2 * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com>
3 * Copyright (C) 2000 Toshiaki Takada
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
37 #include "ospfd/ospfd.h"
38 #include "ospfd/ospf_asbr.h"
39 #include "ospfd/ospf_lsa.h"
40 #include "ospfd/ospf_lsdb.h"
41 #include "ospfd/ospf_ism.h"
42 #include "ospfd/ospf_interface.h"
43 #include "ospfd/ospf_nsm.h"
44 #include "ospfd/ospf_neighbor.h"
45 #include "ospfd/ospf_flood.h"
46 #include "ospfd/ospf_abr.h"
47 #include "ospfd/ospf_spf.h"
48 #include "ospfd/ospf_route.h"
49 #include "ospfd/ospf_zebra.h"
50 /*#include "ospfd/ospf_routemap.h" */
51 #include "ospfd/ospf_vty.h"
52 #include "ospfd/ospf_dump.h"
53 #include "ospfd/ospf_bfd.h"
55 static const char *ospf_network_type_str
[] =
66 /* Utility functions. */
68 ospf_str2area_id (const char *str
, struct in_addr
*area_id
, int *format
)
73 /* match "A.B.C.D". */
74 if (strchr (str
, '.') != NULL
)
76 ret
= inet_aton (str
, area_id
);
79 *format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
81 /* match "<0-4294967295>". */
87 ret
= strtoul (str
, &endptr
, 10);
88 if (*endptr
!= '\0' || errno
|| ret
> UINT32_MAX
)
91 area_id
->s_addr
= htonl (ret
);
92 *format
= OSPF_AREA_ID_FORMAT_DECIMAL
;
100 str2metric (const char *str
, int *metric
)
106 *metric
= strtol (str
, NULL
, 10);
107 if (*metric
< 0 && *metric
> 16777214)
109 /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
117 str2metric_type (const char *str
, int *metric_type
)
123 if (strncmp (str
, "1", 1) == 0)
124 *metric_type
= EXTERNAL_METRIC_TYPE_1
;
125 else if (strncmp (str
, "2", 1) == 0)
126 *metric_type
= EXTERNAL_METRIC_TYPE_2
;
134 ospf_oi_count (struct interface
*ifp
)
136 struct route_node
*rn
;
139 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
150 "Enable a routing process\n"
151 "Start OSPF configuration\n")
154 u_short instance
= 0;
156 ospf
= ospf_lookup();
159 vty_out (vty
, "There isn't active ospf instance %s", VTY_NEWLINE
);
163 vty
->node
= OSPF_NODE
;
166 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
168 /* The following logic to set the vty->index is in place to be able
169 to ignore the commands which dont belong to this instance. */
170 if (ospf
->instance
!= instance
)
174 if (IS_DEBUG_OSPF_EVENT
)
175 zlog_debug ("Config command 'router ospf %d' received", instance
);
176 ospf
->oi_running
= 1;
178 ospf_router_id_update (ospf
);
185 router_ospf_instance_cmd
,
186 "router ospf <1-65535>",
187 "Enable a routing process\n"
188 "Start OSPF configuration\n"
191 DEFUN (no_router_ospf
,
195 "Enable a routing process\n"
196 "Start OSPF configuration\n")
199 u_short instance
= 0;
202 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
204 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
)
212 ALIAS (no_router_ospf
,
213 no_router_ospf_instance_cmd
,
214 "no router ospf <1-65535>",
216 "Enable a routing process\n"
217 "Start OSPF configuration\n"
220 DEFUN (ospf_router_id
,
222 "ospf router-id A.B.C.D",
223 "OSPF specific commands\n"
224 "router-id for the OSPF process\n"
225 "OSPF router-id in IP address format\n")
227 struct ospf
*ospf
= vty
->index
;
228 struct listnode
*node
;
229 struct ospf_area
*area
;
230 struct in_addr router_id
;
236 ret
= inet_aton (argv
[0], &router_id
);
239 vty_out (vty
, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE
);
243 ospf
->router_id_static
= router_id
;
245 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
248 vty_out (vty
, "For this router-id change to take effect,"
249 " save config and restart ospfd%s", VTY_NEWLINE
);
253 ospf_router_id_update (ospf
);
258 ALIAS (ospf_router_id
,
261 "router-id for the OSPF process\n"
262 "OSPF router-id in IP address format\n")
264 DEFUN (no_ospf_router_id
,
265 no_ospf_router_id_cmd
,
268 "OSPF specific commands\n"
269 "router-id for the OSPF process\n")
271 struct ospf
*ospf
= vty
->index
;
272 struct listnode
*node
;
273 struct ospf_area
*area
;
278 ospf
->router_id_static
.s_addr
= 0;
280 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
283 vty_out (vty
, "For this router-id change to take effect,"
284 " save config and restart ospfd%s", VTY_NEWLINE
);
288 ospf_router_id_update (ospf
);
293 ALIAS (no_ospf_router_id
,
294 no_router_ospf_id_cmd
,
297 "router-id for the OSPF process\n")
300 ospf_passive_interface_default (struct ospf
*ospf
, u_char newval
)
303 struct interface
*ifp
;
304 struct ospf_interface
*oi
;
306 ospf
->passive_interface_default
= newval
;
308 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, ln
, ifp
))
311 OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
))
312 UNSET_IF_PARAM (IF_DEF_PARAMS (ifp
), passive_interface
);
314 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, ln
, oi
))
316 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
))
317 UNSET_IF_PARAM (oi
->params
, passive_interface
);
318 /* update multicast memberships */
319 ospf_if_set_multicast(oi
);
324 ospf_passive_interface_update (struct ospf
*ospf
, struct interface
*ifp
,
326 struct ospf_if_params
*params
, u_char value
)
330 params
->passive_interface
= value
;
331 if (params
!= IF_DEF_PARAMS (ifp
))
333 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
))
334 dflt
= IF_DEF_PARAMS (ifp
)->passive_interface
;
336 dflt
= ospf
->passive_interface_default
;
339 SET_IF_PARAM (params
, passive_interface
);
341 UNSET_IF_PARAM (params
, passive_interface
);
343 ospf_free_if_params (ifp
, addr
);
344 ospf_if_update_params (ifp
, addr
);
348 if (value
!= ospf
->passive_interface_default
)
349 SET_IF_PARAM (params
, passive_interface
);
351 UNSET_IF_PARAM (params
, passive_interface
);
355 DEFUN (ospf_passive_interface
,
356 ospf_passive_interface_addr_cmd
,
357 "passive-interface IFNAME A.B.C.D",
358 "Suppress routing updates on an interface\n"
359 "Interface's name\n")
361 struct interface
*ifp
;
364 struct ospf_if_params
*params
;
365 struct route_node
*rn
;
366 struct ospf
*ospf
= vty
->index
;
373 ospf_passive_interface_default (ospf
, OSPF_IF_PASSIVE
);
377 ifp
= if_get_by_name (argv
[0]);
379 params
= IF_DEF_PARAMS (ifp
);
383 ret
= inet_aton(argv
[1], &addr
);
386 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
391 params
= ospf_get_if_params (ifp
, addr
);
392 ospf_if_update_params (ifp
, addr
);
394 ospf_passive_interface_update (ospf
, ifp
, addr
, params
, OSPF_IF_PASSIVE
);
396 /* XXX We should call ospf_if_set_multicast on exactly those
397 * interfaces for which the passive property changed. It is too much
398 * work to determine this set, so we do this for every interface.
399 * This is safe and reasonable because ospf_if_set_multicast uses a
400 * record of joined groups to avoid systems calls if the desired
401 * memberships match the current memership.
404 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
406 struct ospf_interface
*oi
= rn
->info
;
408 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_PASSIVE
))
409 ospf_if_set_multicast(oi
);
412 * XXX It is not clear what state transitions the interface needs to
413 * undergo when going from active to passive. Fixing this will
414 * require precise identification of interfaces having such a
421 ALIAS (ospf_passive_interface
,
422 ospf_passive_interface_cmd
,
423 "passive-interface IFNAME",
424 "Suppress routing updates on an interface\n"
425 "Interface's name\n")
427 ALIAS (ospf_passive_interface
,
428 ospf_passive_interface_default_cmd
,
429 "passive-interface default",
430 "Suppress routing updates on an interface\n"
431 "Suppress routing updates on interfaces by default\n")
433 DEFUN (no_ospf_passive_interface
,
434 no_ospf_passive_interface_addr_cmd
,
435 "no passive-interface IFNAME A.B.C.D",
437 "Allow routing updates on an interface\n"
438 "Interface's name\n")
440 struct interface
*ifp
;
442 struct ospf_if_params
*params
;
444 struct route_node
*rn
;
445 struct ospf
*ospf
= vty
->index
;
452 ospf_passive_interface_default (ospf
, OSPF_IF_ACTIVE
);
456 ifp
= if_get_by_name (argv
[0]);
458 params
= IF_DEF_PARAMS (ifp
);
462 ret
= inet_aton(argv
[1], &addr
);
465 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
470 params
= ospf_lookup_if_params (ifp
, addr
);
474 ospf_passive_interface_update (ospf
, ifp
, addr
, params
, OSPF_IF_ACTIVE
);
476 /* XXX We should call ospf_if_set_multicast on exactly those
477 * interfaces for which the passive property changed. It is too much
478 * work to determine this set, so we do this for every interface.
479 * This is safe and reasonable because ospf_if_set_multicast uses a
480 * record of joined groups to avoid systems calls if the desired
481 * memberships match the current memership.
483 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
485 struct ospf_interface
*oi
= rn
->info
;
487 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_ACTIVE
))
488 ospf_if_set_multicast(oi
);
494 ALIAS (no_ospf_passive_interface
,
495 no_ospf_passive_interface_cmd
,
496 "no passive-interface IFNAME",
498 "Allow routing updates on an interface\n"
499 "Interface's name\n")
501 ALIAS (no_ospf_passive_interface
,
502 no_ospf_passive_interface_default_cmd
,
503 "no passive-interface default",
505 "Allow routing updates on an interface\n"
506 "Allow routing updates on interfaces by default\n")
508 DEFUN (ospf_network_area
,
509 ospf_network_area_cmd
,
510 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
511 "Enable routing on an IP network\n"
512 "OSPF network prefix\n"
513 "Set the OSPF area ID\n"
514 "OSPF area ID in IP address format\n"
515 "OSPF area ID as a decimal value\n")
517 struct ospf
*ospf
= vty
->index
;
518 struct prefix_ipv4 p
;
519 struct in_addr area_id
;
527 vty_out (vty
, "The network command is not supported in multi-instance ospf%s",
532 if (ospf
->if_ospf_cli_count
> 0)
534 vty_out (vty
, "Please remove all ip ospf area x.x.x.x commands first.%s",
539 /* Get network prefix and Area ID. */
540 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
541 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
543 ret
= ospf_network_set (ospf
, &p
, area_id
);
546 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
553 DEFUN (no_ospf_network_area
,
554 no_ospf_network_area_cmd
,
555 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
557 "Enable routing on an IP network\n"
558 "OSPF network prefix\n"
559 "Set the OSPF area ID\n"
560 "OSPF area ID in IP address format\n"
561 "OSPF area ID as a decimal value\n")
563 struct ospf
*ospf
= (struct ospf
*) vty
->index
;
564 struct prefix_ipv4 p
;
565 struct in_addr area_id
;
573 vty_out (vty
, "The network command is not supported in multi-instance ospf%s",
578 /* Get network prefix and Area ID. */
579 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
580 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
582 ret
= ospf_network_unset (ospf
, &p
, area_id
);
585 vty_out (vty
, "Can't find specified network area configuration.%s",
594 DEFUN (ospf_area_range
,
596 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
597 "OSPF area parameters\n"
598 "OSPF area ID in IP address format\n"
599 "OSPF area ID as a decimal value\n"
600 "Summarize routes matching address/mask (border routers only)\n"
601 "Area range prefix\n")
603 struct ospf
*ospf
= vty
->index
;
604 struct prefix_ipv4 p
;
605 struct in_addr area_id
;
612 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
613 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
615 ospf_area_range_set (ospf
, area_id
, &p
, OSPF_AREA_RANGE_ADVERTISE
);
618 VTY_GET_INTEGER ("range cost", cost
, argv
[2]);
619 ospf_area_range_cost_set (ospf
, area_id
, &p
, cost
);
625 ALIAS (ospf_area_range
,
626 ospf_area_range_advertise_cmd
,
627 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
628 "OSPF area parameters\n"
629 "OSPF area ID in IP address format\n"
630 "OSPF area ID as a decimal value\n"
631 "OSPF area range for route advertise (default)\n"
632 "Area range prefix\n"
633 "Advertise this range (default)\n")
635 ALIAS (ospf_area_range
,
636 ospf_area_range_cost_cmd
,
637 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
638 "OSPF area parameters\n"
639 "OSPF area ID in IP address format\n"
640 "OSPF area ID as a decimal value\n"
641 "Summarize routes matching address/mask (border routers only)\n"
642 "Area range prefix\n"
643 "User specified metric for this range\n"
644 "Advertised metric for this range\n")
646 ALIAS (ospf_area_range
,
647 ospf_area_range_advertise_cost_cmd
,
648 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
649 "OSPF area parameters\n"
650 "OSPF area ID in IP address format\n"
651 "OSPF area ID as a decimal value\n"
652 "Summarize routes matching address/mask (border routers only)\n"
653 "Area range prefix\n"
654 "Advertise this range (default)\n"
655 "User specified metric for this range\n"
656 "Advertised metric for this range\n")
658 DEFUN (ospf_area_range_not_advertise
,
659 ospf_area_range_not_advertise_cmd
,
660 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
661 "OSPF area parameters\n"
662 "OSPF area ID in IP address format\n"
663 "OSPF area ID as a decimal value\n"
664 "Summarize routes matching address/mask (border routers only)\n"
665 "Area range prefix\n"
666 "DoNotAdvertise this range\n")
668 struct ospf
*ospf
= vty
->index
;
669 struct prefix_ipv4 p
;
670 struct in_addr area_id
;
676 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
677 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
679 ospf_area_range_set (ospf
, area_id
, &p
, 0);
684 DEFUN (no_ospf_area_range
,
685 no_ospf_area_range_cmd
,
686 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
688 "OSPF area parameters\n"
689 "OSPF area ID in IP address format\n"
690 "OSPF area ID as a decimal value\n"
691 "Summarize routes matching address/mask (border routers only)\n"
692 "Area range prefix\n")
694 struct ospf
*ospf
= vty
->index
;
695 struct prefix_ipv4 p
;
696 struct in_addr area_id
;
702 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
703 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
705 ospf_area_range_unset (ospf
, area_id
, &p
);
710 ALIAS (no_ospf_area_range
,
711 no_ospf_area_range_advertise_cmd
,
712 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
714 "OSPF area parameters\n"
715 "OSPF area ID in IP address format\n"
716 "OSPF area ID as a decimal value\n"
717 "Summarize routes matching address/mask (border routers only)\n"
718 "Area range prefix\n"
719 "Advertise this range (default)\n"
720 "DoNotAdvertise this range\n")
722 ALIAS (no_ospf_area_range
,
723 no_ospf_area_range_cost_cmd
,
724 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
726 "OSPF area parameters\n"
727 "OSPF area ID in IP address format\n"
728 "OSPF area ID as a decimal value\n"
729 "Summarize routes matching address/mask (border routers only)\n"
730 "Area range prefix\n"
731 "User specified metric for this range\n"
732 "Advertised metric for this range\n")
734 ALIAS (no_ospf_area_range
,
735 no_ospf_area_range_advertise_cost_cmd
,
736 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
738 "OSPF area parameters\n"
739 "OSPF area ID in IP address format\n"
740 "OSPF area ID as a decimal value\n"
741 "Summarize routes matching address/mask (border routers only)\n"
742 "Area range prefix\n"
743 "Advertise this range (default)\n"
744 "User specified metric for this range\n"
745 "Advertised metric for this range\n")
747 DEFUN (ospf_area_range_substitute
,
748 ospf_area_range_substitute_cmd
,
749 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
750 "OSPF area parameters\n"
751 "OSPF area ID in IP address format\n"
752 "OSPF area ID as a decimal value\n"
753 "Summarize routes matching address/mask (border routers only)\n"
754 "Area range prefix\n"
755 "Announce area range as another prefix\n"
756 "Network prefix to be announced instead of range\n")
758 struct ospf
*ospf
= vty
->index
;
759 struct prefix_ipv4 p
, s
;
760 struct in_addr area_id
;
766 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
767 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
768 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
770 ospf_area_range_substitute_set (ospf
, area_id
, &p
, &s
);
775 DEFUN (no_ospf_area_range_substitute
,
776 no_ospf_area_range_substitute_cmd
,
777 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
779 "OSPF area parameters\n"
780 "OSPF area ID in IP address format\n"
781 "OSPF area ID as a decimal value\n"
782 "Summarize routes matching address/mask (border routers only)\n"
783 "Area range prefix\n"
784 "Announce area range as another prefix\n"
785 "Network prefix to be announced instead of range\n")
787 struct ospf
*ospf
= vty
->index
;
788 struct prefix_ipv4 p
, s
;
789 struct in_addr area_id
;
795 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
796 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
797 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
799 ospf_area_range_substitute_unset (ospf
, area_id
, &p
);
805 /* Command Handler Logic in VLink stuff is delicate!!
807 ALTER AT YOUR OWN RISK!!!!
809 Various dummy values are used to represent 'NoChange' state for
810 VLink configuration NOT being changed by a VLink command, and
811 special syntax is used within the command strings so that the
812 typed in command verbs can be seen in the configuration command
813 bacckend handler. This is to drastically reduce the verbeage
814 required to coe up with a reasonably compatible Cisco VLink command
816 - Matthew Grant <grantma@anathoth.gen.nz>
817 Wed, 21 Feb 2001 15:13:52 +1300
821 /* Configuration data for virtual links
823 struct ospf_vl_config_data
{
824 struct vty
*vty
; /* vty stuff */
825 struct in_addr area_id
; /* area ID from command line */
826 int format
; /* command line area ID format */
827 struct in_addr vl_peer
; /* command line vl_peer */
828 int auth_type
; /* Authehntication type, if given */
829 char *auth_key
; /* simple password if present */
830 int crypto_key_id
; /* Cryptographic key ID */
831 char *md5_key
; /* MD5 authentication key */
832 int hello_interval
; /* Obvious what these are... */
833 int retransmit_interval
;
839 ospf_vl_config_data_init (struct ospf_vl_config_data
*vl_config
,
842 memset (vl_config
, 0, sizeof (struct ospf_vl_config_data
));
843 vl_config
->auth_type
= OSPF_AUTH_CMD_NOTSEEN
;
844 vl_config
->vty
= vty
;
847 static struct ospf_vl_data
*
848 ospf_find_vl_data (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
850 struct ospf_area
*area
;
851 struct ospf_vl_data
*vl_data
;
853 struct in_addr area_id
;
855 vty
= vl_config
->vty
;
856 area_id
= vl_config
->area_id
;
858 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
861 "Configuring VLs over the backbone is not allowed%s",
865 area
= ospf_area_get (ospf
, area_id
, vl_config
->format
);
867 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
869 if (vl_config
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
870 vty_out (vty
, "Area %s is %s%s",
872 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
875 vty_out (vty
, "Area %ld is %s%s",
876 (u_long
)ntohl (area_id
.s_addr
),
877 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
882 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
->vl_peer
)) == NULL
)
884 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
885 if (vl_data
->vl_oi
== NULL
)
887 vl_data
->vl_oi
= ospf_vl_new (ospf
, vl_data
);
888 ospf_vl_add (ospf
, vl_data
);
889 ospf_spf_calculate_schedule (ospf
);
897 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
898 struct ospf_vl_config_data
*vl_config
)
900 struct crypt_key
*ck
;
902 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
904 vty
= vl_config
->vty
;
906 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
908 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
909 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
912 if (vl_config
->auth_key
)
914 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
915 strncpy ((char *) IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
916 OSPF_AUTH_SIMPLE_SIZE
);
918 else if (vl_config
->md5_key
)
920 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
923 vty_out (vty
, "OSPF: Key %d already exists%s",
924 vl_config
->crypto_key_id
, VTY_NEWLINE
);
927 ck
= ospf_crypt_key_new ();
928 ck
->key_id
= vl_config
->crypto_key_id
;
929 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
930 strncpy ((char *) ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
932 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
934 else if (vl_config
->crypto_key_id
!= 0)
938 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
939 vl_config
->crypto_key_id
) == NULL
)
941 vty_out (vty
, "OSPF: Key %d does not exist%s",
942 vl_config
->crypto_key_id
, VTY_NEWLINE
);
946 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
954 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
955 struct ospf_vl_config_data
*vl_config
)
957 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
958 /* Virtual Link data initialised to defaults, so only set
960 if (vl_config
->hello_interval
)
962 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
963 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
966 if (vl_config
->dead_interval
)
968 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
969 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
972 if (vl_config
->retransmit_interval
)
974 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
975 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
978 if (vl_config
->transmit_delay
)
980 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
981 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
989 /* The business end of all of the above */
991 ospf_vl_set (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
993 struct ospf_vl_data
*vl_data
;
996 vl_data
= ospf_find_vl_data (ospf
, vl_config
);
1000 /* Process this one first as it can have a fatal result, which can
1001 only logically occur if the virtual link exists already
1002 Thus a command error does not result in a change to the
1003 running configuration such as unexpectedly altered timer
1005 ret
= ospf_vl_set_security (vl_data
, vl_config
);
1006 if (ret
!= CMD_SUCCESS
)
1009 /* Set any time based parameters, these area already range checked */
1011 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
1012 if (ret
!= CMD_SUCCESS
)
1019 /* This stuff exists to make specifying all the alias commands A LOT simpler
1021 #define VLINK_HELPSTR_IPADDR \
1022 "OSPF area parameters\n" \
1023 "OSPF area ID in IP address format\n" \
1024 "OSPF area ID as a decimal value\n" \
1025 "Configure a virtual link\n" \
1026 "Router ID of the remote ABR\n"
1028 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
1029 "Enable authentication on this virtual link\n" \
1032 #define VLINK_HELPSTR_AUTHTYPE_ALL \
1033 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
1034 "Use null authentication\n" \
1035 "Use message-digest authentication\n"
1037 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
1038 "Time between HELLO packets\n" \
1039 "Time between retransmitting lost link state advertisements\n" \
1040 "Link state transmit delay\n" \
1041 "Interval after which a neighbor is declared dead\n"
1043 #define VLINK_HELPSTR_TIME_PARAM \
1044 VLINK_HELPSTR_TIME_PARAM_NOSECS \
1047 #define VLINK_HELPSTR_AUTH_SIMPLE \
1048 "Authentication password (key)\n" \
1049 "The OSPF password (key)"
1051 #define VLINK_HELPSTR_AUTH_MD5 \
1052 "Message digest authentication password (key)\n" \
1055 "Use MD5 algorithm\n" \
1056 "The OSPF password (key)"
1058 DEFUN (ospf_area_vlink
,
1059 ospf_area_vlink_cmd
,
1060 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1061 VLINK_HELPSTR_IPADDR
)
1063 struct ospf
*ospf
= vty
->index
;
1064 struct ospf_vl_config_data vl_config
;
1065 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1066 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
1073 ospf_vl_config_data_init(&vl_config
, vty
);
1075 /* Read off first 2 parameters and check them */
1076 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &vl_config
.format
);
1079 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1083 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1086 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1093 /* Thats all folks! - BUGS B. strikes again!!!*/
1095 return ospf_vl_set (ospf
, &vl_config
);
1098 /* Deal with other parameters */
1099 for (i
=2; i
< argc
; i
++)
1102 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1108 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1110 /* authentication-key - this option can occur anywhere on
1111 command line. At start of command line
1112 must check for authentication option. */
1113 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1114 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
1115 vl_config
.auth_key
= auth_key
;
1118 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1120 /* authentication - this option can only occur at start
1122 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
1125 if (strncmp (argv
[i
+1], "n", 1) == 0)
1127 /* "authentication null" */
1128 vl_config
.auth_type
= OSPF_AUTH_NULL
;
1131 else if (strncmp (argv
[i
+1], "m", 1) == 0
1132 && strcmp (argv
[i
+1], "message-digest-") != 0)
1134 /* "authentication message-digest" */
1135 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1143 /* message-digest-key */
1145 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1146 if (vl_config
.crypto_key_id
< 0)
1149 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
1150 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
1151 vl_config
.md5_key
= md5_key
;
1155 /* Hello interval */
1157 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
1158 if (vl_config
.hello_interval
< 0)
1163 /* Retransmit Interval */
1165 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
1166 if (vl_config
.retransmit_interval
< 0)
1171 /* Transmit Delay */
1173 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
1174 if (vl_config
.transmit_delay
< 0)
1181 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
1182 if (vl_config
.dead_interval
< 0)
1189 /* Action configuration */
1191 return ospf_vl_set (ospf
, &vl_config
);
1195 DEFUN (no_ospf_area_vlink
,
1196 no_ospf_area_vlink_cmd
,
1197 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1199 VLINK_HELPSTR_IPADDR
)
1201 struct ospf
*ospf
= vty
->index
;
1202 struct ospf_area
*area
;
1203 struct ospf_vl_config_data vl_config
;
1204 struct ospf_vl_data
*vl_data
= NULL
;
1205 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1212 ospf_vl_config_data_init(&vl_config
, vty
);
1214 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &format
);
1217 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1221 area
= ospf_area_lookup_by_area_id (ospf
, vl_config
.area_id
);
1224 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1228 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1231 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1238 /* Basic VLink no command */
1239 /* Thats all folks! - BUGS B. strikes again!!!*/
1240 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
.vl_peer
)))
1241 ospf_vl_delete (ospf
, vl_data
);
1243 ospf_area_check_free (ospf
, vl_config
.area_id
);
1248 /* If we are down here, we are reseting parameters */
1250 /* Deal with other parameters */
1251 for (i
=2; i
< argc
; i
++)
1253 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1259 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1261 /* authentication-key - this option can occur anywhere on
1262 command line. At start of command line
1263 must check for authentication option. */
1264 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1265 vl_config
.auth_key
= auth_key
;
1267 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1269 /* authentication - this option can only occur at start
1271 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1276 /* message-digest-key */
1277 /* Delete one key */
1279 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1280 if (vl_config
.crypto_key_id
< 0)
1282 vl_config
.md5_key
= NULL
;
1286 /* Hello interval */
1287 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1291 /* Retransmit Interval */
1292 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1296 /* Transmit Delay */
1297 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1303 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1309 /* Action configuration */
1311 return ospf_vl_set (ospf
, &vl_config
);
1314 ALIAS (ospf_area_vlink
,
1315 ospf_area_vlink_param1_cmd
,
1316 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1317 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1318 VLINK_HELPSTR_IPADDR
1319 VLINK_HELPSTR_TIME_PARAM
)
1321 ALIAS (no_ospf_area_vlink
,
1322 no_ospf_area_vlink_param1_cmd
,
1323 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1324 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1326 VLINK_HELPSTR_IPADDR
1327 VLINK_HELPSTR_TIME_PARAM
)
1329 ALIAS (ospf_area_vlink
,
1330 ospf_area_vlink_param2_cmd
,
1331 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1332 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1333 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1334 VLINK_HELPSTR_IPADDR
1335 VLINK_HELPSTR_TIME_PARAM
1336 VLINK_HELPSTR_TIME_PARAM
)
1338 ALIAS (no_ospf_area_vlink
,
1339 no_ospf_area_vlink_param2_cmd
,
1340 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1341 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1342 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1344 VLINK_HELPSTR_IPADDR
1345 VLINK_HELPSTR_TIME_PARAM
1346 VLINK_HELPSTR_TIME_PARAM
)
1348 ALIAS (ospf_area_vlink
,
1349 ospf_area_vlink_param3_cmd
,
1350 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1351 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1352 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1353 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1354 VLINK_HELPSTR_IPADDR
1355 VLINK_HELPSTR_TIME_PARAM
1356 VLINK_HELPSTR_TIME_PARAM
1357 VLINK_HELPSTR_TIME_PARAM
)
1359 ALIAS (no_ospf_area_vlink
,
1360 no_ospf_area_vlink_param3_cmd
,
1361 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1362 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1363 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1364 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1366 VLINK_HELPSTR_IPADDR
1367 VLINK_HELPSTR_TIME_PARAM
1368 VLINK_HELPSTR_TIME_PARAM
1369 VLINK_HELPSTR_TIME_PARAM
)
1371 ALIAS (ospf_area_vlink
,
1372 ospf_area_vlink_param4_cmd
,
1373 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1374 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1375 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1376 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1377 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1378 VLINK_HELPSTR_IPADDR
1379 VLINK_HELPSTR_TIME_PARAM
1380 VLINK_HELPSTR_TIME_PARAM
1381 VLINK_HELPSTR_TIME_PARAM
1382 VLINK_HELPSTR_TIME_PARAM
)
1384 ALIAS (no_ospf_area_vlink
,
1385 no_ospf_area_vlink_param4_cmd
,
1386 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1387 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1388 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1389 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1390 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1392 VLINK_HELPSTR_IPADDR
1393 VLINK_HELPSTR_TIME_PARAM
1394 VLINK_HELPSTR_TIME_PARAM
1395 VLINK_HELPSTR_TIME_PARAM
1396 VLINK_HELPSTR_TIME_PARAM
)
1398 ALIAS (ospf_area_vlink
,
1399 ospf_area_vlink_authtype_args_cmd
,
1400 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1401 "(authentication|) (message-digest|null)",
1402 VLINK_HELPSTR_IPADDR
1403 VLINK_HELPSTR_AUTHTYPE_ALL
)
1405 ALIAS (ospf_area_vlink
,
1406 ospf_area_vlink_authtype_cmd
,
1407 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1408 "(authentication|)",
1409 VLINK_HELPSTR_IPADDR
1410 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1412 ALIAS (no_ospf_area_vlink
,
1413 no_ospf_area_vlink_authtype_cmd
,
1414 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1415 "(authentication|)",
1417 VLINK_HELPSTR_IPADDR
1418 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1420 ALIAS (ospf_area_vlink
,
1421 ospf_area_vlink_md5_cmd
,
1422 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1423 "(message-digest-key|) <1-255> md5 KEY",
1424 VLINK_HELPSTR_IPADDR
1425 VLINK_HELPSTR_AUTH_MD5
)
1427 ALIAS (no_ospf_area_vlink
,
1428 no_ospf_area_vlink_md5_cmd
,
1429 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1430 "(message-digest-key|) <1-255>",
1432 VLINK_HELPSTR_IPADDR
1433 VLINK_HELPSTR_AUTH_MD5
)
1435 ALIAS (ospf_area_vlink
,
1436 ospf_area_vlink_authkey_cmd
,
1437 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1438 "(authentication-key|) AUTH_KEY",
1439 VLINK_HELPSTR_IPADDR
1440 VLINK_HELPSTR_AUTH_SIMPLE
)
1442 ALIAS (no_ospf_area_vlink
,
1443 no_ospf_area_vlink_authkey_cmd
,
1444 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1445 "(authentication-key|)",
1447 VLINK_HELPSTR_IPADDR
1448 VLINK_HELPSTR_AUTH_SIMPLE
)
1450 ALIAS (ospf_area_vlink
,
1451 ospf_area_vlink_authtype_args_authkey_cmd
,
1452 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1453 "(authentication|) (message-digest|null) "
1454 "(authentication-key|) AUTH_KEY",
1455 VLINK_HELPSTR_IPADDR
1456 VLINK_HELPSTR_AUTHTYPE_ALL
1457 VLINK_HELPSTR_AUTH_SIMPLE
)
1459 ALIAS (ospf_area_vlink
,
1460 ospf_area_vlink_authtype_authkey_cmd
,
1461 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1462 "(authentication|) "
1463 "(authentication-key|) AUTH_KEY",
1464 VLINK_HELPSTR_IPADDR
1465 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1466 VLINK_HELPSTR_AUTH_SIMPLE
)
1468 ALIAS (no_ospf_area_vlink
,
1469 no_ospf_area_vlink_authtype_authkey_cmd
,
1470 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1471 "(authentication|) "
1472 "(authentication-key|)",
1474 VLINK_HELPSTR_IPADDR
1475 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1476 VLINK_HELPSTR_AUTH_SIMPLE
)
1478 ALIAS (ospf_area_vlink
,
1479 ospf_area_vlink_authtype_args_md5_cmd
,
1480 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1481 "(authentication|) (message-digest|null) "
1482 "(message-digest-key|) <1-255> md5 KEY",
1483 VLINK_HELPSTR_IPADDR
1484 VLINK_HELPSTR_AUTHTYPE_ALL
1485 VLINK_HELPSTR_AUTH_MD5
)
1487 ALIAS (ospf_area_vlink
,
1488 ospf_area_vlink_authtype_md5_cmd
,
1489 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1490 "(authentication|) "
1491 "(message-digest-key|) <1-255> md5 KEY",
1492 VLINK_HELPSTR_IPADDR
1493 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1494 VLINK_HELPSTR_AUTH_MD5
)
1496 ALIAS (no_ospf_area_vlink
,
1497 no_ospf_area_vlink_authtype_md5_cmd
,
1498 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1499 "(authentication|) "
1500 "(message-digest-key|)",
1502 VLINK_HELPSTR_IPADDR
1503 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1504 VLINK_HELPSTR_AUTH_MD5
)
1507 DEFUN (ospf_area_shortcut
,
1508 ospf_area_shortcut_cmd
,
1509 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1510 "OSPF area parameters\n"
1511 "OSPF area ID in IP address format\n"
1512 "OSPF area ID as a decimal value\n"
1513 "Configure the area's shortcutting mode\n"
1514 "Set default shortcutting behavior\n"
1515 "Enable shortcutting through the area\n"
1516 "Disable shortcutting through the area\n")
1518 struct ospf
*ospf
= vty
->index
;
1519 struct ospf_area
*area
;
1520 struct in_addr area_id
;
1527 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1529 area
= ospf_area_get (ospf
, area_id
, format
);
1531 if (strncmp (argv
[1], "de", 2) == 0)
1532 mode
= OSPF_SHORTCUT_DEFAULT
;
1533 else if (strncmp (argv
[1], "di", 2) == 0)
1534 mode
= OSPF_SHORTCUT_DISABLE
;
1535 else if (strncmp (argv
[1], "e", 1) == 0)
1536 mode
= OSPF_SHORTCUT_ENABLE
;
1540 ospf_area_shortcut_set (ospf
, area
, mode
);
1542 if (ospf
->abr_type
!= OSPF_ABR_SHORTCUT
)
1543 vty_out (vty
, "Shortcut area setting will take effect "
1544 "only when the router is configured as Shortcut ABR%s",
1550 DEFUN (no_ospf_area_shortcut
,
1551 no_ospf_area_shortcut_cmd
,
1552 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1554 "OSPF area parameters\n"
1555 "OSPF area ID in IP address format\n"
1556 "OSPF area ID as a decimal value\n"
1557 "Deconfigure the area's shortcutting mode\n"
1558 "Deconfigure enabled shortcutting through the area\n"
1559 "Deconfigure disabled shortcutting through the area\n")
1561 struct ospf
*ospf
= vty
->index
;
1562 struct ospf_area
*area
;
1563 struct in_addr area_id
;
1569 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1571 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1575 ospf_area_shortcut_unset (ospf
, area
);
1581 DEFUN (ospf_area_stub
,
1583 "area (A.B.C.D|<0-4294967295>) stub",
1584 "OSPF area parameters\n"
1585 "OSPF area ID in IP address format\n"
1586 "OSPF area ID as a decimal value\n"
1587 "Configure OSPF area as stub\n")
1589 struct ospf
*ospf
= vty
->index
;
1590 struct in_addr area_id
;
1596 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1598 ret
= ospf_area_stub_set (ospf
, area_id
);
1601 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1606 ospf_area_no_summary_unset (ospf
, area_id
);
1611 DEFUN (ospf_area_stub_no_summary
,
1612 ospf_area_stub_no_summary_cmd
,
1613 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1614 "OSPF stub parameters\n"
1615 "OSPF area ID in IP address format\n"
1616 "OSPF area ID as a decimal value\n"
1617 "Configure OSPF area as stub\n"
1618 "Do not inject inter-area routes into stub\n")
1620 struct ospf
*ospf
= vty
->index
;
1621 struct in_addr area_id
;
1627 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1629 ret
= ospf_area_stub_set (ospf
, area_id
);
1632 vty_out (vty
, "%% Area cannot be stub as it contains a virtual link%s",
1637 ospf_area_no_summary_set (ospf
, area_id
);
1642 DEFUN (no_ospf_area_stub
,
1643 no_ospf_area_stub_cmd
,
1644 "no area (A.B.C.D|<0-4294967295>) stub",
1646 "OSPF area parameters\n"
1647 "OSPF area ID in IP address format\n"
1648 "OSPF area ID as a decimal value\n"
1649 "Configure OSPF area as stub\n")
1651 struct ospf
*ospf
= vty
->index
;
1652 struct in_addr area_id
;
1658 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1660 ospf_area_stub_unset (ospf
, area_id
);
1661 ospf_area_no_summary_unset (ospf
, area_id
);
1666 DEFUN (no_ospf_area_stub_no_summary
,
1667 no_ospf_area_stub_no_summary_cmd
,
1668 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1670 "OSPF area parameters\n"
1671 "OSPF area ID in IP address format\n"
1672 "OSPF area ID as a decimal value\n"
1673 "Configure OSPF area as stub\n"
1674 "Do not inject inter-area routes into area\n")
1676 struct ospf
*ospf
= vty
->index
;
1677 struct in_addr area_id
;
1683 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1684 ospf_area_no_summary_unset (ospf
, area_id
);
1690 ospf_area_nssa_cmd_handler (struct vty
*vty
, int argc
, const char *argv
[],
1693 struct ospf
*ospf
= vty
->index
;
1694 struct in_addr area_id
;
1700 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1702 ret
= ospf_area_nssa_set (ospf
, area_id
);
1705 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1712 if (strncmp (argv
[1], "translate-c", 11) == 0)
1713 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1714 OSPF_NSSA_ROLE_CANDIDATE
);
1715 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1716 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1717 OSPF_NSSA_ROLE_NEVER
);
1718 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1719 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1720 OSPF_NSSA_ROLE_ALWAYS
);
1724 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1725 OSPF_NSSA_ROLE_CANDIDATE
);
1729 ospf_area_no_summary_set (ospf
, area_id
);
1731 ospf_area_no_summary_unset (ospf
, area_id
);
1733 ospf_schedule_abr_task (ospf
);
1738 DEFUN (ospf_area_nssa_translate_no_summary
,
1739 ospf_area_nssa_translate_no_summary_cmd
,
1740 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
1741 "OSPF area parameters\n"
1742 "OSPF area ID in IP address format\n"
1743 "OSPF area ID as a decimal value\n"
1744 "Configure OSPF area as nssa\n"
1745 "Configure NSSA-ABR for translate election (default)\n"
1746 "Configure NSSA-ABR to never translate\n"
1747 "Configure NSSA-ABR to always translate\n"
1748 "Do not inject inter-area routes into nssa\n")
1750 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1753 DEFUN (ospf_area_nssa_translate
,
1754 ospf_area_nssa_translate_cmd
,
1755 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1756 "OSPF area parameters\n"
1757 "OSPF area ID in IP address format\n"
1758 "OSPF area ID as a decimal value\n"
1759 "Configure OSPF area as nssa\n"
1760 "Configure NSSA-ABR for translate election (default)\n"
1761 "Configure NSSA-ABR to never translate\n"
1762 "Configure NSSA-ABR to always translate\n")
1764 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1767 DEFUN (ospf_area_nssa
,
1769 "area (A.B.C.D|<0-4294967295>) nssa",
1770 "OSPF area parameters\n"
1771 "OSPF area ID in IP address format\n"
1772 "OSPF area ID as a decimal value\n"
1773 "Configure OSPF area as nssa\n")
1775 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1778 DEFUN (ospf_area_nssa_no_summary
,
1779 ospf_area_nssa_no_summary_cmd
,
1780 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1781 "OSPF area parameters\n"
1782 "OSPF area ID in IP address format\n"
1783 "OSPF area ID as a decimal value\n"
1784 "Configure OSPF area as nssa\n"
1785 "Do not inject inter-area routes into nssa\n")
1787 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1790 DEFUN (no_ospf_area_nssa
,
1791 no_ospf_area_nssa_cmd
,
1792 "no area (A.B.C.D|<0-4294967295>) nssa",
1794 "OSPF area parameters\n"
1795 "OSPF area ID in IP address format\n"
1796 "OSPF area ID as a decimal value\n"
1797 "Configure OSPF area as nssa\n")
1799 struct ospf
*ospf
= vty
->index
;
1800 struct in_addr area_id
;
1806 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1808 ospf_area_nssa_unset (ospf
, area_id
);
1809 ospf_area_no_summary_unset (ospf
, area_id
);
1811 ospf_schedule_abr_task (ospf
);
1816 DEFUN (no_ospf_area_nssa_no_summary
,
1817 no_ospf_area_nssa_no_summary_cmd
,
1818 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1820 "OSPF area parameters\n"
1821 "OSPF area ID in IP address format\n"
1822 "OSPF area ID as a decimal value\n"
1823 "Configure OSPF area as nssa\n"
1824 "Do not inject inter-area routes into nssa\n")
1826 struct ospf
*ospf
= vty
->index
;
1827 struct in_addr area_id
;
1833 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1834 ospf_area_no_summary_unset (ospf
, area_id
);
1839 DEFUN (ospf_area_default_cost
,
1840 ospf_area_default_cost_cmd
,
1841 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1842 "OSPF area parameters\n"
1843 "OSPF area ID in IP address format\n"
1844 "OSPF area ID as a decimal value\n"
1845 "Set the summary-default cost of a NSSA or stub area\n"
1846 "Stub's advertised default summary cost\n")
1848 struct ospf
*ospf
= vty
->index
;
1849 struct ospf_area
*area
;
1850 struct in_addr area_id
;
1853 struct prefix_ipv4 p
;
1858 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1859 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1861 area
= ospf_area_get (ospf
, area_id
, format
);
1863 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1865 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1869 area
->default_cost
= cost
;
1872 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1874 if (IS_DEBUG_OSPF_EVENT
)
1875 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1876 "announcing 0.0.0.0/0 to area %s",
1877 inet_ntoa (area
->area_id
));
1878 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1883 DEFUN (no_ospf_area_default_cost
,
1884 no_ospf_area_default_cost_cmd
,
1885 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1887 "OSPF area parameters\n"
1888 "OSPF area ID in IP address format\n"
1889 "OSPF area ID as a decimal value\n"
1890 "Set the summary-default cost of a NSSA or stub area\n"
1891 "Stub's advertised default summary cost\n")
1893 struct ospf
*ospf
= vty
->index
;
1894 struct ospf_area
*area
;
1895 struct in_addr area_id
;
1897 struct prefix_ipv4 p
;
1902 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1903 VTY_CHECK_INTEGER_RANGE ("stub default cost", argv
[1], 0, OSPF_LS_INFINITY
);
1905 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1909 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1911 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1915 area
->default_cost
= 1;
1918 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1920 if (IS_DEBUG_OSPF_EVENT
)
1921 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1922 "announcing 0.0.0.0/0 to area %s",
1923 inet_ntoa (area
->area_id
));
1924 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1927 ospf_area_check_free (ospf
, area_id
);
1932 DEFUN (ospf_area_export_list
,
1933 ospf_area_export_list_cmd
,
1934 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1935 "OSPF area parameters\n"
1936 "OSPF area ID in IP address format\n"
1937 "OSPF area ID as a decimal value\n"
1938 "Set the filter for networks announced to other areas\n"
1939 "Name of the access-list\n")
1941 struct ospf
*ospf
= vty
->index
;
1942 struct ospf_area
*area
;
1943 struct in_addr area_id
;
1949 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1951 area
= ospf_area_get (ospf
, area_id
, format
);
1952 ospf_area_export_list_set (ospf
, area
, argv
[1]);
1957 DEFUN (no_ospf_area_export_list
,
1958 no_ospf_area_export_list_cmd
,
1959 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1961 "OSPF area parameters\n"
1962 "OSPF area ID in IP address format\n"
1963 "OSPF area ID as a decimal value\n"
1964 "Unset the filter for networks announced to other areas\n"
1965 "Name of the access-list\n")
1967 struct ospf
*ospf
= vty
->index
;
1968 struct ospf_area
*area
;
1969 struct in_addr area_id
;
1975 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1977 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1981 ospf_area_export_list_unset (ospf
, area
);
1987 DEFUN (ospf_area_import_list
,
1988 ospf_area_import_list_cmd
,
1989 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1990 "OSPF area parameters\n"
1991 "OSPF area ID in IP address format\n"
1992 "OSPF area ID as a decimal value\n"
1993 "Set the filter for networks from other areas announced to the specified one\n"
1994 "Name of the access-list\n")
1996 struct ospf
*ospf
= vty
->index
;
1997 struct ospf_area
*area
;
1998 struct in_addr area_id
;
2004 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2006 area
= ospf_area_get (ospf
, area_id
, format
);
2007 ospf_area_import_list_set (ospf
, area
, argv
[1]);
2012 DEFUN (no_ospf_area_import_list
,
2013 no_ospf_area_import_list_cmd
,
2014 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
2016 "OSPF area parameters\n"
2017 "OSPF area ID in IP address format\n"
2018 "OSPF area ID as a decimal value\n"
2019 "Unset the filter for networks announced to other areas\n"
2020 "Name of the access-list\n")
2022 struct ospf
*ospf
= vty
->index
;
2023 struct ospf_area
*area
;
2024 struct in_addr area_id
;
2030 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2032 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
2036 ospf_area_import_list_unset (ospf
, area
);
2041 DEFUN (ospf_area_filter_list
,
2042 ospf_area_filter_list_cmd
,
2043 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
2044 "OSPF area parameters\n"
2045 "OSPF area ID in IP address format\n"
2046 "OSPF area ID as a decimal value\n"
2047 "Filter networks between OSPF areas\n"
2048 "Filter prefixes between OSPF areas\n"
2049 "Name of an IP prefix-list\n"
2050 "Filter networks sent to this area\n"
2051 "Filter networks sent from this area\n")
2053 struct ospf
*ospf
= vty
->index
;
2054 struct ospf_area
*area
;
2055 struct in_addr area_id
;
2056 struct prefix_list
*plist
;
2062 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2064 area
= ospf_area_get (ospf
, area_id
, format
);
2065 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
2066 if (strncmp (argv
[2], "in", 2) == 0)
2068 PREFIX_LIST_IN (area
) = plist
;
2069 if (PREFIX_NAME_IN (area
))
2070 free (PREFIX_NAME_IN (area
));
2072 PREFIX_NAME_IN (area
) = strdup (argv
[1]);
2073 ospf_schedule_abr_task (ospf
);
2077 PREFIX_LIST_OUT (area
) = plist
;
2078 if (PREFIX_NAME_OUT (area
))
2079 free (PREFIX_NAME_OUT (area
));
2081 PREFIX_NAME_OUT (area
) = strdup (argv
[1]);
2082 ospf_schedule_abr_task (ospf
);
2088 DEFUN (no_ospf_area_filter_list
,
2089 no_ospf_area_filter_list_cmd
,
2090 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
2092 "OSPF area parameters\n"
2093 "OSPF area ID in IP address format\n"
2094 "OSPF area ID as a decimal value\n"
2095 "Filter networks between OSPF areas\n"
2096 "Filter prefixes between OSPF areas\n"
2097 "Name of an IP prefix-list\n"
2098 "Filter networks sent to this area\n"
2099 "Filter networks sent from this area\n")
2101 struct ospf
*ospf
= vty
->index
;
2102 struct ospf_area
*area
;
2103 struct in_addr area_id
;
2109 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2111 if ((area
= ospf_area_lookup_by_area_id (ospf
, area_id
)) == NULL
)
2114 if (strncmp (argv
[2], "in", 2) == 0)
2116 if (PREFIX_NAME_IN (area
))
2117 if (strcmp (PREFIX_NAME_IN (area
), argv
[1]) != 0)
2120 PREFIX_LIST_IN (area
) = NULL
;
2121 if (PREFIX_NAME_IN (area
))
2122 free (PREFIX_NAME_IN (area
));
2124 PREFIX_NAME_IN (area
) = NULL
;
2126 ospf_schedule_abr_task (ospf
);
2130 if (PREFIX_NAME_OUT (area
))
2131 if (strcmp (PREFIX_NAME_OUT (area
), argv
[1]) != 0)
2134 PREFIX_LIST_OUT (area
) = NULL
;
2135 if (PREFIX_NAME_OUT (area
))
2136 free (PREFIX_NAME_OUT (area
));
2138 PREFIX_NAME_OUT (area
) = NULL
;
2140 ospf_schedule_abr_task (ospf
);
2147 DEFUN (ospf_area_authentication_message_digest
,
2148 ospf_area_authentication_message_digest_cmd
,
2149 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
2150 "OSPF area parameters\n"
2151 "OSPF area ID in IP address format\n"
2152 "OSPF area ID as a decimal value\n"
2153 "Enable authentication\n"
2154 "Use message-digest authentication\n")
2156 struct ospf
*ospf
= vty
->index
;
2157 struct ospf_area
*area
;
2158 struct in_addr area_id
;
2164 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2166 area
= ospf_area_get (ospf
, area_id
, format
);
2167 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
2172 DEFUN (ospf_area_authentication
,
2173 ospf_area_authentication_cmd
,
2174 "area (A.B.C.D|<0-4294967295>) authentication",
2175 "OSPF area parameters\n"
2176 "OSPF area ID in IP address format\n"
2177 "OSPF area ID as a decimal value\n"
2178 "Enable authentication\n")
2180 struct ospf
*ospf
= vty
->index
;
2181 struct ospf_area
*area
;
2182 struct in_addr area_id
;
2188 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2190 area
= ospf_area_get (ospf
, area_id
, format
);
2191 area
->auth_type
= OSPF_AUTH_SIMPLE
;
2196 DEFUN (no_ospf_area_authentication
,
2197 no_ospf_area_authentication_cmd
,
2198 "no area (A.B.C.D|<0-4294967295>) authentication",
2200 "OSPF area parameters\n"
2201 "OSPF area ID in IP address format\n"
2202 "OSPF area ID as a decimal value\n"
2203 "Enable authentication\n")
2205 struct ospf
*ospf
= vty
->index
;
2206 struct ospf_area
*area
;
2207 struct in_addr area_id
;
2213 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2215 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
2219 area
->auth_type
= OSPF_AUTH_NULL
;
2221 ospf_area_check_free (ospf
, area_id
);
2227 DEFUN (ospf_abr_type
,
2229 "ospf abr-type (cisco|ibm|shortcut|standard)",
2230 "OSPF specific commands\n"
2231 "Set OSPF ABR type\n"
2232 "Alternative ABR, cisco implementation\n"
2233 "Alternative ABR, IBM implementation\n"
2235 "Standard behavior (RFC2328)\n")
2237 struct ospf
*ospf
= vty
->index
;
2238 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2243 if (strncmp (argv
[0], "c", 1) == 0)
2244 abr_type
= OSPF_ABR_CISCO
;
2245 else if (strncmp (argv
[0], "i", 1) == 0)
2246 abr_type
= OSPF_ABR_IBM
;
2247 else if (strncmp (argv
[0], "sh", 2) == 0)
2248 abr_type
= OSPF_ABR_SHORTCUT
;
2249 else if (strncmp (argv
[0], "st", 2) == 0)
2250 abr_type
= OSPF_ABR_STAND
;
2254 /* If ABR type value is changed, schedule ABR task. */
2255 if (ospf
->abr_type
!= abr_type
)
2257 ospf
->abr_type
= abr_type
;
2258 ospf_schedule_abr_task (ospf
);
2264 DEFUN (no_ospf_abr_type
,
2265 no_ospf_abr_type_cmd
,
2266 "no ospf abr-type (cisco|ibm|shortcut|standard)",
2268 "OSPF specific commands\n"
2269 "Set OSPF ABR type\n"
2270 "Alternative ABR, cisco implementation\n"
2271 "Alternative ABR, IBM implementation\n"
2274 struct ospf
*ospf
= vty
->index
;
2275 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2280 if (strncmp (argv
[0], "c", 1) == 0)
2281 abr_type
= OSPF_ABR_CISCO
;
2282 else if (strncmp (argv
[0], "i", 1) == 0)
2283 abr_type
= OSPF_ABR_IBM
;
2284 else if (strncmp (argv
[0], "sh", 2) == 0)
2285 abr_type
= OSPF_ABR_SHORTCUT
;
2286 else if (strncmp (argv
[0], "st", 2) == 0)
2287 abr_type
= OSPF_ABR_STAND
;
2291 /* If ABR type value is changed, schedule ABR task. */
2292 if (ospf
->abr_type
== abr_type
)
2294 ospf
->abr_type
= OSPF_ABR_DEFAULT
;
2295 ospf_schedule_abr_task (ospf
);
2301 DEFUN (ospf_log_adjacency_changes
,
2302 ospf_log_adjacency_changes_cmd
,
2303 "log-adjacency-changes",
2304 "Log changes in adjacency state\n")
2306 struct ospf
*ospf
= vty
->index
;
2311 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2312 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2316 DEFUN (ospf_log_adjacency_changes_detail
,
2317 ospf_log_adjacency_changes_detail_cmd
,
2318 "log-adjacency-changes detail",
2319 "Log changes in adjacency state\n"
2320 "Log all state changes\n")
2322 struct ospf
*ospf
= vty
->index
;
2327 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2328 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2332 DEFUN (no_ospf_log_adjacency_changes
,
2333 no_ospf_log_adjacency_changes_cmd
,
2334 "no log-adjacency-changes",
2336 "Log changes in adjacency state\n")
2338 struct ospf
*ospf
= vty
->index
;
2343 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2344 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2348 DEFUN (no_ospf_log_adjacency_changes_detail
,
2349 no_ospf_log_adjacency_changes_detail_cmd
,
2350 "no log-adjacency-changes detail",
2352 "Log changes in adjacency state\n"
2353 "Log all state changes\n")
2355 struct ospf
*ospf
= vty
->index
;
2360 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2361 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2365 DEFUN (ospf_compatible_rfc1583
,
2366 ospf_compatible_rfc1583_cmd
,
2367 "compatible rfc1583",
2368 "OSPF compatibility list\n"
2369 "compatible with RFC 1583\n")
2371 struct ospf
*ospf
= vty
->index
;
2376 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2378 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2379 ospf_spf_calculate_schedule (ospf
);
2384 DEFUN (no_ospf_compatible_rfc1583
,
2385 no_ospf_compatible_rfc1583_cmd
,
2386 "no compatible rfc1583",
2388 "OSPF compatibility list\n"
2389 "compatible with RFC 1583\n")
2391 struct ospf
*ospf
= vty
->index
;
2396 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2398 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2399 ospf_spf_calculate_schedule (ospf
);
2404 ALIAS (ospf_compatible_rfc1583
,
2405 ospf_rfc1583_flag_cmd
,
2406 "ospf rfc1583compatibility",
2407 "OSPF specific commands\n"
2408 "Enable the RFC1583Compatibility flag\n")
2410 ALIAS (no_ospf_compatible_rfc1583
,
2411 no_ospf_rfc1583_flag_cmd
,
2412 "no ospf rfc1583compatibility",
2414 "OSPF specific commands\n"
2415 "Disable the RFC1583Compatibility flag\n")
2418 ospf_timers_spf_set (struct vty
*vty
, unsigned int delay
,
2422 struct ospf
*ospf
= vty
->index
;
2427 ospf
->spf_delay
= delay
;
2428 ospf
->spf_holdtime
= hold
;
2429 ospf
->spf_max_holdtime
= max
;
2434 DEFUN (ospf_timers_min_ls_interval
,
2435 ospf_timers_min_ls_interval_cmd
,
2436 "timers throttle lsa all <0-5000>",
2437 "Adjust routing timers\n"
2438 "Throttling adaptive timer\n"
2439 "LSA delay between transmissions\n"
2441 "Delay (msec) between sending LSAs\n")
2443 struct ospf
*ospf
= vty
->index
;
2444 unsigned int interval
;
2448 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2452 VTY_GET_INTEGER ("LSA interval", interval
, argv
[0]);
2454 ospf
->min_ls_interval
= interval
;
2459 DEFUN (no_ospf_timers_min_ls_interval
,
2460 no_ospf_timers_min_ls_interval_cmd
,
2461 "no timers throttle lsa all",
2463 "Adjust routing timers\n"
2464 "Throttling adaptive timer\n"
2465 "LSA delay between transmissions\n")
2467 struct ospf
*ospf
= vty
->index
;
2468 ospf
->min_ls_interval
= OSPF_MIN_LS_INTERVAL
;
2473 DEFUN (ospf_timers_min_ls_arrival
,
2474 ospf_timers_min_ls_arrival_cmd
,
2475 "timers lsa arrival <0-1000>",
2476 "Adjust routing timers\n"
2477 "Throttling link state advertisement delays\n"
2478 "OSPF minimum arrival interval delay\n"
2479 "Delay (msec) between accepted LSAs\n")
2481 struct ospf
*ospf
= vty
->index
;
2482 unsigned int arrival
;
2486 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2490 VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival
, argv
[0], 0, 1000);
2492 ospf
->min_ls_arrival
= arrival
;
2497 DEFUN (no_ospf_timers_min_ls_arrival
,
2498 no_ospf_timers_min_ls_arrival_cmd
,
2499 "no timers lsa arrival",
2501 "Adjust routing timers\n"
2502 "Throttling link state advertisement delays\n"
2503 "OSPF minimum arrival interval delay\n")
2505 struct ospf
*ospf
= vty
->index
;
2506 ospf
->min_ls_arrival
= OSPF_MIN_LS_ARRIVAL
;
2511 DEFUN (ospf_timers_throttle_spf
,
2512 ospf_timers_throttle_spf_cmd
,
2513 "timers throttle spf <0-600000> <0-600000> <0-600000>",
2514 "Adjust routing timers\n"
2515 "Throttling adaptive timer\n"
2517 "Delay (msec) from first change received till SPF calculation\n"
2518 "Initial hold time (msec) between consecutive SPF calculations\n"
2519 "Maximum hold time (msec)\n")
2521 unsigned int delay
, hold
, max
;
2525 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2529 VTY_GET_INTEGER_RANGE ("SPF delay timer", delay
, argv
[0], 0, 600000);
2530 VTY_GET_INTEGER_RANGE ("SPF hold timer", hold
, argv
[1], 0, 600000);
2531 VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max
, argv
[2], 0, 600000);
2533 return ospf_timers_spf_set (vty
, delay
, hold
, max
);
2536 DEFUN (no_ospf_timers_throttle_spf
,
2537 no_ospf_timers_throttle_spf_cmd
,
2538 "no timers throttle spf",
2540 "Adjust routing timers\n"
2541 "Throttling adaptive timer\n"
2542 "OSPF SPF timers\n")
2544 return ospf_timers_spf_set (vty
,
2545 OSPF_SPF_DELAY_DEFAULT
,
2546 OSPF_SPF_HOLDTIME_DEFAULT
,
2547 OSPF_SPF_MAX_HOLDTIME_DEFAULT
);
2550 ALIAS (no_ospf_timers_throttle_spf
,
2551 no_ospf_timers_throttle_spf_val_cmd
,
2552 "no timers throttle spf <0-60000> <0-60000> <0-60000>",
2554 "Adjust routing timers\n"
2555 "Throttling adaptive timer\n"
2557 "Delay (msec) from first change received till SPF calculation\n"
2558 "Initial hold time (msec) between consecutive SPF calculations\n"
2559 "Maximum hold time (msec)\n")
2561 DEFUN (ospf_timers_lsa
,
2562 ospf_timers_lsa_cmd
,
2563 "timers lsa min-arrival <0-600000>",
2564 "Adjust routing timers\n"
2566 "Minimum delay in receiving new version of a LSA\n"
2567 "Delay in milliseconds\n")
2569 unsigned int minarrival
;
2570 struct ospf
*ospf
= vty
->index
;
2577 vty_out (vty
, "Insufficient number of arguments%s", VTY_NEWLINE
);
2581 VTY_GET_INTEGER ("LSA min-arrival", minarrival
, argv
[0]);
2583 ospf
->min_ls_arrival
= minarrival
;
2588 DEFUN (no_ospf_timers_lsa
,
2589 no_ospf_timers_lsa_cmd
,
2590 "no timers lsa min-arrival",
2592 "Adjust routing timers\n"
2594 "Minimum delay in receiving new version of a LSA\n")
2596 unsigned int minarrival
;
2597 struct ospf
*ospf
= vty
->index
;
2604 VTY_GET_INTEGER ("LSA min-arrival", minarrival
, argv
[0]);
2606 if (ospf
->min_ls_arrival
!= minarrival
||
2607 minarrival
== OSPF_MIN_LS_ARRIVAL
)
2611 ospf
->min_ls_arrival
= OSPF_MIN_LS_ARRIVAL
;
2616 ALIAS (no_ospf_timers_lsa
,
2617 no_ospf_timers_lsa_val_cmd
,
2618 "no timers lsa min-arrival <0-600000>",
2620 "Adjust routing timers\n"
2622 "Minimum delay in receiving new version of a LSA\n"
2623 "Delay in milliseconds\n")
2626 DEFUN (ospf_neighbor
,
2630 "Neighbor IP address\n")
2632 struct ospf
*ospf
= vty
->index
;
2633 struct in_addr nbr_addr
;
2634 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2635 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2640 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2643 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2646 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2648 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2650 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2652 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2657 ALIAS (ospf_neighbor
,
2658 ospf_neighbor_priority_poll_interval_cmd
,
2659 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2661 "Neighbor IP address\n"
2662 "Neighbor Priority\n"
2664 "Dead Neighbor Polling interval\n"
2667 ALIAS (ospf_neighbor
,
2668 ospf_neighbor_priority_cmd
,
2669 "neighbor A.B.C.D priority <0-255>",
2671 "Neighbor IP address\n"
2672 "Neighbor Priority\n"
2675 DEFUN (ospf_neighbor_poll_interval
,
2676 ospf_neighbor_poll_interval_cmd
,
2677 "neighbor A.B.C.D poll-interval <1-65535>",
2679 "Neighbor IP address\n"
2680 "Dead Neighbor Polling interval\n"
2683 struct ospf
*ospf
= vty
->index
;
2684 struct in_addr nbr_addr
;
2685 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2686 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2691 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2694 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[1], 1, 65535);
2697 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2699 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2701 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2703 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2708 ALIAS (ospf_neighbor_poll_interval
,
2709 ospf_neighbor_poll_interval_priority_cmd
,
2710 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2712 "Neighbor address\n"
2713 "OSPF dead-router polling interval\n"
2715 "OSPF priority of non-broadcast neighbor\n"
2718 DEFUN (no_ospf_neighbor
,
2719 no_ospf_neighbor_cmd
,
2720 "no neighbor A.B.C.D",
2723 "Neighbor IP address\n")
2725 struct ospf
*ospf
= vty
->index
;
2726 struct in_addr nbr_addr
;
2731 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2733 (void)ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2738 ALIAS (no_ospf_neighbor
,
2739 no_ospf_neighbor_priority_cmd
,
2740 "no neighbor A.B.C.D priority <0-255>",
2743 "Neighbor IP address\n"
2744 "Neighbor Priority\n"
2747 ALIAS (no_ospf_neighbor
,
2748 no_ospf_neighbor_poll_interval_cmd
,
2749 "no neighbor A.B.C.D poll-interval <1-65535>",
2752 "Neighbor IP address\n"
2753 "Dead Neighbor Polling interval\n"
2756 ALIAS (no_ospf_neighbor
,
2757 no_ospf_neighbor_priority_pollinterval_cmd
,
2758 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2761 "Neighbor IP address\n"
2762 "Neighbor Priority\n"
2764 "Dead Neighbor Polling interval\n"
2768 DEFUN (ospf_refresh_timer
, ospf_refresh_timer_cmd
,
2769 "refresh timer <10-1800>",
2770 "Adjust refresh parameters\n"
2771 "Set refresh timer\n"
2772 "Timer value in seconds\n")
2774 struct ospf
*ospf
= vty
->index
;
2775 unsigned int interval
;
2780 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2781 interval
= (interval
/ 10) * 10;
2783 ospf_timers_refresh_set (ospf
, interval
);
2788 DEFUN (no_ospf_refresh_timer
, no_ospf_refresh_timer_val_cmd
,
2789 "no refresh timer <10-1800>",
2790 "Adjust refresh parameters\n"
2791 "Unset refresh timer\n"
2792 "Timer value in seconds\n")
2794 struct ospf
*ospf
= vty
->index
;
2795 unsigned int interval
;
2802 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2804 if (ospf
->lsa_refresh_interval
!= interval
||
2805 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2809 ospf_timers_refresh_unset (ospf
);
2814 ALIAS (no_ospf_refresh_timer
,
2815 no_ospf_refresh_timer_cmd
,
2817 "Adjust refresh parameters\n"
2818 "Unset refresh timer\n")
2820 DEFUN (ospf_auto_cost_reference_bandwidth
,
2821 ospf_auto_cost_reference_bandwidth_cmd
,
2822 "auto-cost reference-bandwidth <1-4294967>",
2823 "Calculate OSPF interface cost according to bandwidth\n"
2824 "Use reference bandwidth method to assign OSPF cost\n"
2825 "The reference bandwidth in terms of Mbits per second\n")
2827 struct ospf
*ospf
= vty
->index
;
2829 struct listnode
*node
;
2830 struct interface
*ifp
;
2835 refbw
= strtol (argv
[0], NULL
, 10);
2836 if (refbw
< 1 || refbw
> 4294967)
2838 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2842 /* If reference bandwidth is changed. */
2843 if ((refbw
* 1000) == ospf
->ref_bandwidth
)
2846 ospf
->ref_bandwidth
= refbw
* 1000;
2847 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
2848 ospf_if_recalculate_output_cost (ifp
);
2853 DEFUN (no_ospf_auto_cost_reference_bandwidth
,
2854 no_ospf_auto_cost_reference_bandwidth_cmd
,
2855 "no auto-cost reference-bandwidth",
2857 "Calculate OSPF interface cost according to bandwidth\n"
2858 "Use reference bandwidth method to assign OSPF cost\n")
2860 struct ospf
*ospf
= vty
->index
;
2861 struct listnode
*node
, *nnode
;
2862 struct interface
*ifp
;
2867 if (ospf
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
2870 ospf
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
2871 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2872 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2874 for (ALL_LIST_ELEMENTS (om
->iflist
, node
, nnode
, ifp
))
2875 ospf_if_recalculate_output_cost (ifp
);
2880 DEFUN (ospf_write_multiplier
,
2881 ospf_write_multiplier_cmd
,
2882 "ospf write-multiplier <1-100>",
2883 "OSPF specific commands\n"
2884 "Write multiplier\n"
2885 "Maximum number of interface serviced per write\n")
2887 struct ospf
*ospf
= vty
->index
;
2888 u_int32_t write_oi_count
;
2893 write_oi_count
= strtol (argv
[0], NULL
, 10);
2894 if (write_oi_count
< 1 || write_oi_count
> 100)
2896 vty_out (vty
, "write-multiplier value is invalid%s", VTY_NEWLINE
);
2900 ospf
->write_oi_count
= write_oi_count
;
2904 ALIAS (ospf_write_multiplier
,
2905 write_multiplier_cmd
,
2906 "write-multiplier <1-100>",
2907 "Write multiplier\n"
2908 "Maximum number of interface serviced per write\n")
2910 DEFUN (no_ospf_write_multiplier
,
2911 no_ospf_write_multiplier_cmd
,
2912 "no ospf write-multiplier",
2914 "OSPF specific commands\n"
2915 "Write multiplier\n")
2917 struct ospf
*ospf
= vty
->index
;
2922 ospf
->write_oi_count
= OSPF_WRITE_INTERFACE_COUNT_DEFAULT
;
2926 ALIAS (no_ospf_write_multiplier
,
2927 no_write_multiplier_cmd
,
2928 "no write-multiplier",
2930 "Write multiplier\n")
2932 const char *ospf_abr_type_descr_str
[] =
2935 "Standard (RFC2328)",
2937 "Alternative Cisco",
2938 "Alternative Shortcut"
2941 const char *ospf_shortcut_mode_descr_str
[] =
2949 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
, json_object
*json_areas
, u_char use_json
)
2951 json_object
*json_area
= NULL
;
2954 json_area
= json_object_new_object();
2958 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
2960 /* Show Area type/mode. */
2961 if (OSPF_IS_AREA_BACKBONE (area
))
2964 json_object_boolean_true_add(json_area
, "backbone");
2966 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
2972 if (area
->external_routing
== OSPF_AREA_STUB
)
2974 if (area
->no_summary
)
2975 json_object_boolean_true_add(json_area
, "stubNoSummary");
2976 if (area
->shortcut_configured
)
2977 json_object_boolean_true_add(json_area
, "stubShortcut");
2979 else if (area
->external_routing
== OSPF_AREA_NSSA
)
2981 if (area
->no_summary
)
2982 json_object_boolean_true_add(json_area
, "nssaNoSummary");
2983 if (area
->shortcut_configured
)
2984 json_object_boolean_true_add(json_area
, "nssaShortcut");
2987 json_object_string_add(json_area
,"shortcuttingMode",
2988 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
2989 if (area
->shortcut_capability
)
2990 json_object_boolean_true_add(json_area
,"sBitConcensus");
2994 if (area
->external_routing
== OSPF_AREA_STUB
)
2995 vty_out (vty
, " (Stub%s%s)",
2996 area
->no_summary
? ", no summary" : "",
2997 area
->shortcut_configured
? "; " : "");
2998 else if (area
->external_routing
== OSPF_AREA_NSSA
)
2999 vty_out (vty
, " (NSSA%s%s)",
3000 area
->no_summary
? ", no summary" : "",
3001 area
->shortcut_configured
? "; " : "");
3003 vty_out (vty
, "%s", VTY_NEWLINE
);
3004 vty_out (vty
, " Shortcutting mode: %s",
3005 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
3006 vty_out (vty
, ", S-bit consensus: %s%s",
3007 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
3011 /* Show number of interfaces */
3014 json_object_int_add(json_area
, "areaIfTotalCounter", listcount (area
->oiflist
));
3015 json_object_int_add(json_area
, "areaIfActiveCounter", area
->act_ints
);
3018 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
3019 "Active: %d%s", listcount (area
->oiflist
),
3020 area
->act_ints
, VTY_NEWLINE
);
3022 if (area
->external_routing
== OSPF_AREA_NSSA
)
3026 json_object_boolean_true_add(json_area
, "nssa");
3027 if (! IS_OSPF_ABR (area
->ospf
))
3028 json_object_boolean_false_add(json_area
, "abr");
3029 else if (area
->NSSATranslatorState
)
3031 json_object_boolean_true_add(json_area
, "abr");
3032 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3033 json_object_boolean_true_add(json_area
, "nssaTranslatorElected");
3034 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
3035 json_object_boolean_true_add(json_area
, "nssaTranslatorAlways");
3039 json_object_boolean_true_add(json_area
, "abr");
3040 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3041 json_object_boolean_false_add(json_area
, "nssaTranslatorElected");
3043 json_object_boolean_true_add(json_area
, "nssaTranslatorNever");
3048 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
3049 if (! IS_OSPF_ABR (area
->ospf
))
3050 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
3052 else if (area
->NSSATranslatorState
)
3054 vty_out (vty
, " We are an ABR and ");
3055 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3056 vty_out (vty
, "the NSSA Elected Translator. %s",
3058 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
3059 vty_out (vty
, "always an NSSA Translator. %s",
3064 vty_out (vty
, " We are an ABR, but ");
3065 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3066 vty_out (vty
, "not the NSSA Elected Translator. %s",
3069 vty_out (vty
, "never an NSSA Translator. %s",
3075 /* Stub-router state for this area */
3076 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
3078 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3082 json_object_boolean_true_add(json_area
, "originStubMaxDistRouterLsa");
3083 if (CHECK_FLAG(area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
3084 json_object_boolean_true_add(json_area
, "indefiniteActiveAdmin");
3085 if (area
->t_stub_router
)
3087 struct timeval result
;
3088 unsigned long time_store
= 0;
3089 result
= tv_sub (area
->t_stub_router
->u
.sands
, recent_relative_time());
3090 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3091 json_object_int_add(json_area
, "activeStartupRemainderMsecs", time_store
);
3096 vty_out (vty
, " Originating stub / maximum-distance Router-LSA%s",
3098 if (CHECK_FLAG(area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
3099 vty_out (vty
, " Administratively activated (indefinitely)%s",
3101 if (area
->t_stub_router
)
3102 vty_out (vty
, " Active from startup, %s remaining%s",
3103 ospf_timer_dump (area
->t_stub_router
, timebuf
,
3104 sizeof(timebuf
)), VTY_NEWLINE
);
3110 /* Show number of fully adjacent neighbors. */
3111 json_object_int_add(json_area
, "nbrFullAdjacentCounter", area
->full_nbrs
);
3113 /* Show authentication type. */
3114 if (area
->auth_type
== OSPF_AUTH_NULL
)
3115 json_object_string_add(json_area
, "authentication", "authenticationNone");
3116 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
3117 json_object_string_add(json_area
, "authentication", "authenticationSimplePassword");
3118 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
3119 json_object_string_add(json_area
, "authentication", "authenticationMessageDigest");
3121 if (!OSPF_IS_AREA_BACKBONE (area
))
3122 json_object_int_add(json_area
, "virtualAdjacenciesPassingCounter", area
->full_vls
);
3124 /* Show SPF calculation times. */
3125 json_object_int_add(json_area
, "spfExecutedCounter", area
->spf_calculation
);
3126 json_object_int_add(json_area
, "lsaNumber", area
->lsdb
->total
);
3127 json_object_int_add(json_area
, "lsaRouterNumber", ospf_lsdb_count (area
->lsdb
, OSPF_ROUTER_LSA
));
3128 json_object_int_add(json_area
, "lsaRouterChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_ROUTER_LSA
));
3129 json_object_int_add(json_area
, "lsaNetworkNumber", ospf_lsdb_count (area
->lsdb
, OSPF_NETWORK_LSA
));
3130 json_object_int_add(json_area
, "lsaNetworkChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_NETWORK_LSA
));
3131 json_object_int_add(json_area
, "lsaSummaryNumber", ospf_lsdb_count (area
->lsdb
, OSPF_SUMMARY_LSA
));
3132 json_object_int_add(json_area
, "lsaSummaryChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_SUMMARY_LSA
));
3133 json_object_int_add(json_area
, "lsaAsbrNumber", ospf_lsdb_count (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
));
3134 json_object_int_add(json_area
, "lsaAsbrChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
));
3135 json_object_int_add(json_area
, "lsaNssaNumber", ospf_lsdb_count (area
->lsdb
, OSPF_AS_NSSA_LSA
));
3136 json_object_int_add(json_area
, "lsaNssaChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_AS_NSSA_LSA
));
3140 /* Show number of fully adjacent neighbors. */
3141 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
3142 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
3144 /* Show authentication type. */
3145 vty_out (vty
, " Area has ");
3146 if (area
->auth_type
== OSPF_AUTH_NULL
)
3147 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
3148 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
3149 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
3150 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
3151 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
3153 if (!OSPF_IS_AREA_BACKBONE (area
))
3154 vty_out (vty
, " Number of full virtual adjacencies going through"
3155 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
3157 /* Show SPF calculation times. */
3158 vty_out (vty
, " SPF algorithm executed %d times%s",
3159 area
->spf_calculation
, VTY_NEWLINE
);
3161 /* Show number of LSA. */
3162 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
3163 vty_out (vty
, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
3164 ospf_lsdb_count (area
->lsdb
, OSPF_ROUTER_LSA
),
3165 ospf_lsdb_checksum (area
->lsdb
, OSPF_ROUTER_LSA
), VTY_NEWLINE
);
3166 vty_out (vty
, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
3167 ospf_lsdb_count (area
->lsdb
, OSPF_NETWORK_LSA
),
3168 ospf_lsdb_checksum (area
->lsdb
, OSPF_NETWORK_LSA
), VTY_NEWLINE
);
3169 vty_out (vty
, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
3170 ospf_lsdb_count (area
->lsdb
, OSPF_SUMMARY_LSA
),
3171 ospf_lsdb_checksum (area
->lsdb
, OSPF_SUMMARY_LSA
), VTY_NEWLINE
);
3172 vty_out (vty
, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
3173 ospf_lsdb_count (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
),
3174 ospf_lsdb_checksum (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
), VTY_NEWLINE
);
3175 vty_out (vty
, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
3176 ospf_lsdb_count (area
->lsdb
, OSPF_AS_NSSA_LSA
),
3177 ospf_lsdb_checksum (area
->lsdb
, OSPF_AS_NSSA_LSA
), VTY_NEWLINE
);
3180 #ifdef HAVE_OPAQUE_LSA
3183 json_object_int_add(json_area
, "lsaOpaqueLinkNumber", ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
));
3184 json_object_int_add(json_area
, "lsaOpaqueLinkChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
));
3185 json_object_int_add(json_area
, "lsaOpaqueAreaNumber", ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
));
3186 json_object_int_add(json_area
, "lsaOpaqueAreaChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
));
3190 vty_out (vty
, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
3191 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
),
3192 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
), VTY_NEWLINE
);
3193 vty_out (vty
, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
3194 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
),
3195 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
), VTY_NEWLINE
);
3197 #endif /* HAVE_OPAQUE_LSA */
3200 json_object_object_add(json_areas
, inet_ntoa (area
->area_id
), json_area
);
3202 vty_out (vty
, "%s", VTY_NEWLINE
);
3206 show_ip_ospf_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
3208 struct listnode
*node
, *nnode
;
3209 struct ospf_area
* area
;
3210 struct timeval result
;
3211 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3212 json_object
*json
= NULL
;
3213 json_object
*json_areas
= NULL
;
3216 json
= json_object_new_object();
3217 json_areas
= json_object_new_object();
3223 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
3227 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
3228 VTY_NEWLINE
, VTY_NEWLINE
);
3232 /* Show Router ID. */
3235 json_object_string_add(json
, "routerId", inet_ntoa (ospf
->router_id
));
3239 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
3240 inet_ntoa (ospf
->router_id
),
3244 /* Graceful shutdown */
3245 if (ospf
->t_deferred_shutdown
)
3249 unsigned long time_store
= 0;
3250 result
= tv_sub (ospf
->t_deferred_shutdown
->u
.sands
, recent_relative_time());
3251 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3252 json_object_int_add(json
, "deferredShutdownMsecs", time_store
);
3256 vty_out (vty
, " Deferred shutdown in progress, %s remaining%s",
3257 ospf_timer_dump (ospf
->t_deferred_shutdown
,
3258 timebuf
, sizeof (timebuf
)), VTY_NEWLINE
);
3262 /* Show capability. */
3265 json_object_boolean_true_add(json
, "tosRoutesOnly");
3266 json_object_boolean_true_add(json
, "rfc2328Conform");
3267 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
3269 json_object_boolean_true_add(json
, "rfc1583Compatibility");
3274 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
3275 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
3276 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
3277 CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
) ?
3278 "enabled" : "disabled", VTY_NEWLINE
);
3281 #ifdef HAVE_OPAQUE_LSA
3284 if (CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
))
3286 json_object_boolean_true_add(json
, "opaqueCapable");
3288 if (IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf
->opaque
))
3290 json_object_boolean_true_add(json
, "lsaOpaqueOriginationBlocked");
3295 vty_out (vty
, " OpaqueCapability flag is %s%s%s",
3296 CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
) ? "enabled" : "disabled",
3297 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf
->opaque
) ? " (origination blocked)" : "",
3300 #endif /* HAVE_OPAQUE_LSA */
3302 /* Show stub-router configuration */
3303 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
3304 || ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3308 json_object_boolean_true_add(json
, "stubAdvertisement");
3309 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3310 json_object_int_add(json
,"postStartEnabledMsecs", ospf
->stub_router_startup_time
/ 1000);
3311 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3312 json_object_int_add(json
,"preShutdownEnabledMsecs", ospf
->stub_router_shutdown_time
/ 1000);
3316 vty_out (vty
, " Stub router advertisement is configured%s",
3318 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3319 vty_out (vty
, " Enabled for %us after start-up%s",
3320 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
3321 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3322 vty_out (vty
, " Enabled for %us prior to full shutdown%s",
3323 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
3327 /* Show SPF timers. */
3330 json_object_int_add(json
, "spfScheduleDelayMsecs", ospf
->spf_delay
);
3331 json_object_int_add(json
, "holdtimeMinMsecs", ospf
->spf_holdtime
);
3332 json_object_int_add(json
, "holdtimeMaxMsecs", ospf
->spf_max_holdtime
);
3333 json_object_int_add(json
, "holdtimeMultplier", ospf
->spf_hold_multiplier
);
3337 vty_out (vty
, " Initial SPF scheduling delay %d millisec(s)%s"
3338 " Minimum hold time between consecutive SPFs %d millisec(s)%s"
3339 " Maximum hold time between consecutive SPFs %d millisec(s)%s"
3340 " Hold time multiplier is currently %d%s",
3341 ospf
->spf_delay
, VTY_NEWLINE
,
3342 ospf
->spf_holdtime
, VTY_NEWLINE
,
3343 ospf
->spf_max_holdtime
, VTY_NEWLINE
,
3344 ospf
->spf_hold_multiplier
, VTY_NEWLINE
);
3349 if (ospf
->ts_spf
.tv_sec
|| ospf
->ts_spf
.tv_usec
)
3351 unsigned long time_store
= 0;
3353 result
= tv_sub (recent_relative_time(), ospf
->ts_spf
);
3354 result
= tv_sub (result
, recent_relative_time());
3355 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3356 json_object_int_add(json
, "spfLastExecutedMsecs", time_store
);
3358 time_store
= (1000 * ospf
->ts_spf_duration
.tv_sec
) + (ospf
->ts_spf_duration
.tv_usec
/ 1000);
3359 json_object_int_add(json
, "spfLastDurationMsecs", time_store
);
3362 json_object_boolean_true_add(json
, "spfHasNotRun");
3366 vty_out (vty
, " SPF algorithm ");
3367 if (ospf
->ts_spf
.tv_sec
|| ospf
->ts_spf
.tv_usec
)
3369 result
= tv_sub (recent_relative_time(), ospf
->ts_spf
);
3370 vty_out (vty
, "last executed %s ago%s",
3371 ospf_timeval_dump (&result
, timebuf
, sizeof (timebuf
)),
3373 vty_out (vty
, " Last SPF duration %s%s",
3374 ospf_timeval_dump (&ospf
->ts_spf_duration
, timebuf
, sizeof (timebuf
)),
3378 vty_out (vty
, "has not been run%s", VTY_NEWLINE
);
3383 struct timeval temp_time
;
3384 unsigned long time_store
= 0;
3386 if (ospf
->t_spf_calc
)
3388 temp_time
= tv_sub (ospf
->t_spf_calc
->u
.sands
, recent_relative_time());
3389 time_store
= (1000 * temp_time
.tv_sec
) + (temp_time
.tv_usec
/ 1000);
3390 json_object_int_add(json
, "spfTimerDueInMsecs", time_store
);
3393 json_object_int_add(json
, "lsaMinIntervalMsecs", ospf
->min_ls_interval
);
3394 json_object_int_add(json
, "lsaMinArrivalMsecs", ospf
->min_ls_arrival
);
3395 /* Show write multiplier values */
3396 json_object_int_add(json
, "writeMultiplier", ospf
->write_oi_count
);
3397 /* Show refresh parameters. */
3398 json_object_int_add(json
, "refreshTimerMsecs", ospf
->lsa_refresh_interval
/ 1000);
3402 vty_out (vty
, " SPF timer %s%s%s",
3403 (ospf
->t_spf_calc
? "due in " : "is "),
3404 ospf_timer_dump (ospf
->t_spf_calc
, timebuf
, sizeof (timebuf
)),
3407 vty_out (vty
, " LSA minimum interval %d msecs%s",
3408 ospf
->min_ls_interval
, VTY_NEWLINE
);
3409 vty_out (vty
, " LSA minimum arrival %d msecs%s",
3410 ospf
->min_ls_arrival
, VTY_NEWLINE
);
3412 /* Show write multiplier values */
3413 vty_out (vty
, " Write Multiplier set to %d %s",
3414 ospf
->write_oi_count
, VTY_NEWLINE
);
3416 /* Show refresh parameters. */
3417 vty_out (vty
, " Refresh timer %d secs%s",
3418 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
3421 /* Show ABR/ASBR flags. */
3422 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
3425 json_object_string_add(json
, "abrType", ospf_abr_type_descr_str
[ospf
->abr_type
]);
3427 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
3428 ospf_abr_type_descr_str
[ospf
->abr_type
], VTY_NEWLINE
);
3430 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
3433 json_object_string_add(json
, "asbrRouter", "injectingExternalRoutingInformation");
3435 vty_out (vty
, " This router is an ASBR "
3436 "(injecting external routing information)%s", VTY_NEWLINE
);
3439 /* Show Number of AS-external-LSAs. */
3442 json_object_int_add(json
, "lsaExternalCounter",
3443 ospf_lsdb_count (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
));
3444 json_object_int_add(json
, "lsaExternalChecksum",
3445 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
));
3449 vty_out (vty
, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
3450 ospf_lsdb_count (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
),
3451 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
), VTY_NEWLINE
);
3454 #ifdef HAVE_OPAQUE_LSA
3457 json_object_int_add(json
, "lsaAsopaqueCounter",
3458 ospf_lsdb_count (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
));
3459 json_object_int_add(json
, "lsaAsOpaqueChecksum",
3460 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
));
3464 vty_out (vty
, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
3465 ospf_lsdb_count (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
),
3466 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
), VTY_NEWLINE
);
3468 #endif /* HAVE_OPAQUE_LSA */
3470 /* Show number of areas attached. */
3472 json_object_int_add(json
, "attachedAreaCounter", listcount (ospf
->areas
));
3474 vty_out (vty
, " Number of areas attached to this router: %d%s",
3475 listcount (ospf
->areas
), VTY_NEWLINE
);
3477 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
))
3479 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
))
3482 json_object_boolean_true_add(json
, "adjacencyChangesLoggedAll");
3484 vty_out(vty
, " All adjacency changes are logged%s",VTY_NEWLINE
);
3489 json_object_boolean_true_add(json
, "adjacencyChangesLogged");
3491 vty_out(vty
, " Adjacency changes are logged%s",VTY_NEWLINE
);
3494 /* Show each area status. */
3495 for (ALL_LIST_ELEMENTS (ospf
->areas
, node
, nnode
, area
))
3496 show_ip_ospf_area (vty
, area
, json_areas
, use_json
);
3500 json_object_object_add(json
, "areas", json_areas
);
3501 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
3502 json_object_free(json
);
3505 vty_out (vty
, "%s",VTY_NEWLINE
);
3510 DEFUN (show_ip_ospf
,
3512 "show ip ospf {json}",
3515 "OSPF information\n"
3516 "JavaScript Object Notation\n")
3519 u_char uj
= use_json(argc
, argv
);
3521 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
3524 return (show_ip_ospf_common(vty
, ospf
, uj
));
3527 DEFUN (show_ip_ospf_instance
,
3528 show_ip_ospf_instance_cmd
,
3529 "show ip ospf <1-65535> {json}",
3532 "OSPF information\n"
3534 "JavaScript Object Notation\n")
3537 u_short instance
= 0;
3538 u_char uj
= use_json(argc
, argv
);
3540 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
3541 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
3544 return (show_ip_ospf_common(vty
, ospf
, uj
));
3548 show_ip_ospf_interface_sub (struct vty
*vty
, struct ospf
*ospf
, struct interface
*ifp
,
3549 json_object
*json_interface_sub
, u_char use_json
)
3552 struct ospf_neighbor
*nbr
;
3553 struct route_node
*rn
;
3555 /* Is interface up? */
3558 is_up
= if_is_operative(ifp
);
3560 json_object_boolean_true_add(json_interface_sub
, "ifUp");
3562 json_object_boolean_false_add(json_interface_sub
, "ifDown");
3564 json_object_int_add(json_interface_sub
, "ifIndex", ifp
->ifindex
);
3565 json_object_int_add(json_interface_sub
, "mtuBytes", ifp
->mtu
);
3566 json_object_int_add(json_interface_sub
, "bandwidthKbit", ifp
->bandwidth
);
3567 json_object_string_add(json_interface_sub
, "ifFlags", if_flag_dump(ifp
->flags
));
3571 vty_out (vty
, "%s is %s%s", ifp
->name
,
3572 ((is_up
= if_is_operative(ifp
)) ? "up" : "down"), VTY_NEWLINE
);
3573 vty_out (vty
, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s",
3574 ifp
->ifindex
, ifp
->mtu
, ifp
->bandwidth
, if_flag_dump(ifp
->flags
),
3578 /* Is interface OSPF enabled? */
3581 if (ospf_oi_count(ifp
) == 0)
3583 json_object_boolean_false_add(json_interface_sub
, "ospfEnabled");
3588 json_object_boolean_false_add(json_interface_sub
, "ospfRunning");
3592 json_object_boolean_true_add(json_interface_sub
, "ospfEnabled");
3596 if (ospf_oi_count(ifp
) == 0)
3598 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
3603 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
3609 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
3611 struct ospf_interface
*oi
= rn
->info
;
3616 if (CHECK_FLAG(oi
->connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
3619 json_object_boolean_true_add(json_interface_sub
, "ifUnnumbered");
3621 vty_out (vty
, " This interface is UNNUMBERED,");
3625 /* Show OSPF interface information. */
3628 json_object_string_add(json_interface_sub
, "ipAddress", inet_ntoa (oi
->address
->u
.prefix4
));
3629 json_object_int_add(json_interface_sub
, "ipAddressPrefixlen", oi
->address
->prefixlen
);
3632 vty_out (vty
, " Internet Address %s/%d,",
3633 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
3635 if (oi
->connected
->destination
|| oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3637 struct in_addr
*dest
;
3640 if (CONNECTED_PEER(oi
->connected
)
3641 || oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3646 /* For Vlinks, showing the peer address is probably more
3647 * * * * * informative than the local interface that is being used
3649 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3650 dest
= &oi
->vl_data
->peer_addr
;
3652 dest
= &oi
->connected
->destination
->u
.prefix4
;
3656 json_object_string_add(json_interface_sub
, "ospfIfType", dstr
);
3657 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3658 json_object_string_add(json_interface_sub
, "vlinkPeer", inet_ntoa (*dest
));
3660 json_object_string_add(json_interface_sub
, "localIfUsed", inet_ntoa (*dest
));
3663 vty_out (vty
, " %s %s,", dstr
, inet_ntoa (*dest
));
3668 json_object_string_add(json_interface_sub
, "area", ospf_area_desc_string (oi
->area
));
3669 if (OSPF_IF_PARAM(oi
, mtu_ignore
))
3670 json_object_boolean_true_add(json_interface_sub
, "mtuMismatchDetect");
3671 json_object_string_add(json_interface_sub
, "routerId", inet_ntoa (ospf
->router_id
));
3672 json_object_string_add(json_interface_sub
, "networkType", ospf_network_type_str
[oi
->type
]);
3673 json_object_int_add(json_interface_sub
, "cost", oi
->output_cost
);
3674 json_object_int_add(json_interface_sub
, "transmitDelayMsecs", 1000 / OSPF_IF_PARAM (oi
,transmit_delay
));
3675 json_object_string_add(json_interface_sub
, "state", LOOKUP (ospf_ism_state_msg
, oi
->state
));
3676 json_object_int_add(json_interface_sub
, "priority", PRIORITY (oi
));
3680 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
3683 vty_out (vty
, " MTU mismatch detection:%s%s",
3684 OSPF_IF_PARAM(oi
, mtu_ignore
) ? "disabled" : "enabled", VTY_NEWLINE
);
3686 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
3687 inet_ntoa (ospf
->router_id
), ospf_network_type_str
[oi
->type
],
3688 oi
->output_cost
, VTY_NEWLINE
);
3690 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
3691 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
3692 PRIORITY (oi
), VTY_NEWLINE
);
3695 /* Show DR information. */
3696 if (DR (oi
).s_addr
== 0)
3699 vty_out (vty
, " No backup designated router on this network%s",
3704 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
3708 vty_out (vty
, " No backup designated router on this network%s",
3715 json_object_string_add(json_interface_sub
, "bdrId", inet_ntoa (nbr
->router_id
));
3716 json_object_string_add(json_interface_sub
, "bdrAddress", inet_ntoa (nbr
->address
.u
.prefix4
));
3720 vty_out (vty
, " Backup Designated Router (ID) %s,",
3721 inet_ntoa (nbr
->router_id
));
3722 vty_out (vty
, " Interface Address %s%s",
3723 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
3728 /* Next network-LSA sequence number we'll use, if we're elected DR */
3729 if (oi
->params
&& ntohl (oi
->params
->network_lsa_seqnum
) != OSPF_INITIAL_SEQUENCE_NUMBER
)
3732 json_object_int_add(json_interface_sub
, "networkLsaSequence", ntohl (oi
->params
->network_lsa_seqnum
));
3734 vty_out (vty
, " Saved Network-LSA sequence number 0x%x%s",
3735 ntohl (oi
->params
->network_lsa_seqnum
), VTY_NEWLINE
);
3740 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
3741 || OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3743 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
))
3744 json_object_boolean_true_add(json_interface_sub
, "mcastMemberOspfAllRouters");
3745 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3746 json_object_boolean_true_add(json_interface_sub
, "mcastMemberOspfDesignatedRouters");
3751 vty_out (vty
, " Multicast group memberships:");
3752 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
3753 || OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3755 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
))
3756 vty_out (vty
, " OSPFAllRouters");
3757 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3758 vty_out (vty
, " OSPFDesignatedRouters");
3761 vty_out (vty
, " <None>");
3762 vty_out (vty
, "%s", VTY_NEWLINE
);
3767 if (OSPF_IF_PARAM (oi
, fast_hello
) == 0)
3768 json_object_int_add(json_interface_sub
, "timerMsecs", 1000 /OSPF_IF_PARAM (oi
, v_hello
));
3770 json_object_int_add(json_interface_sub
, "timerMsecs", 1000 / OSPF_IF_PARAM (oi
, fast_hello
));
3771 json_object_int_add(json_interface_sub
, "timerDeadMsecs", 1000 / OSPF_IF_PARAM (oi
, v_wait
));
3772 json_object_int_add(json_interface_sub
, "timerWaitMsecs", 1000 / OSPF_IF_PARAM (oi
, v_wait
));
3773 json_object_int_add(json_interface_sub
, "timerRetransmit", 1000 / OSPF_IF_PARAM (oi
, retransmit_interval
));
3777 vty_out (vty
, " Timer intervals configured,");
3778 vty_out (vty
, " Hello ");
3779 if (OSPF_IF_PARAM (oi
, fast_hello
) == 0)
3780 vty_out (vty
, "%ds,", OSPF_IF_PARAM (oi
, v_hello
));
3782 vty_out (vty
, "%dms,", 1000 / OSPF_IF_PARAM (oi
, fast_hello
));
3783 vty_out (vty
, " Dead %ds, Wait %ds, Retransmit %d%s",
3784 OSPF_IF_PARAM (oi
, v_wait
),
3785 OSPF_IF_PARAM (oi
, v_wait
),
3786 OSPF_IF_PARAM (oi
, retransmit_interval
),
3790 if (OSPF_IF_PASSIVE_STATUS (oi
) == OSPF_IF_ACTIVE
)
3792 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3795 struct timeval result
;
3796 unsigned long time_store
= 0;
3797 result
= tv_sub (oi
->t_hello
->u
.sands
, recent_relative_time());
3798 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3799 json_object_int_add(json_interface_sub
, "timerHelloInMsecs", time_store
);
3802 vty_out (vty
, " Hello due in %s%s",
3803 ospf_timer_dump (oi
->t_hello
, timebuf
, sizeof(timebuf
)),
3806 else /* passive-interface is set */
3809 json_object_boolean_true_add(json_interface_sub
, "timerPassiveIface");
3811 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
3816 json_object_int_add(json_interface_sub
, "nbrCount", ospf_nbr_count (oi
, 0));
3817 json_object_int_add(json_interface_sub
, "nbrAdjacentCount", ospf_nbr_count (oi
, NSM_Full
));
3820 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
3821 ospf_nbr_count (oi
, 0), ospf_nbr_count (oi
, NSM_Full
),
3823 ospf_bfd_interface_show(vty
, ifp
, json_interface_sub
, use_json
);
3828 show_ip_ospf_interface_common (struct vty
*vty
, struct ospf
*ospf
, int argc
,
3829 const char **argv
, int iface_argv
, u_char use_json
)
3831 struct interface
*ifp
;
3832 struct listnode
*node
;
3833 json_object
*json
= NULL
;
3834 json_object
*json_interface_sub
= NULL
;
3838 json
= json_object_new_object();
3839 json_interface_sub
= json_object_new_object();
3845 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
3847 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
3848 VTY_NEWLINE
, VTY_NEWLINE
);
3851 if (argc
== (iface_argv
+ 1))
3853 /* Show All Interfaces.*/
3854 for (ALL_LIST_ELEMENTS_RO (iflist
, node
, ifp
))
3856 if (ospf_oi_count(ifp
))
3858 show_ip_ospf_interface_sub (vty
, ospf
, ifp
, json_interface_sub
, use_json
);
3862 else if (argv
[iface_argv
] && strcmp(argv
[iface_argv
], "json") == 0)
3864 /* Show All Interfaces. */
3865 for (ALL_LIST_ELEMENTS_RO (iflist
, node
, ifp
))
3867 if (ospf_oi_count(ifp
))
3869 show_ip_ospf_interface_sub (vty
, ospf
, ifp
, json_interface_sub
, use_json
);
3870 json_object_object_add(json
, ifp
->name
, json_interface_sub
);
3876 /* Interface name is specified. */
3877 if ((ifp
= if_lookup_by_name (argv
[iface_argv
])) == NULL
)
3880 json_object_boolean_true_add(json
, "noSuchIface");
3882 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
3886 show_ip_ospf_interface_sub (vty
, ospf
, ifp
, json_interface_sub
, use_json
);
3888 json_object_object_add(json
, ifp
->name
, json_interface_sub
);
3894 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
3895 json_object_free(json
);
3898 vty_out (vty
, "%s", VTY_NEWLINE
);
3903 DEFUN (show_ip_ospf_interface
,
3904 show_ip_ospf_interface_cmd
,
3905 "show ip ospf interface [INTERFACE] {json}",
3908 "OSPF information\n"
3909 "Interface information\n"
3911 "JavaScript Object Notation\n")
3914 u_char uj
= use_json(argc
, argv
);
3916 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
3919 return show_ip_ospf_interface_common(vty
, ospf
, argc
, argv
, 0, uj
);
3922 DEFUN (show_ip_ospf_instance_interface
,
3923 show_ip_ospf_instance_interface_cmd
,
3924 "show ip ospf <1-65535> interface [INTERFACE] {json}",
3927 "OSPF information\n"
3929 "Interface information\n"
3931 "JavaScript Object Notation\n")
3934 u_short instance
= 0;
3935 u_char uj
= use_json(argc
, argv
);
3937 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
3938 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
3941 return show_ip_ospf_interface_common(vty
, ospf
, argc
, argv
, 1, uj
);
3945 show_ip_ospf_neighbour_header (struct vty
*vty
)
3947 vty_out (vty
, "%s%-15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
3949 "Neighbor ID", "Pri", "State", "Dead Time",
3950 "Address", "Interface", "RXmtL", "RqstL", "DBsmL",
3955 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
, json_object
*json
, u_char use_json
)
3957 struct route_node
*rn
;
3958 struct ospf_neighbor
*nbr
;
3960 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3961 json_object
*json_neighbor
= NULL
;
3963 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3965 if ((nbr
= rn
->info
))
3967 /* Do not show myself. */
3968 if (nbr
!= oi
->nbr_self
)
3970 /* Down state is not shown. */
3971 if (nbr
->state
!= NSM_Down
)
3975 json_neighbor
= json_object_new_object();
3976 ospf_nbr_state_message (nbr
, msgbuf
, 16);
3978 struct timeval result
;
3979 unsigned long time_store
= 0;
3981 result
= tv_sub (nbr
->t_inactivity
->u
.sands
, recent_relative_time());
3982 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3984 json_object_int_add (json_neighbor
, "priority", nbr
->priority
);
3985 json_object_string_add (json_neighbor
, "state", msgbuf
);
3986 json_object_int_add (json_neighbor
, "deadTimeMsecs", time_store
);
3987 json_object_string_add (json_neighbor
, "address", inet_ntoa (nbr
->src
));
3988 json_object_string_add (json_neighbor
, "ifaceName", IF_NAME (oi
));
3989 json_object_int_add (json_neighbor
, "retransmitCounter", ospf_ls_retransmit_count (nbr
));
3990 json_object_int_add (json_neighbor
, "requestCounter", ospf_ls_request_count (nbr
));
3991 json_object_int_add (json_neighbor
, "dbSummaryCounter", ospf_db_summary_count (nbr
));
3992 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
3993 json_object_object_add(json
, "neighbor", json_neighbor
);
3995 json_object_object_add(json
, inet_ntoa (nbr
->router_id
), json_neighbor
);
3999 ospf_nbr_state_message (nbr
, msgbuf
, 16);
4001 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4002 vty_out (vty
, "%-15s %3d %-15s ",
4006 vty_out (vty
, "%-15s %3d %-15s ",
4007 inet_ntoa (nbr
->router_id
), nbr
->priority
,
4010 vty_out (vty
, "%9s ",
4011 ospf_timer_dump (nbr
->t_inactivity
, timebuf
,
4013 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
4014 vty_out (vty
, "%-20s %5ld %5ld %5d%s",
4015 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
4016 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
4026 show_ip_ospf_neighbor_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4028 struct ospf_interface
*oi
;
4029 struct listnode
*node
;
4030 json_object
*json
= NULL
;
4033 json
= json_object_new_object();
4035 show_ip_ospf_neighbour_header (vty
);
4040 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4042 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4043 VTY_NEWLINE
, VTY_NEWLINE
);
4046 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4047 show_ip_ospf_neighbor_sub (vty
, oi
, json
, use_json
);
4051 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4052 json_object_free(json
);
4055 vty_out (vty
, "%s", VTY_NEWLINE
);
4060 DEFUN (show_ip_ospf_neighbor
,
4061 show_ip_ospf_neighbor_cmd
,
4062 "show ip ospf neighbor {json}",
4065 "OSPF information\n"
4067 "JavaScript Object Notation\n")
4070 u_char uj
= use_json(argc
, argv
);
4072 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4075 return show_ip_ospf_neighbor_common(vty
, ospf
, uj
);
4079 DEFUN (show_ip_ospf_instance_neighbor
,
4080 show_ip_ospf_instance_neighbor_cmd
,
4081 "show ip ospf <1-65535> neighbor {json}",
4084 "OSPF information\n"
4087 "JavaScript Object Notation\n")
4090 u_short instance
= 0;
4091 u_char uj
= use_json(argc
, argv
);
4093 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4094 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4097 return show_ip_ospf_neighbor_common(vty
, ospf
, uj
);
4101 show_ip_ospf_neighbor_all_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4103 struct listnode
*node
;
4104 struct ospf_interface
*oi
;
4105 json_object
*json
= NULL
;
4106 json_object
*json_neighbor_sub
= NULL
;
4110 json
= json_object_new_object();
4111 json_neighbor_sub
= json_object_new_object();
4114 show_ip_ospf_neighbour_header (vty
);
4119 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4121 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4122 VTY_NEWLINE
, VTY_NEWLINE
);
4125 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4127 struct listnode
*nbr_node
;
4128 struct ospf_nbr_nbma
*nbr_nbma
;
4130 show_ip_ospf_neighbor_sub (vty
, oi
, json
, use_json
);
4132 /* print Down neighbor status */
4133 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nbr_node
, nbr_nbma
))
4135 if (nbr_nbma
->nbr
== NULL
4136 || nbr_nbma
->nbr
->state
== NSM_Down
)
4140 json_object_int_add (json_neighbor_sub
, "nbrNbmaPriority", nbr_nbma
->priority
);
4141 json_object_boolean_true_add (json_neighbor_sub
, "nbrNbmaDown");
4142 json_object_string_add (json_neighbor_sub
, "nbrNbmaIfaceName", IF_NAME (oi
));
4143 json_object_int_add (json_neighbor_sub
, "nbrNbmaRetransmitCounter", 0);
4144 json_object_int_add (json_neighbor_sub
, "nbrNbmaRequestCounter", 0);
4145 json_object_int_add (json_neighbor_sub
, "nbrNbmaDbSummaryCounter", 0);
4146 json_object_object_add(json
, inet_ntoa (nbr_nbma
->addr
), json_neighbor_sub
);
4150 vty_out (vty
, "%-15s %3d %-15s %9s ",
4151 "-", nbr_nbma
->priority
, "Down", "-");
4152 vty_out (vty
, "%-15s %-20s %5d %5d %5d%s",
4153 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
4154 0, 0, 0, VTY_NEWLINE
);
4162 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4163 json_object_free(json
);
4166 vty_out (vty
, "%s", VTY_NEWLINE
);
4171 DEFUN (show_ip_ospf_neighbor_all
,
4172 show_ip_ospf_neighbor_all_cmd
,
4173 "show ip ospf neighbor all {json}",
4176 "OSPF information\n"
4178 "include down status neighbor\n"
4179 "JavaScript Object Notation\n")
4182 u_char uj
= use_json(argc
, argv
);
4184 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4187 return show_ip_ospf_neighbor_all_common(vty
, ospf
, uj
);
4190 DEFUN (show_ip_ospf_instance_neighbor_all
,
4191 show_ip_ospf_instance_neighbor_all_cmd
,
4192 "show ip ospf <1-65535> neighbor all {json}",
4195 "OSPF information\n"
4198 "include down status neighbor\n"
4199 "JavaScript Object Notation\n")
4202 u_short instance
= 0;
4203 u_char uj
= use_json(argc
, argv
);
4205 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4206 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4209 return show_ip_ospf_neighbor_all_common(vty
, ospf
, uj
);
4213 show_ip_ospf_neighbor_int_common (struct vty
*vty
, struct ospf
*ospf
, int arg_base
,
4214 const char **argv
, u_char use_json
)
4216 struct interface
*ifp
;
4217 struct route_node
*rn
;
4218 json_object
*json
= NULL
;
4221 json
= json_object_new_object();
4223 show_ip_ospf_neighbour_header (vty
);
4228 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4230 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4231 VTY_NEWLINE
, VTY_NEWLINE
);
4234 ifp
= if_lookup_by_name (argv
[arg_base
]);
4238 json_object_boolean_true_add(json
, "noSuchIface");
4240 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
4244 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4246 struct ospf_interface
*oi
= rn
->info
;
4251 show_ip_ospf_neighbor_sub (vty
, oi
, json
, use_json
);
4256 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4257 json_object_free(json
);
4260 vty_out (vty
, "%s", VTY_NEWLINE
);
4265 DEFUN (show_ip_ospf_neighbor_int
,
4266 show_ip_ospf_neighbor_int_cmd
,
4267 "show ip ospf neighbor IFNAME {json}",
4270 "OSPF information\n"
4273 "JavaScript Object Notation\n")
4276 u_char uj
= use_json(argc
, argv
);
4278 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4281 return show_ip_ospf_neighbor_int_common(vty
, ospf
, 0, argv
, uj
);
4284 DEFUN (show_ip_ospf_instance_neighbor_int
,
4285 show_ip_ospf_instance_neighbor_int_cmd
,
4286 "show ip ospf <1-65535> neighbor IFNAME {json}",
4289 "OSPF information\n"
4293 "JavaScript Object Notation\n")
4296 u_short instance
= 0;
4297 u_char uj
= use_json(argc
, argv
);
4299 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4300 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4303 return show_ip_ospf_neighbor_int_common(vty
, ospf
, 1, argv
, uj
);
4307 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
, struct ospf_nbr_nbma
*nbr_nbma
,
4308 u_char use_json
, json_object
*json
)
4310 char timebuf
[OSPF_TIME_DUMP_SIZE
];
4311 json_object
*json_sub
= NULL
;
4314 json_sub
= json_object_new_object();
4315 else /* Show neighbor ID. */
4316 vty_out (vty
, " Neighbor %s,", "-");
4318 /* Show interface address. */
4320 json_object_string_add(json_sub
, "ifaceAddress", inet_ntoa (nbr_nbma
->addr
));
4322 vty_out (vty
, " interface address %s%s",
4323 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
4328 json_object_string_add(json_sub
, "areaId", ospf_area_desc_string (oi
->area
));
4329 json_object_string_add(json_sub
, "iface", IF_NAME (oi
));
4332 vty_out (vty
, " In the area %s via interface %s%s",
4333 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
4335 /* Show neighbor priority and state. */
4338 json_object_int_add(json_sub
, "nbrPriority", nbr_nbma
->priority
);
4339 json_object_string_add(json_sub
, "nbrState", "down");
4342 vty_out (vty
, " Neighbor priority is %d, State is %s,",
4343 nbr_nbma
->priority
, "Down");
4345 /* Show state changes. */
4347 json_object_int_add(json_sub
, "stateChangeCounter", nbr_nbma
->state_change
);
4349 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
4351 /* Show PollInterval */
4353 json_object_int_add(json_sub
, "pollInterval", nbr_nbma
->v_poll
);
4355 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
4357 /* Show poll-interval timer. */
4360 struct timeval res
= tv_sub (nbr_nbma
->t_poll
->u
.sands
, recent_relative_time ());
4361 unsigned long time_store
= 0;
4362 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4363 json_object_int_add(json_sub
, "pollIntervalTimerDueMsec", time_store
);
4366 vty_out (vty
, " Poll timer due in %s%s",
4367 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, sizeof(timebuf
)),
4370 /* Show poll-interval timer thread. */
4373 if (nbr_nbma
->t_poll
!= NULL
)
4374 json_object_string_add(json_sub
, "pollIntervalTimerThread", "on");
4377 vty_out (vty
, " Thread Poll Timer %s%s",
4378 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
4381 json_object_object_add(json
, "noNbrId", json_sub
);
4385 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
4386 struct ospf_neighbor
*nbr
, u_char use_json
, json_object
*json
)
4388 char timebuf
[OSPF_TIME_DUMP_SIZE
];
4389 json_object
*json_sub
= NULL
;
4392 json_sub
= json_object_new_object();
4395 /* Show neighbor ID. */
4396 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4397 vty_out (vty
, " Neighbor %s,", "-");
4399 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
4402 /* Show interface address. */
4404 json_object_string_add(json_sub
, "ifaceAddress", inet_ntoa (nbr
->address
.u
.prefix4
));
4406 vty_out (vty
, " interface address %s%s",
4407 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
4412 json_object_string_add(json_sub
, "areaId", ospf_area_desc_string (oi
->area
));
4413 json_object_string_add(json_sub
, "ifaceName", oi
->ifp
->name
);
4416 vty_out (vty
, " In the area %s via interface %s%s",
4417 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
4419 /* Show neighbor priority and state. */
4422 json_object_int_add(json_sub
, "nbrPriority", nbr
->priority
);
4423 json_object_string_add(json_sub
, "nbrState", LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
4426 vty_out (vty
, " Neighbor priority is %d, State is %s,",
4427 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
4429 /* Show state changes. */
4431 json_object_int_add(json_sub
, "stateChangeCounter", nbr
->state_change
);
4433 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
4435 if (nbr
->ts_last_progress
.tv_sec
|| nbr
->ts_last_progress
.tv_usec
)
4437 struct timeval res
= tv_sub (recent_relative_time (), nbr
->ts_last_progress
);
4440 unsigned long time_store
= 0;
4441 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4442 json_object_int_add(json_sub
, "lastPrgrsvChangeMsec", time_store
);
4446 vty_out (vty
, " Most recent state change statistics:%s",
4448 vty_out (vty
, " Progressive change %s ago%s",
4449 ospf_timeval_dump (&res
, timebuf
, sizeof(timebuf
)),
4454 if (nbr
->ts_last_regress
.tv_sec
|| nbr
->ts_last_regress
.tv_usec
)
4456 struct timeval res
= tv_sub (recent_relative_time (), nbr
->ts_last_regress
);
4459 unsigned long time_store
= 0;
4460 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4461 json_object_int_add(json_sub
, "lastRegressiveChangeMsec", time_store
);
4462 if (nbr
->last_regress_str
)
4463 json_object_string_add(json_sub
, "lastRegressiveChangeReason", nbr
->last_regress_str
);
4467 vty_out (vty
, " Regressive change %s ago, due to %s%s",
4468 ospf_timeval_dump (&res
, timebuf
, sizeof(timebuf
)),
4469 (nbr
->last_regress_str
? nbr
->last_regress_str
: "??"),
4474 /* Show Designated Rotuer ID. */
4476 json_object_string_add(json_sub
, "routerDesignatedId", inet_ntoa (nbr
->d_router
));
4478 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
4480 /* Show Backup Designated Rotuer ID. */
4482 json_object_string_add(json_sub
, "routerDesignatedBackupId", inet_ntoa (nbr
->bd_router
));
4484 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
4489 json_object_int_add(json_sub
, "optionsCounter", nbr
->options
);
4490 json_object_string_add(json_sub
, "optionsList", ospf_options_dump (nbr
->options
));
4493 vty_out (vty
, " Options %d %s%s", nbr
->options
,
4494 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
4496 /* Show Router Dead interval timer. */
4499 struct timeval res
= tv_sub (nbr
->t_inactivity
->u
.sands
, recent_relative_time ());
4500 unsigned long time_store
= 0;
4501 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4502 json_object_int_add(json_sub
, "routerDeadIntervalTimerDueMsec", time_store
);
4505 vty_out (vty
, " Dead timer due in %s%s",
4506 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, sizeof (timebuf
)),
4509 /* Show Database Summary list. */
4511 json_object_int_add(json_sub
, "databaseSummaryListCounter", ospf_db_summary_count (nbr
));
4513 vty_out (vty
, " Database Summary List %d%s",
4514 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
4516 /* Show Link State Request list. */
4518 json_object_int_add(json_sub
, "linkStateRequestListCounter", ospf_ls_request_count (nbr
));
4520 vty_out (vty
, " Link State Request List %ld%s",
4521 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
4523 /* Show Link State Retransmission list. */
4525 json_object_int_add(json_sub
, "linkStateRetransmissionListCounter", ospf_ls_retransmit_count (nbr
));
4527 vty_out (vty
, " Link State Retransmission List %ld%s",
4528 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
4530 /* Show inactivity timer thread. */
4533 if (nbr
->t_inactivity
!= NULL
)
4534 json_object_string_add(json_sub
, "threadInactivityTimer", "on");
4537 vty_out (vty
, " Thread Inactivity Timer %s%s",
4538 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
4540 /* Show Database Description retransmission thread. */
4543 if (nbr
->t_db_desc
!= NULL
)
4544 json_object_string_add(json_sub
, "threadDatabaseDescriptionRetransmission", "on");
4547 vty_out (vty
, " Thread Database Description Retransmision %s%s",
4548 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
4550 /* Show Link State Request Retransmission thread. */
4553 if (nbr
->t_ls_req
!= NULL
)
4554 json_object_string_add(json_sub
, "threadLinkStateRequestRetransmission", "on");
4557 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
4558 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
4560 /* Show Link State Update Retransmission thread. */
4563 if (nbr
->t_ls_upd
!= NULL
)
4564 json_object_string_add(json_sub
, "threadLinkStateUpdateRetransmission", "on");
4567 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
4568 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
4572 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4573 json_object_object_add(json
, "noNbrId", json_sub
);
4575 json_object_object_add(json
, inet_ntoa (nbr
->router_id
), json_sub
);
4578 ospf_bfd_show_info(vty
, nbr
->bfd_info
, json
, use_json
, 0);
4582 show_ip_ospf_neighbor_id_common (struct vty
*vty
, struct ospf
*ospf
,
4583 int arg_base
, const char **argv
, u_char use_json
)
4585 struct listnode
*node
;
4586 struct ospf_neighbor
*nbr
;
4587 struct ospf_interface
*oi
;
4588 struct in_addr router_id
;
4590 json_object
*json
= NULL
;
4593 json
= json_object_new_object();
4598 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4600 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4601 VTY_NEWLINE
, VTY_NEWLINE
);
4604 ret
= inet_aton (argv
[arg_base
], &router_id
);
4608 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
4612 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4614 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
4616 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
, use_json
, json
);
4622 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4623 json_object_free(json
);
4626 vty_out (vty
, "%s", VTY_NEWLINE
);
4631 DEFUN (show_ip_ospf_neighbor_id
,
4632 show_ip_ospf_neighbor_id_cmd
,
4633 "show ip ospf neighbor A.B.C.D {json}",
4636 "OSPF information\n"
4639 "JavaScript Object Notation\n")
4642 u_char uj
= use_json(argc
, argv
);
4644 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4647 return show_ip_ospf_neighbor_id_common(vty
, ospf
, 0, argv
, uj
);
4650 DEFUN (show_ip_ospf_instance_neighbor_id
,
4651 show_ip_ospf_instance_neighbor_id_cmd
,
4652 "show ip ospf <1-65535> neighbor A.B.C.D {json}",
4655 "OSPF information\n"
4659 "JavaScript Object Notation\n")
4662 u_short instance
= 0;
4663 u_char uj
= use_json(argc
, argv
);
4665 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4666 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4669 return show_ip_ospf_neighbor_id_common(vty
, ospf
, 1, argv
, uj
);
4673 show_ip_ospf_neighbor_detail_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4675 struct ospf_interface
*oi
;
4676 struct listnode
*node
;
4677 json_object
*json
= NULL
;
4680 json
= json_object_new_object();
4685 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4687 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4688 VTY_NEWLINE
, VTY_NEWLINE
);
4691 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4693 struct route_node
*rn
;
4694 struct ospf_neighbor
*nbr
;
4696 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4698 if ((nbr
= rn
->info
))
4700 if (nbr
!= oi
->nbr_self
)
4702 if (nbr
->state
!= NSM_Down
)
4704 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
, use_json
, json
);
4713 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4714 json_object_free(json
);
4717 vty_out (vty
, "%s", VTY_NEWLINE
);
4722 DEFUN (show_ip_ospf_neighbor_detail
,
4723 show_ip_ospf_neighbor_detail_cmd
,
4724 "show ip ospf neighbor detail {json}",
4727 "OSPF information\n"
4729 "detail of all neighbors\n"
4730 "JavaScript Object Notation\n")
4733 u_char uj
= use_json(argc
, argv
);
4735 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4738 return show_ip_ospf_neighbor_detail_common(vty
, ospf
, uj
);
4741 DEFUN (show_ip_ospf_instance_neighbor_detail
,
4742 show_ip_ospf_instance_neighbor_detail_cmd
,
4743 "show ip ospf <1-65535> neighbor detail {json}",
4746 "OSPF information\n"
4749 "detail of all neighbors\n"
4750 "JavaScript Object Notation\n")
4753 u_short instance
= 0;
4754 u_char uj
= use_json(argc
, argv
);
4756 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4757 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
4760 return show_ip_ospf_neighbor_detail_common(vty
, ospf
, uj
);
4764 show_ip_ospf_neighbor_detail_all_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4766 struct listnode
*node
;
4767 struct ospf_interface
*oi
;
4768 json_object
*json
= NULL
;
4771 json
= json_object_new_object();
4776 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4778 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4779 VTY_NEWLINE
, VTY_NEWLINE
);
4782 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4784 struct route_node
*rn
;
4785 struct ospf_neighbor
*nbr
;
4786 struct ospf_nbr_nbma
*nbr_nbma
;
4788 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4789 if ((nbr
= rn
->info
))
4790 if (nbr
!= oi
->nbr_self
)
4791 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
4792 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
, use_json
, json
);
4794 if (oi
->type
== OSPF_IFTYPE_NBMA
)
4796 struct listnode
*nd
;
4798 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nd
, nbr_nbma
))
4800 if (nbr_nbma
->nbr
== NULL
|| nbr_nbma
->nbr
->state
== NSM_Down
)
4801 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
, use_json
, json
);
4808 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4809 json_object_free(json
);
4813 vty_out (vty
, "%s", VTY_NEWLINE
);
4819 DEFUN (show_ip_ospf_neighbor_detail_all
,
4820 show_ip_ospf_neighbor_detail_all_cmd
,
4821 "show ip ospf neighbor detail all {json}",
4824 "OSPF information\n"
4826 "detail of all neighbors\n"
4827 "include down status neighbor\n"
4828 "JavaScript Object Notation\n")
4831 u_char uj
= use_json(argc
, argv
);
4833 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4836 return show_ip_ospf_neighbor_detail_all_common(vty
, ospf
, uj
);
4839 DEFUN (show_ip_ospf_instance_neighbor_detail_all
,
4840 show_ip_ospf_instance_neighbor_detail_all_cmd
,
4841 "show ip ospf <1-65535> neighbor detail all {json}",
4844 "OSPF information\n"
4847 "detail of all neighbors\n"
4848 "include down status neighbor\n"
4849 "JavaScript Object Notation\n")
4852 u_short instance
= 0;
4853 u_char uj
= use_json(argc
, argv
);
4855 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4856 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4859 return show_ip_ospf_neighbor_detail_all_common(vty
, ospf
, uj
);
4863 show_ip_ospf_neighbor_int_detail_common (struct vty
*vty
, struct ospf
*ospf
,
4864 int arg_base
, const char **argv
, u_char use_json
)
4866 struct ospf_interface
*oi
;
4867 struct interface
*ifp
;
4868 struct route_node
*rn
, *nrn
;
4869 struct ospf_neighbor
*nbr
;
4870 json_object
*json
= NULL
;
4873 json
= json_object_new_object();
4878 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4880 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4881 VTY_NEWLINE
, VTY_NEWLINE
);
4884 ifp
= if_lookup_by_name (argv
[arg_base
]);
4888 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
4892 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4894 if ((oi
= rn
->info
))
4896 for (nrn
= route_top (oi
->nbrs
); nrn
; nrn
= route_next (nrn
))
4898 if ((nbr
= nrn
->info
))
4900 if (nbr
!= oi
->nbr_self
)
4902 if (nbr
->state
!= NSM_Down
)
4903 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
, use_json
, json
);
4912 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4913 json_object_free(json
);
4916 vty_out (vty
, "%s", VTY_NEWLINE
);
4921 DEFUN (show_ip_ospf_neighbor_int_detail
,
4922 show_ip_ospf_neighbor_int_detail_cmd
,
4923 "show ip ospf neighbor IFNAME detail {json}",
4926 "OSPF information\n"
4929 "detail of all neighbors\n"
4930 "JavaScript Object Notation\n")
4933 u_char uj
= use_json(argc
, argv
);
4935 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4938 return show_ip_ospf_neighbor_int_detail_common(vty
, ospf
, 0, argv
, uj
);
4941 DEFUN (show_ip_ospf_instance_neighbor_int_detail
,
4942 show_ip_ospf_instance_neighbor_int_detail_cmd
,
4943 "show ip ospf <1-65535> neighbor IFNAME detail {json}",
4946 "OSPF information\n"
4950 "detail of all neighbors\n"
4951 "JavaScript Object Notation\n")
4954 u_short instance
= 0;
4955 u_char uj
= use_json(argc
, argv
);
4957 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
4958 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4961 return show_ip_ospf_neighbor_int_detail_common(vty
, ospf
, 1, argv
, uj
);
4964 /* Show functions */
4966 show_lsa_summary (struct vty
*vty
, struct ospf_lsa
*lsa
, int self
)
4968 struct router_lsa
*rl
;
4969 struct summary_lsa
*sl
;
4970 struct as_external_lsa
*asel
;
4971 struct prefix_ipv4 p
;
4974 /* If self option is set, check LSA self flag. */
4975 if (self
== 0 || IS_LSA_SELF (lsa
))
4977 /* LSA common part show. */
4978 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
4979 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
4980 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
4981 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
4982 /* LSA specific part show. */
4983 switch (lsa
->data
->type
)
4985 case OSPF_ROUTER_LSA
:
4986 rl
= (struct router_lsa
*) lsa
->data
;
4987 vty_out (vty
, " %-d", ntohs (rl
->links
));
4989 case OSPF_SUMMARY_LSA
:
4990 sl
= (struct summary_lsa
*) lsa
->data
;
4993 p
.prefix
= sl
->header
.id
;
4994 p
.prefixlen
= ip_masklen (sl
->mask
);
4995 apply_mask_ipv4 (&p
);
4997 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
4999 case OSPF_AS_EXTERNAL_LSA
:
5000 case OSPF_AS_NSSA_LSA
:
5001 asel
= (struct as_external_lsa
*) lsa
->data
;
5004 p
.prefix
= asel
->header
.id
;
5005 p
.prefixlen
= ip_masklen (asel
->mask
);
5006 apply_mask_ipv4 (&p
);
5008 vty_out (vty
, " %s %s/%d [0x%lx]",
5009 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
5010 inet_ntoa (p
.prefix
), p
.prefixlen
,
5011 (u_long
)ntohl (asel
->e
[0].route_tag
));
5013 case OSPF_NETWORK_LSA
:
5014 case OSPF_ASBR_SUMMARY_LSA
:
5015 #ifdef HAVE_OPAQUE_LSA
5016 case OSPF_OPAQUE_LINK_LSA
:
5017 case OSPF_OPAQUE_AREA_LSA
:
5018 case OSPF_OPAQUE_AS_LSA
:
5019 #endif /* HAVE_OPAQUE_LSA */
5023 vty_out (vty
, VTY_NEWLINE
);
5029 static const char *show_database_desc
[] =
5032 "Router Link States",
5034 "Summary Link States",
5035 "ASBR-Summary Link States",
5036 "AS External Link States",
5037 "Group Membership LSA",
5038 "NSSA-external Link States",
5039 #ifdef HAVE_OPAQUE_LSA
5041 "Link-Local Opaque-LSA",
5042 "Area-Local Opaque-LSA",
5043 "AS-external Opaque-LSA",
5044 #endif /* HAVE_OPAQUE_LSA */
5047 static const char *show_database_header
[] =
5050 "Link ID ADV Router Age Seq# CkSum Link count",
5051 "Link ID ADV Router Age Seq# CkSum",
5052 "Link ID ADV Router Age Seq# CkSum Route",
5053 "Link ID ADV Router Age Seq# CkSum",
5054 "Link ID ADV Router Age Seq# CkSum Route",
5055 " --- header for Group Member ----",
5056 "Link ID ADV Router Age Seq# CkSum Route",
5057 #ifdef HAVE_OPAQUE_LSA
5059 "Opaque-Type/Id ADV Router Age Seq# CkSum",
5060 "Opaque-Type/Id ADV Router Age Seq# CkSum",
5061 "Opaque-Type/Id ADV Router Age Seq# CkSum",
5062 #endif /* HAVE_OPAQUE_LSA */
5066 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
5068 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
5070 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
5071 vty_out (vty
, " Options: 0x%-2x : %s%s",
5073 ospf_options_dump(lsa
->data
->options
),
5075 vty_out (vty
, " LS Flags: 0x%-2x %s%s",
5077 ((lsa
->flags
& OSPF_LSA_LOCAL_XLT
) ? "(Translated from Type-7)" : ""),
5080 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
5082 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
5085 vty_out (vty
, " :%s%s%s%s",
5086 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
5087 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
5088 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
5089 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
5091 vty_out (vty
, "%s", VTY_NEWLINE
);
5093 vty_out (vty
, " LS Type: %s%s",
5094 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
5095 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
5096 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
5097 vty_out (vty
, " Advertising Router: %s%s",
5098 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
5099 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
5101 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
5103 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
5106 const char *link_type_desc
[] =
5109 "another Router (point-to-point)",
5110 "a Transit Network",
5115 const char *link_id_desc
[] =
5118 "Neighboring Router ID",
5119 "Designated Router address",
5121 "Neighboring Router ID",
5124 const char *link_data_desc
[] =
5127 "Router Interface address",
5128 "Router Interface address",
5130 "Router Interface address",
5133 /* Show router-LSA each Link information. */
5135 show_ip_ospf_database_router_links (struct vty
*vty
,
5136 struct router_lsa
*rl
)
5141 len
= ntohs (rl
->header
.length
) - 4;
5142 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
5144 type
= rl
->link
[i
].type
;
5146 vty_out (vty
, " Link connected to: %s%s",
5147 link_type_desc
[type
], VTY_NEWLINE
);
5148 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
5149 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
5150 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
5151 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
5152 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
5153 vty_out (vty
, " TOS 0 Metric: %d%s",
5154 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
5155 vty_out (vty
, "%s", VTY_NEWLINE
);
5159 /* Show router-LSA detail information. */
5161 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5165 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
5167 show_ip_ospf_database_header (vty
, lsa
);
5169 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
5170 VTY_NEWLINE
, VTY_NEWLINE
);
5172 show_ip_ospf_database_router_links (vty
, rl
);
5173 vty_out (vty
, "%s", VTY_NEWLINE
);
5179 /* Show network-LSA detail information. */
5181 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5187 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
5189 show_ip_ospf_database_header (vty
, lsa
);
5191 vty_out (vty
, " Network Mask: /%d%s",
5192 ip_masklen (nl
->mask
), VTY_NEWLINE
);
5194 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
5196 for (i
= 0; length
> 0; i
++, length
-= 4)
5197 vty_out (vty
, " Attached Router: %s%s",
5198 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
5200 vty_out (vty
, "%s", VTY_NEWLINE
);
5206 /* Show summary-LSA detail information. */
5208 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5212 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
5214 show_ip_ospf_database_header (vty
, lsa
);
5216 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
5218 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
5220 vty_out (vty
, "%s", VTY_NEWLINE
);
5226 /* Show summary-ASBR-LSA detail information. */
5228 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5232 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
5234 show_ip_ospf_database_header (vty
, lsa
);
5236 vty_out (vty
, " Network Mask: /%d%s",
5237 ip_masklen (sl
->mask
), VTY_NEWLINE
);
5238 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
5240 vty_out (vty
, "%s", VTY_NEWLINE
);
5246 /* Show AS-external-LSA detail information. */
5248 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5252 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
5254 show_ip_ospf_database_header (vty
, lsa
);
5256 vty_out (vty
, " Network Mask: /%d%s",
5257 ip_masklen (al
->mask
), VTY_NEWLINE
);
5258 vty_out (vty
, " Metric Type: %s%s",
5259 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
5260 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
5261 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
5262 vty_out (vty
, " Metric: %d%s",
5263 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
5264 vty_out (vty
, " Forward Address: %s%s",
5265 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
5267 vty_out (vty
, " External Route Tag: %lu%s%s",
5268 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
5276 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
5278 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
5280 /* show_ip_ospf_database_header (vty, lsa); */
5282 zlog_debug( " Network Mask: /%d%s",
5283 ip_masklen (al
->mask
), "\n");
5284 zlog_debug( " Metric Type: %s%s",
5285 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
5286 "2 (Larger than any link state path)" : "1", "\n");
5287 zlog_debug( " TOS: 0%s", "\n");
5288 zlog_debug( " Metric: %d%s",
5289 GET_METRIC (al
->e
[0].metric
), "\n");
5290 zlog_debug( " Forward Address: %s%s",
5291 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
5293 zlog_debug( " External Route Tag: %u%s%s",
5294 ntohl (al
->e
[0].route_tag
), "\n", "\n");
5300 /* Show AS-NSSA-LSA detail information. */
5302 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5306 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
5308 show_ip_ospf_database_header (vty
, lsa
);
5310 vty_out (vty
, " Network Mask: /%d%s",
5311 ip_masklen (al
->mask
), VTY_NEWLINE
);
5312 vty_out (vty
, " Metric Type: %s%s",
5313 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
5314 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
5315 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
5316 vty_out (vty
, " Metric: %d%s",
5317 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
5318 vty_out (vty
, " NSSA: Forward Address: %s%s",
5319 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
5321 vty_out (vty
, " External Route Tag: %u%s%s",
5322 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
5329 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
5334 #ifdef HAVE_OPAQUE_LSA
5336 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5340 show_ip_ospf_database_header (vty
, lsa
);
5341 show_opaque_info_detail (vty
, lsa
);
5343 vty_out (vty
, "%s", VTY_NEWLINE
);
5347 #endif /* HAVE_OPAQUE_LSA */
5349 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
5352 show_router_lsa_detail
,
5353 show_network_lsa_detail
,
5354 show_summary_lsa_detail
,
5355 show_summary_asbr_lsa_detail
,
5356 show_as_external_lsa_detail
,
5358 show_as_nssa_lsa_detail
, /* almost same as external */
5359 #ifdef HAVE_OPAQUE_LSA
5361 show_opaque_lsa_detail
,
5362 show_opaque_lsa_detail
,
5363 show_opaque_lsa_detail
,
5364 #endif /* HAVE_OPAQUE_LSA */
5368 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
5369 struct in_addr
*adv_router
)
5371 memset (lp
, 0, sizeof (struct prefix_ls
));
5375 else if (adv_router
== NULL
)
5384 lp
->adv_router
= *adv_router
;
5389 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
5390 struct in_addr
*id
, struct in_addr
*adv_router
)
5392 struct prefix_ls lp
;
5393 struct route_node
*rn
, *start
;
5394 struct ospf_lsa
*lsa
;
5396 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
5397 start
= route_node_get (rt
, (struct prefix
*) &lp
);
5400 route_lock_node (start
);
5401 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
5402 if ((lsa
= rn
->info
))
5404 if (show_function
[lsa
->data
->type
] != NULL
)
5405 show_function
[lsa
->data
->type
] (vty
, lsa
);
5407 route_unlock_node (start
);
5411 /* Show detail LSA information
5412 -- if id is NULL then show all LSAs. */
5414 show_lsa_detail (struct vty
*vty
, struct ospf
*ospf
, int type
,
5415 struct in_addr
*id
, struct in_addr
*adv_router
)
5417 struct listnode
*node
;
5418 struct ospf_area
*area
;
5422 case OSPF_AS_EXTERNAL_LSA
:
5423 #ifdef HAVE_OPAQUE_LSA
5424 case OSPF_OPAQUE_AS_LSA
:
5425 #endif /* HAVE_OPAQUE_LSA */
5426 vty_out (vty
, " %s %s%s",
5427 show_database_desc
[type
],
5428 VTY_NEWLINE
, VTY_NEWLINE
);
5429 show_lsa_detail_proc (vty
, AS_LSDB (ospf
, type
), id
, adv_router
);
5432 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
5434 vty_out (vty
, "%s %s (Area %s)%s%s",
5435 VTY_NEWLINE
, show_database_desc
[type
],
5436 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
5437 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
5444 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
5445 struct in_addr
*adv_router
)
5447 struct route_node
*rn
;
5448 struct ospf_lsa
*lsa
;
5450 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
5451 if ((lsa
= rn
->info
))
5452 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
5454 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
5456 if (show_function
[lsa
->data
->type
] != NULL
)
5457 show_function
[lsa
->data
->type
] (vty
, lsa
);
5461 /* Show detail LSA information. */
5463 show_lsa_detail_adv_router (struct vty
*vty
, struct ospf
*ospf
, int type
,
5464 struct in_addr
*adv_router
)
5466 struct listnode
*node
;
5467 struct ospf_area
*area
;
5471 case OSPF_AS_EXTERNAL_LSA
:
5472 #ifdef HAVE_OPAQUE_LSA
5473 case OSPF_OPAQUE_AS_LSA
:
5474 #endif /* HAVE_OPAQUE_LSA */
5475 vty_out (vty
, " %s %s%s",
5476 show_database_desc
[type
],
5477 VTY_NEWLINE
, VTY_NEWLINE
);
5478 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf
, type
),
5482 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
5484 vty_out (vty
, "%s %s (Area %s)%s%s",
5485 VTY_NEWLINE
, show_database_desc
[type
],
5486 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
5487 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
5495 show_ip_ospf_database_summary (struct vty
*vty
, struct ospf
*ospf
, int self
)
5497 struct ospf_lsa
*lsa
;
5498 struct route_node
*rn
;
5499 struct ospf_area
*area
;
5500 struct listnode
*node
;
5503 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
5505 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
5509 case OSPF_AS_EXTERNAL_LSA
:
5510 #ifdef HAVE_OPAQUE_LSA
5511 case OSPF_OPAQUE_AS_LSA
:
5512 #endif /* HAVE_OPAQUE_LSA */
5517 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
5518 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
5520 vty_out (vty
, " %s (Area %s)%s%s",
5521 show_database_desc
[type
],
5522 ospf_area_desc_string (area
),
5523 VTY_NEWLINE
, VTY_NEWLINE
);
5524 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
5526 LSDB_LOOP (AREA_LSDB (area
, type
), rn
, lsa
)
5527 show_lsa_summary (vty
, lsa
, self
);
5529 vty_out (vty
, "%s", VTY_NEWLINE
);
5534 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
5538 case OSPF_AS_EXTERNAL_LSA
:
5539 #ifdef HAVE_OPAQUE_LSA
5540 case OSPF_OPAQUE_AS_LSA
:
5541 #endif /* HAVE_OPAQUE_LSA */
5546 if (ospf_lsdb_count_self (ospf
->lsdb
, type
) ||
5547 (!self
&& ospf_lsdb_count (ospf
->lsdb
, type
)))
5549 vty_out (vty
, " %s%s%s",
5550 show_database_desc
[type
],
5551 VTY_NEWLINE
, VTY_NEWLINE
);
5552 vty_out (vty
, "%s%s", show_database_header
[type
],
5555 LSDB_LOOP (AS_LSDB (ospf
, type
), rn
, lsa
)
5556 show_lsa_summary (vty
, lsa
, self
);
5558 vty_out (vty
, "%s", VTY_NEWLINE
);
5562 vty_out (vty
, "%s", VTY_NEWLINE
);
5566 show_ip_ospf_database_maxage (struct vty
*vty
, struct ospf
*ospf
)
5568 struct route_node
*rn
;
5570 vty_out (vty
, "%s MaxAge Link States:%s%s",
5571 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
5573 for (rn
= route_top (ospf
->maxage_lsa
); rn
; rn
= route_next (rn
))
5575 struct ospf_lsa
*lsa
;
5577 if ((lsa
= rn
->info
) != NULL
)
5579 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
5580 vty_out (vty
, "Link State ID: %s%s",
5581 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
5582 vty_out (vty
, "Advertising Router: %s%s",
5583 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
5584 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
5585 vty_out (vty
, "%s", VTY_NEWLINE
);
5590 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
5591 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
5593 #ifdef HAVE_OPAQUE_LSA
5594 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
5595 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
5596 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
5597 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
5598 #else /* HAVE_OPAQUE_LSA */
5599 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
5600 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
5601 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
5602 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
5603 #endif /* HAVE_OPAQUE_LSA */
5605 #define OSPF_LSA_TYPES_CMD_STR \
5606 "asbr-summary|external|network|router|summary" \
5607 OSPF_LSA_TYPE_NSSA_CMD_STR \
5608 OSPF_LSA_TYPE_OPAQUE_CMD_STR
5610 #define OSPF_LSA_TYPES_DESC \
5611 "ASBR summary link states\n" \
5612 "External link states\n" \
5613 "Network link states\n" \
5614 "Router link states\n" \
5615 "Network summary link states\n" \
5616 OSPF_LSA_TYPE_NSSA_DESC \
5617 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
5618 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
5619 OSPF_LSA_TYPE_OPAQUE_AS_DESC
5622 show_ip_ospf_database_common (struct vty
*vty
, struct ospf
*ospf
,
5623 int arg_base
, int argc
, const char **argv
)
5626 struct in_addr id
, adv_router
;
5629 vty_out (vty
, "%sOSPF Instance: %d%s", VTY_NEWLINE
, ospf
->instance
,
5632 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
5633 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
5636 if (argc
== arg_base
+ 0)
5638 show_ip_ospf_database_summary (vty
, ospf
, 0);
5642 /* Set database type to show. */
5643 if (strncmp (argv
[arg_base
+ 0], "r", 1) == 0)
5644 type
= OSPF_ROUTER_LSA
;
5645 else if (strncmp (argv
[arg_base
+ 0], "ne", 2) == 0)
5646 type
= OSPF_NETWORK_LSA
;
5647 else if (strncmp (argv
[arg_base
+ 0], "ns", 2) == 0)
5648 type
= OSPF_AS_NSSA_LSA
;
5649 else if (strncmp (argv
[arg_base
+ 0], "su", 2) == 0)
5650 type
= OSPF_SUMMARY_LSA
;
5651 else if (strncmp (argv
[arg_base
+ 0], "a", 1) == 0)
5652 type
= OSPF_ASBR_SUMMARY_LSA
;
5653 else if (strncmp (argv
[arg_base
+ 0], "e", 1) == 0)
5654 type
= OSPF_AS_EXTERNAL_LSA
;
5655 else if (strncmp (argv
[arg_base
+ 0], "se", 2) == 0)
5657 show_ip_ospf_database_summary (vty
, ospf
, 1);
5660 else if (strncmp (argv
[arg_base
+ 0], "m", 1) == 0)
5662 show_ip_ospf_database_maxage (vty
, ospf
);
5665 #ifdef HAVE_OPAQUE_LSA
5666 else if (strncmp (argv
[arg_base
+ 0], "opaque-l", 8) == 0)
5667 type
= OSPF_OPAQUE_LINK_LSA
;
5668 else if (strncmp (argv
[arg_base
+ 0], "opaque-ar", 9) == 0)
5669 type
= OSPF_OPAQUE_AREA_LSA
;
5670 else if (strncmp (argv
[arg_base
+ 0], "opaque-as", 9) == 0)
5671 type
= OSPF_OPAQUE_AS_LSA
;
5672 #endif /* HAVE_OPAQUE_LSA */
5676 /* `show ip ospf database LSA'. */
5677 if (argc
== arg_base
+ 1)
5678 show_lsa_detail (vty
, ospf
, type
, NULL
, NULL
);
5679 else if (argc
>= arg_base
+ 2)
5681 ret
= inet_aton (argv
[arg_base
+ 1], &id
);
5685 /* `show ip ospf database LSA ID'. */
5686 if (argc
== arg_base
+ 2)
5687 show_lsa_detail (vty
, ospf
, type
, &id
, NULL
);
5688 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
5689 else if (argc
== arg_base
+ 3)
5691 if (strncmp (argv
[arg_base
+ 2], "s", 1) == 0)
5692 adv_router
= ospf
->router_id
;
5695 ret
= inet_aton (argv
[arg_base
+ 2], &adv_router
);
5699 show_lsa_detail (vty
, ospf
, type
, &id
, &adv_router
);
5706 DEFUN (show_ip_ospf_database
,
5707 show_ip_ospf_database_cmd
,
5708 "show ip ospf database",
5711 "OSPF information\n"
5712 "Database summary\n")
5716 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
5719 return (show_ip_ospf_database_common(vty
, ospf
, 0, argc
, argv
));
5722 ALIAS (show_ip_ospf_database
,
5723 show_ip_ospf_database_type_cmd
,
5724 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
5727 "OSPF information\n"
5728 "Database summary\n"
5730 "LSAs in MaxAge list\n"
5731 "Self-originated link states\n")
5733 ALIAS (show_ip_ospf_database
,
5734 show_ip_ospf_database_type_id_cmd
,
5735 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
5738 "OSPF information\n"
5739 "Database summary\n"
5741 "Link State ID (as an IP address)\n")
5743 ALIAS (show_ip_ospf_database
,
5744 show_ip_ospf_database_type_id_adv_router_cmd
,
5745 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
5748 "OSPF information\n"
5749 "Database summary\n"
5751 "Link State ID (as an IP address)\n"
5752 "Advertising Router link states\n"
5753 "Advertising Router (as an IP address)\n")
5755 ALIAS (show_ip_ospf_database
,
5756 show_ip_ospf_database_type_id_self_cmd
,
5757 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
5760 "OSPF information\n"
5761 "Database summary\n"
5763 "Link State ID (as an IP address)\n"
5764 "Self-originated link states\n"
5767 DEFUN (show_ip_ospf_instance_database
,
5768 show_ip_ospf_instance_database_cmd
,
5769 "show ip ospf <1-65535> database",
5772 "OSPF information\n"
5774 "Database summary\n")
5777 u_short instance
= 0;
5779 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
5781 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
5784 return (show_ip_ospf_database_common(vty
, ospf
, 1, argc
, argv
));
5787 ALIAS (show_ip_ospf_instance_database
,
5788 show_ip_ospf_instance_database_type_cmd
,
5789 "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
5792 "OSPF information\n"
5794 "Database summary\n"
5796 "LSAs in MaxAge list\n"
5797 "Self-originated link states\n")
5799 ALIAS (show_ip_ospf_instance_database
,
5800 show_ip_ospf_instance_database_type_id_cmd
,
5801 "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
5804 "OSPF information\n"
5806 "Database summary\n"
5808 "Link State ID (as an IP address)\n")
5810 ALIAS (show_ip_ospf_instance_database
,
5811 show_ip_ospf_instance_database_type_id_adv_router_cmd
,
5812 "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
5815 "OSPF information\n"
5817 "Database summary\n"
5819 "Link State ID (as an IP address)\n"
5820 "Advertising Router link states\n"
5821 "Advertising Router (as an IP address)\n")
5823 ALIAS (show_ip_ospf_instance_database
,
5824 show_ip_ospf_instance_database_type_id_self_cmd
,
5825 "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
5828 "OSPF information\n"
5830 "Database summary\n"
5832 "Link State ID (as an IP address)\n"
5833 "Self-originated link states\n"
5838 show_ip_ospf_database_type_adv_router_common (struct vty
*vty
, struct ospf
*ospf
,
5839 int arg_base
, int argc
, const char **argv
)
5842 struct in_addr adv_router
;
5845 vty_out (vty
, "%sOSPF Instance: %d%s", VTY_NEWLINE
, ospf
->instance
,
5848 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
5849 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
5851 if (argc
!= arg_base
+ 2)
5854 /* Set database type to show. */
5855 if (strncmp (argv
[arg_base
+ 0], "r", 1) == 0)
5856 type
= OSPF_ROUTER_LSA
;
5857 else if (strncmp (argv
[arg_base
+ 0], "ne", 2) == 0)
5858 type
= OSPF_NETWORK_LSA
;
5859 else if (strncmp (argv
[arg_base
+ 0], "ns", 2) == 0)
5860 type
= OSPF_AS_NSSA_LSA
;
5861 else if (strncmp (argv
[arg_base
+ 0], "s", 1) == 0)
5862 type
= OSPF_SUMMARY_LSA
;
5863 else if (strncmp (argv
[arg_base
+ 0], "a", 1) == 0)
5864 type
= OSPF_ASBR_SUMMARY_LSA
;
5865 else if (strncmp (argv
[arg_base
+ 0], "e", 1) == 0)
5866 type
= OSPF_AS_EXTERNAL_LSA
;
5867 #ifdef HAVE_OPAQUE_LSA
5868 else if (strncmp (argv
[arg_base
+ 0], "opaque-l", 8) == 0)
5869 type
= OSPF_OPAQUE_LINK_LSA
;
5870 else if (strncmp (argv
[arg_base
+ 0], "opaque-ar", 9) == 0)
5871 type
= OSPF_OPAQUE_AREA_LSA
;
5872 else if (strncmp (argv
[arg_base
+ 0], "opaque-as", 9) == 0)
5873 type
= OSPF_OPAQUE_AS_LSA
;
5874 #endif /* HAVE_OPAQUE_LSA */
5878 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
5879 if (strncmp (argv
[arg_base
+ 1], "s", 1) == 0)
5880 adv_router
= ospf
->router_id
;
5883 ret
= inet_aton (argv
[arg_base
+ 1], &adv_router
);
5888 show_lsa_detail_adv_router (vty
, ospf
, type
, &adv_router
);
5893 DEFUN (show_ip_ospf_database_type_adv_router
,
5894 show_ip_ospf_database_type_adv_router_cmd
,
5895 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
5898 "OSPF information\n"
5899 "Database summary\n"
5901 "Advertising Router link states\n"
5902 "Advertising Router (as an IP address)\n")
5906 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
5909 return (show_ip_ospf_database_type_adv_router_common(vty
, ospf
, 0, argc
, argv
));
5912 ALIAS (show_ip_ospf_database_type_adv_router
,
5913 show_ip_ospf_database_type_self_cmd
,
5914 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
5917 "OSPF information\n"
5918 "Database summary\n"
5920 "Self-originated link states\n")
5922 DEFUN (show_ip_ospf_instance_database_type_adv_router
,
5923 show_ip_ospf_instance_database_type_adv_router_cmd
,
5924 "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
5927 "OSPF information\n"
5929 "Database summary\n"
5931 "Advertising Router link states\n"
5932 "Advertising Router (as an IP address)\n")
5935 u_short instance
= 0;
5937 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
5939 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
5942 return (show_ip_ospf_database_type_adv_router_common(vty
, ospf
, 1, argc
, argv
));
5945 ALIAS (show_ip_ospf_instance_database_type_adv_router
,
5946 show_ip_ospf_instance_database_type_self_cmd
,
5947 "show ip ospf <1-65535> database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
5950 "OSPF information\n"
5952 "Database summary\n"
5954 "Self-originated link states\n")
5956 DEFUN (ip_ospf_authentication_args
,
5957 ip_ospf_authentication_args_addr_cmd
,
5958 "ip ospf authentication (null|message-digest) A.B.C.D",
5960 "OSPF interface commands\n"
5961 "Enable authentication on this interface\n"
5962 "Use null authentication\n"
5963 "Use message-digest authentication\n"
5964 "Address of interface")
5966 struct interface
*ifp
;
5967 struct in_addr addr
;
5969 struct ospf_if_params
*params
;
5972 params
= IF_DEF_PARAMS (ifp
);
5976 ret
= inet_aton(argv
[1], &addr
);
5979 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5984 params
= ospf_get_if_params (ifp
, addr
);
5985 ospf_if_update_params (ifp
, addr
);
5988 /* Handle null authentication */
5989 if ( argv
[0][0] == 'n' )
5991 SET_IF_PARAM (params
, auth_type
);
5992 params
->auth_type
= OSPF_AUTH_NULL
;
5996 /* Handle message-digest authentication */
5997 if ( argv
[0][0] == 'm' )
5999 SET_IF_PARAM (params
, auth_type
);
6000 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
6004 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
6008 ALIAS (ip_ospf_authentication_args
,
6009 ip_ospf_authentication_args_cmd
,
6010 "ip ospf authentication (null|message-digest)",
6012 "OSPF interface commands\n"
6013 "Enable authentication on this interface\n"
6014 "Use null authentication\n"
6015 "Use message-digest authentication\n")
6017 DEFUN (ip_ospf_authentication
,
6018 ip_ospf_authentication_addr_cmd
,
6019 "ip ospf authentication A.B.C.D",
6021 "OSPF interface commands\n"
6022 "Enable authentication on this interface\n"
6023 "Address of interface")
6025 struct interface
*ifp
;
6026 struct in_addr addr
;
6028 struct ospf_if_params
*params
;
6031 params
= IF_DEF_PARAMS (ifp
);
6035 ret
= inet_aton(argv
[0], &addr
);
6038 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6043 params
= ospf_get_if_params (ifp
, addr
);
6044 ospf_if_update_params (ifp
, addr
);
6047 SET_IF_PARAM (params
, auth_type
);
6048 params
->auth_type
= OSPF_AUTH_SIMPLE
;
6053 ALIAS (ip_ospf_authentication
,
6054 ip_ospf_authentication_cmd
,
6055 "ip ospf authentication",
6057 "OSPF interface commands\n"
6058 "Enable authentication on this interface\n")
6060 DEFUN (no_ip_ospf_authentication_args
,
6061 no_ip_ospf_authentication_args_addr_cmd
,
6062 "no ip ospf authentication (null|message-digest) A.B.C.D",
6065 "OSPF interface commands\n"
6066 "Enable authentication on this interface\n"
6067 "Use null authentication\n"
6068 "Use message-digest authentication\n"
6069 "Address of interface")
6071 struct interface
*ifp
;
6072 struct in_addr addr
;
6074 struct ospf_if_params
*params
;
6075 struct route_node
*rn
;
6079 params
= IF_DEF_PARAMS (ifp
);
6083 ret
= inet_aton(argv
[1], &addr
);
6086 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6091 params
= ospf_lookup_if_params (ifp
, addr
);
6094 vty_out (vty
, "Ip Address specified is unknown%s", VTY_NEWLINE
);
6097 params
->auth_type
= OSPF_AUTH_NOTSET
;
6098 UNSET_IF_PARAM (params
, auth_type
);
6099 if (params
!= IF_DEF_PARAMS (ifp
))
6101 ospf_free_if_params (ifp
, addr
);
6102 ospf_if_update_params (ifp
, addr
);
6107 if ( argv
[0][0] == 'n' )
6109 auth_type
= OSPF_AUTH_NULL
;
6111 else if ( argv
[0][0] == 'm' )
6113 auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
6117 vty_out (vty
, "Unexpected input encountered%s", VTY_NEWLINE
);
6121 * Here we have a case where the user has entered
6122 * 'no ip ospf authentication (null | message_digest )'
6123 * we need to find if we have any ip addresses underneath it that
6124 * correspond to the associated type.
6126 for (rn
= route_top (IF_OIFS_PARAMS (ifp
)); rn
; rn
= route_next (rn
))
6128 if ((params
= rn
->info
))
6130 if (params
->auth_type
== auth_type
)
6132 params
->auth_type
= OSPF_AUTH_NOTSET
;
6133 UNSET_IF_PARAM (params
, auth_type
);
6134 if (params
!= IF_DEF_PARAMS (ifp
))
6136 ospf_free_if_params (ifp
, rn
->p
.u
.prefix4
);
6137 ospf_if_update_params(ifp
, rn
->p
.u
.prefix4
);
6147 ALIAS (no_ip_ospf_authentication_args
,
6148 no_ip_ospf_authentication_args_cmd
,
6149 "no ip ospf authentication (null|message-digest)",
6152 "OSPF interface commands\n"
6153 "Enable authentication on this interface\n"
6154 "Use null authentication\n"
6155 "Use message-digest authentication\n")
6157 DEFUN (no_ip_ospf_authentication
,
6158 no_ip_ospf_authentication_addr_cmd
,
6159 "no ip ospf authentication A.B.C.D",
6162 "OSPF interface commands\n"
6163 "Enable authentication on this interface\n"
6164 "Address of interface")
6166 struct interface
*ifp
;
6167 struct in_addr addr
;
6169 struct ospf_if_params
*params
;
6170 struct route_node
*rn
;
6173 params
= IF_DEF_PARAMS (ifp
);
6177 ret
= inet_aton(argv
[0], &addr
);
6180 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6185 params
= ospf_lookup_if_params (ifp
, addr
);
6188 vty_out (vty
, "Ip Address specified is unknown%s", VTY_NEWLINE
);
6192 params
->auth_type
= OSPF_AUTH_NOTSET
;
6193 UNSET_IF_PARAM (params
, auth_type
);
6194 if (params
!= IF_DEF_PARAMS (ifp
))
6196 ospf_free_if_params (ifp
, addr
);
6197 ospf_if_update_params (ifp
, addr
);
6203 * When a user enters 'no ip ospf authentication'
6204 * We should remove all authentication types from
6207 for (rn
= route_top (IF_OIFS_PARAMS (ifp
)); rn
; rn
= route_next (rn
))
6209 if ((params
= rn
->info
))
6211 if ((params
->auth_type
== OSPF_AUTH_NULL
) ||
6212 (params
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
) ||
6213 (params
->auth_type
== OSPF_AUTH_SIMPLE
))
6215 params
->auth_type
= OSPF_AUTH_NOTSET
;
6216 UNSET_IF_PARAM (params
, auth_type
);
6217 if (params
!= IF_DEF_PARAMS (ifp
))
6219 ospf_free_if_params (ifp
, rn
->p
.u
.prefix4
);
6220 ospf_if_update_params(ifp
, rn
->p
.u
.prefix4
);
6230 ALIAS (no_ip_ospf_authentication
,
6231 no_ip_ospf_authentication_cmd
,
6232 "no ip ospf authentication",
6235 "OSPF interface commands\n"
6236 "Enable authentication on this interface\n")
6238 DEFUN (ip_ospf_authentication_key
,
6239 ip_ospf_authentication_key_addr_cmd
,
6240 "ip ospf authentication-key AUTH_KEY A.B.C.D",
6242 "OSPF interface commands\n"
6243 "Authentication password (key)\n"
6244 "The OSPF password (key)\n"
6245 "Address of interface")
6247 struct interface
*ifp
;
6248 struct in_addr addr
;
6250 struct ospf_if_params
*params
;
6253 params
= IF_DEF_PARAMS (ifp
);
6257 ret
= inet_aton(argv
[1], &addr
);
6260 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6265 params
= ospf_get_if_params (ifp
, addr
);
6266 ospf_if_update_params (ifp
, addr
);
6270 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
6271 strncpy ((char *) params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
6272 SET_IF_PARAM (params
, auth_simple
);
6277 ALIAS (ip_ospf_authentication_key
,
6278 ip_ospf_authentication_key_cmd
,
6279 "ip ospf authentication-key AUTH_KEY",
6281 "OSPF interface commands\n"
6282 "Authentication password (key)\n"
6283 "The OSPF password (key)")
6285 ALIAS (ip_ospf_authentication_key
,
6286 ospf_authentication_key_cmd
,
6287 "ospf authentication-key AUTH_KEY",
6288 "OSPF interface commands\n"
6289 "Authentication password (key)\n"
6290 "The OSPF password (key)")
6292 DEFUN (no_ip_ospf_authentication_key
,
6293 no_ip_ospf_authentication_key_addr_cmd
,
6294 "no ip ospf authentication-key A.B.C.D",
6297 "OSPF interface commands\n"
6298 "Authentication password (key)\n"
6299 "Address of interface")
6301 struct interface
*ifp
;
6302 struct in_addr addr
;
6304 struct ospf_if_params
*params
;
6307 params
= IF_DEF_PARAMS (ifp
);
6311 ret
= inet_aton(argv
[0], &addr
);
6314 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6319 params
= ospf_lookup_if_params (ifp
, addr
);
6324 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
6325 UNSET_IF_PARAM (params
, auth_simple
);
6327 if (params
!= IF_DEF_PARAMS (ifp
))
6329 ospf_free_if_params (ifp
, addr
);
6330 ospf_if_update_params (ifp
, addr
);
6336 ALIAS (no_ip_ospf_authentication_key
,
6337 no_ip_ospf_authentication_key_cmd
,
6338 "no ip ospf authentication-key",
6341 "OSPF interface commands\n"
6342 "Authentication password (key)\n")
6344 ALIAS (no_ip_ospf_authentication_key
,
6345 no_ospf_authentication_key_cmd
,
6346 "no ospf authentication-key",
6348 "OSPF interface commands\n"
6349 "Authentication password (key)\n")
6351 DEFUN (ip_ospf_message_digest_key
,
6352 ip_ospf_message_digest_key_addr_cmd
,
6353 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
6355 "OSPF interface commands\n"
6356 "Message digest authentication password (key)\n"
6358 "Use MD5 algorithm\n"
6359 "The OSPF password (key)"
6360 "Address of interface")
6362 struct interface
*ifp
;
6363 struct crypt_key
*ck
;
6365 struct in_addr addr
;
6367 struct ospf_if_params
*params
;
6370 params
= IF_DEF_PARAMS (ifp
);
6374 ret
= inet_aton(argv
[2], &addr
);
6377 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6382 params
= ospf_get_if_params (ifp
, addr
);
6383 ospf_if_update_params (ifp
, addr
);
6386 key_id
= strtol (argv
[0], NULL
, 10);
6387 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
6389 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
6393 ck
= ospf_crypt_key_new ();
6394 ck
->key_id
= (u_char
) key_id
;
6395 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
6396 strncpy ((char *) ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
6398 ospf_crypt_key_add (params
->auth_crypt
, ck
);
6399 SET_IF_PARAM (params
, auth_crypt
);
6404 ALIAS (ip_ospf_message_digest_key
,
6405 ip_ospf_message_digest_key_cmd
,
6406 "ip ospf message-digest-key <1-255> md5 KEY",
6408 "OSPF interface commands\n"
6409 "Message digest authentication password (key)\n"
6411 "Use MD5 algorithm\n"
6412 "The OSPF password (key)")
6414 ALIAS (ip_ospf_message_digest_key
,
6415 ospf_message_digest_key_cmd
,
6416 "ospf message-digest-key <1-255> md5 KEY",
6417 "OSPF interface commands\n"
6418 "Message digest authentication password (key)\n"
6420 "Use MD5 algorithm\n"
6421 "The OSPF password (key)")
6423 DEFUN (no_ip_ospf_message_digest_key
,
6424 no_ip_ospf_message_digest_key_addr_cmd
,
6425 "no ip ospf message-digest-key <1-255> A.B.C.D",
6428 "OSPF interface commands\n"
6429 "Message digest authentication password (key)\n"
6431 "Address of interface")
6433 struct interface
*ifp
;
6434 struct crypt_key
*ck
;
6436 struct in_addr addr
;
6438 struct ospf_if_params
*params
;
6441 params
= IF_DEF_PARAMS (ifp
);
6445 ret
= inet_aton(argv
[1], &addr
);
6448 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6453 params
= ospf_lookup_if_params (ifp
, addr
);
6458 key_id
= strtol (argv
[0], NULL
, 10);
6459 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
6462 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
6466 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
6468 if (params
!= IF_DEF_PARAMS (ifp
))
6470 ospf_free_if_params (ifp
, addr
);
6471 ospf_if_update_params (ifp
, addr
);
6477 ALIAS (no_ip_ospf_message_digest_key
,
6478 no_ip_ospf_message_digest_key_cmd
,
6479 "no ip ospf message-digest-key <1-255>",
6482 "OSPF interface commands\n"
6483 "Message digest authentication password (key)\n"
6486 ALIAS (no_ip_ospf_message_digest_key
,
6487 no_ospf_message_digest_key_cmd
,
6488 "no ospf message-digest-key <1-255>",
6490 "OSPF interface commands\n"
6491 "Message digest authentication password (key)\n"
6494 DEFUN (ip_ospf_cost
,
6495 ip_ospf_cost_u32_inet4_cmd
,
6496 "ip ospf cost <1-65535> A.B.C.D",
6498 "OSPF interface commands\n"
6501 "Address of interface")
6503 struct interface
*ifp
= vty
->index
;
6505 struct in_addr addr
;
6507 struct ospf_if_params
*params
;
6509 params
= IF_DEF_PARAMS (ifp
);
6511 cost
= strtol (argv
[0], NULL
, 10);
6513 /* cost range is <1-65535>. */
6514 if (cost
< 1 || cost
> 65535)
6516 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
6522 ret
= inet_aton(argv
[1], &addr
);
6525 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6530 params
= ospf_get_if_params (ifp
, addr
);
6531 ospf_if_update_params (ifp
, addr
);
6534 SET_IF_PARAM (params
, output_cost_cmd
);
6535 params
->output_cost_cmd
= cost
;
6537 ospf_if_recalculate_output_cost (ifp
);
6542 ALIAS (ip_ospf_cost
,
6543 ip_ospf_cost_u32_cmd
,
6544 "ip ospf cost <1-65535>",
6546 "OSPF interface commands\n"
6550 ALIAS (ip_ospf_cost
,
6552 "ospf cost <1-65535>",
6553 "OSPF interface commands\n"
6557 ALIAS (ip_ospf_cost
,
6558 ospf_cost_u32_inet4_cmd
,
6559 "ospf cost <1-65535> A.B.C.D",
6560 "OSPF interface commands\n"
6563 "Address of interface")
6565 DEFUN (no_ip_ospf_cost
,
6566 no_ip_ospf_cost_inet4_cmd
,
6567 "no ip ospf cost A.B.C.D",
6570 "OSPF interface commands\n"
6572 "Address of interface")
6574 struct interface
*ifp
= vty
->index
;
6575 struct in_addr addr
;
6577 struct ospf_if_params
*params
;
6580 params
= IF_DEF_PARAMS (ifp
);
6584 ret
= inet_aton(argv
[0], &addr
);
6587 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6592 params
= ospf_lookup_if_params (ifp
, addr
);
6597 UNSET_IF_PARAM (params
, output_cost_cmd
);
6599 if (params
!= IF_DEF_PARAMS (ifp
))
6601 ospf_free_if_params (ifp
, addr
);
6602 ospf_if_update_params (ifp
, addr
);
6605 ospf_if_recalculate_output_cost (ifp
);
6610 ALIAS (no_ip_ospf_cost
,
6611 no_ip_ospf_cost_cmd
,
6615 "OSPF interface commands\n"
6618 ALIAS (no_ip_ospf_cost
,
6622 "OSPF interface commands\n"
6625 ALIAS (no_ip_ospf_cost
,
6626 no_ospf_cost_inet4_cmd
,
6627 "no ospf cost A.B.C.D",
6629 "OSPF interface commands\n"
6631 "Address of interface")
6633 DEFUN (no_ip_ospf_cost2
,
6634 no_ip_ospf_cost_u32_cmd
,
6635 "no ip ospf cost <1-65535>",
6638 "OSPF interface commands\n"
6642 struct interface
*ifp
= vty
->index
;
6643 struct in_addr addr
;
6646 struct ospf_if_params
*params
;
6649 params
= IF_DEF_PARAMS (ifp
);
6651 /* According to the semantics we are mimicking "no ip ospf cost N" is
6652 * always treated as "no ip ospf cost" regardless of the actual value
6653 * of N already configured for the interface. Thus the first argument
6654 * is always checked to be a number, but is ignored after that.
6656 cost
= strtol (argv
[0], NULL
, 10);
6657 if (cost
< 1 || cost
> 65535)
6659 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
6665 ret
= inet_aton(argv
[1], &addr
);
6668 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6673 params
= ospf_lookup_if_params (ifp
, addr
);
6678 UNSET_IF_PARAM (params
, output_cost_cmd
);
6680 if (params
!= IF_DEF_PARAMS (ifp
))
6682 ospf_free_if_params (ifp
, addr
);
6683 ospf_if_update_params (ifp
, addr
);
6686 ospf_if_recalculate_output_cost (ifp
);
6691 ALIAS (no_ip_ospf_cost2
,
6692 no_ospf_cost_u32_cmd
,
6693 "no ospf cost <1-65535>",
6695 "OSPF interface commands\n"
6699 ALIAS (no_ip_ospf_cost2
,
6700 no_ip_ospf_cost_u32_inet4_cmd
,
6701 "no ip ospf cost <1-65535> A.B.C.D",
6704 "OSPF interface commands\n"
6707 "Address of interface")
6709 ALIAS (no_ip_ospf_cost2
,
6710 no_ospf_cost_u32_inet4_cmd
,
6711 "no ospf cost <1-65535> A.B.C.D",
6713 "OSPF interface commands\n"
6716 "Address of interface")
6719 ospf_nbr_timer_update (struct ospf_interface
*oi
)
6721 struct route_node
*rn
;
6722 struct ospf_neighbor
*nbr
;
6724 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
6725 if ((nbr
= rn
->info
))
6727 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
6728 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
6729 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
6730 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
6735 ospf_vty_dead_interval_set (struct vty
*vty
, const char *interval_str
,
6736 const char *nbr_str
,
6737 const char *fast_hello_str
)
6739 struct interface
*ifp
= vty
->index
;
6742 struct in_addr addr
;
6744 struct ospf_if_params
*params
;
6745 struct ospf_interface
*oi
;
6746 struct route_node
*rn
;
6748 params
= IF_DEF_PARAMS (ifp
);
6752 ret
= inet_aton(nbr_str
, &addr
);
6755 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6760 params
= ospf_get_if_params (ifp
, addr
);
6761 ospf_if_update_params (ifp
, addr
);
6766 VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds
, interval_str
,
6769 /* reset fast_hello too, just to be sure */
6770 UNSET_IF_PARAM (params
, fast_hello
);
6771 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
6773 else if (fast_hello_str
)
6775 VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult
, fast_hello_str
,
6777 /* 1s dead-interval with sub-second hellos desired */
6778 seconds
= OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
;
6779 SET_IF_PARAM (params
, fast_hello
);
6780 params
->fast_hello
= hellomult
;
6784 vty_out (vty
, "Please specify dead-interval or hello-multiplier%s",
6789 SET_IF_PARAM (params
, v_wait
);
6790 params
->v_wait
= seconds
;
6792 /* Update timer values in neighbor structure. */
6796 if ((ospf
= ospf_lookup()))
6798 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
6800 ospf_nbr_timer_update (oi
);
6805 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
6806 if ((oi
= rn
->info
))
6807 ospf_nbr_timer_update (oi
);
6814 DEFUN (ip_ospf_dead_interval
,
6815 ip_ospf_dead_interval_addr_cmd
,
6816 "ip ospf dead-interval <1-65535> A.B.C.D",
6818 "OSPF interface commands\n"
6819 "Interval after which a neighbor is declared dead\n"
6821 "Address of interface\n")
6824 return ospf_vty_dead_interval_set (vty
, argv
[0], argv
[1], NULL
);
6826 return ospf_vty_dead_interval_set (vty
, argv
[0], NULL
, NULL
);
6829 ALIAS (ip_ospf_dead_interval
,
6830 ip_ospf_dead_interval_cmd
,
6831 "ip ospf dead-interval <1-65535>",
6833 "OSPF interface commands\n"
6834 "Interval after which a neighbor is declared dead\n"
6837 ALIAS (ip_ospf_dead_interval
,
6838 ospf_dead_interval_cmd
,
6839 "ospf dead-interval <1-65535>",
6840 "OSPF interface commands\n"
6841 "Interval after which a neighbor is declared dead\n"
6844 DEFUN (ip_ospf_dead_interval_minimal
,
6845 ip_ospf_dead_interval_minimal_addr_cmd
,
6846 "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
6848 "OSPF interface commands\n"
6849 "Interval after which a neighbor is declared dead\n"
6850 "Minimal 1s dead-interval with fast sub-second hellos\n"
6851 "Hello multiplier factor\n"
6852 "Number of Hellos to send each second\n"
6853 "Address of interface\n")
6856 return ospf_vty_dead_interval_set (vty
, NULL
, argv
[1], argv
[0]);
6858 return ospf_vty_dead_interval_set (vty
, NULL
, NULL
, argv
[0]);
6861 ALIAS (ip_ospf_dead_interval_minimal
,
6862 ip_ospf_dead_interval_minimal_cmd
,
6863 "ip ospf dead-interval minimal hello-multiplier <1-10>",
6865 "OSPF interface commands\n"
6866 "Interval after which a neighbor is declared dead\n"
6867 "Minimal 1s dead-interval with fast sub-second hellos\n"
6868 "Hello multiplier factor\n"
6869 "Number of Hellos to send each second\n")
6871 DEFUN (no_ip_ospf_dead_interval
,
6872 no_ip_ospf_dead_interval_addr_cmd
,
6873 "no ip ospf dead-interval <1-65535> A.B.C.D",
6876 "OSPF interface commands\n"
6877 "Interval after which a neighbor is declared dead\n"
6879 "Address of interface")
6881 struct interface
*ifp
= vty
->index
;
6882 struct in_addr addr
;
6884 struct ospf_if_params
*params
;
6885 struct ospf_interface
*oi
;
6886 struct route_node
*rn
;
6889 params
= IF_DEF_PARAMS (ifp
);
6893 ret
= inet_aton(argv
[1], &addr
);
6896 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6901 params
= ospf_lookup_if_params (ifp
, addr
);
6906 UNSET_IF_PARAM (params
, v_wait
);
6907 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
6909 UNSET_IF_PARAM (params
, fast_hello
);
6910 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
6912 if (params
!= IF_DEF_PARAMS (ifp
))
6914 ospf_free_if_params (ifp
, addr
);
6915 ospf_if_update_params (ifp
, addr
);
6918 /* Update timer values in neighbor structure. */
6923 if ((ospf
= ospf_lookup()))
6925 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
6927 ospf_nbr_timer_update (oi
);
6932 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
6933 if ((oi
= rn
->info
))
6934 ospf_nbr_timer_update (oi
);
6940 ALIAS (no_ip_ospf_dead_interval
,
6941 no_ip_ospf_dead_interval_seconds_cmd
,
6942 "no ip ospf dead-interval <1-65535>",
6945 "OSPF interface commands\n"
6946 "Interval after which a neighbor is declared dead\n"
6949 ALIAS (no_ip_ospf_dead_interval
,
6950 no_ip_ospf_dead_interval_cmd
,
6951 "no ip ospf dead-interval",
6954 "OSPF interface commands\n"
6955 "Interval after which a neighbor is declared dead\n")
6957 ALIAS (no_ip_ospf_dead_interval
,
6958 no_ospf_dead_interval_cmd
,
6959 "no ospf dead-interval",
6961 "OSPF interface commands\n"
6962 "Interval after which a neighbor is declared dead\n")
6964 DEFUN (ip_ospf_hello_interval
,
6965 ip_ospf_hello_interval_addr_cmd
,
6966 "ip ospf hello-interval <1-65535> A.B.C.D",
6968 "OSPF interface commands\n"
6969 "Time between HELLO packets\n"
6971 "Address of interface")
6973 struct interface
*ifp
= vty
->index
;
6975 struct in_addr addr
;
6977 struct ospf_if_params
*params
;
6979 params
= IF_DEF_PARAMS (ifp
);
6981 seconds
= strtol (argv
[0], NULL
, 10);
6983 /* HelloInterval range is <1-65535>. */
6984 if (seconds
< 1 || seconds
> 65535)
6986 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
6992 ret
= inet_aton(argv
[1], &addr
);
6995 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7000 params
= ospf_get_if_params (ifp
, addr
);
7001 ospf_if_update_params (ifp
, addr
);
7004 SET_IF_PARAM (params
, v_hello
);
7005 params
->v_hello
= seconds
;
7010 ALIAS (ip_ospf_hello_interval
,
7011 ip_ospf_hello_interval_cmd
,
7012 "ip ospf hello-interval <1-65535>",
7014 "OSPF interface commands\n"
7015 "Time between HELLO packets\n"
7018 ALIAS (ip_ospf_hello_interval
,
7019 ospf_hello_interval_cmd
,
7020 "ospf hello-interval <1-65535>",
7021 "OSPF interface commands\n"
7022 "Time between HELLO packets\n"
7025 DEFUN (no_ip_ospf_hello_interval
,
7026 no_ip_ospf_hello_interval_addr_cmd
,
7027 "no ip ospf hello-interval <1-65535> A.B.C.D",
7030 "OSPF interface commands\n"
7031 "Time between HELLO packets\n"
7033 "Address of interface")
7035 struct interface
*ifp
= vty
->index
;
7036 struct in_addr addr
;
7038 struct ospf_if_params
*params
;
7041 params
= IF_DEF_PARAMS (ifp
);
7045 ret
= inet_aton(argv
[1], &addr
);
7048 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7053 params
= ospf_lookup_if_params (ifp
, addr
);
7058 UNSET_IF_PARAM (params
, v_hello
);
7059 params
->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
7061 if (params
!= IF_DEF_PARAMS (ifp
))
7063 ospf_free_if_params (ifp
, addr
);
7064 ospf_if_update_params (ifp
, addr
);
7070 ALIAS (no_ip_ospf_hello_interval
,
7071 no_ip_ospf_hello_interval_seconds_cmd
,
7072 "no ip ospf hello-interval <1-65535>",
7075 "OSPF interface commands\n"
7076 "Time between HELLO packets\n"
7079 ALIAS (no_ip_ospf_hello_interval
,
7080 no_ip_ospf_hello_interval_cmd
,
7081 "no ip ospf hello-interval",
7084 "OSPF interface commands\n"
7085 "Time between HELLO packets\n")
7087 ALIAS (no_ip_ospf_hello_interval
,
7088 no_ospf_hello_interval_cmd
,
7089 "no ospf hello-interval",
7091 "OSPF interface commands\n"
7092 "Time between HELLO packets\n")
7094 DEFUN (ip_ospf_network
,
7095 ip_ospf_network_cmd
,
7096 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
7098 "OSPF interface commands\n"
7100 "Specify OSPF broadcast multi-access network\n"
7101 "Specify OSPF NBMA network\n"
7102 "Specify OSPF point-to-multipoint network\n"
7103 "Specify OSPF point-to-point network\n")
7105 struct interface
*ifp
= vty
->index
;
7106 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
7107 struct route_node
*rn
;
7109 if (old_type
== OSPF_IFTYPE_LOOPBACK
)
7111 vty_out (vty
, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE
);
7115 if (strncmp (argv
[0], "b", 1) == 0)
7116 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
7117 else if (strncmp (argv
[0], "n", 1) == 0)
7118 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
7119 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
7120 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
7121 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
7122 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
7124 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
7127 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
7129 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7131 struct ospf_interface
*oi
= rn
->info
;
7136 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
7138 if (oi
->state
> ISM_Down
)
7140 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
7141 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
7148 ALIAS (ip_ospf_network
,
7150 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
7151 "OSPF interface commands\n"
7153 "Specify OSPF broadcast multi-access network\n"
7154 "Specify OSPF NBMA network\n"
7155 "Specify OSPF point-to-multipoint network\n"
7156 "Specify OSPF point-to-point network\n")
7158 DEFUN (no_ip_ospf_network
,
7159 no_ip_ospf_network_cmd
,
7160 "no ip ospf network",
7163 "OSPF interface commands\n"
7166 struct interface
*ifp
= vty
->index
;
7167 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
7168 struct route_node
*rn
;
7170 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
7172 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
7175 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7177 struct ospf_interface
*oi
= rn
->info
;
7182 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
7184 if (oi
->state
> ISM_Down
)
7186 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
7187 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
7194 ALIAS (no_ip_ospf_network
,
7195 no_ospf_network_cmd
,
7198 "OSPF interface commands\n"
7201 DEFUN (ip_ospf_priority
,
7202 ip_ospf_priority_addr_cmd
,
7203 "ip ospf priority <0-255> A.B.C.D",
7205 "OSPF interface commands\n"
7208 "Address of interface")
7210 struct interface
*ifp
= vty
->index
;
7212 struct route_node
*rn
;
7213 struct in_addr addr
;
7215 struct ospf_if_params
*params
;
7217 params
= IF_DEF_PARAMS (ifp
);
7219 priority
= strtol (argv
[0], NULL
, 10);
7221 /* Router Priority range is <0-255>. */
7222 if (priority
< 0 || priority
> 255)
7224 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
7230 ret
= inet_aton(argv
[1], &addr
);
7233 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7238 params
= ospf_get_if_params (ifp
, addr
);
7239 ospf_if_update_params (ifp
, addr
);
7242 SET_IF_PARAM (params
, priority
);
7243 params
->priority
= priority
;
7245 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7247 struct ospf_interface
*oi
= rn
->info
;
7253 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
7255 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
7256 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
7263 ALIAS (ip_ospf_priority
,
7264 ip_ospf_priority_cmd
,
7265 "ip ospf priority <0-255>",
7267 "OSPF interface commands\n"
7271 ALIAS (ip_ospf_priority
,
7273 "ospf priority <0-255>",
7274 "OSPF interface commands\n"
7278 DEFUN (no_ip_ospf_priority
,
7279 no_ip_ospf_priority_addr_cmd
,
7280 "no ip ospf priority A.B.C.D",
7283 "OSPF interface commands\n"
7285 "Address of interface")
7287 struct interface
*ifp
= vty
->index
;
7288 struct route_node
*rn
;
7289 struct in_addr addr
;
7291 struct ospf_if_params
*params
;
7294 params
= IF_DEF_PARAMS (ifp
);
7298 ret
= inet_aton(argv
[0], &addr
);
7301 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7306 params
= ospf_lookup_if_params (ifp
, addr
);
7311 UNSET_IF_PARAM (params
, priority
);
7312 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
7314 if (params
!= IF_DEF_PARAMS (ifp
))
7316 ospf_free_if_params (ifp
, addr
);
7317 ospf_if_update_params (ifp
, addr
);
7320 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7322 struct ospf_interface
*oi
= rn
->info
;
7328 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
7330 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
7331 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
7338 ALIAS (no_ip_ospf_priority
,
7339 no_ip_ospf_priority_cmd
,
7340 "no ip ospf priority",
7343 "OSPF interface commands\n"
7344 "Router priority\n")
7346 ALIAS (no_ip_ospf_priority
,
7347 no_ospf_priority_cmd
,
7350 "OSPF interface commands\n"
7351 "Router priority\n")
7354 DEFUN (ip_ospf_retransmit_interval
,
7355 ip_ospf_retransmit_interval_addr_cmd
,
7356 "ip ospf retransmit-interval <3-65535> A.B.C.D",
7358 "OSPF interface commands\n"
7359 "Time between retransmitting lost link state advertisements\n"
7361 "Address of interface")
7363 struct interface
*ifp
= vty
->index
;
7365 struct in_addr addr
;
7367 struct ospf_if_params
*params
;
7369 params
= IF_DEF_PARAMS (ifp
);
7370 seconds
= strtol (argv
[0], NULL
, 10);
7372 /* Retransmit Interval range is <3-65535>. */
7373 if (seconds
< 3 || seconds
> 65535)
7375 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
7382 ret
= inet_aton(argv
[1], &addr
);
7385 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7390 params
= ospf_get_if_params (ifp
, addr
);
7391 ospf_if_update_params (ifp
, addr
);
7394 SET_IF_PARAM (params
, retransmit_interval
);
7395 params
->retransmit_interval
= seconds
;
7400 ALIAS (ip_ospf_retransmit_interval
,
7401 ip_ospf_retransmit_interval_cmd
,
7402 "ip ospf retransmit-interval <3-65535>",
7404 "OSPF interface commands\n"
7405 "Time between retransmitting lost link state advertisements\n"
7408 ALIAS (ip_ospf_retransmit_interval
,
7409 ospf_retransmit_interval_cmd
,
7410 "ospf retransmit-interval <3-65535>",
7411 "OSPF interface commands\n"
7412 "Time between retransmitting lost link state advertisements\n"
7415 DEFUN (no_ip_ospf_retransmit_interval
,
7416 no_ip_ospf_retransmit_interval_addr_cmd
,
7417 "no ip ospf retransmit-interval A.B.C.D",
7420 "OSPF interface commands\n"
7421 "Time between retransmitting lost link state advertisements\n"
7422 "Address of interface")
7424 struct interface
*ifp
= vty
->index
;
7425 struct in_addr addr
;
7427 struct ospf_if_params
*params
;
7430 params
= IF_DEF_PARAMS (ifp
);
7434 ret
= inet_aton(argv
[0], &addr
);
7437 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7442 params
= ospf_lookup_if_params (ifp
, addr
);
7447 UNSET_IF_PARAM (params
, retransmit_interval
);
7448 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
7450 if (params
!= IF_DEF_PARAMS (ifp
))
7452 ospf_free_if_params (ifp
, addr
);
7453 ospf_if_update_params (ifp
, addr
);
7459 ALIAS (no_ip_ospf_retransmit_interval
,
7460 no_ip_ospf_retransmit_interval_cmd
,
7461 "no ip ospf retransmit-interval",
7464 "OSPF interface commands\n"
7465 "Time between retransmitting lost link state advertisements\n")
7467 ALIAS (no_ip_ospf_retransmit_interval
,
7468 no_ospf_retransmit_interval_cmd
,
7469 "no ospf retransmit-interval",
7471 "OSPF interface commands\n"
7472 "Time between retransmitting lost link state advertisements\n")
7474 DEFUN (ip_ospf_transmit_delay
,
7475 ip_ospf_transmit_delay_addr_cmd
,
7476 "ip ospf transmit-delay <1-65535> A.B.C.D",
7478 "OSPF interface commands\n"
7479 "Link state transmit delay\n"
7481 "Address of interface")
7483 struct interface
*ifp
= vty
->index
;
7485 struct in_addr addr
;
7487 struct ospf_if_params
*params
;
7489 params
= IF_DEF_PARAMS (ifp
);
7490 seconds
= strtol (argv
[0], NULL
, 10);
7492 /* Transmit Delay range is <1-65535>. */
7493 if (seconds
< 1 || seconds
> 65535)
7495 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
7501 ret
= inet_aton(argv
[1], &addr
);
7504 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7509 params
= ospf_get_if_params (ifp
, addr
);
7510 ospf_if_update_params (ifp
, addr
);
7513 SET_IF_PARAM (params
, transmit_delay
);
7514 params
->transmit_delay
= seconds
;
7519 ALIAS (ip_ospf_transmit_delay
,
7520 ip_ospf_transmit_delay_cmd
,
7521 "ip ospf transmit-delay <1-65535>",
7523 "OSPF interface commands\n"
7524 "Link state transmit delay\n"
7527 ALIAS (ip_ospf_transmit_delay
,
7528 ospf_transmit_delay_cmd
,
7529 "ospf transmit-delay <1-65535>",
7530 "OSPF interface commands\n"
7531 "Link state transmit delay\n"
7534 DEFUN (no_ip_ospf_transmit_delay
,
7535 no_ip_ospf_transmit_delay_addr_cmd
,
7536 "no ip ospf transmit-delay A.B.C.D",
7539 "OSPF interface commands\n"
7540 "Link state transmit delay\n"
7541 "Address of interface")
7543 struct interface
*ifp
= vty
->index
;
7544 struct in_addr addr
;
7546 struct ospf_if_params
*params
;
7549 params
= IF_DEF_PARAMS (ifp
);
7553 ret
= inet_aton(argv
[0], &addr
);
7556 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7561 params
= ospf_lookup_if_params (ifp
, addr
);
7566 UNSET_IF_PARAM (params
, transmit_delay
);
7567 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
7569 if (params
!= IF_DEF_PARAMS (ifp
))
7571 ospf_free_if_params (ifp
, addr
);
7572 ospf_if_update_params (ifp
, addr
);
7578 ALIAS (no_ip_ospf_transmit_delay
,
7579 no_ip_ospf_transmit_delay_cmd
,
7580 "no ip ospf transmit-delay",
7583 "OSPF interface commands\n"
7584 "Link state transmit delay\n")
7586 ALIAS (no_ip_ospf_transmit_delay
,
7587 no_ospf_transmit_delay_cmd
,
7588 "no ospf transmit-delay",
7590 "OSPF interface commands\n"
7591 "Link state transmit delay\n")
7593 DEFUN (ip_ospf_area
,
7595 "ip ospf area (A.B.C.D|<0-4294967295>)",
7597 "OSPF interface commands\n"
7598 "Enable OSPF on this interface\n"
7599 "OSPF area ID in IP address format\n"
7600 "OSPF area ID as a decimal value\n")
7602 struct interface
*ifp
= vty
->index
;
7604 struct in_addr area_id
;
7606 struct ospf_if_params
*params
;
7607 struct route_node
*rn
;
7608 u_short instance
= 0;
7611 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
7613 ospf
= ospf_lookup_instance (instance
);
7616 params
= IF_DEF_PARAMS (ifp
);
7617 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
7619 ospf_interface_unset (ifp
);
7620 ospf
= ospf_lookup();
7621 ospf
->if_ospf_cli_count
--;
7626 ret
= ospf_str2area_id (argv
[instance
? 1 : 0], &area_id
, &format
);
7629 vty_out (vty
, "Please specify area by A.B.C.D|<0-4294967295>%s",
7633 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
7635 vty_out (vty
, "Cannot enable OSPF on a virtual link.%s", VTY_NEWLINE
);
7639 params
= IF_DEF_PARAMS (ifp
);
7640 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
7643 "Must remove previous area config before changing ospf area %s",
7648 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
7650 if (rn
->info
!= NULL
)
7652 vty_out (vty
, "Please remove all network commands first.%s", VTY_NEWLINE
);
7657 /* enable ospf on this interface with area_id */
7658 ospf_interface_set (ifp
, area_id
);
7659 ospf
->if_ospf_cli_count
++;
7664 ALIAS (ip_ospf_area
,
7665 ip_ospf_instance_area_cmd
,
7666 "ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)",
7668 "OSPF interface commands\n"
7670 "Enable OSPF on this interface\n"
7671 "OSPF area ID in IP address format\n"
7672 "OSPF area ID as a decimal value\n")
7674 DEFUN (no_ip_ospf_area
,
7675 no_ip_ospf_area_cmd
,
7679 "OSPF interface commands\n"
7680 "Disable OSPF on this interface\n")
7682 struct interface
*ifp
= vty
->index
;
7684 struct ospf_if_params
*params
;
7685 u_short instance
= 0;
7688 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
7690 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
)
7693 params
= IF_DEF_PARAMS (ifp
);
7694 if (!OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
7696 vty_out (vty
, "Can't find specified inteface area configuration.%s", VTY_NEWLINE
);
7700 ospf_interface_unset (ifp
);
7701 ospf
->if_ospf_cli_count
--;
7705 ALIAS (no_ip_ospf_area
,
7706 no_ip_ospf_instance_area_cmd
,
7707 "no ip ospf <1-65535> area",
7710 "OSPF interface commands\n"
7712 "Disable OSPF on this interface\n")
7714 DEFUN (ospf_redistribute_source
,
7715 ospf_redistribute_source_cmd
,
7716 "redistribute " QUAGGA_REDIST_STR_OSPFD
7717 " {metric <0-16777214>|metric-type (1|2)|route-map WORD}",
7719 QUAGGA_REDIST_HELP_STR_OSPFD
7720 "Metric for redistributed routes\n"
7721 "OSPF default metric\n"
7722 "OSPF exterior metric type for redistributed routes\n"
7723 "Set OSPF External Type 1 metrics\n"
7724 "Set OSPF External Type 2 metrics\n"
7725 "Route map reference\n"
7726 "Pointer to route-map entries\n")
7728 struct ospf
*ospf
= vty
->index
;
7732 struct ospf_redist
*red
;
7735 return CMD_WARNING
; /* should not happen */
7740 /* Get distribute source. */
7741 source
= proto_redistnum(AFI_IP
, argv
[0]);
7742 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
7745 /* Get metric value. */
7746 if (argv
[1] != NULL
)
7747 if (!str2metric (argv
[1], &metric
))
7750 /* Get metric type. */
7751 if (argv
[2] != NULL
)
7752 if (!str2metric_type (argv
[2], &type
))
7755 red
= ospf_redist_add(ospf
, source
, 0);
7757 if (argv
[3] != NULL
)
7758 ospf_routemap_set (red
, argv
[3]);
7760 ospf_routemap_unset (red
);
7762 return ospf_redistribute_set (ospf
, source
, 0, type
, metric
);
7765 DEFUN (no_ospf_redistribute_source
,
7766 no_ospf_redistribute_source_cmd
,
7767 "no redistribute " QUAGGA_REDIST_STR_OSPFD
,
7770 QUAGGA_REDIST_HELP_STR_OSPFD
)
7772 struct ospf
*ospf
= vty
->index
;
7774 struct ospf_redist
*red
;
7778 source
= proto_redistnum(AFI_IP
, argv
[0]);
7779 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
7782 red
= ospf_redist_lookup(ospf
, source
, 0);
7786 ospf_routemap_unset (red
);
7787 return ospf_redistribute_unset (ospf
, source
, 0);
7790 DEFUN (ospf_redistribute_instance_source
,
7791 ospf_redistribute_instance_source_cmd
,
7792 "redistribute (ospf|table) <1-65535>"
7793 " {metric <0-16777214>|metric-type (1|2)|route-map WORD}",
7795 "Open Shortest Path First\n"
7796 "Non-main Kernel Routing Table\n"
7797 "Instance ID/Table ID\n"
7798 "Metric for redistributed routes\n"
7799 "OSPF default metric\n"
7800 "OSPF exterior metric type for redistributed routes\n"
7801 "Set OSPF External Type 1 metrics\n"
7802 "Set OSPF External Type 2 metrics\n"
7803 "Route map reference\n"
7804 "Pointer to route-map entries\n")
7806 struct ospf
*ospf
= vty
->index
;
7811 struct ospf_redist
*red
;
7813 if (strncmp(argv
[0], "o", 1) == 0)
7814 source
= ZEBRA_ROUTE_OSPF
;
7816 source
= ZEBRA_ROUTE_TABLE
;
7818 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
7823 if ((source
== ZEBRA_ROUTE_OSPF
) && !ospf
->instance
)
7825 vty_out (vty
, "Instance redistribution in non-instanced OSPF not allowed%s",
7830 if ((source
== ZEBRA_ROUTE_OSPF
) && (ospf
->instance
== instance
))
7832 vty_out (vty
, "Same instance OSPF redistribution not allowed%s",
7837 /* Get metric value. */
7838 if (argv
[2] != NULL
)
7839 if (!str2metric (argv
[2], &metric
))
7842 /* Get metric type. */
7843 if (argv
[3] != NULL
)
7844 if (!str2metric_type (argv
[3], &type
))
7847 red
= ospf_redist_add(ospf
, source
, instance
);
7848 if (argv
[4] != NULL
)
7849 ospf_routemap_set (red
, argv
[4]);
7851 ospf_routemap_unset (red
);
7853 return ospf_redistribute_set (ospf
, source
, instance
, type
, metric
);
7856 DEFUN (no_ospf_redistribute_instance_source
,
7857 no_ospf_redistribute_instance_source_cmd
,
7858 "no redistribute (ospf|table) <1-65535>"
7859 " {metric <0-16777214>|metric-type (1|2)|route-map WORD}",
7862 "Open Shortest Path First\n"
7863 "Non-main Kernel Routing Table\n"
7864 "Instance ID/Table Id\n"
7865 "Metric for redistributed routes\n"
7866 "OSPF default metric\n"
7867 "OSPF exterior metric type for redistributed routes\n"
7868 "Set OSPF External Type 1 metrics\n"
7869 "Set OSPF External Type 2 metrics\n"
7870 "Route map reference\n"
7871 "Pointer to route-map entries\n")
7873 struct ospf
*ospf
= vty
->index
;
7875 struct ospf_redist
*red
;
7881 if (strncmp(argv
[0], "o", 1) == 0)
7882 source
= ZEBRA_ROUTE_OSPF
;
7884 source
= ZEBRA_ROUTE_TABLE
;
7886 VTY_GET_INTEGER ("Instance ID", instance
, argv
[1]);
7888 if ((source
== ZEBRA_ROUTE_OSPF
) && !ospf
->instance
)
7890 vty_out (vty
, "Instance redistribution in non-instanced OSPF not allowed%s",
7895 if ((source
== ZEBRA_ROUTE_OSPF
) && (ospf
->instance
== instance
))
7897 vty_out (vty
, "Same instance OSPF redistribution not allowed%s",
7902 red
= ospf_redist_lookup(ospf
, source
, instance
);
7906 ospf_routemap_unset (red
);
7907 return ospf_redistribute_unset (ospf
, source
, instance
);
7910 DEFUN (ospf_distribute_list_out
,
7911 ospf_distribute_list_out_cmd
,
7912 "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD
,
7913 "Filter networks in routing updates\n"
7914 "Access-list name\n"
7916 QUAGGA_REDIST_HELP_STR_OSPFD
)
7918 struct ospf
*ospf
= vty
->index
;
7924 /* Get distribute source. */
7925 source
= proto_redistnum(AFI_IP
, argv
[1]);
7926 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
7929 return ospf_distribute_list_out_set (ospf
, source
, argv
[0]);
7932 DEFUN (no_ospf_distribute_list_out
,
7933 no_ospf_distribute_list_out_cmd
,
7934 "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD
,
7936 "Filter networks in routing updates\n"
7937 "Access-list name\n"
7939 QUAGGA_REDIST_HELP_STR_OSPFD
)
7941 struct ospf
*ospf
= vty
->index
;
7947 source
= proto_redistnum(AFI_IP
, argv
[1]);
7948 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
7951 return ospf_distribute_list_out_unset (ospf
, source
, argv
[0]);
7954 /* Default information originate. */
7955 DEFUN (ospf_default_information_originate
,
7956 ospf_default_information_originate_cmd
,
7957 "default-information originate "
7958 "{always|metric <0-16777214>|metric-type (1|2)|route-map WORD}",
7959 "Control distribution of default information\n"
7960 "Distribute a default route\n"
7961 "Always advertise default route\n"
7962 "OSPF default metric\n"
7964 "OSPF metric type for default routes\n"
7965 "Set OSPF External Type 1 metrics\n"
7966 "Set OSPF External Type 2 metrics\n"
7967 "Route map reference\n"
7968 "Pointer to route-map entries\n")
7970 struct ospf
*ospf
= vty
->index
;
7971 int default_originate
= DEFAULT_ORIGINATE_ZEBRA
;
7974 struct ospf_redist
*red
;
7980 return CMD_WARNING
; /* this should not happen */
7982 /* Check whether "always" was specified */
7983 if (argv
[0] != NULL
)
7984 default_originate
= DEFAULT_ORIGINATE_ALWAYS
;
7986 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
7988 /* Get metric value. */
7989 if (argv
[1] != NULL
)
7990 if (!str2metric (argv
[1], &metric
))
7993 /* Get metric type. */
7994 if (argv
[2] != NULL
)
7995 if (!str2metric_type (argv
[2], &type
))
7998 if (argv
[3] != NULL
)
7999 ospf_routemap_set (red
, argv
[3]);
8001 ospf_routemap_unset (red
);
8003 return ospf_redistribute_default_set (ospf
, default_originate
,
8007 DEFUN (no_ospf_default_information_originate
,
8008 no_ospf_default_information_originate_cmd
,
8009 "no default-information originate",
8011 "Control distribution of default information\n"
8012 "Distribute a default route\n")
8014 struct ospf
*ospf
= vty
->index
;
8015 struct prefix_ipv4 p
;
8016 struct ospf_external
*ext
;
8017 struct ospf_redist
*red
;
8023 p
.prefix
.s_addr
= 0;
8026 ospf_external_lsa_flush (ospf
, DEFAULT_ROUTE
, &p
, 0);
8028 if ((ext
= ospf_external_lookup(DEFAULT_ROUTE
, 0)) &&
8029 EXTERNAL_INFO (ext
)) {
8030 ospf_external_info_delete (DEFAULT_ROUTE
, 0, p
);
8031 ospf_external_del (DEFAULT_ROUTE
, 0);
8034 red
= ospf_redist_lookup(ospf
, DEFAULT_ROUTE
, 0);
8038 ospf_routemap_unset (red
);
8039 return ospf_redistribute_default_unset (ospf
);
8042 DEFUN (ospf_default_metric
,
8043 ospf_default_metric_cmd
,
8044 "default-metric <0-16777214>",
8045 "Set metric of redistributed routes\n"
8048 struct ospf
*ospf
= vty
->index
;
8054 if (!str2metric (argv
[0], &metric
))
8057 ospf
->default_metric
= metric
;
8062 DEFUN (no_ospf_default_metric
,
8063 no_ospf_default_metric_cmd
,
8064 "no default-metric",
8066 "Set metric of redistributed routes\n")
8068 struct ospf
*ospf
= vty
->index
;
8073 ospf
->default_metric
= -1;
8078 ALIAS (no_ospf_default_metric
,
8079 no_ospf_default_metric_val_cmd
,
8080 "no default-metric <0-16777214>",
8082 "Set metric of redistributed routes\n"
8085 DEFUN (ospf_distance
,
8088 "Define an administrative distance\n"
8089 "OSPF Administrative distance\n")
8091 struct ospf
*ospf
= vty
->index
;
8096 ospf
->distance_all
= atoi (argv
[0]);
8101 DEFUN (no_ospf_distance
,
8102 no_ospf_distance_cmd
,
8103 "no distance <1-255>",
8105 "Define an administrative distance\n"
8106 "OSPF Administrative distance\n")
8108 struct ospf
*ospf
= vty
->index
;
8113 ospf
->distance_all
= 0;
8118 DEFUN (no_ospf_distance_ospf
,
8119 no_ospf_distance_ospf_cmd
,
8120 "no distance ospf {intra-area|inter-area|external}",
8122 "Define an administrative distance\n"
8123 "OSPF Administrative distance\n"
8125 "Intra-area routes\n"
8126 "Inter-area routes\n"
8127 "External routes\n")
8129 struct ospf
*ospf
= vty
->index
;
8137 if (argv
[0] != NULL
)
8138 ospf
->distance_intra
= 0;
8140 if (argv
[1] != NULL
)
8141 ospf
->distance_inter
= 0;
8143 if (argv
[2] != NULL
)
8144 ospf
->distance_external
= 0;
8146 if (argv
[0] || argv
[1] || argv
[2])
8149 /* If no arguments are given, clear all distance information */
8150 ospf
->distance_intra
= 0;
8151 ospf
->distance_inter
= 0;
8152 ospf
->distance_external
= 0;
8157 DEFUN (ospf_distance_ospf
,
8158 ospf_distance_ospf_cmd
,
8160 "{intra-area <1-255>|inter-area <1-255>|external <1-255>}",
8161 "Define an administrative distance\n"
8162 "OSPF Administrative distance\n"
8163 "Intra-area routes\n"
8164 "Distance for intra-area routes\n"
8165 "Inter-area routes\n"
8166 "Distance for inter-area routes\n"
8168 "Distance for external routes\n")
8170 struct ospf
*ospf
= vty
->index
;
8172 if (argc
< 3) /* should not happen */
8175 if (!argv
[0] && !argv
[1] && !argv
[2])
8177 vty_out(vty
, "%% Command incomplete. (Arguments required)%s",
8182 if (argv
[0] != NULL
)
8183 ospf
->distance_intra
= atoi(argv
[0]);
8185 if (argv
[1] != NULL
)
8186 ospf
->distance_inter
= atoi(argv
[1]);
8188 if (argv
[2] != NULL
)
8189 ospf
->distance_external
= atoi(argv
[2]);
8194 DEFUN (ospf_distance_source
,
8195 ospf_distance_source_cmd
,
8196 "distance <1-255> A.B.C.D/M",
8197 "Administrative distance\n"
8199 "IP source prefix\n")
8201 struct ospf
*ospf
= vty
->index
;
8206 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], NULL
);
8211 DEFUN (no_ospf_distance_source
,
8212 no_ospf_distance_source_cmd
,
8213 "no distance <1-255> A.B.C.D/M",
8215 "Administrative distance\n"
8217 "IP source prefix\n")
8219 struct ospf
*ospf
= vty
->index
;
8224 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], NULL
);
8229 DEFUN (ospf_distance_source_access_list
,
8230 ospf_distance_source_access_list_cmd
,
8231 "distance <1-255> A.B.C.D/M WORD",
8232 "Administrative distance\n"
8234 "IP source prefix\n"
8235 "Access list name\n")
8237 struct ospf
*ospf
= vty
->index
;
8242 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
8247 DEFUN (no_ospf_distance_source_access_list
,
8248 no_ospf_distance_source_access_list_cmd
,
8249 "no distance <1-255> A.B.C.D/M WORD",
8251 "Administrative distance\n"
8253 "IP source prefix\n"
8254 "Access list name\n")
8256 struct ospf
*ospf
= vty
->index
;
8261 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
8266 DEFUN (ip_ospf_mtu_ignore
,
8267 ip_ospf_mtu_ignore_addr_cmd
,
8268 "ip ospf mtu-ignore A.B.C.D",
8270 "OSPF interface commands\n"
8271 "Disable mtu mismatch detection\n"
8272 "Address of interface")
8274 struct interface
*ifp
= vty
->index
;
8275 struct in_addr addr
;
8278 struct ospf_if_params
*params
;
8279 params
= IF_DEF_PARAMS (ifp
);
8283 ret
= inet_aton(argv
[0], &addr
);
8286 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
8290 params
= ospf_get_if_params (ifp
, addr
);
8291 ospf_if_update_params (ifp
, addr
);
8293 params
->mtu_ignore
= 1;
8294 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
8295 SET_IF_PARAM (params
, mtu_ignore
);
8298 UNSET_IF_PARAM (params
, mtu_ignore
);
8299 if (params
!= IF_DEF_PARAMS (ifp
))
8301 ospf_free_if_params (ifp
, addr
);
8302 ospf_if_update_params (ifp
, addr
);
8308 ALIAS (ip_ospf_mtu_ignore
,
8309 ip_ospf_mtu_ignore_cmd
,
8310 "ip ospf mtu-ignore",
8312 "OSPF interface commands\n"
8313 "Disable mtu mismatch detection\n")
8316 DEFUN (no_ip_ospf_mtu_ignore
,
8317 no_ip_ospf_mtu_ignore_addr_cmd
,
8318 "no ip ospf mtu-ignore A.B.C.D",
8320 "OSPF interface commands\n"
8321 "Disable mtu mismatch detection\n"
8322 "Address of interface")
8324 struct interface
*ifp
= vty
->index
;
8325 struct in_addr addr
;
8328 struct ospf_if_params
*params
;
8329 params
= IF_DEF_PARAMS (ifp
);
8333 ret
= inet_aton(argv
[0], &addr
);
8336 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
8340 params
= ospf_get_if_params (ifp
, addr
);
8341 ospf_if_update_params (ifp
, addr
);
8343 params
->mtu_ignore
= 0;
8344 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
8345 SET_IF_PARAM (params
, mtu_ignore
);
8348 UNSET_IF_PARAM (params
, mtu_ignore
);
8349 if (params
!= IF_DEF_PARAMS (ifp
))
8351 ospf_free_if_params (ifp
, addr
);
8352 ospf_if_update_params (ifp
, addr
);
8358 ALIAS (no_ip_ospf_mtu_ignore
,
8359 no_ip_ospf_mtu_ignore_cmd
,
8360 "no ip ospf mtu-ignore",
8362 "OSPF interface commands\n"
8363 "Disable mtu mismatch detection\n")
8365 DEFUN (ospf_max_metric_router_lsa_admin
,
8366 ospf_max_metric_router_lsa_admin_cmd
,
8367 "max-metric router-lsa administrative",
8368 "OSPF maximum / infinite-distance metric\n"
8369 "Advertise own Router-LSA with infinite distance (stub router)\n"
8370 "Administratively applied, for an indefinite period\n")
8372 struct listnode
*ln
;
8373 struct ospf_area
*area
;
8374 struct ospf
*ospf
= vty
->index
;
8379 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
8381 SET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
8383 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
8384 ospf_router_lsa_update_area (area
);
8387 /* Allows for areas configured later to get the property */
8388 ospf
->stub_router_admin_set
= OSPF_STUB_ROUTER_ADMINISTRATIVE_SET
;
8393 DEFUN (no_ospf_max_metric_router_lsa_admin
,
8394 no_ospf_max_metric_router_lsa_admin_cmd
,
8395 "no max-metric router-lsa administrative",
8397 "OSPF maximum / infinite-distance metric\n"
8398 "Advertise own Router-LSA with infinite distance (stub router)\n"
8399 "Administratively applied, for an indefinite period\n")
8401 struct listnode
*ln
;
8402 struct ospf_area
*area
;
8403 struct ospf
*ospf
= vty
->index
;
8408 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
8410 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
8412 /* Don't trample on the start-up stub timer */
8413 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
)
8414 && !area
->t_stub_router
)
8416 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
8417 ospf_router_lsa_update_area (area
);
8420 ospf
->stub_router_admin_set
= OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET
;
8424 DEFUN (ospf_max_metric_router_lsa_startup
,
8425 ospf_max_metric_router_lsa_startup_cmd
,
8426 "max-metric router-lsa on-startup <5-86400>",
8427 "OSPF maximum / infinite-distance metric\n"
8428 "Advertise own Router-LSA with infinite distance (stub router)\n"
8429 "Automatically advertise stub Router-LSA on startup of OSPF\n"
8430 "Time (seconds) to advertise self as stub-router\n")
8432 unsigned int seconds
;
8433 struct ospf
*ospf
= vty
->index
;
8440 vty_out (vty
, "%% Must supply stub-router period");
8444 VTY_GET_INTEGER ("stub-router startup period", seconds
, argv
[0]);
8446 ospf
->stub_router_startup_time
= seconds
;
8451 DEFUN (no_ospf_max_metric_router_lsa_startup
,
8452 no_ospf_max_metric_router_lsa_startup_cmd
,
8453 "no max-metric router-lsa on-startup",
8455 "OSPF maximum / infinite-distance metric\n"
8456 "Advertise own Router-LSA with infinite distance (stub router)\n"
8457 "Automatically advertise stub Router-LSA on startup of OSPF\n")
8459 struct listnode
*ln
;
8460 struct ospf_area
*area
;
8461 struct ospf
*ospf
= vty
->index
;
8466 ospf
->stub_router_startup_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
8468 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
8470 SET_FLAG (area
->stub_router_state
, OSPF_AREA_WAS_START_STUB_ROUTED
);
8471 OSPF_TIMER_OFF (area
->t_stub_router
);
8473 /* Don't trample on admin stub routed */
8474 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
8476 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
8477 ospf_router_lsa_update_area (area
);
8483 DEFUN (ospf_max_metric_router_lsa_shutdown
,
8484 ospf_max_metric_router_lsa_shutdown_cmd
,
8485 "max-metric router-lsa on-shutdown <5-100>",
8486 "OSPF maximum / infinite-distance metric\n"
8487 "Advertise own Router-LSA with infinite distance (stub router)\n"
8488 "Advertise stub-router prior to full shutdown of OSPF\n"
8489 "Time (seconds) to wait till full shutdown\n")
8491 unsigned int seconds
;
8492 struct ospf
*ospf
= vty
->index
;
8499 vty_out (vty
, "%% Must supply stub-router shutdown period");
8503 VTY_GET_INTEGER ("stub-router shutdown wait period", seconds
, argv
[0]);
8505 ospf
->stub_router_shutdown_time
= seconds
;
8510 DEFUN (no_ospf_max_metric_router_lsa_shutdown
,
8511 no_ospf_max_metric_router_lsa_shutdown_cmd
,
8512 "no max-metric router-lsa on-shutdown",
8514 "OSPF maximum / infinite-distance metric\n"
8515 "Advertise own Router-LSA with infinite distance (stub router)\n"
8516 "Advertise stub-router prior to full shutdown of OSPF\n")
8518 struct ospf
*ospf
= vty
->index
;
8523 ospf
->stub_router_shutdown_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
8529 config_write_stub_router (struct vty
*vty
, struct ospf
*ospf
)
8531 struct listnode
*ln
;
8532 struct ospf_area
*area
;
8534 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
8535 vty_out (vty
, " max-metric router-lsa on-startup %u%s",
8536 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
8537 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
8538 vty_out (vty
, " max-metric router-lsa on-shutdown %u%s",
8539 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
8540 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
8542 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
8544 vty_out (vty
, " max-metric router-lsa administrative%s",
8553 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
8555 struct route_node
*rn
;
8556 struct ospf_route
*or;
8557 struct listnode
*pnode
, *pnnode
;
8558 struct ospf_path
*path
;
8560 vty_out (vty
, "============ OSPF network routing table ============%s",
8563 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
8564 if ((or = rn
->info
) != NULL
)
8567 snprintf (buf1
, 19, "%s/%d",
8568 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
8570 switch (or->path_type
)
8572 case OSPF_PATH_INTER_AREA
:
8573 if (or->type
== OSPF_DESTINATION_NETWORK
)
8574 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
8575 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
8576 else if (or->type
== OSPF_DESTINATION_DISCARD
)
8577 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
8579 case OSPF_PATH_INTRA_AREA
:
8580 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
8581 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
8587 if (or->type
== OSPF_DESTINATION_NETWORK
)
8588 for (ALL_LIST_ELEMENTS (or->paths
, pnode
, pnnode
, path
))
8590 if (if_lookup_by_index(path
->ifindex
))
8592 if (path
->nexthop
.s_addr
== 0)
8593 vty_out (vty
, "%24s directly attached to %s%s",
8594 "", ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
8596 vty_out (vty
, "%24s via %s, %s%s", "",
8597 inet_ntoa (path
->nexthop
),
8598 ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
8602 vty_out (vty
, "%s", VTY_NEWLINE
);
8606 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
8608 struct route_node
*rn
;
8609 struct ospf_route
*or;
8610 struct listnode
*pnode
;
8611 struct listnode
*node
;
8612 struct ospf_path
*path
;
8614 vty_out (vty
, "============ OSPF router routing table =============%s",
8616 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
8621 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
8623 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, or))
8626 vty_out (vty
, "%24s", "");
8629 vty_out (vty
, "%s [%d] area: %s",
8630 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
8631 or->cost
, inet_ntoa (or->u
.std
.area_id
));
8633 vty_out (vty
, "%s%s%s",
8634 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
8635 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
8638 for (ALL_LIST_ELEMENTS_RO (or->paths
, pnode
, path
))
8640 if (if_lookup_by_index(path
->ifindex
))
8642 if (path
->nexthop
.s_addr
== 0)
8643 vty_out (vty
, "%24s directly attached to %s%s",
8644 "", ifindex2ifname (path
->ifindex
),
8647 vty_out (vty
, "%24s via %s, %s%s", "",
8648 inet_ntoa (path
->nexthop
),
8649 ifindex2ifname (path
->ifindex
),
8655 vty_out (vty
, "%s", VTY_NEWLINE
);
8659 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
8661 struct route_node
*rn
;
8662 struct ospf_route
*er
;
8663 struct listnode
*pnode
, *pnnode
;
8664 struct ospf_path
*path
;
8666 vty_out (vty
, "============ OSPF external routing table ===========%s",
8668 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
8669 if ((er
= rn
->info
) != NULL
)
8672 snprintf (buf1
, 19, "%s/%d",
8673 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
8675 switch (er
->path_type
)
8677 case OSPF_PATH_TYPE1_EXTERNAL
:
8678 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
8679 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
8681 case OSPF_PATH_TYPE2_EXTERNAL
:
8682 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
8683 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
8687 for (ALL_LIST_ELEMENTS (er
->paths
, pnode
, pnnode
, path
))
8689 if (if_lookup_by_index(path
->ifindex
))
8691 if (path
->nexthop
.s_addr
== 0)
8692 vty_out (vty
, "%24s directly attached to %s%s",
8693 "", ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
8695 vty_out (vty
, "%24s via %s, %s%s", "",
8696 inet_ntoa (path
->nexthop
),
8697 ifindex2ifname (path
->ifindex
),
8702 vty_out (vty
, "%s", VTY_NEWLINE
);
8706 show_ip_ospf_border_routers_common (struct vty
*vty
, struct ospf
*ospf
)
8709 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
8710 VTY_NEWLINE
, VTY_NEWLINE
);
8712 if (ospf
->new_table
== NULL
)
8714 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
8718 /* Show Network routes.
8719 show_ip_ospf_route_network (vty, ospf->new_table); */
8721 /* Show Router routes. */
8722 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
8724 vty_out (vty
, "%s", VTY_NEWLINE
);
8729 DEFUN (show_ip_ospf_border_routers
,
8730 show_ip_ospf_border_routers_cmd
,
8731 "show ip ospf border-routers",
8734 "OSPF information\n"
8735 "Show all the ABR's and ASBR's\n")
8739 if ((ospf
= ospf_lookup ()) == NULL
|| !ospf
->oi_running
)
8742 return show_ip_ospf_border_routers_common(vty
, ospf
);
8745 DEFUN (show_ip_ospf_instance_border_routers
,
8746 show_ip_ospf_instance_border_routers_cmd
,
8747 "show ip ospf <1-65535> border-routers",
8750 "OSPF information\n"
8752 "Show all the ABR's and ASBR's\n")
8755 u_short instance
= 0;
8757 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
8758 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
8761 return show_ip_ospf_border_routers_common(vty
, ospf
);
8765 show_ip_ospf_route_common (struct vty
*vty
, struct ospf
*ospf
)
8768 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
8769 VTY_NEWLINE
, VTY_NEWLINE
);
8771 if (ospf
->new_table
== NULL
)
8773 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
8777 /* Show Network routes. */
8778 show_ip_ospf_route_network (vty
, ospf
->new_table
);
8780 /* Show Router routes. */
8781 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
8783 /* Show AS External routes. */
8784 show_ip_ospf_route_external (vty
, ospf
->old_external_route
);
8786 vty_out (vty
, "%s", VTY_NEWLINE
);
8791 DEFUN (show_ip_ospf_route
,
8792 show_ip_ospf_route_cmd
,
8793 "show ip ospf route",
8796 "OSPF information\n"
8797 "OSPF routing table\n")
8801 if ((ospf
= ospf_lookup ()) == NULL
|| !ospf
->oi_running
)
8804 return show_ip_ospf_route_common(vty
, ospf
);
8807 DEFUN (show_ip_ospf_instance_route
,
8808 show_ip_ospf_instance_route_cmd
,
8809 "show ip ospf <1-65535> route",
8812 "OSPF information\n"
8814 "OSPF routing table\n")
8817 u_short instance
= 0;
8819 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
8820 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
8823 return show_ip_ospf_route_common(vty
, ospf
);
8826 const char *ospf_abr_type_str
[] =
8835 const char *ospf_shortcut_mode_str
[] =
8844 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
8846 memset (buf
, 0, length
);
8848 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
8849 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
8851 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
8855 const char *ospf_int_type_str
[] =
8857 "unknown", /* should never be used. */
8861 "point-to-multipoint",
8862 "virtual-link", /* should never be used. */
8866 /* Configuration write function for ospfd. */
8868 config_write_interface (struct vty
*vty
)
8870 struct listnode
*n1
, *n2
;
8871 struct interface
*ifp
;
8872 struct crypt_key
*ck
;
8874 struct route_node
*rn
= NULL
;
8875 struct ospf_if_params
*params
;
8876 struct ospf
*ospf
= ospf_lookup();
8878 for (ALL_LIST_ELEMENTS_RO (iflist
, n1
, ifp
))
8880 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
8883 vty_out (vty
, "!%s", VTY_NEWLINE
);
8884 vty_out (vty
, "interface %s%s", ifp
->name
,
8887 vty_out (vty
, " description %s%s", ifp
->desc
,
8892 params
= IF_DEF_PARAMS (ifp
);
8895 /* Interface Network print. */
8896 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
8897 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
8899 if (params
->type
!= ospf_default_iftype(ifp
))
8901 vty_out (vty
, " ip ospf network %s",
8902 ospf_int_type_str
[params
->type
]);
8903 if (params
!= IF_DEF_PARAMS (ifp
))
8904 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8905 vty_out (vty
, "%s", VTY_NEWLINE
);
8909 /* OSPF interface authentication print */
8910 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
8911 params
->auth_type
!= OSPF_AUTH_NOTSET
)
8913 const char *auth_str
;
8915 /* Translation tables are not that much help here due to syntax
8916 of the simple option */
8917 switch (params
->auth_type
)
8920 case OSPF_AUTH_NULL
:
8924 case OSPF_AUTH_SIMPLE
:
8928 case OSPF_AUTH_CRYPTOGRAPHIC
:
8929 auth_str
= " message-digest";
8937 vty_out (vty
, " ip ospf authentication%s", auth_str
);
8938 if (params
!= IF_DEF_PARAMS (ifp
))
8939 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8940 vty_out (vty
, "%s", VTY_NEWLINE
);
8943 /* Simple Authentication Password print. */
8944 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
8945 params
->auth_simple
[0] != '\0')
8947 vty_out (vty
, " ip ospf authentication-key %s",
8948 params
->auth_simple
);
8949 if (params
!= IF_DEF_PARAMS (ifp
))
8950 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8951 vty_out (vty
, "%s", VTY_NEWLINE
);
8954 /* Cryptographic Authentication Key print. */
8955 for (ALL_LIST_ELEMENTS_RO (params
->auth_crypt
, n2
, ck
))
8957 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
8958 ck
->key_id
, ck
->auth_key
);
8959 if (params
!= IF_DEF_PARAMS (ifp
))
8960 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8961 vty_out (vty
, "%s", VTY_NEWLINE
);
8964 /* Interface Output Cost print. */
8965 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
8967 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
8968 if (params
!= IF_DEF_PARAMS (ifp
))
8969 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8970 vty_out (vty
, "%s", VTY_NEWLINE
);
8973 /* Hello Interval print. */
8974 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
8975 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
8977 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
8978 if (params
!= IF_DEF_PARAMS (ifp
))
8979 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8980 vty_out (vty
, "%s", VTY_NEWLINE
);
8984 /* Router Dead Interval print. */
8985 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
8986 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
8988 vty_out (vty
, " ip ospf dead-interval ");
8991 if (OSPF_IF_PARAM_CONFIGURED (params
, fast_hello
))
8992 vty_out (vty
, "minimal hello-multiplier %d",
8993 params
->fast_hello
);
8995 vty_out (vty
, "%u", params
->v_wait
);
8997 if (params
!= IF_DEF_PARAMS (ifp
))
8998 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
8999 vty_out (vty
, "%s", VTY_NEWLINE
);
9002 /* Router Priority print. */
9003 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
9004 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
9006 vty_out (vty
, " ip ospf priority %u", params
->priority
);
9007 if (params
!= IF_DEF_PARAMS (ifp
))
9008 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9009 vty_out (vty
, "%s", VTY_NEWLINE
);
9012 /* Retransmit Interval print. */
9013 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
9014 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
9016 vty_out (vty
, " ip ospf retransmit-interval %u",
9017 params
->retransmit_interval
);
9018 if (params
!= IF_DEF_PARAMS (ifp
))
9019 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9020 vty_out (vty
, "%s", VTY_NEWLINE
);
9023 /* Transmit Delay print. */
9024 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
9025 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
9027 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
9028 if (params
!= IF_DEF_PARAMS (ifp
))
9029 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9030 vty_out (vty
, "%s", VTY_NEWLINE
);
9034 if (OSPF_IF_PARAM_CONFIGURED (params
, if_area
))
9037 vty_out (vty
, " ip ospf %d area %s%s", ospf
->instance
,
9038 inet_ntoa (params
->if_area
), VTY_NEWLINE
);
9040 vty_out (vty
, " ip ospf area %s%s",
9041 inet_ntoa (params
->if_area
), VTY_NEWLINE
);
9046 ospf_bfd_write_config(vty
, params
);
9048 /* MTU ignore print. */
9049 if (OSPF_IF_PARAM_CONFIGURED (params
, mtu_ignore
) &&
9050 params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
9052 if (params
->mtu_ignore
== 0)
9053 vty_out (vty
, " no ip ospf mtu-ignore");
9055 vty_out (vty
, " ip ospf mtu-ignore");
9056 if (params
!= IF_DEF_PARAMS (ifp
))
9057 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9058 vty_out (vty
, "%s", VTY_NEWLINE
);
9065 rn
= route_top (IF_OIFS_PARAMS (ifp
));
9067 rn
= route_next (rn
);
9077 #ifdef HAVE_OPAQUE_LSA
9078 ospf_opaque_config_write_if (vty
, ifp
);
9079 #endif /* HAVE_OPAQUE_LSA */
9086 config_write_network_area (struct vty
*vty
, struct ospf
*ospf
)
9088 struct route_node
*rn
;
9089 u_char buf
[INET_ADDRSTRLEN
];
9091 /* `network area' print. */
9092 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
9095 struct ospf_network
*n
= rn
->info
;
9097 memset (buf
, 0, INET_ADDRSTRLEN
);
9099 /* Create Area ID string by specified Area ID format. */
9100 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
9101 strncpy ((char *) buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
9103 sprintf ((char *) buf
, "%lu",
9104 (unsigned long int) ntohl (n
->area_id
.s_addr
));
9106 /* Network print. */
9107 vty_out (vty
, " network %s/%d area %s%s",
9108 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
9116 config_write_ospf_area (struct vty
*vty
, struct ospf
*ospf
)
9118 struct listnode
*node
;
9119 struct ospf_area
*area
;
9120 u_char buf
[INET_ADDRSTRLEN
];
9122 /* Area configuration print. */
9123 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
9125 struct route_node
*rn1
;
9127 area_id2str ((char *) buf
, INET_ADDRSTRLEN
, area
);
9129 if (area
->auth_type
!= OSPF_AUTH_NULL
)
9131 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
9132 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
9134 vty_out (vty
, " area %s authentication message-digest%s",
9138 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
9139 vty_out (vty
, " area %s shortcut %s%s", buf
,
9140 ospf_shortcut_mode_str
[area
->shortcut_configured
],
9143 if ((area
->external_routing
== OSPF_AREA_STUB
)
9144 || (area
->external_routing
== OSPF_AREA_NSSA
)
9147 if (area
->external_routing
== OSPF_AREA_STUB
)
9148 vty_out (vty
, " area %s stub", buf
);
9149 else if (area
->external_routing
== OSPF_AREA_NSSA
)
9151 vty_out (vty
, " area %s nssa", buf
);
9152 switch (area
->NSSATranslatorRole
)
9154 case OSPF_NSSA_ROLE_NEVER
:
9155 vty_out (vty
, " translate-never");
9157 case OSPF_NSSA_ROLE_ALWAYS
:
9158 vty_out (vty
, " translate-always");
9160 case OSPF_NSSA_ROLE_CANDIDATE
:
9162 vty_out (vty
, " translate-candidate");
9166 if (area
->no_summary
)
9167 vty_out (vty
, " no-summary");
9169 vty_out (vty
, "%s", VTY_NEWLINE
);
9171 if (area
->default_cost
!= 1)
9172 vty_out (vty
, " area %s default-cost %d%s", buf
,
9173 area
->default_cost
, VTY_NEWLINE
);
9176 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
9179 struct ospf_area_range
*range
= rn1
->info
;
9181 vty_out (vty
, " area %s range %s/%d", buf
,
9182 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
9184 if (range
->cost_config
!= OSPF_AREA_RANGE_COST_UNSPEC
)
9185 vty_out (vty
, " cost %d", range
->cost_config
);
9187 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
9188 vty_out (vty
, " not-advertise");
9190 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
9191 vty_out (vty
, " substitute %s/%d",
9192 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
9194 vty_out (vty
, "%s", VTY_NEWLINE
);
9197 if (EXPORT_NAME (area
))
9198 vty_out (vty
, " area %s export-list %s%s", buf
,
9199 EXPORT_NAME (area
), VTY_NEWLINE
);
9201 if (IMPORT_NAME (area
))
9202 vty_out (vty
, " area %s import-list %s%s", buf
,
9203 IMPORT_NAME (area
), VTY_NEWLINE
);
9205 if (PREFIX_NAME_IN (area
))
9206 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
9207 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
9209 if (PREFIX_NAME_OUT (area
))
9210 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
9211 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
9218 config_write_ospf_nbr_nbma (struct vty
*vty
, struct ospf
*ospf
)
9220 struct ospf_nbr_nbma
*nbr_nbma
;
9221 struct route_node
*rn
;
9223 /* Static Neighbor configuration print. */
9224 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
9225 if ((nbr_nbma
= rn
->info
))
9227 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
9229 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
9230 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
9232 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
9233 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
9235 vty_out (vty
, "%s", VTY_NEWLINE
);
9242 config_write_virtual_link (struct vty
*vty
, struct ospf
*ospf
)
9244 struct listnode
*node
;
9245 struct ospf_vl_data
*vl_data
;
9246 u_char buf
[INET_ADDRSTRLEN
];
9248 /* Virtual-Link print */
9249 for (ALL_LIST_ELEMENTS_RO (ospf
->vlinks
, node
, vl_data
))
9251 struct listnode
*n2
;
9252 struct crypt_key
*ck
;
9253 struct ospf_interface
*oi
;
9255 if (vl_data
!= NULL
)
9257 memset (buf
, 0, INET_ADDRSTRLEN
);
9259 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
9260 strncpy ((char *) buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
9262 sprintf ((char *) buf
, "%lu",
9263 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
9264 oi
= vl_data
->vl_oi
;
9267 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
9268 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
9269 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
9270 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
9271 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
9273 inet_ntoa (vl_data
->vl_peer
),
9274 OSPF_IF_PARAM (oi
, v_hello
),
9275 OSPF_IF_PARAM (oi
, retransmit_interval
),
9276 OSPF_IF_PARAM (oi
, transmit_delay
),
9277 OSPF_IF_PARAM (oi
, v_wait
),
9280 vty_out (vty
, " area %s virtual-link %s%s", buf
,
9281 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
9283 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
9284 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
9286 inet_ntoa (vl_data
->vl_peer
),
9287 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
9290 for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
,
9292 vty_out (vty
, " area %s virtual-link %s"
9293 " message-digest-key %d md5 %s%s",
9295 inet_ntoa (vl_data
->vl_peer
),
9296 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
9306 config_write_ospf_redistribute (struct vty
*vty
, struct ospf
*ospf
)
9310 /* redistribute print. */
9311 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
9313 struct list
*red_list
;
9314 struct listnode
*node
;
9315 struct ospf_redist
*red
;
9317 red_list
= ospf
->redist
[type
];
9321 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
9323 vty_out (vty
, " redistribute %s", zebra_route_string(type
));
9325 vty_out (vty
, " %d", red
->instance
);
9327 if (red
->dmetric
.value
>= 0)
9328 vty_out (vty
, " metric %d", red
->dmetric
.value
);
9330 if (red
->dmetric
.type
== EXTERNAL_METRIC_TYPE_1
)
9331 vty_out (vty
, " metric-type 1");
9333 if (ROUTEMAP_NAME (red
))
9334 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (red
));
9336 vty_out (vty
, "%s", VTY_NEWLINE
);
9344 config_write_ospf_default_metric (struct vty
*vty
, struct ospf
*ospf
)
9346 if (ospf
->default_metric
!= -1)
9347 vty_out (vty
, " default-metric %d%s", ospf
->default_metric
,
9353 config_write_ospf_distribute (struct vty
*vty
, struct ospf
*ospf
)
9356 struct ospf_redist
*red
;
9360 /* distribute-list print. */
9361 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
9362 if (DISTRIBUTE_NAME (ospf
, type
))
9363 vty_out (vty
, " distribute-list %s out %s%s",
9364 DISTRIBUTE_NAME (ospf
, type
),
9365 zebra_route_string(type
), VTY_NEWLINE
);
9367 /* default-information print. */
9368 if (ospf
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
9370 vty_out (vty
, " default-information originate");
9371 if (ospf
->default_originate
== DEFAULT_ORIGINATE_ALWAYS
)
9372 vty_out (vty
, " always");
9374 red
= ospf_redist_lookup(ospf
, DEFAULT_ROUTE
, 0);
9377 if (red
->dmetric
.value
>= 0)
9378 vty_out (vty
, " metric %d",
9379 red
->dmetric
.value
);
9380 if (red
->dmetric
.type
== EXTERNAL_METRIC_TYPE_1
)
9381 vty_out (vty
, " metric-type 1");
9383 if (ROUTEMAP_NAME (red
))
9384 vty_out (vty
, " route-map %s",
9385 ROUTEMAP_NAME (red
));
9388 vty_out (vty
, "%s", VTY_NEWLINE
);
9397 config_write_ospf_distance (struct vty
*vty
, struct ospf
*ospf
)
9399 struct route_node
*rn
;
9400 struct ospf_distance
*odistance
;
9402 if (ospf
->distance_all
)
9403 vty_out (vty
, " distance %d%s", ospf
->distance_all
, VTY_NEWLINE
);
9405 if (ospf
->distance_intra
9406 || ospf
->distance_inter
9407 || ospf
->distance_external
)
9409 vty_out (vty
, " distance ospf");
9411 if (ospf
->distance_intra
)
9412 vty_out (vty
, " intra-area %d", ospf
->distance_intra
);
9413 if (ospf
->distance_inter
)
9414 vty_out (vty
, " inter-area %d", ospf
->distance_inter
);
9415 if (ospf
->distance_external
)
9416 vty_out (vty
, " external %d", ospf
->distance_external
);
9418 vty_out (vty
, "%s", VTY_NEWLINE
);
9421 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
9422 if ((odistance
= rn
->info
) != NULL
)
9424 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
9425 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
9426 odistance
->access_list
? odistance
->access_list
: "",
9432 /* OSPF configuration write function. */
9434 ospf_config_write (struct vty
*vty
)
9437 struct interface
*ifp
;
9438 struct ospf_interface
*oi
;
9439 struct listnode
*node
;
9442 ospf
= ospf_lookup ();
9443 if (ospf
!= NULL
&& ospf
->oi_running
)
9445 /* `router ospf' print. */
9447 vty_out (vty
, "router ospf %d%s", ospf
->instance
, VTY_NEWLINE
);
9449 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
9453 if (!ospf
->networks
)
9456 /* Router ID print. */
9457 if (ospf
->router_id_static
.s_addr
!= 0)
9458 vty_out (vty
, " ospf router-id %s%s",
9459 inet_ntoa (ospf
->router_id_static
), VTY_NEWLINE
);
9461 /* ABR type print. */
9462 if (ospf
->abr_type
!= OSPF_ABR_DEFAULT
)
9463 vty_out (vty
, " ospf abr-type %s%s",
9464 ospf_abr_type_str
[ospf
->abr_type
], VTY_NEWLINE
);
9466 /* log-adjacency-changes flag print. */
9467 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
))
9469 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
))
9470 vty_out(vty
, " log-adjacency-changes detail%s", VTY_NEWLINE
);
9474 vty_out(vty
, " no log-adjacency-changes%s", VTY_NEWLINE
);
9477 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
9478 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
9479 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
9481 /* auto-cost reference-bandwidth configuration. */
9482 if (ospf
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
9484 vty_out (vty
, "! Important: ensure reference bandwidth "
9485 "is consistent across all routers%s", VTY_NEWLINE
);
9486 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
9487 ospf
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
9490 /* SPF timers print. */
9491 if (ospf
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
9492 ospf
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
||
9493 ospf
->spf_max_holdtime
!= OSPF_SPF_MAX_HOLDTIME_DEFAULT
)
9494 vty_out (vty
, " timers throttle spf %d %d %d%s",
9495 ospf
->spf_delay
, ospf
->spf_holdtime
,
9496 ospf
->spf_max_holdtime
, VTY_NEWLINE
);
9498 /* LSA timers print. */
9499 if (ospf
->min_ls_interval
!= OSPF_MIN_LS_INTERVAL
)
9500 vty_out (vty
, " timers throttle lsa all %d%s",
9501 ospf
->min_ls_interval
, VTY_NEWLINE
);
9502 if (ospf
->min_ls_arrival
!= OSPF_MIN_LS_ARRIVAL
)
9503 vty_out (vty
, " timers lsa min-arrival %d%s",
9504 ospf
->min_ls_arrival
, VTY_NEWLINE
);
9506 /* Write multiplier print. */
9507 if (ospf
->write_oi_count
!= OSPF_WRITE_INTERFACE_COUNT_DEFAULT
)
9508 vty_out (vty
, " ospf write-multiplier %d%s",
9509 ospf
->write_oi_count
, VTY_NEWLINE
);
9511 /* Max-metric router-lsa print */
9512 config_write_stub_router (vty
, ospf
);
9514 /* SPF refresh parameters print. */
9515 if (ospf
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
9516 vty_out (vty
, " refresh timer %d%s",
9517 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
9519 /* Redistribute information print. */
9520 config_write_ospf_redistribute (vty
, ospf
);
9522 /* passive-interface print. */
9523 if (ospf
->passive_interface_default
== OSPF_IF_PASSIVE
)
9524 vty_out (vty
, " passive-interface default%s", VTY_NEWLINE
);
9526 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
9527 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
)
9528 && IF_DEF_PARAMS (ifp
)->passive_interface
!=
9529 ospf
->passive_interface_default
)
9531 vty_out (vty
, " %spassive-interface %s%s",
9532 IF_DEF_PARAMS (ifp
)->passive_interface
? "" : "no ",
9533 ifp
->name
, VTY_NEWLINE
);
9535 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
9537 if (!OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
))
9539 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi
->ifp
),
9542 if (oi
->params
->passive_interface
== IF_DEF_PARAMS (oi
->ifp
)->passive_interface
)
9545 else if (oi
->params
->passive_interface
== ospf
->passive_interface_default
)
9548 vty_out (vty
, " %spassive-interface %s %s%s",
9549 oi
->params
->passive_interface
? "" : "no ",
9551 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
9554 /* Network area print. */
9555 config_write_network_area (vty
, ospf
);
9557 /* Area config print. */
9558 config_write_ospf_area (vty
, ospf
);
9560 /* static neighbor print. */
9561 config_write_ospf_nbr_nbma (vty
, ospf
);
9563 /* Virtual-Link print. */
9564 config_write_virtual_link (vty
, ospf
);
9566 /* Default metric configuration. */
9567 config_write_ospf_default_metric (vty
, ospf
);
9569 /* Distribute-list and default-information print. */
9570 config_write_ospf_distribute (vty
, ospf
);
9572 /* Distance configuration. */
9573 config_write_ospf_distance (vty
, ospf
);
9575 #ifdef HAVE_OPAQUE_LSA
9576 ospf_opaque_config_write_router (vty
, ospf
);
9577 #endif /* HAVE_OPAQUE_LSA */
9584 ospf_vty_show_init (void)
9586 /* "show ip ospf" commands. */
9587 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
9588 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
9590 install_element (VIEW_NODE
, &show_ip_ospf_instance_cmd
);
9591 install_element (ENABLE_NODE
, &show_ip_ospf_instance_cmd
);
9593 /* "show ip ospf database" commands. */
9594 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
9595 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
9596 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
9597 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
9598 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
9599 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
9600 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
9601 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
9602 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
9603 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
9604 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
9605 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
9606 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
9607 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
9609 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_cmd
);
9610 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_id_cmd
);
9611 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_id_adv_router_cmd
);
9612 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_adv_router_cmd
);
9613 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_id_self_cmd
);
9614 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_self_cmd
);
9615 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_cmd
);
9616 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_cmd
);
9617 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_id_cmd
);
9618 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_id_adv_router_cmd
);
9619 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_adv_router_cmd
);
9620 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_id_self_cmd
);
9621 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_self_cmd
);
9622 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_cmd
);
9624 /* "show ip ospf interface" commands. */
9625 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
9626 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
9628 install_element (VIEW_NODE
, &show_ip_ospf_instance_interface_cmd
);
9629 install_element (ENABLE_NODE
, &show_ip_ospf_instance_interface_cmd
);
9631 /* "show ip ospf neighbor" commands. */
9632 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
9633 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
9634 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
9635 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
9636 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
9637 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
9638 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
9639 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
9640 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
9641 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
9642 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
9643 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
9644 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
9645 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
9647 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_int_detail_cmd
);
9648 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_int_cmd
);
9649 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_id_cmd
);
9650 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_detail_all_cmd
);
9651 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_detail_cmd
);
9652 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_cmd
);
9653 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_all_cmd
);
9654 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_int_detail_cmd
);
9655 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_int_cmd
);
9656 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_id_cmd
);
9657 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_detail_all_cmd
);
9658 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_detail_cmd
);
9659 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_cmd
);
9660 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_all_cmd
);
9662 /* "show ip ospf route" commands. */
9663 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
9664 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
9665 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
9666 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
9668 install_element (VIEW_NODE
, &show_ip_ospf_instance_route_cmd
);
9669 install_element (ENABLE_NODE
, &show_ip_ospf_instance_route_cmd
);
9670 install_element (VIEW_NODE
, &show_ip_ospf_instance_border_routers_cmd
);
9671 install_element (ENABLE_NODE
, &show_ip_ospf_instance_border_routers_cmd
);
9675 /* ospfd's interface node. */
9676 static struct cmd_node interface_node
=
9683 /* Initialization of OSPF interface. */
9685 ospf_vty_if_init (void)
9687 /* Install interface node. */
9688 install_node (&interface_node
, config_write_interface
);
9690 install_element (CONFIG_NODE
, &interface_cmd
);
9691 install_element (CONFIG_NODE
, &no_interface_cmd
);
9692 install_default (INTERFACE_NODE
);
9694 /* "description" commands. */
9695 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
9696 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
9698 /* "ip ospf authentication" commands. */
9699 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
9700 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
9701 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
9702 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
9703 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_args_addr_cmd
);
9704 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_args_cmd
);
9705 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
9706 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
9707 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
9708 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
9709 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
9710 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
9712 /* "ip ospf message-digest-key" commands. */
9713 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
9714 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
9715 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
9716 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
9718 /* "ip ospf cost" commands. */
9719 install_element (INTERFACE_NODE
, &ip_ospf_cost_u32_inet4_cmd
);
9720 install_element (INTERFACE_NODE
, &ip_ospf_cost_u32_cmd
);
9721 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_u32_cmd
);
9722 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_u32_inet4_cmd
);
9723 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_inet4_cmd
);
9724 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
9726 /* "ip ospf mtu-ignore" commands. */
9727 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_addr_cmd
);
9728 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_cmd
);
9729 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_addr_cmd
);
9730 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_cmd
);
9732 /* "ip ospf dead-interval" commands. */
9733 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
9734 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
9735 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_addr_cmd
);
9736 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_cmd
);
9737 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
9738 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
9739 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_seconds_cmd
);
9741 /* "ip ospf hello-interval" commands. */
9742 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
9743 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
9744 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
9745 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
9746 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_seconds_cmd
);
9748 /* "ip ospf network" commands. */
9749 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
9750 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
9752 /* "ip ospf priority" commands. */
9753 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
9754 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
9755 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
9756 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
9758 /* "ip ospf retransmit-interval" commands. */
9759 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
9760 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
9761 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
9762 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
9764 /* "ip ospf transmit-delay" commands. */
9765 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
9766 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
9767 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
9768 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
9770 /* "ip ospf area" commands. */
9771 install_element (INTERFACE_NODE
, &ip_ospf_area_cmd
);
9772 install_element (INTERFACE_NODE
, &no_ip_ospf_area_cmd
);
9773 install_element (INTERFACE_NODE
, &ip_ospf_instance_area_cmd
);
9774 install_element (INTERFACE_NODE
, &no_ip_ospf_instance_area_cmd
);
9776 /* These commands are compatibitliy for previous version. */
9777 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
9778 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
9779 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
9780 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
9781 install_element (INTERFACE_NODE
, &ospf_cost_u32_cmd
);
9782 install_element (INTERFACE_NODE
, &ospf_cost_u32_inet4_cmd
);
9783 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
9784 install_element (INTERFACE_NODE
, &no_ospf_cost_u32_cmd
);
9785 install_element (INTERFACE_NODE
, &no_ospf_cost_u32_inet4_cmd
);
9786 install_element (INTERFACE_NODE
, &no_ospf_cost_inet4_cmd
);
9787 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
9788 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
9789 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
9790 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
9791 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
9792 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
9793 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
9794 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
9795 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
9796 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
9797 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
9798 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
9802 ospf_vty_zebra_init (void)
9804 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
9805 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
9806 install_element (OSPF_NODE
, &ospf_redistribute_instance_source_cmd
);
9807 install_element (OSPF_NODE
, &no_ospf_redistribute_instance_source_cmd
);
9809 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
9810 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
9812 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
9813 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
9815 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
9816 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
9817 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
9819 install_element (OSPF_NODE
, &ospf_distance_cmd
);
9820 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
9821 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
9822 install_element (OSPF_NODE
, &ospf_distance_ospf_cmd
);
9824 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
9825 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
9826 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
9827 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
9831 static struct cmd_node ospf_node
=
9834 "%s(config-router)# ",
9839 ospf_interface_clear (struct interface
*ifp
)
9841 if (!if_is_operative (ifp
)) return;
9843 if (IS_DEBUG_OSPF (ism
, ISM_EVENTS
))
9844 zlog (NULL
, LOG_DEBUG
, "ISM[%s]: clear by reset", ifp
->name
);
9849 DEFUN (clear_ip_ospf_interface
,
9850 clear_ip_ospf_interface_cmd
,
9851 "clear ip ospf interface [IFNAME]",
9854 "OSPF information\n"
9855 "Interface information\n"
9858 struct interface
*ifp
;
9859 struct listnode
*node
;
9861 if (argc
== 0) /* Clear all the ospfv2 interfaces. */
9863 for (ALL_LIST_ELEMENTS_RO (iflist
, node
, ifp
))
9864 ospf_interface_clear(ifp
);
9866 else /* Interface name is specified. */
9868 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
9869 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
9871 ospf_interface_clear(ifp
);
9878 ospf_vty_clear_init (void)
9880 install_element (ENABLE_NODE
, &clear_ip_ospf_interface_cmd
);
9884 /* Install OSPF related vty commands. */
9886 ospf_vty_init (void)
9888 /* Install ospf top node. */
9889 install_node (&ospf_node
, ospf_config_write
);
9891 /* "router ospf" commands. */
9892 install_element (CONFIG_NODE
, &router_ospf_cmd
);
9893 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
9895 install_element (CONFIG_NODE
, &router_ospf_instance_cmd
);
9896 install_element (CONFIG_NODE
, &no_router_ospf_instance_cmd
);
9898 install_default (OSPF_NODE
);
9900 /* "ospf router-id" commands. */
9901 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
9902 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
9903 install_element (OSPF_NODE
, &router_ospf_id_cmd
);
9904 install_element (OSPF_NODE
, &no_router_ospf_id_cmd
);
9906 /* "passive-interface" commands. */
9907 install_element (OSPF_NODE
, &ospf_passive_interface_addr_cmd
);
9908 install_element (OSPF_NODE
, &ospf_passive_interface_cmd
);
9909 install_element (OSPF_NODE
, &ospf_passive_interface_default_cmd
);
9910 install_element (OSPF_NODE
, &no_ospf_passive_interface_addr_cmd
);
9911 install_element (OSPF_NODE
, &no_ospf_passive_interface_cmd
);
9912 install_element (OSPF_NODE
, &no_ospf_passive_interface_default_cmd
);
9914 /* "ospf abr-type" commands. */
9915 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
9916 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
9918 /* "ospf log-adjacency-changes" commands. */
9919 install_element (OSPF_NODE
, &ospf_log_adjacency_changes_cmd
);
9920 install_element (OSPF_NODE
, &ospf_log_adjacency_changes_detail_cmd
);
9921 install_element (OSPF_NODE
, &no_ospf_log_adjacency_changes_cmd
);
9922 install_element (OSPF_NODE
, &no_ospf_log_adjacency_changes_detail_cmd
);
9924 /* "ospf rfc1583-compatible" commands. */
9925 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
9926 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
9927 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
9928 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
9930 /* "network area" commands. */
9931 install_element (OSPF_NODE
, &ospf_network_area_cmd
);
9932 install_element (OSPF_NODE
, &no_ospf_network_area_cmd
);
9934 /* "area authentication" commands. */
9935 install_element (OSPF_NODE
, &ospf_area_authentication_message_digest_cmd
);
9936 install_element (OSPF_NODE
, &ospf_area_authentication_cmd
);
9937 install_element (OSPF_NODE
, &no_ospf_area_authentication_cmd
);
9939 /* "area range" commands. */
9940 install_element (OSPF_NODE
, &ospf_area_range_cmd
);
9941 install_element (OSPF_NODE
, &ospf_area_range_advertise_cmd
);
9942 install_element (OSPF_NODE
, &ospf_area_range_cost_cmd
);
9943 install_element (OSPF_NODE
, &ospf_area_range_advertise_cost_cmd
);
9944 install_element (OSPF_NODE
, &ospf_area_range_not_advertise_cmd
);
9945 install_element (OSPF_NODE
, &no_ospf_area_range_cmd
);
9946 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cmd
);
9947 install_element (OSPF_NODE
, &no_ospf_area_range_cost_cmd
);
9948 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cost_cmd
);
9949 install_element (OSPF_NODE
, &ospf_area_range_substitute_cmd
);
9950 install_element (OSPF_NODE
, &no_ospf_area_range_substitute_cmd
);
9952 /* "area virtual-link" commands. */
9953 install_element (OSPF_NODE
, &ospf_area_vlink_cmd
);
9954 install_element (OSPF_NODE
, &no_ospf_area_vlink_cmd
);
9956 install_element (OSPF_NODE
, &ospf_area_vlink_param1_cmd
);
9957 install_element (OSPF_NODE
, &no_ospf_area_vlink_param1_cmd
);
9959 install_element (OSPF_NODE
, &ospf_area_vlink_param2_cmd
);
9960 install_element (OSPF_NODE
, &no_ospf_area_vlink_param2_cmd
);
9962 install_element (OSPF_NODE
, &ospf_area_vlink_param3_cmd
);
9963 install_element (OSPF_NODE
, &no_ospf_area_vlink_param3_cmd
);
9965 install_element (OSPF_NODE
, &ospf_area_vlink_param4_cmd
);
9966 install_element (OSPF_NODE
, &no_ospf_area_vlink_param4_cmd
);
9968 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_cmd
);
9969 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_cmd
);
9970 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_cmd
);
9972 install_element (OSPF_NODE
, &ospf_area_vlink_md5_cmd
);
9973 install_element (OSPF_NODE
, &no_ospf_area_vlink_md5_cmd
);
9975 install_element (OSPF_NODE
, &ospf_area_vlink_authkey_cmd
);
9976 install_element (OSPF_NODE
, &no_ospf_area_vlink_authkey_cmd
);
9978 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_authkey_cmd
);
9979 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_authkey_cmd
);
9980 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_authkey_cmd
);
9982 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_md5_cmd
);
9983 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_md5_cmd
);
9984 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_md5_cmd
);
9986 /* "area stub" commands. */
9987 install_element (OSPF_NODE
, &ospf_area_stub_no_summary_cmd
);
9988 install_element (OSPF_NODE
, &ospf_area_stub_cmd
);
9989 install_element (OSPF_NODE
, &no_ospf_area_stub_no_summary_cmd
);
9990 install_element (OSPF_NODE
, &no_ospf_area_stub_cmd
);
9992 /* "area nssa" commands. */
9993 install_element (OSPF_NODE
, &ospf_area_nssa_cmd
);
9994 install_element (OSPF_NODE
, &ospf_area_nssa_translate_no_summary_cmd
);
9995 install_element (OSPF_NODE
, &ospf_area_nssa_translate_cmd
);
9996 install_element (OSPF_NODE
, &ospf_area_nssa_no_summary_cmd
);
9997 install_element (OSPF_NODE
, &no_ospf_area_nssa_cmd
);
9998 install_element (OSPF_NODE
, &no_ospf_area_nssa_no_summary_cmd
);
10000 install_element (OSPF_NODE
, &ospf_area_default_cost_cmd
);
10001 install_element (OSPF_NODE
, &no_ospf_area_default_cost_cmd
);
10003 install_element (OSPF_NODE
, &ospf_area_shortcut_cmd
);
10004 install_element (OSPF_NODE
, &no_ospf_area_shortcut_cmd
);
10006 install_element (OSPF_NODE
, &ospf_area_export_list_cmd
);
10007 install_element (OSPF_NODE
, &no_ospf_area_export_list_cmd
);
10009 install_element (OSPF_NODE
, &ospf_area_filter_list_cmd
);
10010 install_element (OSPF_NODE
, &no_ospf_area_filter_list_cmd
);
10012 install_element (OSPF_NODE
, &ospf_area_import_list_cmd
);
10013 install_element (OSPF_NODE
, &no_ospf_area_import_list_cmd
);
10015 /* SPF timer commands */
10016 install_element (OSPF_NODE
, &ospf_timers_throttle_spf_cmd
);
10017 install_element (OSPF_NODE
, &no_ospf_timers_throttle_spf_cmd
);
10018 install_element (OSPF_NODE
, &no_ospf_timers_throttle_spf_val_cmd
);
10020 /* LSA timers commands */
10021 install_element (OSPF_NODE
, &ospf_timers_min_ls_interval_cmd
);
10022 install_element (OSPF_NODE
, &no_ospf_timers_min_ls_interval_cmd
);
10023 install_element (OSPF_NODE
, &ospf_timers_min_ls_arrival_cmd
);
10024 install_element (OSPF_NODE
, &no_ospf_timers_min_ls_arrival_cmd
);
10025 install_element (OSPF_NODE
, &ospf_timers_lsa_cmd
);
10026 install_element (OSPF_NODE
, &no_ospf_timers_lsa_cmd
);
10027 install_element (OSPF_NODE
, &no_ospf_timers_lsa_val_cmd
);
10029 /* refresh timer commands */
10030 install_element (OSPF_NODE
, &ospf_refresh_timer_cmd
);
10031 install_element (OSPF_NODE
, &no_ospf_refresh_timer_val_cmd
);
10032 install_element (OSPF_NODE
, &no_ospf_refresh_timer_cmd
);
10034 /* max-metric commands */
10035 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_admin_cmd
);
10036 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_admin_cmd
);
10037 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_startup_cmd
);
10038 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_startup_cmd
);
10039 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_shutdown_cmd
);
10040 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_shutdown_cmd
);
10042 /* reference bandwidth commands */
10043 install_element (OSPF_NODE
, &ospf_auto_cost_reference_bandwidth_cmd
);
10044 install_element (OSPF_NODE
, &no_ospf_auto_cost_reference_bandwidth_cmd
);
10046 /* "neighbor" commands. */
10047 install_element (OSPF_NODE
, &ospf_neighbor_cmd
);
10048 install_element (OSPF_NODE
, &ospf_neighbor_priority_poll_interval_cmd
);
10049 install_element (OSPF_NODE
, &ospf_neighbor_priority_cmd
);
10050 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_cmd
);
10051 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_priority_cmd
);
10052 install_element (OSPF_NODE
, &no_ospf_neighbor_cmd
);
10053 install_element (OSPF_NODE
, &no_ospf_neighbor_priority_cmd
);
10054 install_element (OSPF_NODE
, &no_ospf_neighbor_poll_interval_cmd
);
10056 /* write multiplier commands */
10057 install_element (OSPF_NODE
, &ospf_write_multiplier_cmd
);
10058 install_element (OSPF_NODE
, &no_ospf_write_multiplier_cmd
);
10059 install_element (OSPF_NODE
, &write_multiplier_cmd
);
10060 install_element (OSPF_NODE
, &no_write_multiplier_cmd
);
10062 /* Init interface related vty commands. */
10063 ospf_vty_if_init ();
10065 /* Init zebra related vty commands. */
10066 ospf_vty_zebra_init ();