]>
Commit | Line | Data |
---|---|---|
acddc0ed | 1 | // SPDX-License-Identifier: GPL-2.0-or-later |
718e3744 | 2 | /* |
508e53e2 | 3 | * Copyright (C) 2003 Yasuhiro Ohara |
718e3744 | 4 | */ |
5 | ||
718e3744 | 6 | #include <zebra.h> |
7 | ||
8 | #include "log.h" | |
508e53e2 | 9 | #include "memory.h" |
24a58196 | 10 | #include "frrevent.h" |
718e3744 | 11 | #include "linklist.h" |
12 | #include "vty.h" | |
13 | #include "command.h" | |
d06cc416 | 14 | #include "lib/bfd.h" |
718e3744 | 15 | |
508e53e2 | 16 | #include "ospf6_proto.h" |
718e3744 | 17 | #include "ospf6_lsa.h" |
508e53e2 | 18 | #include "ospf6_lsdb.h" |
718e3744 | 19 | #include "ospf6_message.h" |
508e53e2 | 20 | #include "ospf6_top.h" |
21 | #include "ospf6_area.h" | |
22 | #include "ospf6_interface.h" | |
718e3744 | 23 | #include "ospf6_neighbor.h" |
508e53e2 | 24 | #include "ospf6_intra.h" |
3b4cd3a9 | 25 | #include "ospf6_flood.h" |
049207c3 | 26 | #include "ospf6d.h" |
7f342629 | 27 | #include "ospf6_bfd.h" |
4dfd8aff DW |
28 | #include "ospf6_abr.h" |
29 | #include "ospf6_asbr.h" | |
30 | #include "ospf6_lsa.h" | |
31 | #include "ospf6_spf.h" | |
32 | #include "ospf6_zebra.h" | |
0d1753a7 | 33 | #include "ospf6_gr.h" |
6a5bb300 | 34 | #include "lib/json.h" |
718e3744 | 35 | |
a526c055 | 36 | DEFINE_MTYPE_STATIC(OSPF6D, OSPF6_NEIGHBOR, "OSPF6 neighbor"); |
30043e4c | 37 | |
3012671f | 38 | DEFINE_HOOK(ospf6_neighbor_change, |
d62a17ae | 39 | (struct ospf6_neighbor * on, int state, int next_state), |
8451921b | 40 | (on, state, next_state)); |
3012671f | 41 | |
508e53e2 | 42 | unsigned char conf_debug_ospf6_neighbor = 0; |
43 | ||
2b64873d | 44 | const char *const ospf6_neighbor_state_str[] = { |
d62a17ae | 45 | "None", "Down", "Attempt", "Init", "Twoway", |
46 | "ExStart", "ExChange", "Loading", "Full", NULL}; | |
718e3744 | 47 | |
2b64873d DL |
48 | const char *const ospf6_neighbor_event_str[] = { |
49 | "NoEvent", "HelloReceived", "2-WayReceived", "NegotiationDone", | |
50 | "ExchangeDone", "LoadingDone", "AdjOK?", "SeqNumberMismatch", | |
51 | "BadLSReq", "1-WayReceived", "InactivityTimer", | |
52 | }; | |
53 | ||
d62a17ae | 54 | int ospf6_neighbor_cmp(void *va, void *vb) |
718e3744 | 55 | { |
d62a17ae | 56 | struct ospf6_neighbor *ona = (struct ospf6_neighbor *)va; |
57 | struct ospf6_neighbor *onb = (struct ospf6_neighbor *)vb; | |
27fa3398 DS |
58 | |
59 | if (ona->router_id == onb->router_id) | |
60 | return 0; | |
61 | ||
62 | return (ntohl(ona->router_id) < ntohl(onb->router_id)) ? -1 : 1; | |
718e3744 | 63 | } |
64 | ||
d7c0a89a | 65 | struct ospf6_neighbor *ospf6_neighbor_lookup(uint32_t router_id, |
d62a17ae | 66 | struct ospf6_interface *oi) |
718e3744 | 67 | { |
d62a17ae | 68 | struct listnode *n; |
69 | struct ospf6_neighbor *on; | |
70 | ||
71 | for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, n, on)) | |
72 | if (on->router_id == router_id) | |
73 | return on; | |
74 | ||
75 | return (struct ospf6_neighbor *)NULL; | |
718e3744 | 76 | } |
77 | ||
71165098 RW |
78 | struct ospf6_neighbor *ospf6_area_neighbor_lookup(struct ospf6_area *area, |
79 | uint32_t router_id) | |
80 | { | |
81 | struct ospf6_interface *oi; | |
82 | struct ospf6_neighbor *nbr; | |
83 | struct listnode *node; | |
84 | ||
85 | for (ALL_LIST_ELEMENTS_RO(area->if_list, node, oi)) { | |
86 | nbr = ospf6_neighbor_lookup(router_id, oi); | |
87 | if (nbr) | |
88 | return nbr; | |
89 | } | |
90 | ||
91 | return NULL; | |
92 | } | |
93 | ||
47cd6348 MN |
94 | static void ospf6_neighbor_clear_ls_lists(struct ospf6_neighbor *on) |
95 | { | |
96 | struct ospf6_lsa *lsa; | |
97 | struct ospf6_lsa *lsanext; | |
98 | ||
99 | ospf6_lsdb_remove_all(on->summary_list); | |
100 | if (on->last_ls_req) { | |
101 | ospf6_lsa_unlock(on->last_ls_req); | |
102 | on->last_ls_req = NULL; | |
103 | } | |
104 | ospf6_lsdb_remove_all(on->request_list); | |
105 | for (ALL_LSDB(on->retrans_list, lsa, lsanext)) { | |
106 | ospf6_decrement_retrans_count(lsa); | |
107 | ospf6_lsdb_remove(lsa, on->retrans_list); | |
108 | } | |
109 | } | |
110 | ||
508e53e2 | 111 | /* create ospf6_neighbor */ |
d7c0a89a | 112 | struct ospf6_neighbor *ospf6_neighbor_create(uint32_t router_id, |
d62a17ae | 113 | struct ospf6_interface *oi) |
718e3744 | 114 | { |
d62a17ae | 115 | struct ospf6_neighbor *on; |
116 | char buf[16]; | |
6cb85350 | 117 | int type; |
d62a17ae | 118 | |
aa406bbc | 119 | on = XCALLOC(MTYPE_OSPF6_NEIGHBOR, sizeof(struct ospf6_neighbor)); |
d62a17ae | 120 | inet_ntop(AF_INET, &router_id, buf, sizeof(buf)); |
121 | snprintf(on->name, sizeof(on->name), "%s%%%s", buf, | |
122 | oi->interface->name); | |
123 | on->ospf6_if = oi; | |
124 | on->state = OSPF6_NEIGHBOR_DOWN; | |
125 | on->state_change = 0; | |
126 | monotime(&on->last_changed); | |
127 | on->router_id = router_id; | |
128 | ||
129 | on->summary_list = ospf6_lsdb_create(on); | |
130 | on->request_list = ospf6_lsdb_create(on); | |
131 | on->retrans_list = ospf6_lsdb_create(on); | |
132 | ||
133 | on->dbdesc_list = ospf6_lsdb_create(on); | |
134 | on->lsupdate_list = ospf6_lsdb_create(on); | |
135 | on->lsack_list = ospf6_lsdb_create(on); | |
136 | ||
6cb85350 AR |
137 | for (type = 0; type < OSPF6_MESSAGE_TYPE_MAX; type++) { |
138 | on->seqnum_l[type] = 0; | |
139 | on->seqnum_h[type] = 0; | |
140 | } | |
141 | ||
142 | on->auth_present = false; | |
143 | ||
d62a17ae | 144 | listnode_add_sort(oi->neighbor_list, on); |
145 | ||
146 | ospf6_bfd_info_nbr_create(oi, on); | |
147 | return on; | |
718e3744 | 148 | } |
149 | ||
d62a17ae | 150 | void ospf6_neighbor_delete(struct ospf6_neighbor *on) |
718e3744 | 151 | { |
47cd6348 | 152 | ospf6_neighbor_clear_ls_lists(on); |
718e3744 | 153 | |
d62a17ae | 154 | ospf6_lsdb_remove_all(on->dbdesc_list); |
155 | ospf6_lsdb_remove_all(on->lsupdate_list); | |
156 | ospf6_lsdb_remove_all(on->lsack_list); | |
508e53e2 | 157 | |
d62a17ae | 158 | ospf6_lsdb_delete(on->summary_list); |
159 | ospf6_lsdb_delete(on->request_list); | |
160 | ospf6_lsdb_delete(on->retrans_list); | |
718e3744 | 161 | |
d62a17ae | 162 | ospf6_lsdb_delete(on->dbdesc_list); |
163 | ospf6_lsdb_delete(on->lsupdate_list); | |
164 | ospf6_lsdb_delete(on->lsack_list); | |
508e53e2 | 165 | |
e16d030c | 166 | EVENT_OFF(on->inactivity_timer); |
508e53e2 | 167 | |
e16d030c | 168 | EVENT_OFF(on->last_dbdesc_release_timer); |
bc09f3e6 | 169 | |
e16d030c DS |
170 | EVENT_OFF(on->thread_send_dbdesc); |
171 | EVENT_OFF(on->thread_send_lsreq); | |
172 | EVENT_OFF(on->thread_send_lsupdate); | |
173 | EVENT_OFF(on->thread_send_lsack); | |
174 | EVENT_OFF(on->thread_exchange_done); | |
175 | EVENT_OFF(on->thread_adj_ok); | |
81e06dd3 | 176 | |
e16d030c | 177 | EVENT_OFF(on->gr_helper_info.t_grace_timer); |
508e53e2 | 178 | |
d06cc416 | 179 | bfd_sess_free(&on->bfd_session); |
d62a17ae | 180 | XFREE(MTYPE_OSPF6_NEIGHBOR, on); |
718e3744 | 181 | } |
182 | ||
d7c0a89a | 183 | static void ospf6_neighbor_state_change(uint8_t next_state, |
d62a17ae | 184 | struct ospf6_neighbor *on, int event) |
718e3744 | 185 | { |
d7c0a89a | 186 | uint8_t prev_state; |
d62a17ae | 187 | |
188 | prev_state = on->state; | |
189 | on->state = next_state; | |
190 | ||
191 | if (prev_state == next_state) | |
192 | return; | |
193 | ||
194 | on->state_change++; | |
195 | monotime(&on->last_changed); | |
196 | ||
197 | /* log */ | |
198 | if (IS_OSPF6_DEBUG_NEIGHBOR(STATE)) { | |
ba427e63 DA |
199 | zlog_debug( |
200 | "Neighbor state change %s (Router-ID: %pI4): [%s]->[%s] (%s)", | |
201 | on->name, &on->router_id, | |
202 | ospf6_neighbor_state_str[prev_state], | |
203 | ospf6_neighbor_state_str[next_state], | |
204 | ospf6_neighbor_event_string(event)); | |
d62a17ae | 205 | } |
206 | ||
207 | /* Optionally notify about adjacency changes */ | |
208 | if (CHECK_FLAG(on->ospf6_if->area->ospf6->config_flags, | |
209 | OSPF6_LOG_ADJACENCY_CHANGES) | |
210 | && (CHECK_FLAG(on->ospf6_if->area->ospf6->config_flags, | |
211 | OSPF6_LOG_ADJACENCY_DETAIL) | |
212 | || (next_state == OSPF6_NEIGHBOR_FULL) | |
213 | || (next_state < prev_state))) | |
ba427e63 DA |
214 | zlog_notice( |
215 | "AdjChg: Nbr %pI4(%s) on %s: %s -> %s (%s)", | |
216 | &on->router_id, | |
217 | vrf_id_to_name(on->ospf6_if->interface->vrf->vrf_id), | |
218 | on->name, ospf6_neighbor_state_str[prev_state], | |
219 | ospf6_neighbor_state_str[next_state], | |
220 | ospf6_neighbor_event_string(event)); | |
d62a17ae | 221 | |
222 | if (prev_state == OSPF6_NEIGHBOR_FULL | |
223 | || next_state == OSPF6_NEIGHBOR_FULL) { | |
0d1753a7 | 224 | if (!OSPF6_GR_IS_ACTIVE_HELPER(on)) { |
225 | OSPF6_ROUTER_LSA_SCHEDULE(on->ospf6_if->area); | |
226 | if (on->ospf6_if->state == OSPF6_INTERFACE_DR) { | |
227 | OSPF6_NETWORK_LSA_SCHEDULE(on->ospf6_if); | |
228 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT( | |
229 | on->ospf6_if); | |
230 | } | |
d62a17ae | 231 | } |
690df177 CS |
232 | if (next_state == OSPF6_NEIGHBOR_FULL) |
233 | on->ospf6_if->area->intra_prefix_originate = 1; | |
234 | ||
0d1753a7 | 235 | if (!OSPF6_GR_IS_ACTIVE_HELPER(on)) |
236 | OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB( | |
237 | on->ospf6_if->area); | |
76249532 | 238 | |
0d1753a7 | 239 | if ((prev_state == OSPF6_NEIGHBOR_LOADING |
240 | || prev_state == OSPF6_NEIGHBOR_EXCHANGE) | |
241 | && next_state == OSPF6_NEIGHBOR_FULL) { | |
76249532 | 242 | OSPF6_AS_EXTERN_LSA_SCHEDULE(on->ospf6_if); |
d6927cf3 | 243 | on->ospf6_if->area->full_nbrs++; |
76249532 | 244 | } |
d6927cf3 CS |
245 | |
246 | if (prev_state == OSPF6_NEIGHBOR_FULL) | |
247 | on->ospf6_if->area->full_nbrs--; | |
d62a17ae | 248 | } |
249 | ||
250 | if ((prev_state == OSPF6_NEIGHBOR_EXCHANGE | |
251 | || prev_state == OSPF6_NEIGHBOR_LOADING) | |
252 | && (next_state != OSPF6_NEIGHBOR_EXCHANGE | |
253 | && next_state != OSPF6_NEIGHBOR_LOADING)) | |
254 | ospf6_maxage_remove(on->ospf6_if->area->ospf6); | |
255 | ||
256 | hook_call(ospf6_neighbor_change, on, next_state, prev_state); | |
257 | ospf6_bfd_trigger_event(on, prev_state, next_state); | |
718e3744 | 258 | } |
259 | ||
508e53e2 | 260 | /* RFC2328 section 10.4 */ |
d62a17ae | 261 | static int need_adjacency(struct ospf6_neighbor *on) |
718e3744 | 262 | { |
d62a17ae | 263 | if (on->ospf6_if->state == OSPF6_INTERFACE_POINTTOPOINT |
264 | || on->ospf6_if->state == OSPF6_INTERFACE_DR | |
265 | || on->ospf6_if->state == OSPF6_INTERFACE_BDR) | |
266 | return 1; | |
718e3744 | 267 | |
d62a17ae | 268 | if (on->ospf6_if->drouter == on->router_id |
269 | || on->ospf6_if->bdrouter == on->router_id) | |
270 | return 1; | |
508e53e2 | 271 | |
d62a17ae | 272 | return 0; |
718e3744 | 273 | } |
274 | ||
e6685141 | 275 | void hello_received(struct event *thread) |
718e3744 | 276 | { |
d62a17ae | 277 | struct ospf6_neighbor *on; |
718e3744 | 278 | |
e16d030c | 279 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 280 | assert(on); |
718e3744 | 281 | |
d62a17ae | 282 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
283 | zlog_debug("Neighbor Event %s: *HelloReceived*", on->name); | |
508e53e2 | 284 | |
d62a17ae | 285 | /* reset Inactivity Timer */ |
e16d030c | 286 | EVENT_OFF(on->inactivity_timer); |
907a2395 DS |
287 | event_add_timer(master, inactivity_timer, on, |
288 | on->ospf6_if->dead_interval, &on->inactivity_timer); | |
508e53e2 | 289 | |
d62a17ae | 290 | if (on->state <= OSPF6_NEIGHBOR_DOWN) |
291 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on, | |
292 | OSPF6_NEIGHBOR_EVENT_HELLO_RCVD); | |
718e3744 | 293 | } |
294 | ||
e6685141 | 295 | void twoway_received(struct event *thread) |
718e3744 | 296 | { |
d62a17ae | 297 | struct ospf6_neighbor *on; |
508e53e2 | 298 | |
e16d030c | 299 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 300 | assert(on); |
508e53e2 | 301 | |
d62a17ae | 302 | if (on->state > OSPF6_NEIGHBOR_INIT) |
cc9f21da | 303 | return; |
508e53e2 | 304 | |
d62a17ae | 305 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
306 | zlog_debug("Neighbor Event %s: *2Way-Received*", on->name); | |
508e53e2 | 307 | |
907a2395 | 308 | event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); |
508e53e2 | 309 | |
d62a17ae | 310 | if (!need_adjacency(on)) { |
311 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on, | |
312 | OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD); | |
cc9f21da | 313 | return; |
d62a17ae | 314 | } |
718e3744 | 315 | |
d62a17ae | 316 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on, |
317 | OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD); | |
318 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT); | |
319 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); | |
320 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); | |
508e53e2 | 321 | |
e16d030c | 322 | EVENT_OFF(on->thread_send_dbdesc); |
907a2395 DS |
323 | event_add_event(master, ospf6_dbdesc_send, on, 0, |
324 | &on->thread_send_dbdesc); | |
718e3744 | 325 | } |
326 | ||
e6685141 | 327 | void negotiation_done(struct event *thread) |
718e3744 | 328 | { |
d62a17ae | 329 | struct ospf6_neighbor *on; |
2e37407f | 330 | struct ospf6_lsa *lsa, *lsanext; |
d62a17ae | 331 | |
e16d030c | 332 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 333 | assert(on); |
334 | ||
335 | if (on->state != OSPF6_NEIGHBOR_EXSTART) | |
cc9f21da | 336 | return; |
d62a17ae | 337 | |
338 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) | |
339 | zlog_debug("Neighbor Event %s: *NegotiationDone*", on->name); | |
340 | ||
341 | /* clear ls-list */ | |
47cd6348 | 342 | ospf6_neighbor_clear_ls_lists(on); |
d62a17ae | 343 | |
344 | /* Interface scoped LSAs */ | |
2e37407f | 345 | for (ALL_LSDB(on->ospf6_if->lsdb, lsa, lsanext)) { |
d62a17ae | 346 | if (OSPF6_LSA_IS_MAXAGE(lsa)) { |
347 | ospf6_increment_retrans_count(lsa); | |
348 | ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list); | |
349 | } else | |
350 | ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->summary_list); | |
351 | } | |
352 | ||
353 | /* Area scoped LSAs */ | |
2e37407f | 354 | for (ALL_LSDB(on->ospf6_if->area->lsdb, lsa, lsanext)) { |
d62a17ae | 355 | if (OSPF6_LSA_IS_MAXAGE(lsa)) { |
356 | ospf6_increment_retrans_count(lsa); | |
357 | ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list); | |
358 | } else | |
359 | ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->summary_list); | |
360 | } | |
361 | ||
362 | /* AS scoped LSAs */ | |
2e37407f | 363 | for (ALL_LSDB(on->ospf6_if->area->ospf6->lsdb, lsa, lsanext)) { |
d62a17ae | 364 | if (OSPF6_LSA_IS_MAXAGE(lsa)) { |
365 | ospf6_increment_retrans_count(lsa); | |
366 | ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->retrans_list); | |
367 | } else | |
368 | ospf6_lsdb_add(ospf6_lsa_copy(lsa), on->summary_list); | |
369 | } | |
370 | ||
371 | UNSET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); | |
372 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXCHANGE, on, | |
373 | OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE); | |
718e3744 | 374 | } |
375 | ||
e6685141 | 376 | static void ospf6_neighbor_last_dbdesc_release(struct event *thread) |
bc09f3e6 | 377 | { |
e16d030c | 378 | struct ospf6_neighbor *on = EVENT_ARG(thread); |
bc09f3e6 YR |
379 | |
380 | assert(on); | |
381 | memset(&on->dbdesc_last, 0, sizeof(struct ospf6_dbdesc)); | |
bc09f3e6 YR |
382 | } |
383 | ||
e6685141 | 384 | void exchange_done(struct event *thread) |
718e3744 | 385 | { |
d62a17ae | 386 | struct ospf6_neighbor *on; |
718e3744 | 387 | |
e16d030c | 388 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 389 | assert(on); |
508e53e2 | 390 | |
d62a17ae | 391 | if (on->state != OSPF6_NEIGHBOR_EXCHANGE) |
cc9f21da | 392 | return; |
508e53e2 | 393 | |
d62a17ae | 394 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
395 | zlog_debug("Neighbor Event %s: *ExchangeDone*", on->name); | |
508e53e2 | 396 | |
e16d030c | 397 | EVENT_OFF(on->thread_send_dbdesc); |
d62a17ae | 398 | ospf6_lsdb_remove_all(on->dbdesc_list); |
508e53e2 | 399 | |
bc09f3e6 YR |
400 | /* RFC 2328 (10.8): Release the last dbdesc after dead_interval */ |
401 | if (!CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT)) { | |
e16d030c | 402 | EVENT_OFF(on->last_dbdesc_release_timer); |
907a2395 DS |
403 | event_add_timer(master, ospf6_neighbor_last_dbdesc_release, on, |
404 | on->ospf6_if->dead_interval, | |
405 | &on->last_dbdesc_release_timer); | |
bc09f3e6 | 406 | } |
508e53e2 | 407 | |
d62a17ae | 408 | if (on->request_list->count == 0) |
409 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_FULL, on, | |
410 | OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE); | |
411 | else { | |
412 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_LOADING, on, | |
413 | OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE); | |
eb82e9ee | 414 | |
907a2395 DS |
415 | event_add_event(master, ospf6_lsreq_send, on, 0, |
416 | &on->thread_send_lsreq); | |
d62a17ae | 417 | } |
508e53e2 | 418 | } |
419 | ||
eb82e9ee | 420 | /* Check loading state. */ |
d62a17ae | 421 | void ospf6_check_nbr_loading(struct ospf6_neighbor *on) |
eb82e9ee DD |
422 | { |
423 | ||
d62a17ae | 424 | /* RFC2328 Section 10.9: When the neighbor responds to these requests |
425 | with the proper Link State Update packet(s), the Link state request | |
426 | list is truncated and a new Link State Request packet is sent. | |
427 | */ | |
428 | if ((on->state == OSPF6_NEIGHBOR_LOADING) | |
429 | || (on->state == OSPF6_NEIGHBOR_EXCHANGE)) { | |
430 | if (on->request_list->count == 0) | |
907a2395 | 431 | event_add_event(master, loading_done, on, 0, NULL); |
d62a17ae | 432 | else if (on->last_ls_req == NULL) { |
e16d030c | 433 | EVENT_OFF(on->thread_send_lsreq); |
907a2395 DS |
434 | event_add_event(master, ospf6_lsreq_send, on, 0, |
435 | &on->thread_send_lsreq); | |
d62a17ae | 436 | } |
eb82e9ee | 437 | } |
eb82e9ee DD |
438 | } |
439 | ||
e6685141 | 440 | void loading_done(struct event *thread) |
508e53e2 | 441 | { |
d62a17ae | 442 | struct ospf6_neighbor *on; |
508e53e2 | 443 | |
e16d030c | 444 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 445 | assert(on); |
508e53e2 | 446 | |
d62a17ae | 447 | if (on->state != OSPF6_NEIGHBOR_LOADING) |
cc9f21da | 448 | return; |
508e53e2 | 449 | |
d62a17ae | 450 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
451 | zlog_debug("Neighbor Event %s: *LoadingDone*", on->name); | |
508e53e2 | 452 | |
d62a17ae | 453 | assert(on->request_list->count == 0); |
508e53e2 | 454 | |
d62a17ae | 455 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_FULL, on, |
456 | OSPF6_NEIGHBOR_EVENT_LOADING_DONE); | |
508e53e2 | 457 | } |
458 | ||
e6685141 | 459 | void adj_ok(struct event *thread) |
508e53e2 | 460 | { |
d62a17ae | 461 | struct ospf6_neighbor *on; |
d62a17ae | 462 | |
e16d030c | 463 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 464 | assert(on); |
465 | ||
466 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) | |
467 | zlog_debug("Neighbor Event %s: *AdjOK?*", on->name); | |
468 | ||
469 | if (on->state == OSPF6_NEIGHBOR_TWOWAY && need_adjacency(on)) { | |
470 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on, | |
471 | OSPF6_NEIGHBOR_EVENT_ADJ_OK); | |
472 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT); | |
473 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); | |
474 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); | |
475 | ||
e16d030c | 476 | EVENT_OFF(on->thread_send_dbdesc); |
907a2395 DS |
477 | event_add_event(master, ospf6_dbdesc_send, on, 0, |
478 | &on->thread_send_dbdesc); | |
d62a17ae | 479 | |
480 | } else if (on->state >= OSPF6_NEIGHBOR_EXSTART && !need_adjacency(on)) { | |
481 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY, on, | |
482 | OSPF6_NEIGHBOR_EVENT_ADJ_OK); | |
47cd6348 | 483 | ospf6_neighbor_clear_ls_lists(on); |
d62a17ae | 484 | } |
508e53e2 | 485 | } |
718e3744 | 486 | |
e6685141 | 487 | void seqnumber_mismatch(struct event *thread) |
508e53e2 | 488 | { |
d62a17ae | 489 | struct ospf6_neighbor *on; |
718e3744 | 490 | |
e16d030c | 491 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 492 | assert(on); |
718e3744 | 493 | |
d62a17ae | 494 | if (on->state < OSPF6_NEIGHBOR_EXCHANGE) |
cc9f21da | 495 | return; |
718e3744 | 496 | |
d62a17ae | 497 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
498 | zlog_debug("Neighbor Event %s: *SeqNumberMismatch*", on->name); | |
718e3744 | 499 | |
d62a17ae | 500 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on, |
501 | OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH); | |
502 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT); | |
503 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); | |
504 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); | |
718e3744 | 505 | |
47cd6348 | 506 | ospf6_neighbor_clear_ls_lists(on); |
508e53e2 | 507 | |
e16d030c | 508 | EVENT_OFF(on->thread_send_dbdesc); |
d62a17ae | 509 | on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ |
931b1b8c | 510 | |
907a2395 DS |
511 | event_add_event(master, ospf6_dbdesc_send, on, 0, |
512 | &on->thread_send_dbdesc); | |
718e3744 | 513 | } |
514 | ||
e6685141 | 515 | void bad_lsreq(struct event *thread) |
718e3744 | 516 | { |
d62a17ae | 517 | struct ospf6_neighbor *on; |
508e53e2 | 518 | |
e16d030c | 519 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 520 | assert(on); |
508e53e2 | 521 | |
d62a17ae | 522 | if (on->state < OSPF6_NEIGHBOR_EXCHANGE) |
cc9f21da | 523 | return; |
718e3744 | 524 | |
d62a17ae | 525 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
526 | zlog_debug("Neighbor Event %s: *BadLSReq*", on->name); | |
718e3744 | 527 | |
d62a17ae | 528 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART, on, |
529 | OSPF6_NEIGHBOR_EVENT_BAD_LSREQ); | |
530 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT); | |
531 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT); | |
532 | SET_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT); | |
718e3744 | 533 | |
47cd6348 | 534 | ospf6_neighbor_clear_ls_lists(on); |
718e3744 | 535 | |
e16d030c | 536 | EVENT_OFF(on->thread_send_dbdesc); |
d62a17ae | 537 | on->dbdesc_seqnum++; /* Incr seqnum as per RFC2328, sec 10.3 */ |
931b1b8c | 538 | |
907a2395 DS |
539 | event_add_event(master, ospf6_dbdesc_send, on, 0, |
540 | &on->thread_send_dbdesc); | |
718e3744 | 541 | } |
542 | ||
e6685141 | 543 | void oneway_received(struct event *thread) |
718e3744 | 544 | { |
d62a17ae | 545 | struct ospf6_neighbor *on; |
718e3744 | 546 | |
e16d030c | 547 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 548 | assert(on); |
508e53e2 | 549 | |
d62a17ae | 550 | if (on->state < OSPF6_NEIGHBOR_TWOWAY) |
cc9f21da | 551 | return; |
508e53e2 | 552 | |
d62a17ae | 553 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
554 | zlog_debug("Neighbor Event %s: *1Way-Received*", on->name); | |
508e53e2 | 555 | |
d62a17ae | 556 | ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT, on, |
557 | OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD); | |
907a2395 | 558 | event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); |
508e53e2 | 559 | |
47cd6348 | 560 | ospf6_neighbor_clear_ls_lists(on); |
508e53e2 | 561 | |
e16d030c DS |
562 | EVENT_OFF(on->thread_send_dbdesc); |
563 | EVENT_OFF(on->thread_send_lsreq); | |
564 | EVENT_OFF(on->thread_send_lsupdate); | |
565 | EVENT_OFF(on->thread_send_lsack); | |
566 | EVENT_OFF(on->thread_exchange_done); | |
567 | EVENT_OFF(on->thread_adj_ok); | |
508e53e2 | 568 | } |
569 | ||
e6685141 | 570 | void inactivity_timer(struct event *thread) |
508e53e2 | 571 | { |
d62a17ae | 572 | struct ospf6_neighbor *on; |
508e53e2 | 573 | |
e16d030c | 574 | on = (struct ospf6_neighbor *)EVENT_ARG(thread); |
d62a17ae | 575 | assert(on); |
508e53e2 | 576 | |
d62a17ae | 577 | if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
578 | zlog_debug("Neighbor Event %s: *InactivityTimer*", on->name); | |
508e53e2 | 579 | |
d62a17ae | 580 | on->drouter = on->prev_drouter = 0; |
581 | on->bdrouter = on->prev_bdrouter = 0; | |
508e53e2 | 582 | |
0d1753a7 | 583 | if (!OSPF6_GR_IS_ACTIVE_HELPER(on)) { |
584 | on->drouter = on->prev_drouter = 0; | |
585 | on->bdrouter = on->prev_bdrouter = 0; | |
586 | ||
587 | ospf6_neighbor_state_change( | |
588 | OSPF6_NEIGHBOR_DOWN, on, | |
589 | OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER); | |
907a2395 | 590 | event_add_event(master, neighbor_change, on->ospf6_if, 0, NULL); |
0d1753a7 | 591 | |
592 | listnode_delete(on->ospf6_if->neighbor_list, on); | |
593 | ospf6_neighbor_delete(on); | |
508e53e2 | 594 | |
0d1753a7 | 595 | } else { |
0fc3e113 | 596 | if (IS_DEBUG_OSPF6_GR) |
0d1753a7 | 597 | zlog_debug( |
598 | "%s, Acting as HELPER for this neighbour, So restart the dead timer.", | |
599 | __PRETTY_FUNCTION__); | |
600 | ||
907a2395 DS |
601 | event_add_timer(master, inactivity_timer, on, |
602 | on->ospf6_if->dead_interval, | |
603 | &on->inactivity_timer); | |
0d1753a7 | 604 | } |
718e3744 | 605 | } |
606 | ||
508e53e2 | 607 | |
718e3744 | 608 | /* vty functions */ |
609 | /* show neighbor structure */ | |
6a5bb300 | 610 | static void ospf6_neighbor_show(struct vty *vty, struct ospf6_neighbor *on, |
611 | json_object *json_array, bool use_json) | |
718e3744 | 612 | { |
d62a17ae | 613 | char router_id[16]; |
68bfcc05 | 614 | char duration[64]; |
d62a17ae | 615 | struct timeval res; |
616 | char nstate[16]; | |
68bfcc05 | 617 | char deadtime[64]; |
d62a17ae | 618 | long h, m, s; |
6a5bb300 | 619 | json_object *json_route; |
d62a17ae | 620 | |
621 | /* Router-ID (Name) */ | |
622 | inet_ntop(AF_INET, &on->router_id, router_id, sizeof(router_id)); | |
508e53e2 | 623 | #ifdef HAVE_GETNAMEINFO |
d62a17ae | 624 | { |
625 | } | |
508e53e2 | 626 | #endif /*HAVE_GETNAMEINFO*/ |
627 | ||
d62a17ae | 628 | /* Dead time */ |
629 | h = m = s = 0; | |
630 | if (on->inactivity_timer) { | |
631 | s = monotime_until(&on->inactivity_timer->u.sands, NULL) | |
632 | / 1000000LL; | |
633 | h = s / 3600; | |
634 | s -= h * 3600; | |
635 | m = s / 60; | |
636 | s -= m * 60; | |
637 | } | |
638 | snprintf(deadtime, sizeof(deadtime), "%02ld:%02ld:%02ld", h, m, s); | |
639 | ||
640 | /* Neighbor State */ | |
e5973353 | 641 | if (on->ospf6_if->type == OSPF_IFTYPE_POINTOPOINT) |
d62a17ae | 642 | snprintf(nstate, sizeof(nstate), "PointToPoint"); |
643 | else { | |
644 | if (on->router_id == on->drouter) | |
645 | snprintf(nstate, sizeof(nstate), "DR"); | |
646 | else if (on->router_id == on->bdrouter) | |
647 | snprintf(nstate, sizeof(nstate), "BDR"); | |
648 | else | |
649 | snprintf(nstate, sizeof(nstate), "DROther"); | |
650 | } | |
651 | ||
652 | /* Duration */ | |
653 | monotime_since(&on->last_changed, &res); | |
654 | timerstring(&res, duration, sizeof(duration)); | |
655 | ||
656 | /* | |
657 | vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]\n", | |
6a5bb300 | 658 | "Neighbor ID", "Pri", "DeadTime", "State", "IfState", |
659 | "Duration", "I/F", "State"); | |
d62a17ae | 660 | */ |
6a5bb300 | 661 | if (use_json) { |
662 | json_route = json_object_new_object(); | |
663 | ||
664 | json_object_string_add(json_route, "neighborId", router_id); | |
665 | json_object_int_add(json_route, "priority", on->priority); | |
666 | json_object_string_add(json_route, "deadTime", deadtime); | |
667 | json_object_string_add(json_route, "state", | |
668 | ospf6_neighbor_state_str[on->state]); | |
669 | json_object_string_add(json_route, "ifState", nstate); | |
670 | json_object_string_add(json_route, "duration", duration); | |
671 | json_object_string_add(json_route, "interfaceName", | |
672 | on->ospf6_if->interface->name); | |
673 | json_object_string_add( | |
674 | json_route, "interfaceState", | |
675 | ospf6_interface_state_str[on->ospf6_if->state]); | |
676 | ||
677 | json_object_array_add(json_array, json_route); | |
678 | } else | |
679 | vty_out(vty, "%-15s %3d %11s %8s/%-12s %11s %s[%s]\n", | |
680 | router_id, on->priority, deadtime, | |
681 | ospf6_neighbor_state_str[on->state], nstate, duration, | |
682 | on->ospf6_if->interface->name, | |
683 | ospf6_interface_state_str[on->ospf6_if->state]); | |
508e53e2 | 684 | } |
685 | ||
d62a17ae | 686 | static void ospf6_neighbor_show_drchoice(struct vty *vty, |
6a5bb300 | 687 | struct ospf6_neighbor *on, |
688 | json_object *json_array, bool use_json) | |
508e53e2 | 689 | { |
d62a17ae | 690 | char router_id[16]; |
691 | char drouter[16], bdrouter[16]; | |
68bfcc05 | 692 | char duration[64]; |
d62a17ae | 693 | struct timeval now, res; |
6a5bb300 | 694 | json_object *json_route; |
d62a17ae | 695 | |
696 | /* | |
697 | vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]\n", | |
698 | "RouterID", "State", "Duration", "DR", "BDR", "I/F", | |
699 | "State"); | |
700 | */ | |
701 | ||
702 | inet_ntop(AF_INET, &on->router_id, router_id, sizeof(router_id)); | |
703 | inet_ntop(AF_INET, &on->drouter, drouter, sizeof(drouter)); | |
704 | inet_ntop(AF_INET, &on->bdrouter, bdrouter, sizeof(bdrouter)); | |
705 | ||
706 | monotime(&now); | |
707 | timersub(&now, &on->last_changed, &res); | |
708 | timerstring(&res, duration, sizeof(duration)); | |
709 | ||
6a5bb300 | 710 | if (use_json) { |
711 | json_route = json_object_new_object(); | |
712 | json_object_string_add(json_route, "routerId", router_id); | |
713 | json_object_string_add(json_route, "state", | |
714 | ospf6_neighbor_state_str[on->state]); | |
715 | json_object_string_add(json_route, "duration", duration); | |
716 | json_object_string_add(json_route, "dRouter", drouter); | |
717 | json_object_string_add(json_route, "bdRouter", bdrouter); | |
718 | json_object_string_add(json_route, "interfaceName", | |
719 | on->ospf6_if->interface->name); | |
720 | json_object_string_add( | |
721 | json_route, "interfaceState", | |
722 | ospf6_interface_state_str[on->ospf6_if->state]); | |
723 | ||
724 | json_object_array_add(json_array, json_route); | |
725 | } else | |
726 | vty_out(vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", router_id, | |
727 | ospf6_neighbor_state_str[on->state], duration, drouter, | |
728 | bdrouter, on->ospf6_if->interface->name, | |
729 | ospf6_interface_state_str[on->ospf6_if->state]); | |
718e3744 | 730 | } |
731 | ||
d62a17ae | 732 | static void ospf6_neighbor_show_detail(struct vty *vty, |
6a5bb300 | 733 | struct ospf6_neighbor *on, |
734 | json_object *json, bool use_json) | |
718e3744 | 735 | { |
d62a17ae | 736 | char drouter[16], bdrouter[16]; |
737 | char linklocal_addr[64], duration[32]; | |
738 | struct timeval now, res; | |
2e37407f | 739 | struct ospf6_lsa *lsa, *lsanext; |
6a5bb300 | 740 | json_object *json_neighbor; |
741 | json_object *json_array; | |
742 | char db_desc_str[20]; | |
d62a17ae | 743 | |
744 | inet_ntop(AF_INET6, &on->linklocal_addr, linklocal_addr, | |
745 | sizeof(linklocal_addr)); | |
746 | inet_ntop(AF_INET, &on->drouter, drouter, sizeof(drouter)); | |
747 | inet_ntop(AF_INET, &on->bdrouter, bdrouter, sizeof(bdrouter)); | |
748 | ||
749 | monotime(&now); | |
750 | timersub(&now, &on->last_changed, &res); | |
751 | timerstring(&res, duration, sizeof(duration)); | |
752 | ||
6a5bb300 | 753 | if (use_json) { |
754 | json_neighbor = json_object_new_object(); | |
755 | json_object_string_add(json_neighbor, "area", | |
756 | on->ospf6_if->area->name); | |
757 | json_object_string_add(json_neighbor, "interface", | |
758 | on->ospf6_if->interface->name); | |
759 | json_object_int_add(json_neighbor, "interfaceIndex", | |
760 | on->ospf6_if->interface->ifindex); | |
761 | json_object_int_add(json_neighbor, "neighborInterfaceIndex", | |
762 | on->ifindex); | |
763 | json_object_string_add(json_neighbor, "linkLocalAddress", | |
764 | linklocal_addr); | |
765 | json_object_string_add(json_neighbor, "neighborState", | |
766 | ospf6_neighbor_state_str[on->state]); | |
767 | json_object_string_add(json_neighbor, "neighborStateDuration", | |
768 | duration); | |
769 | json_object_string_add(json_neighbor, "neighborDRouter", | |
770 | drouter); | |
771 | json_object_string_add(json_neighbor, "neighborBdRouter", | |
772 | bdrouter); | |
773 | snprintf(db_desc_str, sizeof(db_desc_str), "%s%s%s", | |
774 | (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT) | |
775 | ? "Initial " | |
776 | : ""), | |
777 | (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) | |
778 | ? "More" | |
779 | : ""), | |
780 | (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) | |
781 | ? "Master" | |
782 | : "Slave")); | |
783 | json_object_string_add(json_neighbor, "dbDescStatus", | |
784 | db_desc_str); | |
785 | ||
786 | json_object_int_add(json_neighbor, "dbDescSeqNumber", | |
787 | (unsigned long)ntohl(on->dbdesc_seqnum)); | |
788 | ||
789 | json_array = json_object_new_array(); | |
790 | json_object_int_add(json_neighbor, "summaryListCount", | |
791 | on->summary_list->count); | |
792 | for (ALL_LSDB(on->summary_list, lsa, lsanext)) | |
793 | json_object_array_add( | |
794 | json_array, json_object_new_string(lsa->name)); | |
795 | json_object_object_add(json_neighbor, "summaryListLsa", | |
796 | json_array); | |
797 | ||
798 | json_array = json_object_new_array(); | |
799 | json_object_int_add(json_neighbor, "requestListCount", | |
800 | on->request_list->count); | |
801 | for (ALL_LSDB(on->request_list, lsa, lsanext)) | |
802 | json_object_array_add( | |
803 | json_array, json_object_new_string(lsa->name)); | |
804 | json_object_object_add(json_neighbor, "requestListLsa", | |
805 | json_array); | |
806 | ||
807 | json_array = json_object_new_array(); | |
808 | json_object_int_add(json_neighbor, "reTransListCount", | |
809 | on->retrans_list->count); | |
810 | for (ALL_LSDB(on->retrans_list, lsa, lsanext)) | |
811 | json_object_array_add( | |
812 | json_array, json_object_new_string(lsa->name)); | |
813 | json_object_object_add(json_neighbor, "reTransListLsa", | |
814 | json_array); | |
815 | ||
816 | ||
817 | timerclear(&res); | |
5f6eaa9b | 818 | if (event_is_scheduled(on->thread_send_dbdesc)) |
6a5bb300 | 819 | timersub(&on->thread_send_dbdesc->u.sands, &now, &res); |
820 | timerstring(&res, duration, sizeof(duration)); | |
821 | json_object_int_add(json_neighbor, "pendingLsaDbDescCount", | |
822 | on->dbdesc_list->count); | |
823 | json_object_string_add(json_neighbor, "pendingLsaDbDescTime", | |
824 | duration); | |
c905f04c DS |
825 | json_object_string_add( |
826 | json_neighbor, "dbDescSendThread", | |
5f6eaa9b DS |
827 | (event_is_scheduled(on->thread_send_dbdesc) ? "on" |
828 | : "off")); | |
6a5bb300 | 829 | json_array = json_object_new_array(); |
830 | for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) | |
831 | json_object_array_add( | |
832 | json_array, json_object_new_string(lsa->name)); | |
833 | json_object_object_add(json_neighbor, "pendingLsaDbDesc", | |
834 | json_array); | |
835 | ||
836 | timerclear(&res); | |
5f6eaa9b | 837 | if (event_is_scheduled(on->thread_send_lsreq)) |
6a5bb300 | 838 | timersub(&on->thread_send_lsreq->u.sands, &now, &res); |
839 | timerstring(&res, duration, sizeof(duration)); | |
840 | json_object_int_add(json_neighbor, "pendingLsaLsReqCount", | |
841 | on->request_list->count); | |
842 | json_object_string_add(json_neighbor, "pendingLsaLsReqTime", | |
843 | duration); | |
c905f04c DS |
844 | json_object_string_add( |
845 | json_neighbor, "lsReqSendThread", | |
5f6eaa9b DS |
846 | (event_is_scheduled(on->thread_send_lsreq) ? "on" |
847 | : "off")); | |
6a5bb300 | 848 | json_array = json_object_new_array(); |
849 | for (ALL_LSDB(on->request_list, lsa, lsanext)) | |
850 | json_object_array_add( | |
851 | json_array, json_object_new_string(lsa->name)); | |
852 | json_object_object_add(json_neighbor, "pendingLsaLsReq", | |
853 | json_array); | |
854 | ||
855 | ||
856 | timerclear(&res); | |
5f6eaa9b | 857 | if (event_is_scheduled(on->thread_send_lsupdate)) |
6a5bb300 | 858 | timersub(&on->thread_send_lsupdate->u.sands, &now, |
859 | &res); | |
860 | timerstring(&res, duration, sizeof(duration)); | |
861 | json_object_int_add(json_neighbor, "pendingLsaLsUpdateCount", | |
862 | on->lsupdate_list->count); | |
863 | json_object_string_add(json_neighbor, "pendingLsaLsUpdateTime", | |
864 | duration); | |
865 | json_object_string_add( | |
866 | json_neighbor, "lsUpdateSendThread", | |
5f6eaa9b DS |
867 | (event_is_scheduled(on->thread_send_lsupdate) ? "on" |
868 | : "off")); | |
6a5bb300 | 869 | json_array = json_object_new_array(); |
870 | for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) | |
871 | json_object_array_add( | |
872 | json_array, json_object_new_string(lsa->name)); | |
873 | json_object_object_add(json_neighbor, "pendingLsaLsUpdate", | |
874 | json_array); | |
875 | ||
876 | timerclear(&res); | |
5f6eaa9b | 877 | if (event_is_scheduled(on->thread_send_lsack)) |
6a5bb300 | 878 | timersub(&on->thread_send_lsack->u.sands, &now, &res); |
879 | timerstring(&res, duration, sizeof(duration)); | |
880 | json_object_int_add(json_neighbor, "pendingLsaLsAckCount", | |
881 | on->lsack_list->count); | |
882 | json_object_string_add(json_neighbor, "pendingLsaLsAckTime", | |
883 | duration); | |
c905f04c DS |
884 | json_object_string_add( |
885 | json_neighbor, "lsAckSendThread", | |
5f6eaa9b DS |
886 | (event_is_scheduled(on->thread_send_lsack) ? "on" |
887 | : "off")); | |
6a5bb300 | 888 | json_array = json_object_new_array(); |
889 | for (ALL_LSDB(on->lsack_list, lsa, lsanext)) | |
890 | json_object_array_add( | |
891 | json_array, json_object_new_string(lsa->name)); | |
892 | json_object_object_add(json_neighbor, "pendingLsaLsAck", | |
893 | json_array); | |
894 | ||
d06cc416 | 895 | bfd_sess_show(vty, json_neighbor, on->bfd_session); |
6a5bb300 | 896 | |
6cb85350 AR |
897 | if (on->auth_present == true) { |
898 | json_object_string_add(json_neighbor, "authStatus", | |
899 | "enabled"); | |
900 | json_object_int_add( | |
901 | json_neighbor, "recvdHelloHigherSeqNo", | |
902 | on->seqnum_h[OSPF6_MESSAGE_TYPE_HELLO]); | |
903 | json_object_int_add( | |
904 | json_neighbor, "recvdHelloLowerSeqNo", | |
905 | on->seqnum_l[OSPF6_MESSAGE_TYPE_HELLO]); | |
906 | json_object_int_add( | |
907 | json_neighbor, "recvdDBDescHigherSeqNo", | |
908 | on->seqnum_h[OSPF6_MESSAGE_TYPE_DBDESC]); | |
909 | json_object_int_add( | |
910 | json_neighbor, "recvdDBDescLowerSeqNo", | |
911 | on->seqnum_l[OSPF6_MESSAGE_TYPE_DBDESC]); | |
912 | json_object_int_add( | |
913 | json_neighbor, "recvdLSReqHigherSeqNo", | |
914 | on->seqnum_h[OSPF6_MESSAGE_TYPE_LSREQ]); | |
915 | json_object_int_add( | |
916 | json_neighbor, "recvdLSReqLowerSeqNo", | |
917 | on->seqnum_l[OSPF6_MESSAGE_TYPE_LSREQ]); | |
918 | json_object_int_add( | |
919 | json_neighbor, "recvdLSUpdHigherSeqNo", | |
920 | on->seqnum_h[OSPF6_MESSAGE_TYPE_LSUPDATE]); | |
921 | json_object_int_add( | |
922 | json_neighbor, "recvdLSUpdLowerSeqNo", | |
923 | on->seqnum_l[OSPF6_MESSAGE_TYPE_LSUPDATE]); | |
924 | json_object_int_add( | |
925 | json_neighbor, "recvdLSAckHigherSeqNo", | |
926 | on->seqnum_h[OSPF6_MESSAGE_TYPE_LSACK]); | |
927 | json_object_int_add( | |
928 | json_neighbor, "recvdLSAckLowerSeqNo", | |
929 | on->seqnum_l[OSPF6_MESSAGE_TYPE_LSACK]); | |
930 | } else | |
931 | json_object_string_add(json_neighbor, "authStatus", | |
932 | "disabled"); | |
6a5bb300 | 933 | |
6cb85350 | 934 | json_object_object_add(json, on->name, json_neighbor); |
6a5bb300 | 935 | |
936 | } else { | |
937 | vty_out(vty, " Neighbor %s\n", on->name); | |
938 | vty_out(vty, " Area %s via interface %s (ifindex %d)\n", | |
939 | on->ospf6_if->area->name, on->ospf6_if->interface->name, | |
940 | on->ospf6_if->interface->ifindex); | |
941 | vty_out(vty, " His IfIndex: %d Link-local address: %s\n", | |
942 | on->ifindex, linklocal_addr); | |
943 | vty_out(vty, " State %s for a duration of %s\n", | |
944 | ospf6_neighbor_state_str[on->state], duration); | |
945 | vty_out(vty, " His choice of DR/BDR %s/%s, Priority %d\n", | |
946 | drouter, bdrouter, on->priority); | |
947 | vty_out(vty, " DbDesc status: %s%s%s SeqNum: %#lx\n", | |
948 | (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_IBIT) | |
949 | ? "Initial " | |
950 | : ""), | |
951 | (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MBIT) | |
952 | ? "More " | |
953 | : ""), | |
954 | (CHECK_FLAG(on->dbdesc_bits, OSPF6_DBDESC_MSBIT) | |
955 | ? "Master" | |
956 | : "Slave"), | |
957 | (unsigned long)ntohl(on->dbdesc_seqnum)); | |
958 | ||
959 | vty_out(vty, " Summary-List: %d LSAs\n", | |
960 | on->summary_list->count); | |
961 | for (ALL_LSDB(on->summary_list, lsa, lsanext)) | |
962 | vty_out(vty, " %s\n", lsa->name); | |
963 | ||
964 | vty_out(vty, " Request-List: %d LSAs\n", | |
965 | on->request_list->count); | |
966 | for (ALL_LSDB(on->request_list, lsa, lsanext)) | |
967 | vty_out(vty, " %s\n", lsa->name); | |
968 | ||
969 | vty_out(vty, " Retrans-List: %d LSAs\n", | |
970 | on->retrans_list->count); | |
971 | for (ALL_LSDB(on->retrans_list, lsa, lsanext)) | |
972 | vty_out(vty, " %s\n", lsa->name); | |
973 | ||
974 | timerclear(&res); | |
5f6eaa9b | 975 | if (event_is_scheduled(on->thread_send_dbdesc)) |
6a5bb300 | 976 | timersub(&on->thread_send_dbdesc->u.sands, &now, &res); |
977 | timerstring(&res, duration, sizeof(duration)); | |
978 | vty_out(vty, | |
979 | " %d Pending LSAs for DbDesc in Time %s [thread %s]\n", | |
980 | on->dbdesc_list->count, duration, | |
5f6eaa9b DS |
981 | (event_is_scheduled(on->thread_send_dbdesc) ? "on" |
982 | : "off")); | |
6a5bb300 | 983 | for (ALL_LSDB(on->dbdesc_list, lsa, lsanext)) |
984 | vty_out(vty, " %s\n", lsa->name); | |
985 | ||
986 | timerclear(&res); | |
5f6eaa9b | 987 | if (event_is_scheduled(on->thread_send_lsreq)) |
6a5bb300 | 988 | timersub(&on->thread_send_lsreq->u.sands, &now, &res); |
989 | timerstring(&res, duration, sizeof(duration)); | |
990 | vty_out(vty, | |
991 | " %d Pending LSAs for LSReq in Time %s [thread %s]\n", | |
992 | on->request_list->count, duration, | |
5f6eaa9b DS |
993 | (event_is_scheduled(on->thread_send_lsreq) ? "on" |
994 | : "off")); | |
6a5bb300 | 995 | for (ALL_LSDB(on->request_list, lsa, lsanext)) |
996 | vty_out(vty, " %s\n", lsa->name); | |
997 | ||
998 | timerclear(&res); | |
5f6eaa9b | 999 | if (event_is_scheduled(on->thread_send_lsupdate)) |
6a5bb300 | 1000 | timersub(&on->thread_send_lsupdate->u.sands, &now, |
1001 | &res); | |
1002 | timerstring(&res, duration, sizeof(duration)); | |
1003 | vty_out(vty, | |
1004 | " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n", | |
1005 | on->lsupdate_list->count, duration, | |
5f6eaa9b DS |
1006 | (event_is_scheduled(on->thread_send_lsupdate) ? "on" |
1007 | : "off")); | |
6a5bb300 | 1008 | for (ALL_LSDB(on->lsupdate_list, lsa, lsanext)) |
1009 | vty_out(vty, " %s\n", lsa->name); | |
1010 | ||
1011 | timerclear(&res); | |
5f6eaa9b | 1012 | if (event_is_scheduled(on->thread_send_lsack)) |
6a5bb300 | 1013 | timersub(&on->thread_send_lsack->u.sands, &now, &res); |
1014 | timerstring(&res, duration, sizeof(duration)); | |
1015 | vty_out(vty, | |
1016 | " %d Pending LSAs for LSAck in Time %s [thread %s]\n", | |
1017 | on->lsack_list->count, duration, | |
5f6eaa9b DS |
1018 | (event_is_scheduled(on->thread_send_lsack) ? "on" |
1019 | : "off")); | |
6a5bb300 | 1020 | for (ALL_LSDB(on->lsack_list, lsa, lsanext)) |
1021 | vty_out(vty, " %s\n", lsa->name); | |
1022 | ||
d06cc416 | 1023 | bfd_sess_show(vty, NULL, on->bfd_session); |
6cb85350 AR |
1024 | |
1025 | if (on->auth_present == true) { | |
1026 | vty_out(vty, " Authentication header present\n"); | |
1027 | vty_out(vty, | |
1028 | "\t\t\t hello DBDesc LSReq LSUpd LSAck\n"); | |
1029 | vty_out(vty, | |
1030 | " Higher sequence no 0x%-10X 0x%-10X 0x%-10X 0x%-10X 0x%-10X\n", | |
1031 | on->seqnum_h[OSPF6_MESSAGE_TYPE_HELLO], | |
1032 | on->seqnum_h[OSPF6_MESSAGE_TYPE_DBDESC], | |
1033 | on->seqnum_h[OSPF6_MESSAGE_TYPE_LSREQ], | |
1034 | on->seqnum_h[OSPF6_MESSAGE_TYPE_LSUPDATE], | |
1035 | on->seqnum_h[OSPF6_MESSAGE_TYPE_LSACK]); | |
1036 | vty_out(vty, | |
1037 | " Lower sequence no 0x%-10X 0x%-10X 0x%-10X 0x%-10X 0x%-10X\n", | |
1038 | on->seqnum_l[OSPF6_MESSAGE_TYPE_HELLO], | |
1039 | on->seqnum_l[OSPF6_MESSAGE_TYPE_DBDESC], | |
1040 | on->seqnum_l[OSPF6_MESSAGE_TYPE_LSREQ], | |
1041 | on->seqnum_l[OSPF6_MESSAGE_TYPE_LSUPDATE], | |
1042 | on->seqnum_l[OSPF6_MESSAGE_TYPE_LSACK]); | |
1043 | } else | |
1044 | vty_out(vty, " Authentication header not present\n"); | |
6a5bb300 | 1045 | } |
718e3744 | 1046 | } |
1047 | ||
ee3e6d7f IR |
1048 | static void ospf6_neighbor_show_detail_common(struct vty *vty, |
1049 | struct ospf6 *ospf6, bool uj, | |
1050 | bool detail, bool drchoice) | |
718e3744 | 1051 | { |
d62a17ae | 1052 | struct ospf6_neighbor *on; |
1053 | struct ospf6_interface *oi; | |
1054 | struct ospf6_area *oa; | |
1055 | struct listnode *i, *j, *k; | |
6a5bb300 | 1056 | json_object *json = NULL; |
1057 | json_object *json_array = NULL; | |
6a5bb300 | 1058 | void (*showfunc)(struct vty *, struct ospf6_neighbor *, |
1059 | json_object *json, bool use_json); | |
d62a17ae | 1060 | |
ee3e6d7f IR |
1061 | if (detail) |
1062 | showfunc = ospf6_neighbor_show_detail; | |
1063 | else if (drchoice) | |
1064 | showfunc = ospf6_neighbor_show_drchoice; | |
1065 | else | |
1066 | showfunc = ospf6_neighbor_show; | |
d62a17ae | 1067 | |
6a5bb300 | 1068 | if (uj) { |
1069 | json = json_object_new_object(); | |
1070 | json_array = json_object_new_array(); | |
1071 | } else { | |
1072 | if (showfunc == ospf6_neighbor_show) | |
1073 | vty_out(vty, "%-15s %3s %11s %8s/%-12s %11s %s[%s]\n", | |
1074 | "Neighbor ID", "Pri", "DeadTime", "State", | |
1075 | "IfState", "Duration", "I/F", "State"); | |
1076 | else if (showfunc == ospf6_neighbor_show_drchoice) | |
1077 | vty_out(vty, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", | |
1078 | "RouterID", "State", "Duration", "DR", "BDR", | |
1079 | "I/F", "State"); | |
1080 | } | |
d62a17ae | 1081 | |
1082 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) | |
1083 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) | |
6a5bb300 | 1084 | for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, k, on)) { |
1085 | if (showfunc == ospf6_neighbor_show_detail) | |
1086 | (*showfunc)(vty, on, json, uj); | |
1087 | else | |
1088 | (*showfunc)(vty, on, json_array, uj); | |
1089 | } | |
1090 | ||
1091 | if (uj) { | |
1092 | if (showfunc != ospf6_neighbor_show_detail) | |
1093 | json_object_object_add(json, "neighbors", json_array); | |
1094 | else | |
1095 | json_object_free(json_array); | |
5a6c232b | 1096 | vty_json(vty, json); |
6a5bb300 | 1097 | } |
718e3744 | 1098 | } |
1099 | ||
d48ef099 | 1100 | DEFUN(show_ipv6_ospf6_neighbor, show_ipv6_ospf6_neighbor_cmd, |
1101 | "show ipv6 ospf6 [vrf <NAME|all>] neighbor [<detail|drchoice>] [json]", | |
1102 | SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR | |
1103 | "All VRFs\n" | |
1104 | "Neighbor list\n" | |
1105 | "Display details\n" | |
1106 | "Display DR choices\n" JSON_STR) | |
1107 | { | |
d48ef099 | 1108 | struct ospf6 *ospf6; |
1109 | struct listnode *node; | |
1110 | const char *vrf_name = NULL; | |
1111 | bool all_vrf = false; | |
1112 | int idx_vrf = 0; | |
ee3e6d7f IR |
1113 | int idx_type = 4; |
1114 | bool uj = use_json(argc, argv); | |
1115 | bool detail = false; | |
1116 | bool drchoice = false; | |
d48ef099 | 1117 | |
d48ef099 | 1118 | OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); |
ee3e6d7f IR |
1119 | |
1120 | if (argv_find(argv, argc, "detail", &idx_type)) | |
1121 | detail = true; | |
1122 | else if (argv_find(argv, argc, "drchoice", &idx_type)) | |
1123 | drchoice = true; | |
d48ef099 | 1124 | |
1125 | for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { | |
1126 | if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { | |
ee3e6d7f IR |
1127 | ospf6_neighbor_show_detail_common(vty, ospf6, uj, |
1128 | detail, drchoice); | |
d48ef099 | 1129 | if (!all_vrf) |
1130 | break; | |
1131 | } | |
1132 | } | |
718e3744 | 1133 | |
d6b901ac | 1134 | OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); |
1135 | ||
d48ef099 | 1136 | return CMD_SUCCESS; |
1137 | } | |
1138 | ||
1139 | static int ospf6_neighbor_show_common(struct vty *vty, int argc, | |
1140 | struct cmd_token **argv, | |
d6b901ac | 1141 | struct ospf6 *ospf6, int idx_ipv4, |
1142 | bool uj) | |
718e3744 | 1143 | { |
d62a17ae | 1144 | struct ospf6_neighbor *on; |
1145 | struct ospf6_interface *oi; | |
1146 | struct ospf6_area *oa; | |
1147 | struct listnode *i, *j, *k; | |
6a5bb300 | 1148 | void (*showfunc)(struct vty *, struct ospf6_neighbor *, |
1149 | json_object *json, bool use_json); | |
d7c0a89a | 1150 | uint32_t router_id; |
6a5bb300 | 1151 | json_object *json = NULL; |
d62a17ae | 1152 | |
d62a17ae | 1153 | showfunc = ospf6_neighbor_show_detail; |
6a5bb300 | 1154 | if (uj) |
1155 | json = json_object_new_object(); | |
d62a17ae | 1156 | |
1157 | if ((inet_pton(AF_INET, argv[idx_ipv4]->arg, &router_id)) != 1) { | |
1158 | vty_out(vty, "Router-ID is not parsable: %s\n", | |
1159 | argv[idx_ipv4]->arg); | |
1160 | return CMD_SUCCESS; | |
1161 | } | |
1162 | ||
1163 | for (ALL_LIST_ELEMENTS_RO(ospf6->area_list, i, oa)) | |
1164 | for (ALL_LIST_ELEMENTS_RO(oa->if_list, j, oi)) | |
786b76d0 YR |
1165 | for (ALL_LIST_ELEMENTS_RO(oi->neighbor_list, k, on)) { |
1166 | if (router_id == on->router_id) | |
1167 | (*showfunc)(vty, on, json, uj); | |
1168 | } | |
d62a17ae | 1169 | |
c48349e3 | 1170 | if (uj) |
5a6c232b | 1171 | vty_json(vty, json); |
d48ef099 | 1172 | |
1173 | return CMD_SUCCESS; | |
1174 | } | |
1175 | ||
1176 | DEFUN(show_ipv6_ospf6_neighbor_one, show_ipv6_ospf6_neighbor_one_cmd, | |
1177 | "show ipv6 ospf6 [vrf <NAME|all>] neighbor A.B.C.D [json]", | |
1178 | SHOW_STR IP6_STR OSPF6_STR VRF_CMD_HELP_STR | |
1179 | "All VRFs\n" | |
1180 | "Neighbor list\n" | |
1181 | "Specify Router-ID as IPv4 address notation\n" JSON_STR) | |
1182 | { | |
1183 | int idx_ipv4 = 4; | |
1184 | struct ospf6 *ospf6; | |
1185 | struct listnode *node; | |
1186 | const char *vrf_name = NULL; | |
1187 | bool all_vrf = false; | |
1188 | int idx_vrf = 0; | |
d6b901ac | 1189 | bool uj = use_json(argc, argv); |
d48ef099 | 1190 | |
d48ef099 | 1191 | OSPF6_FIND_VRF_ARGS(argv, argc, idx_vrf, vrf_name, all_vrf); |
1192 | if (idx_vrf > 0) | |
1193 | idx_ipv4 += 2; | |
1194 | ||
1195 | for (ALL_LIST_ELEMENTS_RO(om6->ospf6, node, ospf6)) { | |
1196 | if (all_vrf || strcmp(ospf6->name, vrf_name) == 0) { | |
1197 | ospf6_neighbor_show_common(vty, argc, argv, ospf6, | |
d6b901ac | 1198 | idx_ipv4, uj); |
d48ef099 | 1199 | |
1200 | if (!all_vrf) | |
1201 | break; | |
1202 | } | |
1203 | } | |
1204 | ||
d6b901ac | 1205 | OSPF6_CMD_CHECK_VRF(uj, all_vrf, ospf6); |
1206 | ||
d62a17ae | 1207 | return CMD_SUCCESS; |
718e3744 | 1208 | } |
1209 | ||
d62a17ae | 1210 | void ospf6_neighbor_init(void) |
718e3744 | 1211 | { |
d62a17ae | 1212 | install_element(VIEW_NODE, &show_ipv6_ospf6_neighbor_cmd); |
1213 | install_element(VIEW_NODE, &show_ipv6_ospf6_neighbor_one_cmd); | |
508e53e2 | 1214 | } |
1215 | ||
1216 | DEFUN (debug_ospf6_neighbor, | |
1217 | debug_ospf6_neighbor_cmd, | |
6de69f83 | 1218 | "debug ospf6 neighbor [<state|event>]", |
508e53e2 | 1219 | DEBUG_STR |
1220 | OSPF6_STR | |
1221 | "Debug OSPFv3 Neighbor\n" | |
1d68dbfe DW |
1222 | "Debug OSPFv3 Neighbor State Change\n" |
1223 | "Debug OSPFv3 Neighbor Event\n") | |
508e53e2 | 1224 | { |
d62a17ae | 1225 | int idx_type = 3; |
1226 | unsigned char level = 0; | |
1227 | ||
1228 | if (argc == 4) { | |
1229 | if (!strncmp(argv[idx_type]->arg, "s", 1)) | |
1230 | level = OSPF6_DEBUG_NEIGHBOR_STATE; | |
1231 | else if (!strncmp(argv[idx_type]->arg, "e", 1)) | |
1232 | level = OSPF6_DEBUG_NEIGHBOR_EVENT; | |
1233 | } else | |
1234 | level = OSPF6_DEBUG_NEIGHBOR_STATE | OSPF6_DEBUG_NEIGHBOR_EVENT; | |
1235 | ||
1236 | OSPF6_DEBUG_NEIGHBOR_ON(level); | |
1237 | return CMD_SUCCESS; | |
718e3744 | 1238 | } |
1239 | ||
508e53e2 | 1240 | |
1241 | DEFUN (no_debug_ospf6_neighbor, | |
1242 | no_debug_ospf6_neighbor_cmd, | |
6de69f83 | 1243 | "no debug ospf6 neighbor [<state|event>]", |
508e53e2 | 1244 | NO_STR |
1245 | DEBUG_STR | |
1246 | OSPF6_STR | |
1247 | "Debug OSPFv3 Neighbor\n" | |
1d68dbfe DW |
1248 | "Debug OSPFv3 Neighbor State Change\n" |
1249 | "Debug OSPFv3 Neighbor Event\n") | |
508e53e2 | 1250 | { |
d62a17ae | 1251 | int idx_type = 4; |
1252 | unsigned char level = 0; | |
1253 | ||
1254 | if (argc == 5) { | |
1255 | if (!strncmp(argv[idx_type]->arg, "s", 1)) | |
1256 | level = OSPF6_DEBUG_NEIGHBOR_STATE; | |
1257 | if (!strncmp(argv[idx_type]->arg, "e", 1)) | |
1258 | level = OSPF6_DEBUG_NEIGHBOR_EVENT; | |
1259 | } else | |
1260 | level = OSPF6_DEBUG_NEIGHBOR_STATE | OSPF6_DEBUG_NEIGHBOR_EVENT; | |
1261 | ||
1262 | OSPF6_DEBUG_NEIGHBOR_OFF(level); | |
1263 | return CMD_SUCCESS; | |
508e53e2 | 1264 | } |
1265 | ||
508e53e2 | 1266 | |
4dfd8aff DW |
1267 | DEFUN (no_debug_ospf6, |
1268 | no_debug_ospf6_cmd, | |
1269 | "no debug ospf6", | |
1270 | NO_STR | |
1271 | DEBUG_STR | |
1272 | OSPF6_STR) | |
1273 | { | |
d7c0a89a | 1274 | unsigned int i; |
d62a17ae | 1275 | |
1276 | OSPF6_DEBUG_ABR_OFF(); | |
1277 | OSPF6_DEBUG_ASBR_OFF(); | |
1278 | OSPF6_DEBUG_BROUTER_OFF(); | |
1279 | OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF(); | |
1280 | OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF(); | |
1281 | OSPF6_DEBUG_FLOODING_OFF(); | |
1282 | OSPF6_DEBUG_INTERFACE_OFF(); | |
1283 | ||
067967b8 | 1284 | ospf6_lsa_debug_set_all(false); |
d62a17ae | 1285 | |
1286 | for (i = 0; i < 6; i++) | |
1287 | OSPF6_DEBUG_MESSAGE_OFF(i, | |
1288 | OSPF6_DEBUG_NEIGHBOR_STATE | |
1289 | | OSPF6_DEBUG_NEIGHBOR_EVENT); | |
1290 | ||
1291 | OSPF6_DEBUG_NEIGHBOR_OFF(OSPF6_DEBUG_NEIGHBOR_STATE | |
1292 | | OSPF6_DEBUG_NEIGHBOR_EVENT); | |
1293 | OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_TABLE); | |
1294 | OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_INTRA); | |
1295 | OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_INTER); | |
1296 | OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_MEMORY); | |
1297 | OSPF6_DEBUG_SPF_OFF(OSPF6_DEBUG_SPF_PROCESS); | |
1298 | OSPF6_DEBUG_SPF_OFF(OSPF6_DEBUG_SPF_TIME); | |
1299 | OSPF6_DEBUG_SPF_OFF(OSPF6_DEBUG_SPF_DATABASE); | |
1300 | OSPF6_DEBUG_ZEBRA_OFF(OSPF6_DEBUG_ZEBRA_SEND | OSPF6_DEBUG_ZEBRA_RECV); | |
1301 | ||
1302 | return CMD_SUCCESS; | |
4dfd8aff DW |
1303 | } |
1304 | ||
d62a17ae | 1305 | int config_write_ospf6_debug_neighbor(struct vty *vty) |
508e53e2 | 1306 | { |
d62a17ae | 1307 | if (IS_OSPF6_DEBUG_NEIGHBOR(STATE) && IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) |
1308 | vty_out(vty, "debug ospf6 neighbor\n"); | |
1309 | else if (IS_OSPF6_DEBUG_NEIGHBOR(STATE)) | |
1310 | vty_out(vty, "debug ospf6 neighbor state\n"); | |
1311 | else if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT)) | |
1312 | vty_out(vty, "debug ospf6 neighbor event\n"); | |
1313 | return 0; | |
508e53e2 | 1314 | } |
1315 | ||
d62a17ae | 1316 | void install_element_ospf6_debug_neighbor(void) |
508e53e2 | 1317 | { |
d62a17ae | 1318 | install_element(ENABLE_NODE, &debug_ospf6_neighbor_cmd); |
1319 | install_element(ENABLE_NODE, &no_debug_ospf6_neighbor_cmd); | |
1320 | install_element(ENABLE_NODE, &no_debug_ospf6_cmd); | |
1321 | install_element(CONFIG_NODE, &debug_ospf6_neighbor_cmd); | |
1322 | install_element(CONFIG_NODE, &no_debug_ospf6_neighbor_cmd); | |
1323 | install_element(CONFIG_NODE, &no_debug_ospf6_cmd); | |
508e53e2 | 1324 | } |