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
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
33 #include "ospf6_proto.h"
34 #include "ospf6_message.h"
35 #include "ospf6_lsa.h"
36 #include "ospf6_lsdb.h"
37 #include "ospf6_route.h"
38 #include "ospf6_zebra.h"
40 #include "ospf6_top.h"
41 #include "ospf6_area.h"
42 #include "ospf6_interface.h"
43 #include "ospf6_neighbor.h"
45 #include "ospf6_flood.h"
46 #include "ospf6_asbr.h"
47 #include "ospf6_abr.h"
48 #include "ospf6_intra.h"
49 #include "ospf6_spf.h"
52 /* global ospf6d variable */
55 static void ospf6_disable (struct ospf6
*o
);
58 ospf6_top_lsdb_hook_add (struct ospf6_lsa
*lsa
)
60 switch (ntohs (lsa
->header
->type
))
62 case OSPF6_LSTYPE_AS_EXTERNAL
:
63 ospf6_asbr_lsa_add (lsa
);
72 ospf6_top_lsdb_hook_remove (struct ospf6_lsa
*lsa
)
74 switch (ntohs (lsa
->header
->type
))
76 case OSPF6_LSTYPE_AS_EXTERNAL
:
77 ospf6_asbr_lsa_remove (lsa
);
86 ospf6_top_route_hook_add (struct ospf6_route
*route
)
88 ospf6_abr_originate_summary (route
);
89 ospf6_zebra_route_update_add (route
);
93 ospf6_top_route_hook_remove (struct ospf6_route
*route
)
95 route
->flag
|= OSPF6_ROUTE_REMOVE
;
96 ospf6_abr_originate_summary (route
);
97 ospf6_zebra_route_update_remove (route
);
101 ospf6_top_brouter_hook_add (struct ospf6_route
*route
)
103 ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route
->prefix
));
104 ospf6_asbr_lsentry_add (route
);
105 ospf6_abr_originate_summary (route
);
109 ospf6_top_brouter_hook_remove (struct ospf6_route
*route
)
111 route
->flag
|= OSPF6_ROUTE_REMOVE
;
112 ospf6_abr_examin_brouter (ADV_ROUTER_IN_PREFIX (&route
->prefix
));
113 ospf6_asbr_lsentry_remove (route
);
114 ospf6_abr_originate_summary (route
);
117 static struct ospf6
*
122 o
= XCALLOC (MTYPE_OSPF6_TOP
, sizeof (struct ospf6
));
125 quagga_gettime (QUAGGA_CLK_MONOTONIC
, &o
->starttime
);
126 o
->area_list
= list_new ();
127 o
->area_list
->cmp
= ospf6_area_cmp
;
128 o
->lsdb
= ospf6_lsdb_create (o
);
129 o
->lsdb_self
= ospf6_lsdb_create (o
);
130 o
->lsdb
->hook_add
= ospf6_top_lsdb_hook_add
;
131 o
->lsdb
->hook_remove
= ospf6_top_lsdb_hook_remove
;
133 o
->spf_delay
= OSPF_SPF_DELAY_DEFAULT
;
134 o
->spf_holdtime
= OSPF_SPF_HOLDTIME_DEFAULT
;
135 o
->spf_max_holdtime
= OSPF_SPF_MAX_HOLDTIME_DEFAULT
;
136 o
->spf_hold_multiplier
= 1;
138 o
->route_table
= OSPF6_ROUTE_TABLE_CREATE (GLOBAL
, ROUTES
);
139 o
->route_table
->scope
= o
;
140 o
->route_table
->hook_add
= ospf6_top_route_hook_add
;
141 o
->route_table
->hook_remove
= ospf6_top_route_hook_remove
;
143 o
->brouter_table
= OSPF6_ROUTE_TABLE_CREATE (GLOBAL
, BORDER_ROUTERS
);
144 o
->brouter_table
->scope
= o
;
145 o
->brouter_table
->hook_add
= ospf6_top_brouter_hook_add
;
146 o
->brouter_table
->hook_remove
= ospf6_top_brouter_hook_remove
;
148 o
->external_table
= OSPF6_ROUTE_TABLE_CREATE (GLOBAL
, EXTERNAL_ROUTES
);
149 o
->external_table
->scope
= o
;
151 o
->external_id_table
= route_table_init ();
153 o
->ref_bandwidth
= OSPF6_REFERENCE_BANDWIDTH
;
159 ospf6_delete (struct ospf6
*o
)
161 struct listnode
*node
, *nnode
;
162 struct ospf6_area
*oa
;
164 ospf6_disable (ospf6
);
166 for (ALL_LIST_ELEMENTS (o
->area_list
, node
, nnode
, oa
))
167 ospf6_area_delete (oa
);
170 list_delete (o
->area_list
);
172 ospf6_lsdb_delete (o
->lsdb
);
173 ospf6_lsdb_delete (o
->lsdb_self
);
175 ospf6_route_table_delete (o
->route_table
);
176 ospf6_route_table_delete (o
->brouter_table
);
178 ospf6_route_table_delete (o
->external_table
);
179 route_table_finish (o
->external_id_table
);
181 XFREE (MTYPE_OSPF6_TOP
, o
);
185 ospf6_enable (struct ospf6
*o
)
187 struct listnode
*node
, *nnode
;
188 struct ospf6_area
*oa
;
190 if (CHECK_FLAG (o
->flag
, OSPF6_DISABLED
))
192 UNSET_FLAG (o
->flag
, OSPF6_DISABLED
);
193 for (ALL_LIST_ELEMENTS (o
->area_list
, node
, nnode
, oa
))
194 ospf6_area_enable (oa
);
199 ospf6_disable (struct ospf6
*o
)
201 struct listnode
*node
, *nnode
;
202 struct ospf6_area
*oa
;
204 if (! CHECK_FLAG (o
->flag
, OSPF6_DISABLED
))
206 SET_FLAG (o
->flag
, OSPF6_DISABLED
);
208 for (ALL_LIST_ELEMENTS (o
->area_list
, node
, nnode
, oa
))
209 ospf6_area_disable (oa
);
211 /* XXX: This also changes persistent settings */
212 ospf6_asbr_redistribute_reset();
214 ospf6_lsdb_remove_all (o
->lsdb
);
215 ospf6_route_remove_all (o
->route_table
);
216 ospf6_route_remove_all (o
->brouter_table
);
218 THREAD_OFF(o
->maxage_remover
);
219 THREAD_OFF(o
->t_spf_calc
);
220 THREAD_OFF(o
->t_ase_calc
);
225 ospf6_maxage_remover (struct thread
*thread
)
227 struct ospf6
*o
= (struct ospf6
*) THREAD_ARG (thread
);
228 struct ospf6_area
*oa
;
229 struct ospf6_interface
*oi
;
230 struct ospf6_neighbor
*on
;
231 struct listnode
*i
, *j
, *k
;
234 o
->maxage_remover
= (struct thread
*) NULL
;
236 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
238 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
240 for (ALL_LIST_ELEMENTS_RO (oi
->neighbor_list
, k
, on
))
242 if (on
->state
!= OSPF6_NEIGHBOR_EXCHANGE
&&
243 on
->state
!= OSPF6_NEIGHBOR_LOADING
)
246 ospf6_maxage_remove (o
);
252 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, i
, oa
))
254 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, j
, oi
))
256 if (ospf6_lsdb_maxage_remover (oi
->lsdb
))
262 if (ospf6_lsdb_maxage_remover (oa
->lsdb
))
268 if (ospf6_lsdb_maxage_remover (o
->lsdb
))
275 ospf6_maxage_remove (o
);
282 ospf6_maxage_remove (struct ospf6
*o
)
284 if (o
&& ! o
->maxage_remover
)
285 o
->maxage_remover
= thread_add_timer (master
, ospf6_maxage_remover
, o
,
286 OSPF_LSA_MAXAGE_REMOVE_DELAY_DEFAULT
);
297 ospf6
= ospf6_create ();
299 /* set current ospf point. */
300 vty
->node
= OSPF6_NODE
;
307 DEFUN (no_router_ospf6
,
314 vty_out (vty
, "OSPFv3 is not configured%s", VNL
);
317 ospf6_delete (ospf6
);
321 /* return to config node . */
322 vty
->node
= CONFIG_NODE
;
328 /* change Router_ID commands. */
329 DEFUN (ospf6_router_id
,
332 "Configure OSPF Router-ID\n"
339 o
= (struct ospf6
*) vty
->index
;
341 ret
= inet_pton (AF_INET
, argv
[0], &router_id
);
344 vty_out (vty
, "malformed OSPF Router-ID: %s%s", argv
[0], VNL
);
348 o
->router_id_static
= router_id
;
349 if (o
->router_id
== 0)
350 o
->router_id
= router_id
;
355 DEFUN (ospf6_log_adjacency_changes
,
356 ospf6_log_adjacency_changes_cmd
,
357 "log-adjacency-changes",
358 "Log changes in adjacency state\n")
360 struct ospf6
*ospf6
= vty
->index
;
362 SET_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_CHANGES
);
366 DEFUN (ospf6_log_adjacency_changes_detail
,
367 ospf6_log_adjacency_changes_detail_cmd
,
368 "log-adjacency-changes detail",
369 "Log changes in adjacency state\n"
370 "Log all state changes\n")
372 struct ospf6
*ospf6
= vty
->index
;
374 SET_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_CHANGES
);
375 SET_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_DETAIL
);
379 DEFUN (no_ospf6_log_adjacency_changes
,
380 no_ospf6_log_adjacency_changes_cmd
,
381 "no log-adjacency-changes",
383 "Log changes in adjacency state\n")
385 struct ospf6
*ospf6
= vty
->index
;
387 UNSET_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_DETAIL
);
388 UNSET_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_CHANGES
);
392 DEFUN (no_ospf6_log_adjacency_changes_detail
,
393 no_ospf6_log_adjacency_changes_detail_cmd
,
394 "no log-adjacency-changes detail",
396 "Log changes in adjacency state\n"
397 "Log all state changes\n")
399 struct ospf6
*ospf6
= vty
->index
;
401 UNSET_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_DETAIL
);
405 DEFUN (ospf6_interface_area
,
406 ospf6_interface_area_cmd
,
407 "interface IFNAME area A.B.C.D",
408 "Enable routing on an IPv6 interface\n"
410 "Specify the OSPF6 area ID\n"
411 "OSPF6 area ID in IPv4 address notation\n"
415 struct ospf6_area
*oa
;
416 struct ospf6_interface
*oi
;
417 struct interface
*ifp
;
420 o
= (struct ospf6
*) vty
->index
;
422 /* find/create ospf6 interface */
423 ifp
= if_get_by_name (argv
[0]);
424 oi
= (struct ospf6_interface
*) ifp
->info
;
426 oi
= ospf6_interface_create (ifp
);
429 vty_out (vty
, "%s already attached to Area %s%s",
430 oi
->interface
->name
, oi
->area
->name
, VNL
);
435 if (inet_pton (AF_INET
, argv
[1], &area_id
) != 1)
437 vty_out (vty
, "Invalid Area-ID: %s%s", argv
[1], VNL
);
441 /* find/create ospf6 area */
442 oa
= ospf6_area_lookup (area_id
, o
);
444 oa
= ospf6_area_create (area_id
, o
);
446 /* attach interface to area */
447 listnode_add (oa
->if_list
, oi
); /* sort ?? */
450 SET_FLAG (oa
->flag
, OSPF6_AREA_ENABLE
);
452 /* ospf6 process is currently disabled, not much more to do */
453 if (CHECK_FLAG (o
->flag
, OSPF6_DISABLED
))
457 ospf6_interface_enable (oi
);
459 /* If the router is ABR, originate summary routes */
460 if (ospf6_is_router_abr (o
))
461 ospf6_abr_enable_area (oa
);
466 DEFUN (no_ospf6_interface_area
,
467 no_ospf6_interface_area_cmd
,
468 "no interface IFNAME area A.B.C.D",
470 "Disable routing on an IPv6 interface\n"
472 "Specify the OSPF6 area ID\n"
473 "OSPF6 area ID in IPv4 address notation\n"
477 struct ospf6_interface
*oi
;
478 struct ospf6_area
*oa
;
479 struct interface
*ifp
;
482 o
= (struct ospf6
*) vty
->index
;
484 ifp
= if_lookup_by_name (argv
[0]);
487 vty_out (vty
, "No such interface %s%s", argv
[0], VNL
);
491 oi
= (struct ospf6_interface
*) ifp
->info
;
494 vty_out (vty
, "Interface %s not enabled%s", ifp
->name
, VNL
);
499 if (inet_pton (AF_INET
, argv
[1], &area_id
) != 1)
501 vty_out (vty
, "Invalid Area-ID: %s%s", argv
[1], VNL
);
506 if (oi
->area
== NULL
)
508 vty_out (vty
, "No such Area-ID: %s%s", argv
[1], VNL
);
512 if (oi
->area
->area_id
!= area_id
)
514 vty_out (vty
, "Wrong Area-ID: %s is attached to area %s%s",
515 oi
->interface
->name
, oi
->area
->name
, VNL
);
519 thread_execute (master
, interface_down
, oi
, 0);
522 listnode_delete (oi
->area
->if_list
, oi
);
523 oi
->area
= (struct ospf6_area
*) NULL
;
525 /* Withdraw inter-area routes from this area, if necessary */
526 if (oa
->if_list
->count
== 0)
528 UNSET_FLAG (oa
->flag
, OSPF6_AREA_ENABLE
);
529 ospf6_abr_disable_area (oa
);
535 DEFUN (ospf6_stub_router_admin
,
536 ospf6_stub_router_admin_cmd
,
537 "stub-router administrative",
538 "Make router a stub router\n"
539 "Advertise inability to be a transit router\n"
540 "Administratively applied, for an indefinite period\n")
542 struct listnode
*node
;
543 struct ospf6_area
*oa
;
545 if (!CHECK_FLAG (ospf6
->flag
, OSPF6_STUB_ROUTER
))
547 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
549 OSPF6_OPT_CLEAR (oa
->options
, OSPF6_OPT_V6
);
550 OSPF6_OPT_CLEAR (oa
->options
, OSPF6_OPT_R
);
551 OSPF6_ROUTER_LSA_SCHEDULE (oa
);
553 SET_FLAG (ospf6
->flag
, OSPF6_STUB_ROUTER
);
559 DEFUN (no_ospf6_stub_router_admin
,
560 no_ospf6_stub_router_admin_cmd
,
561 "no stub-router administrative",
563 "Make router a stub router\n"
564 "Advertise ability to be a transit router\n"
565 "Administratively applied, for an indefinite period\n")
567 struct listnode
*node
;
568 struct ospf6_area
*oa
;
570 if (CHECK_FLAG (ospf6
->flag
, OSPF6_STUB_ROUTER
))
572 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, node
, oa
))
574 OSPF6_OPT_SET (oa
->options
, OSPF6_OPT_V6
);
575 OSPF6_OPT_SET (oa
->options
, OSPF6_OPT_R
);
576 OSPF6_ROUTER_LSA_SCHEDULE (oa
);
578 UNSET_FLAG (ospf6
->flag
, OSPF6_STUB_ROUTER
);
584 DEFUN (ospf6_stub_router_startup
,
585 ospf6_stub_router_startup_cmd
,
586 "stub-router on-startup <5-86400>",
587 "Make router a stub router\n"
588 "Advertise inability to be a transit router\n"
589 "Automatically advertise as stub-router on startup of OSPF6\n"
590 "Time (seconds) to advertise self as stub-router\n")
595 DEFUN (no_ospf6_stub_router_startup
,
596 no_ospf6_stub_router_startup_cmd
,
597 "no stub-router on-startup",
599 "Make router a stub router\n"
600 "Advertise inability to be a transit router\n"
601 "Automatically advertise as stub-router on startup of OSPF6\n"
602 "Time (seconds) to advertise self as stub-router\n")
607 DEFUN (ospf6_stub_router_shutdown
,
608 ospf6_stub_router_shutdown_cmd
,
609 "stub-router on-shutdown <5-86400>",
610 "Make router a stub router\n"
611 "Advertise inability to be a transit router\n"
612 "Automatically advertise as stub-router before shutdown\n"
613 "Time (seconds) to advertise self as stub-router\n")
618 DEFUN (no_ospf6_stub_router_shutdown
,
619 no_ospf6_stub_router_shutdown_cmd
,
620 "no stub-router on-shutdown",
622 "Make router a stub router\n"
623 "Advertise inability to be a transit router\n"
624 "Automatically advertise as stub-router before shutdown\n"
625 "Time (seconds) to advertise self as stub-router\n")
631 ospf6_show (struct vty
*vty
, struct ospf6
*o
)
634 struct ospf6_area
*oa
;
635 char router_id
[16], duration
[32];
636 struct timeval now
, running
, result
;
637 char buf
[32], rbuf
[32];
639 /* process id, router id */
640 inet_ntop (AF_INET
, &o
->router_id
, router_id
, sizeof (router_id
));
641 vty_out (vty
, " OSPFv3 Routing Process (0) with Router-ID %s%s",
645 quagga_gettime (QUAGGA_CLK_MONOTONIC
, &now
);
646 timersub (&now
, &o
->starttime
, &running
);
647 timerstring (&running
, duration
, sizeof (duration
));
648 vty_out (vty
, " Running %s%s", duration
, VNL
);
650 /* Redistribute configuration */
653 /* Show SPF parameters */
654 vty_out(vty
, " Initial SPF scheduling delay %d millisec(s)%s"
655 " Minimum hold time between consecutive SPFs %d millsecond(s)%s"
656 " Maximum hold time between consecutive SPFs %d millsecond(s)%s"
657 " Hold time multiplier is currently %d%s",
659 o
->spf_holdtime
, VNL
,
660 o
->spf_max_holdtime
, VNL
,
661 o
->spf_hold_multiplier
, VNL
);
663 vty_out(vty
, " SPF algorithm ");
664 if (o
->ts_spf
.tv_sec
|| o
->ts_spf
.tv_usec
)
666 timersub(&now
, &o
->ts_spf
, &result
);
667 timerstring(&result
, buf
, sizeof(buf
));
668 ospf6_spf_reason_string(o
->last_spf_reason
, rbuf
, sizeof(rbuf
));
669 vty_out(vty
, "last executed %s ago, reason %s%s", buf
, rbuf
, VNL
);
670 vty_out (vty
, " Last SPF duration %ld sec %ld usec%s",
671 o
->ts_spf_duration
.tv_sec
, o
->ts_spf_duration
.tv_usec
, VNL
);
674 vty_out(vty
, "has not been run$%s", VNL
);
675 threadtimer_string(now
, o
->t_spf_calc
, buf
, sizeof(buf
));
676 vty_out (vty
, " SPF timer %s%s%s",
677 (o
->t_spf_calc
? "due in " : "is "), buf
, VNL
);
679 if (CHECK_FLAG (o
->flag
, OSPF6_STUB_ROUTER
))
680 vty_out (vty
, " Router Is Stub Router%s", VNL
);
683 vty_out (vty
, " Number of AS scoped LSAs is %u%s",
684 o
->lsdb
->count
, VNL
);
687 vty_out (vty
, " Number of areas in this router is %u%s",
688 listcount (o
->area_list
), VNL
);
690 if (CHECK_FLAG(o
->config_flags
, OSPF6_LOG_ADJACENCY_CHANGES
))
692 if (CHECK_FLAG(o
->config_flags
, OSPF6_LOG_ADJACENCY_DETAIL
))
693 vty_out(vty
, " All adjacency changes are logged%s",VTY_NEWLINE
);
695 vty_out(vty
, " Adjacency changes are logged%s",VTY_NEWLINE
);
698 vty_out (vty
, "%s",VTY_NEWLINE
);
700 for (ALL_LIST_ELEMENTS_RO (o
->area_list
, n
, oa
))
701 ospf6_area_show (vty
, oa
);
704 /* show top level structures */
705 DEFUN (show_ipv6_ospf6
,
712 OSPF6_CMD_CHECK_RUNNING ();
714 ospf6_show (vty
, ospf6
);
718 DEFUN (show_ipv6_ospf6_route
,
719 show_ipv6_ospf6_route_cmd
,
720 "show ipv6 ospf6 route",
727 OSPF6_CMD_CHECK_RUNNING ();
729 ospf6_route_table_show (vty
, argc
, argv
, ospf6
->route_table
);
733 ALIAS (show_ipv6_ospf6_route
,
734 show_ipv6_ospf6_route_detail_cmd
,
735 "show ipv6 ospf6 route (X:X::X:X|X:X::X:X/M|detail|summary)",
740 "Specify IPv6 address\n"
741 "Specify IPv6 prefix\n"
742 "Detailed information\n"
743 "Summary of route table\n"
746 DEFUN (show_ipv6_ospf6_route_match
,
747 show_ipv6_ospf6_route_match_cmd
,
748 "show ipv6 ospf6 route X:X::X:X/M match",
753 "Specify IPv6 prefix\n"
754 "Display routes which match the specified route\n"
757 const char *sargv
[CMD_ARGC_MAX
];
760 OSPF6_CMD_CHECK_RUNNING ();
762 /* copy argv to sargv and then append "match" */
763 for (i
= 0; i
< argc
; i
++)
766 sargv
[sargc
++] = "match";
769 ospf6_route_table_show (vty
, sargc
, sargv
, ospf6
->route_table
);
773 DEFUN (show_ipv6_ospf6_route_match_detail
,
774 show_ipv6_ospf6_route_match_detail_cmd
,
775 "show ipv6 ospf6 route X:X::X:X/M match detail",
780 "Specify IPv6 prefix\n"
781 "Display routes which match the specified route\n"
782 "Detailed information\n"
785 const char *sargv
[CMD_ARGC_MAX
];
788 /* copy argv to sargv and then append "match" and "detail" */
789 for (i
= 0; i
< argc
; i
++)
792 sargv
[sargc
++] = "match";
793 sargv
[sargc
++] = "detail";
796 OSPF6_CMD_CHECK_RUNNING ();
798 ospf6_route_table_show (vty
, sargc
, sargv
, ospf6
->route_table
);
802 ALIAS (show_ipv6_ospf6_route_match
,
803 show_ipv6_ospf6_route_longer_cmd
,
804 "show ipv6 ospf6 route X:X::X:X/M longer",
809 "Specify IPv6 prefix\n"
810 "Display routes longer than the specified route\n"
813 DEFUN (show_ipv6_ospf6_route_match_detail
,
814 show_ipv6_ospf6_route_longer_detail_cmd
,
815 "show ipv6 ospf6 route X:X::X:X/M longer detail",
820 "Specify IPv6 prefix\n"
821 "Display routes longer than the specified route\n"
822 "Detailed information\n"
825 ALIAS (show_ipv6_ospf6_route
,
826 show_ipv6_ospf6_route_type_cmd
,
827 "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2)",
832 "Display Intra-Area routes\n"
833 "Display Inter-Area routes\n"
834 "Display Type-1 External routes\n"
835 "Display Type-2 External routes\n"
838 DEFUN (show_ipv6_ospf6_route_type_detail
,
839 show_ipv6_ospf6_route_type_detail_cmd
,
840 "show ipv6 ospf6 route (intra-area|inter-area|external-1|external-2) detail",
845 "Display Intra-Area routes\n"
846 "Display Inter-Area routes\n"
847 "Display Type-1 External routes\n"
848 "Display Type-2 External routes\n"
849 "Detailed information\n"
852 const char *sargv
[CMD_ARGC_MAX
];
855 /* copy argv to sargv and then append "detail" */
856 for (i
= 0; i
< argc
; i
++)
859 sargv
[sargc
++] = "detail";
862 OSPF6_CMD_CHECK_RUNNING ();
864 ospf6_route_table_show (vty
, sargc
, sargv
, ospf6
->route_table
);
869 ospf6_stub_router_config_write (struct vty
*vty
)
871 if (CHECK_FLAG (ospf6
->flag
, OSPF6_STUB_ROUTER
))
873 vty_out (vty
, " stub-router administrative%s", VNL
);
878 /* OSPF configuration write function. */
880 config_write_ospf6 (struct vty
*vty
)
883 struct listnode
*j
, *k
;
884 struct ospf6_area
*oa
;
885 struct ospf6_interface
*oi
;
887 /* OSPFv6 configuration. */
891 inet_ntop (AF_INET
, &ospf6
->router_id_static
, router_id
, sizeof (router_id
));
892 vty_out (vty
, "router ospf6%s", VNL
);
893 if (ospf6
->router_id_static
!= 0)
894 vty_out (vty
, " router-id %s%s", router_id
, VNL
);
896 /* log-adjacency-changes flag print. */
897 if (CHECK_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_CHANGES
))
899 vty_out(vty
, " log-adjacency-changes");
900 if (CHECK_FLAG(ospf6
->config_flags
, OSPF6_LOG_ADJACENCY_DETAIL
))
901 vty_out(vty
, " detail");
902 vty_out(vty
, "%s", VTY_NEWLINE
);
905 if (ospf6
->ref_bandwidth
!= OSPF6_REFERENCE_BANDWIDTH
)
906 vty_out (vty
, " auto-cost reference-bandwidth %d%s", ospf6
->ref_bandwidth
/ 1000,
909 ospf6_stub_router_config_write (vty
);
910 ospf6_redistribute_config_write (vty
);
911 ospf6_area_config_write (vty
);
912 ospf6_spf_config_write (vty
);
914 for (ALL_LIST_ELEMENTS_RO (ospf6
->area_list
, j
, oa
))
916 for (ALL_LIST_ELEMENTS_RO (oa
->if_list
, k
, oi
))
917 vty_out (vty
, " interface %s area %s%s",
918 oi
->interface
->name
, oa
->name
, VNL
);
920 vty_out (vty
, "!%s", VNL
);
924 /* OSPF6 node structure. */
925 static struct cmd_node ospf6_node
=
928 "%s(config-ospf6)# ",
932 /* Install ospf related commands. */
934 ospf6_top_init (void)
936 /* Install ospf6 top node. */
937 install_node (&ospf6_node
, config_write_ospf6
);
939 install_element (VIEW_NODE
, &show_ipv6_ospf6_cmd
);
940 install_element (ENABLE_NODE
, &show_ipv6_ospf6_cmd
);
941 install_element (CONFIG_NODE
, &router_ospf6_cmd
);
942 install_element (CONFIG_NODE
, &no_router_ospf6_cmd
);
944 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_cmd
);
945 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_detail_cmd
);
946 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_match_cmd
);
947 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_match_detail_cmd
);
948 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_longer_cmd
);
949 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_longer_detail_cmd
);
950 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_type_cmd
);
951 install_element (VIEW_NODE
, &show_ipv6_ospf6_route_type_detail_cmd
);
952 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_cmd
);
953 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_detail_cmd
);
954 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_match_cmd
);
955 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_match_detail_cmd
);
956 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_longer_cmd
);
957 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_longer_detail_cmd
);
958 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_type_cmd
);
959 install_element (ENABLE_NODE
, &show_ipv6_ospf6_route_type_detail_cmd
);
961 install_default (OSPF6_NODE
);
962 install_element (OSPF6_NODE
, &ospf6_router_id_cmd
);
963 install_element (OSPF6_NODE
, &ospf6_log_adjacency_changes_cmd
);
964 install_element (OSPF6_NODE
, &ospf6_log_adjacency_changes_detail_cmd
);
965 install_element (OSPF6_NODE
, &no_ospf6_log_adjacency_changes_cmd
);
966 install_element (OSPF6_NODE
, &no_ospf6_log_adjacency_changes_detail_cmd
);
967 install_element (OSPF6_NODE
, &ospf6_interface_area_cmd
);
968 install_element (OSPF6_NODE
, &no_ospf6_interface_area_cmd
);
969 install_element (OSPF6_NODE
, &ospf6_stub_router_admin_cmd
);
970 install_element (OSPF6_NODE
, &no_ospf6_stub_router_admin_cmd
);
972 install_element (OSPF6_NODE, &ospf6_stub_router_startup_cmd);
973 install_element (OSPF6_NODE, &no_ospf6_stub_router_startup_cmd);
974 install_element (OSPF6_NODE, &ospf6_stub_router_shutdown_cmd);
975 install_element (OSPF6_NODE, &no_ospf6_stub_router_shutdown_cmd);