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
31 #include "ospf6_proto.h"
32 #include "ospf6_lsa.h"
33 #include "ospf6_lsdb.h"
34 #include "ospf6_route.h"
35 #include "ospf6_top.h"
36 #include "ospf6_area.h"
37 #include "ospf6_interface.h"
39 #include "ospf6_zebra.h"
41 unsigned char conf_debug_ospf6_route
= 0;
43 static char *ospf6_route_table_name(struct ospf6_route_table
*table
)
46 switch (table
->scope_type
) {
47 case OSPF6_SCOPE_TYPE_GLOBAL
: {
48 switch (table
->table_type
) {
49 case OSPF6_TABLE_TYPE_ROUTES
:
50 snprintf(name
, sizeof(name
), "global route table");
52 case OSPF6_TABLE_TYPE_BORDER_ROUTERS
:
53 snprintf(name
, sizeof(name
), "global brouter table");
55 case OSPF6_TABLE_TYPE_EXTERNAL_ROUTES
:
56 snprintf(name
, sizeof(name
), "global external table");
59 snprintf(name
, sizeof(name
), "global unknown table");
64 case OSPF6_SCOPE_TYPE_AREA
: {
65 struct ospf6_area
*oa
= (struct ospf6_area
*)table
->scope
;
66 switch (table
->table_type
) {
67 case OSPF6_TABLE_TYPE_SPF_RESULTS
:
68 snprintf(name
, sizeof(name
), "area %s spf table",
71 case OSPF6_TABLE_TYPE_ROUTES
:
72 snprintf(name
, sizeof(name
), "area %s route table",
75 case OSPF6_TABLE_TYPE_PREFIX_RANGES
:
76 snprintf(name
, sizeof(name
), "area %s range table",
79 case OSPF6_TABLE_TYPE_SUMMARY_PREFIXES
:
80 snprintf(name
, sizeof(name
),
81 "area %s summary prefix table", oa
->name
);
83 case OSPF6_TABLE_TYPE_SUMMARY_ROUTERS
:
84 snprintf(name
, sizeof(name
),
85 "area %s summary router table", oa
->name
);
88 snprintf(name
, sizeof(name
), "area %s unknown table",
94 case OSPF6_SCOPE_TYPE_INTERFACE
: {
95 struct ospf6_interface
*oi
=
96 (struct ospf6_interface
*)table
->scope
;
97 switch (table
->table_type
) {
98 case OSPF6_TABLE_TYPE_CONNECTED_ROUTES
:
99 snprintf(name
, sizeof(name
),
100 "interface %s connected table",
101 oi
->interface
->name
);
104 snprintf(name
, sizeof(name
),
105 "interface %s unknown table",
106 oi
->interface
->name
);
112 switch (table
->table_type
) {
113 case OSPF6_TABLE_TYPE_SPF_RESULTS
:
114 snprintf(name
, sizeof(name
), "temporary spf table");
117 snprintf(name
, sizeof(name
), "temporary unknown table");
125 void ospf6_linkstate_prefix(u_int32_t adv_router
, u_int32_t id
,
126 struct prefix
*prefix
)
128 memset(prefix
, 0, sizeof(struct prefix
));
129 prefix
->family
= AF_INET6
;
130 prefix
->prefixlen
= 64;
131 memcpy(&prefix
->u
.prefix6
.s6_addr
[0], &adv_router
, 4);
132 memcpy(&prefix
->u
.prefix6
.s6_addr
[4], &id
, 4);
135 void ospf6_linkstate_prefix2str(struct prefix
*prefix
, char *buf
, int size
)
137 u_int32_t adv_router
, id
;
138 char adv_router_str
[16], id_str
[16];
139 memcpy(&adv_router
, &prefix
->u
.prefix6
.s6_addr
[0], 4);
140 memcpy(&id
, &prefix
->u
.prefix6
.s6_addr
[4], 4);
141 inet_ntop(AF_INET
, &adv_router
, adv_router_str
, sizeof(adv_router_str
));
142 inet_ntop(AF_INET
, &id
, id_str
, sizeof(id_str
));
144 snprintf(buf
, size
, "%s Net-ID: %s", adv_router_str
, id_str
);
146 snprintf(buf
, size
, "%s", adv_router_str
);
149 /* Global strings for logging */
150 const char *ospf6_dest_type_str
[OSPF6_DEST_TYPE_MAX
] = {
151 "Unknown", "Router", "Network", "Discard", "Linkstate", "AddressRange",
154 const char *ospf6_dest_type_substr
[OSPF6_DEST_TYPE_MAX
] = {
155 "?", "R", "N", "D", "L", "A",
158 const char *ospf6_path_type_str
[OSPF6_PATH_TYPE_MAX
] = {
159 "Unknown", "Intra-Area", "Inter-Area", "External-1", "External-2",
162 const char *ospf6_path_type_substr
[OSPF6_PATH_TYPE_MAX
] = {
163 "??", "IA", "IE", "E1", "E2",
167 struct ospf6_nexthop
*ospf6_nexthop_create(void)
169 struct ospf6_nexthop
*nh
;
171 nh
= XCALLOC(MTYPE_OSPF6_NEXTHOP
, sizeof(struct ospf6_nexthop
));
175 void ospf6_nexthop_delete(struct ospf6_nexthop
*nh
)
178 XFREE(MTYPE_OSPF6_NEXTHOP
, nh
);
181 void ospf6_clear_nexthops(struct list
*nh_list
)
183 struct listnode
*node
;
184 struct ospf6_nexthop
*nh
;
187 for (ALL_LIST_ELEMENTS_RO(nh_list
, node
, nh
))
188 ospf6_nexthop_clear(nh
);
192 static struct ospf6_nexthop
*
193 ospf6_route_find_nexthop(struct list
*nh_list
, struct ospf6_nexthop
*nh_match
)
195 struct listnode
*node
;
196 struct ospf6_nexthop
*nh
;
198 if (nh_list
&& nh_match
) {
199 for (ALL_LIST_ELEMENTS_RO(nh_list
, node
, nh
)) {
200 if (ospf6_nexthop_is_same(nh
, nh_match
))
208 void ospf6_copy_nexthops(struct list
*dst
, struct list
*src
)
210 struct ospf6_nexthop
*nh_new
, *nh
;
211 struct listnode
*node
;
214 for (ALL_LIST_ELEMENTS_RO(src
, node
, nh
)) {
215 if (ospf6_nexthop_is_set(nh
)) {
216 nh_new
= ospf6_nexthop_create();
217 ospf6_nexthop_copy(nh_new
, nh
);
218 listnode_add_sort(dst
, nh_new
);
224 void ospf6_merge_nexthops(struct list
*dst
, struct list
*src
)
226 struct listnode
*node
;
227 struct ospf6_nexthop
*nh
, *nh_new
;
230 for (ALL_LIST_ELEMENTS_RO(src
, node
, nh
)) {
231 if (!ospf6_route_find_nexthop(dst
, nh
)) {
232 nh_new
= ospf6_nexthop_create();
233 ospf6_nexthop_copy(nh_new
, nh
);
234 listnode_add_sort(dst
, nh_new
);
240 int ospf6_route_cmp_nexthops(struct ospf6_route
*a
, struct ospf6_route
*b
)
242 struct listnode
*anode
, *bnode
;
243 struct ospf6_nexthop
*anh
, *bnh
;
244 bool identical
= false;
247 if (listcount(a
->nh_list
) == listcount(b
->nh_list
)) {
248 for (ALL_LIST_ELEMENTS_RO(a
->nh_list
, anode
, anh
)) {
250 for (ALL_LIST_ELEMENTS_RO(b
->nh_list
, bnode
,
252 if (ospf6_nexthop_is_same(anh
, bnh
))
255 /* Currnet List A element not found List B
256 * Non-Identical lists return */
257 if (identical
== false)
264 /* One of the routes doesn't exist ? */
268 int ospf6_num_nexthops(struct list
*nh_list
)
270 return (listcount(nh_list
));
273 void ospf6_add_nexthop(struct list
*nh_list
, int ifindex
, struct in6_addr
*addr
)
275 struct ospf6_nexthop
*nh
;
276 struct ospf6_nexthop nh_match
;
279 nh_match
.ifindex
= ifindex
;
281 memcpy(&nh_match
.address
, addr
,
282 sizeof(struct in6_addr
));
284 memset(&nh_match
.address
, 0, sizeof(struct in6_addr
));
286 if (!ospf6_route_find_nexthop(nh_list
, &nh_match
)) {
287 nh
= ospf6_nexthop_create();
288 ospf6_nexthop_copy(nh
, &nh_match
);
289 listnode_add(nh_list
, nh
);
294 void ospf6_route_zebra_copy_nexthops(struct ospf6_route
*route
,
295 struct zapi_nexthop nexthops
[],
298 struct ospf6_nexthop
*nh
;
299 struct listnode
*node
;
305 for (ALL_LIST_ELEMENTS_RO(route
->nh_list
, node
, nh
)) {
306 if (IS_OSPF6_DEBUG_ZEBRA(SEND
)) {
308 inet_ntop(AF_INET6
, &nh
->address
, buf
,
310 ifname
= ifindex2ifname(nh
->ifindex
,
312 zlog_debug(" nexthop: %s%%%.*s(%d)", buf
,
313 IFNAMSIZ
, ifname
, nh
->ifindex
);
318 nexthops
[i
].ifindex
= nh
->ifindex
;
319 if (!IN6_IS_ADDR_UNSPECIFIED(&nh
->address
)) {
320 nexthops
[i
].gate
.ipv6
= nh
->address
;
321 nexthops
[i
].type
= NEXTHOP_TYPE_IPV6_IFINDEX
;
323 nexthops
[i
].type
= NEXTHOP_TYPE_IFINDEX
;
329 int ospf6_route_get_first_nh_index(struct ospf6_route
*route
)
331 struct ospf6_nexthop
*nh
;
334 if ((nh
= (struct ospf6_nexthop
*)listhead(route
->nh_list
)))
335 return (nh
->ifindex
);
341 int ospf6_nexthop_cmp(struct ospf6_nexthop
*a
, struct ospf6_nexthop
*b
)
343 if (a
->ifindex
< b
->ifindex
)
345 else if (a
->ifindex
> b
->ifindex
)
348 return memcmp(&a
->address
, &b
->address
,
349 sizeof(struct in6_addr
));
354 static int ospf6_path_cmp(struct ospf6_path
*a
, struct ospf6_path
*b
)
356 if (a
->origin
.adv_router
< b
->origin
.adv_router
)
358 else if (a
->origin
.adv_router
> b
->origin
.adv_router
)
364 void ospf6_path_free(struct ospf6_path
*op
)
367 list_delete_and_null(&op
->nh_list
);
368 XFREE(MTYPE_OSPF6_PATH
, op
);
371 struct ospf6_path
*ospf6_path_dup(struct ospf6_path
*path
)
373 struct ospf6_path
*new;
375 new = XCALLOC(MTYPE_OSPF6_PATH
, sizeof(struct ospf6_path
));
376 memcpy(new, path
, sizeof(struct ospf6_path
));
377 new->nh_list
= list_new();
378 new->nh_list
->cmp
= (int (*)(void *, void *))ospf6_nexthop_cmp
;
379 new->nh_list
->del
= (void (*) (void *))ospf6_nexthop_delete
;
384 struct ospf6_route
*ospf6_route_create(void)
386 struct ospf6_route
*route
;
387 route
= XCALLOC(MTYPE_OSPF6_ROUTE
, sizeof(struct ospf6_route
));
388 route
->nh_list
= list_new();
389 route
->nh_list
->cmp
= (int (*)(void *, void *))ospf6_nexthop_cmp
;
390 route
->nh_list
->del
= (void (*) (void *))ospf6_nexthop_delete
;
391 route
->paths
= list_new();
392 route
->paths
->cmp
= (int (*)(void *, void *))ospf6_path_cmp
;
393 route
->paths
->del
= (void (*)(void *))ospf6_path_free
;
397 void ospf6_route_delete(struct ospf6_route
*route
)
401 list_delete_and_null(&route
->nh_list
);
403 list_delete_and_null(&route
->paths
);
404 XFREE(MTYPE_OSPF6_ROUTE
, route
);
408 struct ospf6_route
*ospf6_route_copy(struct ospf6_route
*route
)
410 struct ospf6_route
*new;
412 new = ospf6_route_create();
413 new->type
= route
->type
;
414 memcpy(&new->prefix
, &route
->prefix
, sizeof(struct prefix
));
415 new->installed
= route
->installed
;
416 new->changed
= route
->changed
;
417 new->flag
= route
->flag
;
418 new->route_option
= route
->route_option
;
419 new->linkstate_id
= route
->linkstate_id
;
420 new->path
= route
->path
;
421 ospf6_copy_nexthops(new->nh_list
, route
->nh_list
);
430 void ospf6_route_lock(struct ospf6_route
*route
)
435 void ospf6_route_unlock(struct ospf6_route
*route
)
437 assert(route
->lock
> 0);
439 if (route
->lock
== 0) {
440 /* Can't detach from the table until here
441 because ospf6_route_next () will use
442 the 'route->table' pointer for logging */
444 ospf6_route_delete(route
);
448 /* Route compare function. If ra is more preferred, it returns
449 less than 0. If rb is more preferred returns greater than 0.
450 Otherwise (neither one is preferred), returns 0 */
451 int ospf6_route_cmp(struct ospf6_route
*ra
, struct ospf6_route
*rb
)
453 assert(ospf6_route_is_same(ra
, rb
));
454 assert(OSPF6_PATH_TYPE_NONE
< ra
->path
.type
455 && ra
->path
.type
< OSPF6_PATH_TYPE_MAX
);
456 assert(OSPF6_PATH_TYPE_NONE
< rb
->path
.type
457 && rb
->path
.type
< OSPF6_PATH_TYPE_MAX
);
459 if (ra
->type
!= rb
->type
)
460 return (ra
->type
- rb
->type
);
462 if (ra
->path
.area_id
!= rb
->path
.area_id
)
463 return (ntohl(ra
->path
.area_id
) - ntohl(rb
->path
.area_id
));
465 if (ra
->path
.type
!= rb
->path
.type
)
466 return (ra
->path
.type
- rb
->path
.type
);
468 if (ra
->path
.type
== OSPF6_PATH_TYPE_EXTERNAL2
) {
469 if (ra
->path
.u
.cost_e2
!= rb
->path
.u
.cost_e2
)
470 return (ra
->path
.u
.cost_e2
- rb
->path
.u
.cost_e2
);
472 if (ra
->path
.cost
!= rb
->path
.cost
)
473 return (ra
->path
.cost
- rb
->path
.cost
);
479 struct ospf6_route
*ospf6_route_lookup(struct prefix
*prefix
,
480 struct ospf6_route_table
*table
)
482 struct route_node
*node
;
483 struct ospf6_route
*route
;
485 node
= route_node_lookup(table
->table
, prefix
);
489 route
= (struct ospf6_route
*)node
->info
;
490 route_unlock_node(node
); /* to free the lookup lock */
495 ospf6_route_lookup_identical(struct ospf6_route
*route
,
496 struct ospf6_route_table
*table
)
498 struct ospf6_route
*target
;
500 for (target
= ospf6_route_lookup(&route
->prefix
, table
); target
;
501 target
= target
->next
) {
502 if (target
->type
== route
->type
&&
503 (memcmp(&target
->prefix
, &route
->prefix
,
504 sizeof(struct prefix
)) == 0) &&
505 target
->path
.type
== route
->path
.type
&&
506 target
->path
.cost
== route
->path
.cost
&&
507 target
->path
.u
.cost_e2
== route
->path
.u
.cost_e2
&&
508 ospf6_route_cmp_nexthops(target
, route
) == 0)
515 ospf6_route_lookup_bestmatch(struct prefix
*prefix
,
516 struct ospf6_route_table
*table
)
518 struct route_node
*node
;
519 struct ospf6_route
*route
;
521 node
= route_node_match(table
->table
, prefix
);
524 route_unlock_node(node
);
526 route
= (struct ospf6_route
*)node
->info
;
531 static void route_table_assert(struct ospf6_route_table
*table
)
533 struct ospf6_route
*prev
, *r
, *next
;
534 char buf
[PREFIX2STR_BUFFER
];
535 unsigned int link_error
= 0, num
= 0;
537 r
= ospf6_route_head(table
);
543 next
= ospf6_route_next(r
);
552 for (r
= ospf6_route_head(table
); r
; r
= ospf6_route_next(r
))
555 if (link_error
== 0 && num
== table
->count
)
558 zlog_err("PANIC !!");
559 zlog_err("Something has gone wrong with ospf6_route_table[%p]", table
);
560 zlog_debug("table count = %d, real number = %d", table
->count
, num
);
561 zlog_debug("DUMP START");
562 for (r
= ospf6_route_head(table
); r
; r
= ospf6_route_next(r
)) {
563 prefix2str(&r
->prefix
, buf
, sizeof(buf
));
564 zlog_info("%p<-[%p]->%p : %s", r
->prev
, r
, r
->next
, buf
);
566 zlog_debug("DUMP END");
568 assert(link_error
== 0 && num
== table
->count
);
570 #define ospf6_route_table_assert(t) (route_table_assert (t))
572 #define ospf6_route_table_assert(t) ((void) 0)
575 struct ospf6_route
*ospf6_route_add(struct ospf6_route
*route
,
576 struct ospf6_route_table
*table
)
578 struct route_node
*node
, *nextnode
, *prevnode
;
579 struct ospf6_route
*current
= NULL
;
580 struct ospf6_route
*prev
= NULL
, *old
= NULL
, *next
= NULL
;
581 char buf
[PREFIX2STR_BUFFER
];
584 assert(route
->rnode
== NULL
);
585 assert(route
->lock
== 0);
586 assert(route
->next
== NULL
);
587 assert(route
->prev
== NULL
);
589 if (route
->type
== OSPF6_DEST_TYPE_LINKSTATE
)
590 ospf6_linkstate_prefix2str(&route
->prefix
, buf
, sizeof(buf
));
592 prefix2str(&route
->prefix
, buf
, sizeof(buf
));
594 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
595 zlog_debug("%s %p: route add %p: %s",
596 ospf6_route_table_name(table
), (void *)table
,
598 else if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
599 zlog_debug("%s: route add: %s", ospf6_route_table_name(table
),
604 node
= route_node_get(table
->table
, &route
->prefix
);
607 /* find place to insert */
608 for (current
= node
->info
; current
; current
= current
->next
) {
609 if (!ospf6_route_is_same(current
, route
))
611 else if (current
->type
!= route
->type
)
613 else if (ospf6_route_is_same_origin(current
, route
))
615 else if (ospf6_route_cmp(current
, route
) > 0)
625 /* if route does not actually change, return unchanged */
626 if (ospf6_route_is_identical(old
, route
)) {
627 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
629 "%s %p: route add %p: needless update of %p",
630 ospf6_route_table_name(table
),
631 (void *)table
, (void *)route
,
633 else if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
634 zlog_debug("%s: route add: needless update",
635 ospf6_route_table_name(table
));
637 ospf6_route_delete(route
);
638 SET_FLAG(old
->flag
, OSPF6_ROUTE_ADD
);
639 ospf6_route_table_assert(table
);
641 /* to free the lookup lock */
642 route_unlock_node(node
);
646 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
647 zlog_debug("%s %p: route add %p: update of %p",
648 ospf6_route_table_name(table
), (void *)table
,
649 (void *)route
, (void *)old
);
650 else if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
651 zlog_debug("%s: route add: update",
652 ospf6_route_table_name(table
));
654 /* replace old one if exists */
655 if (node
->info
== old
) {
657 SET_FLAG(route
->flag
, OSPF6_ROUTE_BEST
);
661 old
->prev
->next
= route
;
662 route
->prev
= old
->prev
;
664 old
->next
->prev
= route
;
665 route
->next
= old
->next
;
667 route
->installed
= old
->installed
;
668 route
->changed
= now
;
669 assert(route
->table
== NULL
);
670 route
->table
= table
;
672 ospf6_route_unlock(old
); /* will be deleted later */
673 ospf6_route_lock(route
);
675 SET_FLAG(route
->flag
, OSPF6_ROUTE_CHANGE
);
676 ospf6_route_table_assert(table
);
679 (*table
->hook_add
)(route
);
684 /* insert if previous or next node found */
686 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
688 "%s %p: route add %p: another path: prev %p, next %p node refcount %u",
689 ospf6_route_table_name(table
), (void *)table
,
690 (void *)route
, (void *)prev
, (void *)next
,
692 else if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
693 zlog_debug("%s: route add: another path found",
694 ospf6_route_table_name(table
));
708 if (node
->info
== next
) {
709 assert(next
->rnode
== node
);
711 UNSET_FLAG(next
->flag
, OSPF6_ROUTE_BEST
);
712 SET_FLAG(route
->flag
, OSPF6_ROUTE_BEST
);
713 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
715 "%s %p: route add %p: replacing previous best: %p",
716 ospf6_route_table_name(table
),
717 (void *)table
, (void *)route
,
721 route
->installed
= now
;
722 route
->changed
= now
;
723 assert(route
->table
== NULL
);
724 route
->table
= table
;
726 ospf6_route_lock(route
);
728 ospf6_route_table_assert(table
);
730 SET_FLAG(route
->flag
, OSPF6_ROUTE_ADD
);
732 (*table
->hook_add
)(route
);
737 /* Else, this is the brand new route regarding to the prefix */
738 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
739 zlog_debug("%s %p: route add %p %s : brand new route",
740 ospf6_route_table_name(table
), (void *)table
,
742 else if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
743 zlog_debug("%s: route add: brand new route",
744 ospf6_route_table_name(table
));
746 assert(node
->info
== NULL
);
748 SET_FLAG(route
->flag
, OSPF6_ROUTE_BEST
);
749 ospf6_route_lock(route
);
750 route
->installed
= now
;
751 route
->changed
= now
;
752 assert(route
->table
== NULL
);
753 route
->table
= table
;
755 /* lookup real existing next route */
757 route_lock_node(nextnode
);
759 nextnode
= route_next(nextnode
);
760 } while (nextnode
&& nextnode
->info
== NULL
);
763 if (nextnode
== NULL
)
766 route_unlock_node(nextnode
);
768 next
= nextnode
->info
;
773 /* lookup real existing prev route */
775 route_lock_node(prevnode
);
777 prevnode
= route_prev(prevnode
);
778 } while (prevnode
&& prevnode
->info
== NULL
);
781 if (prevnode
== NULL
)
784 route_unlock_node(prevnode
);
786 prev
= prevnode
->info
;
787 while (prev
->next
&& ospf6_route_is_same(prev
, prev
->next
))
794 ospf6_route_table_assert(table
);
796 SET_FLAG(route
->flag
, OSPF6_ROUTE_ADD
);
798 (*table
->hook_add
)(route
);
803 void ospf6_route_remove(struct ospf6_route
*route
,
804 struct ospf6_route_table
*table
)
806 struct route_node
*node
;
807 struct ospf6_route
*current
;
808 char buf
[PREFIX2STR_BUFFER
];
810 if (route
->type
== OSPF6_DEST_TYPE_LINKSTATE
)
811 ospf6_linkstate_prefix2str(&route
->prefix
, buf
, sizeof(buf
));
813 prefix2str(&route
->prefix
, buf
, sizeof(buf
));
815 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
816 zlog_debug("%s %p: route remove %p: %s refcount %u",
817 ospf6_route_table_name(table
), (void *)table
,
818 (void *)route
, buf
, route
->lock
);
819 else if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
820 zlog_debug("%s: route remove: %s",
821 ospf6_route_table_name(table
), buf
);
823 node
= route_node_lookup(table
->table
, &route
->prefix
);
826 /* find the route to remove, making sure that the route pointer
827 is from the route table. */
828 current
= node
->info
;
829 while (current
&& current
!= route
)
830 current
= current
->next
;
832 assert(current
== route
);
834 /* adjust doubly linked list */
836 route
->prev
->next
= route
->next
;
838 route
->next
->prev
= route
->prev
;
840 if (node
->info
== route
) {
841 if (route
->next
&& route
->next
->rnode
== node
) {
842 node
->info
= route
->next
;
843 SET_FLAG(route
->next
->flag
, OSPF6_ROUTE_BEST
);
847 route_unlock_node(node
); /* to free the original lock */
851 route_unlock_node(node
); /* to free the lookup lock */
853 ospf6_route_table_assert(table
);
855 SET_FLAG(route
->flag
, OSPF6_ROUTE_WAS_REMOVED
);
857 /* Note hook_remove may call ospf6_route_remove */
858 if (table
->hook_remove
)
859 (*table
->hook_remove
)(route
);
861 ospf6_route_unlock(route
);
864 struct ospf6_route
*ospf6_route_head(struct ospf6_route_table
*table
)
866 struct route_node
*node
;
867 struct ospf6_route
*route
;
869 node
= route_top(table
->table
);
873 /* skip to the real existing entry */
874 while (node
&& node
->info
== NULL
)
875 node
= route_next(node
);
879 route_unlock_node(node
);
882 route
= (struct ospf6_route
*)node
->info
;
883 assert(route
->prev
== NULL
);
884 assert(route
->table
== table
);
885 ospf6_route_lock(route
);
887 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
888 zlog_info("%s %p: route head: %p<-[%p]->%p",
889 ospf6_route_table_name(table
), (void *)table
,
890 (void *)route
->prev
, (void *)route
,
891 (void *)route
->next
);
896 struct ospf6_route
*ospf6_route_next(struct ospf6_route
*route
)
898 struct ospf6_route
*next
= route
->next
;
900 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
901 zlog_info("%s %p: route next: %p<-[%p]->%p",
902 ospf6_route_table_name(route
->table
),
903 (void *)route
->table
, (void *)route
->prev
,
904 (void *)route
, (void *)route
->next
);
906 ospf6_route_unlock(route
);
908 ospf6_route_lock(next
);
913 struct ospf6_route
*ospf6_route_best_next(struct ospf6_route
*route
)
915 struct route_node
*rnode
;
916 struct ospf6_route
*next
;
918 ospf6_route_unlock(route
);
920 rnode
= route
->rnode
;
921 route_lock_node(rnode
);
922 rnode
= route_next(rnode
);
923 while (rnode
&& rnode
->info
== NULL
)
924 rnode
= route_next(rnode
);
927 route_unlock_node(rnode
);
930 next
= (struct ospf6_route
*)rnode
->info
;
931 ospf6_route_lock(next
);
935 struct ospf6_route
*ospf6_route_match_head(struct prefix
*prefix
,
936 struct ospf6_route_table
*table
)
938 struct route_node
*node
;
939 struct ospf6_route
*route
;
941 /* Walk down tree. */
942 node
= table
->table
->top
;
943 while (node
&& node
->p
.prefixlen
< prefix
->prefixlen
944 && prefix_match(&node
->p
, prefix
))
945 node
= node
->link
[prefix_bit(&prefix
->u
.prefix
,
949 route_lock_node(node
);
950 while (node
&& node
->info
== NULL
)
951 node
= route_next(node
);
954 route_unlock_node(node
);
956 if (!prefix_match(prefix
, &node
->p
))
960 ospf6_route_lock(route
);
964 struct ospf6_route
*ospf6_route_match_next(struct prefix
*prefix
,
965 struct ospf6_route
*route
)
967 struct ospf6_route
*next
;
969 next
= ospf6_route_next(route
);
970 if (next
&& !prefix_match(prefix
, &next
->prefix
)) {
971 ospf6_route_unlock(next
);
978 void ospf6_route_remove_all(struct ospf6_route_table
*table
)
980 struct ospf6_route
*route
;
981 for (route
= ospf6_route_head(table
); route
;
982 route
= ospf6_route_next(route
))
983 ospf6_route_remove(route
, table
);
986 struct ospf6_route_table
*ospf6_route_table_create(int s
, int t
)
988 struct ospf6_route_table
*new;
989 new = XCALLOC(MTYPE_OSPF6_ROUTE
, sizeof(struct ospf6_route_table
));
990 new->table
= route_table_init();
996 void ospf6_route_table_delete(struct ospf6_route_table
*table
)
998 ospf6_route_remove_all(table
);
999 bf_free(table
->idspace
);
1000 route_table_finish(table
->table
);
1001 XFREE(MTYPE_OSPF6_ROUTE
, table
);
1006 void ospf6_route_show(struct vty
*vty
, struct ospf6_route
*route
)
1009 char destination
[PREFIX2STR_BUFFER
], nexthop
[64];
1012 struct timeval now
, res
;
1013 struct listnode
*node
;
1014 struct ospf6_nexthop
*nh
;
1017 timersub(&now
, &route
->changed
, &res
);
1018 timerstring(&res
, duration
, sizeof(duration
));
1021 if (route
->type
== OSPF6_DEST_TYPE_LINKSTATE
)
1022 ospf6_linkstate_prefix2str(&route
->prefix
, destination
,
1023 sizeof(destination
));
1024 else if (route
->type
== OSPF6_DEST_TYPE_ROUTER
)
1025 inet_ntop(route
->prefix
.family
, &route
->prefix
.u
.prefix
,
1026 destination
, sizeof(destination
));
1028 prefix2str(&route
->prefix
, destination
, sizeof(destination
));
1031 for (ALL_LIST_ELEMENTS_RO(route
->nh_list
, node
, nh
)) {
1033 inet_ntop(AF_INET6
, &nh
->address
, nexthop
, sizeof(nexthop
));
1034 ifname
= ifindex2ifname(nh
->ifindex
, VRF_DEFAULT
);
1037 vty_out(vty
, "%c%1s %2s %-30s %-25s %6.*s %s\n",
1038 (ospf6_route_is_best(route
) ? '*' : ' '),
1039 OSPF6_DEST_TYPE_SUBSTR(route
->type
),
1040 OSPF6_PATH_TYPE_SUBSTR(route
->path
.type
),
1041 destination
, nexthop
, IFNAMSIZ
, ifname
,
1045 vty_out(vty
, "%c%1s %2s %-30s %-25s %6.*s %s\n", ' ',
1046 "", "", "", nexthop
, IFNAMSIZ
, ifname
, "");
1050 void ospf6_route_show_detail(struct vty
*vty
, struct ospf6_route
*route
)
1053 char destination
[PREFIX2STR_BUFFER
], nexthop
[64];
1054 char area_id
[16], id
[16], adv_router
[16], capa
[16], options
[16];
1055 struct timeval now
, res
;
1057 struct listnode
*node
;
1058 struct ospf6_nexthop
*nh
;
1063 if (route
->type
== OSPF6_DEST_TYPE_LINKSTATE
)
1064 ospf6_linkstate_prefix2str(&route
->prefix
, destination
,
1065 sizeof(destination
));
1066 else if (route
->type
== OSPF6_DEST_TYPE_ROUTER
)
1067 inet_ntop(route
->prefix
.family
, &route
->prefix
.u
.prefix
,
1068 destination
, sizeof(destination
));
1070 prefix2str(&route
->prefix
, destination
, sizeof(destination
));
1071 vty_out(vty
, "Destination: %s\n", destination
);
1073 /* destination type */
1074 vty_out(vty
, "Destination type: %s\n",
1075 OSPF6_DEST_TYPE_NAME(route
->type
));
1078 timersub(&now
, &route
->installed
, &res
);
1079 timerstring(&res
, duration
, sizeof(duration
));
1080 vty_out(vty
, "Installed Time: %s ago\n", duration
);
1082 timersub(&now
, &route
->changed
, &res
);
1083 timerstring(&res
, duration
, sizeof(duration
));
1084 vty_out(vty
, " Changed Time: %s ago\n", duration
);
1086 /* Debugging info */
1087 vty_out(vty
, "Lock: %d Flags: %s%s%s%s\n", route
->lock
,
1088 (CHECK_FLAG(route
->flag
, OSPF6_ROUTE_BEST
) ? "B" : "-"),
1089 (CHECK_FLAG(route
->flag
, OSPF6_ROUTE_ADD
) ? "A" : "-"),
1090 (CHECK_FLAG(route
->flag
, OSPF6_ROUTE_REMOVE
) ? "R" : "-"),
1091 (CHECK_FLAG(route
->flag
, OSPF6_ROUTE_CHANGE
) ? "C" : "-"));
1092 vty_out(vty
, "Memory: prev: %p this: %p next: %p\n",
1093 (void *)route
->prev
, (void *)route
, (void *)route
->next
);
1098 inet_ntop(AF_INET
, &route
->path
.area_id
, area_id
, sizeof(area_id
));
1099 vty_out(vty
, "Associated Area: %s\n", area_id
);
1102 vty_out(vty
, "Path Type: %s\n", OSPF6_PATH_TYPE_NAME(route
->path
.type
));
1105 inet_ntop(AF_INET
, &route
->path
.origin
.id
, id
, sizeof(id
));
1106 inet_ntop(AF_INET
, &route
->path
.origin
.adv_router
, adv_router
,
1107 sizeof(adv_router
));
1108 vty_out(vty
, "LS Origin: %s Id: %s Adv: %s\n",
1109 ospf6_lstype_name(route
->path
.origin
.type
), id
, adv_router
);
1112 ospf6_options_printbuf(route
->path
.options
, options
, sizeof(options
));
1113 vty_out(vty
, "Options: %s\n", options
);
1116 ospf6_capability_printbuf(route
->path
.router_bits
, capa
, sizeof(capa
));
1117 vty_out(vty
, "Router Bits: %s\n", capa
);
1119 /* Prefix Options */
1120 vty_out(vty
, "Prefix Options: xxx\n");
1123 vty_out(vty
, "Metric Type: %d\n", route
->path
.metric_type
);
1124 vty_out(vty
, "Metric: %d (%d)\n", route
->path
.cost
,
1125 route
->path
.u
.cost_e2
);
1127 vty_out(vty
, "Paths count: %u\n", route
->paths
->count
);
1128 vty_out(vty
, "Nexthop count: %u\n", route
->nh_list
->count
);
1130 vty_out(vty
, "Nexthop:\n");
1131 for (ALL_LIST_ELEMENTS_RO(route
->nh_list
, node
, nh
)) {
1133 inet_ntop(AF_INET6
, &nh
->address
, nexthop
, sizeof(nexthop
));
1134 ifname
= ifindex2ifname(nh
->ifindex
, VRF_DEFAULT
);
1135 vty_out(vty
, " %s %.*s\n", nexthop
, IFNAMSIZ
, ifname
);
1140 static void ospf6_route_show_table_summary(struct vty
*vty
,
1141 struct ospf6_route_table
*table
)
1143 struct ospf6_route
*route
, *prev
= NULL
;
1144 int i
, pathtype
[OSPF6_PATH_TYPE_MAX
];
1145 unsigned int number
= 0;
1146 int nh_count
= 0, nhinval
= 0, ecmp
= 0;
1147 int alternative
= 0, destination
= 0;
1149 for (i
= 0; i
< OSPF6_PATH_TYPE_MAX
; i
++)
1152 for (route
= ospf6_route_head(table
); route
;
1153 route
= ospf6_route_next(route
)) {
1154 if (prev
== NULL
|| !ospf6_route_is_same(prev
, route
))
1158 nh_count
= ospf6_num_nexthops(route
->nh_list
);
1161 else if (nh_count
> 1)
1163 pathtype
[route
->path
.type
]++;
1169 assert(number
== table
->count
);
1171 vty_out(vty
, "Number of OSPFv3 routes: %d\n", number
);
1172 vty_out(vty
, "Number of Destination: %d\n", destination
);
1173 vty_out(vty
, "Number of Alternative routes: %d\n", alternative
);
1174 vty_out(vty
, "Number of Equal Cost Multi Path: %d\n", ecmp
);
1175 for (i
= OSPF6_PATH_TYPE_INTRA
; i
<= OSPF6_PATH_TYPE_EXTERNAL2
; i
++) {
1176 vty_out(vty
, "Number of %s routes: %d\n",
1177 OSPF6_PATH_TYPE_NAME(i
), pathtype
[i
]);
1181 static void ospf6_route_show_table_prefix(struct vty
*vty
,
1182 struct prefix
*prefix
,
1183 struct ospf6_route_table
*table
)
1185 struct ospf6_route
*route
;
1187 route
= ospf6_route_lookup(prefix
, table
);
1191 ospf6_route_lock(route
);
1192 while (route
&& ospf6_route_is_prefix(prefix
, route
)) {
1193 /* Specifying a prefix will always display details */
1194 ospf6_route_show_detail(vty
, route
);
1195 route
= ospf6_route_next(route
);
1198 ospf6_route_unlock(route
);
1201 static void ospf6_route_show_table_address(struct vty
*vty
,
1202 struct prefix
*prefix
,
1203 struct ospf6_route_table
*table
)
1205 struct ospf6_route
*route
;
1207 route
= ospf6_route_lookup_bestmatch(prefix
, table
);
1211 prefix
= &route
->prefix
;
1212 ospf6_route_lock(route
);
1213 while (route
&& ospf6_route_is_prefix(prefix
, route
)) {
1214 /* Specifying a prefix will always display details */
1215 ospf6_route_show_detail(vty
, route
);
1216 route
= ospf6_route_next(route
);
1219 ospf6_route_unlock(route
);
1222 static void ospf6_route_show_table_match(struct vty
*vty
, int detail
,
1223 struct prefix
*prefix
,
1224 struct ospf6_route_table
*table
)
1226 struct ospf6_route
*route
;
1227 assert(prefix
->family
);
1229 route
= ospf6_route_match_head(prefix
, table
);
1232 ospf6_route_show_detail(vty
, route
);
1234 ospf6_route_show(vty
, route
);
1235 route
= ospf6_route_match_next(prefix
, route
);
1239 static void ospf6_route_show_table_type(struct vty
*vty
, int detail
,
1241 struct ospf6_route_table
*table
)
1243 struct ospf6_route
*route
;
1245 route
= ospf6_route_head(table
);
1247 if (route
->path
.type
== type
) {
1249 ospf6_route_show_detail(vty
, route
);
1251 ospf6_route_show(vty
, route
);
1253 route
= ospf6_route_next(route
);
1257 static void ospf6_route_show_table(struct vty
*vty
, int detail
,
1258 struct ospf6_route_table
*table
)
1260 struct ospf6_route
*route
;
1262 route
= ospf6_route_head(table
);
1265 ospf6_route_show_detail(vty
, route
);
1267 ospf6_route_show(vty
, route
);
1268 route
= ospf6_route_next(route
);
1272 int ospf6_route_table_show(struct vty
*vty
, int argc_start
, int argc
,
1273 struct cmd_token
**argv
,
1274 struct ospf6_route_table
*table
)
1282 struct prefix prefix
;
1285 memset(&prefix
, 0, sizeof(struct prefix
));
1287 for (i
= argc_start
; i
< argc
; i
++) {
1288 if (strmatch(argv
[i
]->text
, "summary")) {
1293 if (strmatch(argv
[i
]->text
, "intra-area")) {
1294 type
= OSPF6_PATH_TYPE_INTRA
;
1298 if (strmatch(argv
[i
]->text
, "inter-area")) {
1299 type
= OSPF6_PATH_TYPE_INTER
;
1303 if (strmatch(argv
[i
]->text
, "external-1")) {
1304 type
= OSPF6_PATH_TYPE_EXTERNAL1
;
1308 if (strmatch(argv
[i
]->text
, "external-2")) {
1309 type
= OSPF6_PATH_TYPE_EXTERNAL2
;
1313 if (strmatch(argv
[i
]->text
, "detail")) {
1318 if (strmatch(argv
[i
]->text
, "match")) {
1323 ret
= str2prefix(argv
[i
]->arg
, &prefix
);
1324 if (ret
== 1 && prefix
.family
== AF_INET6
) {
1326 if (strchr(argv
[i
]->arg
, '/'))
1331 vty_out(vty
, "Malformed argument: %s\n", argv
[i
]->arg
);
1335 /* Give summary of this route table */
1337 ospf6_route_show_table_summary(vty
, table
);
1341 /* Give exact prefix-match route */
1342 if (isprefix
&& !match
) {
1343 /* If exact address, give best matching route */
1345 ospf6_route_show_table_address(vty
, &prefix
, table
);
1347 ospf6_route_show_table_prefix(vty
, &prefix
, table
);
1353 ospf6_route_show_table_match(vty
, detail
, &prefix
, table
);
1355 ospf6_route_show_table_type(vty
, detail
, type
, table
);
1357 ospf6_route_show_table(vty
, detail
, table
);
1362 static void ospf6_linkstate_show_header(struct vty
*vty
)
1364 vty_out(vty
, "%-7s %-15s %-15s %-8s %-14s %s\n", "Type", "Router-ID",
1365 "Net-ID", "Rtr-Bits", "Options", "Cost");
1368 static void ospf6_linkstate_show(struct vty
*vty
, struct ospf6_route
*route
)
1370 u_int32_t router
, id
;
1371 char routername
[16], idname
[16], rbits
[16], options
[16];
1373 router
= ospf6_linkstate_prefix_adv_router(&route
->prefix
);
1374 inet_ntop(AF_INET
, &router
, routername
, sizeof(routername
));
1375 id
= ospf6_linkstate_prefix_id(&route
->prefix
);
1376 inet_ntop(AF_INET
, &id
, idname
, sizeof(idname
));
1378 ospf6_capability_printbuf(route
->path
.router_bits
, rbits
,
1380 ospf6_options_printbuf(route
->path
.options
, options
, sizeof(options
));
1383 vty_out(vty
, "%-7s %-15s %-15s %-8s %-14s %lu\n", "Network",
1384 routername
, idname
, rbits
, options
,
1385 (unsigned long)route
->path
.cost
);
1387 vty_out(vty
, "%-7s %-15s %-15s %-8s %-14s %lu\n", "Router",
1388 routername
, idname
, rbits
, options
,
1389 (unsigned long)route
->path
.cost
);
1393 static void ospf6_linkstate_show_table_exact(struct vty
*vty
,
1394 struct prefix
*prefix
,
1395 struct ospf6_route_table
*table
)
1397 struct ospf6_route
*route
;
1399 route
= ospf6_route_lookup(prefix
, table
);
1403 ospf6_route_lock(route
);
1404 while (route
&& ospf6_route_is_prefix(prefix
, route
)) {
1405 /* Specifying a prefix will always display details */
1406 ospf6_route_show_detail(vty
, route
);
1407 route
= ospf6_route_next(route
);
1410 ospf6_route_unlock(route
);
1413 static void ospf6_linkstate_show_table(struct vty
*vty
, int detail
,
1414 struct ospf6_route_table
*table
)
1416 struct ospf6_route
*route
;
1419 ospf6_linkstate_show_header(vty
);
1421 route
= ospf6_route_head(table
);
1424 ospf6_route_show_detail(vty
, route
);
1426 ospf6_linkstate_show(vty
, route
);
1427 route
= ospf6_route_next(route
);
1431 int ospf6_linkstate_table_show(struct vty
*vty
, int idx_ipv4
, int argc
,
1432 struct cmd_token
**argv
,
1433 struct ospf6_route_table
*table
)
1439 struct prefix router
, id
, prefix
;
1441 memset(&router
, 0, sizeof(struct prefix
));
1442 memset(&id
, 0, sizeof(struct prefix
));
1443 memset(&prefix
, 0, sizeof(struct prefix
));
1445 for (i
= idx_ipv4
; i
< argc
; i
++) {
1446 if (strmatch(argv
[i
]->text
, "detail")) {
1452 ret
= str2prefix(argv
[i
]->arg
, &router
);
1453 if (ret
== 1 && router
.family
== AF_INET
) {
1457 vty_out(vty
, "Malformed argument: %s\n", argv
[i
]->arg
);
1462 ret
= str2prefix(argv
[i
]->arg
, &id
);
1463 if (ret
== 1 && id
.family
== AF_INET
) {
1467 vty_out(vty
, "Malformed argument: %s\n", argv
[i
]->arg
);
1471 vty_out(vty
, "Malformed argument: %s\n", argv
[i
]->arg
);
1476 ospf6_linkstate_prefix(router
.u
.prefix4
.s_addr
,
1477 id
.u
.prefix4
.s_addr
, &prefix
);
1480 ospf6_linkstate_show_table_exact(vty
, &prefix
, table
);
1482 ospf6_linkstate_show_table(vty
, detail
, table
);
1488 void ospf6_brouter_show_header(struct vty
*vty
)
1490 vty_out(vty
, "%-15s %-8s %-14s %-10s %-15s\n", "Router-ID", "Rtr-Bits",
1491 "Options", "Path-Type", "Area");
1494 void ospf6_brouter_show(struct vty
*vty
, struct ospf6_route
*route
)
1496 u_int32_t adv_router
;
1497 char adv
[16], rbits
[16], options
[16], area
[16];
1499 adv_router
= ospf6_linkstate_prefix_adv_router(&route
->prefix
);
1500 inet_ntop(AF_INET
, &adv_router
, adv
, sizeof(adv
));
1501 ospf6_capability_printbuf(route
->path
.router_bits
, rbits
,
1503 ospf6_options_printbuf(route
->path
.options
, options
, sizeof(options
));
1504 inet_ntop(AF_INET
, &route
->path
.area_id
, area
, sizeof(area
));
1506 /* vty_out (vty, "%-15s %-8s %-14s %-10s %-15s\n",
1507 "Router-ID", "Rtr-Bits", "Options", "Path-Type", "Area"); */
1508 vty_out(vty
, "%-15s %-8s %-14s %-10s %-15s\n", adv
, rbits
, options
,
1509 OSPF6_PATH_TYPE_NAME(route
->path
.type
), area
);
1512 DEFUN (debug_ospf6_route
,
1513 debug_ospf6_route_cmd
,
1514 "debug ospf6 route <table|intra-area|inter-area|memory>",
1518 "Debug route table calculation\n"
1519 "Debug intra-area route calculation\n"
1520 "Debug inter-area route calculation\n"
1521 "Debug route memory use\n"
1525 unsigned char level
= 0;
1527 if (!strcmp(argv
[idx_type
]->text
, "table"))
1528 level
= OSPF6_DEBUG_ROUTE_TABLE
;
1529 else if (!strcmp(argv
[idx_type
]->text
, "intra-area"))
1530 level
= OSPF6_DEBUG_ROUTE_INTRA
;
1531 else if (!strcmp(argv
[idx_type
]->text
, "inter-area"))
1532 level
= OSPF6_DEBUG_ROUTE_INTER
;
1533 else if (!strcmp(argv
[idx_type
]->text
, "memory"))
1534 level
= OSPF6_DEBUG_ROUTE_MEMORY
;
1535 OSPF6_DEBUG_ROUTE_ON(level
);
1539 DEFUN (no_debug_ospf6_route
,
1540 no_debug_ospf6_route_cmd
,
1541 "no debug ospf6 route <table|intra-area|inter-area|memory>",
1546 "Debug route table calculation\n"
1547 "Debug intra-area route calculation\n"
1548 "Debug inter-area route calculation\n"
1549 "Debug route memory use\n")
1552 unsigned char level
= 0;
1554 if (!strcmp(argv
[idx_type
]->text
, "table"))
1555 level
= OSPF6_DEBUG_ROUTE_TABLE
;
1556 else if (!strcmp(argv
[idx_type
]->text
, "intra-area"))
1557 level
= OSPF6_DEBUG_ROUTE_INTRA
;
1558 else if (!strcmp(argv
[idx_type
]->text
, "inter-area"))
1559 level
= OSPF6_DEBUG_ROUTE_INTER
;
1560 else if (!strcmp(argv
[idx_type
]->text
, "memory"))
1561 level
= OSPF6_DEBUG_ROUTE_MEMORY
;
1562 OSPF6_DEBUG_ROUTE_OFF(level
);
1566 int config_write_ospf6_debug_route(struct vty
*vty
)
1568 if (IS_OSPF6_DEBUG_ROUTE(TABLE
))
1569 vty_out(vty
, "debug ospf6 route table\n");
1570 if (IS_OSPF6_DEBUG_ROUTE(INTRA
))
1571 vty_out(vty
, "debug ospf6 route intra-area\n");
1572 if (IS_OSPF6_DEBUG_ROUTE(INTER
))
1573 vty_out(vty
, "debug ospf6 route inter-area\n");
1574 if (IS_OSPF6_DEBUG_ROUTE(MEMORY
))
1575 vty_out(vty
, "debug ospf6 route memory\n");
1580 void install_element_ospf6_debug_route(void)
1582 install_element(ENABLE_NODE
, &debug_ospf6_route_cmd
);
1583 install_element(ENABLE_NODE
, &no_debug_ospf6_route_cmd
);
1584 install_element(CONFIG_NODE
, &debug_ospf6_route_cmd
);
1585 install_element(CONFIG_NODE
, &no_debug_ospf6_route_cmd
);