2 * Copyright (C) 2003 Yasuhiro Ohara
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License along
17 * with this program; see the file COPYING; if not, write to the Free Software
18 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "ospf6_proto.h"
31 #include "ospf6_lsa.h"
32 #include "ospf6_lsdb.h"
33 #include "ospf6_message.h"
34 #include "ospf6_top.h"
35 #include "ospf6_area.h"
36 #include "ospf6_interface.h"
37 #include "ospf6_neighbor.h"
38 #include "ospf6_intra.h"
39 #include "ospf6_flood.h"
41 #include "ospf6_bfd.h"
42 #include "ospf6_abr.h"
43 #include "ospf6_asbr.h"
44 #include "ospf6_lsa.h"
45 #include "ospf6_spf.h"
46 #include "ospf6_zebra.h"
49 DEFINE_HOOK(ospf6_neighbor_change
,
50 (struct ospf6_neighbor
* on
, int state
, int next_state
),
51 (on
, state
, next_state
));
53 unsigned char conf_debug_ospf6_neighbor
= 0;
55 const char *const ospf6_neighbor_state_str
[] = {
56 "None", "Down", "Attempt", "Init", "Twoway",
57 "ExStart", "ExChange", "Loading", "Full", NULL
};
59 const char *const ospf6_neighbor_event_str
[] = {
60 "NoEvent", "HelloReceived", "2-WayReceived", "NegotiationDone",
61 "ExchangeDone", "LoadingDone", "AdjOK?", "SeqNumberMismatch",
62 "BadLSReq", "1-WayReceived", "InactivityTimer",
65 int ospf6_neighbor_cmp(void *va
, void *vb
)
67 struct ospf6_neighbor
*ona
= (struct ospf6_neighbor
*)va
;
68 struct ospf6_neighbor
*onb
= (struct ospf6_neighbor
*)vb
;
70 if (ona
->router_id
== onb
->router_id
)
73 return (ntohl(ona
->router_id
) < ntohl(onb
->router_id
)) ? -1 : 1;
76 struct ospf6_neighbor
*ospf6_neighbor_lookup(uint32_t router_id
,
77 struct ospf6_interface
*oi
)
80 struct ospf6_neighbor
*on
;
82 for (ALL_LIST_ELEMENTS_RO(oi
->neighbor_list
, n
, on
))
83 if (on
->router_id
== router_id
)
86 return (struct ospf6_neighbor
*)NULL
;
89 /* create ospf6_neighbor */
90 struct ospf6_neighbor
*ospf6_neighbor_create(uint32_t router_id
,
91 struct ospf6_interface
*oi
)
93 struct ospf6_neighbor
*on
;
96 on
= XCALLOC(MTYPE_OSPF6_NEIGHBOR
, sizeof(struct ospf6_neighbor
));
97 inet_ntop(AF_INET
, &router_id
, buf
, sizeof(buf
));
98 snprintf(on
->name
, sizeof(on
->name
), "%s%%%s", buf
,
101 on
->state
= OSPF6_NEIGHBOR_DOWN
;
102 on
->state_change
= 0;
103 monotime(&on
->last_changed
);
104 on
->router_id
= router_id
;
106 on
->summary_list
= ospf6_lsdb_create(on
);
107 on
->request_list
= ospf6_lsdb_create(on
);
108 on
->retrans_list
= ospf6_lsdb_create(on
);
110 on
->dbdesc_list
= ospf6_lsdb_create(on
);
111 on
->lsupdate_list
= ospf6_lsdb_create(on
);
112 on
->lsack_list
= ospf6_lsdb_create(on
);
114 listnode_add_sort(oi
->neighbor_list
, on
);
116 ospf6_bfd_info_nbr_create(oi
, on
);
120 void ospf6_neighbor_delete(struct ospf6_neighbor
*on
)
122 struct ospf6_lsa
*lsa
, *lsanext
;
124 ospf6_lsdb_remove_all(on
->summary_list
);
125 ospf6_lsdb_remove_all(on
->request_list
);
126 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
)) {
127 ospf6_decrement_retrans_count(lsa
);
128 ospf6_lsdb_remove(lsa
, on
->retrans_list
);
131 ospf6_lsdb_remove_all(on
->dbdesc_list
);
132 ospf6_lsdb_remove_all(on
->lsupdate_list
);
133 ospf6_lsdb_remove_all(on
->lsack_list
);
135 ospf6_lsdb_delete(on
->summary_list
);
136 ospf6_lsdb_delete(on
->request_list
);
137 ospf6_lsdb_delete(on
->retrans_list
);
139 ospf6_lsdb_delete(on
->dbdesc_list
);
140 ospf6_lsdb_delete(on
->lsupdate_list
);
141 ospf6_lsdb_delete(on
->lsack_list
);
143 THREAD_OFF(on
->inactivity_timer
);
145 THREAD_OFF(on
->thread_send_dbdesc
);
146 THREAD_OFF(on
->thread_send_lsreq
);
147 THREAD_OFF(on
->thread_send_lsupdate
);
148 THREAD_OFF(on
->thread_send_lsack
);
150 ospf6_bfd_reg_dereg_nbr(on
, ZEBRA_BFD_DEST_DEREGISTER
);
151 XFREE(MTYPE_OSPF6_NEIGHBOR
, on
);
154 static void ospf6_neighbor_state_change(uint8_t next_state
,
155 struct ospf6_neighbor
*on
, int event
)
159 prev_state
= on
->state
;
160 on
->state
= next_state
;
162 if (prev_state
== next_state
)
166 monotime(&on
->last_changed
);
169 if (IS_OSPF6_DEBUG_NEIGHBOR(STATE
)) {
170 zlog_debug("Neighbor state change %s: [%s]->[%s] (%s)",
171 on
->name
, ospf6_neighbor_state_str
[prev_state
],
172 ospf6_neighbor_state_str
[next_state
],
173 ospf6_neighbor_event_string(event
));
176 /* Optionally notify about adjacency changes */
177 if (CHECK_FLAG(on
->ospf6_if
->area
->ospf6
->config_flags
,
178 OSPF6_LOG_ADJACENCY_CHANGES
)
179 && (CHECK_FLAG(on
->ospf6_if
->area
->ospf6
->config_flags
,
180 OSPF6_LOG_ADJACENCY_DETAIL
)
181 || (next_state
== OSPF6_NEIGHBOR_FULL
)
182 || (next_state
< prev_state
)))
183 zlog_notice("AdjChg: Nbr %s: %s -> %s (%s)", on
->name
,
184 ospf6_neighbor_state_str
[prev_state
],
185 ospf6_neighbor_state_str
[next_state
],
186 ospf6_neighbor_event_string(event
));
188 if (prev_state
== OSPF6_NEIGHBOR_FULL
189 || next_state
== OSPF6_NEIGHBOR_FULL
) {
190 OSPF6_ROUTER_LSA_SCHEDULE(on
->ospf6_if
->area
);
191 if (on
->ospf6_if
->state
== OSPF6_INTERFACE_DR
) {
192 OSPF6_NETWORK_LSA_SCHEDULE(on
->ospf6_if
);
193 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_TRANSIT(on
->ospf6_if
);
195 if (next_state
== OSPF6_NEIGHBOR_FULL
)
196 on
->ospf6_if
->area
->intra_prefix_originate
= 1;
198 OSPF6_INTRA_PREFIX_LSA_SCHEDULE_STUB(on
->ospf6_if
->area
);
200 if ((prev_state
== OSPF6_NEIGHBOR_LOADING
||
201 prev_state
== OSPF6_NEIGHBOR_EXCHANGE
) &&
202 next_state
== OSPF6_NEIGHBOR_FULL
) {
203 OSPF6_AS_EXTERN_LSA_SCHEDULE(on
->ospf6_if
);
204 on
->ospf6_if
->area
->full_nbrs
++;
207 if (prev_state
== OSPF6_NEIGHBOR_FULL
)
208 on
->ospf6_if
->area
->full_nbrs
--;
211 if ((prev_state
== OSPF6_NEIGHBOR_EXCHANGE
212 || prev_state
== OSPF6_NEIGHBOR_LOADING
)
213 && (next_state
!= OSPF6_NEIGHBOR_EXCHANGE
214 && next_state
!= OSPF6_NEIGHBOR_LOADING
))
215 ospf6_maxage_remove(on
->ospf6_if
->area
->ospf6
);
217 hook_call(ospf6_neighbor_change
, on
, next_state
, prev_state
);
218 ospf6_bfd_trigger_event(on
, prev_state
, next_state
);
221 /* RFC2328 section 10.4 */
222 static int need_adjacency(struct ospf6_neighbor
*on
)
224 if (on
->ospf6_if
->state
== OSPF6_INTERFACE_POINTTOPOINT
225 || on
->ospf6_if
->state
== OSPF6_INTERFACE_DR
226 || on
->ospf6_if
->state
== OSPF6_INTERFACE_BDR
)
229 if (on
->ospf6_if
->drouter
== on
->router_id
230 || on
->ospf6_if
->bdrouter
== on
->router_id
)
236 int hello_received(struct thread
*thread
)
238 struct ospf6_neighbor
*on
;
240 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
243 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
244 zlog_debug("Neighbor Event %s: *HelloReceived*", on
->name
);
246 /* reset Inactivity Timer */
247 THREAD_OFF(on
->inactivity_timer
);
248 on
->inactivity_timer
= NULL
;
249 thread_add_timer(master
, inactivity_timer
, on
,
250 on
->ospf6_if
->dead_interval
, &on
->inactivity_timer
);
252 if (on
->state
<= OSPF6_NEIGHBOR_DOWN
)
253 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT
, on
,
254 OSPF6_NEIGHBOR_EVENT_HELLO_RCVD
);
259 int twoway_received(struct thread
*thread
)
261 struct ospf6_neighbor
*on
;
263 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
266 if (on
->state
> OSPF6_NEIGHBOR_INIT
)
269 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
270 zlog_debug("Neighbor Event %s: *2Way-Received*", on
->name
);
272 thread_add_event(master
, neighbor_change
, on
->ospf6_if
, 0, NULL
);
274 if (!need_adjacency(on
)) {
275 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY
, on
,
276 OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD
);
280 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART
, on
,
281 OSPF6_NEIGHBOR_EVENT_TWOWAY_RCVD
);
282 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MSBIT
);
283 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MBIT
);
284 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
);
286 THREAD_OFF(on
->thread_send_dbdesc
);
287 on
->thread_send_dbdesc
= NULL
;
288 thread_add_event(master
, ospf6_dbdesc_send
, on
, 0,
289 &on
->thread_send_dbdesc
);
294 int negotiation_done(struct thread
*thread
)
296 struct ospf6_neighbor
*on
;
297 struct ospf6_lsa
*lsa
, *lsanext
;
299 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
302 if (on
->state
!= OSPF6_NEIGHBOR_EXSTART
)
305 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
306 zlog_debug("Neighbor Event %s: *NegotiationDone*", on
->name
);
309 ospf6_lsdb_remove_all(on
->summary_list
);
310 ospf6_lsdb_remove_all(on
->request_list
);
311 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
)) {
312 ospf6_decrement_retrans_count(lsa
);
313 ospf6_lsdb_remove(lsa
, on
->retrans_list
);
316 /* Interface scoped LSAs */
317 for (ALL_LSDB(on
->ospf6_if
->lsdb
, lsa
, lsanext
)) {
318 if (OSPF6_LSA_IS_MAXAGE(lsa
)) {
319 ospf6_increment_retrans_count(lsa
);
320 ospf6_lsdb_add(ospf6_lsa_copy(lsa
), on
->retrans_list
);
322 ospf6_lsdb_add(ospf6_lsa_copy(lsa
), on
->summary_list
);
325 /* Area scoped LSAs */
326 for (ALL_LSDB(on
->ospf6_if
->area
->lsdb
, lsa
, lsanext
)) {
327 if (OSPF6_LSA_IS_MAXAGE(lsa
)) {
328 ospf6_increment_retrans_count(lsa
);
329 ospf6_lsdb_add(ospf6_lsa_copy(lsa
), on
->retrans_list
);
331 ospf6_lsdb_add(ospf6_lsa_copy(lsa
), on
->summary_list
);
335 for (ALL_LSDB(on
->ospf6_if
->area
->ospf6
->lsdb
, lsa
, lsanext
)) {
336 if (OSPF6_LSA_IS_MAXAGE(lsa
)) {
337 ospf6_increment_retrans_count(lsa
);
338 ospf6_lsdb_add(ospf6_lsa_copy(lsa
), on
->retrans_list
);
340 ospf6_lsdb_add(ospf6_lsa_copy(lsa
), on
->summary_list
);
343 UNSET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
);
344 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXCHANGE
, on
,
345 OSPF6_NEIGHBOR_EVENT_NEGOTIATION_DONE
);
350 int exchange_done(struct thread
*thread
)
352 struct ospf6_neighbor
*on
;
354 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
357 if (on
->state
!= OSPF6_NEIGHBOR_EXCHANGE
)
360 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
361 zlog_debug("Neighbor Event %s: *ExchangeDone*", on
->name
);
363 THREAD_OFF(on
->thread_send_dbdesc
);
364 ospf6_lsdb_remove_all(on
->dbdesc_list
);
367 thread_add_timer (master, ospf6_neighbor_last_dbdesc_release, on,
368 on->ospf6_if->dead_interval);
371 if (on
->request_list
->count
== 0)
372 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_FULL
, on
,
373 OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE
);
375 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_LOADING
, on
,
376 OSPF6_NEIGHBOR_EVENT_EXCHANGE_DONE
);
378 thread_add_event(master
, ospf6_lsreq_send
, on
, 0,
379 &on
->thread_send_lsreq
);
385 /* Check loading state. */
386 void ospf6_check_nbr_loading(struct ospf6_neighbor
*on
)
389 /* RFC2328 Section 10.9: When the neighbor responds to these requests
390 with the proper Link State Update packet(s), the Link state request
391 list is truncated and a new Link State Request packet is sent.
393 if ((on
->state
== OSPF6_NEIGHBOR_LOADING
)
394 || (on
->state
== OSPF6_NEIGHBOR_EXCHANGE
)) {
395 if (on
->request_list
->count
== 0)
396 thread_add_event(master
, loading_done
, on
, 0, NULL
);
397 else if (on
->last_ls_req
== NULL
) {
398 if (on
->thread_send_lsreq
!= NULL
)
399 THREAD_OFF(on
->thread_send_lsreq
);
400 on
->thread_send_lsreq
= NULL
;
401 thread_add_event(master
, ospf6_lsreq_send
, on
, 0,
402 &on
->thread_send_lsreq
);
407 int loading_done(struct thread
*thread
)
409 struct ospf6_neighbor
*on
;
411 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
414 if (on
->state
!= OSPF6_NEIGHBOR_LOADING
)
417 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
418 zlog_debug("Neighbor Event %s: *LoadingDone*", on
->name
);
420 assert(on
->request_list
->count
== 0);
422 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_FULL
, on
,
423 OSPF6_NEIGHBOR_EVENT_LOADING_DONE
);
428 int adj_ok(struct thread
*thread
)
430 struct ospf6_neighbor
*on
;
431 struct ospf6_lsa
*lsa
, *lsanext
;
433 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
436 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
437 zlog_debug("Neighbor Event %s: *AdjOK?*", on
->name
);
439 if (on
->state
== OSPF6_NEIGHBOR_TWOWAY
&& need_adjacency(on
)) {
440 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART
, on
,
441 OSPF6_NEIGHBOR_EVENT_ADJ_OK
);
442 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MSBIT
);
443 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MBIT
);
444 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
);
446 THREAD_OFF(on
->thread_send_dbdesc
);
447 on
->thread_send_dbdesc
= NULL
;
448 thread_add_event(master
, ospf6_dbdesc_send
, on
, 0,
449 &on
->thread_send_dbdesc
);
451 } else if (on
->state
>= OSPF6_NEIGHBOR_EXSTART
&& !need_adjacency(on
)) {
452 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_TWOWAY
, on
,
453 OSPF6_NEIGHBOR_EVENT_ADJ_OK
);
454 ospf6_lsdb_remove_all(on
->summary_list
);
455 ospf6_lsdb_remove_all(on
->request_list
);
456 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
)) {
457 ospf6_decrement_retrans_count(lsa
);
458 ospf6_lsdb_remove(lsa
, on
->retrans_list
);
465 int seqnumber_mismatch(struct thread
*thread
)
467 struct ospf6_neighbor
*on
;
468 struct ospf6_lsa
*lsa
, *lsanext
;
470 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
473 if (on
->state
< OSPF6_NEIGHBOR_EXCHANGE
)
476 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
477 zlog_debug("Neighbor Event %s: *SeqNumberMismatch*", on
->name
);
479 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART
, on
,
480 OSPF6_NEIGHBOR_EVENT_SEQNUMBER_MISMATCH
);
481 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MSBIT
);
482 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MBIT
);
483 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
);
485 ospf6_lsdb_remove_all(on
->summary_list
);
486 ospf6_lsdb_remove_all(on
->request_list
);
487 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
)) {
488 ospf6_decrement_retrans_count(lsa
);
489 ospf6_lsdb_remove(lsa
, on
->retrans_list
);
492 THREAD_OFF(on
->thread_send_dbdesc
);
493 on
->dbdesc_seqnum
++; /* Incr seqnum as per RFC2328, sec 10.3 */
495 on
->thread_send_dbdesc
= NULL
;
496 thread_add_event(master
, ospf6_dbdesc_send
, on
, 0,
497 &on
->thread_send_dbdesc
);
502 int bad_lsreq(struct thread
*thread
)
504 struct ospf6_neighbor
*on
;
505 struct ospf6_lsa
*lsa
, *lsanext
;
507 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
510 if (on
->state
< OSPF6_NEIGHBOR_EXCHANGE
)
513 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
514 zlog_debug("Neighbor Event %s: *BadLSReq*", on
->name
);
516 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_EXSTART
, on
,
517 OSPF6_NEIGHBOR_EVENT_BAD_LSREQ
);
518 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MSBIT
);
519 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MBIT
);
520 SET_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
);
522 ospf6_lsdb_remove_all(on
->summary_list
);
523 ospf6_lsdb_remove_all(on
->request_list
);
524 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
)) {
525 ospf6_decrement_retrans_count(lsa
);
526 ospf6_lsdb_remove(lsa
, on
->retrans_list
);
529 THREAD_OFF(on
->thread_send_dbdesc
);
530 on
->dbdesc_seqnum
++; /* Incr seqnum as per RFC2328, sec 10.3 */
532 on
->thread_send_dbdesc
= NULL
;
533 thread_add_event(master
, ospf6_dbdesc_send
, on
, 0,
534 &on
->thread_send_dbdesc
);
539 int oneway_received(struct thread
*thread
)
541 struct ospf6_neighbor
*on
;
542 struct ospf6_lsa
*lsa
, *lsanext
;
544 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
547 if (on
->state
< OSPF6_NEIGHBOR_TWOWAY
)
550 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
551 zlog_debug("Neighbor Event %s: *1Way-Received*", on
->name
);
553 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_INIT
, on
,
554 OSPF6_NEIGHBOR_EVENT_ONEWAY_RCVD
);
555 thread_add_event(master
, neighbor_change
, on
->ospf6_if
, 0, NULL
);
557 ospf6_lsdb_remove_all(on
->summary_list
);
558 ospf6_lsdb_remove_all(on
->request_list
);
559 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
)) {
560 ospf6_decrement_retrans_count(lsa
);
561 ospf6_lsdb_remove(lsa
, on
->retrans_list
);
564 THREAD_OFF(on
->thread_send_dbdesc
);
565 THREAD_OFF(on
->thread_send_lsreq
);
566 THREAD_OFF(on
->thread_send_lsupdate
);
567 THREAD_OFF(on
->thread_send_lsack
);
572 int inactivity_timer(struct thread
*thread
)
574 struct ospf6_neighbor
*on
;
576 on
= (struct ospf6_neighbor
*)THREAD_ARG(thread
);
579 if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
580 zlog_debug("Neighbor Event %s: *InactivityTimer*", on
->name
);
582 on
->inactivity_timer
= NULL
;
583 on
->drouter
= on
->prev_drouter
= 0;
584 on
->bdrouter
= on
->prev_bdrouter
= 0;
586 ospf6_neighbor_state_change(OSPF6_NEIGHBOR_DOWN
, on
,
587 OSPF6_NEIGHBOR_EVENT_INACTIVITY_TIMER
);
588 thread_add_event(master
, neighbor_change
, on
->ospf6_if
, 0, NULL
);
590 listnode_delete(on
->ospf6_if
->neighbor_list
, on
);
591 ospf6_neighbor_delete(on
);
598 /* show neighbor structure */
599 static void ospf6_neighbor_show(struct vty
*vty
, struct ospf6_neighbor
*on
,
600 json_object
*json_array
, bool use_json
)
608 json_object
*json_route
;
610 /* Router-ID (Name) */
611 inet_ntop(AF_INET
, &on
->router_id
, router_id
, sizeof(router_id
));
612 #ifdef HAVE_GETNAMEINFO
615 #endif /*HAVE_GETNAMEINFO*/
619 if (on
->inactivity_timer
) {
620 s
= monotime_until(&on
->inactivity_timer
->u
.sands
, NULL
)
627 snprintf(deadtime
, sizeof(deadtime
), "%02ld:%02ld:%02ld", h
, m
, s
);
630 if (on
->ospf6_if
->type
== OSPF_IFTYPE_POINTOPOINT
)
631 snprintf(nstate
, sizeof(nstate
), "PointToPoint");
633 if (on
->router_id
== on
->drouter
)
634 snprintf(nstate
, sizeof(nstate
), "DR");
635 else if (on
->router_id
== on
->bdrouter
)
636 snprintf(nstate
, sizeof(nstate
), "BDR");
638 snprintf(nstate
, sizeof(nstate
), "DROther");
642 monotime_since(&on
->last_changed
, &res
);
643 timerstring(&res
, duration
, sizeof(duration
));
646 vty_out (vty, "%-15s %3d %11s %6s/%-12s %11s %s[%s]\n",
647 "Neighbor ID", "Pri", "DeadTime", "State", "IfState",
648 "Duration", "I/F", "State");
651 json_route
= json_object_new_object();
653 json_object_string_add(json_route
, "neighborId", router_id
);
654 json_object_int_add(json_route
, "priority", on
->priority
);
655 json_object_string_add(json_route
, "deadTime", deadtime
);
656 json_object_string_add(json_route
, "state",
657 ospf6_neighbor_state_str
[on
->state
]);
658 json_object_string_add(json_route
, "ifState", nstate
);
659 json_object_string_add(json_route
, "duration", duration
);
660 json_object_string_add(json_route
, "interfaceName",
661 on
->ospf6_if
->interface
->name
);
662 json_object_string_add(
663 json_route
, "interfaceState",
664 ospf6_interface_state_str
[on
->ospf6_if
->state
]);
666 json_object_array_add(json_array
, json_route
);
668 vty_out(vty
, "%-15s %3d %11s %8s/%-12s %11s %s[%s]\n",
669 router_id
, on
->priority
, deadtime
,
670 ospf6_neighbor_state_str
[on
->state
], nstate
, duration
,
671 on
->ospf6_if
->interface
->name
,
672 ospf6_interface_state_str
[on
->ospf6_if
->state
]);
675 static void ospf6_neighbor_show_drchoice(struct vty
*vty
,
676 struct ospf6_neighbor
*on
,
677 json_object
*json_array
, bool use_json
)
680 char drouter
[16], bdrouter
[16];
682 struct timeval now
, res
;
683 json_object
*json_route
;
686 vty_out (vty, "%-15s %6s/%-11s %-15s %-15s %s[%s]\n",
687 "RouterID", "State", "Duration", "DR", "BDR", "I/F",
691 inet_ntop(AF_INET
, &on
->router_id
, router_id
, sizeof(router_id
));
692 inet_ntop(AF_INET
, &on
->drouter
, drouter
, sizeof(drouter
));
693 inet_ntop(AF_INET
, &on
->bdrouter
, bdrouter
, sizeof(bdrouter
));
696 timersub(&now
, &on
->last_changed
, &res
);
697 timerstring(&res
, duration
, sizeof(duration
));
700 json_route
= json_object_new_object();
701 json_object_string_add(json_route
, "routerId", router_id
);
702 json_object_string_add(json_route
, "state",
703 ospf6_neighbor_state_str
[on
->state
]);
704 json_object_string_add(json_route
, "duration", duration
);
705 json_object_string_add(json_route
, "dRouter", drouter
);
706 json_object_string_add(json_route
, "bdRouter", bdrouter
);
707 json_object_string_add(json_route
, "interfaceName",
708 on
->ospf6_if
->interface
->name
);
709 json_object_string_add(
710 json_route
, "interfaceState",
711 ospf6_interface_state_str
[on
->ospf6_if
->state
]);
713 json_object_array_add(json_array
, json_route
);
715 vty_out(vty
, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n", router_id
,
716 ospf6_neighbor_state_str
[on
->state
], duration
, drouter
,
717 bdrouter
, on
->ospf6_if
->interface
->name
,
718 ospf6_interface_state_str
[on
->ospf6_if
->state
]);
721 static void ospf6_neighbor_show_detail(struct vty
*vty
,
722 struct ospf6_neighbor
*on
,
723 json_object
*json
, bool use_json
)
725 char drouter
[16], bdrouter
[16];
726 char linklocal_addr
[64], duration
[32];
727 struct timeval now
, res
;
728 struct ospf6_lsa
*lsa
, *lsanext
;
729 json_object
*json_neighbor
;
730 json_object
*json_array
;
731 char db_desc_str
[20];
733 inet_ntop(AF_INET6
, &on
->linklocal_addr
, linklocal_addr
,
734 sizeof(linklocal_addr
));
735 inet_ntop(AF_INET
, &on
->drouter
, drouter
, sizeof(drouter
));
736 inet_ntop(AF_INET
, &on
->bdrouter
, bdrouter
, sizeof(bdrouter
));
739 timersub(&now
, &on
->last_changed
, &res
);
740 timerstring(&res
, duration
, sizeof(duration
));
743 json_neighbor
= json_object_new_object();
744 json_object_string_add(json_neighbor
, "area",
745 on
->ospf6_if
->area
->name
);
746 json_object_string_add(json_neighbor
, "interface",
747 on
->ospf6_if
->interface
->name
);
748 json_object_int_add(json_neighbor
, "interfaceIndex",
749 on
->ospf6_if
->interface
->ifindex
);
750 json_object_int_add(json_neighbor
, "neighborInterfaceIndex",
752 json_object_string_add(json_neighbor
, "linkLocalAddress",
754 json_object_string_add(json_neighbor
, "neighborState",
755 ospf6_neighbor_state_str
[on
->state
]);
756 json_object_string_add(json_neighbor
, "neighborStateDuration",
758 json_object_string_add(json_neighbor
, "neighborDRouter",
760 json_object_string_add(json_neighbor
, "neighborBdRouter",
762 snprintf(db_desc_str
, sizeof(db_desc_str
), "%s%s%s",
763 (CHECK_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
)
766 (CHECK_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MBIT
)
769 (CHECK_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MSBIT
)
772 json_object_string_add(json_neighbor
, "dbDescStatus",
775 json_object_int_add(json_neighbor
, "dbDescSeqNumber",
776 (unsigned long)ntohl(on
->dbdesc_seqnum
));
778 json_array
= json_object_new_array();
779 json_object_int_add(json_neighbor
, "summaryListCount",
780 on
->summary_list
->count
);
781 for (ALL_LSDB(on
->summary_list
, lsa
, lsanext
))
782 json_object_array_add(
783 json_array
, json_object_new_string(lsa
->name
));
784 json_object_object_add(json_neighbor
, "summaryListLsa",
787 json_array
= json_object_new_array();
788 json_object_int_add(json_neighbor
, "requestListCount",
789 on
->request_list
->count
);
790 for (ALL_LSDB(on
->request_list
, lsa
, lsanext
))
791 json_object_array_add(
792 json_array
, json_object_new_string(lsa
->name
));
793 json_object_object_add(json_neighbor
, "requestListLsa",
796 json_array
= json_object_new_array();
797 json_object_int_add(json_neighbor
, "reTransListCount",
798 on
->retrans_list
->count
);
799 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
))
800 json_object_array_add(
801 json_array
, json_object_new_string(lsa
->name
));
802 json_object_object_add(json_neighbor
, "reTransListLsa",
807 if (on
->thread_send_dbdesc
)
808 timersub(&on
->thread_send_dbdesc
->u
.sands
, &now
, &res
);
809 timerstring(&res
, duration
, sizeof(duration
));
810 json_object_int_add(json_neighbor
, "pendingLsaDbDescCount",
811 on
->dbdesc_list
->count
);
812 json_object_string_add(json_neighbor
, "pendingLsaDbDescTime",
814 json_object_string_add(json_neighbor
, "dbDescSendThread",
815 (on
->thread_send_dbdesc
? "on" : "off"));
816 json_array
= json_object_new_array();
817 for (ALL_LSDB(on
->dbdesc_list
, lsa
, lsanext
))
818 json_object_array_add(
819 json_array
, json_object_new_string(lsa
->name
));
820 json_object_object_add(json_neighbor
, "pendingLsaDbDesc",
824 if (on
->thread_send_lsreq
)
825 timersub(&on
->thread_send_lsreq
->u
.sands
, &now
, &res
);
826 timerstring(&res
, duration
, sizeof(duration
));
827 json_object_int_add(json_neighbor
, "pendingLsaLsReqCount",
828 on
->request_list
->count
);
829 json_object_string_add(json_neighbor
, "pendingLsaLsReqTime",
831 json_object_string_add(json_neighbor
, "lsReqSendThread",
832 (on
->thread_send_lsreq
? "on" : "off"));
833 json_array
= json_object_new_array();
834 for (ALL_LSDB(on
->request_list
, lsa
, lsanext
))
835 json_object_array_add(
836 json_array
, json_object_new_string(lsa
->name
));
837 json_object_object_add(json_neighbor
, "pendingLsaLsReq",
842 if (on
->thread_send_lsupdate
)
843 timersub(&on
->thread_send_lsupdate
->u
.sands
, &now
,
845 timerstring(&res
, duration
, sizeof(duration
));
846 json_object_int_add(json_neighbor
, "pendingLsaLsUpdateCount",
847 on
->lsupdate_list
->count
);
848 json_object_string_add(json_neighbor
, "pendingLsaLsUpdateTime",
850 json_object_string_add(
851 json_neighbor
, "lsUpdateSendThread",
852 (on
->thread_send_lsupdate
? "on" : "off"));
853 json_array
= json_object_new_array();
854 for (ALL_LSDB(on
->lsupdate_list
, lsa
, lsanext
))
855 json_object_array_add(
856 json_array
, json_object_new_string(lsa
->name
));
857 json_object_object_add(json_neighbor
, "pendingLsaLsUpdate",
861 if (on
->thread_send_lsack
)
862 timersub(&on
->thread_send_lsack
->u
.sands
, &now
, &res
);
863 timerstring(&res
, duration
, sizeof(duration
));
864 json_object_int_add(json_neighbor
, "pendingLsaLsAckCount",
865 on
->lsack_list
->count
);
866 json_object_string_add(json_neighbor
, "pendingLsaLsAckTime",
868 json_object_string_add(json_neighbor
, "lsAckSendThread",
869 (on
->thread_send_lsack
? "on" : "off"));
870 json_array
= json_object_new_array();
871 for (ALL_LSDB(on
->lsack_list
, lsa
, lsanext
))
872 json_object_array_add(
873 json_array
, json_object_new_string(lsa
->name
));
874 json_object_object_add(json_neighbor
, "pendingLsaLsAck",
877 ospf6_bfd_show_info(vty
, on
->bfd_info
, 0, json_neighbor
,
880 json_object_object_add(json
, on
->name
, json_neighbor
);
884 vty_out(vty
, " Neighbor %s\n", on
->name
);
885 vty_out(vty
, " Area %s via interface %s (ifindex %d)\n",
886 on
->ospf6_if
->area
->name
, on
->ospf6_if
->interface
->name
,
887 on
->ospf6_if
->interface
->ifindex
);
888 vty_out(vty
, " His IfIndex: %d Link-local address: %s\n",
889 on
->ifindex
, linklocal_addr
);
890 vty_out(vty
, " State %s for a duration of %s\n",
891 ospf6_neighbor_state_str
[on
->state
], duration
);
892 vty_out(vty
, " His choice of DR/BDR %s/%s, Priority %d\n",
893 drouter
, bdrouter
, on
->priority
);
894 vty_out(vty
, " DbDesc status: %s%s%s SeqNum: %#lx\n",
895 (CHECK_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_IBIT
)
898 (CHECK_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MBIT
)
901 (CHECK_FLAG(on
->dbdesc_bits
, OSPF6_DBDESC_MSBIT
)
904 (unsigned long)ntohl(on
->dbdesc_seqnum
));
906 vty_out(vty
, " Summary-List: %d LSAs\n",
907 on
->summary_list
->count
);
908 for (ALL_LSDB(on
->summary_list
, lsa
, lsanext
))
909 vty_out(vty
, " %s\n", lsa
->name
);
911 vty_out(vty
, " Request-List: %d LSAs\n",
912 on
->request_list
->count
);
913 for (ALL_LSDB(on
->request_list
, lsa
, lsanext
))
914 vty_out(vty
, " %s\n", lsa
->name
);
916 vty_out(vty
, " Retrans-List: %d LSAs\n",
917 on
->retrans_list
->count
);
918 for (ALL_LSDB(on
->retrans_list
, lsa
, lsanext
))
919 vty_out(vty
, " %s\n", lsa
->name
);
922 if (on
->thread_send_dbdesc
)
923 timersub(&on
->thread_send_dbdesc
->u
.sands
, &now
, &res
);
924 timerstring(&res
, duration
, sizeof(duration
));
926 " %d Pending LSAs for DbDesc in Time %s [thread %s]\n",
927 on
->dbdesc_list
->count
, duration
,
928 (on
->thread_send_dbdesc
? "on" : "off"));
929 for (ALL_LSDB(on
->dbdesc_list
, lsa
, lsanext
))
930 vty_out(vty
, " %s\n", lsa
->name
);
933 if (on
->thread_send_lsreq
)
934 timersub(&on
->thread_send_lsreq
->u
.sands
, &now
, &res
);
935 timerstring(&res
, duration
, sizeof(duration
));
937 " %d Pending LSAs for LSReq in Time %s [thread %s]\n",
938 on
->request_list
->count
, duration
,
939 (on
->thread_send_lsreq
? "on" : "off"));
940 for (ALL_LSDB(on
->request_list
, lsa
, lsanext
))
941 vty_out(vty
, " %s\n", lsa
->name
);
944 if (on
->thread_send_lsupdate
)
945 timersub(&on
->thread_send_lsupdate
->u
.sands
, &now
,
947 timerstring(&res
, duration
, sizeof(duration
));
949 " %d Pending LSAs for LSUpdate in Time %s [thread %s]\n",
950 on
->lsupdate_list
->count
, duration
,
951 (on
->thread_send_lsupdate
? "on" : "off"));
952 for (ALL_LSDB(on
->lsupdate_list
, lsa
, lsanext
))
953 vty_out(vty
, " %s\n", lsa
->name
);
956 if (on
->thread_send_lsack
)
957 timersub(&on
->thread_send_lsack
->u
.sands
, &now
, &res
);
958 timerstring(&res
, duration
, sizeof(duration
));
960 " %d Pending LSAs for LSAck in Time %s [thread %s]\n",
961 on
->lsack_list
->count
, duration
,
962 (on
->thread_send_lsack
? "on" : "off"));
963 for (ALL_LSDB(on
->lsack_list
, lsa
, lsanext
))
964 vty_out(vty
, " %s\n", lsa
->name
);
966 ospf6_bfd_show_info(vty
, on
->bfd_info
, 0, NULL
, use_json
);
970 DEFUN (show_ipv6_ospf6_neighbor
,
971 show_ipv6_ospf6_neighbor_cmd
,
972 "show ipv6 ospf6 neighbor [<detail|drchoice>] [json]",
978 "Display DR choices\n"
982 struct ospf6_neighbor
*on
;
983 struct ospf6_interface
*oi
;
984 struct ospf6_area
*oa
;
985 struct listnode
*i
, *j
, *k
;
987 json_object
*json
= NULL
;
988 json_object
*json_array
= NULL
;
989 bool uj
= use_json(argc
, argv
);
990 void (*showfunc
)(struct vty
*, struct ospf6_neighbor
*,
991 json_object
*json
, bool use_json
);
993 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
995 OSPF6_CMD_CHECK_RUNNING(ospf6
);
996 showfunc
= ospf6_neighbor_show
;
998 if ((uj
&& argc
== 6) || (!uj
&& argc
== 5)) {
999 if (!strncmp(argv
[idx_type
]->arg
, "de", 2))
1000 showfunc
= ospf6_neighbor_show_detail
;
1001 else if (!strncmp(argv
[idx_type
]->arg
, "dr", 2))
1002 showfunc
= ospf6_neighbor_show_drchoice
;
1006 json
= json_object_new_object();
1007 json_array
= json_object_new_array();
1009 if (showfunc
== ospf6_neighbor_show
)
1010 vty_out(vty
, "%-15s %3s %11s %8s/%-12s %11s %s[%s]\n",
1011 "Neighbor ID", "Pri", "DeadTime", "State",
1012 "IfState", "Duration", "I/F", "State");
1013 else if (showfunc
== ospf6_neighbor_show_drchoice
)
1014 vty_out(vty
, "%-15s %8s/%-11s %-15s %-15s %s[%s]\n",
1015 "RouterID", "State", "Duration", "DR", "BDR",
1019 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, i
, oa
))
1020 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
))
1021 for (ALL_LIST_ELEMENTS_RO(oi
->neighbor_list
, k
, on
)) {
1022 if (showfunc
== ospf6_neighbor_show_detail
)
1023 (*showfunc
)(vty
, on
, json
, uj
);
1025 (*showfunc
)(vty
, on
, json_array
, uj
);
1029 if (showfunc
!= ospf6_neighbor_show_detail
)
1030 json_object_object_add(json
, "neighbors", json_array
);
1032 json_object_free(json_array
);
1033 vty_out(vty
, "%s\n",
1034 json_object_to_json_string_ext(
1035 json
, JSON_C_TO_STRING_PRETTY
));
1036 json_object_free(json
);
1042 DEFUN (show_ipv6_ospf6_neighbor_one
,
1043 show_ipv6_ospf6_neighbor_one_cmd
,
1044 "show ipv6 ospf6 neighbor A.B.C.D [json]",
1049 "Specify Router-ID as IPv4 address notation\n"
1053 struct ospf6_neighbor
*on
;
1054 struct ospf6_interface
*oi
;
1055 struct ospf6_area
*oa
;
1056 struct listnode
*i
, *j
, *k
;
1057 void (*showfunc
)(struct vty
*, struct ospf6_neighbor
*,
1058 json_object
*json
, bool use_json
);
1060 struct ospf6
*ospf6
;
1061 json_object
*json
= NULL
;
1062 bool uj
= use_json(argc
, argv
);
1064 ospf6
= ospf6_lookup_by_vrf_name(VRF_DEFAULT_NAME
);
1065 OSPF6_CMD_CHECK_RUNNING(ospf6
);
1066 showfunc
= ospf6_neighbor_show_detail
;
1068 json
= json_object_new_object();
1070 if ((inet_pton(AF_INET
, argv
[idx_ipv4
]->arg
, &router_id
)) != 1) {
1071 vty_out(vty
, "Router-ID is not parsable: %s\n",
1072 argv
[idx_ipv4
]->arg
);
1076 for (ALL_LIST_ELEMENTS_RO(ospf6
->area_list
, i
, oa
))
1077 for (ALL_LIST_ELEMENTS_RO(oa
->if_list
, j
, oi
))
1078 for (ALL_LIST_ELEMENTS_RO(oi
->neighbor_list
, k
, on
)) {
1079 if (router_id
== on
->router_id
)
1080 (*showfunc
)(vty
, on
, json
, uj
);
1084 vty_out(vty
, "%s\n",
1085 json_object_to_json_string_ext(
1086 json
, JSON_C_TO_STRING_PRETTY
));
1087 json_object_free(json
);
1092 void ospf6_neighbor_init(void)
1094 install_element(VIEW_NODE
, &show_ipv6_ospf6_neighbor_cmd
);
1095 install_element(VIEW_NODE
, &show_ipv6_ospf6_neighbor_one_cmd
);
1098 DEFUN (debug_ospf6_neighbor
,
1099 debug_ospf6_neighbor_cmd
,
1100 "debug ospf6 neighbor [<state|event>]",
1103 "Debug OSPFv3 Neighbor\n"
1104 "Debug OSPFv3 Neighbor State Change\n"
1105 "Debug OSPFv3 Neighbor Event\n")
1108 unsigned char level
= 0;
1111 if (!strncmp(argv
[idx_type
]->arg
, "s", 1))
1112 level
= OSPF6_DEBUG_NEIGHBOR_STATE
;
1113 else if (!strncmp(argv
[idx_type
]->arg
, "e", 1))
1114 level
= OSPF6_DEBUG_NEIGHBOR_EVENT
;
1116 level
= OSPF6_DEBUG_NEIGHBOR_STATE
| OSPF6_DEBUG_NEIGHBOR_EVENT
;
1118 OSPF6_DEBUG_NEIGHBOR_ON(level
);
1123 DEFUN (no_debug_ospf6_neighbor
,
1124 no_debug_ospf6_neighbor_cmd
,
1125 "no debug ospf6 neighbor [<state|event>]",
1129 "Debug OSPFv3 Neighbor\n"
1130 "Debug OSPFv3 Neighbor State Change\n"
1131 "Debug OSPFv3 Neighbor Event\n")
1134 unsigned char level
= 0;
1137 if (!strncmp(argv
[idx_type
]->arg
, "s", 1))
1138 level
= OSPF6_DEBUG_NEIGHBOR_STATE
;
1139 if (!strncmp(argv
[idx_type
]->arg
, "e", 1))
1140 level
= OSPF6_DEBUG_NEIGHBOR_EVENT
;
1142 level
= OSPF6_DEBUG_NEIGHBOR_STATE
| OSPF6_DEBUG_NEIGHBOR_EVENT
;
1144 OSPF6_DEBUG_NEIGHBOR_OFF(level
);
1149 DEFUN (no_debug_ospf6
,
1157 struct ospf6_lsa_handler
*handler
= NULL
;
1159 OSPF6_DEBUG_ABR_OFF();
1160 OSPF6_DEBUG_ASBR_OFF();
1161 OSPF6_DEBUG_BROUTER_OFF();
1162 OSPF6_DEBUG_BROUTER_SPECIFIC_ROUTER_OFF();
1163 OSPF6_DEBUG_BROUTER_SPECIFIC_AREA_OFF();
1164 OSPF6_DEBUG_FLOODING_OFF();
1165 OSPF6_DEBUG_INTERFACE_OFF();
1167 for (i
= 0; i
< vector_active(ospf6_lsa_handler_vector
); i
++) {
1168 handler
= vector_slot(ospf6_lsa_handler_vector
, i
);
1170 if (handler
!= NULL
) {
1171 UNSET_FLAG(handler
->lh_debug
, OSPF6_LSA_DEBUG
);
1175 for (i
= 0; i
< 6; i
++)
1176 OSPF6_DEBUG_MESSAGE_OFF(i
,
1177 OSPF6_DEBUG_NEIGHBOR_STATE
1178 | OSPF6_DEBUG_NEIGHBOR_EVENT
);
1180 OSPF6_DEBUG_NEIGHBOR_OFF(OSPF6_DEBUG_NEIGHBOR_STATE
1181 | OSPF6_DEBUG_NEIGHBOR_EVENT
);
1182 OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_TABLE
);
1183 OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_INTRA
);
1184 OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_INTER
);
1185 OSPF6_DEBUG_ROUTE_OFF(OSPF6_DEBUG_ROUTE_MEMORY
);
1186 OSPF6_DEBUG_SPF_OFF(OSPF6_DEBUG_SPF_PROCESS
);
1187 OSPF6_DEBUG_SPF_OFF(OSPF6_DEBUG_SPF_TIME
);
1188 OSPF6_DEBUG_SPF_OFF(OSPF6_DEBUG_SPF_DATABASE
);
1189 OSPF6_DEBUG_ZEBRA_OFF(OSPF6_DEBUG_ZEBRA_SEND
| OSPF6_DEBUG_ZEBRA_RECV
);
1194 int config_write_ospf6_debug_neighbor(struct vty
*vty
)
1196 if (IS_OSPF6_DEBUG_NEIGHBOR(STATE
) && IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
1197 vty_out(vty
, "debug ospf6 neighbor\n");
1198 else if (IS_OSPF6_DEBUG_NEIGHBOR(STATE
))
1199 vty_out(vty
, "debug ospf6 neighbor state\n");
1200 else if (IS_OSPF6_DEBUG_NEIGHBOR(EVENT
))
1201 vty_out(vty
, "debug ospf6 neighbor event\n");
1205 void install_element_ospf6_debug_neighbor(void)
1207 install_element(ENABLE_NODE
, &debug_ospf6_neighbor_cmd
);
1208 install_element(ENABLE_NODE
, &no_debug_ospf6_neighbor_cmd
);
1209 install_element(ENABLE_NODE
, &no_debug_ospf6_cmd
);
1210 install_element(CONFIG_NODE
, &debug_ospf6_neighbor_cmd
);
1211 install_element(CONFIG_NODE
, &no_debug_ospf6_neighbor_cmd
);
1212 install_element(CONFIG_NODE
, &no_debug_ospf6_cmd
);