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
))
148 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
149 * "router ospf <1-65535>",
150 * "Enable a routing process\n"
151 * "Start OSPF configuration\n"
158 "Enable a routing process\n"
159 "Start OSPF configuration\n")
162 u_short instance
= 0;
164 ospf
= ospf_lookup();
167 vty_out (vty
, "There isn't active ospf instance %s", VTY_NEWLINE
);
171 vty
->node
= OSPF_NODE
;
174 VTY_GET_INTEGER ("Instance", instance
, argv
[0]);
176 /* The following logic to set the vty->index is in place to be able
177 to ignore the commands which dont belong to this instance. */
178 if (ospf
->instance
!= instance
)
182 if (IS_DEBUG_OSPF_EVENT
)
183 zlog_debug ("Config command 'router ospf %d' received", instance
);
184 ospf
->oi_running
= 1;
186 ospf_router_id_update (ospf
);
194 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
195 * "no router ospf <1-65535>",
197 * "Enable a routing process\n"
198 * "Start OSPF configuration\n"
202 DEFUN (no_router_ospf
,
206 "Enable a routing process\n"
207 "Start OSPF configuration\n")
210 u_short instance
= 0;
213 VTY_GET_INTEGER ("Instance", instance
, argv
[3]->arg
);
215 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
)
224 DEFUN (ospf_router_id
,
226 "ospf router-id A.B.C.D",
227 "OSPF specific commands\n"
228 "router-id for the OSPF process\n"
229 "OSPF router-id in IP address format\n")
232 struct ospf
*ospf
= vty
->index
;
233 struct listnode
*node
;
234 struct ospf_area
*area
;
235 struct in_addr router_id
;
241 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &router_id
);
244 vty_out (vty
, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE
);
248 ospf
->router_id_static
= router_id
;
250 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
253 vty_out (vty
, "For this router-id change to take effect,"
254 " save config and restart ospfd%s", VTY_NEWLINE
);
258 ospf_router_id_update (ospf
);
263 ALIAS_HIDDEN (ospf_router_id
,
264 ospf_router_id_old_cmd
,
266 "router-id for the OSPF process\n"
267 "OSPF router-id in IP address format\n")
270 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
271 * "no ospf router-id A.B.C.D",
273 * "OSPF specific commands\n"
274 * "router-id for the OSPF process\n"
275 * "OSPF router-id in IP address format\n"
278 DEFUN (no_ospf_router_id
,
279 no_ospf_router_id_cmd
,
282 "OSPF specific commands\n"
283 "router-id for the OSPF process\n")
285 struct ospf
*ospf
= vty
->index
;
286 struct listnode
*node
;
287 struct ospf_area
*area
;
292 ospf
->router_id_static
.s_addr
= 0;
294 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
297 vty_out (vty
, "For this router-id change to take effect,"
298 " save config and restart ospfd%s", VTY_NEWLINE
);
302 ospf_router_id_update (ospf
);
309 ospf_passive_interface_default (struct ospf
*ospf
, u_char newval
)
312 struct interface
*ifp
;
313 struct ospf_interface
*oi
;
315 ospf
->passive_interface_default
= newval
;
317 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, ln
, ifp
))
320 OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
))
321 UNSET_IF_PARAM (IF_DEF_PARAMS (ifp
), passive_interface
);
323 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, ln
, oi
))
325 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
))
326 UNSET_IF_PARAM (oi
->params
, passive_interface
);
327 /* update multicast memberships */
328 ospf_if_set_multicast(oi
);
333 ospf_passive_interface_update_addr (struct ospf
*ospf
, struct interface
*ifp
,
334 struct ospf_if_params
*params
, u_char value
,
339 params
->passive_interface
= value
;
340 if (params
!= IF_DEF_PARAMS (ifp
))
342 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
))
343 dflt
= IF_DEF_PARAMS (ifp
)->passive_interface
;
345 dflt
= ospf
->passive_interface_default
;
348 SET_IF_PARAM (params
, passive_interface
);
350 UNSET_IF_PARAM (params
, passive_interface
);
352 ospf_free_if_params (ifp
, addr
);
353 ospf_if_update_params (ifp
, addr
);
358 ospf_passive_interface_update (struct ospf
*ospf
, struct interface
*ifp
,
359 struct ospf_if_params
*params
, u_char value
)
361 params
->passive_interface
= value
;
362 if (params
== IF_DEF_PARAMS (ifp
))
364 if (value
!= ospf
->passive_interface_default
)
365 SET_IF_PARAM (params
, passive_interface
);
367 UNSET_IF_PARAM (params
, passive_interface
);
372 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
373 * "passive-interface IFNAME",
374 * "Suppress routing updates on an interface\n"
375 * "Interface's name\n"
377 * "passive-interface default",
378 * "Suppress routing updates on an interface\n"
379 * "Suppress routing updates on interfaces by default\n"
382 DEFUN (ospf_passive_interface
,
383 ospf_passive_interface_addr_cmd
,
384 "passive-interface IFNAME A.B.C.D",
385 "Suppress routing updates on an interface\n"
386 "Interface's name\n")
389 struct interface
*ifp
;
390 struct in_addr addr
= { .s_addr
= INADDR_ANY
};
392 struct ospf_if_params
*params
;
393 struct route_node
*rn
;
394 struct ospf
*ospf
= vty
->index
;
401 ospf_passive_interface_default (ospf
, OSPF_IF_PASSIVE
);
405 ifp
= if_get_by_name (argv
[idx_ipv4
]->arg
);
407 params
= IF_DEF_PARAMS (ifp
);
411 ret
= inet_aton(argv
[1], &addr
);
414 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
419 params
= ospf_get_if_params (ifp
, addr
);
420 ospf_if_update_params (ifp
, addr
);
421 ospf_passive_interface_update_addr (ospf
, ifp
, params
,
422 OSPF_IF_PASSIVE
, addr
);
425 ospf_passive_interface_update (ospf
, ifp
, params
, OSPF_IF_PASSIVE
);
427 /* XXX We should call ospf_if_set_multicast on exactly those
428 * interfaces for which the passive property changed. It is too much
429 * work to determine this set, so we do this for every interface.
430 * This is safe and reasonable because ospf_if_set_multicast uses a
431 * record of joined groups to avoid systems calls if the desired
432 * memberships match the current memership.
435 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
437 struct ospf_interface
*oi
= rn
->info
;
439 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_PASSIVE
))
440 ospf_if_set_multicast(oi
);
443 * XXX It is not clear what state transitions the interface needs to
444 * undergo when going from active to passive. Fixing this will
445 * require precise identification of interfaces having such a
455 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
456 * "no passive-interface default",
458 * "Allow routing updates on an interface\n"
459 * "Allow routing updates on interfaces by default\n"
461 * "no passive-interface IFNAME",
463 * "Allow routing updates on an interface\n"
464 * "Interface's name\n"
467 DEFUN (no_ospf_passive_interface
,
468 no_ospf_passive_interface_addr_cmd
,
469 "no passive-interface IFNAME A.B.C.D",
471 "Allow routing updates on an interface\n"
472 "Interface's name\n")
475 struct interface
*ifp
;
476 struct in_addr addr
= { .s_addr
= INADDR_ANY
};
477 struct ospf_if_params
*params
;
479 struct route_node
*rn
;
480 struct ospf
*ospf
= vty
->index
;
487 ospf_passive_interface_default (ospf
, OSPF_IF_ACTIVE
);
491 ifp
= if_get_by_name (argv
[idx_ipv4
]->arg
);
493 params
= IF_DEF_PARAMS (ifp
);
497 ret
= inet_aton(argv
[1], &addr
);
500 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
505 params
= ospf_lookup_if_params (ifp
, addr
);
508 ospf_passive_interface_update_addr (ospf
, ifp
, params
, OSPF_IF_ACTIVE
,
511 ospf_passive_interface_update (ospf
, ifp
, params
, OSPF_IF_ACTIVE
);
513 /* XXX We should call ospf_if_set_multicast on exactly those
514 * interfaces for which the passive property changed. It is too much
515 * work to determine this set, so we do this for every interface.
516 * This is safe and reasonable because ospf_if_set_multicast uses a
517 * record of joined groups to avoid systems calls if the desired
518 * memberships match the current memership.
520 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
522 struct ospf_interface
*oi
= rn
->info
;
524 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_ACTIVE
))
525 ospf_if_set_multicast(oi
);
533 DEFUN (ospf_network_area
,
534 ospf_network_area_cmd
,
535 "network A.B.C.D/M area <A.B.C.D|(0-4294967295)>",
536 "Enable routing on an IP network\n"
537 "OSPF network prefix\n"
538 "Set the OSPF area ID\n"
539 "OSPF area ID in IP address format\n"
540 "OSPF area ID as a decimal value\n")
542 int idx_ipv4_prefixlen
= 1;
543 int idx_ipv4_number
= 3;
544 struct ospf
*ospf
= vty
->index
;
545 struct prefix_ipv4 p
;
546 struct in_addr area_id
;
554 vty_out (vty
, "The network command is not supported in multi-instance ospf%s",
559 if (ospf
->if_ospf_cli_count
> 0)
561 vty_out (vty
, "Please remove all ip ospf area x.x.x.x commands first.%s",
566 /* Get network prefix and Area ID. */
567 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[idx_ipv4_prefixlen
]->arg
);
568 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
570 ret
= ospf_network_set (ospf
, &p
, area_id
);
573 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
580 DEFUN (no_ospf_network_area
,
581 no_ospf_network_area_cmd
,
582 "no network A.B.C.D/M area <A.B.C.D|(0-4294967295)>",
584 "Enable routing on an IP network\n"
585 "OSPF network prefix\n"
586 "Set the OSPF area ID\n"
587 "OSPF area ID in IP address format\n"
588 "OSPF area ID as a decimal value\n")
590 int idx_ipv4_prefixlen
= 2;
591 int idx_ipv4_number
= 4;
592 struct ospf
*ospf
= (struct ospf
*) vty
->index
;
593 struct prefix_ipv4 p
;
594 struct in_addr area_id
;
602 vty_out (vty
, "The network command is not supported in multi-instance ospf%s",
607 /* Get network prefix and Area ID. */
608 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[idx_ipv4_prefixlen
]->arg
);
609 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
611 ret
= ospf_network_unset (ospf
, &p
, area_id
);
614 vty_out (vty
, "Can't find specified network area configuration.%s",
624 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
625 * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
626 * "OSPF area parameters\n"
627 * "OSPF area ID in IP address format\n"
628 * "OSPF area ID as a decimal value\n"
629 * "OSPF area range for route advertise (default)\n"
630 * "Area range prefix\n"
631 * "Advertise this range (default)\n"
633 * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
634 * "OSPF area parameters\n"
635 * "OSPF area ID in IP address format\n"
636 * "OSPF area ID as a decimal value\n"
637 * "Summarize routes matching address/mask (border routers only)\n"
638 * "Area range prefix\n"
639 * "User specified metric for this range\n"
640 * "Advertised metric for this range\n"
642 * "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
643 * "OSPF area parameters\n"
644 * "OSPF area ID in IP address format\n"
645 * "OSPF area ID as a decimal value\n"
646 * "Summarize routes matching address/mask (border routers only)\n"
647 * "Area range prefix\n"
648 * "Advertise this range (default)\n"
649 * "User specified metric for this range\n"
650 * "Advertised metric for this range\n"
653 DEFUN (ospf_area_range
,
655 "area <A.B.C.D|(0-4294967295)> range A.B.C.D/M",
656 "OSPF area parameters\n"
657 "OSPF area ID in IP address format\n"
658 "OSPF area ID as a decimal value\n"
659 "Summarize routes matching address/mask (border routers only)\n"
660 "Area range prefix\n")
662 int idx_ipv4_number
= 1;
663 int idx_ipv4_prefixlen
= 3;
664 struct ospf
*ospf
= vty
->index
;
665 struct prefix_ipv4 p
;
666 struct in_addr area_id
;
673 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
674 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[idx_ipv4_prefixlen
]->arg
);
676 ospf_area_range_set (ospf
, area_id
, &p
, OSPF_AREA_RANGE_ADVERTISE
);
679 VTY_GET_INTEGER ("range cost", cost
, argv
[2]);
680 ospf_area_range_cost_set (ospf
, area_id
, &p
, cost
);
689 DEFUN (ospf_area_range_not_advertise
,
690 ospf_area_range_not_advertise_cmd
,
691 "area <A.B.C.D|(0-4294967295)> range A.B.C.D/M not-advertise",
692 "OSPF area parameters\n"
693 "OSPF area ID in IP address format\n"
694 "OSPF area ID as a decimal value\n"
695 "Summarize routes matching address/mask (border routers only)\n"
696 "Area range prefix\n"
697 "DoNotAdvertise this range\n")
699 int idx_ipv4_number
= 1;
700 int idx_ipv4_prefixlen
= 3;
701 struct ospf
*ospf
= vty
->index
;
702 struct prefix_ipv4 p
;
703 struct in_addr area_id
;
709 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
710 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[idx_ipv4_prefixlen
]->arg
);
712 ospf_area_range_set (ospf
, area_id
, &p
, 0);
718 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
719 * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
721 * "OSPF area parameters\n"
722 * "OSPF area ID in IP address format\n"
723 * "OSPF area ID as a decimal value\n"
724 * "Summarize routes matching address/mask (border routers only)\n"
725 * "Area range prefix\n"
726 * "Advertise this range (default)\n"
727 * "DoNotAdvertise this range\n"
729 * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
731 * "OSPF area parameters\n"
732 * "OSPF area ID in IP address format\n"
733 * "OSPF area ID as a decimal value\n"
734 * "Summarize routes matching address/mask (border routers only)\n"
735 * "Area range prefix\n"
736 * "Advertise this range (default)\n"
737 * "User specified metric for this range\n"
738 * "Advertised metric for this range\n"
740 * "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
742 * "OSPF area parameters\n"
743 * "OSPF area ID in IP address format\n"
744 * "OSPF area ID as a decimal value\n"
745 * "Summarize routes matching address/mask (border routers only)\n"
746 * "Area range prefix\n"
747 * "User specified metric for this range\n"
748 * "Advertised metric for this range\n"
751 DEFUN (no_ospf_area_range
,
752 no_ospf_area_range_cmd
,
753 "no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M",
755 "OSPF area parameters\n"
756 "OSPF area ID in IP address format\n"
757 "OSPF area ID as a decimal value\n"
758 "Summarize routes matching address/mask (border routers only)\n"
759 "Area range prefix\n")
761 int idx_ipv4_number
= 2;
762 int idx_ipv4_prefixlen
= 4;
763 struct ospf
*ospf
= vty
->index
;
764 struct prefix_ipv4 p
;
765 struct in_addr area_id
;
771 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
772 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[idx_ipv4_prefixlen
]->arg
);
774 ospf_area_range_unset (ospf
, area_id
, &p
);
782 DEFUN (ospf_area_range_substitute
,
783 ospf_area_range_substitute_cmd
,
784 "area <A.B.C.D|(0-4294967295)> range A.B.C.D/M substitute A.B.C.D/M",
785 "OSPF area parameters\n"
786 "OSPF area ID in IP address format\n"
787 "OSPF area ID as a decimal value\n"
788 "Summarize routes matching address/mask (border routers only)\n"
789 "Area range prefix\n"
790 "Announce area range as another prefix\n"
791 "Network prefix to be announced instead of range\n")
793 int idx_ipv4_number
= 1;
794 int idx_ipv4_prefixlen
= 3;
795 int idx_ipv4_prefixlen_2
= 5;
796 struct ospf
*ospf
= vty
->index
;
797 struct prefix_ipv4 p
, s
;
798 struct in_addr area_id
;
804 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
805 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[idx_ipv4_prefixlen
]->arg
);
806 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[idx_ipv4_prefixlen_2
]->arg
);
808 ospf_area_range_substitute_set (ospf
, area_id
, &p
, &s
);
813 DEFUN (no_ospf_area_range_substitute
,
814 no_ospf_area_range_substitute_cmd
,
815 "no area <A.B.C.D|(0-4294967295)> range A.B.C.D/M substitute A.B.C.D/M",
817 "OSPF area parameters\n"
818 "OSPF area ID in IP address format\n"
819 "OSPF area ID as a decimal value\n"
820 "Summarize routes matching address/mask (border routers only)\n"
821 "Area range prefix\n"
822 "Announce area range as another prefix\n"
823 "Network prefix to be announced instead of range\n")
825 int idx_ipv4_number
= 2;
826 int idx_ipv4_prefixlen
= 4;
827 int idx_ipv4_prefixlen_2
= 6;
828 struct ospf
*ospf
= vty
->index
;
829 struct prefix_ipv4 p
, s
;
830 struct in_addr area_id
;
836 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
837 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[idx_ipv4_prefixlen
]->arg
);
838 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[idx_ipv4_prefixlen_2
]->arg
);
840 ospf_area_range_substitute_unset (ospf
, area_id
, &p
);
846 /* Command Handler Logic in VLink stuff is delicate!!
848 ALTER AT YOUR OWN RISK!!!!
850 Various dummy values are used to represent 'NoChange' state for
851 VLink configuration NOT being changed by a VLink command, and
852 special syntax is used within the command strings so that the
853 typed in command verbs can be seen in the configuration command
854 bacckend handler. This is to drastically reduce the verbeage
855 required to coe up with a reasonably compatible Cisco VLink command
857 - Matthew Grant <grantma@anathoth.gen.nz>
858 Wed, 21 Feb 2001 15:13:52 +1300
862 /* Configuration data for virtual links
864 struct ospf_vl_config_data
{
865 struct vty
*vty
; /* vty stuff */
866 struct in_addr area_id
; /* area ID from command line */
867 int format
; /* command line area ID format */
868 struct in_addr vl_peer
; /* command line vl_peer */
869 int auth_type
; /* Authehntication type, if given */
870 char *auth_key
; /* simple password if present */
871 int crypto_key_id
; /* Cryptographic key ID */
872 char *md5_key
; /* MD5 authentication key */
873 int hello_interval
; /* Obvious what these are... */
874 int retransmit_interval
;
880 ospf_vl_config_data_init (struct ospf_vl_config_data
*vl_config
,
883 memset (vl_config
, 0, sizeof (struct ospf_vl_config_data
));
884 vl_config
->auth_type
= OSPF_AUTH_CMD_NOTSEEN
;
885 vl_config
->vty
= vty
;
888 static struct ospf_vl_data
*
889 ospf_find_vl_data (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
891 struct ospf_area
*area
;
892 struct ospf_vl_data
*vl_data
;
894 struct in_addr area_id
;
896 vty
= vl_config
->vty
;
897 area_id
= vl_config
->area_id
;
899 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
902 "Configuring VLs over the backbone is not allowed%s",
906 area
= ospf_area_get (ospf
, area_id
, vl_config
->format
);
908 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
910 if (vl_config
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
911 vty_out (vty
, "Area %s is %s%s",
913 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
916 vty_out (vty
, "Area %ld is %s%s",
917 (u_long
)ntohl (area_id
.s_addr
),
918 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
923 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
->vl_peer
)) == NULL
)
925 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
926 if (vl_data
->vl_oi
== NULL
)
928 vl_data
->vl_oi
= ospf_vl_new (ospf
, vl_data
);
929 ospf_vl_add (ospf
, vl_data
);
930 ospf_spf_calculate_schedule (ospf
, SPF_FLAG_CONFIG_CHANGE
);
938 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
939 struct ospf_vl_config_data
*vl_config
)
941 struct crypt_key
*ck
;
943 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
945 vty
= vl_config
->vty
;
947 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
949 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
950 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
953 if (vl_config
->auth_key
)
955 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
956 strncpy ((char *) IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
957 OSPF_AUTH_SIMPLE_SIZE
);
959 else if (vl_config
->md5_key
)
961 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
964 vty_out (vty
, "OSPF: Key %d already exists%s",
965 vl_config
->crypto_key_id
, VTY_NEWLINE
);
968 ck
= ospf_crypt_key_new ();
969 ck
->key_id
= vl_config
->crypto_key_id
;
970 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
971 strncpy ((char *) ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
973 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
975 else if (vl_config
->crypto_key_id
!= 0)
979 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
980 vl_config
->crypto_key_id
) == NULL
)
982 vty_out (vty
, "OSPF: Key %d does not exist%s",
983 vl_config
->crypto_key_id
, VTY_NEWLINE
);
987 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
995 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
996 struct ospf_vl_config_data
*vl_config
)
998 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
999 /* Virtual Link data initialised to defaults, so only set
1001 if (vl_config
->hello_interval
)
1003 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
1004 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
1007 if (vl_config
->dead_interval
)
1009 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
1010 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
1013 if (vl_config
->retransmit_interval
)
1015 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
1016 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
1019 if (vl_config
->transmit_delay
)
1021 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
1022 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
1030 /* The business end of all of the above */
1032 ospf_vl_set (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
1034 struct ospf_vl_data
*vl_data
;
1037 vl_data
= ospf_find_vl_data (ospf
, vl_config
);
1041 /* Process this one first as it can have a fatal result, which can
1042 only logically occur if the virtual link exists already
1043 Thus a command error does not result in a change to the
1044 running configuration such as unexpectedly altered timer
1046 ret
= ospf_vl_set_security (vl_data
, vl_config
);
1047 if (ret
!= CMD_SUCCESS
)
1050 /* Set any time based parameters, these area already range checked */
1052 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
1053 if (ret
!= CMD_SUCCESS
)
1060 /* This stuff exists to make specifying all the alias commands A LOT simpler
1062 #define VLINK_HELPSTR_IPADDR \
1063 "OSPF area parameters\n" \
1064 "OSPF area ID in IP address format\n" \
1065 "OSPF area ID as a decimal value\n" \
1066 "Configure a virtual link\n" \
1067 "Router ID of the remote ABR\n"
1069 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
1070 "Enable authentication on this virtual link\n" \
1073 #define VLINK_HELPSTR_AUTHTYPE_ALL \
1074 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
1075 "Use null authentication\n" \
1076 "Use message-digest authentication\n"
1078 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
1079 "Time between HELLO packets\n" \
1080 "Time between retransmitting lost link state advertisements\n" \
1081 "Link state transmit delay\n" \
1082 "Interval after which a neighbor is declared dead\n"
1084 #define VLINK_HELPSTR_TIME_PARAM \
1085 VLINK_HELPSTR_TIME_PARAM_NOSECS \
1088 #define VLINK_HELPSTR_AUTH_SIMPLE \
1089 "Authentication password (key)\n" \
1090 "The OSPF password (key)"
1092 #define VLINK_HELPSTR_AUTH_MD5 \
1093 "Message digest authentication password (key)\n" \
1096 "Use MD5 algorithm\n" \
1097 "The OSPF password (key)"
1100 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1101 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1102 * "(authentication|) (message-digest|null) "
1103 * "(authentication-key|) AUTH_KEY",
1104 * VLINK_HELPSTR_IPADDR
1105 * VLINK_HELPSTR_AUTHTYPE_ALL
1106 * VLINK_HELPSTR_AUTH_SIMPLE
1108 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1109 * "(authentication|) "
1110 * "(authentication-key|) AUTH_KEY",
1111 * VLINK_HELPSTR_IPADDR
1112 * VLINK_HELPSTR_AUTHTYPE_SIMPLE
1113 * VLINK_HELPSTR_AUTH_SIMPLE
1115 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1116 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1117 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1118 * VLINK_HELPSTR_IPADDR
1119 * VLINK_HELPSTR_TIME_PARAM
1120 * VLINK_HELPSTR_TIME_PARAM
1122 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1123 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1124 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1125 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1126 * VLINK_HELPSTR_IPADDR
1127 * VLINK_HELPSTR_TIME_PARAM
1128 * VLINK_HELPSTR_TIME_PARAM
1129 * VLINK_HELPSTR_TIME_PARAM
1131 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1132 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1133 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1134 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1135 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1136 * VLINK_HELPSTR_IPADDR
1137 * VLINK_HELPSTR_TIME_PARAM
1138 * VLINK_HELPSTR_TIME_PARAM
1139 * VLINK_HELPSTR_TIME_PARAM
1140 * VLINK_HELPSTR_TIME_PARAM
1142 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1143 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1144 * VLINK_HELPSTR_IPADDR
1145 * VLINK_HELPSTR_TIME_PARAM
1147 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1148 * "(authentication|) (message-digest|null)",
1149 * VLINK_HELPSTR_IPADDR
1150 * VLINK_HELPSTR_AUTHTYPE_ALL
1152 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1153 * "(message-digest-key|) <1-255> md5 KEY",
1154 * VLINK_HELPSTR_IPADDR
1155 * VLINK_HELPSTR_AUTH_MD5
1157 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1158 * "(authentication|) "
1159 * "(message-digest-key|) <1-255> md5 KEY",
1160 * VLINK_HELPSTR_IPADDR
1161 * VLINK_HELPSTR_AUTHTYPE_SIMPLE
1162 * VLINK_HELPSTR_AUTH_MD5
1164 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1165 * "(authentication|) (message-digest|null) "
1166 * "(message-digest-key|) <1-255> md5 KEY",
1167 * VLINK_HELPSTR_IPADDR
1168 * VLINK_HELPSTR_AUTHTYPE_ALL
1169 * VLINK_HELPSTR_AUTH_MD5
1171 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1172 * "(authentication|)",
1173 * VLINK_HELPSTR_IPADDR
1174 * VLINK_HELPSTR_AUTHTYPE_SIMPLE
1176 * "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1177 * "(authentication-key|) AUTH_KEY",
1178 * VLINK_HELPSTR_IPADDR
1179 * VLINK_HELPSTR_AUTH_SIMPLE
1182 DEFUN (ospf_area_vlink
,
1183 ospf_area_vlink_cmd
,
1184 "area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D",
1185 VLINK_HELPSTR_IPADDR
)
1187 int idx_ipv4_number
= 1;
1189 struct ospf
*ospf
= vty
->index
;
1190 struct ospf_vl_config_data vl_config
;
1191 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1192 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
1199 ospf_vl_config_data_init(&vl_config
, vty
);
1201 /* Read off first 2 parameters and check them */
1202 ret
= ospf_str2area_id (argv
[idx_ipv4_number
]->arg
, &vl_config
.area_id
, &vl_config
.format
);
1205 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1209 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &vl_config
.vl_peer
);
1212 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1219 /* Thats all folks! - BUGS B. strikes again!!!*/
1221 return ospf_vl_set (ospf
, &vl_config
);
1224 /* Deal with other parameters */
1225 for (i
=2; i
< argc
; i
++)
1228 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1234 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1236 /* authentication-key - this option can occur anywhere on
1237 command line. At start of command line
1238 must check for authentication option. */
1239 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1240 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
1241 vl_config
.auth_key
= auth_key
;
1244 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1246 /* authentication - this option can only occur at start
1248 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
1251 if (strncmp (argv
[i
+1], "n", 1) == 0)
1253 /* "authentication null" */
1254 vl_config
.auth_type
= OSPF_AUTH_NULL
;
1257 else if (strncmp (argv
[i
+1], "m", 1) == 0
1258 && strcmp (argv
[i
+1], "message-digest-") != 0)
1260 /* "authentication message-digest" */
1261 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1269 /* message-digest-key */
1271 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1272 if (vl_config
.crypto_key_id
< 0)
1275 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
1276 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
1277 vl_config
.md5_key
= md5_key
;
1281 /* Hello interval */
1283 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
1284 if (vl_config
.hello_interval
< 0)
1289 /* Retransmit Interval */
1291 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
1292 if (vl_config
.retransmit_interval
< 0)
1297 /* Transmit Delay */
1299 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
1300 if (vl_config
.transmit_delay
< 0)
1307 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
1308 if (vl_config
.dead_interval
< 0)
1315 /* Action configuration */
1317 return ospf_vl_set (ospf
, &vl_config
);
1322 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1323 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1324 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1325 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1326 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1328 * VLINK_HELPSTR_IPADDR
1329 * VLINK_HELPSTR_TIME_PARAM
1330 * VLINK_HELPSTR_TIME_PARAM
1331 * VLINK_HELPSTR_TIME_PARAM
1333 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1334 * "(authentication|) "
1335 * "(message-digest-key|) <1-255> md5 KEY",
1337 * VLINK_HELPSTR_IPADDR
1338 * VLINK_HELPSTR_AUTHTYPE_SIMPLE
1339 * VLINK_HELPSTR_AUTH_MD5
1341 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1342 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1343 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1345 * VLINK_HELPSTR_IPADDR
1346 * VLINK_HELPSTR_TIME_PARAM
1347 * VLINK_HELPSTR_TIME_PARAM
1349 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1350 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
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>",
1355 * VLINK_HELPSTR_IPADDR
1356 * VLINK_HELPSTR_TIME_PARAM
1357 * VLINK_HELPSTR_TIME_PARAM
1358 * VLINK_HELPSTR_TIME_PARAM
1359 * VLINK_HELPSTR_TIME_PARAM
1361 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1362 * "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1364 * VLINK_HELPSTR_IPADDR
1365 * VLINK_HELPSTR_TIME_PARAM
1367 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1368 * "(message-digest-key|) <1-255> md5 KEY",
1370 * VLINK_HELPSTR_IPADDR
1371 * VLINK_HELPSTR_AUTH_MD5
1373 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1374 * "(authentication|)",
1376 * VLINK_HELPSTR_IPADDR
1377 * VLINK_HELPSTR_AUTHTYPE_SIMPLE
1379 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1380 * "(authentication|) (message-digest|null) "
1381 * "(message-digest-key|) <1-255> md5 KEY",
1383 * VLINK_HELPSTR_IPADDR
1384 * VLINK_HELPSTR_AUTHTYPE_ALL
1385 * VLINK_HELPSTR_AUTH_MD5
1387 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1388 * "(authentication|) "
1389 * "(authentication-key|) AUTH_KEY",
1391 * VLINK_HELPSTR_IPADDR
1392 * VLINK_HELPSTR_AUTHTYPE_SIMPLE
1393 * VLINK_HELPSTR_AUTH_SIMPLE
1395 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1396 * "(authentication-key|) AUTH_KEY",
1398 * VLINK_HELPSTR_IPADDR
1399 * VLINK_HELPSTR_AUTH_SIMPLE
1401 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1402 * "(authentication|) (message-digest|null)",
1404 * VLINK_HELPSTR_IPADDR
1405 * VLINK_HELPSTR_AUTHTYPE_ALL
1407 * "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1408 * "(authentication|) (message-digest|null) "
1409 * "(authentication-key|) AUTH_KEY",
1411 * VLINK_HELPSTR_IPADDR
1412 * VLINK_HELPSTR_AUTHTYPE_ALL
1413 * VLINK_HELPSTR_AUTH_SIMPLE
1416 DEFUN (no_ospf_area_vlink
,
1417 no_ospf_area_vlink_cmd
,
1418 "no area <A.B.C.D|(0-4294967295)> virtual-link A.B.C.D",
1420 VLINK_HELPSTR_IPADDR
)
1422 int idx_ipv4_number
= 2;
1424 struct ospf
*ospf
= vty
->index
;
1425 struct ospf_area
*area
;
1426 struct ospf_vl_config_data vl_config
;
1427 struct ospf_vl_data
*vl_data
= NULL
;
1428 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1435 ospf_vl_config_data_init(&vl_config
, vty
);
1437 ret
= ospf_str2area_id (argv
[idx_ipv4_number
]->arg
, &vl_config
.area_id
, &format
);
1440 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1444 area
= ospf_area_lookup_by_area_id (ospf
, vl_config
.area_id
);
1447 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1451 ret
= inet_aton (argv
[idx_ipv4
]->arg
, &vl_config
.vl_peer
);
1454 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1461 /* Basic VLink no command */
1462 /* Thats all folks! - BUGS B. strikes again!!!*/
1463 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
.vl_peer
)))
1464 ospf_vl_delete (ospf
, vl_data
);
1466 ospf_area_check_free (ospf
, vl_config
.area_id
);
1471 /* If we are down here, we are reseting parameters */
1473 /* Deal with other parameters */
1474 for (i
=2; i
< argc
; i
++)
1476 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1482 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1484 /* authentication-key - this option can occur anywhere on
1485 command line. At start of command line
1486 must check for authentication option. */
1487 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1488 vl_config
.auth_key
= auth_key
;
1490 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1492 /* authentication - this option can only occur at start
1494 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1499 /* message-digest-key */
1500 /* Delete one key */
1502 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1503 if (vl_config
.crypto_key_id
< 0)
1505 vl_config
.md5_key
= NULL
;
1509 /* Hello interval */
1510 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1514 /* Retransmit Interval */
1515 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1519 /* Transmit Delay */
1520 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1526 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1532 /* Action configuration */
1534 return ospf_vl_set (ospf
, &vl_config
);
1562 DEFUN (ospf_area_shortcut
,
1563 ospf_area_shortcut_cmd
,
1564 "area <A.B.C.D|(0-4294967295)> shortcut <default|enable|disable>",
1565 "OSPF area parameters\n"
1566 "OSPF area ID in IP address format\n"
1567 "OSPF area ID as a decimal value\n"
1568 "Configure the area's shortcutting mode\n"
1569 "Set default shortcutting behavior\n"
1570 "Enable shortcutting through the area\n"
1571 "Disable shortcutting through the area\n")
1573 int idx_ipv4_number
= 1;
1574 int idx_enable_disable
= 3;
1575 struct ospf
*ospf
= vty
->index
;
1576 struct ospf_area
*area
;
1577 struct in_addr area_id
;
1584 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1586 area
= ospf_area_get (ospf
, area_id
, format
);
1588 if (strncmp (argv
[idx_enable_disable
]->arg
, "de", 2) == 0)
1589 mode
= OSPF_SHORTCUT_DEFAULT
;
1590 else if (strncmp (argv
[idx_enable_disable
]->arg
, "di", 2) == 0)
1591 mode
= OSPF_SHORTCUT_DISABLE
;
1592 else if (strncmp (argv
[idx_enable_disable
]->arg
, "e", 1) == 0)
1593 mode
= OSPF_SHORTCUT_ENABLE
;
1597 ospf_area_shortcut_set (ospf
, area
, mode
);
1599 if (ospf
->abr_type
!= OSPF_ABR_SHORTCUT
)
1600 vty_out (vty
, "Shortcut area setting will take effect "
1601 "only when the router is configured as Shortcut ABR%s",
1607 DEFUN (no_ospf_area_shortcut
,
1608 no_ospf_area_shortcut_cmd
,
1609 "no area <A.B.C.D|(0-4294967295)> shortcut <enable|disable>",
1611 "OSPF area parameters\n"
1612 "OSPF area ID in IP address format\n"
1613 "OSPF area ID as a decimal value\n"
1614 "Deconfigure the area's shortcutting mode\n"
1615 "Deconfigure enabled shortcutting through the area\n"
1616 "Deconfigure disabled shortcutting through the area\n")
1618 int idx_ipv4_number
= 2;
1619 struct ospf
*ospf
= vty
->index
;
1620 struct ospf_area
*area
;
1621 struct in_addr area_id
;
1627 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1629 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1633 ospf_area_shortcut_unset (ospf
, area
);
1639 DEFUN (ospf_area_stub
,
1641 "area <A.B.C.D|(0-4294967295)> stub",
1642 "OSPF area parameters\n"
1643 "OSPF area ID in IP address format\n"
1644 "OSPF area ID as a decimal value\n"
1645 "Configure OSPF area as stub\n")
1647 int idx_ipv4_number
= 1;
1648 struct ospf
*ospf
= vty
->index
;
1649 struct in_addr area_id
;
1655 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1657 ret
= ospf_area_stub_set (ospf
, area_id
);
1660 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1665 ospf_area_no_summary_unset (ospf
, area_id
);
1670 DEFUN (ospf_area_stub_no_summary
,
1671 ospf_area_stub_no_summary_cmd
,
1672 "area <A.B.C.D|(0-4294967295)> stub no-summary",
1673 "OSPF stub parameters\n"
1674 "OSPF area ID in IP address format\n"
1675 "OSPF area ID as a decimal value\n"
1676 "Configure OSPF area as stub\n"
1677 "Do not inject inter-area routes into stub\n")
1679 int idx_ipv4_number
= 1;
1680 struct ospf
*ospf
= vty
->index
;
1681 struct in_addr area_id
;
1687 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1689 ret
= ospf_area_stub_set (ospf
, area_id
);
1692 vty_out (vty
, "%% Area cannot be stub as it contains a virtual link%s",
1697 ospf_area_no_summary_set (ospf
, area_id
);
1702 DEFUN (no_ospf_area_stub
,
1703 no_ospf_area_stub_cmd
,
1704 "no area <A.B.C.D|(0-4294967295)> stub",
1706 "OSPF area parameters\n"
1707 "OSPF area ID in IP address format\n"
1708 "OSPF area ID as a decimal value\n"
1709 "Configure OSPF area as stub\n")
1711 int idx_ipv4_number
= 2;
1712 struct ospf
*ospf
= vty
->index
;
1713 struct in_addr area_id
;
1719 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1721 ospf_area_stub_unset (ospf
, area_id
);
1722 ospf_area_no_summary_unset (ospf
, area_id
);
1727 DEFUN (no_ospf_area_stub_no_summary
,
1728 no_ospf_area_stub_no_summary_cmd
,
1729 "no area <A.B.C.D|(0-4294967295)> stub no-summary",
1731 "OSPF area parameters\n"
1732 "OSPF area ID in IP address format\n"
1733 "OSPF area ID as a decimal value\n"
1734 "Configure OSPF area as stub\n"
1735 "Do not inject inter-area routes into area\n")
1737 int idx_ipv4_number
= 2;
1738 struct ospf
*ospf
= vty
->index
;
1739 struct in_addr area_id
;
1745 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1746 ospf_area_no_summary_unset (ospf
, area_id
);
1752 ospf_area_nssa_cmd_handler (struct vty
*vty
, int argc
, const char *argv
[],
1755 struct ospf
*ospf
= vty
->index
;
1756 struct in_addr area_id
;
1762 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1764 ret
= ospf_area_nssa_set (ospf
, area_id
);
1767 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1774 if (strncmp (argv
[1], "translate-c", 11) == 0)
1775 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1776 OSPF_NSSA_ROLE_CANDIDATE
);
1777 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1778 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1779 OSPF_NSSA_ROLE_NEVER
);
1780 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1781 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1782 OSPF_NSSA_ROLE_ALWAYS
);
1786 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1787 OSPF_NSSA_ROLE_CANDIDATE
);
1791 ospf_area_no_summary_set (ospf
, area_id
);
1793 ospf_area_no_summary_unset (ospf
, area_id
);
1795 ospf_schedule_abr_task (ospf
);
1800 DEFUN (ospf_area_nssa_translate_no_summary
,
1801 ospf_area_nssa_translate_no_summary_cmd
,
1802 "area <A.B.C.D|(0-4294967295)> nssa <translate-candidate|translate-never|translate-always> no-summary",
1803 "OSPF area parameters\n"
1804 "OSPF area ID in IP address format\n"
1805 "OSPF area ID as a decimal value\n"
1806 "Configure OSPF area as nssa\n"
1807 "Configure NSSA-ABR for translate election (default)\n"
1808 "Configure NSSA-ABR to never translate\n"
1809 "Configure NSSA-ABR to always translate\n"
1810 "Do not inject inter-area routes into nssa\n")
1812 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1815 DEFUN (ospf_area_nssa_translate
,
1816 ospf_area_nssa_translate_cmd
,
1817 "area <A.B.C.D|(0-4294967295)> nssa <translate-candidate|translate-never|translate-always>",
1818 "OSPF area parameters\n"
1819 "OSPF area ID in IP address format\n"
1820 "OSPF area ID as a decimal value\n"
1821 "Configure OSPF area as nssa\n"
1822 "Configure NSSA-ABR for translate election (default)\n"
1823 "Configure NSSA-ABR to never translate\n"
1824 "Configure NSSA-ABR to always translate\n")
1826 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1829 DEFUN (ospf_area_nssa
,
1831 "area <A.B.C.D|(0-4294967295)> nssa",
1832 "OSPF area parameters\n"
1833 "OSPF area ID in IP address format\n"
1834 "OSPF area ID as a decimal value\n"
1835 "Configure OSPF area as nssa\n")
1837 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1840 DEFUN (ospf_area_nssa_no_summary
,
1841 ospf_area_nssa_no_summary_cmd
,
1842 "area <A.B.C.D|(0-4294967295)> nssa no-summary",
1843 "OSPF area parameters\n"
1844 "OSPF area ID in IP address format\n"
1845 "OSPF area ID as a decimal value\n"
1846 "Configure OSPF area as nssa\n"
1847 "Do not inject inter-area routes into nssa\n")
1849 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1853 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
1854 * "no area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always|) {no-summary}",
1856 * "OSPF area parameters\n"
1857 * "OSPF area ID in IP address format\n"
1858 * "OSPF area ID as a decimal value\n"
1859 * "Configure OSPF area as nssa\n"
1860 * "Configure NSSA-ABR for translate election (default)\n"
1861 * "Configure NSSA-ABR to never translate\n"
1862 * "Configure NSSA-ABR to always translate\n"
1863 * "Do not inject inter-area routes into nssa\n"
1866 DEFUN (no_ospf_area_nssa
,
1867 no_ospf_area_nssa_cmd
,
1868 "no area <A.B.C.D|(0-4294967295)> nssa",
1870 "OSPF area parameters\n"
1871 "OSPF area ID in IP address format\n"
1872 "OSPF area ID as a decimal value\n"
1873 "Configure OSPF area as nssa\n")
1875 int idx_ipv4_number
= 2;
1876 struct ospf
*ospf
= vty
->index
;
1877 struct in_addr area_id
;
1883 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1885 ospf_area_nssa_unset (ospf
, area_id
);
1886 ospf_area_no_summary_unset (ospf
, area_id
);
1888 ospf_schedule_abr_task (ospf
);
1894 DEFUN (ospf_area_default_cost
,
1895 ospf_area_default_cost_cmd
,
1896 "area <A.B.C.D|(0-4294967295)> default-cost (0-16777215)",
1897 "OSPF area parameters\n"
1898 "OSPF area ID in IP address format\n"
1899 "OSPF area ID as a decimal value\n"
1900 "Set the summary-default cost of a NSSA or stub area\n"
1901 "Stub's advertised default summary cost\n")
1903 int idx_ipv4_number
= 1;
1905 struct ospf
*ospf
= vty
->index
;
1906 struct ospf_area
*area
;
1907 struct in_addr area_id
;
1910 struct prefix_ipv4 p
;
1915 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1916 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[idx_number
]->arg
, 0, 16777215);
1918 area
= ospf_area_get (ospf
, area_id
, format
);
1920 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1922 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1926 area
->default_cost
= cost
;
1929 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1931 if (IS_DEBUG_OSPF_EVENT
)
1932 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1933 "announcing 0.0.0.0/0 to area %s",
1934 inet_ntoa (area
->area_id
));
1935 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1940 DEFUN (no_ospf_area_default_cost
,
1941 no_ospf_area_default_cost_cmd
,
1942 "no area <A.B.C.D|(0-4294967295)> default-cost (0-16777215)",
1944 "OSPF area parameters\n"
1945 "OSPF area ID in IP address format\n"
1946 "OSPF area ID as a decimal value\n"
1947 "Set the summary-default cost of a NSSA or stub area\n"
1948 "Stub's advertised default summary cost\n")
1950 int idx_ipv4_number
= 2;
1952 struct ospf
*ospf
= vty
->index
;
1953 struct ospf_area
*area
;
1954 struct in_addr area_id
;
1956 struct prefix_ipv4 p
;
1961 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[idx_ipv4_number
]->arg
);
1962 VTY_CHECK_INTEGER_RANGE ("stub default cost", argv
[idx_number
]->arg
, 0, OSPF_LS_INFINITY
);
1964 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1968 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1970 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1974 area
->default_cost
= 1;
1977 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1979 if (IS_DEBUG_OSPF_EVENT
)
1980 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1981 "announcing 0.0.0.0/0 to area %s",
1982 inet_ntoa (area
->area_id
));
1983 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1986 ospf_area_check_free (ospf
, area_id
);
1991 DEFUN (ospf_area_export_list
,
1992 ospf_area_export_list_cmd
,
1993 "area <A.B.C.D|(0-4294967295)> export-list NAME",
1994 "OSPF area parameters\n"
1995 "OSPF area ID in IP address format\n"
1996 "OSPF area ID as a decimal value\n"
1997 "Set the filter for networks announced to other areas\n"
1998 "Name of the access-list\n")
2000 int idx_ipv4_number
= 1;
2001 struct ospf
*ospf
= vty
->index
;
2002 struct ospf_area
*area
;
2003 struct in_addr area_id
;
2009 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2011 area
= ospf_area_get (ospf
, area_id
, format
);
2012 ospf_area_export_list_set (ospf
, area
, argv
[1]);
2017 DEFUN (no_ospf_area_export_list
,
2018 no_ospf_area_export_list_cmd
,
2019 "no area <A.B.C.D|(0-4294967295)> export-list NAME",
2021 "OSPF area parameters\n"
2022 "OSPF area ID in IP address format\n"
2023 "OSPF area ID as a decimal value\n"
2024 "Unset the filter for networks announced to other areas\n"
2025 "Name of the access-list\n")
2027 int idx_ipv4_number
= 2;
2028 struct ospf
*ospf
= vty
->index
;
2029 struct ospf_area
*area
;
2030 struct in_addr area_id
;
2036 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2038 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
2042 ospf_area_export_list_unset (ospf
, area
);
2048 DEFUN (ospf_area_import_list
,
2049 ospf_area_import_list_cmd
,
2050 "area <A.B.C.D|(0-4294967295)> import-list NAME",
2051 "OSPF area parameters\n"
2052 "OSPF area ID in IP address format\n"
2053 "OSPF area ID as a decimal value\n"
2054 "Set the filter for networks from other areas announced to the specified one\n"
2055 "Name of the access-list\n")
2057 int idx_ipv4_number
= 1;
2058 struct ospf
*ospf
= vty
->index
;
2059 struct ospf_area
*area
;
2060 struct in_addr area_id
;
2066 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2068 area
= ospf_area_get (ospf
, area_id
, format
);
2069 ospf_area_import_list_set (ospf
, area
, argv
[1]);
2074 DEFUN (no_ospf_area_import_list
,
2075 no_ospf_area_import_list_cmd
,
2076 "no area <A.B.C.D|(0-4294967295)> import-list NAME",
2078 "OSPF area parameters\n"
2079 "OSPF area ID in IP address format\n"
2080 "OSPF area ID as a decimal value\n"
2081 "Unset the filter for networks announced to other areas\n"
2082 "Name of the access-list\n")
2084 int idx_ipv4_number
= 2;
2085 struct ospf
*ospf
= vty
->index
;
2086 struct ospf_area
*area
;
2087 struct in_addr area_id
;
2093 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2095 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
2099 ospf_area_import_list_unset (ospf
, area
);
2104 DEFUN (ospf_area_filter_list
,
2105 ospf_area_filter_list_cmd
,
2106 "area <A.B.C.D|(0-4294967295)> filter-list prefix WORD <in|out>",
2107 "OSPF area parameters\n"
2108 "OSPF area ID in IP address format\n"
2109 "OSPF area ID as a decimal value\n"
2110 "Filter networks between OSPF areas\n"
2111 "Filter prefixes between OSPF areas\n"
2112 "Name of an IP prefix-list\n"
2113 "Filter networks sent to this area\n"
2114 "Filter networks sent from this area\n")
2116 int idx_ipv4_number
= 1;
2119 struct ospf
*ospf
= vty
->index
;
2120 struct ospf_area
*area
;
2121 struct in_addr area_id
;
2122 struct prefix_list
*plist
;
2128 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2130 area
= ospf_area_get (ospf
, area_id
, format
);
2131 plist
= prefix_list_lookup (AFI_IP
, argv
[idx_word
]->arg
);
2132 if (strncmp (argv
[idx_in_out
]->arg
, "in", 2) == 0)
2134 PREFIX_LIST_IN (area
) = plist
;
2135 if (PREFIX_NAME_IN (area
))
2136 free (PREFIX_NAME_IN (area
));
2138 PREFIX_NAME_IN (area
) = strdup (argv
[idx_word
]->arg
);
2139 ospf_schedule_abr_task (ospf
);
2143 PREFIX_LIST_OUT (area
) = plist
;
2144 if (PREFIX_NAME_OUT (area
))
2145 free (PREFIX_NAME_OUT (area
));
2147 PREFIX_NAME_OUT (area
) = strdup (argv
[idx_word
]->arg
);
2148 ospf_schedule_abr_task (ospf
);
2154 DEFUN (no_ospf_area_filter_list
,
2155 no_ospf_area_filter_list_cmd
,
2156 "no area <A.B.C.D|(0-4294967295)> filter-list prefix WORD <in|out>",
2158 "OSPF area parameters\n"
2159 "OSPF area ID in IP address format\n"
2160 "OSPF area ID as a decimal value\n"
2161 "Filter networks between OSPF areas\n"
2162 "Filter prefixes between OSPF areas\n"
2163 "Name of an IP prefix-list\n"
2164 "Filter networks sent to this area\n"
2165 "Filter networks sent from this area\n")
2167 int idx_ipv4_number
= 2;
2170 struct ospf
*ospf
= vty
->index
;
2171 struct ospf_area
*area
;
2172 struct in_addr area_id
;
2178 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2180 if ((area
= ospf_area_lookup_by_area_id (ospf
, area_id
)) == NULL
)
2183 if (strncmp (argv
[idx_in_out
]->arg
, "in", 2) == 0)
2185 if (PREFIX_NAME_IN (area
))
2186 if (strcmp (PREFIX_NAME_IN (area
), argv
[idx_word
]->arg
) != 0)
2189 PREFIX_LIST_IN (area
) = NULL
;
2190 if (PREFIX_NAME_IN (area
))
2191 free (PREFIX_NAME_IN (area
));
2193 PREFIX_NAME_IN (area
) = NULL
;
2195 ospf_schedule_abr_task (ospf
);
2199 if (PREFIX_NAME_OUT (area
))
2200 if (strcmp (PREFIX_NAME_OUT (area
), argv
[idx_word
]->arg
) != 0)
2203 PREFIX_LIST_OUT (area
) = NULL
;
2204 if (PREFIX_NAME_OUT (area
))
2205 free (PREFIX_NAME_OUT (area
));
2207 PREFIX_NAME_OUT (area
) = NULL
;
2209 ospf_schedule_abr_task (ospf
);
2216 DEFUN (ospf_area_authentication_message_digest
,
2217 ospf_area_authentication_message_digest_cmd
,
2218 "area <A.B.C.D|(0-4294967295)> authentication message-digest",
2219 "OSPF area parameters\n"
2220 "OSPF area ID in IP address format\n"
2221 "OSPF area ID as a decimal value\n"
2222 "Enable authentication\n"
2223 "Use message-digest authentication\n")
2225 int idx_ipv4_number
= 1;
2226 struct ospf
*ospf
= vty
->index
;
2227 struct ospf_area
*area
;
2228 struct in_addr area_id
;
2234 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2236 area
= ospf_area_get (ospf
, area_id
, format
);
2237 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
2242 DEFUN (ospf_area_authentication
,
2243 ospf_area_authentication_cmd
,
2244 "area <A.B.C.D|(0-4294967295)> authentication",
2245 "OSPF area parameters\n"
2246 "OSPF area ID in IP address format\n"
2247 "OSPF area ID as a decimal value\n"
2248 "Enable authentication\n")
2250 int idx_ipv4_number
= 1;
2251 struct ospf
*ospf
= vty
->index
;
2252 struct ospf_area
*area
;
2253 struct in_addr area_id
;
2259 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2261 area
= ospf_area_get (ospf
, area_id
, format
);
2262 area
->auth_type
= OSPF_AUTH_SIMPLE
;
2267 DEFUN (no_ospf_area_authentication
,
2268 no_ospf_area_authentication_cmd
,
2269 "no area <A.B.C.D|(0-4294967295)> authentication",
2271 "OSPF area parameters\n"
2272 "OSPF area ID in IP address format\n"
2273 "OSPF area ID as a decimal value\n"
2274 "Enable authentication\n")
2276 int idx_ipv4_number
= 2;
2277 struct ospf
*ospf
= vty
->index
;
2278 struct ospf_area
*area
;
2279 struct in_addr area_id
;
2285 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[idx_ipv4_number
]->arg
);
2287 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
2291 area
->auth_type
= OSPF_AUTH_NULL
;
2293 ospf_area_check_free (ospf
, area_id
);
2299 DEFUN (ospf_abr_type
,
2301 "ospf abr-type <cisco|ibm|shortcut|standard>",
2302 "OSPF specific commands\n"
2303 "Set OSPF ABR type\n"
2304 "Alternative ABR, cisco implementation\n"
2305 "Alternative ABR, IBM implementation\n"
2307 "Standard behavior (RFC2328)\n")
2310 struct ospf
*ospf
= vty
->index
;
2311 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2316 if (strncmp (argv
[idx_vendor
]->arg
, "c", 1) == 0)
2317 abr_type
= OSPF_ABR_CISCO
;
2318 else if (strncmp (argv
[idx_vendor
]->arg
, "i", 1) == 0)
2319 abr_type
= OSPF_ABR_IBM
;
2320 else if (strncmp (argv
[idx_vendor
]->arg
, "sh", 2) == 0)
2321 abr_type
= OSPF_ABR_SHORTCUT
;
2322 else if (strncmp (argv
[idx_vendor
]->arg
, "st", 2) == 0)
2323 abr_type
= OSPF_ABR_STAND
;
2327 /* If ABR type value is changed, schedule ABR task. */
2328 if (ospf
->abr_type
!= abr_type
)
2330 ospf
->abr_type
= abr_type
;
2331 ospf_schedule_abr_task (ospf
);
2337 DEFUN (no_ospf_abr_type
,
2338 no_ospf_abr_type_cmd
,
2339 "no ospf abr-type <cisco|ibm|shortcut|standard>",
2341 "OSPF specific commands\n"
2342 "Set OSPF ABR type\n"
2343 "Alternative ABR, cisco implementation\n"
2344 "Alternative ABR, IBM implementation\n"
2348 struct ospf
*ospf
= vty
->index
;
2349 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2354 if (strncmp (argv
[idx_vendor
]->arg
, "c", 1) == 0)
2355 abr_type
= OSPF_ABR_CISCO
;
2356 else if (strncmp (argv
[idx_vendor
]->arg
, "i", 1) == 0)
2357 abr_type
= OSPF_ABR_IBM
;
2358 else if (strncmp (argv
[idx_vendor
]->arg
, "sh", 2) == 0)
2359 abr_type
= OSPF_ABR_SHORTCUT
;
2360 else if (strncmp (argv
[idx_vendor
]->arg
, "st", 2) == 0)
2361 abr_type
= OSPF_ABR_STAND
;
2365 /* If ABR type value is changed, schedule ABR task. */
2366 if (ospf
->abr_type
== abr_type
)
2368 ospf
->abr_type
= OSPF_ABR_DEFAULT
;
2369 ospf_schedule_abr_task (ospf
);
2375 DEFUN (ospf_log_adjacency_changes
,
2376 ospf_log_adjacency_changes_cmd
,
2377 "log-adjacency-changes",
2378 "Log changes in adjacency state\n")
2380 struct ospf
*ospf
= vty
->index
;
2385 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2386 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2390 DEFUN (ospf_log_adjacency_changes_detail
,
2391 ospf_log_adjacency_changes_detail_cmd
,
2392 "log-adjacency-changes detail",
2393 "Log changes in adjacency state\n"
2394 "Log all state changes\n")
2396 struct ospf
*ospf
= vty
->index
;
2401 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2402 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2406 DEFUN (no_ospf_log_adjacency_changes
,
2407 no_ospf_log_adjacency_changes_cmd
,
2408 "no log-adjacency-changes",
2410 "Log changes in adjacency state\n")
2412 struct ospf
*ospf
= vty
->index
;
2417 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2418 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2422 DEFUN (no_ospf_log_adjacency_changes_detail
,
2423 no_ospf_log_adjacency_changes_detail_cmd
,
2424 "no log-adjacency-changes detail",
2426 "Log changes in adjacency state\n"
2427 "Log all state changes\n")
2429 struct ospf
*ospf
= vty
->index
;
2434 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2435 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2440 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2441 * "ospf rfc1583compatibility",
2442 * "OSPF specific commands\n"
2443 * "Enable the RFC1583Compatibility flag\n"
2446 DEFUN (ospf_compatible_rfc1583
,
2447 ospf_compatible_rfc1583_cmd
,
2448 "compatible rfc1583",
2449 "OSPF compatibility list\n"
2450 "compatible with RFC 1583\n")
2452 struct ospf
*ospf
= vty
->index
;
2457 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2459 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2460 ospf_spf_calculate_schedule (ospf
, SPF_FLAG_CONFIG_CHANGE
);
2466 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2467 * "no ospf rfc1583compatibility",
2469 * "OSPF specific commands\n"
2470 * "Disable the RFC1583Compatibility flag\n"
2473 DEFUN (no_ospf_compatible_rfc1583
,
2474 no_ospf_compatible_rfc1583_cmd
,
2475 "no compatible rfc1583",
2477 "OSPF compatibility list\n"
2478 "compatible with RFC 1583\n")
2480 struct ospf
*ospf
= vty
->index
;
2485 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2487 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2488 ospf_spf_calculate_schedule (ospf
, SPF_FLAG_CONFIG_CHANGE
);
2496 ospf_timers_spf_set (struct vty
*vty
, unsigned int delay
,
2500 struct ospf
*ospf
= vty
->index
;
2505 ospf
->spf_delay
= delay
;
2506 ospf
->spf_holdtime
= hold
;
2507 ospf
->spf_max_holdtime
= max
;
2512 DEFUN (ospf_timers_min_ls_interval
,
2513 ospf_timers_min_ls_interval_cmd
,
2514 "timers throttle lsa all (0-5000)",
2515 "Adjust routing timers\n"
2516 "Throttling adaptive timer\n"
2517 "LSA delay between transmissions\n"
2519 "Delay (msec) between sending LSAs\n")
2522 struct ospf
*ospf
= vty
->index
;
2523 unsigned int interval
;
2530 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2534 VTY_GET_INTEGER ("LSA interval", interval
, argv
[idx_number
]->arg
);
2536 ospf
->min_ls_interval
= interval
;
2542 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2543 * "no timers throttle lsa all <0-5000>",
2545 * "Adjust routing timers\n"
2546 * "Throttling adaptive timer\n"
2547 * "LSA delay between transmissions\n"
2549 * "Delay (msec) between sending LSAs\n"
2552 DEFUN (no_ospf_timers_min_ls_interval
,
2553 no_ospf_timers_min_ls_interval_cmd
,
2554 "no timers throttle lsa all",
2556 "Adjust routing timers\n"
2557 "Throttling adaptive timer\n"
2558 "LSA delay between transmissions\n"
2561 struct ospf
*ospf
= vty
->index
;
2562 ospf
->min_ls_interval
= OSPF_MIN_LS_INTERVAL
;
2568 DEFUN (ospf_timers_min_ls_arrival
,
2569 ospf_timers_min_ls_arrival_cmd
,
2570 "timers lsa arrival (0-1000)",
2571 "Adjust routing timers\n"
2572 "Throttling link state advertisement delays\n"
2573 "OSPF minimum arrival interval delay\n"
2574 "Delay (msec) between accepted LSAs\n")
2577 struct ospf
*ospf
= vty
->index
;
2578 unsigned int arrival
;
2585 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2589 VTY_GET_INTEGER_RANGE ("minimum LSA inter-arrival time", arrival
, argv
[idx_number
]->arg
, 0, 1000);
2591 ospf
->min_ls_arrival
= arrival
;
2597 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2598 * "no timers lsa arrival <0-1000>",
2600 * "Adjust routing timers\n"
2601 * "Throttling link state advertisement delays\n"
2602 * "OSPF minimum arrival interval delay\n"
2603 * "Delay (msec) between accepted LSAs\n"
2606 DEFUN (no_ospf_timers_min_ls_arrival
,
2607 no_ospf_timers_min_ls_arrival_cmd
,
2608 "no timers lsa arrival",
2610 "Adjust routing timers\n"
2611 "Throttling link state advertisement delays\n"
2612 "OSPF minimum arrival interval delay\n")
2614 struct ospf
*ospf
= vty
->index
;
2619 ospf
->min_ls_arrival
= OSPF_MIN_LS_ARRIVAL
;
2625 DEFUN (ospf_timers_throttle_spf
,
2626 ospf_timers_throttle_spf_cmd
,
2627 "timers throttle spf (0-600000) (0-600000) (0-600000)",
2628 "Adjust routing timers\n"
2629 "Throttling adaptive timer\n"
2631 "Delay (msec) from first change received till SPF calculation\n"
2632 "Initial hold time (msec) between consecutive SPF calculations\n"
2633 "Maximum hold time (msec)\n")
2636 int idx_number_2
= 4;
2637 int idx_number_3
= 5;
2638 unsigned int delay
, hold
, max
;
2642 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2646 VTY_GET_INTEGER_RANGE ("SPF delay timer", delay
, argv
[idx_number
]->arg
, 0, 600000);
2647 VTY_GET_INTEGER_RANGE ("SPF hold timer", hold
, argv
[idx_number_2
]->arg
, 0, 600000);
2648 VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max
, argv
[idx_number_3
]->arg
, 0, 600000);
2650 return ospf_timers_spf_set (vty
, delay
, hold
, max
);
2654 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2655 * "no timers throttle spf <0-600000> <0-600000> <0-600000>",
2657 * "Adjust routing timers\n"
2658 * "Throttling adaptive timer\n"
2659 * "OSPF SPF timers\n"
2660 * "Delay (msec) from first change received till SPF calculation\n"
2661 * "Initial hold time (msec) between consecutive SPF calculations\n"
2662 * "Maximum hold time (msec)\n"
2665 DEFUN (no_ospf_timers_throttle_spf
,
2666 no_ospf_timers_throttle_spf_cmd
,
2667 "no timers throttle spf",
2669 "Adjust routing timers\n"
2670 "Throttling adaptive timer\n"
2671 "OSPF SPF timers\n")
2673 return ospf_timers_spf_set (vty
,
2674 OSPF_SPF_DELAY_DEFAULT
,
2675 OSPF_SPF_HOLDTIME_DEFAULT
,
2676 OSPF_SPF_MAX_HOLDTIME_DEFAULT
);
2680 DEFUN (ospf_timers_lsa
,
2681 ospf_timers_lsa_cmd
,
2682 "timers lsa min-arrival (0-600000)",
2683 "Adjust routing timers\n"
2685 "Minimum delay in receiving new version of a LSA\n"
2686 "Delay in milliseconds\n")
2689 unsigned int minarrival
;
2690 struct ospf
*ospf
= vty
->index
;
2697 vty_out (vty
, "Insufficient number of arguments%s", VTY_NEWLINE
);
2701 VTY_GET_INTEGER ("LSA min-arrival", minarrival
, argv
[idx_number
]->arg
);
2703 ospf
->min_ls_arrival
= minarrival
;
2709 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2710 * "no timers lsa min-arrival <0-600000>",
2712 * "Adjust routing timers\n"
2713 * "OSPF LSA timers\n"
2714 * "Minimum delay in receiving new version of a LSA\n"
2715 * "Delay in milliseconds\n"
2718 DEFUN (no_ospf_timers_lsa
,
2719 no_ospf_timers_lsa_cmd
,
2720 "no timers lsa min-arrival",
2722 "Adjust routing timers\n"
2724 "Minimum delay in receiving new version of a LSA\n")
2726 unsigned int minarrival
;
2727 struct ospf
*ospf
= vty
->index
;
2734 VTY_GET_INTEGER ("LSA min-arrival", minarrival
, argv
[0]);
2736 if (ospf
->min_ls_arrival
!= minarrival
||
2737 minarrival
== OSPF_MIN_LS_ARRIVAL
)
2741 ospf
->min_ls_arrival
= OSPF_MIN_LS_ARRIVAL
;
2749 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2750 * "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2752 * "Neighbor IP address\n"
2753 * "Neighbor Priority\n"
2755 * "Dead Neighbor Polling interval\n"
2758 * "neighbor A.B.C.D priority <0-255>",
2760 * "Neighbor IP address\n"
2761 * "Neighbor Priority\n"
2765 DEFUN (ospf_neighbor
,
2769 "Neighbor IP address\n")
2772 struct ospf
*ospf
= vty
->index
;
2773 struct in_addr nbr_addr
;
2774 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2775 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2780 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[idx_ipv4
]->arg
);
2783 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2786 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2788 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2790 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2792 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2800 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2801 * "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2803 * "Neighbor address\n"
2804 * "OSPF dead-router polling interval\n"
2806 * "OSPF priority of non-broadcast neighbor\n"
2810 DEFUN (ospf_neighbor_poll_interval
,
2811 ospf_neighbor_poll_interval_cmd
,
2812 "neighbor A.B.C.D poll-interval (1-65535)",
2814 "Neighbor IP address\n"
2815 "Dead Neighbor Polling interval\n"
2820 struct ospf
*ospf
= vty
->index
;
2821 struct in_addr nbr_addr
;
2822 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2823 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2828 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[idx_ipv4
]->arg
);
2831 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[idx_number
]->arg
, 1, 65535);
2834 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2836 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2838 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2840 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2847 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2848 * "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2851 * "Neighbor IP address\n"
2852 * "Neighbor Priority\n"
2854 * "Dead Neighbor Polling interval\n"
2857 * "no neighbor A.B.C.D priority <0-255>",
2860 * "Neighbor IP address\n"
2861 * "Neighbor Priority\n"
2864 * "no neighbor A.B.C.D poll-interval <1-65535>",
2867 * "Neighbor IP address\n"
2868 * "Dead Neighbor Polling interval\n"
2871 * "no neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2874 * "Neighbor IP address\n"
2875 * "Dead Neighbor Polling interval\n"
2877 * "OSPF priority of non-broadcast neighbor\n"
2881 DEFUN (no_ospf_neighbor
,
2882 no_ospf_neighbor_cmd
,
2883 "no neighbor A.B.C.D",
2886 "Neighbor IP address\n")
2889 struct ospf
*ospf
= vty
->index
;
2890 struct in_addr nbr_addr
;
2895 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[idx_ipv4
]->arg
);
2897 (void)ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2906 DEFUN (ospf_refresh_timer
,
2907 ospf_refresh_timer_cmd
,
2908 "refresh timer (10-1800)",
2909 "Adjust refresh parameters\n"
2910 "Set refresh timer\n"
2911 "Timer value in seconds\n")
2914 struct ospf
*ospf
= vty
->index
;
2915 unsigned int interval
;
2920 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[idx_number
]->arg
, 10, 1800);
2921 interval
= (interval
/ OSPF_LSA_REFRESHER_GRANULARITY
) * OSPF_LSA_REFRESHER_GRANULARITY
;
2923 ospf_timers_refresh_set (ospf
, interval
);
2929 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
2930 * "no refresh timer",
2931 * "Adjust refresh parameters\n"
2932 * "Unset refresh timer\n"
2935 DEFUN (no_ospf_refresh_timer
,
2936 no_ospf_refresh_timer_val_cmd
,
2937 "no refresh timer (10-1800)",
2938 "Adjust refresh parameters\n"
2939 "Unset refresh timer\n"
2940 "Timer value in seconds\n")
2943 struct ospf
*ospf
= vty
->index
;
2944 unsigned int interval
;
2951 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[idx_number
]->arg
, 10, 1800);
2953 if (ospf
->lsa_refresh_interval
!= interval
||
2954 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2958 ospf_timers_refresh_unset (ospf
);
2964 DEFUN (ospf_auto_cost_reference_bandwidth
,
2965 ospf_auto_cost_reference_bandwidth_cmd
,
2966 "auto-cost reference-bandwidth (1-4294967)",
2967 "Calculate OSPF interface cost according to bandwidth\n"
2968 "Use reference bandwidth method to assign OSPF cost\n"
2969 "The reference bandwidth in terms of Mbits per second\n")
2972 struct ospf
*ospf
= vty
->index
;
2974 struct listnode
*node
;
2975 struct interface
*ifp
;
2980 refbw
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
2981 if (refbw
< 1 || refbw
> 4294967)
2983 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2987 /* If reference bandwidth is changed. */
2988 if ((refbw
) == ospf
->ref_bandwidth
)
2991 ospf
->ref_bandwidth
= refbw
;
2992 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
2993 ospf_if_recalculate_output_cost (ifp
);
2999 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3000 * "no auto-cost reference-bandwidth <1-4294967>",
3002 * "Calculate OSPF interface cost according to bandwidth\n"
3003 * "Use reference bandwidth method to assign OSPF cost\n"
3004 * "The reference bandwidth in terms of Mbits per second\n"
3007 DEFUN (no_ospf_auto_cost_reference_bandwidth
,
3008 no_ospf_auto_cost_reference_bandwidth_cmd
,
3009 "no auto-cost reference-bandwidth",
3011 "Calculate OSPF interface cost according to bandwidth\n"
3012 "Use reference bandwidth method to assign OSPF cost\n")
3014 struct ospf
*ospf
= vty
->index
;
3015 struct listnode
*node
, *nnode
;
3016 struct interface
*ifp
;
3021 if (ospf
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
3024 ospf
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
3025 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
3026 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
3028 for (ALL_LIST_ELEMENTS (om
->iflist
, node
, nnode
, ifp
))
3029 ospf_if_recalculate_output_cost (ifp
);
3036 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3037 * "write-multiplier <1-100>",
3038 * "Write multiplier\n"
3039 * "Maximum number of interface serviced per write\n"
3042 DEFUN (ospf_write_multiplier
,
3043 ospf_write_multiplier_cmd
,
3044 "ospf write-multiplier (1-100)",
3045 "OSPF specific commands\n"
3046 "Write multiplier\n"
3047 "Maximum number of interface serviced per write\n")
3050 struct ospf
*ospf
= vty
->index
;
3051 u_int32_t write_oi_count
;
3056 write_oi_count
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
3057 if (write_oi_count
< 1 || write_oi_count
> 100)
3059 vty_out (vty
, "write-multiplier value is invalid%s", VTY_NEWLINE
);
3063 ospf
->write_oi_count
= write_oi_count
;
3069 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
3070 * "no write-multiplier",
3072 * "Write multiplier\n"
3074 * "no write-multiplier <1-100>",
3076 * "Write multiplier\n"
3077 * "Maximum number of interface serviced per write\n"
3080 DEFUN (no_ospf_write_multiplier
,
3081 no_ospf_write_multiplier_cmd
,
3082 "no ospf write-multiplier (1-100)",
3084 "OSPF specific commands\n"
3085 "Write multiplier\n"
3086 "Maximum number of interface serviced per write\n")
3088 struct ospf
*ospf
= vty
->index
;
3093 ospf
->write_oi_count
= OSPF_WRITE_INTERFACE_COUNT_DEFAULT
;
3099 const char *ospf_abr_type_descr_str
[] =
3102 "Standard (RFC2328)",
3104 "Alternative Cisco",
3105 "Alternative Shortcut"
3108 const char *ospf_shortcut_mode_descr_str
[] =
3116 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
, json_object
*json_areas
, u_char use_json
)
3118 json_object
*json_area
= NULL
;
3121 json_area
= json_object_new_object();
3125 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
3127 /* Show Area type/mode. */
3128 if (OSPF_IS_AREA_BACKBONE (area
))
3131 json_object_boolean_true_add(json_area
, "backbone");
3133 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
3139 if (area
->external_routing
== OSPF_AREA_STUB
)
3141 if (area
->no_summary
)
3142 json_object_boolean_true_add(json_area
, "stubNoSummary");
3143 if (area
->shortcut_configured
)
3144 json_object_boolean_true_add(json_area
, "stubShortcut");
3146 else if (area
->external_routing
== OSPF_AREA_NSSA
)
3148 if (area
->no_summary
)
3149 json_object_boolean_true_add(json_area
, "nssaNoSummary");
3150 if (area
->shortcut_configured
)
3151 json_object_boolean_true_add(json_area
, "nssaShortcut");
3154 json_object_string_add(json_area
,"shortcuttingMode",
3155 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
3156 if (area
->shortcut_capability
)
3157 json_object_boolean_true_add(json_area
,"sBitConcensus");
3161 if (area
->external_routing
== OSPF_AREA_STUB
)
3162 vty_out (vty
, " (Stub%s%s)",
3163 area
->no_summary
? ", no summary" : "",
3164 area
->shortcut_configured
? "; " : "");
3165 else if (area
->external_routing
== OSPF_AREA_NSSA
)
3166 vty_out (vty
, " (NSSA%s%s)",
3167 area
->no_summary
? ", no summary" : "",
3168 area
->shortcut_configured
? "; " : "");
3170 vty_out (vty
, "%s", VTY_NEWLINE
);
3171 vty_out (vty
, " Shortcutting mode: %s",
3172 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
3173 vty_out (vty
, ", S-bit consensus: %s%s",
3174 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
3178 /* Show number of interfaces */
3181 json_object_int_add(json_area
, "areaIfTotalCounter", listcount (area
->oiflist
));
3182 json_object_int_add(json_area
, "areaIfActiveCounter", area
->act_ints
);
3185 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
3186 "Active: %d%s", listcount (area
->oiflist
),
3187 area
->act_ints
, VTY_NEWLINE
);
3189 if (area
->external_routing
== OSPF_AREA_NSSA
)
3193 json_object_boolean_true_add(json_area
, "nssa");
3194 if (! IS_OSPF_ABR (area
->ospf
))
3195 json_object_boolean_false_add(json_area
, "abr");
3196 else if (area
->NSSATranslatorState
)
3198 json_object_boolean_true_add(json_area
, "abr");
3199 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3200 json_object_boolean_true_add(json_area
, "nssaTranslatorElected");
3201 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
3202 json_object_boolean_true_add(json_area
, "nssaTranslatorAlways");
3206 json_object_boolean_true_add(json_area
, "abr");
3207 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3208 json_object_boolean_false_add(json_area
, "nssaTranslatorElected");
3210 json_object_boolean_true_add(json_area
, "nssaTranslatorNever");
3215 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
3216 if (! IS_OSPF_ABR (area
->ospf
))
3217 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
3219 else if (area
->NSSATranslatorState
)
3221 vty_out (vty
, " We are an ABR and ");
3222 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3223 vty_out (vty
, "the NSSA Elected Translator. %s",
3225 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
3226 vty_out (vty
, "always an NSSA Translator. %s",
3231 vty_out (vty
, " We are an ABR, but ");
3232 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
3233 vty_out (vty
, "not the NSSA Elected Translator. %s",
3236 vty_out (vty
, "never an NSSA Translator. %s",
3242 /* Stub-router state for this area */
3243 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
3245 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3249 json_object_boolean_true_add(json_area
, "originStubMaxDistRouterLsa");
3250 if (CHECK_FLAG(area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
3251 json_object_boolean_true_add(json_area
, "indefiniteActiveAdmin");
3252 if (area
->t_stub_router
)
3254 struct timeval result
;
3255 unsigned long time_store
= 0;
3256 result
= tv_sub (area
->t_stub_router
->u
.sands
, recent_relative_time());
3257 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3258 json_object_int_add(json_area
, "activeStartupRemainderMsecs", time_store
);
3263 vty_out (vty
, " Originating stub / maximum-distance Router-LSA%s",
3265 if (CHECK_FLAG(area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
3266 vty_out (vty
, " Administratively activated (indefinitely)%s",
3268 if (area
->t_stub_router
)
3269 vty_out (vty
, " Active from startup, %s remaining%s",
3270 ospf_timer_dump (area
->t_stub_router
, timebuf
,
3271 sizeof(timebuf
)), VTY_NEWLINE
);
3277 /* Show number of fully adjacent neighbors. */
3278 json_object_int_add(json_area
, "nbrFullAdjacentCounter", area
->full_nbrs
);
3280 /* Show authentication type. */
3281 if (area
->auth_type
== OSPF_AUTH_NULL
)
3282 json_object_string_add(json_area
, "authentication", "authenticationNone");
3283 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
3284 json_object_string_add(json_area
, "authentication", "authenticationSimplePassword");
3285 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
3286 json_object_string_add(json_area
, "authentication", "authenticationMessageDigest");
3288 if (!OSPF_IS_AREA_BACKBONE (area
))
3289 json_object_int_add(json_area
, "virtualAdjacenciesPassingCounter", area
->full_vls
);
3291 /* Show SPF calculation times. */
3292 json_object_int_add(json_area
, "spfExecutedCounter", area
->spf_calculation
);
3293 json_object_int_add(json_area
, "lsaNumber", area
->lsdb
->total
);
3294 json_object_int_add(json_area
, "lsaRouterNumber", ospf_lsdb_count (area
->lsdb
, OSPF_ROUTER_LSA
));
3295 json_object_int_add(json_area
, "lsaRouterChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_ROUTER_LSA
));
3296 json_object_int_add(json_area
, "lsaNetworkNumber", ospf_lsdb_count (area
->lsdb
, OSPF_NETWORK_LSA
));
3297 json_object_int_add(json_area
, "lsaNetworkChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_NETWORK_LSA
));
3298 json_object_int_add(json_area
, "lsaSummaryNumber", ospf_lsdb_count (area
->lsdb
, OSPF_SUMMARY_LSA
));
3299 json_object_int_add(json_area
, "lsaSummaryChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_SUMMARY_LSA
));
3300 json_object_int_add(json_area
, "lsaAsbrNumber", ospf_lsdb_count (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
));
3301 json_object_int_add(json_area
, "lsaAsbrChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
));
3302 json_object_int_add(json_area
, "lsaNssaNumber", ospf_lsdb_count (area
->lsdb
, OSPF_AS_NSSA_LSA
));
3303 json_object_int_add(json_area
, "lsaNssaChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_AS_NSSA_LSA
));
3307 /* Show number of fully adjacent neighbors. */
3308 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
3309 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
3311 /* Show authentication type. */
3312 vty_out (vty
, " Area has ");
3313 if (area
->auth_type
== OSPF_AUTH_NULL
)
3314 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
3315 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
3316 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
3317 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
3318 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
3320 if (!OSPF_IS_AREA_BACKBONE (area
))
3321 vty_out (vty
, " Number of full virtual adjacencies going through"
3322 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
3324 /* Show SPF calculation times. */
3325 vty_out (vty
, " SPF algorithm executed %d times%s",
3326 area
->spf_calculation
, VTY_NEWLINE
);
3328 /* Show number of LSA. */
3329 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
3330 vty_out (vty
, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
3331 ospf_lsdb_count (area
->lsdb
, OSPF_ROUTER_LSA
),
3332 ospf_lsdb_checksum (area
->lsdb
, OSPF_ROUTER_LSA
), VTY_NEWLINE
);
3333 vty_out (vty
, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
3334 ospf_lsdb_count (area
->lsdb
, OSPF_NETWORK_LSA
),
3335 ospf_lsdb_checksum (area
->lsdb
, OSPF_NETWORK_LSA
), VTY_NEWLINE
);
3336 vty_out (vty
, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
3337 ospf_lsdb_count (area
->lsdb
, OSPF_SUMMARY_LSA
),
3338 ospf_lsdb_checksum (area
->lsdb
, OSPF_SUMMARY_LSA
), VTY_NEWLINE
);
3339 vty_out (vty
, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
3340 ospf_lsdb_count (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
),
3341 ospf_lsdb_checksum (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
), VTY_NEWLINE
);
3342 vty_out (vty
, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
3343 ospf_lsdb_count (area
->lsdb
, OSPF_AS_NSSA_LSA
),
3344 ospf_lsdb_checksum (area
->lsdb
, OSPF_AS_NSSA_LSA
), VTY_NEWLINE
);
3349 json_object_int_add(json_area
, "lsaOpaqueLinkNumber", ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
));
3350 json_object_int_add(json_area
, "lsaOpaqueLinkChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
));
3351 json_object_int_add(json_area
, "lsaOpaqueAreaNumber", ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
));
3352 json_object_int_add(json_area
, "lsaOpaqueAreaChecksum", ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
));
3356 vty_out (vty
, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
3357 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
),
3358 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
), VTY_NEWLINE
);
3359 vty_out (vty
, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
3360 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
),
3361 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
), VTY_NEWLINE
);
3365 json_object_object_add(json_areas
, inet_ntoa (area
->area_id
), json_area
);
3367 vty_out (vty
, "%s", VTY_NEWLINE
);
3371 show_ip_ospf_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
3373 struct listnode
*node
, *nnode
;
3374 struct ospf_area
* area
;
3375 struct timeval result
;
3376 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3377 json_object
*json
= NULL
;
3378 json_object
*json_areas
= NULL
;
3381 json
= json_object_new_object();
3382 json_areas
= json_object_new_object();
3388 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
3392 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
3393 VTY_NEWLINE
, VTY_NEWLINE
);
3397 /* Show Router ID. */
3400 json_object_string_add(json
, "routerId", inet_ntoa (ospf
->router_id
));
3404 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
3405 inet_ntoa (ospf
->router_id
),
3409 /* Graceful shutdown */
3410 if (ospf
->t_deferred_shutdown
)
3414 unsigned long time_store
= 0;
3415 result
= tv_sub (ospf
->t_deferred_shutdown
->u
.sands
, recent_relative_time());
3416 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3417 json_object_int_add(json
, "deferredShutdownMsecs", time_store
);
3421 vty_out (vty
, " Deferred shutdown in progress, %s remaining%s",
3422 ospf_timer_dump (ospf
->t_deferred_shutdown
,
3423 timebuf
, sizeof (timebuf
)), VTY_NEWLINE
);
3427 /* Show capability. */
3430 json_object_boolean_true_add(json
, "tosRoutesOnly");
3431 json_object_boolean_true_add(json
, "rfc2328Conform");
3432 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
3434 json_object_boolean_true_add(json
, "rfc1583Compatibility");
3439 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
3440 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
3441 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
3442 CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
) ?
3443 "enabled" : "disabled", VTY_NEWLINE
);
3448 if (CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
))
3450 json_object_boolean_true_add(json
, "opaqueCapable");
3455 vty_out (vty
, " OpaqueCapability flag is %s%s",
3456 CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
) ? "enabled" : "disabled",
3460 /* Show stub-router configuration */
3461 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
3462 || ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3466 json_object_boolean_true_add(json
, "stubAdvertisement");
3467 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3468 json_object_int_add(json
,"postStartEnabledMsecs", ospf
->stub_router_startup_time
/ 1000);
3469 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3470 json_object_int_add(json
,"preShutdownEnabledMsecs", ospf
->stub_router_shutdown_time
/ 1000);
3474 vty_out (vty
, " Stub router advertisement is configured%s",
3476 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3477 vty_out (vty
, " Enabled for %us after start-up%s",
3478 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
3479 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
3480 vty_out (vty
, " Enabled for %us prior to full shutdown%s",
3481 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
3485 /* Show SPF timers. */
3488 json_object_int_add(json
, "spfScheduleDelayMsecs", ospf
->spf_delay
);
3489 json_object_int_add(json
, "holdtimeMinMsecs", ospf
->spf_holdtime
);
3490 json_object_int_add(json
, "holdtimeMaxMsecs", ospf
->spf_max_holdtime
);
3491 json_object_int_add(json
, "holdtimeMultplier", ospf
->spf_hold_multiplier
);
3495 vty_out (vty
, " Initial SPF scheduling delay %d millisec(s)%s"
3496 " Minimum hold time between consecutive SPFs %d millisec(s)%s"
3497 " Maximum hold time between consecutive SPFs %d millisec(s)%s"
3498 " Hold time multiplier is currently %d%s",
3499 ospf
->spf_delay
, VTY_NEWLINE
,
3500 ospf
->spf_holdtime
, VTY_NEWLINE
,
3501 ospf
->spf_max_holdtime
, VTY_NEWLINE
,
3502 ospf
->spf_hold_multiplier
, VTY_NEWLINE
);
3507 if (ospf
->ts_spf
.tv_sec
|| ospf
->ts_spf
.tv_usec
)
3509 unsigned long time_store
= 0;
3511 result
= tv_sub (recent_relative_time(), ospf
->ts_spf
);
3512 result
= tv_sub (result
, recent_relative_time());
3513 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3514 json_object_int_add(json
, "spfLastExecutedMsecs", time_store
);
3516 time_store
= (1000 * ospf
->ts_spf_duration
.tv_sec
) + (ospf
->ts_spf_duration
.tv_usec
/ 1000);
3517 json_object_int_add(json
, "spfLastDurationMsecs", time_store
);
3520 json_object_boolean_true_add(json
, "spfHasNotRun");
3524 vty_out (vty
, " SPF algorithm ");
3525 if (ospf
->ts_spf
.tv_sec
|| ospf
->ts_spf
.tv_usec
)
3527 result
= tv_sub (recent_relative_time(), ospf
->ts_spf
);
3528 vty_out (vty
, "last executed %s ago%s",
3529 ospf_timeval_dump (&result
, timebuf
, sizeof (timebuf
)),
3531 vty_out (vty
, " Last SPF duration %s%s",
3532 ospf_timeval_dump (&ospf
->ts_spf_duration
, timebuf
, sizeof (timebuf
)),
3536 vty_out (vty
, "has not been run%s", VTY_NEWLINE
);
3541 struct timeval temp_time
;
3542 unsigned long time_store
= 0;
3544 if (ospf
->t_spf_calc
)
3546 temp_time
= tv_sub (ospf
->t_spf_calc
->u
.sands
, recent_relative_time());
3547 time_store
= (1000 * temp_time
.tv_sec
) + (temp_time
.tv_usec
/ 1000);
3548 json_object_int_add(json
, "spfTimerDueInMsecs", time_store
);
3551 json_object_int_add(json
, "lsaMinIntervalMsecs", ospf
->min_ls_interval
);
3552 json_object_int_add(json
, "lsaMinArrivalMsecs", ospf
->min_ls_arrival
);
3553 /* Show write multiplier values */
3554 json_object_int_add(json
, "writeMultiplier", ospf
->write_oi_count
);
3555 /* Show refresh parameters. */
3556 json_object_int_add(json
, "refreshTimerMsecs", ospf
->lsa_refresh_interval
* 1000);
3560 vty_out (vty
, " SPF timer %s%s%s",
3561 (ospf
->t_spf_calc
? "due in " : "is "),
3562 ospf_timer_dump (ospf
->t_spf_calc
, timebuf
, sizeof (timebuf
)),
3565 vty_out (vty
, " LSA minimum interval %d msecs%s",
3566 ospf
->min_ls_interval
, VTY_NEWLINE
);
3567 vty_out (vty
, " LSA minimum arrival %d msecs%s",
3568 ospf
->min_ls_arrival
, VTY_NEWLINE
);
3570 /* Show write multiplier values */
3571 vty_out (vty
, " Write Multiplier set to %d %s",
3572 ospf
->write_oi_count
, VTY_NEWLINE
);
3574 /* Show refresh parameters. */
3575 vty_out (vty
, " Refresh timer %d secs%s",
3576 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
3579 /* Show ABR/ASBR flags. */
3580 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
3583 json_object_string_add(json
, "abrType", ospf_abr_type_descr_str
[ospf
->abr_type
]);
3585 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
3586 ospf_abr_type_descr_str
[ospf
->abr_type
], VTY_NEWLINE
);
3588 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
3591 json_object_string_add(json
, "asbrRouter", "injectingExternalRoutingInformation");
3593 vty_out (vty
, " This router is an ASBR "
3594 "(injecting external routing information)%s", VTY_NEWLINE
);
3597 /* Show Number of AS-external-LSAs. */
3600 json_object_int_add(json
, "lsaExternalCounter",
3601 ospf_lsdb_count (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
));
3602 json_object_int_add(json
, "lsaExternalChecksum",
3603 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
));
3607 vty_out (vty
, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
3608 ospf_lsdb_count (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
),
3609 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
), VTY_NEWLINE
);
3614 json_object_int_add(json
, "lsaAsopaqueCounter",
3615 ospf_lsdb_count (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
));
3616 json_object_int_add(json
, "lsaAsOpaqueChecksum",
3617 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
));
3621 vty_out (vty
, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
3622 ospf_lsdb_count (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
),
3623 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
), VTY_NEWLINE
);
3626 /* Show number of areas attached. */
3628 json_object_int_add(json
, "attachedAreaCounter", listcount (ospf
->areas
));
3630 vty_out (vty
, " Number of areas attached to this router: %d%s",
3631 listcount (ospf
->areas
), VTY_NEWLINE
);
3633 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
))
3635 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
))
3638 json_object_boolean_true_add(json
, "adjacencyChangesLoggedAll");
3640 vty_out(vty
, " All adjacency changes are logged%s",VTY_NEWLINE
);
3645 json_object_boolean_true_add(json
, "adjacencyChangesLogged");
3647 vty_out(vty
, " Adjacency changes are logged%s",VTY_NEWLINE
);
3650 /* Show each area status. */
3651 for (ALL_LIST_ELEMENTS (ospf
->areas
, node
, nnode
, area
))
3652 show_ip_ospf_area (vty
, area
, json_areas
, use_json
);
3656 json_object_object_add(json
, "areas", json_areas
);
3657 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
3658 json_object_free(json
);
3661 vty_out (vty
, "%s",VTY_NEWLINE
);
3666 DEFUN (show_ip_ospf
,
3668 "show ip ospf [json]",
3671 "OSPF information\n"
3672 "JavaScript Object Notation\n")
3675 u_char uj
= use_json(argc
, argv
);
3677 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
3680 return (show_ip_ospf_common(vty
, ospf
, uj
));
3683 DEFUN (show_ip_ospf_instance
,
3684 show_ip_ospf_instance_cmd
,
3685 "show ip ospf (1-65535) [json]",
3688 "OSPF information\n"
3690 "JavaScript Object Notation\n")
3694 u_short instance
= 0;
3695 u_char uj
= use_json(argc
, argv
);
3697 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
3698 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
3701 return (show_ip_ospf_common(vty
, ospf
, uj
));
3705 show_ip_ospf_interface_sub (struct vty
*vty
, struct ospf
*ospf
, struct interface
*ifp
,
3706 json_object
*json_interface_sub
, u_char use_json
)
3709 struct ospf_neighbor
*nbr
;
3710 struct route_node
*rn
;
3712 /* Is interface up? */
3715 is_up
= if_is_operative(ifp
);
3717 json_object_boolean_true_add(json_interface_sub
, "ifUp");
3719 json_object_boolean_false_add(json_interface_sub
, "ifDown");
3721 json_object_int_add(json_interface_sub
, "ifIndex", ifp
->ifindex
);
3722 json_object_int_add(json_interface_sub
, "mtuBytes", ifp
->mtu
);
3723 json_object_int_add(json_interface_sub
, "bandwidthMbit", ifp
->bandwidth
);
3724 json_object_string_add(json_interface_sub
, "ifFlags", if_flag_dump(ifp
->flags
));
3728 vty_out (vty
, "%s is %s%s", ifp
->name
,
3729 ((is_up
= if_is_operative(ifp
)) ? "up" : "down"), VTY_NEWLINE
);
3730 vty_out (vty
, " ifindex %u, MTU %u bytes, BW %u Mbit %s%s",
3731 ifp
->ifindex
, ifp
->mtu
, ifp
->bandwidth
, if_flag_dump(ifp
->flags
),
3735 /* Is interface OSPF enabled? */
3738 if (ospf_oi_count(ifp
) == 0)
3740 json_object_boolean_false_add(json_interface_sub
, "ospfEnabled");
3745 json_object_boolean_false_add(json_interface_sub
, "ospfRunning");
3749 json_object_boolean_true_add(json_interface_sub
, "ospfEnabled");
3753 if (ospf_oi_count(ifp
) == 0)
3755 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
3760 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
3766 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
3768 struct ospf_interface
*oi
= rn
->info
;
3773 if (CHECK_FLAG(oi
->connected
->flags
, ZEBRA_IFA_UNNUMBERED
))
3776 json_object_boolean_true_add(json_interface_sub
, "ifUnnumbered");
3778 vty_out (vty
, " This interface is UNNUMBERED,");
3782 /* Show OSPF interface information. */
3785 json_object_string_add(json_interface_sub
, "ipAddress", inet_ntoa (oi
->address
->u
.prefix4
));
3786 json_object_int_add(json_interface_sub
, "ipAddressPrefixlen", oi
->address
->prefixlen
);
3789 vty_out (vty
, " Internet Address %s/%d,",
3790 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
3792 if (oi
->connected
->destination
|| oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3794 struct in_addr
*dest
;
3797 if (CONNECTED_PEER(oi
->connected
)
3798 || oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3803 /* For Vlinks, showing the peer address is probably more
3804 * * * * * informative than the local interface that is being used
3806 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3807 dest
= &oi
->vl_data
->peer_addr
;
3809 dest
= &oi
->connected
->destination
->u
.prefix4
;
3813 json_object_string_add(json_interface_sub
, "ospfIfType", dstr
);
3814 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
3815 json_object_string_add(json_interface_sub
, "vlinkPeer", inet_ntoa (*dest
));
3817 json_object_string_add(json_interface_sub
, "localIfUsed", inet_ntoa (*dest
));
3820 vty_out (vty
, " %s %s,", dstr
, inet_ntoa (*dest
));
3825 json_object_string_add(json_interface_sub
, "area", ospf_area_desc_string (oi
->area
));
3826 if (OSPF_IF_PARAM(oi
, mtu_ignore
))
3827 json_object_boolean_true_add(json_interface_sub
, "mtuMismatchDetect");
3828 json_object_string_add(json_interface_sub
, "routerId", inet_ntoa (ospf
->router_id
));
3829 json_object_string_add(json_interface_sub
, "networkType", ospf_network_type_str
[oi
->type
]);
3830 json_object_int_add(json_interface_sub
, "cost", oi
->output_cost
);
3831 json_object_int_add(json_interface_sub
, "transmitDelayMsecs", 1000 / OSPF_IF_PARAM (oi
,transmit_delay
));
3832 json_object_string_add(json_interface_sub
, "state", LOOKUP (ospf_ism_state_msg
, oi
->state
));
3833 json_object_int_add(json_interface_sub
, "priority", PRIORITY (oi
));
3837 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
3840 vty_out (vty
, " MTU mismatch detection:%s%s",
3841 OSPF_IF_PARAM(oi
, mtu_ignore
) ? "disabled" : "enabled", VTY_NEWLINE
);
3843 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
3844 inet_ntoa (ospf
->router_id
), ospf_network_type_str
[oi
->type
],
3845 oi
->output_cost
, VTY_NEWLINE
);
3847 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
3848 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
3849 PRIORITY (oi
), VTY_NEWLINE
);
3852 /* Show DR information. */
3853 if (DR (oi
).s_addr
== 0)
3856 vty_out (vty
, " No backup designated router on this network%s",
3861 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
3865 vty_out (vty
, " No backup designated router on this network%s",
3872 json_object_string_add(json_interface_sub
, "bdrId", inet_ntoa (nbr
->router_id
));
3873 json_object_string_add(json_interface_sub
, "bdrAddress", inet_ntoa (nbr
->address
.u
.prefix4
));
3877 vty_out (vty
, " Backup Designated Router (ID) %s,",
3878 inet_ntoa (nbr
->router_id
));
3879 vty_out (vty
, " Interface Address %s%s",
3880 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
3885 /* Next network-LSA sequence number we'll use, if we're elected DR */
3886 if (oi
->params
&& ntohl (oi
->params
->network_lsa_seqnum
) != OSPF_INITIAL_SEQUENCE_NUMBER
)
3889 json_object_int_add(json_interface_sub
, "networkLsaSequence", ntohl (oi
->params
->network_lsa_seqnum
));
3891 vty_out (vty
, " Saved Network-LSA sequence number 0x%x%s",
3892 ntohl (oi
->params
->network_lsa_seqnum
), VTY_NEWLINE
);
3897 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
3898 || OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3900 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
))
3901 json_object_boolean_true_add(json_interface_sub
, "mcastMemberOspfAllRouters");
3902 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3903 json_object_boolean_true_add(json_interface_sub
, "mcastMemberOspfDesignatedRouters");
3908 vty_out (vty
, " Multicast group memberships:");
3909 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
3910 || OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3912 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
))
3913 vty_out (vty
, " OSPFAllRouters");
3914 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
3915 vty_out (vty
, " OSPFDesignatedRouters");
3918 vty_out (vty
, " <None>");
3919 vty_out (vty
, "%s", VTY_NEWLINE
);
3924 if (OSPF_IF_PARAM (oi
, fast_hello
) == 0)
3925 json_object_int_add(json_interface_sub
, "timerMsecs", 1000 /OSPF_IF_PARAM (oi
, v_hello
));
3927 json_object_int_add(json_interface_sub
, "timerMsecs", 1000 / OSPF_IF_PARAM (oi
, fast_hello
));
3928 json_object_int_add(json_interface_sub
, "timerDeadMsecs", 1000 / OSPF_IF_PARAM (oi
, v_wait
));
3929 json_object_int_add(json_interface_sub
, "timerWaitMsecs", 1000 / OSPF_IF_PARAM (oi
, v_wait
));
3930 json_object_int_add(json_interface_sub
, "timerRetransmit", 1000 / OSPF_IF_PARAM (oi
, retransmit_interval
));
3934 vty_out (vty
, " Timer intervals configured,");
3935 vty_out (vty
, " Hello ");
3936 if (OSPF_IF_PARAM (oi
, fast_hello
) == 0)
3937 vty_out (vty
, "%ds,", OSPF_IF_PARAM (oi
, v_hello
));
3939 vty_out (vty
, "%dms,", 1000 / OSPF_IF_PARAM (oi
, fast_hello
));
3940 vty_out (vty
, " Dead %ds, Wait %ds, Retransmit %d%s",
3941 OSPF_IF_PARAM (oi
, v_wait
),
3942 OSPF_IF_PARAM (oi
, v_wait
),
3943 OSPF_IF_PARAM (oi
, retransmit_interval
),
3947 if (OSPF_IF_PASSIVE_STATUS (oi
) == OSPF_IF_ACTIVE
)
3949 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3952 struct timeval result
;
3953 unsigned long time_store
= 0;
3955 result
= tv_sub (oi
->t_hello
->u
.sands
, recent_relative_time());
3961 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
3962 json_object_int_add(json_interface_sub
, "timerHelloInMsecs", time_store
);
3965 vty_out (vty
, " Hello due in %s%s",
3966 ospf_timer_dump (oi
->t_hello
, timebuf
, sizeof(timebuf
)),
3969 else /* passive-interface is set */
3972 json_object_boolean_true_add(json_interface_sub
, "timerPassiveIface");
3974 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
3979 json_object_int_add(json_interface_sub
, "nbrCount", ospf_nbr_count (oi
, 0));
3980 json_object_int_add(json_interface_sub
, "nbrAdjacentCount", ospf_nbr_count (oi
, NSM_Full
));
3983 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
3984 ospf_nbr_count (oi
, 0), ospf_nbr_count (oi
, NSM_Full
),
3986 ospf_bfd_interface_show(vty
, ifp
, json_interface_sub
, use_json
);
3991 show_ip_ospf_interface_common (struct vty
*vty
, struct ospf
*ospf
, int argc
,
3992 const char **argv
, int iface_argv
, u_char use_json
)
3994 struct interface
*ifp
;
3995 struct listnode
*node
;
3996 json_object
*json
= NULL
;
3997 json_object
*json_interface_sub
= NULL
;
4001 json
= json_object_new_object();
4002 json_interface_sub
= json_object_new_object();
4008 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4010 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4011 VTY_NEWLINE
, VTY_NEWLINE
);
4014 if (argc
== (iface_argv
+ 1))
4016 /* Show All Interfaces.*/
4017 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
4019 if (ospf_oi_count(ifp
))
4021 show_ip_ospf_interface_sub (vty
, ospf
, ifp
, json_interface_sub
, use_json
);
4023 json_object_object_add (json
, ifp
->name
, json_interface_sub
);
4027 else if (argv
[iface_argv
] && strcmp(argv
[iface_argv
], "json") == 0)
4031 json
= json_object_new_object();
4032 json_interface_sub
= json_object_new_object ();
4035 /* Show All Interfaces. */
4036 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
4038 if (ospf_oi_count(ifp
))
4040 show_ip_ospf_interface_sub (vty
, ospf
, ifp
, json_interface_sub
, use_json
);
4042 json_object_object_add(json
, ifp
->name
, json_interface_sub
);
4048 /* Interface name is specified. */
4049 if ((ifp
= if_lookup_by_name (argv
[iface_argv
])) == NULL
)
4052 json_object_boolean_true_add(json
, "noSuchIface");
4054 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
4058 show_ip_ospf_interface_sub (vty
, ospf
, ifp
, json_interface_sub
, use_json
);
4060 json_object_object_add(json
, ifp
->name
, json_interface_sub
);
4066 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4067 json_object_free(json
);
4070 vty_out (vty
, "%s", VTY_NEWLINE
);
4075 DEFUN (show_ip_ospf_interface
,
4076 show_ip_ospf_interface_cmd
,
4077 "show ip ospf interface [INTERFACE] [json]",
4080 "OSPF information\n"
4081 "Interface information\n"
4083 "JavaScript Object Notation\n")
4086 u_char uj
= use_json(argc
, argv
);
4088 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4091 return show_ip_ospf_interface_common(vty
, ospf
, argc
, argv
, 0, uj
);
4094 DEFUN (show_ip_ospf_instance_interface
,
4095 show_ip_ospf_instance_interface_cmd
,
4096 "show ip ospf (1-65535) interface [INTERFACE] [json]",
4099 "OSPF information\n"
4101 "Interface information\n"
4103 "JavaScript Object Notation\n")
4107 u_short instance
= 0;
4108 u_char uj
= use_json(argc
, argv
);
4110 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
4111 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
4114 return show_ip_ospf_interface_common(vty
, ospf
, argc
, argv
, 1, uj
);
4118 show_ip_ospf_neighbour_header (struct vty
*vty
)
4120 vty_out (vty
, "%s%-15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
4122 "Neighbor ID", "Pri", "State", "Dead Time",
4123 "Address", "Interface", "RXmtL", "RqstL", "DBsmL",
4128 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
, json_object
*json
, u_char use_json
)
4130 struct route_node
*rn
;
4131 struct ospf_neighbor
*nbr
;
4133 char timebuf
[OSPF_TIME_DUMP_SIZE
];
4134 json_object
*json_neighbor
= NULL
;
4136 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4138 if ((nbr
= rn
->info
))
4140 /* Do not show myself. */
4141 if (nbr
!= oi
->nbr_self
)
4143 /* Down state is not shown. */
4144 if (nbr
->state
!= NSM_Down
)
4148 json_neighbor
= json_object_new_object();
4149 ospf_nbr_state_message (nbr
, msgbuf
, 16);
4151 struct timeval result
;
4152 unsigned long time_store
= 0;
4154 result
= tv_sub (nbr
->t_inactivity
->u
.sands
, recent_relative_time());
4155 time_store
= (1000 * result
.tv_sec
) + (result
.tv_usec
/ 1000);
4157 json_object_int_add (json_neighbor
, "priority", nbr
->priority
);
4158 json_object_string_add (json_neighbor
, "state", msgbuf
);
4159 json_object_int_add (json_neighbor
, "deadTimeMsecs", time_store
);
4160 json_object_string_add (json_neighbor
, "address", inet_ntoa (nbr
->src
));
4161 json_object_string_add (json_neighbor
, "ifaceName", IF_NAME (oi
));
4162 json_object_int_add (json_neighbor
, "retransmitCounter", ospf_ls_retransmit_count (nbr
));
4163 json_object_int_add (json_neighbor
, "requestCounter", ospf_ls_request_count (nbr
));
4164 json_object_int_add (json_neighbor
, "dbSummaryCounter", ospf_db_summary_count (nbr
));
4165 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4166 json_object_object_add(json
, "neighbor", json_neighbor
);
4168 json_object_object_add(json
, inet_ntoa (nbr
->router_id
), json_neighbor
);
4172 ospf_nbr_state_message (nbr
, msgbuf
, 16);
4174 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4175 vty_out (vty
, "%-15s %3d %-15s ",
4179 vty_out (vty
, "%-15s %3d %-15s ",
4180 inet_ntoa (nbr
->router_id
), nbr
->priority
,
4183 vty_out (vty
, "%9s ",
4184 ospf_timer_dump (nbr
->t_inactivity
, timebuf
,
4186 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
4187 vty_out (vty
, "%-20s %5ld %5ld %5d%s",
4188 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
4189 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
4199 show_ip_ospf_neighbor_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4201 struct ospf_interface
*oi
;
4202 struct listnode
*node
;
4203 json_object
*json
= NULL
;
4206 json
= json_object_new_object();
4208 show_ip_ospf_neighbour_header (vty
);
4213 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4215 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4216 VTY_NEWLINE
, VTY_NEWLINE
);
4219 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4220 show_ip_ospf_neighbor_sub (vty
, oi
, json
, use_json
);
4224 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4225 json_object_free(json
);
4228 vty_out (vty
, "%s", VTY_NEWLINE
);
4233 DEFUN (show_ip_ospf_neighbor
,
4234 show_ip_ospf_neighbor_cmd
,
4235 "show ip ospf neighbor [json]",
4238 "OSPF information\n"
4240 "JavaScript Object Notation\n")
4243 u_char uj
= use_json(argc
, argv
);
4245 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4248 return show_ip_ospf_neighbor_common(vty
, ospf
, uj
);
4252 DEFUN (show_ip_ospf_instance_neighbor
,
4253 show_ip_ospf_instance_neighbor_cmd
,
4254 "show ip ospf (1-65535) neighbor [json]",
4257 "OSPF information\n"
4260 "JavaScript Object Notation\n")
4264 u_short instance
= 0;
4265 u_char uj
= use_json(argc
, argv
);
4267 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
4268 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4271 return show_ip_ospf_neighbor_common(vty
, ospf
, uj
);
4275 show_ip_ospf_neighbor_all_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4277 struct listnode
*node
;
4278 struct ospf_interface
*oi
;
4279 json_object
*json
= NULL
;
4280 json_object
*json_neighbor_sub
= NULL
;
4284 json
= json_object_new_object();
4285 json_neighbor_sub
= json_object_new_object();
4288 show_ip_ospf_neighbour_header (vty
);
4293 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4295 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4296 VTY_NEWLINE
, VTY_NEWLINE
);
4299 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4301 struct listnode
*nbr_node
;
4302 struct ospf_nbr_nbma
*nbr_nbma
;
4304 show_ip_ospf_neighbor_sub (vty
, oi
, json
, use_json
);
4306 /* print Down neighbor status */
4307 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nbr_node
, nbr_nbma
))
4309 if (nbr_nbma
->nbr
== NULL
4310 || nbr_nbma
->nbr
->state
== NSM_Down
)
4314 json_object_int_add (json_neighbor_sub
, "nbrNbmaPriority", nbr_nbma
->priority
);
4315 json_object_boolean_true_add (json_neighbor_sub
, "nbrNbmaDown");
4316 json_object_string_add (json_neighbor_sub
, "nbrNbmaIfaceName", IF_NAME (oi
));
4317 json_object_int_add (json_neighbor_sub
, "nbrNbmaRetransmitCounter", 0);
4318 json_object_int_add (json_neighbor_sub
, "nbrNbmaRequestCounter", 0);
4319 json_object_int_add (json_neighbor_sub
, "nbrNbmaDbSummaryCounter", 0);
4320 json_object_object_add(json
, inet_ntoa (nbr_nbma
->addr
), json_neighbor_sub
);
4324 vty_out (vty
, "%-15s %3d %-15s %9s ",
4325 "-", nbr_nbma
->priority
, "Down", "-");
4326 vty_out (vty
, "%-15s %-20s %5d %5d %5d%s",
4327 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
4328 0, 0, 0, VTY_NEWLINE
);
4336 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4337 json_object_free(json
);
4340 vty_out (vty
, "%s", VTY_NEWLINE
);
4345 DEFUN (show_ip_ospf_neighbor_all
,
4346 show_ip_ospf_neighbor_all_cmd
,
4347 "show ip ospf neighbor all [json]",
4350 "OSPF information\n"
4352 "include down status neighbor\n"
4353 "JavaScript Object Notation\n")
4356 u_char uj
= use_json(argc
, argv
);
4358 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4361 return show_ip_ospf_neighbor_all_common(vty
, ospf
, uj
);
4364 DEFUN (show_ip_ospf_instance_neighbor_all
,
4365 show_ip_ospf_instance_neighbor_all_cmd
,
4366 "show ip ospf (1-65535) neighbor all [json]",
4369 "OSPF information\n"
4372 "include down status neighbor\n"
4373 "JavaScript Object Notation\n")
4377 u_short instance
= 0;
4378 u_char uj
= use_json(argc
, argv
);
4380 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
4381 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4384 return show_ip_ospf_neighbor_all_common(vty
, ospf
, uj
);
4388 show_ip_ospf_neighbor_int_common (struct vty
*vty
, struct ospf
*ospf
, int arg_base
,
4389 const char **argv
, u_char use_json
)
4391 struct interface
*ifp
;
4392 struct route_node
*rn
;
4393 json_object
*json
= NULL
;
4396 json
= json_object_new_object();
4398 show_ip_ospf_neighbour_header (vty
);
4403 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4405 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4406 VTY_NEWLINE
, VTY_NEWLINE
);
4409 ifp
= if_lookup_by_name (argv
[arg_base
]);
4413 json_object_boolean_true_add(json
, "noSuchIface");
4415 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
4419 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4421 struct ospf_interface
*oi
= rn
->info
;
4426 show_ip_ospf_neighbor_sub (vty
, oi
, json
, use_json
);
4431 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4432 json_object_free(json
);
4435 vty_out (vty
, "%s", VTY_NEWLINE
);
4440 DEFUN (show_ip_ospf_neighbor_int
,
4441 show_ip_ospf_neighbor_int_cmd
,
4442 "show ip ospf neighbor IFNAME [json]",
4445 "OSPF information\n"
4448 "JavaScript Object Notation\n")
4451 u_char uj
= use_json(argc
, argv
);
4453 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4456 return show_ip_ospf_neighbor_int_common(vty
, ospf
, 0, argv
, uj
);
4459 DEFUN (show_ip_ospf_instance_neighbor_int
,
4460 show_ip_ospf_instance_neighbor_int_cmd
,
4461 "show ip ospf (1-65535) neighbor IFNAME [json]",
4464 "OSPF information\n"
4468 "JavaScript Object Notation\n")
4472 u_short instance
= 0;
4473 u_char uj
= use_json(argc
, argv
);
4475 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
4476 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4479 return show_ip_ospf_neighbor_int_common(vty
, ospf
, 1, argv
, uj
);
4483 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
, struct ospf_nbr_nbma
*nbr_nbma
,
4484 u_char use_json
, json_object
*json
)
4486 char timebuf
[OSPF_TIME_DUMP_SIZE
];
4487 json_object
*json_sub
= NULL
;
4490 json_sub
= json_object_new_object();
4491 else /* Show neighbor ID. */
4492 vty_out (vty
, " Neighbor %s,", "-");
4494 /* Show interface address. */
4496 json_object_string_add(json_sub
, "ifaceAddress", inet_ntoa (nbr_nbma
->addr
));
4498 vty_out (vty
, " interface address %s%s",
4499 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
4504 json_object_string_add(json_sub
, "areaId", ospf_area_desc_string (oi
->area
));
4505 json_object_string_add(json_sub
, "iface", IF_NAME (oi
));
4508 vty_out (vty
, " In the area %s via interface %s%s",
4509 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
4511 /* Show neighbor priority and state. */
4514 json_object_int_add(json_sub
, "nbrPriority", nbr_nbma
->priority
);
4515 json_object_string_add(json_sub
, "nbrState", "down");
4518 vty_out (vty
, " Neighbor priority is %d, State is %s,",
4519 nbr_nbma
->priority
, "Down");
4521 /* Show state changes. */
4523 json_object_int_add(json_sub
, "stateChangeCounter", nbr_nbma
->state_change
);
4525 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
4527 /* Show PollInterval */
4529 json_object_int_add(json_sub
, "pollInterval", nbr_nbma
->v_poll
);
4531 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
4533 /* Show poll-interval timer. */
4536 struct timeval res
= tv_sub (nbr_nbma
->t_poll
->u
.sands
, recent_relative_time ());
4537 unsigned long time_store
= 0;
4538 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4539 json_object_int_add(json_sub
, "pollIntervalTimerDueMsec", time_store
);
4542 vty_out (vty
, " Poll timer due in %s%s",
4543 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, sizeof(timebuf
)),
4546 /* Show poll-interval timer thread. */
4549 if (nbr_nbma
->t_poll
!= NULL
)
4550 json_object_string_add(json_sub
, "pollIntervalTimerThread", "on");
4553 vty_out (vty
, " Thread Poll Timer %s%s",
4554 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
4557 json_object_object_add(json
, "noNbrId", json_sub
);
4561 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
4562 struct ospf_neighbor
*nbr
, u_char use_json
, json_object
*json
)
4564 char timebuf
[OSPF_TIME_DUMP_SIZE
];
4565 json_object
*json_sub
= NULL
;
4568 json_sub
= json_object_new_object();
4571 /* Show neighbor ID. */
4572 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4573 vty_out (vty
, " Neighbor %s,", "-");
4575 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
4578 /* Show interface address. */
4580 json_object_string_add(json_sub
, "ifaceAddress", inet_ntoa (nbr
->address
.u
.prefix4
));
4582 vty_out (vty
, " interface address %s%s",
4583 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
4588 json_object_string_add(json_sub
, "areaId", ospf_area_desc_string (oi
->area
));
4589 json_object_string_add(json_sub
, "ifaceName", oi
->ifp
->name
);
4592 vty_out (vty
, " In the area %s via interface %s%s",
4593 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
4595 /* Show neighbor priority and state. */
4598 json_object_int_add(json_sub
, "nbrPriority", nbr
->priority
);
4599 json_object_string_add(json_sub
, "nbrState", LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
4602 vty_out (vty
, " Neighbor priority is %d, State is %s,",
4603 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
4605 /* Show state changes. */
4607 json_object_int_add(json_sub
, "stateChangeCounter", nbr
->state_change
);
4609 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
4611 if (nbr
->ts_last_progress
.tv_sec
|| nbr
->ts_last_progress
.tv_usec
)
4613 struct timeval res
= tv_sub (recent_relative_time (), nbr
->ts_last_progress
);
4616 unsigned long time_store
= 0;
4617 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4618 json_object_int_add(json_sub
, "lastPrgrsvChangeMsec", time_store
);
4622 vty_out (vty
, " Most recent state change statistics:%s",
4624 vty_out (vty
, " Progressive change %s ago%s",
4625 ospf_timeval_dump (&res
, timebuf
, sizeof(timebuf
)),
4630 if (nbr
->ts_last_regress
.tv_sec
|| nbr
->ts_last_regress
.tv_usec
)
4632 struct timeval res
= tv_sub (recent_relative_time (), nbr
->ts_last_regress
);
4635 unsigned long time_store
= 0;
4636 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4637 json_object_int_add(json_sub
, "lastRegressiveChangeMsec", time_store
);
4638 if (nbr
->last_regress_str
)
4639 json_object_string_add(json_sub
, "lastRegressiveChangeReason", nbr
->last_regress_str
);
4643 vty_out (vty
, " Regressive change %s ago, due to %s%s",
4644 ospf_timeval_dump (&res
, timebuf
, sizeof(timebuf
)),
4645 (nbr
->last_regress_str
? nbr
->last_regress_str
: "??"),
4650 /* Show Designated Rotuer ID. */
4652 json_object_string_add(json_sub
, "routerDesignatedId", inet_ntoa (nbr
->d_router
));
4654 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
4656 /* Show Backup Designated Rotuer ID. */
4658 json_object_string_add(json_sub
, "routerDesignatedBackupId", inet_ntoa (nbr
->bd_router
));
4660 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
4665 json_object_int_add(json_sub
, "optionsCounter", nbr
->options
);
4666 json_object_string_add(json_sub
, "optionsList", ospf_options_dump (nbr
->options
));
4669 vty_out (vty
, " Options %d %s%s", nbr
->options
,
4670 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
4672 /* Show Router Dead interval timer. */
4675 struct timeval res
= tv_sub (nbr
->t_inactivity
->u
.sands
, recent_relative_time ());
4676 unsigned long time_store
= 0;
4677 time_store
= (1000 * res
.tv_sec
) + (res
.tv_usec
/ 1000);
4678 json_object_int_add(json_sub
, "routerDeadIntervalTimerDueMsec", time_store
);
4681 vty_out (vty
, " Dead timer due in %s%s",
4682 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, sizeof (timebuf
)),
4685 /* Show Database Summary list. */
4687 json_object_int_add(json_sub
, "databaseSummaryListCounter", ospf_db_summary_count (nbr
));
4689 vty_out (vty
, " Database Summary List %d%s",
4690 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
4692 /* Show Link State Request list. */
4694 json_object_int_add(json_sub
, "linkStateRequestListCounter", ospf_ls_request_count (nbr
));
4696 vty_out (vty
, " Link State Request List %ld%s",
4697 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
4699 /* Show Link State Retransmission list. */
4701 json_object_int_add(json_sub
, "linkStateRetransmissionListCounter", ospf_ls_retransmit_count (nbr
));
4703 vty_out (vty
, " Link State Retransmission List %ld%s",
4704 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
4706 /* Show inactivity timer thread. */
4709 if (nbr
->t_inactivity
!= NULL
)
4710 json_object_string_add(json_sub
, "threadInactivityTimer", "on");
4713 vty_out (vty
, " Thread Inactivity Timer %s%s",
4714 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
4716 /* Show Database Description retransmission thread. */
4719 if (nbr
->t_db_desc
!= NULL
)
4720 json_object_string_add(json_sub
, "threadDatabaseDescriptionRetransmission", "on");
4723 vty_out (vty
, " Thread Database Description Retransmision %s%s",
4724 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
4726 /* Show Link State Request Retransmission thread. */
4729 if (nbr
->t_ls_req
!= NULL
)
4730 json_object_string_add(json_sub
, "threadLinkStateRequestRetransmission", "on");
4733 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
4734 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
4736 /* Show Link State Update Retransmission thread. */
4739 if (nbr
->t_ls_upd
!= NULL
)
4740 json_object_string_add(json_sub
, "threadLinkStateUpdateRetransmission", "on");
4743 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
4744 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
4748 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
4749 json_object_object_add(json
, "noNbrId", json_sub
);
4751 json_object_object_add(json
, inet_ntoa (nbr
->router_id
), json_sub
);
4754 ospf_bfd_show_info(vty
, nbr
->bfd_info
, json
, use_json
, 0);
4758 show_ip_ospf_neighbor_id_common (struct vty
*vty
, struct ospf
*ospf
,
4759 int arg_base
, const char **argv
, u_char use_json
)
4761 struct listnode
*node
;
4762 struct ospf_neighbor
*nbr
;
4763 struct ospf_interface
*oi
;
4764 struct in_addr router_id
;
4766 json_object
*json
= NULL
;
4769 json
= json_object_new_object();
4774 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4776 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4777 VTY_NEWLINE
, VTY_NEWLINE
);
4780 ret
= inet_aton (argv
[arg_base
], &router_id
);
4784 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
4788 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4790 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
4792 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
, use_json
, json
);
4798 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4799 json_object_free(json
);
4802 vty_out (vty
, "%s", VTY_NEWLINE
);
4807 DEFUN (show_ip_ospf_neighbor_id
,
4808 show_ip_ospf_neighbor_id_cmd
,
4809 "show ip ospf neighbor A.B.C.D [json]",
4812 "OSPF information\n"
4815 "JavaScript Object Notation\n")
4818 u_char uj
= use_json(argc
, argv
);
4820 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4823 return show_ip_ospf_neighbor_id_common(vty
, ospf
, 0, argv
, uj
);
4826 DEFUN (show_ip_ospf_instance_neighbor_id
,
4827 show_ip_ospf_instance_neighbor_id_cmd
,
4828 "show ip ospf (1-65535) neighbor A.B.C.D [json]",
4831 "OSPF information\n"
4835 "JavaScript Object Notation\n")
4839 u_short instance
= 0;
4840 u_char uj
= use_json(argc
, argv
);
4842 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
4843 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
4846 return show_ip_ospf_neighbor_id_common(vty
, ospf
, 1, argv
, uj
);
4850 show_ip_ospf_neighbor_detail_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4852 struct ospf_interface
*oi
;
4853 struct listnode
*node
;
4854 json_object
*json
= NULL
;
4857 json
= json_object_new_object();
4862 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4864 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4865 VTY_NEWLINE
, VTY_NEWLINE
);
4868 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4870 struct route_node
*rn
;
4871 struct ospf_neighbor
*nbr
;
4873 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4875 if ((nbr
= rn
->info
))
4877 if (nbr
!= oi
->nbr_self
)
4879 if (nbr
->state
!= NSM_Down
)
4881 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
, use_json
, json
);
4890 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4891 json_object_free(json
);
4894 vty_out (vty
, "%s", VTY_NEWLINE
);
4899 DEFUN (show_ip_ospf_neighbor_detail
,
4900 show_ip_ospf_neighbor_detail_cmd
,
4901 "show ip ospf neighbor detail [json]",
4904 "OSPF information\n"
4906 "detail of all neighbors\n"
4907 "JavaScript Object Notation\n")
4910 u_char uj
= use_json(argc
, argv
);
4912 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
4915 return show_ip_ospf_neighbor_detail_common(vty
, ospf
, uj
);
4918 DEFUN (show_ip_ospf_instance_neighbor_detail
,
4919 show_ip_ospf_instance_neighbor_detail_cmd
,
4920 "show ip ospf (1-65535) neighbor detail [json]",
4923 "OSPF information\n"
4926 "detail of all neighbors\n"
4927 "JavaScript Object Notation\n")
4931 u_short instance
= 0;
4932 u_char uj
= use_json(argc
, argv
);
4934 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
4935 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
4938 return show_ip_ospf_neighbor_detail_common(vty
, ospf
, uj
);
4942 show_ip_ospf_neighbor_detail_all_common (struct vty
*vty
, struct ospf
*ospf
, u_char use_json
)
4944 struct listnode
*node
;
4945 struct ospf_interface
*oi
;
4946 json_object
*json
= NULL
;
4949 json
= json_object_new_object();
4954 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
4956 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
4957 VTY_NEWLINE
, VTY_NEWLINE
);
4960 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
4962 struct route_node
*rn
;
4963 struct ospf_neighbor
*nbr
;
4964 struct ospf_nbr_nbma
*nbr_nbma
;
4966 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4967 if ((nbr
= rn
->info
))
4968 if (nbr
!= oi
->nbr_self
)
4969 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
4970 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
, use_json
, json
);
4972 if (oi
->type
== OSPF_IFTYPE_NBMA
)
4974 struct listnode
*nd
;
4976 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nd
, nbr_nbma
))
4978 if (nbr_nbma
->nbr
== NULL
|| nbr_nbma
->nbr
->state
== NSM_Down
)
4979 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
, use_json
, json
);
4986 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
4987 json_object_free(json
);
4991 vty_out (vty
, "%s", VTY_NEWLINE
);
4997 DEFUN (show_ip_ospf_neighbor_detail_all
,
4998 show_ip_ospf_neighbor_detail_all_cmd
,
4999 "show ip ospf neighbor detail all [json]",
5002 "OSPF information\n"
5004 "detail of all neighbors\n"
5005 "include down status neighbor\n"
5006 "JavaScript Object Notation\n")
5009 u_char uj
= use_json(argc
, argv
);
5011 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
5014 return show_ip_ospf_neighbor_detail_all_common(vty
, ospf
, uj
);
5017 DEFUN (show_ip_ospf_instance_neighbor_detail_all
,
5018 show_ip_ospf_instance_neighbor_detail_all_cmd
,
5019 "show ip ospf (1-65535) neighbor detail all [json]",
5022 "OSPF information\n"
5025 "detail of all neighbors\n"
5026 "include down status neighbor\n"
5027 "JavaScript Object Notation\n")
5031 u_short instance
= 0;
5032 u_char uj
= use_json(argc
, argv
);
5034 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
5035 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
5038 return show_ip_ospf_neighbor_detail_all_common(vty
, ospf
, uj
);
5042 show_ip_ospf_neighbor_int_detail_common (struct vty
*vty
, struct ospf
*ospf
,
5043 int arg_base
, const char **argv
, u_char use_json
)
5045 struct ospf_interface
*oi
;
5046 struct interface
*ifp
;
5047 struct route_node
*rn
, *nrn
;
5048 struct ospf_neighbor
*nbr
;
5049 json_object
*json
= NULL
;
5052 json
= json_object_new_object();
5057 json_object_int_add(json
, "ospfInstance", ospf
->instance
);
5059 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
5060 VTY_NEWLINE
, VTY_NEWLINE
);
5063 ifp
= if_lookup_by_name (argv
[arg_base
]);
5067 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
5071 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5073 if ((oi
= rn
->info
))
5075 for (nrn
= route_top (oi
->nbrs
); nrn
; nrn
= route_next (nrn
))
5077 if ((nbr
= nrn
->info
))
5079 if (nbr
!= oi
->nbr_self
)
5081 if (nbr
->state
!= NSM_Down
)
5082 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
, use_json
, json
);
5091 vty_out (vty
, "%s%s", json_object_to_json_string(json
), VTY_NEWLINE
);
5092 json_object_free(json
);
5095 vty_out (vty
, "%s", VTY_NEWLINE
);
5100 DEFUN (show_ip_ospf_neighbor_int_detail
,
5101 show_ip_ospf_neighbor_int_detail_cmd
,
5102 "show ip ospf neighbor IFNAME detail [json]",
5105 "OSPF information\n"
5108 "detail of all neighbors\n"
5109 "JavaScript Object Notation\n")
5112 u_char uj
= use_json(argc
, argv
);
5114 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
5117 return show_ip_ospf_neighbor_int_detail_common(vty
, ospf
, 0, argv
, uj
);
5120 DEFUN (show_ip_ospf_instance_neighbor_int_detail
,
5121 show_ip_ospf_instance_neighbor_int_detail_cmd
,
5122 "show ip ospf (1-65535) neighbor IFNAME detail [json]",
5125 "OSPF information\n"
5129 "detail of all neighbors\n"
5130 "JavaScript Object Notation\n")
5134 u_short instance
= 0;
5135 u_char uj
= use_json(argc
, argv
);
5137 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
5138 if ((ospf
= ospf_lookup_instance(instance
)) == NULL
|| !ospf
->oi_running
)
5141 return show_ip_ospf_neighbor_int_detail_common(vty
, ospf
, 1, argv
, uj
);
5144 /* Show functions */
5146 show_lsa_summary (struct vty
*vty
, struct ospf_lsa
*lsa
, int self
)
5148 struct router_lsa
*rl
;
5149 struct summary_lsa
*sl
;
5150 struct as_external_lsa
*asel
;
5151 struct prefix_ipv4 p
;
5154 /* If self option is set, check LSA self flag. */
5155 if (self
== 0 || IS_LSA_SELF (lsa
))
5157 /* LSA common part show. */
5158 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
5159 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
5160 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
5161 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
5162 /* LSA specific part show. */
5163 switch (lsa
->data
->type
)
5165 case OSPF_ROUTER_LSA
:
5166 rl
= (struct router_lsa
*) lsa
->data
;
5167 vty_out (vty
, " %-d", ntohs (rl
->links
));
5169 case OSPF_SUMMARY_LSA
:
5170 sl
= (struct summary_lsa
*) lsa
->data
;
5173 p
.prefix
= sl
->header
.id
;
5174 p
.prefixlen
= ip_masklen (sl
->mask
);
5175 apply_mask_ipv4 (&p
);
5177 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
5179 case OSPF_AS_EXTERNAL_LSA
:
5180 case OSPF_AS_NSSA_LSA
:
5181 asel
= (struct as_external_lsa
*) lsa
->data
;
5184 p
.prefix
= asel
->header
.id
;
5185 p
.prefixlen
= ip_masklen (asel
->mask
);
5186 apply_mask_ipv4 (&p
);
5188 vty_out (vty
, " %s %s/%d [0x%lx]",
5189 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
5190 inet_ntoa (p
.prefix
), p
.prefixlen
,
5191 (u_long
)ntohl (asel
->e
[0].route_tag
));
5193 case OSPF_NETWORK_LSA
:
5194 case OSPF_ASBR_SUMMARY_LSA
:
5195 case OSPF_OPAQUE_LINK_LSA
:
5196 case OSPF_OPAQUE_AREA_LSA
:
5197 case OSPF_OPAQUE_AS_LSA
:
5201 vty_out (vty
, VTY_NEWLINE
);
5207 static const char *show_database_desc
[] =
5210 "Router Link States",
5212 "Summary Link States",
5213 "ASBR-Summary Link States",
5214 "AS External Link States",
5215 "Group Membership LSA",
5216 "NSSA-external Link States",
5218 "Link-Local Opaque-LSA",
5219 "Area-Local Opaque-LSA",
5220 "AS-external Opaque-LSA",
5223 static const char *show_database_header
[] =
5226 "Link ID ADV Router Age Seq# CkSum Link count",
5227 "Link ID ADV Router Age Seq# CkSum",
5228 "Link ID ADV Router Age Seq# CkSum Route",
5229 "Link ID ADV Router Age Seq# CkSum",
5230 "Link ID ADV Router Age Seq# CkSum Route",
5231 " --- header for Group Member ----",
5232 "Link ID ADV Router Age Seq# CkSum Route",
5234 "Opaque-Type/Id ADV Router Age Seq# CkSum",
5235 "Opaque-Type/Id ADV Router Age Seq# CkSum",
5236 "Opaque-Type/Id ADV Router Age Seq# CkSum",
5240 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
5242 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
5244 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
5245 vty_out (vty
, " Options: 0x%-2x : %s%s",
5247 ospf_options_dump(lsa
->data
->options
),
5249 vty_out (vty
, " LS Flags: 0x%-2x %s%s",
5251 ((lsa
->flags
& OSPF_LSA_LOCAL_XLT
) ? "(Translated from Type-7)" : ""),
5254 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
5256 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
5259 vty_out (vty
, " :%s%s%s%s",
5260 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
5261 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
5262 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
5263 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
5265 vty_out (vty
, "%s", VTY_NEWLINE
);
5267 vty_out (vty
, " LS Type: %s%s",
5268 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
5269 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
5270 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
5271 vty_out (vty
, " Advertising Router: %s%s",
5272 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
5273 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
5275 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
5277 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
5280 const char *link_type_desc
[] =
5283 "another Router (point-to-point)",
5284 "a Transit Network",
5289 const char *link_id_desc
[] =
5292 "Neighboring Router ID",
5293 "Designated Router address",
5295 "Neighboring Router ID",
5298 const char *link_data_desc
[] =
5301 "Router Interface address",
5302 "Router Interface address",
5304 "Router Interface address",
5307 /* Show router-LSA each Link information. */
5309 show_ip_ospf_database_router_links (struct vty
*vty
,
5310 struct router_lsa
*rl
)
5315 len
= ntohs (rl
->header
.length
) - 4;
5316 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
5318 type
= rl
->link
[i
].type
;
5320 vty_out (vty
, " Link connected to: %s%s",
5321 link_type_desc
[type
], VTY_NEWLINE
);
5322 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
5323 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
5324 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
5325 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
5326 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
5327 vty_out (vty
, " TOS 0 Metric: %d%s",
5328 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
5329 vty_out (vty
, "%s", VTY_NEWLINE
);
5333 /* Show router-LSA detail information. */
5335 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5339 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
5341 show_ip_ospf_database_header (vty
, lsa
);
5343 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
5344 VTY_NEWLINE
, VTY_NEWLINE
);
5346 show_ip_ospf_database_router_links (vty
, rl
);
5347 vty_out (vty
, "%s", VTY_NEWLINE
);
5353 /* Show network-LSA detail information. */
5355 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5361 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
5363 show_ip_ospf_database_header (vty
, lsa
);
5365 vty_out (vty
, " Network Mask: /%d%s",
5366 ip_masklen (nl
->mask
), VTY_NEWLINE
);
5368 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
5370 for (i
= 0; length
> 0; i
++, length
-= 4)
5371 vty_out (vty
, " Attached Router: %s%s",
5372 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
5374 vty_out (vty
, "%s", VTY_NEWLINE
);
5380 /* Show summary-LSA detail information. */
5382 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5386 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
5388 show_ip_ospf_database_header (vty
, lsa
);
5390 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
5392 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
5394 vty_out (vty
, "%s", VTY_NEWLINE
);
5400 /* Show summary-ASBR-LSA detail information. */
5402 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5406 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
5408 show_ip_ospf_database_header (vty
, lsa
);
5410 vty_out (vty
, " Network Mask: /%d%s",
5411 ip_masklen (sl
->mask
), VTY_NEWLINE
);
5412 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
5414 vty_out (vty
, "%s", VTY_NEWLINE
);
5420 /* Show AS-external-LSA detail information. */
5422 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5426 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
5428 show_ip_ospf_database_header (vty
, lsa
);
5430 vty_out (vty
, " Network Mask: /%d%s",
5431 ip_masklen (al
->mask
), VTY_NEWLINE
);
5432 vty_out (vty
, " Metric Type: %s%s",
5433 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
5434 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
5435 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
5436 vty_out (vty
, " Metric: %d%s",
5437 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
5438 vty_out (vty
, " Forward Address: %s%s",
5439 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
5441 vty_out (vty
, " External Route Tag: %lu%s%s",
5442 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
5450 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
5452 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
5454 /* show_ip_ospf_database_header (vty, lsa); */
5456 zlog_debug( " Network Mask: /%d%s",
5457 ip_masklen (al
->mask
), "\n");
5458 zlog_debug( " Metric Type: %s%s",
5459 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
5460 "2 (Larger than any link state path)" : "1", "\n");
5461 zlog_debug( " TOS: 0%s", "\n");
5462 zlog_debug( " Metric: %d%s",
5463 GET_METRIC (al
->e
[0].metric
), "\n");
5464 zlog_debug( " Forward Address: %s%s",
5465 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
5467 zlog_debug( " External Route Tag: %u%s%s",
5468 ntohl (al
->e
[0].route_tag
), "\n", "\n");
5474 /* Show AS-NSSA-LSA detail information. */
5476 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5480 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
5482 show_ip_ospf_database_header (vty
, lsa
);
5484 vty_out (vty
, " Network Mask: /%d%s",
5485 ip_masklen (al
->mask
), VTY_NEWLINE
);
5486 vty_out (vty
, " Metric Type: %s%s",
5487 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
5488 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
5489 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
5490 vty_out (vty
, " Metric: %d%s",
5491 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
5492 vty_out (vty
, " NSSA: Forward Address: %s%s",
5493 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
5495 vty_out (vty
, " External Route Tag: %u%s%s",
5496 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
5503 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
5509 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
5513 show_ip_ospf_database_header (vty
, lsa
);
5514 show_opaque_info_detail (vty
, lsa
);
5516 vty_out (vty
, "%s", VTY_NEWLINE
);
5521 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
5524 show_router_lsa_detail
,
5525 show_network_lsa_detail
,
5526 show_summary_lsa_detail
,
5527 show_summary_asbr_lsa_detail
,
5528 show_as_external_lsa_detail
,
5530 show_as_nssa_lsa_detail
, /* almost same as external */
5532 show_opaque_lsa_detail
,
5533 show_opaque_lsa_detail
,
5534 show_opaque_lsa_detail
,
5538 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
5539 struct in_addr
*adv_router
)
5541 memset (lp
, 0, sizeof (struct prefix_ls
));
5545 else if (adv_router
== NULL
)
5554 lp
->adv_router
= *adv_router
;
5559 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
5560 struct in_addr
*id
, struct in_addr
*adv_router
)
5562 struct prefix_ls lp
;
5563 struct route_node
*rn
, *start
;
5564 struct ospf_lsa
*lsa
;
5566 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
5567 start
= route_node_get (rt
, (struct prefix
*) &lp
);
5570 route_lock_node (start
);
5571 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
5572 if ((lsa
= rn
->info
))
5574 if (show_function
[lsa
->data
->type
] != NULL
)
5575 show_function
[lsa
->data
->type
] (vty
, lsa
);
5577 route_unlock_node (start
);
5581 /* Show detail LSA information
5582 -- if id is NULL then show all LSAs. */
5584 show_lsa_detail (struct vty
*vty
, struct ospf
*ospf
, int type
,
5585 struct in_addr
*id
, struct in_addr
*adv_router
)
5587 struct listnode
*node
;
5588 struct ospf_area
*area
;
5592 case OSPF_AS_EXTERNAL_LSA
:
5593 case OSPF_OPAQUE_AS_LSA
:
5594 vty_out (vty
, " %s %s%s",
5595 show_database_desc
[type
],
5596 VTY_NEWLINE
, VTY_NEWLINE
);
5597 show_lsa_detail_proc (vty
, AS_LSDB (ospf
, type
), id
, adv_router
);
5600 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
5602 vty_out (vty
, "%s %s (Area %s)%s%s",
5603 VTY_NEWLINE
, show_database_desc
[type
],
5604 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
5605 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
5612 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
5613 struct in_addr
*adv_router
)
5615 struct route_node
*rn
;
5616 struct ospf_lsa
*lsa
;
5618 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
5619 if ((lsa
= rn
->info
))
5620 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
5622 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
5624 if (show_function
[lsa
->data
->type
] != NULL
)
5625 show_function
[lsa
->data
->type
] (vty
, lsa
);
5629 /* Show detail LSA information. */
5631 show_lsa_detail_adv_router (struct vty
*vty
, struct ospf
*ospf
, int type
,
5632 struct in_addr
*adv_router
)
5634 struct listnode
*node
;
5635 struct ospf_area
*area
;
5639 case OSPF_AS_EXTERNAL_LSA
:
5640 case OSPF_OPAQUE_AS_LSA
:
5641 vty_out (vty
, " %s %s%s",
5642 show_database_desc
[type
],
5643 VTY_NEWLINE
, VTY_NEWLINE
);
5644 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf
, type
),
5648 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
5650 vty_out (vty
, "%s %s (Area %s)%s%s",
5651 VTY_NEWLINE
, show_database_desc
[type
],
5652 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
5653 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
5661 show_ip_ospf_database_summary (struct vty
*vty
, struct ospf
*ospf
, int self
)
5663 struct ospf_lsa
*lsa
;
5664 struct route_node
*rn
;
5665 struct ospf_area
*area
;
5666 struct listnode
*node
;
5669 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
5671 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
5675 case OSPF_AS_EXTERNAL_LSA
:
5676 case OSPF_OPAQUE_AS_LSA
:
5681 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
5682 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
5684 vty_out (vty
, " %s (Area %s)%s%s",
5685 show_database_desc
[type
],
5686 ospf_area_desc_string (area
),
5687 VTY_NEWLINE
, VTY_NEWLINE
);
5688 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
5690 LSDB_LOOP (AREA_LSDB (area
, type
), rn
, lsa
)
5691 show_lsa_summary (vty
, lsa
, self
);
5693 vty_out (vty
, "%s", VTY_NEWLINE
);
5698 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
5702 case OSPF_AS_EXTERNAL_LSA
:
5703 case OSPF_OPAQUE_AS_LSA
:
5708 if (ospf_lsdb_count_self (ospf
->lsdb
, type
) ||
5709 (!self
&& ospf_lsdb_count (ospf
->lsdb
, type
)))
5711 vty_out (vty
, " %s%s%s",
5712 show_database_desc
[type
],
5713 VTY_NEWLINE
, VTY_NEWLINE
);
5714 vty_out (vty
, "%s%s", show_database_header
[type
],
5717 LSDB_LOOP (AS_LSDB (ospf
, type
), rn
, lsa
)
5718 show_lsa_summary (vty
, lsa
, self
);
5720 vty_out (vty
, "%s", VTY_NEWLINE
);
5724 vty_out (vty
, "%s", VTY_NEWLINE
);
5728 show_ip_ospf_database_maxage (struct vty
*vty
, struct ospf
*ospf
)
5730 struct route_node
*rn
;
5732 vty_out (vty
, "%s MaxAge Link States:%s%s",
5733 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
5735 for (rn
= route_top (ospf
->maxage_lsa
); rn
; rn
= route_next (rn
))
5737 struct ospf_lsa
*lsa
;
5739 if ((lsa
= rn
->info
) != NULL
)
5741 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
5742 vty_out (vty
, "Link State ID: %s%s",
5743 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
5744 vty_out (vty
, "Advertising Router: %s%s",
5745 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
5746 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
5747 vty_out (vty
, "%s", VTY_NEWLINE
);
5752 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
5753 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
5755 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
5756 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
5757 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
5758 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
5760 #define OSPF_LSA_TYPES_DESC \
5761 "ASBR summary link states\n" \
5762 "External link states\n" \
5763 "Network link states\n" \
5764 "Router link states\n" \
5765 "Network summary link states\n" \
5766 OSPF_LSA_TYPE_NSSA_DESC \
5767 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
5768 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
5769 OSPF_LSA_TYPE_OPAQUE_AS_DESC
5772 show_ip_ospf_database_common (struct vty
*vty
, struct ospf
*ospf
,
5773 int arg_base
, int argc
, const char **argv
)
5776 struct in_addr id
, adv_router
;
5779 vty_out (vty
, "%sOSPF Instance: %d%s", VTY_NEWLINE
, ospf
->instance
,
5782 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
5783 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
5786 if (argc
== arg_base
+ 0)
5788 show_ip_ospf_database_summary (vty
, ospf
, 0);
5792 /* Set database type to show. */
5793 if (strncmp (argv
[arg_base
+ 0], "r", 1) == 0)
5794 type
= OSPF_ROUTER_LSA
;
5795 else if (strncmp (argv
[arg_base
+ 0], "ne", 2) == 0)
5796 type
= OSPF_NETWORK_LSA
;
5797 else if (strncmp (argv
[arg_base
+ 0], "ns", 2) == 0)
5798 type
= OSPF_AS_NSSA_LSA
;
5799 else if (strncmp (argv
[arg_base
+ 0], "su", 2) == 0)
5800 type
= OSPF_SUMMARY_LSA
;
5801 else if (strncmp (argv
[arg_base
+ 0], "a", 1) == 0)
5802 type
= OSPF_ASBR_SUMMARY_LSA
;
5803 else if (strncmp (argv
[arg_base
+ 0], "e", 1) == 0)
5804 type
= OSPF_AS_EXTERNAL_LSA
;
5805 else if (strncmp (argv
[arg_base
+ 0], "se", 2) == 0)
5807 show_ip_ospf_database_summary (vty
, ospf
, 1);
5810 else if (strncmp (argv
[arg_base
+ 0], "m", 1) == 0)
5812 show_ip_ospf_database_maxage (vty
, ospf
);
5815 else if (strncmp (argv
[arg_base
+ 0], "opaque-l", 8) == 0)
5816 type
= OSPF_OPAQUE_LINK_LSA
;
5817 else if (strncmp (argv
[arg_base
+ 0], "opaque-ar", 9) == 0)
5818 type
= OSPF_OPAQUE_AREA_LSA
;
5819 else if (strncmp (argv
[arg_base
+ 0], "opaque-as", 9) == 0)
5820 type
= OSPF_OPAQUE_AS_LSA
;
5824 /* `show ip ospf database LSA'. */
5825 if (argc
== arg_base
+ 1)
5826 show_lsa_detail (vty
, ospf
, type
, NULL
, NULL
);
5827 else if (argc
>= arg_base
+ 2)
5829 ret
= inet_aton (argv
[arg_base
+ 1], &id
);
5833 /* `show ip ospf database LSA ID'. */
5834 if (argc
== arg_base
+ 2)
5835 show_lsa_detail (vty
, ospf
, type
, &id
, NULL
);
5836 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
5837 else if (argc
== arg_base
+ 3)
5839 if (strncmp (argv
[arg_base
+ 2], "s", 1) == 0)
5840 adv_router
= ospf
->router_id
;
5843 ret
= inet_aton (argv
[arg_base
+ 2], &adv_router
);
5847 show_lsa_detail (vty
, ospf
, type
, &id
, &adv_router
);
5855 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
5856 * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D",
5859 * "OSPF information\n"
5860 * "Database summary\n"
5861 * OSPF_LSA_TYPES_DESC
5862 * "Link State ID (as an IP address)\n"
5864 * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D (self-originate|)",
5867 * "OSPF information\n"
5868 * "Database summary\n"
5869 * OSPF_LSA_TYPES_DESC
5870 * "Link State ID (as an IP address)\n"
5871 * "Self-originated link states\n"
5874 * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D adv-router A.B.C.D",
5877 * "OSPF information\n"
5878 * "Database summary\n"
5879 * OSPF_LSA_TYPES_DESC
5880 * "Link State ID (as an IP address)\n"
5881 * "Advertising Router link states\n"
5882 * "Advertising Router (as an IP address)\n"
5884 * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)",
5887 * "OSPF information\n"
5888 * "Database summary\n"
5889 * OSPF_LSA_TYPES_DESC
5890 * "LSAs in MaxAge list\n"
5891 * "Self-originated link states\n"
5894 DEFUN (show_ip_ospf_database
,
5895 show_ip_ospf_database_cmd
,
5896 "show ip ospf database",
5899 "OSPF information\n"
5900 "Database summary\n")
5904 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
5907 return (show_ip_ospf_database_common(vty
, ospf
, 0, argc
, argv
));
5915 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
5916 * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D adv-router A.B.C.D",
5919 * "OSPF information\n"
5921 * "Database summary\n"
5922 * OSPF_LSA_TYPES_DESC
5923 * "Link State ID (as an IP address)\n"
5924 * "Advertising Router link states\n"
5925 * "Advertising Router (as an IP address)\n"
5927 * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D",
5930 * "OSPF information\n"
5932 * "Database summary\n"
5933 * OSPF_LSA_TYPES_DESC
5934 * "Link State ID (as an IP address)\n"
5936 * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) A.B.C.D (self-originate|)",
5939 * "OSPF information\n"
5941 * "Database summary\n"
5942 * OSPF_LSA_TYPES_DESC
5943 * "Link State ID (as an IP address)\n"
5944 * "Self-originated link states\n"
5947 * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as|max-age|self-originate)",
5950 * "OSPF information\n"
5952 * "Database summary\n"
5953 * OSPF_LSA_TYPES_DESC
5954 * "LSAs in MaxAge list\n"
5955 * "Self-originated link states\n"
5958 DEFUN (show_ip_ospf_instance_database
,
5959 show_ip_ospf_instance_database_cmd
,
5960 "show ip ospf (1-65535) database",
5963 "OSPF information\n"
5965 "Database summary\n")
5969 u_short instance
= 0;
5971 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
5973 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
5976 return (show_ip_ospf_database_common(vty
, ospf
, 1, argc
, argv
));
5985 show_ip_ospf_database_type_adv_router_common (struct vty
*vty
, struct ospf
*ospf
,
5986 int arg_base
, int argc
, const char **argv
)
5989 struct in_addr adv_router
;
5992 vty_out (vty
, "%sOSPF Instance: %d%s", VTY_NEWLINE
, ospf
->instance
,
5995 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
5996 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
5998 if (argc
!= arg_base
+ 2)
6001 /* Set database type to show. */
6002 if (strncmp (argv
[arg_base
+ 0], "r", 1) == 0)
6003 type
= OSPF_ROUTER_LSA
;
6004 else if (strncmp (argv
[arg_base
+ 0], "ne", 2) == 0)
6005 type
= OSPF_NETWORK_LSA
;
6006 else if (strncmp (argv
[arg_base
+ 0], "ns", 2) == 0)
6007 type
= OSPF_AS_NSSA_LSA
;
6008 else if (strncmp (argv
[arg_base
+ 0], "s", 1) == 0)
6009 type
= OSPF_SUMMARY_LSA
;
6010 else if (strncmp (argv
[arg_base
+ 0], "a", 1) == 0)
6011 type
= OSPF_ASBR_SUMMARY_LSA
;
6012 else if (strncmp (argv
[arg_base
+ 0], "e", 1) == 0)
6013 type
= OSPF_AS_EXTERNAL_LSA
;
6014 else if (strncmp (argv
[arg_base
+ 0], "opaque-l", 8) == 0)
6015 type
= OSPF_OPAQUE_LINK_LSA
;
6016 else if (strncmp (argv
[arg_base
+ 0], "opaque-ar", 9) == 0)
6017 type
= OSPF_OPAQUE_AREA_LSA
;
6018 else if (strncmp (argv
[arg_base
+ 0], "opaque-as", 9) == 0)
6019 type
= OSPF_OPAQUE_AS_LSA
;
6023 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
6024 if (strncmp (argv
[arg_base
+ 1], "s", 1) == 0)
6025 adv_router
= ospf
->router_id
;
6028 ret
= inet_aton (argv
[arg_base
+ 1], &adv_router
);
6033 show_lsa_detail_adv_router (vty
, ospf
, type
, &adv_router
);
6039 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6040 * "show ip ospf database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)",
6043 * "OSPF information\n"
6044 * "Database summary\n"
6045 * OSPF_LSA_TYPES_DESC
6046 * "Self-originated link states\n"
6049 DEFUN (show_ip_ospf_database_type_adv_router
,
6050 show_ip_ospf_database_type_adv_router_cmd
,
6051 "show ip ospf database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> adv-router A.B.C.D",
6054 "OSPF information\n"
6055 "Database summary\n"
6057 "Advertising Router link states\n"
6058 "Advertising Router (as an IP address)\n")
6062 if ((ospf
= ospf_lookup()) == NULL
|| !ospf
->oi_running
)
6065 return (show_ip_ospf_database_type_adv_router_common(vty
, ospf
, 0, argc
, argv
));
6070 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6071 * "show ip ospf <1-65535> database (asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as) (self-originate|)",
6074 * "OSPF information\n"
6076 * "Database summary\n"
6077 * OSPF_LSA_TYPES_DESC
6078 * "Self-originated link states\n"
6081 DEFUN (show_ip_ospf_instance_database_type_adv_router
,
6082 show_ip_ospf_instance_database_type_adv_router_cmd
,
6083 "show ip ospf (1-65535) database <asbr-summary|external|network|router|summary|nssa-external|opaque-link|opaque-area|opaque-as> adv-router A.B.C.D",
6086 "OSPF information\n"
6088 "Database summary\n"
6090 "Advertising Router link states\n"
6091 "Advertising Router (as an IP address)\n")
6095 u_short instance
= 0;
6097 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
6099 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
6102 return (show_ip_ospf_database_type_adv_router_common(vty
, ospf
, 1, argc
, argv
));
6107 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6108 * "ip ospf authentication (null|message-digest)",
6109 * "IP Information\n"
6110 * "OSPF interface commands\n"
6111 * "Enable authentication on this interface\n"
6112 * "Use null authentication\n"
6113 * "Use message-digest authentication\n"
6116 DEFUN (ip_ospf_authentication_args
,
6117 ip_ospf_authentication_args_addr_cmd
,
6118 "ip ospf authentication <null|message-digest> A.B.C.D",
6120 "OSPF interface commands\n"
6121 "Enable authentication on this interface\n"
6122 "Use null authentication\n"
6123 "Use message-digest authentication\n"
6124 "Address of interface")
6126 int idx_encryption
= 3;
6128 struct interface
*ifp
;
6129 struct in_addr addr
;
6131 struct ospf_if_params
*params
;
6134 params
= IF_DEF_PARAMS (ifp
);
6138 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6141 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6146 params
= ospf_get_if_params (ifp
, addr
);
6147 ospf_if_update_params (ifp
, addr
);
6150 /* Handle null authentication */
6151 if ( argv
[idx_encryption
]->arg
[0] == 'n' )
6153 SET_IF_PARAM (params
, auth_type
);
6154 params
->auth_type
= OSPF_AUTH_NULL
;
6158 /* Handle message-digest authentication */
6159 if ( argv
[idx_encryption
]->arg
[0] == 'm' )
6161 SET_IF_PARAM (params
, auth_type
);
6162 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
6166 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
6172 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6173 * "ip ospf authentication",
6174 * "IP Information\n"
6175 * "OSPF interface commands\n"
6176 * "Enable authentication on this interface\n"
6179 DEFUN (ip_ospf_authentication
,
6180 ip_ospf_authentication_addr_cmd
,
6181 "ip ospf authentication A.B.C.D",
6183 "OSPF interface commands\n"
6184 "Enable authentication on this interface\n"
6185 "Address of interface")
6188 struct interface
*ifp
;
6189 struct in_addr addr
;
6191 struct ospf_if_params
*params
;
6194 params
= IF_DEF_PARAMS (ifp
);
6198 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6201 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6206 params
= ospf_get_if_params (ifp
, addr
);
6207 ospf_if_update_params (ifp
, addr
);
6210 SET_IF_PARAM (params
, auth_type
);
6211 params
->auth_type
= OSPF_AUTH_SIMPLE
;
6218 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6219 * "no ip ospf authentication (null|message-digest)",
6221 * "IP Information\n"
6222 * "OSPF interface commands\n"
6223 * "Enable authentication on this interface\n"
6224 * "Use null authentication\n"
6225 * "Use message-digest authentication\n"
6228 DEFUN (no_ip_ospf_authentication_args
,
6229 no_ip_ospf_authentication_args_addr_cmd
,
6230 "no ip ospf authentication <null|message-digest> A.B.C.D",
6233 "OSPF interface commands\n"
6234 "Enable authentication on this interface\n"
6235 "Use null authentication\n"
6236 "Use message-digest authentication\n"
6237 "Address of interface")
6239 int idx_encryption
= 4;
6241 struct interface
*ifp
;
6242 struct in_addr addr
;
6244 struct ospf_if_params
*params
;
6245 struct route_node
*rn
;
6249 params
= IF_DEF_PARAMS (ifp
);
6253 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6256 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6261 params
= ospf_lookup_if_params (ifp
, addr
);
6264 vty_out (vty
, "Ip Address specified is unknown%s", VTY_NEWLINE
);
6267 params
->auth_type
= OSPF_AUTH_NOTSET
;
6268 UNSET_IF_PARAM (params
, auth_type
);
6269 if (params
!= IF_DEF_PARAMS (ifp
))
6271 ospf_free_if_params (ifp
, addr
);
6272 ospf_if_update_params (ifp
, addr
);
6277 if ( argv
[idx_encryption
]->arg
[0] == 'n' )
6279 auth_type
= OSPF_AUTH_NULL
;
6281 else if ( argv
[idx_encryption
]->arg
[0] == 'm' )
6283 auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
6287 vty_out (vty
, "Unexpected input encountered%s", VTY_NEWLINE
);
6291 * Here we have a case where the user has entered
6292 * 'no ip ospf authentication (null | message_digest )'
6293 * we need to find if we have any ip addresses underneath it that
6294 * correspond to the associated type.
6296 if (params
->auth_type
== auth_type
)
6298 params
->auth_type
= OSPF_AUTH_NOTSET
;
6299 UNSET_IF_PARAM (params
, auth_type
);
6302 for (rn
= route_top (IF_OIFS_PARAMS (ifp
)); rn
; rn
= route_next (rn
))
6304 if ((params
= rn
->info
))
6306 if (params
->auth_type
== auth_type
)
6308 params
->auth_type
= OSPF_AUTH_NOTSET
;
6309 UNSET_IF_PARAM (params
, auth_type
);
6310 if (params
!= IF_DEF_PARAMS (ifp
))
6312 ospf_free_if_params (ifp
, rn
->p
.u
.prefix4
);
6313 ospf_if_update_params(ifp
, rn
->p
.u
.prefix4
);
6325 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6326 * "no ip ospf authentication",
6328 * "IP Information\n"
6329 * "OSPF interface commands\n"
6330 * "Enable authentication on this interface\n"
6333 DEFUN (no_ip_ospf_authentication
,
6334 no_ip_ospf_authentication_addr_cmd
,
6335 "no ip ospf authentication A.B.C.D",
6338 "OSPF interface commands\n"
6339 "Enable authentication on this interface\n"
6340 "Address of interface")
6343 struct interface
*ifp
;
6344 struct in_addr addr
;
6346 struct ospf_if_params
*params
;
6347 struct route_node
*rn
;
6350 params
= IF_DEF_PARAMS (ifp
);
6354 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6357 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6362 params
= ospf_lookup_if_params (ifp
, addr
);
6365 vty_out (vty
, "Ip Address specified is unknown%s", VTY_NEWLINE
);
6369 params
->auth_type
= OSPF_AUTH_NOTSET
;
6370 UNSET_IF_PARAM (params
, auth_type
);
6371 if (params
!= IF_DEF_PARAMS (ifp
))
6373 ospf_free_if_params (ifp
, addr
);
6374 ospf_if_update_params (ifp
, addr
);
6380 * When a user enters 'no ip ospf authentication'
6381 * We should remove all authentication types from
6384 if ((params
->auth_type
== OSPF_AUTH_NULL
) ||
6385 (params
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
) ||
6386 (params
->auth_type
== OSPF_AUTH_SIMPLE
))
6388 params
->auth_type
= OSPF_AUTH_NOTSET
;
6389 UNSET_IF_PARAM (params
, auth_type
);
6392 for (rn
= route_top (IF_OIFS_PARAMS (ifp
)); rn
; rn
= route_next (rn
))
6394 if ((params
= rn
->info
))
6397 if ((params
->auth_type
== OSPF_AUTH_NULL
) ||
6398 (params
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
) ||
6399 (params
->auth_type
== OSPF_AUTH_SIMPLE
))
6401 params
->auth_type
= OSPF_AUTH_NOTSET
;
6402 UNSET_IF_PARAM (params
, auth_type
);
6403 if (params
!= IF_DEF_PARAMS (ifp
))
6405 ospf_free_if_params (ifp
, rn
->p
.u
.prefix4
);
6406 ospf_if_update_params(ifp
, rn
->p
.u
.prefix4
);
6418 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6419 * "ip ospf authentication-key AUTH_KEY",
6420 * "IP Information\n"
6421 * "OSPF interface commands\n"
6422 * "Authentication password (key)\n"
6423 * "The OSPF password (key)"
6426 DEFUN (ip_ospf_authentication_key
,
6427 ip_ospf_authentication_key_addr_cmd
,
6428 "ip ospf authentication-key AUTH_KEY A.B.C.D",
6430 "OSPF interface commands\n"
6431 "Authentication password (key)\n"
6432 "The OSPF password (key)\n"
6433 "Address of interface")
6436 struct interface
*ifp
;
6437 struct in_addr addr
;
6439 struct ospf_if_params
*params
;
6442 params
= IF_DEF_PARAMS (ifp
);
6446 ret
= inet_aton(argv
[1], &addr
);
6449 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6454 params
= ospf_get_if_params (ifp
, addr
);
6455 ospf_if_update_params (ifp
, addr
);
6458 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
6459 strncpy ((char *) params
->auth_simple
, argv
[idx_ipv4
]->arg
, OSPF_AUTH_SIMPLE_SIZE
);
6460 SET_IF_PARAM (params
, auth_simple
);
6466 ALIAS_HIDDEN (ip_ospf_authentication_key
,
6467 ospf_authentication_key_cmd
,
6468 "ospf authentication-key AUTH_KEY",
6469 "OSPF interface commands\n"
6470 "Authentication password (key)\n"
6471 "The OSPF password (key)")
6474 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6475 * "no ospf authentication-key AUTH_KEY A.B.C.D",
6477 * "OSPF interface commands\n"
6478 * "Authentication password (key)\n"
6479 * "The OSPF password (key)\n"
6480 * "Address of interface"
6482 * "no ospf authentication-key AUTH_KEY",
6484 * "OSPF interface commands\n"
6485 * "Authentication password (key)\n"
6486 * "The OSPF password (key)\n"
6488 * "no ip ospf authentication-key",
6490 * "IP Information\n"
6491 * "OSPF interface commands\n"
6492 * "Authentication password (key)\n"
6494 * "no ip ospf authentication-key AUTH_KEY",
6496 * "IP Information\n"
6497 * "OSPF interface commands\n"
6498 * "Authentication password (key)\n"
6500 * "no ospf authentication-key",
6502 * "OSPF interface commands\n"
6503 * "Authentication password (key)\n"
6506 DEFUN (no_ip_ospf_authentication_key
,
6507 no_ip_ospf_authentication_key_authkey_addr_cmd
,
6508 "no ip ospf authentication-key AUTH_KEY A.B.C.D",
6511 "OSPF interface commands\n"
6512 "Authentication password (key)\n"
6513 "The OSPF password (key)")
6515 struct interface
*ifp
;
6516 struct in_addr addr
;
6517 struct ospf_if_params
*params
;
6521 params
= IF_DEF_PARAMS (ifp
);
6525 ret
= inet_aton(argv
[1], &addr
);
6528 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6533 params
= ospf_lookup_if_params (ifp
, addr
);
6538 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
6539 UNSET_IF_PARAM (params
, auth_simple
);
6541 if (params
!= IF_DEF_PARAMS (ifp
))
6543 ospf_free_if_params (ifp
, addr
);
6544 ospf_if_update_params (ifp
, addr
);
6556 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6557 * "ip ospf message-digest-key <1-255> md5 KEY",
6558 * "IP Information\n"
6559 * "OSPF interface commands\n"
6560 * "Message digest authentication password (key)\n"
6562 * "Use MD5 algorithm\n"
6563 * "The OSPF password (key)"
6566 DEFUN (ip_ospf_message_digest_key
,
6567 ip_ospf_message_digest_key_addr_cmd
,
6568 "ip ospf message-digest-key (1-255) md5 KEY A.B.C.D",
6570 "OSPF interface commands\n"
6571 "Message digest authentication password (key)\n"
6573 "Use MD5 algorithm\n"
6574 "The OSPF password (key)"
6575 "Address of interface")
6579 struct interface
*ifp
;
6580 struct crypt_key
*ck
;
6582 struct in_addr addr
;
6584 struct ospf_if_params
*params
;
6587 params
= IF_DEF_PARAMS (ifp
);
6591 ret
= inet_aton(argv
[2], &addr
);
6594 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6599 params
= ospf_get_if_params (ifp
, addr
);
6600 ospf_if_update_params (ifp
, addr
);
6603 key_id
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
6604 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
6606 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
6610 ck
= ospf_crypt_key_new ();
6611 ck
->key_id
= (u_char
) key_id
;
6612 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
6613 strncpy ((char *) ck
->auth_key
, argv
[idx_ipv4
]->arg
, OSPF_AUTH_MD5_SIZE
);
6615 ospf_crypt_key_add (params
->auth_crypt
, ck
);
6616 SET_IF_PARAM (params
, auth_crypt
);
6622 ALIAS_HIDDEN (ip_ospf_message_digest_key
,
6623 ospf_message_digest_key_cmd
,
6624 "ospf message-digest-key <1-255> md5 KEY",
6625 "OSPF interface commands\n"
6626 "Message digest authentication password (key)\n"
6628 "Use MD5 algorithm\n"
6629 "The OSPF password (key)")
6632 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6633 * "no ip ospf message-digest-key <1-255> md5 KEY",
6635 * "IP Information\n"
6636 * "OSPF interface commands\n"
6637 * "Message digest authentication password (key)\n"
6639 * "Use MD5 algorithm\n"
6640 * "The OSPF password (key)"
6643 DEFUN (no_ip_ospf_message_digest_key_md5
,
6644 no_ip_ospf_message_digest_key_md5_addr_cmd
,
6645 "no ip ospf message-digest-key (1-255) md5 KEY A.B.C.D",
6648 "OSPF interface commands\n"
6649 "Message digest authentication password (key)\n"
6651 "Use MD5 algorithm\n"
6652 "The OSPF password (key)"
6653 "Address of interface")
6656 struct interface
*ifp
;
6657 struct crypt_key
*ck
;
6659 struct in_addr addr
;
6661 struct ospf_if_params
*params
;
6664 params
= IF_DEF_PARAMS (ifp
);
6668 ret
= inet_aton(argv
[2], &addr
);
6671 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6676 params
= ospf_lookup_if_params (ifp
, addr
);
6681 key_id
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
6682 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
6685 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
6689 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
6691 if (params
!= IF_DEF_PARAMS (ifp
))
6693 ospf_free_if_params (ifp
, addr
);
6694 ospf_if_update_params (ifp
, addr
);
6702 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6703 * "no ip ospf message-digest-key <1-255>",
6705 * "IP Information\n"
6706 * "OSPF interface commands\n"
6707 * "Message digest authentication password (key)\n"
6710 * "no ospf message-digest-key <1-255>",
6712 * "OSPF interface commands\n"
6713 * "Message digest authentication password (key)\n"
6717 DEFUN (no_ip_ospf_message_digest_key
,
6718 no_ip_ospf_message_digest_key_addr_cmd
,
6719 "no ip ospf message-digest-key (1-255) A.B.C.D",
6722 "OSPF interface commands\n"
6723 "Message digest authentication password (key)\n"
6725 "Address of interface")
6729 struct interface
*ifp
;
6730 struct crypt_key
*ck
;
6732 struct in_addr addr
;
6734 struct ospf_if_params
*params
;
6737 params
= IF_DEF_PARAMS (ifp
);
6741 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6744 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6749 params
= ospf_lookup_if_params (ifp
, addr
);
6754 key_id
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
6755 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
6758 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
6762 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
6764 if (params
!= IF_DEF_PARAMS (ifp
))
6766 ospf_free_if_params (ifp
, addr
);
6767 ospf_if_update_params (ifp
, addr
);
6776 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6777 * "ip ospf cost <1-65535>",
6778 * "IP Information\n"
6779 * "OSPF interface commands\n"
6780 * "Interface cost\n"
6784 DEFUN (ip_ospf_cost
,
6785 ip_ospf_cost_u32_inet4_cmd
,
6786 "ip ospf cost (1-65535) A.B.C.D",
6788 "OSPF interface commands\n"
6791 "Address of interface")
6795 struct interface
*ifp
= vty
->index
;
6797 struct in_addr addr
;
6799 struct ospf_if_params
*params
;
6801 params
= IF_DEF_PARAMS (ifp
);
6803 cost
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
6805 /* cost range is <1-65535>. */
6806 if (cost
< 1 || cost
> 65535)
6808 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
6814 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6817 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6822 params
= ospf_get_if_params (ifp
, addr
);
6823 ospf_if_update_params (ifp
, addr
);
6826 SET_IF_PARAM (params
, output_cost_cmd
);
6827 params
->output_cost_cmd
= cost
;
6829 ospf_if_recalculate_output_cost (ifp
);
6835 ALIAS_HIDDEN (ip_ospf_cost
,
6837 "ospf cost <1-65535>",
6838 "OSPF interface commands\n"
6842 ALIAS_HIDDEN (ip_ospf_cost
,
6843 ospf_cost_u32_inet4_cmd
,
6844 "ospf cost <1-65535> A.B.C.D",
6845 "OSPF interface commands\n"
6848 "Address of interface")
6851 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6852 * "no ospf cost A.B.C.D",
6854 * "OSPF interface commands\n"
6855 * "Interface cost\n"
6856 * "Address of interface"
6860 * "OSPF interface commands\n"
6861 * "Interface cost\n"
6863 * "no ip ospf cost",
6865 * "IP Information\n"
6866 * "OSPF interface commands\n"
6867 * "Interface cost\n"
6870 DEFUN (no_ip_ospf_cost
,
6871 no_ip_ospf_cost_inet4_cmd
,
6872 "no ip ospf cost A.B.C.D",
6875 "OSPF interface commands\n"
6877 "Address of interface")
6880 struct interface
*ifp
= vty
->index
;
6881 struct in_addr addr
;
6883 struct ospf_if_params
*params
;
6886 params
= IF_DEF_PARAMS (ifp
);
6890 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
6893 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6898 params
= ospf_lookup_if_params (ifp
, addr
);
6903 UNSET_IF_PARAM (params
, output_cost_cmd
);
6905 if (params
!= IF_DEF_PARAMS (ifp
))
6907 ospf_free_if_params (ifp
, addr
);
6908 ospf_if_update_params (ifp
, addr
);
6911 ospf_if_recalculate_output_cost (ifp
);
6920 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
6921 * "no ospf cost <1-65535>",
6923 * "OSPF interface commands\n"
6924 * "Interface cost\n"
6927 * "no ospf cost <1-65535> A.B.C.D",
6929 * "OSPF interface commands\n"
6930 * "Interface cost\n"
6932 * "Address of interface"
6934 * "no ip ospf cost <1-65535> A.B.C.D",
6936 * "IP Information\n"
6937 * "OSPF interface commands\n"
6938 * "Interface cost\n"
6940 * "Address of interface"
6943 DEFUN (no_ip_ospf_cost2
,
6944 no_ip_ospf_cost_u32_cmd
,
6945 "no ip ospf cost (1-65535)",
6948 "OSPF interface commands\n"
6953 struct interface
*ifp
= vty
->index
;
6954 struct in_addr addr
;
6957 struct ospf_if_params
*params
;
6960 params
= IF_DEF_PARAMS (ifp
);
6962 /* According to the semantics we are mimicking "no ip ospf cost N" is
6963 * always treated as "no ip ospf cost" regardless of the actual value
6964 * of N already configured for the interface. Thus the first argument
6965 * is always checked to be a number, but is ignored after that.
6967 cost
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
6968 if (cost
< 1 || cost
> 65535)
6970 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
6976 ret
= inet_aton(argv
[1], &addr
);
6979 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6984 params
= ospf_lookup_if_params (ifp
, addr
);
6989 UNSET_IF_PARAM (params
, output_cost_cmd
);
6991 if (params
!= IF_DEF_PARAMS (ifp
))
6993 ospf_free_if_params (ifp
, addr
);
6994 ospf_if_update_params (ifp
, addr
);
6997 ospf_if_recalculate_output_cost (ifp
);
7006 ospf_nbr_timer_update (struct ospf_interface
*oi
)
7008 struct route_node
*rn
;
7009 struct ospf_neighbor
*nbr
;
7011 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
7012 if ((nbr
= rn
->info
))
7014 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
7015 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
7016 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
7017 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
7022 ospf_vty_dead_interval_set (struct vty
*vty
, const char *interval_str
,
7023 const char *nbr_str
,
7024 const char *fast_hello_str
)
7026 struct interface
*ifp
= vty
->index
;
7029 struct in_addr addr
;
7031 struct ospf_if_params
*params
;
7032 struct ospf_interface
*oi
;
7033 struct route_node
*rn
;
7035 params
= IF_DEF_PARAMS (ifp
);
7039 ret
= inet_aton(nbr_str
, &addr
);
7042 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7047 params
= ospf_get_if_params (ifp
, addr
);
7048 ospf_if_update_params (ifp
, addr
);
7053 VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds
, interval_str
,
7056 /* reset fast_hello too, just to be sure */
7057 UNSET_IF_PARAM (params
, fast_hello
);
7058 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
7060 else if (fast_hello_str
)
7062 VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult
, fast_hello_str
,
7064 /* 1s dead-interval with sub-second hellos desired */
7065 seconds
= OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
;
7066 SET_IF_PARAM (params
, fast_hello
);
7067 params
->fast_hello
= hellomult
;
7071 vty_out (vty
, "Please specify dead-interval or hello-multiplier%s",
7076 SET_IF_PARAM (params
, v_wait
);
7077 params
->v_wait
= seconds
;
7079 /* Update timer values in neighbor structure. */
7083 if ((ospf
= ospf_lookup()))
7085 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
7087 ospf_nbr_timer_update (oi
);
7092 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7093 if ((oi
= rn
->info
))
7094 ospf_nbr_timer_update (oi
);
7102 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7103 * "ip ospf dead-interval <1-65535>",
7104 * "IP Information\n"
7105 * "OSPF interface commands\n"
7106 * "Interval after which a neighbor is declared dead\n"
7110 DEFUN (ip_ospf_dead_interval
,
7111 ip_ospf_dead_interval_addr_cmd
,
7112 "ip ospf dead-interval (1-65535) A.B.C.D",
7114 "OSPF interface commands\n"
7115 "Interval after which a neighbor is declared dead\n"
7117 "Address of interface\n")
7122 return ospf_vty_dead_interval_set (vty
, argv
[idx_number
]->arg
, argv
[idx_ipv4
]->arg
, NULL
);
7124 return ospf_vty_dead_interval_set (vty
, argv
[idx_number
]->arg
, NULL
, NULL
);
7128 ALIAS_HIDDEN (ip_ospf_dead_interval
,
7129 ospf_dead_interval_cmd
,
7130 "ospf dead-interval <1-65535>",
7131 "OSPF interface commands\n"
7132 "Interval after which a neighbor is declared dead\n"
7136 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7137 * "ip ospf dead-interval minimal hello-multiplier <1-10>",
7138 * "IP Information\n"
7139 * "OSPF interface commands\n"
7140 * "Interval after which a neighbor is declared dead\n"
7141 * "Minimal 1s dead-interval with fast sub-second hellos\n"
7142 * "Hello multiplier factor\n"
7143 * "Number of Hellos to send each second\n"
7146 DEFUN (ip_ospf_dead_interval_minimal
,
7147 ip_ospf_dead_interval_minimal_addr_cmd
,
7148 "ip ospf dead-interval minimal hello-multiplier (1-10) A.B.C.D",
7150 "OSPF interface commands\n"
7151 "Interval after which a neighbor is declared dead\n"
7152 "Minimal 1s dead-interval with fast sub-second hellos\n"
7153 "Hello multiplier factor\n"
7154 "Number of Hellos to send each second\n"
7155 "Address of interface\n")
7160 return ospf_vty_dead_interval_set (vty
, NULL
, argv
[idx_ipv4
]->arg
, argv
[idx_number
]->arg
);
7162 return ospf_vty_dead_interval_set (vty
, NULL
, NULL
, argv
[idx_number
]->arg
);
7167 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7168 * "no ospf dead-interval",
7170 * "OSPF interface commands\n"
7171 * "Interval after which a neighbor is declared dead\n"
7173 * "no ip ospf dead-interval minimal hello-multiplier <1-10>",
7175 * "IP Information\n"
7176 * "OSPF interface commands\n"
7177 * "Interval after which a neighbor is declared dead\n"
7178 * "Minimal 1s dead-interval with fast sub-second hellos\n"
7179 * "Hello multiplier factor\n"
7180 * "Number of Hellos to send each second\n"
7182 * "no ip ospf dead-interval <1-65535>",
7184 * "IP Information\n"
7185 * "OSPF interface commands\n"
7186 * "Interval after which a neighbor is declared dead\n"
7189 * "no ip ospf dead-interval",
7191 * "IP Information\n"
7192 * "OSPF interface commands\n"
7193 * "Interval after which a neighbor is declared dead\n"
7195 * "no ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
7197 * "IP Information\n"
7198 * "OSPF interface commands\n"
7199 * "Interval after which a neighbor is declared dead\n"
7200 * "Minimal 1s dead-interval with fast sub-second hellos\n"
7201 * "Hello multiplier factor\n"
7202 * "Number of Hellos to send each second\n"
7203 * "Address of interface\n"
7206 DEFUN (no_ip_ospf_dead_interval
,
7207 no_ip_ospf_dead_interval_addr_cmd
,
7208 "no ip ospf dead-interval (1-65535) A.B.C.D",
7211 "OSPF interface commands\n"
7212 "Interval after which a neighbor is declared dead\n"
7214 "Address of interface")
7217 struct interface
*ifp
= vty
->index
;
7218 struct in_addr addr
;
7220 struct ospf_if_params
*params
;
7221 struct ospf_interface
*oi
;
7222 struct route_node
*rn
;
7225 params
= IF_DEF_PARAMS (ifp
);
7229 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7232 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7237 params
= ospf_lookup_if_params (ifp
, addr
);
7242 UNSET_IF_PARAM (params
, v_wait
);
7243 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
7245 UNSET_IF_PARAM (params
, fast_hello
);
7246 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
7248 if (params
!= IF_DEF_PARAMS (ifp
))
7250 ospf_free_if_params (ifp
, addr
);
7251 ospf_if_update_params (ifp
, addr
);
7254 /* Update timer values in neighbor structure. */
7259 if ((ospf
= ospf_lookup()))
7261 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
7263 ospf_nbr_timer_update (oi
);
7268 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7269 if ((oi
= rn
->info
))
7270 ospf_nbr_timer_update (oi
);
7282 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7283 * "ip ospf hello-interval <1-65535>",
7284 * "IP Information\n"
7285 * "OSPF interface commands\n"
7286 * "Time between HELLO packets\n"
7290 DEFUN (ip_ospf_hello_interval
,
7291 ip_ospf_hello_interval_addr_cmd
,
7292 "ip ospf hello-interval (1-65535) A.B.C.D",
7294 "OSPF interface commands\n"
7295 "Time between HELLO packets\n"
7297 "Address of interface")
7301 struct interface
*ifp
= vty
->index
;
7303 struct in_addr addr
;
7305 struct ospf_if_params
*params
;
7307 params
= IF_DEF_PARAMS (ifp
);
7309 seconds
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
7311 /* HelloInterval range is <1-65535>. */
7312 if (seconds
< 1 || seconds
> 65535)
7314 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
7320 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7323 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7328 params
= ospf_get_if_params (ifp
, addr
);
7329 ospf_if_update_params (ifp
, addr
);
7332 SET_IF_PARAM (params
, v_hello
);
7333 params
->v_hello
= seconds
;
7339 ALIAS_HIDDEN (ip_ospf_hello_interval
,
7340 ospf_hello_interval_cmd
,
7341 "ospf hello-interval <1-65535>",
7342 "OSPF interface commands\n"
7343 "Time between HELLO packets\n"
7347 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7348 * "no ip ospf hello-interval <1-65535>",
7350 * "IP Information\n"
7351 * "OSPF interface commands\n"
7352 * "Time between HELLO packets\n"
7355 * "no ip ospf hello-interval",
7357 * "IP Information\n"
7358 * "OSPF interface commands\n"
7359 * "Time between HELLO packets\n"
7361 * "no ospf hello-interval <1-65535>",
7363 * "OSPF interface commands\n"
7364 * "Time between HELLO packets\n"
7368 DEFUN (no_ip_ospf_hello_interval
,
7369 no_ip_ospf_hello_interval_addr_cmd
,
7370 "no ip ospf hello-interval (1-65535) A.B.C.D",
7373 "OSPF interface commands\n"
7374 "Time between HELLO packets\n"
7376 "Address of interface")
7379 struct interface
*ifp
= vty
->index
;
7380 struct in_addr addr
;
7382 struct ospf_if_params
*params
;
7385 params
= IF_DEF_PARAMS (ifp
);
7389 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7392 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7397 params
= ospf_lookup_if_params (ifp
, addr
);
7402 UNSET_IF_PARAM (params
, v_hello
);
7403 params
->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
7405 if (params
!= IF_DEF_PARAMS (ifp
))
7407 ospf_free_if_params (ifp
, addr
);
7408 ospf_if_update_params (ifp
, addr
);
7417 DEFUN (ip_ospf_network
,
7418 ip_ospf_network_cmd
,
7419 "ip ospf network <broadcast|non-broadcast|point-to-multipoint|point-to-point>",
7421 "OSPF interface commands\n"
7423 "Specify OSPF broadcast multi-access network\n"
7424 "Specify OSPF NBMA network\n"
7425 "Specify OSPF point-to-multipoint network\n"
7426 "Specify OSPF point-to-point network\n")
7428 int idx_network
= 3;
7429 struct interface
*ifp
= vty
->index
;
7430 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
7431 struct route_node
*rn
;
7433 if (old_type
== OSPF_IFTYPE_LOOPBACK
)
7435 vty_out (vty
, "This is a loopback interface. Can't set network type.%s", VTY_NEWLINE
);
7439 if (strncmp (argv
[idx_network
]->arg
, "b", 1) == 0)
7440 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
7441 else if (strncmp (argv
[idx_network
]->arg
, "n", 1) == 0)
7442 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
7443 else if (strncmp (argv
[idx_network
]->arg
, "point-to-m", 10) == 0)
7444 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
7445 else if (strncmp (argv
[idx_network
]->arg
, "point-to-p", 10) == 0)
7446 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
7448 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
7451 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
7453 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7455 struct ospf_interface
*oi
= rn
->info
;
7460 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
7462 if (oi
->state
> ISM_Down
)
7464 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
7465 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
7472 ALIAS_HIDDEN (ip_ospf_network
,
7474 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
7475 "OSPF interface commands\n"
7477 "Specify OSPF broadcast multi-access network\n"
7478 "Specify OSPF NBMA network\n"
7479 "Specify OSPF point-to-multipoint network\n"
7480 "Specify OSPF point-to-point network\n")
7483 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7484 * "no ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
7486 * "OSPF interface commands\n"
7488 * "Specify OSPF broadcast multi-access network\n"
7489 * "Specify OSPF NBMA network\n"
7490 * "Specify OSPF point-to-multipoint network\n"
7491 * "Specify OSPF point-to-point network\n"
7493 * "no ospf network",
7495 * "OSPF interface commands\n"
7498 * "no ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
7500 * "IP Information\n"
7501 * "OSPF interface commands\n"
7503 * "Specify OSPF broadcast multi-access network\n"
7504 * "Specify OSPF NBMA network\n"
7505 * "Specify OSPF point-to-multipoint network\n"
7506 * "Specify OSPF point-to-point network\n"
7509 DEFUN (no_ip_ospf_network
,
7510 no_ip_ospf_network_cmd
,
7511 "no ip ospf network",
7514 "OSPF interface commands\n"
7517 struct interface
*ifp
= vty
->index
;
7518 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
7519 struct route_node
*rn
;
7521 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
7523 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
7526 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7528 struct ospf_interface
*oi
= rn
->info
;
7533 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
7535 if (oi
->state
> ISM_Down
)
7537 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
7538 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
7549 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7550 * "ip ospf priority <0-255>",
7551 * "IP Information\n"
7552 * "OSPF interface commands\n"
7553 * "Router priority\n"
7557 DEFUN (ip_ospf_priority
,
7558 ip_ospf_priority_addr_cmd
,
7559 "ip ospf priority (0-255) A.B.C.D",
7561 "OSPF interface commands\n"
7564 "Address of interface")
7568 struct interface
*ifp
= vty
->index
;
7570 struct route_node
*rn
;
7571 struct in_addr addr
;
7573 struct ospf_if_params
*params
;
7575 params
= IF_DEF_PARAMS (ifp
);
7577 priority
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
7579 /* Router Priority range is <0-255>. */
7580 if (priority
< 0 || priority
> 255)
7582 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
7588 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7591 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7596 params
= ospf_get_if_params (ifp
, addr
);
7597 ospf_if_update_params (ifp
, addr
);
7600 SET_IF_PARAM (params
, priority
);
7601 params
->priority
= priority
;
7603 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7605 struct ospf_interface
*oi
= rn
->info
;
7611 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
7613 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
7614 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
7622 ALIAS_HIDDEN (ip_ospf_priority
,
7624 "ospf priority <0-255>",
7625 "OSPF interface commands\n"
7630 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7631 * "no ip ospf priority",
7633 * "IP Information\n"
7634 * "OSPF interface commands\n"
7635 * "Router priority\n"
7637 * "no ip ospf priority <0-255>",
7639 * "IP Information\n"
7640 * "OSPF interface commands\n"
7641 * "Router priority\n"
7644 * "no ospf priority <0-255>",
7646 * "OSPF interface commands\n"
7647 * "Router priority\n"
7651 DEFUN (no_ip_ospf_priority
,
7652 no_ip_ospf_priority_addr_cmd
,
7653 "no ip ospf priority (0-255) A.B.C.D",
7656 "OSPF interface commands\n"
7659 "Address of interface")
7662 struct interface
*ifp
= vty
->index
;
7663 struct route_node
*rn
;
7664 struct in_addr addr
;
7666 struct ospf_if_params
*params
;
7669 params
= IF_DEF_PARAMS (ifp
);
7673 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7676 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7681 params
= ospf_lookup_if_params (ifp
, addr
);
7686 UNSET_IF_PARAM (params
, priority
);
7687 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
7689 if (params
!= IF_DEF_PARAMS (ifp
))
7691 ospf_free_if_params (ifp
, addr
);
7692 ospf_if_update_params (ifp
, addr
);
7695 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
7697 struct ospf_interface
*oi
= rn
->info
;
7703 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
7705 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
7706 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
7718 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7719 * "ip ospf retransmit-interval <3-65535>",
7720 * "IP Information\n"
7721 * "OSPF interface commands\n"
7722 * "Time between retransmitting lost link state advertisements\n"
7726 DEFUN (ip_ospf_retransmit_interval
,
7727 ip_ospf_retransmit_interval_addr_cmd
,
7728 "ip ospf retransmit-interval (3-65535) A.B.C.D",
7730 "OSPF interface commands\n"
7731 "Time between retransmitting lost link state advertisements\n"
7733 "Address of interface")
7737 struct interface
*ifp
= vty
->index
;
7739 struct in_addr addr
;
7741 struct ospf_if_params
*params
;
7743 params
= IF_DEF_PARAMS (ifp
);
7744 seconds
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
7746 /* Retransmit Interval range is <3-65535>. */
7747 if (seconds
< 3 || seconds
> 65535)
7749 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
7756 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7759 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7764 params
= ospf_get_if_params (ifp
, addr
);
7765 ospf_if_update_params (ifp
, addr
);
7768 SET_IF_PARAM (params
, retransmit_interval
);
7769 params
->retransmit_interval
= seconds
;
7775 ALIAS_HIDDEN (ip_ospf_retransmit_interval
,
7776 ospf_retransmit_interval_cmd
,
7777 "ospf retransmit-interval <3-65535>",
7778 "OSPF interface commands\n"
7779 "Time between retransmitting lost link state advertisements\n"
7783 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7784 * "no ip ospf retransmit-interval <3-65535> A.B.C.D",
7786 * "IP Information\n"
7787 * "OSPF interface commands\n"
7788 * "Time between retransmitting lost link state advertisements\n"
7790 * "Address of interface"
7792 * "no ip ospf retransmit-interval",
7794 * "IP Information\n"
7795 * "OSPF interface commands\n"
7796 * "Time between retransmitting lost link state advertisements\n"
7798 * "no ospf retransmit-interval",
7800 * "OSPF interface commands\n"
7801 * "Time between retransmitting lost link state advertisements\n"
7804 DEFUN (no_ip_ospf_retransmit_interval
,
7805 no_ip_ospf_retransmit_interval_addr_cmd
,
7806 "no ip ospf retransmit-interval A.B.C.D",
7809 "OSPF interface commands\n"
7810 "Time between retransmitting lost link state advertisements\n"
7811 "Address of interface")
7813 struct interface
*ifp
= vty
->index
;
7814 struct in_addr addr
;
7816 struct ospf_if_params
*params
;
7820 params
= IF_DEF_PARAMS (ifp
);
7829 ret
= inet_aton(argv
[addr_index
], &addr
);
7832 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7837 params
= ospf_lookup_if_params (ifp
, addr
);
7842 UNSET_IF_PARAM (params
, retransmit_interval
);
7843 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
7845 if (params
!= IF_DEF_PARAMS (ifp
))
7847 ospf_free_if_params (ifp
, addr
);
7848 ospf_if_update_params (ifp
, addr
);
7857 DEFUN (no_ip_ospf_retransmit_interval_sec
,
7858 no_ip_ospf_retransmit_interval_sec_cmd
,
7859 "no ip ospf retransmit-interval (3-65535)",
7862 "OSPF interface commands\n"
7863 "Time between retransmitting lost link state advertisements\n"
7866 struct interface
*ifp
= vty
->index
;
7867 struct ospf_if_params
*params
;
7870 params
= IF_DEF_PARAMS (ifp
);
7872 UNSET_IF_PARAM (params
, retransmit_interval
);
7873 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
7880 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7881 * "ip ospf transmit-delay <1-65535>",
7882 * "IP Information\n"
7883 * "OSPF interface commands\n"
7884 * "Link state transmit delay\n"
7888 DEFUN (ip_ospf_transmit_delay
,
7889 ip_ospf_transmit_delay_addr_cmd
,
7890 "ip ospf transmit-delay (1-65535) A.B.C.D",
7892 "OSPF interface commands\n"
7893 "Link state transmit delay\n"
7895 "Address of interface")
7899 struct interface
*ifp
= vty
->index
;
7901 struct in_addr addr
;
7903 struct ospf_if_params
*params
;
7905 params
= IF_DEF_PARAMS (ifp
);
7906 seconds
= strtol (argv
[idx_number
]->arg
, NULL
, 10);
7908 /* Transmit Delay range is <1-65535>. */
7909 if (seconds
< 1 || seconds
> 65535)
7911 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
7917 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
7920 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7925 params
= ospf_get_if_params (ifp
, addr
);
7926 ospf_if_update_params (ifp
, addr
);
7929 SET_IF_PARAM (params
, transmit_delay
);
7930 params
->transmit_delay
= seconds
;
7936 ALIAS_HIDDEN (ip_ospf_transmit_delay
,
7937 ospf_transmit_delay_cmd
,
7938 "ospf transmit-delay <1-65535>",
7939 "OSPF interface commands\n"
7940 "Link state transmit delay\n"
7944 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
7945 * "no ospf transmit-delay",
7947 * "OSPF interface commands\n"
7948 * "Link state transmit delay\n"
7950 * "no ip ospf transmit-delay",
7952 * "IP Information\n"
7953 * "OSPF interface commands\n"
7954 * "Link state transmit delay\n"
7956 * "no ip ospf transmit-delay <1-65535> A.B.C.D",
7958 * "IP Information\n"
7959 * "OSPF interface commands\n"
7960 * "Link state transmit delay\n"
7962 * "Address of interface"
7965 DEFUN (no_ip_ospf_transmit_delay
,
7966 no_ip_ospf_transmit_delay_addr_cmd
,
7967 "no ip ospf transmit-delay A.B.C.D",
7970 "OSPF interface commands\n"
7971 "Link state transmit delay\n"
7972 "Address of interface")
7974 struct interface
*ifp
= vty
->index
;
7975 struct in_addr addr
;
7977 struct ospf_if_params
*params
;
7981 params
= IF_DEF_PARAMS (ifp
);
7990 ret
= inet_aton(argv
[addr_index
], &addr
);
7993 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
7998 params
= ospf_lookup_if_params (ifp
, addr
);
8003 UNSET_IF_PARAM (params
, transmit_delay
);
8004 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
8006 if (params
!= IF_DEF_PARAMS (ifp
))
8008 ospf_free_if_params (ifp
, addr
);
8009 ospf_if_update_params (ifp
, addr
);
8018 DEFUN (no_ip_ospf_transmit_delay_sec
,
8019 no_ip_ospf_transmit_delay_sec_cmd
,
8020 "no ip ospf transmit-delay (1-65535)",
8023 "OSPF interface commands\n"
8024 "Link state transmit delay\n"
8026 "Address of interface")
8028 struct interface
*ifp
= vty
->index
;
8029 struct ospf_if_params
*params
;
8032 params
= IF_DEF_PARAMS (ifp
);
8034 UNSET_IF_PARAM (params
, transmit_delay
);
8035 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
8041 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
8042 * "ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)",
8043 * "IP Information\n"
8044 * "OSPF interface commands\n"
8046 * "Enable OSPF on this interface\n"
8047 * "OSPF area ID in IP address format\n"
8048 * "OSPF area ID as a decimal value\n"
8051 DEFUN (ip_ospf_area
,
8053 "ip ospf area <A.B.C.D|(0-4294967295)>",
8055 "OSPF interface commands\n"
8056 "Enable OSPF on this interface\n"
8057 "OSPF area ID in IP address format\n"
8058 "OSPF area ID as a decimal value\n")
8060 int idx_ipv4_number
= 3;
8061 struct interface
*ifp
= vty
->index
;
8063 struct in_addr area_id
;
8065 struct ospf_if_params
*params
;
8066 struct route_node
*rn
;
8067 u_short instance
= 0;
8070 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_ipv4_number
]->arg
);
8072 ospf
= ospf_lookup_instance (instance
);
8075 params
= IF_DEF_PARAMS (ifp
);
8076 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
8078 ospf_interface_unset (ifp
);
8079 ospf
= ospf_lookup();
8080 ospf
->if_ospf_cli_count
--;
8085 ret
= ospf_str2area_id (argv
[instance
? 1 : 0], &area_id
, &format
);
8088 vty_out (vty
, "Please specify area by A.B.C.D|<0-4294967295>%s",
8092 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
8094 vty_out (vty
, "Cannot enable OSPF on a virtual link.%s", VTY_NEWLINE
);
8098 params
= IF_DEF_PARAMS (ifp
);
8099 if (OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
8102 "Must remove previous area config before changing ospf area %s",
8107 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
8109 if (rn
->info
!= NULL
)
8111 vty_out (vty
, "Please remove all network commands first.%s", VTY_NEWLINE
);
8116 /* enable ospf on this interface with area_id */
8117 ospf_interface_set (ifp
, area_id
);
8118 ospf
->if_ospf_cli_count
++;
8125 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
8126 * "no ip ospf area (A.B.C.D|<0-4294967295>)",
8128 * "IP Information\n"
8129 * "OSPF interface commands\n"
8130 * "Disable OSPF on this interface\n"
8131 * "OSPF area ID in IP address format\n"
8132 * "OSPF area ID as a decimal value\n"
8135 DEFUN (no_ip_ospf_area
,
8136 no_ip_ospf_area_cmd
,
8140 "OSPF interface commands\n"
8141 "Disable OSPF on this interface\n")
8143 struct interface
*ifp
= vty
->index
;
8145 struct ospf_if_params
*params
;
8146 u_short instance
= 0;
8148 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
)
8151 params
= IF_DEF_PARAMS (ifp
);
8152 if (!OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
8154 vty_out (vty
, "Can't find specified inteface area configuration.%s", VTY_NEWLINE
);
8158 ospf_interface_unset (ifp
);
8159 ospf
->if_ospf_cli_count
--;
8165 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
8166 * "no ip ospf <1-65535> area (A.B.C.D|<0-4294967295>)",
8168 * "IP Information\n"
8169 * "OSPF interface commands\n"
8171 * "Disable OSPF on this interface\n"
8172 * "OSPF area ID in IP address format\n"
8173 * "OSPF area ID as a decimal value\n"
8176 DEFUN (no_ip_ospf_instance_area
,
8177 no_ip_ospf_instance_area_cmd
,
8178 "no ip ospf (1-65535) area",
8181 "OSPF interface commands\n"
8183 "Disable OSPF on this interface\n")
8186 struct interface
*ifp
= vty
->index
;
8188 struct ospf_if_params
*params
;
8189 u_short instance
= 0;
8191 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
8193 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
)
8196 params
= IF_DEF_PARAMS (ifp
);
8197 if (!OSPF_IF_PARAM_CONFIGURED(params
, if_area
))
8199 vty_out (vty
, "Can't find specified inteface area configuration.%s", VTY_NEWLINE
);
8203 ospf_interface_unset (ifp
);
8204 ospf
->if_ospf_cli_count
--;
8209 DEFUN (ospf_redistribute_source
,
8210 ospf_redistribute_source_cmd
,
8211 "redistribute <kernel|connected|static|rip|isis|bgp|pim|table> [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
8213 QUAGGA_REDIST_HELP_STR_OSPFD
8214 "Metric for redistributed routes\n"
8215 "OSPF default metric\n"
8216 "OSPF exterior metric type for redistributed routes\n"
8217 "Set OSPF External Type 1 metrics\n"
8218 "Set OSPF External Type 2 metrics\n"
8219 "Route map reference\n"
8220 "Pointer to route-map entries\n")
8222 int idx_protocol
= 1;
8223 int idx_redist_param
= 2;
8224 struct ospf
*ospf
= vty
->index
;
8228 struct ospf_redist
*red
;
8234 return CMD_WARNING
; /* should not happen */
8239 /* Get distribute source. */
8240 source
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->arg
);
8241 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
8244 /* Get metric value. */
8245 if (argv
[idx_redist_param
]->arg
!= NULL
)
8246 if (!str2metric (argv
[idx_redist_param
]->arg
, &metric
))
8249 /* Get metric type. */
8250 if (argv
[2] != NULL
)
8251 if (!str2metric_type (argv
[2], &type
))
8254 red
= ospf_redist_add(ospf
, source
, 0);
8256 if (argv
[3] != NULL
)
8257 ospf_routemap_set (red
, argv
[3]);
8259 ospf_routemap_unset (red
);
8261 return ospf_redistribute_set (ospf
, source
, 0, type
, metric
);
8264 DEFUN (no_ospf_redistribute_source
,
8265 no_ospf_redistribute_source_cmd
,
8266 "no redistribute <kernel|connected|static|rip|isis|bgp|pim|table> [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
8269 QUAGGA_REDIST_HELP_STR_OSPFD
8270 "Metric for redistributed routes\n"
8271 "OSPF default metric\n"
8272 "OSPF exterior metric type for redistributed routes\n"
8273 "Set OSPF External Type 1 metrics\n"
8274 "Set OSPF External Type 2 metrics\n"
8275 "Route map reference\n"
8276 "Pointer to route-map entries\n")
8278 int idx_protocol
= 2;
8279 struct ospf
*ospf
= vty
->index
;
8281 struct ospf_redist
*red
;
8285 source
= proto_redistnum(AFI_IP
, argv
[idx_protocol
]->arg
);
8286 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
8289 red
= ospf_redist_lookup(ospf
, source
, 0);
8293 ospf_routemap_unset (red
);
8294 return ospf_redistribute_unset (ospf
, source
, 0);
8297 DEFUN (ospf_redistribute_instance_source
,
8298 ospf_redistribute_instance_source_cmd
,
8299 "redistribute <ospf|table> (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
8301 "Open Shortest Path First\n"
8302 "Non-main Kernel Routing Table\n"
8303 "Instance ID/Table ID\n"
8304 "Metric for redistributed routes\n"
8305 "OSPF default metric\n"
8306 "OSPF exterior metric type for redistributed routes\n"
8307 "Set OSPF External Type 1 metrics\n"
8308 "Set OSPF External Type 2 metrics\n"
8309 "Route map reference\n"
8310 "Pointer to route-map entries\n")
8312 int idx_ospf_table
= 1;
8314 int idx_redist_param
= 3;
8315 struct ospf
*ospf
= vty
->index
;
8320 struct ospf_redist
*red
;
8325 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
8326 source
= ZEBRA_ROUTE_OSPF
;
8328 source
= ZEBRA_ROUTE_TABLE
;
8330 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
8335 if ((source
== ZEBRA_ROUTE_OSPF
) && !ospf
->instance
)
8337 vty_out (vty
, "Instance redistribution in non-instanced OSPF not allowed%s",
8342 if ((source
== ZEBRA_ROUTE_OSPF
) && (ospf
->instance
== instance
))
8344 vty_out (vty
, "Same instance OSPF redistribution not allowed%s",
8349 /* Get metric value. */
8350 if (argv
[idx_redist_param
]->arg
!= NULL
)
8351 if (!str2metric (argv
[idx_redist_param
]->arg
, &metric
))
8354 /* Get metric type. */
8355 if (argv
[3] != NULL
)
8356 if (!str2metric_type (argv
[3], &type
))
8359 red
= ospf_redist_add(ospf
, source
, instance
);
8360 if (argv
[4] != NULL
)
8361 ospf_routemap_set (red
, argv
[4]);
8363 ospf_routemap_unset (red
);
8365 return ospf_redistribute_set (ospf
, source
, instance
, type
, metric
);
8368 DEFUN (no_ospf_redistribute_instance_source
,
8369 no_ospf_redistribute_instance_source_cmd
,
8370 "no redistribute <ospf|table> (1-65535) [metric (0-16777214)|metric-type <1|2>|route-map WORD]",
8373 "Open Shortest Path First\n"
8374 "Non-main Kernel Routing Table\n"
8375 "Instance ID/Table Id\n"
8376 "Metric for redistributed routes\n"
8377 "OSPF default metric\n"
8378 "OSPF exterior metric type for redistributed routes\n"
8379 "Set OSPF External Type 1 metrics\n"
8380 "Set OSPF External Type 2 metrics\n"
8381 "Route map reference\n"
8382 "Pointer to route-map entries\n")
8384 int idx_ospf_table
= 2;
8386 struct ospf
*ospf
= vty
->index
;
8388 struct ospf_redist
*red
;
8394 if (strncmp(argv
[idx_ospf_table
]->arg
, "o", 1) == 0)
8395 source
= ZEBRA_ROUTE_OSPF
;
8397 source
= ZEBRA_ROUTE_TABLE
;
8399 VTY_GET_INTEGER ("Instance ID", instance
, argv
[idx_number
]->arg
);
8401 if ((source
== ZEBRA_ROUTE_OSPF
) && !ospf
->instance
)
8403 vty_out (vty
, "Instance redistribution in non-instanced OSPF not allowed%s",
8408 if ((source
== ZEBRA_ROUTE_OSPF
) && (ospf
->instance
== instance
))
8410 vty_out (vty
, "Same instance OSPF redistribution not allowed%s",
8415 red
= ospf_redist_lookup(ospf
, source
, instance
);
8419 ospf_routemap_unset (red
);
8420 return ospf_redistribute_unset (ospf
, source
, instance
);
8423 DEFUN (ospf_distribute_list_out
,
8424 ospf_distribute_list_out_cmd
,
8425 "distribute-list WORD out <kernel|connected|static|rip|isis|bgp|pim|table>",
8426 "Filter networks in routing updates\n"
8427 "Access-list name\n"
8429 QUAGGA_REDIST_HELP_STR_OSPFD
)
8432 struct ospf
*ospf
= vty
->index
;
8438 /* Get distribute source. */
8439 source
= proto_redistnum(AFI_IP
, argv
[4]->arg
);
8440 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
8443 return ospf_distribute_list_out_set (ospf
, source
, argv
[idx_word
]->arg
);
8446 DEFUN (no_ospf_distribute_list_out
,
8447 no_ospf_distribute_list_out_cmd
,
8448 "no distribute-list WORD out <kernel|connected|static|rip|isis|bgp|pim|table>",
8450 "Filter networks in routing updates\n"
8451 "Access-list name\n"
8453 QUAGGA_REDIST_HELP_STR_OSPFD
)
8456 struct ospf
*ospf
= vty
->index
;
8462 source
= proto_redistnum(AFI_IP
, argv
[5]->arg
);
8463 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
8466 return ospf_distribute_list_out_unset (ospf
, source
, argv
[idx_word
]->arg
);
8469 /* Default information originate. */
8470 DEFUN (ospf_default_information_originate
,
8471 ospf_default_information_originate_cmd
,
8472 "default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]",
8473 "Control distribution of default information\n"
8474 "Distribute a default route\n"
8475 "Always advertise default route\n"
8476 "OSPF default metric\n"
8478 "OSPF metric type for default routes\n"
8479 "Set OSPF External Type 1 metrics\n"
8480 "Set OSPF External Type 2 metrics\n"
8481 "Route map reference\n"
8482 "Pointer to route-map entries\n")
8484 int idx_redist_param
= 2;
8485 struct ospf
*ospf
= vty
->index
;
8486 int default_originate
= DEFAULT_ORIGINATE_ZEBRA
;
8489 struct ospf_redist
*red
;
8495 return CMD_WARNING
; /* this should not happen */
8497 /* Check whether "always" was specified */
8498 if (argv
[idx_redist_param
]->arg
!= NULL
)
8499 default_originate
= DEFAULT_ORIGINATE_ALWAYS
;
8501 red
= ospf_redist_add(ospf
, DEFAULT_ROUTE
, 0);
8503 /* Get metric value. */
8504 if (argv
[1] != NULL
)
8505 if (!str2metric (argv
[1], &metric
))
8508 /* Get metric type. */
8509 if (argv
[2] != NULL
)
8510 if (!str2metric_type (argv
[2], &type
))
8513 if (argv
[3] != NULL
)
8514 ospf_routemap_set (red
, argv
[3]);
8516 ospf_routemap_unset (red
);
8518 return ospf_redistribute_default_set (ospf
, default_originate
,
8522 DEFUN (no_ospf_default_information_originate
,
8523 no_ospf_default_information_originate_cmd
,
8524 "no default-information originate [always|metric (0-16777214)|metric-type <1|2>|route-map WORD]",
8526 "Control distribution of default information\n"
8527 "Distribute a default route\n"
8528 "Always advertise default route\n"
8529 "OSPF default metric\n"
8531 "OSPF metric type for default routes\n"
8532 "Set OSPF External Type 1 metrics\n"
8533 "Set OSPF External Type 2 metrics\n"
8534 "Route map reference\n"
8535 "Pointer to route-map entries\n")
8537 struct ospf
*ospf
= vty
->index
;
8538 struct prefix_ipv4 p
;
8539 struct ospf_external
*ext
;
8540 struct ospf_redist
*red
;
8546 p
.prefix
.s_addr
= 0;
8549 ospf_external_lsa_flush (ospf
, DEFAULT_ROUTE
, &p
, 0);
8551 if ((ext
= ospf_external_lookup(DEFAULT_ROUTE
, 0)) &&
8552 EXTERNAL_INFO (ext
)) {
8553 ospf_external_info_delete (DEFAULT_ROUTE
, 0, p
);
8554 ospf_external_del (DEFAULT_ROUTE
, 0);
8557 red
= ospf_redist_lookup(ospf
, DEFAULT_ROUTE
, 0);
8561 ospf_routemap_unset (red
);
8562 return ospf_redistribute_default_unset (ospf
);
8565 DEFUN (ospf_default_metric
,
8566 ospf_default_metric_cmd
,
8567 "default-metric (0-16777214)",
8568 "Set metric of redistributed routes\n"
8572 struct ospf
*ospf
= vty
->index
;
8578 if (!str2metric (argv
[idx_number
]->arg
, &metric
))
8581 ospf
->default_metric
= metric
;
8587 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
8588 * "no default-metric <0-16777214>",
8590 * "Set metric of redistributed routes\n"
8591 * "Default metric\n"
8594 DEFUN (no_ospf_default_metric
,
8595 no_ospf_default_metric_cmd
,
8596 "no default-metric",
8598 "Set metric of redistributed routes\n")
8600 struct ospf
*ospf
= vty
->index
;
8605 ospf
->default_metric
= -1;
8611 DEFUN (ospf_distance
,
8614 "Define an administrative distance\n"
8615 "OSPF Administrative distance\n")
8618 struct ospf
*ospf
= vty
->index
;
8623 ospf
->distance_all
= atoi (argv
[idx_number
]->arg
);
8628 DEFUN (no_ospf_distance
,
8629 no_ospf_distance_cmd
,
8630 "no distance (1-255)",
8632 "Define an administrative distance\n"
8633 "OSPF Administrative distance\n")
8635 struct ospf
*ospf
= vty
->index
;
8640 ospf
->distance_all
= 0;
8645 DEFUN (no_ospf_distance_ospf
,
8646 no_ospf_distance_ospf_cmd
,
8647 "no distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]",
8649 "Define an administrative distance\n"
8650 "OSPF Administrative distance\n"
8651 "Intra-area routes\n"
8652 "Distance for intra-area routes\n"
8653 "Inter-area routes\n"
8654 "Distance for inter-area routes\n"
8656 "Distance for external routes\n")
8658 int idx_area_distance
= 3;
8659 struct ospf
*ospf
= vty
->index
;
8670 if (argv
[idx_area_distance
]->arg
!= NULL
)
8671 ospf
->distance_intra
= 0;
8673 if (argv
[1] != NULL
)
8674 ospf
->distance_inter
= 0;
8676 if (argv
[2] != NULL
)
8677 ospf
->distance_external
= 0;
8679 if (argv
[idx_area_distance
]->arg
|| argv
[1] || argv
[2])
8682 /* If no arguments are given, clear all distance information */
8683 ospf
->distance_intra
= 0;
8684 ospf
->distance_inter
= 0;
8685 ospf
->distance_external
= 0;
8690 DEFUN (ospf_distance_ospf
,
8691 ospf_distance_ospf_cmd
,
8692 "distance ospf [intra-area (1-255)|inter-area (1-255)|external (1-255)]",
8693 "Define an administrative distance\n"
8694 "OSPF Administrative distance\n"
8695 "Intra-area routes\n"
8696 "Distance for intra-area routes\n"
8697 "Inter-area routes\n"
8698 "Distance for inter-area routes\n"
8700 "Distance for external routes\n")
8702 int idx_area_distance
= 2;
8703 struct ospf
*ospf
= vty
->index
;
8708 if (argc
< 3) /* should not happen */
8711 if (!argv
[idx_area_distance
]->arg
&& !argv
[1] && !argv
[2])
8713 vty_out(vty
, "%% Command incomplete. (Arguments required)%s",
8718 if (argv
[idx_area_distance
]->arg
!= NULL
)
8719 ospf
->distance_intra
= atoi(argv
[idx_area_distance
]->arg
);
8721 if (argv
[1] != NULL
)
8722 ospf
->distance_inter
= atoi(argv
[1]);
8724 if (argv
[2] != NULL
)
8725 ospf
->distance_external
= atoi(argv
[2]);
8730 DEFUN (ospf_distance_source
,
8731 ospf_distance_source_cmd
,
8732 "distance (1-255) A.B.C.D/M",
8733 "Administrative distance\n"
8735 "IP source prefix\n")
8738 int idx_ipv4_prefixlen
= 2;
8739 struct ospf
*ospf
= vty
->index
;
8744 ospf_distance_set (vty
, ospf
, argv
[idx_number
]->arg
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
);
8749 DEFUN (no_ospf_distance_source
,
8750 no_ospf_distance_source_cmd
,
8751 "no distance (1-255) A.B.C.D/M",
8753 "Administrative distance\n"
8755 "IP source prefix\n")
8758 int idx_ipv4_prefixlen
= 3;
8759 struct ospf
*ospf
= vty
->index
;
8764 ospf_distance_unset (vty
, ospf
, argv
[idx_number
]->arg
, argv
[idx_ipv4_prefixlen
]->arg
, NULL
);
8769 DEFUN (ospf_distance_source_access_list
,
8770 ospf_distance_source_access_list_cmd
,
8771 "distance (1-255) A.B.C.D/M WORD",
8772 "Administrative distance\n"
8774 "IP source prefix\n"
8775 "Access list name\n")
8778 int idx_ipv4_prefixlen
= 2;
8780 struct ospf
*ospf
= vty
->index
;
8785 ospf_distance_set (vty
, ospf
, argv
[idx_number
]->arg
, argv
[idx_ipv4_prefixlen
]->arg
, argv
[idx_word
]->arg
);
8790 DEFUN (no_ospf_distance_source_access_list
,
8791 no_ospf_distance_source_access_list_cmd
,
8792 "no distance (1-255) A.B.C.D/M WORD",
8794 "Administrative distance\n"
8796 "IP source prefix\n"
8797 "Access list name\n")
8800 int idx_ipv4_prefixlen
= 3;
8802 struct ospf
*ospf
= vty
->index
;
8807 ospf_distance_unset (vty
, ospf
, argv
[idx_number
]->arg
, argv
[idx_ipv4_prefixlen
]->arg
, argv
[idx_word
]->arg
);
8813 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
8814 * "ip ospf mtu-ignore",
8815 * "IP Information\n"
8816 * "OSPF interface commands\n"
8817 * "Disable mtu mismatch detection\n"
8820 DEFUN (ip_ospf_mtu_ignore
,
8821 ip_ospf_mtu_ignore_addr_cmd
,
8822 "ip ospf mtu-ignore A.B.C.D",
8824 "OSPF interface commands\n"
8825 "Disable mtu mismatch detection\n"
8826 "Address of interface")
8829 struct interface
*ifp
= vty
->index
;
8830 struct in_addr addr
;
8833 struct ospf_if_params
*params
;
8834 params
= IF_DEF_PARAMS (ifp
);
8838 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
8841 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
8845 params
= ospf_get_if_params (ifp
, addr
);
8846 ospf_if_update_params (ifp
, addr
);
8848 params
->mtu_ignore
= 1;
8849 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
8850 SET_IF_PARAM (params
, mtu_ignore
);
8853 UNSET_IF_PARAM (params
, mtu_ignore
);
8854 if (params
!= IF_DEF_PARAMS (ifp
))
8856 ospf_free_if_params (ifp
, addr
);
8857 ospf_if_update_params (ifp
, addr
);
8866 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
8867 * "no ip ospf mtu-ignore",
8868 * "IP Information\n"
8869 * "OSPF interface commands\n"
8870 * "Disable mtu mismatch detection\n"
8873 DEFUN (no_ip_ospf_mtu_ignore
,
8874 no_ip_ospf_mtu_ignore_addr_cmd
,
8875 "no ip ospf mtu-ignore A.B.C.D",
8877 "OSPF interface commands\n"
8878 "Disable mtu mismatch detection\n"
8879 "Address of interface")
8882 struct interface
*ifp
= vty
->index
;
8883 struct in_addr addr
;
8886 struct ospf_if_params
*params
;
8887 params
= IF_DEF_PARAMS (ifp
);
8891 ret
= inet_aton(argv
[idx_ipv4
]->arg
, &addr
);
8894 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
8898 params
= ospf_get_if_params (ifp
, addr
);
8899 ospf_if_update_params (ifp
, addr
);
8901 params
->mtu_ignore
= 0;
8902 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
8903 SET_IF_PARAM (params
, mtu_ignore
);
8906 UNSET_IF_PARAM (params
, mtu_ignore
);
8907 if (params
!= IF_DEF_PARAMS (ifp
))
8909 ospf_free_if_params (ifp
, addr
);
8910 ospf_if_update_params (ifp
, addr
);
8917 DEFUN (ospf_max_metric_router_lsa_admin
,
8918 ospf_max_metric_router_lsa_admin_cmd
,
8919 "max-metric router-lsa administrative",
8920 "OSPF maximum / infinite-distance metric\n"
8921 "Advertise own Router-LSA with infinite distance (stub router)\n"
8922 "Administratively applied, for an indefinite period\n")
8924 struct listnode
*ln
;
8925 struct ospf_area
*area
;
8926 struct ospf
*ospf
= vty
->index
;
8931 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
8933 SET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
8935 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
8936 ospf_router_lsa_update_area (area
);
8939 /* Allows for areas configured later to get the property */
8940 ospf
->stub_router_admin_set
= OSPF_STUB_ROUTER_ADMINISTRATIVE_SET
;
8945 DEFUN (no_ospf_max_metric_router_lsa_admin
,
8946 no_ospf_max_metric_router_lsa_admin_cmd
,
8947 "no max-metric router-lsa administrative",
8949 "OSPF maximum / infinite-distance metric\n"
8950 "Advertise own Router-LSA with infinite distance (stub router)\n"
8951 "Administratively applied, for an indefinite period\n")
8953 struct listnode
*ln
;
8954 struct ospf_area
*area
;
8955 struct ospf
*ospf
= vty
->index
;
8960 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
8962 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
8964 /* Don't trample on the start-up stub timer */
8965 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
)
8966 && !area
->t_stub_router
)
8968 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
8969 ospf_router_lsa_update_area (area
);
8972 ospf
->stub_router_admin_set
= OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET
;
8976 DEFUN (ospf_max_metric_router_lsa_startup
,
8977 ospf_max_metric_router_lsa_startup_cmd
,
8978 "max-metric router-lsa on-startup (5-86400)",
8979 "OSPF maximum / infinite-distance metric\n"
8980 "Advertise own Router-LSA with infinite distance (stub router)\n"
8981 "Automatically advertise stub Router-LSA on startup of OSPF\n"
8982 "Time (seconds) to advertise self as stub-router\n")
8985 unsigned int seconds
;
8986 struct ospf
*ospf
= vty
->index
;
8993 vty_out (vty
, "%% Must supply stub-router period");
8997 VTY_GET_INTEGER ("stub-router startup period", seconds
, argv
[idx_number
]->arg
);
8999 ospf
->stub_router_startup_time
= seconds
;
9005 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
9006 * "no max-metric router-lsa on-startup",
9008 * "OSPF maximum / infinite-distance metric\n"
9009 * "Advertise own Router-LSA with infinite distance (stub router)\n"
9010 * "Automatically advertise stub Router-LSA on startup of OSPF\n"
9013 DEFUN (no_ospf_max_metric_router_lsa_startup
,
9014 no_ospf_max_metric_router_lsa_startup_cmd
,
9015 "no max-metric router-lsa on-startup (5-86400)",
9017 "OSPF maximum / infinite-distance metric\n"
9018 "Advertise own Router-LSA with infinite distance (stub router)\n"
9019 "Automatically advertise stub Router-LSA on startup of OSPF\n"
9020 "Time (seconds) to advertise self as stub-router\n")
9022 struct listnode
*ln
;
9023 struct ospf_area
*area
;
9024 struct ospf
*ospf
= vty
->index
;
9029 ospf
->stub_router_startup_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
9031 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
9033 SET_FLAG (area
->stub_router_state
, OSPF_AREA_WAS_START_STUB_ROUTED
);
9034 OSPF_TIMER_OFF (area
->t_stub_router
);
9036 /* Don't trample on admin stub routed */
9037 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
9039 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
9040 ospf_router_lsa_update_area (area
);
9047 DEFUN (ospf_max_metric_router_lsa_shutdown
,
9048 ospf_max_metric_router_lsa_shutdown_cmd
,
9049 "max-metric router-lsa on-shutdown (5-100)",
9050 "OSPF maximum / infinite-distance metric\n"
9051 "Advertise own Router-LSA with infinite distance (stub router)\n"
9052 "Advertise stub-router prior to full shutdown of OSPF\n"
9053 "Time (seconds) to wait till full shutdown\n")
9056 unsigned int seconds
;
9057 struct ospf
*ospf
= vty
->index
;
9064 vty_out (vty
, "%% Must supply stub-router shutdown period");
9068 VTY_GET_INTEGER ("stub-router shutdown wait period", seconds
, argv
[idx_number
]->arg
);
9070 ospf
->stub_router_shutdown_time
= seconds
;
9076 * CHECK ME - The following ALIASes need to be implemented in this DEFUN
9077 * "no max-metric router-lsa on-shutdown",
9079 * "OSPF maximum / infinite-distance metric\n"
9080 * "Advertise own Router-LSA with infinite distance (stub router)\n"
9081 * "Advertise stub-router prior to full shutdown of OSPF\n");
9084 * config_write_stub_router (struct vty *vty, struct ospf *ospf
9087 DEFUN (no_ospf_max_metric_router_lsa_shutdown
,
9088 no_ospf_max_metric_router_lsa_shutdown_cmd
,
9089 "no max-metric router-lsa on-shutdown (5-100)",
9091 "OSPF maximum / infinite-distance metric\n"
9092 "Advertise own Router-LSA with infinite distance (stub router)\n"
9093 "Advertise stub-router prior to full shutdown of OSPF\n"
9094 "Time (seconds) to wait till full shutdown\n")
9096 struct ospf
*ospf
= vty
->index
;
9101 ospf
->stub_router_shutdown_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
9107 config_write_stub_router (struct vty
*vty
, struct ospf
*ospf
)
9109 struct listnode
*ln
;
9110 struct ospf_area
*area
;
9112 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
9113 vty_out (vty
, " max-metric router-lsa on-startup %u%s",
9114 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
9115 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
9116 vty_out (vty
, " max-metric router-lsa on-shutdown %u%s",
9117 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
9118 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
9120 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
9122 vty_out (vty
, " max-metric router-lsa administrative%s",
9131 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
9133 struct route_node
*rn
;
9134 struct ospf_route
*or;
9135 struct listnode
*pnode
, *pnnode
;
9136 struct ospf_path
*path
;
9138 vty_out (vty
, "============ OSPF network routing table ============%s",
9141 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
9142 if ((or = rn
->info
) != NULL
)
9145 snprintf (buf1
, 19, "%s/%d",
9146 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
9148 switch (or->path_type
)
9150 case OSPF_PATH_INTER_AREA
:
9151 if (or->type
== OSPF_DESTINATION_NETWORK
)
9152 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
9153 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
9154 else if (or->type
== OSPF_DESTINATION_DISCARD
)
9155 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
9157 case OSPF_PATH_INTRA_AREA
:
9158 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
9159 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
9165 if (or->type
== OSPF_DESTINATION_NETWORK
)
9166 for (ALL_LIST_ELEMENTS (or->paths
, pnode
, pnnode
, path
))
9168 if (if_lookup_by_index(path
->ifindex
))
9170 if (path
->nexthop
.s_addr
== 0)
9171 vty_out (vty
, "%24s directly attached to %s%s",
9172 "", ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
9174 vty_out (vty
, "%24s via %s, %s%s", "",
9175 inet_ntoa (path
->nexthop
),
9176 ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
9180 vty_out (vty
, "%s", VTY_NEWLINE
);
9184 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
9186 struct route_node
*rn
;
9187 struct ospf_route
*or;
9188 struct listnode
*pnode
;
9189 struct listnode
*node
;
9190 struct ospf_path
*path
;
9192 vty_out (vty
, "============ OSPF router routing table =============%s",
9194 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
9199 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
9201 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, or))
9204 vty_out (vty
, "%24s", "");
9207 vty_out (vty
, "%s [%d] area: %s",
9208 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
9209 or->cost
, inet_ntoa (or->u
.std
.area_id
));
9211 vty_out (vty
, "%s%s%s",
9212 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
9213 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
9216 for (ALL_LIST_ELEMENTS_RO (or->paths
, pnode
, path
))
9218 if (if_lookup_by_index(path
->ifindex
))
9220 if (path
->nexthop
.s_addr
== 0)
9221 vty_out (vty
, "%24s directly attached to %s%s",
9222 "", ifindex2ifname (path
->ifindex
),
9225 vty_out (vty
, "%24s via %s, %s%s", "",
9226 inet_ntoa (path
->nexthop
),
9227 ifindex2ifname (path
->ifindex
),
9233 vty_out (vty
, "%s", VTY_NEWLINE
);
9237 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
9239 struct route_node
*rn
;
9240 struct ospf_route
*er
;
9241 struct listnode
*pnode
, *pnnode
;
9242 struct ospf_path
*path
;
9244 vty_out (vty
, "============ OSPF external routing table ===========%s",
9246 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
9247 if ((er
= rn
->info
) != NULL
)
9250 snprintf (buf1
, 19, "%s/%d",
9251 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
9253 switch (er
->path_type
)
9255 case OSPF_PATH_TYPE1_EXTERNAL
:
9256 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
9257 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
9259 case OSPF_PATH_TYPE2_EXTERNAL
:
9260 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
9261 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
9265 for (ALL_LIST_ELEMENTS (er
->paths
, pnode
, pnnode
, path
))
9267 if (if_lookup_by_index(path
->ifindex
))
9269 if (path
->nexthop
.s_addr
== 0)
9270 vty_out (vty
, "%24s directly attached to %s%s",
9271 "", ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
9273 vty_out (vty
, "%24s via %s, %s%s", "",
9274 inet_ntoa (path
->nexthop
),
9275 ifindex2ifname (path
->ifindex
),
9280 vty_out (vty
, "%s", VTY_NEWLINE
);
9284 show_ip_ospf_border_routers_common (struct vty
*vty
, struct ospf
*ospf
)
9287 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
9288 VTY_NEWLINE
, VTY_NEWLINE
);
9290 if (ospf
->new_table
== NULL
)
9292 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
9296 /* Show Network routes.
9297 show_ip_ospf_route_network (vty, ospf->new_table); */
9299 /* Show Router routes. */
9300 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
9302 vty_out (vty
, "%s", VTY_NEWLINE
);
9307 DEFUN (show_ip_ospf_border_routers
,
9308 show_ip_ospf_border_routers_cmd
,
9309 "show ip ospf border-routers",
9312 "OSPF information\n"
9313 "Show all the ABR's and ASBR's\n")
9317 if ((ospf
= ospf_lookup ()) == NULL
|| !ospf
->oi_running
)
9320 return show_ip_ospf_border_routers_common(vty
, ospf
);
9323 DEFUN (show_ip_ospf_instance_border_routers
,
9324 show_ip_ospf_instance_border_routers_cmd
,
9325 "show ip ospf (1-65535) border-routers",
9328 "OSPF information\n"
9330 "Show all the ABR's and ASBR's\n")
9334 u_short instance
= 0;
9336 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
9337 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
9340 return show_ip_ospf_border_routers_common(vty
, ospf
);
9344 show_ip_ospf_route_common (struct vty
*vty
, struct ospf
*ospf
)
9347 vty_out (vty
, "%sOSPF Instance: %d%s%s", VTY_NEWLINE
, ospf
->instance
,
9348 VTY_NEWLINE
, VTY_NEWLINE
);
9350 if (ospf
->new_table
== NULL
)
9352 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
9356 /* Show Network routes. */
9357 show_ip_ospf_route_network (vty
, ospf
->new_table
);
9359 /* Show Router routes. */
9360 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
9362 /* Show AS External routes. */
9363 show_ip_ospf_route_external (vty
, ospf
->old_external_route
);
9365 vty_out (vty
, "%s", VTY_NEWLINE
);
9370 DEFUN (show_ip_ospf_route
,
9371 show_ip_ospf_route_cmd
,
9372 "show ip ospf route",
9375 "OSPF information\n"
9376 "OSPF routing table\n")
9380 if ((ospf
= ospf_lookup ()) == NULL
|| !ospf
->oi_running
)
9383 return show_ip_ospf_route_common(vty
, ospf
);
9386 DEFUN (show_ip_ospf_instance_route
,
9387 show_ip_ospf_instance_route_cmd
,
9388 "show ip ospf (1-65535) route",
9391 "OSPF information\n"
9393 "OSPF routing table\n")
9397 u_short instance
= 0;
9399 VTY_GET_INTEGER ("Instance", instance
, argv
[idx_number
]->arg
);
9400 if ((ospf
= ospf_lookup_instance (instance
)) == NULL
|| !ospf
->oi_running
)
9403 return show_ip_ospf_route_common(vty
, ospf
);
9406 const char *ospf_abr_type_str
[] =
9415 const char *ospf_shortcut_mode_str
[] =
9424 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
9426 memset (buf
, 0, length
);
9428 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
9429 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
9431 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
9435 const char *ospf_int_type_str
[] =
9437 "unknown", /* should never be used. */
9441 "point-to-multipoint",
9442 "virtual-link", /* should never be used. */
9446 /* Configuration write function for ospfd. */
9448 config_write_interface (struct vty
*vty
)
9450 struct listnode
*n1
, *n2
;
9451 struct interface
*ifp
;
9452 struct crypt_key
*ck
;
9454 struct route_node
*rn
= NULL
;
9455 struct ospf_if_params
*params
;
9456 struct ospf
*ospf
= ospf_lookup();
9458 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), n1
, ifp
))
9460 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
9463 if (ifp
->ifindex
== IFINDEX_DELETED
)
9466 vty_out (vty
, "!%s", VTY_NEWLINE
);
9467 vty_out (vty
, "interface %s%s", ifp
->name
,
9470 vty_out (vty
, " description %s%s", ifp
->desc
,
9475 params
= IF_DEF_PARAMS (ifp
);
9478 /* Interface Network print. */
9479 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
9480 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
9482 if (params
->type
!= ospf_default_iftype(ifp
))
9484 vty_out (vty
, " ip ospf network %s",
9485 ospf_int_type_str
[params
->type
]);
9486 if (params
!= IF_DEF_PARAMS (ifp
))
9487 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9488 vty_out (vty
, "%s", VTY_NEWLINE
);
9492 /* OSPF interface authentication print */
9493 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
9494 params
->auth_type
!= OSPF_AUTH_NOTSET
)
9496 const char *auth_str
;
9498 /* Translation tables are not that much help here due to syntax
9499 of the simple option */
9500 switch (params
->auth_type
)
9503 case OSPF_AUTH_NULL
:
9507 case OSPF_AUTH_SIMPLE
:
9511 case OSPF_AUTH_CRYPTOGRAPHIC
:
9512 auth_str
= " message-digest";
9520 vty_out (vty
, " ip ospf authentication%s", auth_str
);
9521 if (params
!= IF_DEF_PARAMS (ifp
))
9522 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9523 vty_out (vty
, "%s", VTY_NEWLINE
);
9526 /* Simple Authentication Password print. */
9527 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
9528 params
->auth_simple
[0] != '\0')
9530 vty_out (vty
, " ip ospf authentication-key %s",
9531 params
->auth_simple
);
9532 if (params
!= IF_DEF_PARAMS (ifp
))
9533 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9534 vty_out (vty
, "%s", VTY_NEWLINE
);
9537 /* Cryptographic Authentication Key print. */
9538 for (ALL_LIST_ELEMENTS_RO (params
->auth_crypt
, n2
, ck
))
9540 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
9541 ck
->key_id
, ck
->auth_key
);
9542 if (params
!= IF_DEF_PARAMS (ifp
))
9543 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9544 vty_out (vty
, "%s", VTY_NEWLINE
);
9547 /* Interface Output Cost print. */
9548 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
9550 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
9551 if (params
!= IF_DEF_PARAMS (ifp
))
9552 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9553 vty_out (vty
, "%s", VTY_NEWLINE
);
9556 /* Hello Interval print. */
9557 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
9558 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
9560 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
9561 if (params
!= IF_DEF_PARAMS (ifp
))
9562 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9563 vty_out (vty
, "%s", VTY_NEWLINE
);
9567 /* Router Dead Interval print. */
9568 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
9569 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
9571 vty_out (vty
, " ip ospf dead-interval ");
9574 if (OSPF_IF_PARAM_CONFIGURED (params
, fast_hello
))
9575 vty_out (vty
, "minimal hello-multiplier %d",
9576 params
->fast_hello
);
9578 vty_out (vty
, "%u", params
->v_wait
);
9580 if (params
!= IF_DEF_PARAMS (ifp
))
9581 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9582 vty_out (vty
, "%s", VTY_NEWLINE
);
9585 /* Router Priority print. */
9586 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
9587 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
9589 vty_out (vty
, " ip ospf priority %u", params
->priority
);
9590 if (params
!= IF_DEF_PARAMS (ifp
))
9591 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9592 vty_out (vty
, "%s", VTY_NEWLINE
);
9595 /* Retransmit Interval print. */
9596 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
9597 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
9599 vty_out (vty
, " ip ospf retransmit-interval %u",
9600 params
->retransmit_interval
);
9601 if (params
!= IF_DEF_PARAMS (ifp
))
9602 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9603 vty_out (vty
, "%s", VTY_NEWLINE
);
9606 /* Transmit Delay print. */
9607 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
9608 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
9610 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
9611 if (params
!= IF_DEF_PARAMS (ifp
))
9612 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9613 vty_out (vty
, "%s", VTY_NEWLINE
);
9617 if (OSPF_IF_PARAM_CONFIGURED (params
, if_area
))
9620 vty_out (vty
, " ip ospf %d area %s%s", ospf
->instance
,
9621 inet_ntoa (params
->if_area
), VTY_NEWLINE
);
9623 vty_out (vty
, " ip ospf area %s%s",
9624 inet_ntoa (params
->if_area
), VTY_NEWLINE
);
9629 ospf_bfd_write_config(vty
, params
);
9631 /* MTU ignore print. */
9632 if (OSPF_IF_PARAM_CONFIGURED (params
, mtu_ignore
) &&
9633 params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
9635 if (params
->mtu_ignore
== 0)
9636 vty_out (vty
, " no ip ospf mtu-ignore");
9638 vty_out (vty
, " ip ospf mtu-ignore");
9639 if (params
!= IF_DEF_PARAMS (ifp
))
9640 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
9641 vty_out (vty
, "%s", VTY_NEWLINE
);
9648 rn
= route_top (IF_OIFS_PARAMS (ifp
));
9650 rn
= route_next (rn
);
9660 ospf_opaque_config_write_if (vty
, ifp
);
9667 config_write_network_area (struct vty
*vty
, struct ospf
*ospf
)
9669 struct route_node
*rn
;
9670 u_char buf
[INET_ADDRSTRLEN
];
9672 /* `network area' print. */
9673 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
9676 struct ospf_network
*n
= rn
->info
;
9678 memset (buf
, 0, INET_ADDRSTRLEN
);
9680 /* Create Area ID string by specified Area ID format. */
9681 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
9682 strncpy ((char *) buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
9684 sprintf ((char *) buf
, "%lu",
9685 (unsigned long int) ntohl (n
->area_id
.s_addr
));
9687 /* Network print. */
9688 vty_out (vty
, " network %s/%d area %s%s",
9689 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
9697 config_write_ospf_area (struct vty
*vty
, struct ospf
*ospf
)
9699 struct listnode
*node
;
9700 struct ospf_area
*area
;
9701 u_char buf
[INET_ADDRSTRLEN
];
9703 /* Area configuration print. */
9704 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
9706 struct route_node
*rn1
;
9708 area_id2str ((char *) buf
, INET_ADDRSTRLEN
, area
);
9710 if (area
->auth_type
!= OSPF_AUTH_NULL
)
9712 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
9713 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
9715 vty_out (vty
, " area %s authentication message-digest%s",
9719 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
9720 vty_out (vty
, " area %s shortcut %s%s", buf
,
9721 ospf_shortcut_mode_str
[area
->shortcut_configured
],
9724 if ((area
->external_routing
== OSPF_AREA_STUB
)
9725 || (area
->external_routing
== OSPF_AREA_NSSA
)
9728 if (area
->external_routing
== OSPF_AREA_STUB
)
9729 vty_out (vty
, " area %s stub", buf
);
9730 else if (area
->external_routing
== OSPF_AREA_NSSA
)
9732 vty_out (vty
, " area %s nssa", buf
);
9733 switch (area
->NSSATranslatorRole
)
9735 case OSPF_NSSA_ROLE_NEVER
:
9736 vty_out (vty
, " translate-never");
9738 case OSPF_NSSA_ROLE_ALWAYS
:
9739 vty_out (vty
, " translate-always");
9741 case OSPF_NSSA_ROLE_CANDIDATE
:
9743 vty_out (vty
, " translate-candidate");
9747 if (area
->no_summary
)
9748 vty_out (vty
, " no-summary");
9750 vty_out (vty
, "%s", VTY_NEWLINE
);
9752 if (area
->default_cost
!= 1)
9753 vty_out (vty
, " area %s default-cost %d%s", buf
,
9754 area
->default_cost
, VTY_NEWLINE
);
9757 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
9760 struct ospf_area_range
*range
= rn1
->info
;
9762 vty_out (vty
, " area %s range %s/%d", buf
,
9763 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
9765 if (range
->cost_config
!= OSPF_AREA_RANGE_COST_UNSPEC
)
9766 vty_out (vty
, " cost %d", range
->cost_config
);
9768 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
9769 vty_out (vty
, " not-advertise");
9771 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
9772 vty_out (vty
, " substitute %s/%d",
9773 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
9775 vty_out (vty
, "%s", VTY_NEWLINE
);
9778 if (EXPORT_NAME (area
))
9779 vty_out (vty
, " area %s export-list %s%s", buf
,
9780 EXPORT_NAME (area
), VTY_NEWLINE
);
9782 if (IMPORT_NAME (area
))
9783 vty_out (vty
, " area %s import-list %s%s", buf
,
9784 IMPORT_NAME (area
), VTY_NEWLINE
);
9786 if (PREFIX_NAME_IN (area
))
9787 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
9788 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
9790 if (PREFIX_NAME_OUT (area
))
9791 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
9792 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
9799 config_write_ospf_nbr_nbma (struct vty
*vty
, struct ospf
*ospf
)
9801 struct ospf_nbr_nbma
*nbr_nbma
;
9802 struct route_node
*rn
;
9804 /* Static Neighbor configuration print. */
9805 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
9806 if ((nbr_nbma
= rn
->info
))
9808 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
9810 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
9811 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
9813 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
9814 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
9816 vty_out (vty
, "%s", VTY_NEWLINE
);
9823 config_write_virtual_link (struct vty
*vty
, struct ospf
*ospf
)
9825 struct listnode
*node
;
9826 struct ospf_vl_data
*vl_data
;
9827 u_char buf
[INET_ADDRSTRLEN
];
9829 /* Virtual-Link print */
9830 for (ALL_LIST_ELEMENTS_RO (ospf
->vlinks
, node
, vl_data
))
9832 struct listnode
*n2
;
9833 struct crypt_key
*ck
;
9834 struct ospf_interface
*oi
;
9836 if (vl_data
!= NULL
)
9838 memset (buf
, 0, INET_ADDRSTRLEN
);
9840 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
9841 strncpy ((char *) buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
9843 sprintf ((char *) buf
, "%lu",
9844 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
9845 oi
= vl_data
->vl_oi
;
9848 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
9849 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
9850 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
9851 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
9852 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
9854 inet_ntoa (vl_data
->vl_peer
),
9855 OSPF_IF_PARAM (oi
, v_hello
),
9856 OSPF_IF_PARAM (oi
, retransmit_interval
),
9857 OSPF_IF_PARAM (oi
, transmit_delay
),
9858 OSPF_IF_PARAM (oi
, v_wait
),
9861 vty_out (vty
, " area %s virtual-link %s%s", buf
,
9862 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
9864 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
9865 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
9867 inet_ntoa (vl_data
->vl_peer
),
9868 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
9871 for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
,
9873 vty_out (vty
, " area %s virtual-link %s"
9874 " message-digest-key %d md5 %s%s",
9876 inet_ntoa (vl_data
->vl_peer
),
9877 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
9887 config_write_ospf_redistribute (struct vty
*vty
, struct ospf
*ospf
)
9891 /* redistribute print. */
9892 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
9894 struct list
*red_list
;
9895 struct listnode
*node
;
9896 struct ospf_redist
*red
;
9898 red_list
= ospf
->redist
[type
];
9902 for (ALL_LIST_ELEMENTS_RO(red_list
, node
, red
))
9904 vty_out (vty
, " redistribute %s", zebra_route_string(type
));
9906 vty_out (vty
, " %d", red
->instance
);
9908 if (red
->dmetric
.value
>= 0)
9909 vty_out (vty
, " metric %d", red
->dmetric
.value
);
9911 if (red
->dmetric
.type
== EXTERNAL_METRIC_TYPE_1
)
9912 vty_out (vty
, " metric-type 1");
9914 if (ROUTEMAP_NAME (red
))
9915 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (red
));
9917 vty_out (vty
, "%s", VTY_NEWLINE
);
9925 config_write_ospf_default_metric (struct vty
*vty
, struct ospf
*ospf
)
9927 if (ospf
->default_metric
!= -1)
9928 vty_out (vty
, " default-metric %d%s", ospf
->default_metric
,
9934 config_write_ospf_distribute (struct vty
*vty
, struct ospf
*ospf
)
9937 struct ospf_redist
*red
;
9941 /* distribute-list print. */
9942 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
9943 if (DISTRIBUTE_NAME (ospf
, type
))
9944 vty_out (vty
, " distribute-list %s out %s%s",
9945 DISTRIBUTE_NAME (ospf
, type
),
9946 zebra_route_string(type
), VTY_NEWLINE
);
9948 /* default-information print. */
9949 if (ospf
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
9951 vty_out (vty
, " default-information originate");
9952 if (ospf
->default_originate
== DEFAULT_ORIGINATE_ALWAYS
)
9953 vty_out (vty
, " always");
9955 red
= ospf_redist_lookup(ospf
, DEFAULT_ROUTE
, 0);
9958 if (red
->dmetric
.value
>= 0)
9959 vty_out (vty
, " metric %d",
9960 red
->dmetric
.value
);
9961 if (red
->dmetric
.type
== EXTERNAL_METRIC_TYPE_1
)
9962 vty_out (vty
, " metric-type 1");
9964 if (ROUTEMAP_NAME (red
))
9965 vty_out (vty
, " route-map %s",
9966 ROUTEMAP_NAME (red
));
9969 vty_out (vty
, "%s", VTY_NEWLINE
);
9978 config_write_ospf_distance (struct vty
*vty
, struct ospf
*ospf
)
9980 struct route_node
*rn
;
9981 struct ospf_distance
*odistance
;
9983 if (ospf
->distance_all
)
9984 vty_out (vty
, " distance %d%s", ospf
->distance_all
, VTY_NEWLINE
);
9986 if (ospf
->distance_intra
9987 || ospf
->distance_inter
9988 || ospf
->distance_external
)
9990 vty_out (vty
, " distance ospf");
9992 if (ospf
->distance_intra
)
9993 vty_out (vty
, " intra-area %d", ospf
->distance_intra
);
9994 if (ospf
->distance_inter
)
9995 vty_out (vty
, " inter-area %d", ospf
->distance_inter
);
9996 if (ospf
->distance_external
)
9997 vty_out (vty
, " external %d", ospf
->distance_external
);
9999 vty_out (vty
, "%s", VTY_NEWLINE
);
10002 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
10003 if ((odistance
= rn
->info
) != NULL
)
10005 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
10006 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
10007 odistance
->access_list
? odistance
->access_list
: "",
10013 /* OSPF configuration write function. */
10015 ospf_config_write (struct vty
*vty
)
10018 struct interface
*ifp
;
10019 struct ospf_interface
*oi
;
10020 struct listnode
*node
;
10023 ospf
= ospf_lookup ();
10024 if (ospf
!= NULL
&& ospf
->oi_running
)
10026 /* `router ospf' print. */
10027 if (ospf
->instance
)
10028 vty_out (vty
, "router ospf %d%s", ospf
->instance
, VTY_NEWLINE
);
10030 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
10034 if (!ospf
->networks
)
10037 /* Router ID print. */
10038 if (ospf
->router_id_static
.s_addr
!= 0)
10039 vty_out (vty
, " ospf router-id %s%s",
10040 inet_ntoa (ospf
->router_id_static
), VTY_NEWLINE
);
10042 /* ABR type print. */
10043 if (ospf
->abr_type
!= OSPF_ABR_DEFAULT
)
10044 vty_out (vty
, " ospf abr-type %s%s",
10045 ospf_abr_type_str
[ospf
->abr_type
], VTY_NEWLINE
);
10047 /* log-adjacency-changes flag print. */
10048 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
))
10050 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
))
10051 vty_out(vty
, " log-adjacency-changes detail%s", VTY_NEWLINE
);
10055 vty_out(vty
, " no log-adjacency-changes%s", VTY_NEWLINE
);
10058 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
10059 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
10060 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
10062 /* auto-cost reference-bandwidth configuration. */
10063 if (ospf
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
10065 vty_out (vty
, "! Important: ensure reference bandwidth "
10066 "is consistent across all routers%s", VTY_NEWLINE
);
10067 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
10068 ospf
->ref_bandwidth
, VTY_NEWLINE
);
10071 /* SPF timers print. */
10072 if (ospf
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
10073 ospf
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
||
10074 ospf
->spf_max_holdtime
!= OSPF_SPF_MAX_HOLDTIME_DEFAULT
)
10075 vty_out (vty
, " timers throttle spf %d %d %d%s",
10076 ospf
->spf_delay
, ospf
->spf_holdtime
,
10077 ospf
->spf_max_holdtime
, VTY_NEWLINE
);
10079 /* LSA timers print. */
10080 if (ospf
->min_ls_interval
!= OSPF_MIN_LS_INTERVAL
)
10081 vty_out (vty
, " timers throttle lsa all %d%s",
10082 ospf
->min_ls_interval
, VTY_NEWLINE
);
10083 if (ospf
->min_ls_arrival
!= OSPF_MIN_LS_ARRIVAL
)
10084 vty_out (vty
, " timers lsa min-arrival %d%s",
10085 ospf
->min_ls_arrival
, VTY_NEWLINE
);
10087 /* Write multiplier print. */
10088 if (ospf
->write_oi_count
!= OSPF_WRITE_INTERFACE_COUNT_DEFAULT
)
10089 vty_out (vty
, " ospf write-multiplier %d%s",
10090 ospf
->write_oi_count
, VTY_NEWLINE
);
10092 /* Max-metric router-lsa print */
10093 config_write_stub_router (vty
, ospf
);
10095 /* SPF refresh parameters print. */
10096 if (ospf
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
10097 vty_out (vty
, " refresh timer %d%s",
10098 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
10100 /* Redistribute information print. */
10101 config_write_ospf_redistribute (vty
, ospf
);
10103 /* passive-interface print. */
10104 if (ospf
->passive_interface_default
== OSPF_IF_PASSIVE
)
10105 vty_out (vty
, " passive-interface default%s", VTY_NEWLINE
);
10107 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
10108 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
)
10109 && IF_DEF_PARAMS (ifp
)->passive_interface
!=
10110 ospf
->passive_interface_default
)
10112 vty_out (vty
, " %spassive-interface %s%s",
10113 IF_DEF_PARAMS (ifp
)->passive_interface
? "" : "no ",
10114 ifp
->name
, VTY_NEWLINE
);
10116 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
10118 if (!OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
))
10120 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi
->ifp
),
10121 passive_interface
))
10123 if (oi
->params
->passive_interface
== IF_DEF_PARAMS (oi
->ifp
)->passive_interface
)
10126 else if (oi
->params
->passive_interface
== ospf
->passive_interface_default
)
10129 vty_out (vty
, " %spassive-interface %s %s%s",
10130 oi
->params
->passive_interface
? "" : "no ",
10132 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
10135 /* Network area print. */
10136 config_write_network_area (vty
, ospf
);
10138 /* Area config print. */
10139 config_write_ospf_area (vty
, ospf
);
10141 /* static neighbor print. */
10142 config_write_ospf_nbr_nbma (vty
, ospf
);
10144 /* Virtual-Link print. */
10145 config_write_virtual_link (vty
, ospf
);
10147 /* Default metric configuration. */
10148 config_write_ospf_default_metric (vty
, ospf
);
10150 /* Distribute-list and default-information print. */
10151 config_write_ospf_distribute (vty
, ospf
);
10153 /* Distance configuration. */
10154 config_write_ospf_distance (vty
, ospf
);
10156 ospf_opaque_config_write_router (vty
, ospf
);
10163 ospf_vty_show_init (void)
10165 /* "show ip ospf" commands. */
10166 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
10167 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
10169 install_element (VIEW_NODE
, &show_ip_ospf_instance_cmd
);
10170 install_element (ENABLE_NODE
, &show_ip_ospf_instance_cmd
);
10172 /* "show ip ospf database" commands. */
10173 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
10174 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
10175 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
10176 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
10178 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_type_adv_router_cmd
);
10179 install_element (VIEW_NODE
, &show_ip_ospf_instance_database_cmd
);
10180 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_type_adv_router_cmd
);
10181 install_element (ENABLE_NODE
, &show_ip_ospf_instance_database_cmd
);
10183 /* "show ip ospf interface" commands. */
10184 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
10185 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
10187 install_element (VIEW_NODE
, &show_ip_ospf_instance_interface_cmd
);
10188 install_element (ENABLE_NODE
, &show_ip_ospf_instance_interface_cmd
);
10190 /* "show ip ospf neighbor" commands. */
10191 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
10192 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
10193 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
10194 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
10195 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
10196 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
10197 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
10198 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
10199 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
10200 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
10201 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
10202 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
10203 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
10204 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
10206 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_int_detail_cmd
);
10207 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_int_cmd
);
10208 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_id_cmd
);
10209 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_detail_all_cmd
);
10210 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_detail_cmd
);
10211 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_cmd
);
10212 install_element (VIEW_NODE
, &show_ip_ospf_instance_neighbor_all_cmd
);
10213 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_int_detail_cmd
);
10214 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_int_cmd
);
10215 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_id_cmd
);
10216 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_detail_all_cmd
);
10217 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_detail_cmd
);
10218 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_cmd
);
10219 install_element (ENABLE_NODE
, &show_ip_ospf_instance_neighbor_all_cmd
);
10221 /* "show ip ospf route" commands. */
10222 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
10223 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
10224 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
10225 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
10227 install_element (VIEW_NODE
, &show_ip_ospf_instance_route_cmd
);
10228 install_element (ENABLE_NODE
, &show_ip_ospf_instance_route_cmd
);
10229 install_element (VIEW_NODE
, &show_ip_ospf_instance_border_routers_cmd
);
10230 install_element (ENABLE_NODE
, &show_ip_ospf_instance_border_routers_cmd
);
10234 /* ospfd's interface node. */
10235 static struct cmd_node interface_node
=
10242 /* Initialization of OSPF interface. */
10244 ospf_vty_if_init (void)
10246 /* Install interface node. */
10247 install_node (&interface_node
, config_write_interface
);
10249 install_element (CONFIG_NODE
, &interface_cmd
);
10250 install_element (CONFIG_NODE
, &no_interface_cmd
);
10251 install_default (INTERFACE_NODE
);
10253 /* "description" commands. */
10254 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
10255 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
10257 /* "ip ospf authentication" commands. */
10258 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
10259 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
10260 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_args_addr_cmd
);
10261 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
10262 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
10263 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_authkey_addr_cmd
);
10265 /* "ip ospf message-digest-key" commands. */
10266 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
10267 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
10268 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_md5_addr_cmd
);
10270 /* "ip ospf cost" commands. */
10271 install_element (INTERFACE_NODE
, &ip_ospf_cost_u32_inet4_cmd
);
10272 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_u32_cmd
);
10273 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_inet4_cmd
);
10275 /* "ip ospf mtu-ignore" commands. */
10276 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_addr_cmd
);
10277 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_addr_cmd
);
10279 /* "ip ospf dead-interval" commands. */
10280 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
10281 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_addr_cmd
);
10282 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
10284 /* "ip ospf hello-interval" commands. */
10285 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
10286 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
10288 /* "ip ospf network" commands. */
10289 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
10290 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
10292 /* "ip ospf priority" commands. */
10293 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
10294 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
10296 /* "ip ospf retransmit-interval" commands. */
10297 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
10298 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
10299 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_sec_cmd
);
10301 /* "ip ospf transmit-delay" commands. */
10302 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
10303 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
10304 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_sec_cmd
);
10306 /* "ip ospf area" commands. */
10307 install_element (INTERFACE_NODE
, &ip_ospf_area_cmd
);
10308 install_element (INTERFACE_NODE
, &no_ip_ospf_area_cmd
);
10309 install_element (INTERFACE_NODE
, &no_ip_ospf_instance_area_cmd
);
10311 /* These commands are compatibitliy for previous version. */
10312 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
10313 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
10314 install_element (INTERFACE_NODE
, &ospf_cost_u32_cmd
);
10315 install_element (INTERFACE_NODE
, &ospf_cost_u32_inet4_cmd
);
10316 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
10317 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
10318 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
10319 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
10320 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
10321 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
10325 ospf_vty_zebra_init (void)
10327 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
10328 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
10329 install_element (OSPF_NODE
, &ospf_redistribute_instance_source_cmd
);
10330 install_element (OSPF_NODE
, &no_ospf_redistribute_instance_source_cmd
);
10332 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
10333 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
10335 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
10336 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
10338 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
10339 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
10341 install_element (OSPF_NODE
, &ospf_distance_cmd
);
10342 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
10343 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
10344 install_element (OSPF_NODE
, &ospf_distance_ospf_cmd
);
10346 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
10347 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
10348 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
10349 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
10353 static struct cmd_node ospf_node
=
10356 "%s(config-router)# ",
10361 ospf_interface_clear (struct interface
*ifp
)
10363 if (!if_is_operative (ifp
)) return;
10365 if (IS_DEBUG_OSPF (ism
, ISM_EVENTS
))
10366 zlog (NULL
, LOG_DEBUG
, "ISM[%s]: clear by reset", ifp
->name
);
10368 ospf_if_reset(ifp
);
10371 DEFUN (clear_ip_ospf_interface
,
10372 clear_ip_ospf_interface_cmd
,
10373 "clear ip ospf interface [IFNAME]",
10376 "OSPF information\n"
10377 "Interface information\n"
10378 "Interface name\n")
10380 int idx_ifname
= 4;
10381 struct interface
*ifp
;
10382 struct listnode
*node
;
10384 if (argc
== 0) /* Clear all the ospfv2 interfaces. */
10386 for (ALL_LIST_ELEMENTS_RO (vrf_iflist (VRF_DEFAULT
), node
, ifp
))
10387 ospf_interface_clear(ifp
);
10389 else /* Interface name is specified. */
10391 if ((ifp
= if_lookup_by_name (argv
[idx_ifname
]->arg
)) == NULL
)
10392 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
10394 ospf_interface_clear(ifp
);
10397 return CMD_SUCCESS
;
10401 ospf_vty_clear_init (void)
10403 install_element (ENABLE_NODE
, &clear_ip_ospf_interface_cmd
);
10407 /* Install OSPF related vty commands. */
10409 ospf_vty_init (void)
10411 /* Install ospf top node. */
10412 install_node (&ospf_node
, ospf_config_write
);
10414 /* "router ospf" commands. */
10415 install_element (CONFIG_NODE
, &router_ospf_cmd
);
10416 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
10419 install_default (OSPF_NODE
);
10421 /* "ospf router-id" commands. */
10422 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
10423 install_element (OSPF_NODE
, &ospf_router_id_old_cmd
);
10424 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
10426 /* "passive-interface" commands. */
10427 install_element (OSPF_NODE
, &ospf_passive_interface_addr_cmd
);
10428 install_element (OSPF_NODE
, &no_ospf_passive_interface_addr_cmd
);
10430 /* "ospf abr-type" commands. */
10431 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
10432 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
10434 /* "ospf log-adjacency-changes" commands. */
10435 install_element (OSPF_NODE
, &ospf_log_adjacency_changes_cmd
);
10436 install_element (OSPF_NODE
, &ospf_log_adjacency_changes_detail_cmd
);
10437 install_element (OSPF_NODE
, &no_ospf_log_adjacency_changes_cmd
);
10438 install_element (OSPF_NODE
, &no_ospf_log_adjacency_changes_detail_cmd
);
10440 /* "ospf rfc1583-compatible" commands. */
10441 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
10442 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
10444 /* "network area" commands. */
10445 install_element (OSPF_NODE
, &ospf_network_area_cmd
);
10446 install_element (OSPF_NODE
, &no_ospf_network_area_cmd
);
10448 /* "area authentication" commands. */
10449 install_element (OSPF_NODE
, &ospf_area_authentication_message_digest_cmd
);
10450 install_element (OSPF_NODE
, &ospf_area_authentication_cmd
);
10451 install_element (OSPF_NODE
, &no_ospf_area_authentication_cmd
);
10453 /* "area range" commands. */
10454 install_element (OSPF_NODE
, &ospf_area_range_cmd
);
10455 install_element (OSPF_NODE
, &ospf_area_range_not_advertise_cmd
);
10456 install_element (OSPF_NODE
, &no_ospf_area_range_cmd
);
10457 install_element (OSPF_NODE
, &ospf_area_range_substitute_cmd
);
10458 install_element (OSPF_NODE
, &no_ospf_area_range_substitute_cmd
);
10460 /* "area virtual-link" commands. */
10461 install_element (OSPF_NODE
, &ospf_area_vlink_cmd
);
10462 install_element (OSPF_NODE
, &no_ospf_area_vlink_cmd
);
10473 /* "area stub" commands. */
10474 install_element (OSPF_NODE
, &ospf_area_stub_no_summary_cmd
);
10475 install_element (OSPF_NODE
, &ospf_area_stub_cmd
);
10476 install_element (OSPF_NODE
, &no_ospf_area_stub_no_summary_cmd
);
10477 install_element (OSPF_NODE
, &no_ospf_area_stub_cmd
);
10479 /* "area nssa" commands. */
10480 install_element (OSPF_NODE
, &ospf_area_nssa_cmd
);
10481 install_element (OSPF_NODE
, &ospf_area_nssa_translate_no_summary_cmd
);
10482 install_element (OSPF_NODE
, &ospf_area_nssa_translate_cmd
);
10483 install_element (OSPF_NODE
, &ospf_area_nssa_no_summary_cmd
);
10484 install_element (OSPF_NODE
, &no_ospf_area_nssa_cmd
);
10486 install_element (OSPF_NODE
, &ospf_area_default_cost_cmd
);
10487 install_element (OSPF_NODE
, &no_ospf_area_default_cost_cmd
);
10489 install_element (OSPF_NODE
, &ospf_area_shortcut_cmd
);
10490 install_element (OSPF_NODE
, &no_ospf_area_shortcut_cmd
);
10492 install_element (OSPF_NODE
, &ospf_area_export_list_cmd
);
10493 install_element (OSPF_NODE
, &no_ospf_area_export_list_cmd
);
10495 install_element (OSPF_NODE
, &ospf_area_filter_list_cmd
);
10496 install_element (OSPF_NODE
, &no_ospf_area_filter_list_cmd
);
10498 install_element (OSPF_NODE
, &ospf_area_import_list_cmd
);
10499 install_element (OSPF_NODE
, &no_ospf_area_import_list_cmd
);
10501 /* SPF timer commands */
10502 install_element (OSPF_NODE
, &ospf_timers_throttle_spf_cmd
);
10503 install_element (OSPF_NODE
, &no_ospf_timers_throttle_spf_cmd
);
10505 /* LSA timers commands */
10506 install_element (OSPF_NODE
, &ospf_timers_min_ls_interval_cmd
);
10507 install_element (OSPF_NODE
, &no_ospf_timers_min_ls_interval_cmd
);
10508 install_element (OSPF_NODE
, &ospf_timers_min_ls_arrival_cmd
);
10509 install_element (OSPF_NODE
, &no_ospf_timers_min_ls_arrival_cmd
);
10510 install_element (OSPF_NODE
, &ospf_timers_lsa_cmd
);
10511 install_element (OSPF_NODE
, &no_ospf_timers_lsa_cmd
);
10513 /* refresh timer commands */
10514 install_element (OSPF_NODE
, &ospf_refresh_timer_cmd
);
10515 install_element (OSPF_NODE
, &no_ospf_refresh_timer_val_cmd
);
10517 /* max-metric commands */
10518 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_admin_cmd
);
10519 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_admin_cmd
);
10520 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_startup_cmd
);
10521 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_startup_cmd
);
10522 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_shutdown_cmd
);
10523 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_shutdown_cmd
);
10525 /* reference bandwidth commands */
10526 install_element (OSPF_NODE
, &ospf_auto_cost_reference_bandwidth_cmd
);
10527 install_element (OSPF_NODE
, &no_ospf_auto_cost_reference_bandwidth_cmd
);
10529 /* "neighbor" commands. */
10530 install_element (OSPF_NODE
, &ospf_neighbor_cmd
);
10531 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_cmd
);
10532 install_element (OSPF_NODE
, &no_ospf_neighbor_cmd
);
10534 /* write multiplier commands */
10535 install_element (OSPF_NODE
, &ospf_write_multiplier_cmd
);
10536 install_element (OSPF_NODE
, &no_ospf_write_multiplier_cmd
);
10538 /* Init interface related vty commands. */
10539 ospf_vty_if_init ();
10541 /* Init zebra related vty commands. */
10542 ospf_vty_zebra_init ();