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
35 #include "ospfd/ospfd.h"
36 #include "ospfd/ospf_asbr.h"
37 #include "ospfd/ospf_lsa.h"
38 #include "ospfd/ospf_lsdb.h"
39 #include "ospfd/ospf_ism.h"
40 #include "ospfd/ospf_interface.h"
41 #include "ospfd/ospf_nsm.h"
42 #include "ospfd/ospf_neighbor.h"
43 #include "ospfd/ospf_flood.h"
44 #include "ospfd/ospf_abr.h"
45 #include "ospfd/ospf_spf.h"
46 #include "ospfd/ospf_route.h"
47 #include "ospfd/ospf_zebra.h"
48 /*#include "ospfd/ospf_routemap.h" */
49 #include "ospfd/ospf_vty.h"
50 #include "ospfd/ospf_dump.h"
53 static const char *ospf_network_type_str
[] =
65 /* Utility functions. */
67 ospf_str2area_id (const char *str
, struct in_addr
*area_id
, int *format
)
72 /* match "A.B.C.D". */
73 if (strchr (str
, '.') != NULL
)
75 ret
= inet_aton (str
, area_id
);
78 *format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
80 /* match "<0-4294967295>". */
83 ret
= strtoul (str
, &endptr
, 10);
84 if (*endptr
!= '\0' || (ret
== ULONG_MAX
&& errno
== ERANGE
))
87 area_id
->s_addr
= htonl (ret
);
88 *format
= OSPF_AREA_ID_FORMAT_DECIMAL
;
96 str2metric (const char *str
, int *metric
)
102 *metric
= strtol (str
, NULL
, 10);
103 if (*metric
< 0 && *metric
> 16777214)
105 /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
113 str2metric_type (const char *str
, int *metric_type
)
119 if (strncmp (str
, "1", 1) == 0)
120 *metric_type
= EXTERNAL_METRIC_TYPE_1
;
121 else if (strncmp (str
, "2", 1) == 0)
122 *metric_type
= EXTERNAL_METRIC_TYPE_2
;
130 ospf_oi_count (struct interface
*ifp
)
132 struct route_node
*rn
;
135 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
146 "Enable a routing process\n"
147 "Start OSPF configuration\n")
149 vty
->node
= OSPF_NODE
;
150 vty
->index
= ospf_get ();
155 DEFUN (no_router_ospf
,
159 "Enable a routing process\n"
160 "Start OSPF configuration\n")
164 ospf
= ospf_lookup ();
167 vty_out (vty
, "There isn't active ospf instance%s", VTY_NEWLINE
);
176 DEFUN (ospf_router_id
,
178 "ospf router-id A.B.C.D",
179 "OSPF specific commands\n"
180 "router-id for the OSPF process\n"
181 "OSPF router-id in IP address format\n")
183 struct ospf
*ospf
= vty
->index
;
184 struct in_addr router_id
;
187 ret
= inet_aton (argv
[0], &router_id
);
190 vty_out (vty
, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE
);
194 ospf
->router_id_static
= router_id
;
196 ospf_router_id_update (ospf
);
201 ALIAS (ospf_router_id
,
204 "router-id for the OSPF process\n"
205 "OSPF router-id in IP address format\n")
207 DEFUN (no_ospf_router_id
,
208 no_ospf_router_id_cmd
,
211 "OSPF specific commands\n"
212 "router-id for the OSPF process\n")
214 struct ospf
*ospf
= vty
->index
;
216 ospf
->router_id_static
.s_addr
= 0;
218 ospf_router_id_update (ospf
);
223 ALIAS (no_ospf_router_id
,
224 no_router_ospf_id_cmd
,
227 "router-id for the OSPF process\n")
230 ospf_passive_interface_default (struct ospf
*ospf
, u_char newval
)
233 struct interface
*ifp
;
234 struct ospf_interface
*oi
;
236 ospf
->passive_interface_default
= newval
;
238 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, ln
, ifp
))
241 OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
))
242 UNSET_IF_PARAM (IF_DEF_PARAMS (ifp
), passive_interface
);
244 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, ln
, oi
))
246 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
))
247 UNSET_IF_PARAM (oi
->params
, passive_interface
);
248 /* update multicast memberships */
249 ospf_if_set_multicast(oi
);
254 ospf_passive_interface_update (struct ospf
*ospf
, struct interface
*ifp
,
256 struct ospf_if_params
*params
, u_char value
)
260 params
->passive_interface
= value
;
261 if (params
!= IF_DEF_PARAMS (ifp
))
263 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
))
264 dflt
= IF_DEF_PARAMS (ifp
)->passive_interface
;
266 dflt
= ospf
->passive_interface_default
;
269 SET_IF_PARAM (params
, passive_interface
);
271 UNSET_IF_PARAM (params
, passive_interface
);
273 ospf_free_if_params (ifp
, addr
);
274 ospf_if_update_params (ifp
, addr
);
278 if (value
!= ospf
->passive_interface_default
)
279 SET_IF_PARAM (params
, passive_interface
);
281 UNSET_IF_PARAM (params
, passive_interface
);
285 DEFUN (ospf_passive_interface
,
286 ospf_passive_interface_addr_cmd
,
287 "passive-interface IFNAME A.B.C.D",
288 "Suppress routing updates on an interface\n"
289 "Interface's name\n")
291 struct interface
*ifp
;
294 struct ospf_if_params
*params
;
295 struct route_node
*rn
;
296 struct ospf
*ospf
= vty
->index
;
300 ospf_passive_interface_default (ospf
, OSPF_IF_PASSIVE
);
304 ifp
= if_get_by_name (argv
[0]);
306 params
= IF_DEF_PARAMS (ifp
);
310 ret
= inet_aton(argv
[1], &addr
);
313 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
318 params
= ospf_get_if_params (ifp
, addr
);
319 ospf_if_update_params (ifp
, addr
);
321 ospf_passive_interface_update (ospf
, ifp
, addr
, params
, OSPF_IF_PASSIVE
);
323 /* XXX We should call ospf_if_set_multicast on exactly those
324 * interfaces for which the passive property changed. It is too much
325 * work to determine this set, so we do this for every interface.
326 * This is safe and reasonable because ospf_if_set_multicast uses a
327 * record of joined groups to avoid systems calls if the desired
328 * memberships match the current memership.
331 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
333 struct ospf_interface
*oi
= rn
->info
;
335 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_PASSIVE
))
336 ospf_if_set_multicast(oi
);
339 * XXX It is not clear what state transitions the interface needs to
340 * undergo when going from active to passive. Fixing this will
341 * require precise identification of interfaces having such a
348 ALIAS (ospf_passive_interface
,
349 ospf_passive_interface_cmd
,
350 "passive-interface IFNAME",
351 "Suppress routing updates on an interface\n"
352 "Interface's name\n")
354 ALIAS (ospf_passive_interface
,
355 ospf_passive_interface_default_cmd
,
356 "passive-interface default",
357 "Suppress routing updates on an interface\n"
358 "Suppress routing updates on interfaces by default\n")
360 DEFUN (no_ospf_passive_interface
,
361 no_ospf_passive_interface_addr_cmd
,
362 "no passive-interface IFNAME A.B.C.D",
364 "Allow routing updates on an interface\n"
365 "Interface's name\n")
367 struct interface
*ifp
;
369 struct ospf_if_params
*params
;
371 struct route_node
*rn
;
372 struct ospf
*ospf
= vty
->index
;
376 ospf_passive_interface_default (ospf
, OSPF_IF_ACTIVE
);
380 ifp
= if_get_by_name (argv
[0]);
382 params
= IF_DEF_PARAMS (ifp
);
386 ret
= inet_aton(argv
[1], &addr
);
389 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
394 params
= ospf_lookup_if_params (ifp
, addr
);
398 ospf_passive_interface_update (ospf
, ifp
, addr
, params
, OSPF_IF_ACTIVE
);
400 /* XXX We should call ospf_if_set_multicast on exactly those
401 * interfaces for which the passive property changed. It is too much
402 * work to determine this set, so we do this for every interface.
403 * This is safe and reasonable because ospf_if_set_multicast uses a
404 * record of joined groups to avoid systems calls if the desired
405 * memberships match the current memership.
407 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
409 struct ospf_interface
*oi
= rn
->info
;
411 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_ACTIVE
))
412 ospf_if_set_multicast(oi
);
418 ALIAS (no_ospf_passive_interface
,
419 no_ospf_passive_interface_cmd
,
420 "no passive-interface IFNAME",
422 "Allow routing updates on an interface\n"
423 "Interface's name\n")
425 ALIAS (no_ospf_passive_interface
,
426 no_ospf_passive_interface_default_cmd
,
427 "no passive-interface default",
429 "Allow routing updates on an interface\n"
430 "Allow routing updates on interfaces by default\n")
432 DEFUN (ospf_network_area
,
433 ospf_network_area_cmd
,
434 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
435 "Enable routing on an IP network\n"
436 "OSPF network prefix\n"
437 "Set the OSPF area ID\n"
438 "OSPF area ID in IP address format\n"
439 "OSPF area ID as a decimal value\n")
441 struct ospf
*ospf
= vty
->index
;
442 struct prefix_ipv4 p
;
443 struct in_addr area_id
;
446 /* Get network prefix and Area ID. */
447 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
448 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
450 ret
= ospf_network_set (ospf
, &p
, area_id
);
453 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
460 DEFUN (no_ospf_network_area
,
461 no_ospf_network_area_cmd
,
462 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
464 "Enable routing on an IP network\n"
465 "OSPF network prefix\n"
466 "Set the OSPF area ID\n"
467 "OSPF area ID in IP address format\n"
468 "OSPF area ID as a decimal value\n")
470 struct ospf
*ospf
= (struct ospf
*) vty
->index
;
471 struct prefix_ipv4 p
;
472 struct in_addr area_id
;
475 /* Get network prefix and Area ID. */
476 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
477 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
479 ret
= ospf_network_unset (ospf
, &p
, area_id
);
482 vty_out (vty
, "Can't find specified network area configuration.%s",
491 DEFUN (ospf_area_range
,
493 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
494 "OSPF area parameters\n"
495 "OSPF area ID in IP address format\n"
496 "OSPF area ID as a decimal value\n"
497 "Summarize routes matching address/mask (border routers only)\n"
498 "Area range prefix\n")
500 struct ospf
*ospf
= vty
->index
;
501 struct prefix_ipv4 p
;
502 struct in_addr area_id
;
506 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
507 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
509 ospf_area_range_set (ospf
, area_id
, &p
, OSPF_AREA_RANGE_ADVERTISE
);
512 VTY_GET_INTEGER ("range cost", cost
, argv
[2]);
513 ospf_area_range_cost_set (ospf
, area_id
, &p
, cost
);
519 ALIAS (ospf_area_range
,
520 ospf_area_range_advertise_cmd
,
521 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
522 "OSPF area parameters\n"
523 "OSPF area ID in IP address format\n"
524 "OSPF area ID as a decimal value\n"
525 "OSPF area range for route advertise (default)\n"
526 "Area range prefix\n"
527 "Advertise this range (default)\n")
529 ALIAS (ospf_area_range
,
530 ospf_area_range_cost_cmd
,
531 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
532 "OSPF area parameters\n"
533 "OSPF area ID in IP address format\n"
534 "OSPF area ID as a decimal value\n"
535 "Summarize routes matching address/mask (border routers only)\n"
536 "Area range prefix\n"
537 "User specified metric for this range\n"
538 "Advertised metric for this range\n")
540 ALIAS (ospf_area_range
,
541 ospf_area_range_advertise_cost_cmd
,
542 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
543 "OSPF area parameters\n"
544 "OSPF area ID in IP address format\n"
545 "OSPF area ID as a decimal value\n"
546 "Summarize routes matching address/mask (border routers only)\n"
547 "Area range prefix\n"
548 "Advertise this range (default)\n"
549 "User specified metric for this range\n"
550 "Advertised metric for this range\n")
552 DEFUN (ospf_area_range_not_advertise
,
553 ospf_area_range_not_advertise_cmd
,
554 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
555 "OSPF area parameters\n"
556 "OSPF area ID in IP address format\n"
557 "OSPF area ID as a decimal value\n"
558 "Summarize routes matching address/mask (border routers only)\n"
559 "Area range prefix\n"
560 "DoNotAdvertise this range\n")
562 struct ospf
*ospf
= vty
->index
;
563 struct prefix_ipv4 p
;
564 struct in_addr area_id
;
567 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
568 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
570 ospf_area_range_set (ospf
, area_id
, &p
, 0);
575 DEFUN (no_ospf_area_range
,
576 no_ospf_area_range_cmd
,
577 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
579 "OSPF area parameters\n"
580 "OSPF area ID in IP address format\n"
581 "OSPF area ID as a decimal value\n"
582 "Summarize routes matching address/mask (border routers only)\n"
583 "Area range prefix\n")
585 struct ospf
*ospf
= vty
->index
;
586 struct prefix_ipv4 p
;
587 struct in_addr area_id
;
590 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
591 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
593 ospf_area_range_unset (ospf
, area_id
, &p
);
598 ALIAS (no_ospf_area_range
,
599 no_ospf_area_range_advertise_cmd
,
600 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
602 "OSPF area parameters\n"
603 "OSPF area ID in IP address format\n"
604 "OSPF area ID as a decimal value\n"
605 "Summarize routes matching address/mask (border routers only)\n"
606 "Area range prefix\n"
607 "Advertise this range (default)\n"
608 "DoNotAdvertise this range\n")
610 ALIAS (no_ospf_area_range
,
611 no_ospf_area_range_cost_cmd
,
612 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
614 "OSPF area parameters\n"
615 "OSPF area ID in IP address format\n"
616 "OSPF area ID as a decimal value\n"
617 "Summarize routes matching address/mask (border routers only)\n"
618 "Area range prefix\n"
619 "User specified metric for this range\n"
620 "Advertised metric for this range\n")
622 ALIAS (no_ospf_area_range
,
623 no_ospf_area_range_advertise_cost_cmd
,
624 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
626 "OSPF area parameters\n"
627 "OSPF area ID in IP address format\n"
628 "OSPF area ID as a decimal value\n"
629 "Summarize routes matching address/mask (border routers only)\n"
630 "Area range prefix\n"
631 "Advertise this range (default)\n"
632 "User specified metric for this range\n"
633 "Advertised metric for this range\n")
635 DEFUN (ospf_area_range_substitute
,
636 ospf_area_range_substitute_cmd
,
637 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
638 "OSPF area parameters\n"
639 "OSPF area ID in IP address format\n"
640 "OSPF area ID as a decimal value\n"
641 "Summarize routes matching address/mask (border routers only)\n"
642 "Area range prefix\n"
643 "Announce area range as another prefix\n"
644 "Network prefix to be announced instead of range\n")
646 struct ospf
*ospf
= vty
->index
;
647 struct prefix_ipv4 p
, s
;
648 struct in_addr area_id
;
651 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
652 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
653 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
655 ospf_area_range_substitute_set (ospf
, area_id
, &p
, &s
);
660 DEFUN (no_ospf_area_range_substitute
,
661 no_ospf_area_range_substitute_cmd
,
662 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
664 "OSPF area parameters\n"
665 "OSPF area ID in IP address format\n"
666 "OSPF area ID as a decimal value\n"
667 "Summarize routes matching address/mask (border routers only)\n"
668 "Area range prefix\n"
669 "Announce area range as another prefix\n"
670 "Network prefix to be announced instead of range\n")
672 struct ospf
*ospf
= vty
->index
;
673 struct prefix_ipv4 p
, s
;
674 struct in_addr area_id
;
677 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
678 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
679 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
681 ospf_area_range_substitute_unset (ospf
, area_id
, &p
);
687 /* Command Handler Logic in VLink stuff is delicate!!
689 ALTER AT YOUR OWN RISK!!!!
691 Various dummy values are used to represent 'NoChange' state for
692 VLink configuration NOT being changed by a VLink command, and
693 special syntax is used within the command strings so that the
694 typed in command verbs can be seen in the configuration command
695 bacckend handler. This is to drastically reduce the verbeage
696 required to coe up with a reasonably compatible Cisco VLink command
698 - Matthew Grant <grantma@anathoth.gen.nz>
699 Wed, 21 Feb 2001 15:13:52 +1300
703 /* Configuration data for virtual links
705 struct ospf_vl_config_data
{
706 struct vty
*vty
; /* vty stuff */
707 struct in_addr area_id
; /* area ID from command line */
708 int format
; /* command line area ID format */
709 struct in_addr vl_peer
; /* command line vl_peer */
710 int auth_type
; /* Authehntication type, if given */
711 char *auth_key
; /* simple password if present */
712 int crypto_key_id
; /* Cryptographic key ID */
713 char *md5_key
; /* MD5 authentication key */
714 int hello_interval
; /* Obvious what these are... */
715 int retransmit_interval
;
721 ospf_vl_config_data_init (struct ospf_vl_config_data
*vl_config
,
724 memset (vl_config
, 0, sizeof (struct ospf_vl_config_data
));
725 vl_config
->auth_type
= OSPF_AUTH_CMD_NOTSEEN
;
726 vl_config
->vty
= vty
;
729 static struct ospf_vl_data
*
730 ospf_find_vl_data (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
732 struct ospf_area
*area
;
733 struct ospf_vl_data
*vl_data
;
735 struct in_addr area_id
;
737 vty
= vl_config
->vty
;
738 area_id
= vl_config
->area_id
;
740 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
743 "Configuring VLs over the backbone is not allowed%s",
747 area
= ospf_area_get (ospf
, area_id
, vl_config
->format
);
749 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
751 if (vl_config
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
752 vty_out (vty
, "Area %s is %s%s",
754 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
757 vty_out (vty
, "Area %ld is %s%s",
758 (u_long
)ntohl (area_id
.s_addr
),
759 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
764 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
->vl_peer
)) == NULL
)
766 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
767 if (vl_data
->vl_oi
== NULL
)
769 vl_data
->vl_oi
= ospf_vl_new (ospf
, vl_data
);
770 ospf_vl_add (ospf
, vl_data
);
771 ospf_spf_calculate_schedule (ospf
);
779 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
780 struct ospf_vl_config_data
*vl_config
)
782 struct crypt_key
*ck
;
784 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
786 vty
= vl_config
->vty
;
788 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
790 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
791 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
794 if (vl_config
->auth_key
)
796 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
797 strncpy ((char *) IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
798 OSPF_AUTH_SIMPLE_SIZE
);
800 else if (vl_config
->md5_key
)
802 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
805 vty_out (vty
, "OSPF: Key %d already exists%s",
806 vl_config
->crypto_key_id
, VTY_NEWLINE
);
809 ck
= ospf_crypt_key_new ();
810 ck
->key_id
= vl_config
->crypto_key_id
;
811 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
812 strncpy ((char *) ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
814 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
816 else if (vl_config
->crypto_key_id
!= 0)
820 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
821 vl_config
->crypto_key_id
) == NULL
)
823 vty_out (vty
, "OSPF: Key %d does not exist%s",
824 vl_config
->crypto_key_id
, VTY_NEWLINE
);
828 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
836 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
837 struct ospf_vl_config_data
*vl_config
)
839 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
840 /* Virtual Link data initialised to defaults, so only set
842 if (vl_config
->hello_interval
)
844 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
845 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
848 if (vl_config
->dead_interval
)
850 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
851 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
854 if (vl_config
->retransmit_interval
)
856 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
857 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
860 if (vl_config
->transmit_delay
)
862 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
863 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
871 /* The business end of all of the above */
873 ospf_vl_set (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
875 struct ospf_vl_data
*vl_data
;
878 vl_data
= ospf_find_vl_data (ospf
, vl_config
);
882 /* Process this one first as it can have a fatal result, which can
883 only logically occur if the virtual link exists already
884 Thus a command error does not result in a change to the
885 running configuration such as unexpectedly altered timer
887 ret
= ospf_vl_set_security (vl_data
, vl_config
);
888 if (ret
!= CMD_SUCCESS
)
891 /* Set any time based parameters, these area already range checked */
893 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
894 if (ret
!= CMD_SUCCESS
)
901 /* This stuff exists to make specifying all the alias commands A LOT simpler
903 #define VLINK_HELPSTR_IPADDR \
904 "OSPF area parameters\n" \
905 "OSPF area ID in IP address format\n" \
906 "OSPF area ID as a decimal value\n" \
907 "Configure a virtual link\n" \
908 "Router ID of the remote ABR\n"
910 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
911 "Enable authentication on this virtual link\n" \
914 #define VLINK_HELPSTR_AUTHTYPE_ALL \
915 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
916 "Use null authentication\n" \
917 "Use message-digest authentication\n"
919 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
920 "Time between HELLO packets\n" \
921 "Time between retransmitting lost link state advertisements\n" \
922 "Link state transmit delay\n" \
923 "Interval after which a neighbor is declared dead\n"
925 #define VLINK_HELPSTR_TIME_PARAM \
926 VLINK_HELPSTR_TIME_PARAM_NOSECS \
929 #define VLINK_HELPSTR_AUTH_SIMPLE \
930 "Authentication password (key)\n" \
931 "The OSPF password (key)"
933 #define VLINK_HELPSTR_AUTH_MD5 \
934 "Message digest authentication password (key)\n" \
937 "Use MD5 algorithm\n" \
938 "The OSPF password (key)"
940 DEFUN (ospf_area_vlink
,
942 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
943 VLINK_HELPSTR_IPADDR
)
945 struct ospf
*ospf
= vty
->index
;
946 struct ospf_vl_config_data vl_config
;
947 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
948 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
952 ospf_vl_config_data_init(&vl_config
, vty
);
954 /* Read off first 2 parameters and check them */
955 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &vl_config
.format
);
958 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
962 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
965 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
972 /* Thats all folks! - BUGS B. strikes again!!!*/
974 return ospf_vl_set (ospf
, &vl_config
);
977 /* Deal with other parameters */
978 for (i
=2; i
< argc
; i
++)
981 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
987 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
989 /* authentication-key - this option can occur anywhere on
990 command line. At start of command line
991 must check for authentication option. */
992 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
993 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
994 vl_config
.auth_key
= auth_key
;
997 else if (strncmp (argv
[i
], "authentication", 14) == 0)
999 /* authentication - this option can only occur at start
1001 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
1004 if (strncmp (argv
[i
+1], "n", 1) == 0)
1006 /* "authentication null" */
1007 vl_config
.auth_type
= OSPF_AUTH_NULL
;
1010 else if (strncmp (argv
[i
+1], "m", 1) == 0
1011 && strcmp (argv
[i
+1], "message-digest-") != 0)
1013 /* "authentication message-digest" */
1014 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1022 /* message-digest-key */
1024 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1025 if (vl_config
.crypto_key_id
< 0)
1028 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
1029 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
1030 vl_config
.md5_key
= md5_key
;
1034 /* Hello interval */
1036 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
1037 if (vl_config
.hello_interval
< 0)
1042 /* Retransmit Interval */
1044 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
1045 if (vl_config
.retransmit_interval
< 0)
1050 /* Transmit Delay */
1052 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
1053 if (vl_config
.transmit_delay
< 0)
1060 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
1061 if (vl_config
.dead_interval
< 0)
1068 /* Action configuration */
1070 return ospf_vl_set (ospf
, &vl_config
);
1074 DEFUN (no_ospf_area_vlink
,
1075 no_ospf_area_vlink_cmd
,
1076 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1078 VLINK_HELPSTR_IPADDR
)
1080 struct ospf
*ospf
= vty
->index
;
1081 struct ospf_area
*area
;
1082 struct ospf_vl_config_data vl_config
;
1083 struct ospf_vl_data
*vl_data
= NULL
;
1084 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1088 ospf_vl_config_data_init(&vl_config
, vty
);
1090 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &format
);
1093 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1097 area
= ospf_area_lookup_by_area_id (ospf
, vl_config
.area_id
);
1100 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1104 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1107 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1114 /* Basic VLink no command */
1115 /* Thats all folks! - BUGS B. strikes again!!!*/
1116 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
.vl_peer
)))
1117 ospf_vl_delete (ospf
, vl_data
);
1119 ospf_area_check_free (ospf
, vl_config
.area_id
);
1124 /* If we are down here, we are reseting parameters */
1126 /* Deal with other parameters */
1127 for (i
=2; i
< argc
; i
++)
1129 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1135 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1137 /* authentication-key - this option can occur anywhere on
1138 command line. At start of command line
1139 must check for authentication option. */
1140 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1141 vl_config
.auth_key
= auth_key
;
1143 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1145 /* authentication - this option can only occur at start
1147 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1152 /* message-digest-key */
1153 /* Delete one key */
1155 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1156 if (vl_config
.crypto_key_id
< 0)
1158 vl_config
.md5_key
= NULL
;
1162 /* Hello interval */
1163 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1167 /* Retransmit Interval */
1168 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1172 /* Transmit Delay */
1173 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1179 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1185 /* Action configuration */
1187 return ospf_vl_set (ospf
, &vl_config
);
1190 ALIAS (ospf_area_vlink
,
1191 ospf_area_vlink_param1_cmd
,
1192 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1193 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1194 VLINK_HELPSTR_IPADDR
1195 VLINK_HELPSTR_TIME_PARAM
)
1197 ALIAS (no_ospf_area_vlink
,
1198 no_ospf_area_vlink_param1_cmd
,
1199 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1200 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1202 VLINK_HELPSTR_IPADDR
1203 VLINK_HELPSTR_TIME_PARAM
)
1205 ALIAS (ospf_area_vlink
,
1206 ospf_area_vlink_param2_cmd
,
1207 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1208 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1209 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1210 VLINK_HELPSTR_IPADDR
1211 VLINK_HELPSTR_TIME_PARAM
1212 VLINK_HELPSTR_TIME_PARAM
)
1214 ALIAS (no_ospf_area_vlink
,
1215 no_ospf_area_vlink_param2_cmd
,
1216 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1217 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1218 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1220 VLINK_HELPSTR_IPADDR
1221 VLINK_HELPSTR_TIME_PARAM
1222 VLINK_HELPSTR_TIME_PARAM
)
1224 ALIAS (ospf_area_vlink
,
1225 ospf_area_vlink_param3_cmd
,
1226 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1227 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1228 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1229 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1230 VLINK_HELPSTR_IPADDR
1231 VLINK_HELPSTR_TIME_PARAM
1232 VLINK_HELPSTR_TIME_PARAM
1233 VLINK_HELPSTR_TIME_PARAM
)
1235 ALIAS (no_ospf_area_vlink
,
1236 no_ospf_area_vlink_param3_cmd
,
1237 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1238 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1239 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1240 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1242 VLINK_HELPSTR_IPADDR
1243 VLINK_HELPSTR_TIME_PARAM
1244 VLINK_HELPSTR_TIME_PARAM
1245 VLINK_HELPSTR_TIME_PARAM
)
1247 ALIAS (ospf_area_vlink
,
1248 ospf_area_vlink_param4_cmd
,
1249 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1250 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1251 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1252 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1253 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1254 VLINK_HELPSTR_IPADDR
1255 VLINK_HELPSTR_TIME_PARAM
1256 VLINK_HELPSTR_TIME_PARAM
1257 VLINK_HELPSTR_TIME_PARAM
1258 VLINK_HELPSTR_TIME_PARAM
)
1260 ALIAS (no_ospf_area_vlink
,
1261 no_ospf_area_vlink_param4_cmd
,
1262 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1263 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1264 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1265 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1266 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1268 VLINK_HELPSTR_IPADDR
1269 VLINK_HELPSTR_TIME_PARAM
1270 VLINK_HELPSTR_TIME_PARAM
1271 VLINK_HELPSTR_TIME_PARAM
1272 VLINK_HELPSTR_TIME_PARAM
)
1274 ALIAS (ospf_area_vlink
,
1275 ospf_area_vlink_authtype_args_cmd
,
1276 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1277 "(authentication|) (message-digest|null)",
1278 VLINK_HELPSTR_IPADDR
1279 VLINK_HELPSTR_AUTHTYPE_ALL
)
1281 ALIAS (ospf_area_vlink
,
1282 ospf_area_vlink_authtype_cmd
,
1283 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1284 "(authentication|)",
1285 VLINK_HELPSTR_IPADDR
1286 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1288 ALIAS (no_ospf_area_vlink
,
1289 no_ospf_area_vlink_authtype_cmd
,
1290 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1291 "(authentication|)",
1293 VLINK_HELPSTR_IPADDR
1294 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1296 ALIAS (ospf_area_vlink
,
1297 ospf_area_vlink_md5_cmd
,
1298 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1299 "(message-digest-key|) <1-255> md5 KEY",
1300 VLINK_HELPSTR_IPADDR
1301 VLINK_HELPSTR_AUTH_MD5
)
1303 ALIAS (no_ospf_area_vlink
,
1304 no_ospf_area_vlink_md5_cmd
,
1305 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1306 "(message-digest-key|) <1-255>",
1308 VLINK_HELPSTR_IPADDR
1309 VLINK_HELPSTR_AUTH_MD5
)
1311 ALIAS (ospf_area_vlink
,
1312 ospf_area_vlink_authkey_cmd
,
1313 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1314 "(authentication-key|) AUTH_KEY",
1315 VLINK_HELPSTR_IPADDR
1316 VLINK_HELPSTR_AUTH_SIMPLE
)
1318 ALIAS (no_ospf_area_vlink
,
1319 no_ospf_area_vlink_authkey_cmd
,
1320 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1321 "(authentication-key|)",
1323 VLINK_HELPSTR_IPADDR
1324 VLINK_HELPSTR_AUTH_SIMPLE
)
1326 ALIAS (ospf_area_vlink
,
1327 ospf_area_vlink_authtype_args_authkey_cmd
,
1328 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1329 "(authentication|) (message-digest|null) "
1330 "(authentication-key|) AUTH_KEY",
1331 VLINK_HELPSTR_IPADDR
1332 VLINK_HELPSTR_AUTHTYPE_ALL
1333 VLINK_HELPSTR_AUTH_SIMPLE
)
1335 ALIAS (ospf_area_vlink
,
1336 ospf_area_vlink_authtype_authkey_cmd
,
1337 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1338 "(authentication|) "
1339 "(authentication-key|) AUTH_KEY",
1340 VLINK_HELPSTR_IPADDR
1341 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1342 VLINK_HELPSTR_AUTH_SIMPLE
)
1344 ALIAS (no_ospf_area_vlink
,
1345 no_ospf_area_vlink_authtype_authkey_cmd
,
1346 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1347 "(authentication|) "
1348 "(authentication-key|)",
1350 VLINK_HELPSTR_IPADDR
1351 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1352 VLINK_HELPSTR_AUTH_SIMPLE
)
1354 ALIAS (ospf_area_vlink
,
1355 ospf_area_vlink_authtype_args_md5_cmd
,
1356 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1357 "(authentication|) (message-digest|null) "
1358 "(message-digest-key|) <1-255> md5 KEY",
1359 VLINK_HELPSTR_IPADDR
1360 VLINK_HELPSTR_AUTHTYPE_ALL
1361 VLINK_HELPSTR_AUTH_MD5
)
1363 ALIAS (ospf_area_vlink
,
1364 ospf_area_vlink_authtype_md5_cmd
,
1365 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1366 "(authentication|) "
1367 "(message-digest-key|) <1-255> md5 KEY",
1368 VLINK_HELPSTR_IPADDR
1369 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1370 VLINK_HELPSTR_AUTH_MD5
)
1372 ALIAS (no_ospf_area_vlink
,
1373 no_ospf_area_vlink_authtype_md5_cmd
,
1374 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1375 "(authentication|) "
1376 "(message-digest-key|)",
1378 VLINK_HELPSTR_IPADDR
1379 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1380 VLINK_HELPSTR_AUTH_MD5
)
1383 DEFUN (ospf_area_shortcut
,
1384 ospf_area_shortcut_cmd
,
1385 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1386 "OSPF area parameters\n"
1387 "OSPF area ID in IP address format\n"
1388 "OSPF area ID as a decimal value\n"
1389 "Configure the area's shortcutting mode\n"
1390 "Set default shortcutting behavior\n"
1391 "Enable shortcutting through the area\n"
1392 "Disable shortcutting through the area\n")
1394 struct ospf
*ospf
= vty
->index
;
1395 struct ospf_area
*area
;
1396 struct in_addr area_id
;
1400 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1402 area
= ospf_area_get (ospf
, area_id
, format
);
1404 if (strncmp (argv
[1], "de", 2) == 0)
1405 mode
= OSPF_SHORTCUT_DEFAULT
;
1406 else if (strncmp (argv
[1], "di", 2) == 0)
1407 mode
= OSPF_SHORTCUT_DISABLE
;
1408 else if (strncmp (argv
[1], "e", 1) == 0)
1409 mode
= OSPF_SHORTCUT_ENABLE
;
1413 ospf_area_shortcut_set (ospf
, area
, mode
);
1415 if (ospf
->abr_type
!= OSPF_ABR_SHORTCUT
)
1416 vty_out (vty
, "Shortcut area setting will take effect "
1417 "only when the router is configured as Shortcut ABR%s",
1423 DEFUN (no_ospf_area_shortcut
,
1424 no_ospf_area_shortcut_cmd
,
1425 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1427 "OSPF area parameters\n"
1428 "OSPF area ID in IP address format\n"
1429 "OSPF area ID as a decimal value\n"
1430 "Deconfigure the area's shortcutting mode\n"
1431 "Deconfigure enabled shortcutting through the area\n"
1432 "Deconfigure disabled shortcutting through the area\n")
1434 struct ospf
*ospf
= vty
->index
;
1435 struct ospf_area
*area
;
1436 struct in_addr area_id
;
1439 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1441 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1445 ospf_area_shortcut_unset (ospf
, area
);
1451 DEFUN (ospf_area_stub
,
1453 "area (A.B.C.D|<0-4294967295>) stub",
1454 "OSPF area parameters\n"
1455 "OSPF area ID in IP address format\n"
1456 "OSPF area ID as a decimal value\n"
1457 "Configure OSPF area as stub\n")
1459 struct ospf
*ospf
= vty
->index
;
1460 struct in_addr area_id
;
1463 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1465 ret
= ospf_area_stub_set (ospf
, area_id
);
1468 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1473 ospf_area_no_summary_unset (ospf
, area_id
);
1478 DEFUN (ospf_area_stub_no_summary
,
1479 ospf_area_stub_no_summary_cmd
,
1480 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1481 "OSPF stub parameters\n"
1482 "OSPF area ID in IP address format\n"
1483 "OSPF area ID as a decimal value\n"
1484 "Configure OSPF area as stub\n"
1485 "Do not inject inter-area routes into stub\n")
1487 struct ospf
*ospf
= vty
->index
;
1488 struct in_addr area_id
;
1491 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1493 ret
= ospf_area_stub_set (ospf
, area_id
);
1496 vty_out (vty
, "%% Area cannot be stub as it contains a virtual link%s",
1501 ospf_area_no_summary_set (ospf
, area_id
);
1506 DEFUN (no_ospf_area_stub
,
1507 no_ospf_area_stub_cmd
,
1508 "no area (A.B.C.D|<0-4294967295>) stub",
1510 "OSPF area parameters\n"
1511 "OSPF area ID in IP address format\n"
1512 "OSPF area ID as a decimal value\n"
1513 "Configure OSPF area as stub\n")
1515 struct ospf
*ospf
= vty
->index
;
1516 struct in_addr area_id
;
1519 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1521 ospf_area_stub_unset (ospf
, area_id
);
1522 ospf_area_no_summary_unset (ospf
, area_id
);
1527 DEFUN (no_ospf_area_stub_no_summary
,
1528 no_ospf_area_stub_no_summary_cmd
,
1529 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1531 "OSPF area parameters\n"
1532 "OSPF area ID in IP address format\n"
1533 "OSPF area ID as a decimal value\n"
1534 "Configure OSPF area as stub\n"
1535 "Do not inject inter-area routes into area\n")
1537 struct ospf
*ospf
= vty
->index
;
1538 struct in_addr area_id
;
1541 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1542 ospf_area_no_summary_unset (ospf
, area_id
);
1548 ospf_area_nssa_cmd_handler (struct vty
*vty
, int argc
, const char *argv
[],
1551 struct ospf
*ospf
= vty
->index
;
1552 struct in_addr area_id
;
1555 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1557 ret
= ospf_area_nssa_set (ospf
, area_id
);
1560 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1567 if (strncmp (argv
[1], "translate-c", 11) == 0)
1568 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1569 OSPF_NSSA_ROLE_CANDIDATE
);
1570 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1571 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1572 OSPF_NSSA_ROLE_NEVER
);
1573 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1574 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1575 OSPF_NSSA_ROLE_ALWAYS
);
1579 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1580 OSPF_NSSA_ROLE_CANDIDATE
);
1584 ospf_area_no_summary_set (ospf
, area_id
);
1586 ospf_area_no_summary_unset (ospf
, area_id
);
1588 ospf_schedule_abr_task (ospf
);
1593 DEFUN (ospf_area_nssa_translate_no_summary
,
1594 ospf_area_nssa_translate_no_summary_cmd
,
1595 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
1596 "OSPF area parameters\n"
1597 "OSPF area ID in IP address format\n"
1598 "OSPF area ID as a decimal value\n"
1599 "Configure OSPF area as nssa\n"
1600 "Configure NSSA-ABR for translate election (default)\n"
1601 "Configure NSSA-ABR to never translate\n"
1602 "Configure NSSA-ABR to always translate\n"
1603 "Do not inject inter-area routes into nssa\n")
1605 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1608 DEFUN (ospf_area_nssa_translate
,
1609 ospf_area_nssa_translate_cmd
,
1610 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1611 "OSPF area parameters\n"
1612 "OSPF area ID in IP address format\n"
1613 "OSPF area ID as a decimal value\n"
1614 "Configure OSPF area as nssa\n"
1615 "Configure NSSA-ABR for translate election (default)\n"
1616 "Configure NSSA-ABR to never translate\n"
1617 "Configure NSSA-ABR to always translate\n")
1619 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1622 DEFUN (ospf_area_nssa
,
1624 "area (A.B.C.D|<0-4294967295>) nssa",
1625 "OSPF area parameters\n"
1626 "OSPF area ID in IP address format\n"
1627 "OSPF area ID as a decimal value\n"
1628 "Configure OSPF area as nssa\n")
1630 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1633 DEFUN (ospf_area_nssa_no_summary
,
1634 ospf_area_nssa_no_summary_cmd
,
1635 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1636 "OSPF area parameters\n"
1637 "OSPF area ID in IP address format\n"
1638 "OSPF area ID as a decimal value\n"
1639 "Configure OSPF area as nssa\n"
1640 "Do not inject inter-area routes into nssa\n")
1642 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1645 DEFUN (no_ospf_area_nssa
,
1646 no_ospf_area_nssa_cmd
,
1647 "no area (A.B.C.D|<0-4294967295>) nssa",
1649 "OSPF area parameters\n"
1650 "OSPF area ID in IP address format\n"
1651 "OSPF area ID as a decimal value\n"
1652 "Configure OSPF area as nssa\n")
1654 struct ospf
*ospf
= vty
->index
;
1655 struct in_addr area_id
;
1658 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1660 ospf_area_nssa_unset (ospf
, area_id
);
1661 ospf_area_no_summary_unset (ospf
, area_id
);
1663 ospf_schedule_abr_task (ospf
);
1668 DEFUN (no_ospf_area_nssa_no_summary
,
1669 no_ospf_area_nssa_no_summary_cmd
,
1670 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1672 "OSPF area parameters\n"
1673 "OSPF area ID in IP address format\n"
1674 "OSPF area ID as a decimal value\n"
1675 "Configure OSPF area as nssa\n"
1676 "Do not inject inter-area routes into nssa\n")
1678 struct ospf
*ospf
= vty
->index
;
1679 struct in_addr area_id
;
1682 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1683 ospf_area_no_summary_unset (ospf
, area_id
);
1688 DEFUN (ospf_area_default_cost
,
1689 ospf_area_default_cost_cmd
,
1690 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1691 "OSPF area parameters\n"
1692 "OSPF area ID in IP address format\n"
1693 "OSPF area ID as a decimal value\n"
1694 "Set the summary-default cost of a NSSA or stub area\n"
1695 "Stub's advertised default summary cost\n")
1697 struct ospf
*ospf
= vty
->index
;
1698 struct ospf_area
*area
;
1699 struct in_addr area_id
;
1702 struct prefix_ipv4 p
;
1704 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1705 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1707 area
= ospf_area_get (ospf
, area_id
, format
);
1709 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1711 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1715 area
->default_cost
= cost
;
1718 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1720 if (IS_DEBUG_OSPF_EVENT
)
1721 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1722 "announcing 0.0.0.0/0 to area %s",
1723 inet_ntoa (area
->area_id
));
1724 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1729 DEFUN (no_ospf_area_default_cost
,
1730 no_ospf_area_default_cost_cmd
,
1731 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1733 "OSPF area parameters\n"
1734 "OSPF area ID in IP address format\n"
1735 "OSPF area ID as a decimal value\n"
1736 "Set the summary-default cost of a NSSA or stub area\n"
1737 "Stub's advertised default summary cost\n")
1739 struct ospf
*ospf
= vty
->index
;
1740 struct ospf_area
*area
;
1741 struct in_addr area_id
;
1744 struct prefix_ipv4 p
;
1746 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1747 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1749 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1753 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1755 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1759 area
->default_cost
= 1;
1762 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1764 if (IS_DEBUG_OSPF_EVENT
)
1765 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1766 "announcing 0.0.0.0/0 to area %s",
1767 inet_ntoa (area
->area_id
));
1768 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1771 ospf_area_check_free (ospf
, area_id
);
1776 DEFUN (ospf_area_export_list
,
1777 ospf_area_export_list_cmd
,
1778 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1779 "OSPF area parameters\n"
1780 "OSPF area ID in IP address format\n"
1781 "OSPF area ID as a decimal value\n"
1782 "Set the filter for networks announced to other areas\n"
1783 "Name of the access-list\n")
1785 struct ospf
*ospf
= vty
->index
;
1786 struct ospf_area
*area
;
1787 struct in_addr area_id
;
1790 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1792 area
= ospf_area_get (ospf
, area_id
, format
);
1793 ospf_area_export_list_set (ospf
, area
, argv
[1]);
1798 DEFUN (no_ospf_area_export_list
,
1799 no_ospf_area_export_list_cmd
,
1800 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1802 "OSPF area parameters\n"
1803 "OSPF area ID in IP address format\n"
1804 "OSPF area ID as a decimal value\n"
1805 "Unset the filter for networks announced to other areas\n"
1806 "Name of the access-list\n")
1808 struct ospf
*ospf
= vty
->index
;
1809 struct ospf_area
*area
;
1810 struct in_addr area_id
;
1813 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1815 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1819 ospf_area_export_list_unset (ospf
, area
);
1825 DEFUN (ospf_area_import_list
,
1826 ospf_area_import_list_cmd
,
1827 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1828 "OSPF area parameters\n"
1829 "OSPF area ID in IP address format\n"
1830 "OSPF area ID as a decimal value\n"
1831 "Set the filter for networks from other areas announced to the specified one\n"
1832 "Name of the access-list\n")
1834 struct ospf
*ospf
= vty
->index
;
1835 struct ospf_area
*area
;
1836 struct in_addr area_id
;
1839 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1841 area
= ospf_area_get (ospf
, area_id
, format
);
1842 ospf_area_import_list_set (ospf
, area
, argv
[1]);
1847 DEFUN (no_ospf_area_import_list
,
1848 no_ospf_area_import_list_cmd
,
1849 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1851 "OSPF area parameters\n"
1852 "OSPF area ID in IP address format\n"
1853 "OSPF area ID as a decimal value\n"
1854 "Unset the filter for networks announced to other areas\n"
1855 "Name of the access-list\n")
1857 struct ospf
*ospf
= vty
->index
;
1858 struct ospf_area
*area
;
1859 struct in_addr area_id
;
1862 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1864 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1868 ospf_area_import_list_unset (ospf
, area
);
1873 DEFUN (ospf_area_filter_list
,
1874 ospf_area_filter_list_cmd
,
1875 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1876 "OSPF area parameters\n"
1877 "OSPF area ID in IP address format\n"
1878 "OSPF area ID as a decimal value\n"
1879 "Filter networks between OSPF areas\n"
1880 "Filter prefixes between OSPF areas\n"
1881 "Name of an IP prefix-list\n"
1882 "Filter networks sent to this area\n"
1883 "Filter networks sent from this area\n")
1885 struct ospf
*ospf
= vty
->index
;
1886 struct ospf_area
*area
;
1887 struct in_addr area_id
;
1888 struct prefix_list
*plist
;
1891 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1893 area
= ospf_area_get (ospf
, area_id
, format
);
1894 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1895 if (strncmp (argv
[2], "in", 2) == 0)
1897 PREFIX_LIST_IN (area
) = plist
;
1898 if (PREFIX_NAME_IN (area
))
1899 free (PREFIX_NAME_IN (area
));
1901 PREFIX_NAME_IN (area
) = strdup (argv
[1]);
1902 ospf_schedule_abr_task (ospf
);
1906 PREFIX_LIST_OUT (area
) = plist
;
1907 if (PREFIX_NAME_OUT (area
))
1908 free (PREFIX_NAME_OUT (area
));
1910 PREFIX_NAME_OUT (area
) = strdup (argv
[1]);
1911 ospf_schedule_abr_task (ospf
);
1917 DEFUN (no_ospf_area_filter_list
,
1918 no_ospf_area_filter_list_cmd
,
1919 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1921 "OSPF area parameters\n"
1922 "OSPF area ID in IP address format\n"
1923 "OSPF area ID as a decimal value\n"
1924 "Filter networks between OSPF areas\n"
1925 "Filter prefixes between OSPF areas\n"
1926 "Name of an IP prefix-list\n"
1927 "Filter networks sent to this area\n"
1928 "Filter networks sent from this area\n")
1930 struct ospf
*ospf
= vty
->index
;
1931 struct ospf_area
*area
;
1932 struct in_addr area_id
;
1933 struct prefix_list
*plist
;
1936 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1938 if ((area
= ospf_area_lookup_by_area_id (ospf
, area_id
)) == NULL
)
1941 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1942 if (strncmp (argv
[2], "in", 2) == 0)
1944 if (PREFIX_NAME_IN (area
))
1945 if (strcmp (PREFIX_NAME_IN (area
), argv
[1]) != 0)
1948 PREFIX_LIST_IN (area
) = NULL
;
1949 if (PREFIX_NAME_IN (area
))
1950 free (PREFIX_NAME_IN (area
));
1952 PREFIX_NAME_IN (area
) = NULL
;
1954 ospf_schedule_abr_task (ospf
);
1958 if (PREFIX_NAME_OUT (area
))
1959 if (strcmp (PREFIX_NAME_OUT (area
), argv
[1]) != 0)
1962 PREFIX_LIST_OUT (area
) = NULL
;
1963 if (PREFIX_NAME_OUT (area
))
1964 free (PREFIX_NAME_OUT (area
));
1966 PREFIX_NAME_OUT (area
) = NULL
;
1968 ospf_schedule_abr_task (ospf
);
1975 DEFUN (ospf_area_authentication_message_digest
,
1976 ospf_area_authentication_message_digest_cmd
,
1977 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1978 "OSPF area parameters\n"
1979 "Enable authentication\n"
1980 "Use message-digest authentication\n")
1982 struct ospf
*ospf
= vty
->index
;
1983 struct ospf_area
*area
;
1984 struct in_addr area_id
;
1987 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1989 area
= ospf_area_get (ospf
, area_id
, format
);
1990 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1995 DEFUN (ospf_area_authentication
,
1996 ospf_area_authentication_cmd
,
1997 "area (A.B.C.D|<0-4294967295>) authentication",
1998 "OSPF area parameters\n"
1999 "OSPF area ID in IP address format\n"
2000 "OSPF area ID as a decimal value\n"
2001 "Enable authentication\n")
2003 struct ospf
*ospf
= vty
->index
;
2004 struct ospf_area
*area
;
2005 struct in_addr area_id
;
2008 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2010 area
= ospf_area_get (ospf
, area_id
, format
);
2011 area
->auth_type
= OSPF_AUTH_SIMPLE
;
2016 DEFUN (no_ospf_area_authentication
,
2017 no_ospf_area_authentication_cmd
,
2018 "no area (A.B.C.D|<0-4294967295>) authentication",
2020 "OSPF area parameters\n"
2021 "OSPF area ID in IP address format\n"
2022 "OSPF area ID as a decimal value\n"
2023 "Enable authentication\n")
2025 struct ospf
*ospf
= vty
->index
;
2026 struct ospf_area
*area
;
2027 struct in_addr area_id
;
2030 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
2032 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
2036 area
->auth_type
= OSPF_AUTH_NULL
;
2038 ospf_area_check_free (ospf
, area_id
);
2044 DEFUN (ospf_abr_type
,
2046 "ospf abr-type (cisco|ibm|shortcut|standard)",
2047 "OSPF specific commands\n"
2048 "Set OSPF ABR type\n"
2049 "Alternative ABR, cisco implementation\n"
2050 "Alternative ABR, IBM implementation\n"
2052 "Standard behavior (RFC2328)\n")
2054 struct ospf
*ospf
= vty
->index
;
2055 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2057 if (strncmp (argv
[0], "c", 1) == 0)
2058 abr_type
= OSPF_ABR_CISCO
;
2059 else if (strncmp (argv
[0], "i", 1) == 0)
2060 abr_type
= OSPF_ABR_IBM
;
2061 else if (strncmp (argv
[0], "sh", 2) == 0)
2062 abr_type
= OSPF_ABR_SHORTCUT
;
2063 else if (strncmp (argv
[0], "st", 2) == 0)
2064 abr_type
= OSPF_ABR_STAND
;
2068 /* If ABR type value is changed, schedule ABR task. */
2069 if (ospf
->abr_type
!= abr_type
)
2071 ospf
->abr_type
= abr_type
;
2072 ospf_schedule_abr_task (ospf
);
2078 DEFUN (no_ospf_abr_type
,
2079 no_ospf_abr_type_cmd
,
2080 "no ospf abr-type (cisco|ibm|shortcut|standard)",
2082 "OSPF specific commands\n"
2083 "Set OSPF ABR type\n"
2084 "Alternative ABR, cisco implementation\n"
2085 "Alternative ABR, IBM implementation\n"
2088 struct ospf
*ospf
= vty
->index
;
2089 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2091 if (strncmp (argv
[0], "c", 1) == 0)
2092 abr_type
= OSPF_ABR_CISCO
;
2093 else if (strncmp (argv
[0], "i", 1) == 0)
2094 abr_type
= OSPF_ABR_IBM
;
2095 else if (strncmp (argv
[0], "sh", 2) == 0)
2096 abr_type
= OSPF_ABR_SHORTCUT
;
2097 else if (strncmp (argv
[0], "st", 2) == 0)
2098 abr_type
= OSPF_ABR_STAND
;
2102 /* If ABR type value is changed, schedule ABR task. */
2103 if (ospf
->abr_type
== abr_type
)
2105 ospf
->abr_type
= OSPF_ABR_DEFAULT
;
2106 ospf_schedule_abr_task (ospf
);
2112 DEFUN (ospf_log_adjacency_changes
,
2113 ospf_log_adjacency_changes_cmd
,
2114 "log-adjacency-changes",
2115 "Log changes in adjacency state\n")
2117 struct ospf
*ospf
= vty
->index
;
2119 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2123 DEFUN (ospf_log_adjacency_changes_detail
,
2124 ospf_log_adjacency_changes_detail_cmd
,
2125 "log-adjacency-changes detail",
2126 "Log changes in adjacency state\n"
2127 "Log all state changes\n")
2129 struct ospf
*ospf
= vty
->index
;
2131 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2132 SET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2136 DEFUN (no_ospf_log_adjacency_changes
,
2137 no_ospf_log_adjacency_changes_cmd
,
2138 "no log-adjacency-changes",
2140 "Log changes in adjacency state\n")
2142 struct ospf
*ospf
= vty
->index
;
2144 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2145 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
);
2149 DEFUN (no_ospf_log_adjacency_changes_detail
,
2150 no_ospf_log_adjacency_changes_detail_cmd
,
2151 "no log-adjacency-changes detail",
2153 "Log changes in adjacency state\n"
2154 "Log all state changes\n")
2156 struct ospf
*ospf
= vty
->index
;
2158 UNSET_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
);
2162 DEFUN (ospf_compatible_rfc1583
,
2163 ospf_compatible_rfc1583_cmd
,
2164 "compatible rfc1583",
2165 "OSPF compatibility list\n"
2166 "compatible with RFC 1583\n")
2168 struct ospf
*ospf
= vty
->index
;
2170 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2172 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2173 ospf_spf_calculate_schedule (ospf
);
2178 DEFUN (no_ospf_compatible_rfc1583
,
2179 no_ospf_compatible_rfc1583_cmd
,
2180 "no compatible rfc1583",
2182 "OSPF compatibility list\n"
2183 "compatible with RFC 1583\n")
2185 struct ospf
*ospf
= vty
->index
;
2187 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2189 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2190 ospf_spf_calculate_schedule (ospf
);
2195 ALIAS (ospf_compatible_rfc1583
,
2196 ospf_rfc1583_flag_cmd
,
2197 "ospf rfc1583compatibility",
2198 "OSPF specific commands\n"
2199 "Enable the RFC1583Compatibility flag\n")
2201 ALIAS (no_ospf_compatible_rfc1583
,
2202 no_ospf_rfc1583_flag_cmd
,
2203 "no ospf rfc1583compatibility",
2205 "OSPF specific commands\n"
2206 "Disable the RFC1583Compatibility flag\n")
2209 ospf_timers_spf_set (struct vty
*vty
, unsigned int delay
,
2213 struct ospf
*ospf
= vty
->index
;
2215 ospf
->spf_delay
= delay
;
2216 ospf
->spf_holdtime
= hold
;
2217 ospf
->spf_max_holdtime
= max
;
2222 DEFUN (ospf_timers_throttle_spf
,
2223 ospf_timers_throttle_spf_cmd
,
2224 "timers throttle spf <0-600000> <0-600000> <0-600000>",
2225 "Adjust routing timers\n"
2226 "Throttling adaptive timer\n"
2228 "Delay (msec) from first change received till SPF calculation\n"
2229 "Initial hold time (msec) between consecutive SPF calculations\n"
2230 "Maximum hold time (msec)\n")
2232 unsigned int delay
, hold
, max
;
2236 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2240 VTY_GET_INTEGER_RANGE ("SPF delay timer", delay
, argv
[0], 0, 600000);
2241 VTY_GET_INTEGER_RANGE ("SPF hold timer", hold
, argv
[1], 0, 600000);
2242 VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max
, argv
[2], 0, 600000);
2244 return ospf_timers_spf_set (vty
, delay
, hold
, max
);
2247 DEFUN_DEPRECATED (ospf_timers_spf
,
2248 ospf_timers_spf_cmd
,
2249 "timers spf <0-4294967295> <0-4294967295>",
2250 "Adjust routing timers\n"
2252 "Delay (s) between receiving a change to SPF calculation\n"
2253 "Hold time (s) between consecutive SPF calculations\n")
2255 unsigned int delay
, hold
;
2259 vty_out (vty
, "Insufficient number of arguments%s", VTY_NEWLINE
);
2263 VTY_GET_INTEGER ("SPF delay timer", delay
, argv
[0]);
2264 VTY_GET_INTEGER ("SPF hold timer", hold
, argv
[1]);
2266 /* truncate down the second values if they're greater than 600000ms */
2267 if (delay
> (600000 / 1000))
2269 else if (delay
== 0)
2270 /* 0s delay was probably specified because of lack of ms resolution */
2271 delay
= OSPF_SPF_DELAY_DEFAULT
;
2272 if (hold
> (600000 / 1000))
2275 return ospf_timers_spf_set (vty
, delay
* 1000, hold
* 1000, hold
* 1000);
2278 DEFUN (no_ospf_timers_throttle_spf
,
2279 no_ospf_timers_throttle_spf_cmd
,
2280 "no timers throttle spf",
2282 "Adjust routing timers\n"
2283 "Throttling adaptive timer\n"
2284 "OSPF SPF timers\n")
2286 return ospf_timers_spf_set (vty
,
2287 OSPF_SPF_DELAY_DEFAULT
,
2288 OSPF_SPF_HOLDTIME_DEFAULT
,
2289 OSPF_SPF_MAX_HOLDTIME_DEFAULT
);
2292 ALIAS_DEPRECATED (no_ospf_timers_throttle_spf
,
2293 no_ospf_timers_spf_cmd
,
2296 "Adjust routing timers\n"
2297 "OSPF SPF timers\n")
2299 DEFUN (ospf_neighbor
,
2303 "Neighbor IP address\n")
2305 struct ospf
*ospf
= vty
->index
;
2306 struct in_addr nbr_addr
;
2307 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2308 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2310 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2313 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2316 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2318 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2320 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2322 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, priority
);
2327 ALIAS (ospf_neighbor
,
2328 ospf_neighbor_priority_poll_interval_cmd
,
2329 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2331 "Neighbor IP address\n"
2332 "Neighbor Priority\n"
2334 "Dead Neighbor Polling interval\n"
2337 ALIAS (ospf_neighbor
,
2338 ospf_neighbor_priority_cmd
,
2339 "neighbor A.B.C.D priority <0-255>",
2341 "Neighbor IP address\n"
2342 "Neighbor Priority\n"
2345 DEFUN (ospf_neighbor_poll_interval
,
2346 ospf_neighbor_poll_interval_cmd
,
2347 "neighbor A.B.C.D poll-interval <1-65535>",
2349 "Neighbor IP address\n"
2350 "Dead Neighbor Polling interval\n"
2353 struct ospf
*ospf
= vty
->index
;
2354 struct in_addr nbr_addr
;
2355 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2356 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2358 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2361 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[1], 1, 65535);
2364 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2366 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2368 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2370 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2375 ALIAS (ospf_neighbor_poll_interval
,
2376 ospf_neighbor_poll_interval_priority_cmd
,
2377 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2379 "Neighbor address\n"
2380 "OSPF dead-router polling interval\n"
2382 "OSPF priority of non-broadcast neighbor\n"
2385 DEFUN (no_ospf_neighbor
,
2386 no_ospf_neighbor_cmd
,
2387 "no neighbor A.B.C.D",
2390 "Neighbor IP address\n")
2392 struct ospf
*ospf
= vty
->index
;
2393 struct in_addr nbr_addr
;
2396 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2398 ret
= ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2403 ALIAS (no_ospf_neighbor
,
2404 no_ospf_neighbor_priority_cmd
,
2405 "no neighbor A.B.C.D priority <0-255>",
2408 "Neighbor IP address\n"
2409 "Neighbor Priority\n"
2412 ALIAS (no_ospf_neighbor
,
2413 no_ospf_neighbor_poll_interval_cmd
,
2414 "no neighbor A.B.C.D poll-interval <1-65535>",
2417 "Neighbor IP address\n"
2418 "Dead Neighbor Polling interval\n"
2421 ALIAS (no_ospf_neighbor
,
2422 no_ospf_neighbor_priority_pollinterval_cmd
,
2423 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2426 "Neighbor IP address\n"
2427 "Neighbor Priority\n"
2429 "Dead Neighbor Polling interval\n"
2433 DEFUN (ospf_refresh_timer
, ospf_refresh_timer_cmd
,
2434 "refresh timer <10-1800>",
2435 "Adjust refresh parameters\n"
2436 "Set refresh timer\n"
2437 "Timer value in seconds\n")
2439 struct ospf
*ospf
= vty
->index
;
2440 unsigned int interval
;
2442 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2443 interval
= (interval
/ 10) * 10;
2445 ospf_timers_refresh_set (ospf
, interval
);
2450 DEFUN (no_ospf_refresh_timer
, no_ospf_refresh_timer_val_cmd
,
2451 "no refresh timer <10-1800>",
2452 "Adjust refresh parameters\n"
2453 "Unset refresh timer\n"
2454 "Timer value in seconds\n")
2456 struct ospf
*ospf
= vty
->index
;
2457 unsigned int interval
;
2461 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2463 if (ospf
->lsa_refresh_interval
!= interval
||
2464 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2468 ospf_timers_refresh_unset (ospf
);
2473 ALIAS (no_ospf_refresh_timer
,
2474 no_ospf_refresh_timer_cmd
,
2476 "Adjust refresh parameters\n"
2477 "Unset refresh timer\n")
2479 DEFUN (ospf_auto_cost_reference_bandwidth
,
2480 ospf_auto_cost_reference_bandwidth_cmd
,
2481 "auto-cost reference-bandwidth <1-4294967>",
2482 "Calculate OSPF interface cost according to bandwidth\n"
2483 "Use reference bandwidth method to assign OSPF cost\n"
2484 "The reference bandwidth in terms of Mbits per second\n")
2486 struct ospf
*ospf
= vty
->index
;
2488 struct listnode
*node
;
2489 struct interface
*ifp
;
2491 refbw
= strtol (argv
[0], NULL
, 10);
2492 if (refbw
< 1 || refbw
> 4294967)
2494 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2498 /* If reference bandwidth is changed. */
2499 if ((refbw
* 1000) == ospf
->ref_bandwidth
)
2502 ospf
->ref_bandwidth
= refbw
* 1000;
2503 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
2504 ospf_if_recalculate_output_cost (ifp
);
2509 DEFUN (no_ospf_auto_cost_reference_bandwidth
,
2510 no_ospf_auto_cost_reference_bandwidth_cmd
,
2511 "no auto-cost reference-bandwidth",
2513 "Calculate OSPF interface cost according to bandwidth\n"
2514 "Use reference bandwidth method to assign OSPF cost\n")
2516 struct ospf
*ospf
= vty
->index
;
2517 struct listnode
*node
, *nnode
;
2518 struct interface
*ifp
;
2520 if (ospf
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
2523 ospf
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
2524 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2525 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2527 for (ALL_LIST_ELEMENTS (om
->iflist
, node
, nnode
, ifp
))
2528 ospf_if_recalculate_output_cost (ifp
);
2533 const char *ospf_abr_type_descr_str
[] =
2536 "Standard (RFC2328)",
2538 "Alternative Cisco",
2539 "Alternative Shortcut"
2542 const char *ospf_shortcut_mode_descr_str
[] =
2552 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
)
2555 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
2557 /* Show Area type/mode. */
2558 if (OSPF_IS_AREA_BACKBONE (area
))
2559 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
2562 if (area
->external_routing
== OSPF_AREA_STUB
)
2563 vty_out (vty
, " (Stub%s%s)",
2564 area
->no_summary
? ", no summary" : "",
2565 area
->shortcut_configured
? "; " : "");
2567 else if (area
->external_routing
== OSPF_AREA_NSSA
)
2568 vty_out (vty
, " (NSSA%s%s)",
2569 area
->no_summary
? ", no summary" : "",
2570 area
->shortcut_configured
? "; " : "");
2572 vty_out (vty
, "%s", VTY_NEWLINE
);
2573 vty_out (vty
, " Shortcutting mode: %s",
2574 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
2575 vty_out (vty
, ", S-bit consensus: %s%s",
2576 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
2579 /* Show number of interfaces. */
2580 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
2581 "Active: %d%s", listcount (area
->oiflist
),
2582 area
->act_ints
, VTY_NEWLINE
);
2584 if (area
->external_routing
== OSPF_AREA_NSSA
)
2586 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
2587 if (! IS_OSPF_ABR (area
->ospf
))
2588 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
2590 else if (area
->NSSATranslatorState
)
2592 vty_out (vty
, " We are an ABR and ");
2593 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2594 vty_out (vty
, "the NSSA Elected Translator. %s",
2596 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
2597 vty_out (vty
, "always an NSSA Translator. %s",
2602 vty_out (vty
, " We are an ABR, but ");
2603 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2604 vty_out (vty
, "not the NSSA Elected Translator. %s",
2607 vty_out (vty
, "never an NSSA Translator. %s",
2611 /* Stub-router state for this area */
2612 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
2614 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2615 vty_out (vty
, " Originating stub / maximum-distance Router-LSA%s",
2617 if (CHECK_FLAG(area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
2618 vty_out (vty
, " Administratively activated (indefinitely)%s",
2620 if (area
->t_stub_router
)
2621 vty_out (vty
, " Active from startup, %s remaining%s",
2622 ospf_timer_dump (area
->t_stub_router
, timebuf
,
2623 sizeof(timebuf
)), VTY_NEWLINE
);
2626 /* Show number of fully adjacent neighbors. */
2627 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
2628 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
2630 /* Show authentication type. */
2631 vty_out (vty
, " Area has ");
2632 if (area
->auth_type
== OSPF_AUTH_NULL
)
2633 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
2634 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
2635 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
2636 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
2637 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
2639 if (!OSPF_IS_AREA_BACKBONE (area
))
2640 vty_out (vty
, " Number of full virtual adjacencies going through"
2641 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
2643 /* Show SPF calculation times. */
2644 vty_out (vty
, " SPF algorithm executed %d times%s",
2645 area
->spf_calculation
, VTY_NEWLINE
);
2647 /* Show number of LSA. */
2648 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
2649 vty_out (vty
, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
2650 ospf_lsdb_count (area
->lsdb
, OSPF_ROUTER_LSA
),
2651 ospf_lsdb_checksum (area
->lsdb
, OSPF_ROUTER_LSA
), VTY_NEWLINE
);
2652 vty_out (vty
, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
2653 ospf_lsdb_count (area
->lsdb
, OSPF_NETWORK_LSA
),
2654 ospf_lsdb_checksum (area
->lsdb
, OSPF_NETWORK_LSA
), VTY_NEWLINE
);
2655 vty_out (vty
, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
2656 ospf_lsdb_count (area
->lsdb
, OSPF_SUMMARY_LSA
),
2657 ospf_lsdb_checksum (area
->lsdb
, OSPF_SUMMARY_LSA
), VTY_NEWLINE
);
2658 vty_out (vty
, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
2659 ospf_lsdb_count (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
),
2660 ospf_lsdb_checksum (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
), VTY_NEWLINE
);
2661 vty_out (vty
, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
2662 ospf_lsdb_count (area
->lsdb
, OSPF_AS_NSSA_LSA
),
2663 ospf_lsdb_checksum (area
->lsdb
, OSPF_AS_NSSA_LSA
), VTY_NEWLINE
);
2664 #ifdef HAVE_OPAQUE_LSA
2665 vty_out (vty
, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
2666 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
),
2667 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
), VTY_NEWLINE
);
2668 vty_out (vty
, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
2669 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
),
2670 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
), VTY_NEWLINE
);
2671 #endif /* HAVE_OPAQUE_LSA */
2672 vty_out (vty
, "%s", VTY_NEWLINE
);
2675 DEFUN (show_ip_ospf
,
2680 "OSPF information\n")
2682 struct listnode
*node
, *nnode
;
2683 struct ospf_area
* area
;
2685 struct timeval result
;
2686 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2688 /* Check OSPF is enable. */
2689 ospf
= ospf_lookup ();
2692 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2696 /* Show Router ID. */
2697 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
2698 inet_ntoa (ospf
->router_id
),
2701 /* Graceful shutdown */
2702 if (ospf
->t_deferred_shutdown
)
2703 vty_out (vty
, " Deferred shutdown in progress, %s remaining%s",
2704 ospf_timer_dump (ospf
->t_deferred_shutdown
,
2705 timebuf
, sizeof (timebuf
)), VTY_NEWLINE
);
2706 /* Show capability. */
2707 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
2708 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
2709 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
2710 CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
) ?
2711 "enabled" : "disabled", VTY_NEWLINE
);
2712 #ifdef HAVE_OPAQUE_LSA
2713 vty_out (vty
, " OpaqueCapability flag is %s%s%s",
2714 CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
) ?
2715 "enabled" : "disabled",
2716 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf
->opaque
) ?
2717 " (origination blocked)" : "",
2719 #endif /* HAVE_OPAQUE_LSA */
2721 /* Show stub-router configuration */
2722 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
2723 || ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
2725 vty_out (vty
, " Stub router advertisement is configured%s",
2727 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
2728 vty_out (vty
, " Enabled for %us after start-up%s",
2729 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
2730 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
2731 vty_out (vty
, " Enabled for %us prior to full shutdown%s",
2732 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
2735 /* Show SPF timers. */
2736 vty_out (vty
, " Initial SPF scheduling delay %d millisec(s)%s"
2737 " Minimum hold time between consecutive SPFs %d millisec(s)%s"
2738 " Maximum hold time between consecutive SPFs %d millisec(s)%s"
2739 " Hold time multiplier is currently %d%s",
2740 ospf
->spf_delay
, VTY_NEWLINE
,
2741 ospf
->spf_holdtime
, VTY_NEWLINE
,
2742 ospf
->spf_max_holdtime
, VTY_NEWLINE
,
2743 ospf
->spf_hold_multiplier
, VTY_NEWLINE
);
2744 vty_out (vty
, " SPF algorithm ");
2745 if (ospf
->ts_spf
.tv_sec
|| ospf
->ts_spf
.tv_usec
)
2747 result
= tv_sub (recent_relative_time (), ospf
->ts_spf
);
2748 vty_out (vty
, "last executed %s ago%s",
2749 ospf_timeval_dump (&result
, timebuf
, sizeof (timebuf
)),
2753 vty_out (vty
, "has not been run%s", VTY_NEWLINE
);
2754 vty_out (vty
, " SPF timer %s%s%s",
2755 (ospf
->t_spf_calc
? "due in " : "is "),
2756 ospf_timer_dump (ospf
->t_spf_calc
, timebuf
, sizeof (timebuf
)),
2759 /* Show refresh parameters. */
2760 vty_out (vty
, " Refresh timer %d secs%s",
2761 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
2763 /* Show ABR/ASBR flags. */
2764 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
2765 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
2766 ospf_abr_type_descr_str
[ospf
->abr_type
], VTY_NEWLINE
);
2768 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
2769 vty_out (vty
, " This router is an ASBR "
2770 "(injecting external routing information)%s", VTY_NEWLINE
);
2772 /* Show Number of AS-external-LSAs. */
2773 vty_out (vty
, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
2774 ospf_lsdb_count (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
),
2775 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
), VTY_NEWLINE
);
2776 #ifdef HAVE_OPAQUE_LSA
2777 vty_out (vty
, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
2778 ospf_lsdb_count (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
),
2779 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
), VTY_NEWLINE
);
2780 #endif /* HAVE_OPAQUE_LSA */
2781 /* Show number of areas attached. */
2782 vty_out (vty
, " Number of areas attached to this router: %d%s",
2783 listcount (ospf
->areas
), VTY_NEWLINE
);
2785 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
))
2787 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
))
2788 vty_out(vty
, " All adjacency changes are logged%s",VTY_NEWLINE
);
2790 vty_out(vty
, " Adjacency changes are logged%s",VTY_NEWLINE
);
2793 vty_out (vty
, "%s",VTY_NEWLINE
);
2795 /* Show each area status. */
2796 for (ALL_LIST_ELEMENTS (ospf
->areas
, node
, nnode
, area
))
2797 show_ip_ospf_area (vty
, area
);
2804 show_ip_ospf_interface_sub (struct vty
*vty
, struct ospf
*ospf
,
2805 struct interface
*ifp
)
2808 struct ospf_neighbor
*nbr
;
2809 struct route_node
*rn
;
2811 /* Is interface up? */
2812 vty_out (vty
, "%s is %s%s", ifp
->name
,
2813 ((is_up
= if_is_operative(ifp
)) ? "up" : "down"), VTY_NEWLINE
);
2814 vty_out (vty
, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s",
2815 ifp
->ifindex
, ifp
->mtu
, ifp
->bandwidth
, if_flag_dump(ifp
->flags
),
2818 /* Is interface OSPF enabled? */
2819 if (ospf_oi_count(ifp
) == 0)
2821 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2826 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
2831 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
2833 struct ospf_interface
*oi
= rn
->info
;
2838 /* Show OSPF interface information. */
2839 vty_out (vty
, " Internet Address %s/%d,",
2840 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
2842 if (oi
->connected
->destination
|| oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
2844 struct in_addr
*dest
;
2847 if (CONNECTED_PEER(oi
->connected
)
2848 || oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
2853 /* For Vlinks, showing the peer address is probably more
2854 * informative than the local interface that is being used
2856 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
2857 dest
= &oi
->vl_data
->peer_addr
;
2859 dest
= &oi
->connected
->destination
->u
.prefix4
;
2861 vty_out (vty
, " %s %s,", dstr
, inet_ntoa (*dest
));
2864 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
2867 vty_out (vty
, " MTU mismatch detection:%s%s",
2868 OSPF_IF_PARAM(oi
, mtu_ignore
) ? "disabled" : "enabled", VTY_NEWLINE
);
2870 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
2871 inet_ntoa (ospf
->router_id
), ospf_network_type_str
[oi
->type
],
2872 oi
->output_cost
, VTY_NEWLINE
);
2874 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
2875 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
2876 PRIORITY (oi
), VTY_NEWLINE
);
2878 /* Show DR information. */
2879 if (DR (oi
).s_addr
== 0)
2880 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2883 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &DR (oi
));
2885 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2888 vty_out (vty
, " Designated Router (ID) %s,",
2889 inet_ntoa (nbr
->router_id
));
2890 vty_out (vty
, " Interface Address %s%s",
2891 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2895 /* Show BDR information. */
2896 if (BDR (oi
).s_addr
== 0)
2897 vty_out (vty
, " No backup designated router on this network%s",
2901 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
2903 vty_out (vty
, " No backup designated router on this network%s",
2907 vty_out (vty
, " Backup Designated Router (ID) %s,",
2908 inet_ntoa (nbr
->router_id
));
2909 vty_out (vty
, " Interface Address %s%s",
2910 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2914 vty_out (vty
, " Multicast group memberships:");
2915 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
)
2916 || OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
2918 if (OI_MEMBER_CHECK(oi
, MEMBER_ALLROUTERS
))
2919 vty_out (vty
, " OSPFAllRouters");
2920 if (OI_MEMBER_CHECK(oi
, MEMBER_DROUTERS
))
2921 vty_out (vty
, " OSPFDesignatedRouters");
2924 vty_out (vty
, " <None>");
2925 vty_out (vty
, "%s", VTY_NEWLINE
);
2927 vty_out (vty
, " Timer intervals configured,");
2928 vty_out (vty
, " Hello ");
2929 if (OSPF_IF_PARAM (oi
, fast_hello
) == 0)
2930 vty_out (vty
, "%ds,", OSPF_IF_PARAM (oi
, v_hello
));
2932 vty_out (vty
, "%dms,", 1000 / OSPF_IF_PARAM (oi
, fast_hello
));
2933 vty_out (vty
, " Dead %ds, Wait %ds, Retransmit %d%s",
2934 OSPF_IF_PARAM (oi
, v_wait
),
2935 OSPF_IF_PARAM (oi
, v_wait
),
2936 OSPF_IF_PARAM (oi
, retransmit_interval
),
2939 if (OSPF_IF_PASSIVE_STATUS (oi
) == OSPF_IF_ACTIVE
)
2941 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2942 vty_out (vty
, " Hello due in %s%s",
2943 ospf_timer_dump (oi
->t_hello
, timebuf
, sizeof(timebuf
)),
2946 else /* passive-interface is set */
2947 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
2949 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
2950 ospf_nbr_count (oi
, 0), ospf_nbr_count (oi
, NSM_Full
),
2955 DEFUN (show_ip_ospf_interface
,
2956 show_ip_ospf_interface_cmd
,
2957 "show ip ospf interface [INTERFACE]",
2960 "OSPF information\n"
2961 "Interface information\n"
2964 struct interface
*ifp
;
2966 struct listnode
*node
;
2968 ospf
= ospf_lookup ();
2971 vty_out (vty
, "OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2975 /* Show All Interfaces. */
2977 for (ALL_LIST_ELEMENTS_RO (iflist
, node
, ifp
))
2978 show_ip_ospf_interface_sub (vty
, ospf
, ifp
);
2979 /* Interface name is specified. */
2982 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
2983 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
2985 show_ip_ospf_interface_sub (vty
, ospf
, ifp
);
2992 show_ip_ospf_neighbour_header (struct vty
*vty
)
2994 vty_out (vty
, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
2996 "Neighbor ID", "Pri", "State", "Dead Time",
2997 "Address", "Interface", "RXmtL", "RqstL", "DBsmL",
3002 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
)
3004 struct route_node
*rn
;
3005 struct ospf_neighbor
*nbr
;
3007 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3009 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3010 if ((nbr
= rn
->info
))
3011 /* Do not show myself. */
3012 if (nbr
!= oi
->nbr_self
)
3013 /* Down state is not shown. */
3014 if (nbr
->state
!= NSM_Down
)
3016 ospf_nbr_state_message (nbr
, msgbuf
, 16);
3018 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
3019 vty_out (vty
, "%-15s %3d %-15s ",
3023 vty_out (vty
, "%-15s %3d %-15s ",
3024 inet_ntoa (nbr
->router_id
), nbr
->priority
,
3027 vty_out (vty
, "%9s ",
3028 ospf_timer_dump (nbr
->t_inactivity
, timebuf
,
3031 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
3032 vty_out (vty
, "%-20s %5ld %5ld %5d%s",
3033 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
3034 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
3039 DEFUN (show_ip_ospf_neighbor
,
3040 show_ip_ospf_neighbor_cmd
,
3041 "show ip ospf neighbor",
3044 "OSPF information\n"
3048 struct ospf_interface
*oi
;
3049 struct listnode
*node
;
3051 ospf
= ospf_lookup ();
3054 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3058 show_ip_ospf_neighbour_header (vty
);
3060 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3061 show_ip_ospf_neighbor_sub (vty
, oi
);
3066 DEFUN (show_ip_ospf_neighbor_all
,
3067 show_ip_ospf_neighbor_all_cmd
,
3068 "show ip ospf neighbor all",
3071 "OSPF information\n"
3073 "include down status neighbor\n")
3075 struct ospf
*ospf
= ospf_lookup ();
3076 struct listnode
*node
;
3077 struct ospf_interface
*oi
;
3081 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3085 show_ip_ospf_neighbour_header (vty
);
3087 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3089 struct listnode
*nbr_node
;
3090 struct ospf_nbr_nbma
*nbr_nbma
;
3092 show_ip_ospf_neighbor_sub (vty
, oi
);
3094 /* print Down neighbor status */
3095 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nbr_node
, nbr_nbma
))
3097 if (nbr_nbma
->nbr
== NULL
3098 || nbr_nbma
->nbr
->state
== NSM_Down
)
3100 vty_out (vty
, "%-15s %3d %-15s %9s ",
3101 "-", nbr_nbma
->priority
, "Down", "-");
3102 vty_out (vty
, "%-15s %-20s %5d %5d %5d%s",
3103 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
3104 0, 0, 0, VTY_NEWLINE
);
3112 DEFUN (show_ip_ospf_neighbor_int
,
3113 show_ip_ospf_neighbor_int_cmd
,
3114 "show ip ospf neighbor IFNAME",
3117 "OSPF information\n"
3122 struct interface
*ifp
;
3123 struct route_node
*rn
;
3125 ifp
= if_lookup_by_name (argv
[0]);
3128 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
3132 ospf
= ospf_lookup ();
3135 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3139 show_ip_ospf_neighbour_header (vty
);
3141 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
3143 struct ospf_interface
*oi
= rn
->info
;
3148 show_ip_ospf_neighbor_sub (vty
, oi
);
3155 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
3156 struct ospf_nbr_nbma
*nbr_nbma
)
3158 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3160 /* Show neighbor ID. */
3161 vty_out (vty
, " Neighbor %s,", "-");
3163 /* Show interface address. */
3164 vty_out (vty
, " interface address %s%s",
3165 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
3167 vty_out (vty
, " In the area %s via interface %s%s",
3168 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
3169 /* Show neighbor priority and state. */
3170 vty_out (vty
, " Neighbor priority is %d, State is %s,",
3171 nbr_nbma
->priority
, "Down");
3172 /* Show state changes. */
3173 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
3175 /* Show PollInterval */
3176 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
3178 /* Show poll-interval timer. */
3179 vty_out (vty
, " Poll timer due in %s%s",
3180 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, sizeof(timebuf
)),
3183 /* Show poll-interval timer thread. */
3184 vty_out (vty
, " Thread Poll Timer %s%s",
3185 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
3189 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
3190 struct ospf_neighbor
*nbr
)
3192 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3194 /* Show neighbor ID. */
3195 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
3196 vty_out (vty
, " Neighbor %s,", "-");
3198 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
3200 /* Show interface address. */
3201 vty_out (vty
, " interface address %s%s",
3202 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
3204 vty_out (vty
, " In the area %s via interface %s%s",
3205 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
3206 /* Show neighbor priority and state. */
3207 vty_out (vty
, " Neighbor priority is %d, State is %s,",
3208 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
3209 /* Show state changes. */
3210 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
3211 if (nbr
->ts_last_progress
.tv_sec
|| nbr
->ts_last_progress
.tv_usec
)
3214 = tv_sub (recent_relative_time (), nbr
->ts_last_progress
);
3215 vty_out (vty
, " Most recent state change statistics:%s",
3217 vty_out (vty
, " Progressive change %s ago%s",
3218 ospf_timeval_dump (&res
, timebuf
, sizeof(timebuf
)),
3221 if (nbr
->ts_last_regress
.tv_sec
|| nbr
->ts_last_regress
.tv_usec
)
3224 = tv_sub (recent_relative_time (), nbr
->ts_last_regress
);
3225 vty_out (vty
, " Regressive change %s ago, due to %s%s",
3226 ospf_timeval_dump (&res
, timebuf
, sizeof(timebuf
)),
3227 (nbr
->last_regress_str
? nbr
->last_regress_str
: "??"),
3230 /* Show Designated Rotuer ID. */
3231 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
3232 /* Show Backup Designated Rotuer ID. */
3233 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
3235 vty_out (vty
, " Options %d %s%s", nbr
->options
,
3236 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
3237 /* Show Router Dead interval timer. */
3238 vty_out (vty
, " Dead timer due in %s%s",
3239 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, sizeof (timebuf
)),
3241 /* Show Database Summary list. */
3242 vty_out (vty
, " Database Summary List %d%s",
3243 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
3244 /* Show Link State Request list. */
3245 vty_out (vty
, " Link State Request List %ld%s",
3246 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
3247 /* Show Link State Retransmission list. */
3248 vty_out (vty
, " Link State Retransmission List %ld%s",
3249 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
3250 /* Show inactivity timer thread. */
3251 vty_out (vty
, " Thread Inactivity Timer %s%s",
3252 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
3253 /* Show Database Description retransmission thread. */
3254 vty_out (vty
, " Thread Database Description Retransmision %s%s",
3255 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
3256 /* Show Link State Request Retransmission thread. */
3257 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
3258 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
3259 /* Show Link State Update Retransmission thread. */
3260 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
3261 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
3264 DEFUN (show_ip_ospf_neighbor_id
,
3265 show_ip_ospf_neighbor_id_cmd
,
3266 "show ip ospf neighbor A.B.C.D",
3269 "OSPF information\n"
3274 struct listnode
*node
;
3275 struct ospf_neighbor
*nbr
;
3276 struct ospf_interface
*oi
;
3277 struct in_addr router_id
;
3280 ret
= inet_aton (argv
[0], &router_id
);
3283 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
3287 ospf
= ospf_lookup ();
3290 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3294 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3295 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
3296 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3301 DEFUN (show_ip_ospf_neighbor_detail
,
3302 show_ip_ospf_neighbor_detail_cmd
,
3303 "show ip ospf neighbor detail",
3306 "OSPF information\n"
3308 "detail of all neighbors\n")
3311 struct ospf_interface
*oi
;
3312 struct listnode
*node
;
3314 ospf
= ospf_lookup ();
3317 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3321 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3323 struct route_node
*rn
;
3324 struct ospf_neighbor
*nbr
;
3326 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3327 if ((nbr
= rn
->info
))
3328 if (nbr
!= oi
->nbr_self
)
3329 if (nbr
->state
!= NSM_Down
)
3330 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3336 DEFUN (show_ip_ospf_neighbor_detail_all
,
3337 show_ip_ospf_neighbor_detail_all_cmd
,
3338 "show ip ospf neighbor detail all",
3341 "OSPF information\n"
3343 "detail of all neighbors\n"
3344 "include down status neighbor\n")
3347 struct listnode
*node
;
3348 struct ospf_interface
*oi
;
3350 ospf
= ospf_lookup ();
3353 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3357 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3359 struct route_node
*rn
;
3360 struct ospf_neighbor
*nbr
;
3361 struct ospf_nbr_nbma
*nbr_nbma
;
3363 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3364 if ((nbr
= rn
->info
))
3365 if (nbr
!= oi
->nbr_self
)
3366 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
3367 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
);
3369 if (oi
->type
== OSPF_IFTYPE_NBMA
)
3371 struct listnode
*nd
;
3373 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nd
, nbr_nbma
))
3374 if (nbr_nbma
->nbr
== NULL
3375 || nbr_nbma
->nbr
->state
== NSM_Down
)
3376 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
);
3383 DEFUN (show_ip_ospf_neighbor_int_detail
,
3384 show_ip_ospf_neighbor_int_detail_cmd
,
3385 "show ip ospf neighbor IFNAME detail",
3388 "OSPF information\n"
3391 "detail of all neighbors")
3394 struct ospf_interface
*oi
;
3395 struct interface
*ifp
;
3396 struct route_node
*rn
, *nrn
;
3397 struct ospf_neighbor
*nbr
;
3399 ifp
= if_lookup_by_name (argv
[0]);
3402 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
3406 ospf
= ospf_lookup ();
3409 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3414 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
3415 if ((oi
= rn
->info
))
3416 for (nrn
= route_top (oi
->nbrs
); nrn
; nrn
= route_next (nrn
))
3417 if ((nbr
= nrn
->info
))
3418 if (nbr
!= oi
->nbr_self
)
3419 if (nbr
->state
!= NSM_Down
)
3420 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3426 /* Show functions */
3428 show_lsa_summary (struct vty
*vty
, struct ospf_lsa
*lsa
, int self
)
3430 struct router_lsa
*rl
;
3431 struct summary_lsa
*sl
;
3432 struct as_external_lsa
*asel
;
3433 struct prefix_ipv4 p
;
3436 /* If self option is set, check LSA self flag. */
3437 if (self
== 0 || IS_LSA_SELF (lsa
))
3439 /* LSA common part show. */
3440 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
3441 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
3442 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
3443 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
3444 /* LSA specific part show. */
3445 switch (lsa
->data
->type
)
3447 case OSPF_ROUTER_LSA
:
3448 rl
= (struct router_lsa
*) lsa
->data
;
3449 vty_out (vty
, " %-d", ntohs (rl
->links
));
3451 case OSPF_SUMMARY_LSA
:
3452 sl
= (struct summary_lsa
*) lsa
->data
;
3455 p
.prefix
= sl
->header
.id
;
3456 p
.prefixlen
= ip_masklen (sl
->mask
);
3457 apply_mask_ipv4 (&p
);
3459 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
3461 case OSPF_AS_EXTERNAL_LSA
:
3462 case OSPF_AS_NSSA_LSA
:
3463 asel
= (struct as_external_lsa
*) lsa
->data
;
3466 p
.prefix
= asel
->header
.id
;
3467 p
.prefixlen
= ip_masklen (asel
->mask
);
3468 apply_mask_ipv4 (&p
);
3470 vty_out (vty
, " %s %s/%d [0x%lx]",
3471 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
3472 inet_ntoa (p
.prefix
), p
.prefixlen
,
3473 (u_long
)ntohl (asel
->e
[0].route_tag
));
3475 case OSPF_NETWORK_LSA
:
3476 case OSPF_ASBR_SUMMARY_LSA
:
3477 #ifdef HAVE_OPAQUE_LSA
3478 case OSPF_OPAQUE_LINK_LSA
:
3479 case OSPF_OPAQUE_AREA_LSA
:
3480 case OSPF_OPAQUE_AS_LSA
:
3481 #endif /* HAVE_OPAQUE_LSA */
3485 vty_out (vty
, VTY_NEWLINE
);
3491 static const char *show_database_desc
[] =
3494 "Router Link States",
3496 "Summary Link States",
3497 "ASBR-Summary Link States",
3498 "AS External Link States",
3499 "Group Membership LSA",
3500 "NSSA-external Link States",
3501 #ifdef HAVE_OPAQUE_LSA
3503 "Link-Local Opaque-LSA",
3504 "Area-Local Opaque-LSA",
3505 "AS-external Opaque-LSA",
3506 #endif /* HAVE_OPAQUE_LSA */
3509 static const char *show_database_header
[] =
3512 "Link ID ADV Router Age Seq# CkSum Link count",
3513 "Link ID ADV Router Age Seq# CkSum",
3514 "Link ID ADV Router Age Seq# CkSum Route",
3515 "Link ID ADV Router Age Seq# CkSum",
3516 "Link ID ADV Router Age Seq# CkSum Route",
3517 " --- header for Group Member ----",
3518 "Link ID ADV Router Age Seq# CkSum Route",
3519 #ifdef HAVE_OPAQUE_LSA
3521 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3522 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3523 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3524 #endif /* HAVE_OPAQUE_LSA */
3528 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
3530 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
3532 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
3533 vty_out (vty
, " Options: 0x%-2x : %s%s",
3535 ospf_options_dump(lsa
->data
->options
),
3537 vty_out (vty
, " LS Flags: 0x%-2x %s%s",
3539 ((lsa
->flags
& OSPF_LSA_LOCAL_XLT
) ? "(Translated from Type-7)" : ""),
3542 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
3544 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
3547 vty_out (vty
, " :%s%s%s%s",
3548 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
3549 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
3550 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
3551 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
3553 vty_out (vty
, "%s", VTY_NEWLINE
);
3555 vty_out (vty
, " LS Type: %s%s",
3556 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3557 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
3558 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3559 vty_out (vty
, " Advertising Router: %s%s",
3560 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3561 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
3563 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
3565 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
3568 const char *link_type_desc
[] =
3571 "another Router (point-to-point)",
3572 "a Transit Network",
3577 const char *link_id_desc
[] =
3580 "Neighboring Router ID",
3581 "Designated Router address",
3583 "Neighboring Router ID",
3586 const char *link_data_desc
[] =
3589 "Router Interface address",
3590 "Router Interface address",
3592 "Router Interface address",
3595 /* Show router-LSA each Link information. */
3597 show_ip_ospf_database_router_links (struct vty
*vty
,
3598 struct router_lsa
*rl
)
3602 len
= ntohs (rl
->header
.length
) - 4;
3603 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
3605 type
= rl
->link
[i
].type
;
3607 vty_out (vty
, " Link connected to: %s%s",
3608 link_type_desc
[type
], VTY_NEWLINE
);
3609 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
3610 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
3611 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
3612 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
3613 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
3614 vty_out (vty
, " TOS 0 Metric: %d%s",
3615 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
3616 vty_out (vty
, "%s", VTY_NEWLINE
);
3620 /* Show router-LSA detail information. */
3622 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3626 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
3628 show_ip_ospf_database_header (vty
, lsa
);
3630 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
3631 VTY_NEWLINE
, VTY_NEWLINE
);
3633 show_ip_ospf_database_router_links (vty
, rl
);
3634 vty_out (vty
, "%s", VTY_NEWLINE
);
3640 /* Show network-LSA detail information. */
3642 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3648 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
3650 show_ip_ospf_database_header (vty
, lsa
);
3652 vty_out (vty
, " Network Mask: /%d%s",
3653 ip_masklen (nl
->mask
), VTY_NEWLINE
);
3655 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
3657 for (i
= 0; length
> 0; i
++, length
-= 4)
3658 vty_out (vty
, " Attached Router: %s%s",
3659 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
3661 vty_out (vty
, "%s", VTY_NEWLINE
);
3667 /* Show summary-LSA detail information. */
3669 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3673 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3675 show_ip_ospf_database_header (vty
, lsa
);
3677 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
3679 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3681 vty_out (vty
, "%s", VTY_NEWLINE
);
3687 /* Show summary-ASBR-LSA detail information. */
3689 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3693 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3695 show_ip_ospf_database_header (vty
, lsa
);
3697 vty_out (vty
, " Network Mask: /%d%s",
3698 ip_masklen (sl
->mask
), VTY_NEWLINE
);
3699 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3701 vty_out (vty
, "%s", VTY_NEWLINE
);
3707 /* Show AS-external-LSA detail information. */
3709 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3713 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3715 show_ip_ospf_database_header (vty
, lsa
);
3717 vty_out (vty
, " Network Mask: /%d%s",
3718 ip_masklen (al
->mask
), VTY_NEWLINE
);
3719 vty_out (vty
, " Metric Type: %s%s",
3720 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3721 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3722 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3723 vty_out (vty
, " Metric: %d%s",
3724 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3725 vty_out (vty
, " Forward Address: %s%s",
3726 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3728 vty_out (vty
, " External Route Tag: %lu%s%s",
3729 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3737 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
3739 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3741 /* show_ip_ospf_database_header (vty, lsa); */
3743 zlog_debug( " Network Mask: /%d%s",
3744 ip_masklen (al
->mask
), "\n");
3745 zlog_debug( " Metric Type: %s%s",
3746 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3747 "2 (Larger than any link state path)" : "1", "\n");
3748 zlog_debug( " TOS: 0%s", "\n");
3749 zlog_debug( " Metric: %d%s",
3750 GET_METRIC (al
->e
[0].metric
), "\n");
3751 zlog_debug( " Forward Address: %s%s",
3752 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
3754 zlog_debug( " External Route Tag: %u%s%s",
3755 ntohl (al
->e
[0].route_tag
), "\n", "\n");
3761 /* Show AS-NSSA-LSA detail information. */
3763 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3767 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3769 show_ip_ospf_database_header (vty
, lsa
);
3771 vty_out (vty
, " Network Mask: /%d%s",
3772 ip_masklen (al
->mask
), VTY_NEWLINE
);
3773 vty_out (vty
, " Metric Type: %s%s",
3774 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3775 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3776 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3777 vty_out (vty
, " Metric: %d%s",
3778 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3779 vty_out (vty
, " NSSA: Forward Address: %s%s",
3780 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3782 vty_out (vty
, " External Route Tag: %u%s%s",
3783 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3790 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
3795 #ifdef HAVE_OPAQUE_LSA
3797 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3801 show_ip_ospf_database_header (vty
, lsa
);
3802 show_opaque_info_detail (vty
, lsa
);
3804 vty_out (vty
, "%s", VTY_NEWLINE
);
3808 #endif /* HAVE_OPAQUE_LSA */
3810 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
3813 show_router_lsa_detail
,
3814 show_network_lsa_detail
,
3815 show_summary_lsa_detail
,
3816 show_summary_asbr_lsa_detail
,
3817 show_as_external_lsa_detail
,
3819 show_as_nssa_lsa_detail
, /* almost same as external */
3820 #ifdef HAVE_OPAQUE_LSA
3822 show_opaque_lsa_detail
,
3823 show_opaque_lsa_detail
,
3824 show_opaque_lsa_detail
,
3825 #endif /* HAVE_OPAQUE_LSA */
3829 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
3830 struct in_addr
*adv_router
)
3832 memset (lp
, 0, sizeof (struct prefix_ls
));
3836 else if (adv_router
== NULL
)
3845 lp
->adv_router
= *adv_router
;
3850 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
3851 struct in_addr
*id
, struct in_addr
*adv_router
)
3853 struct prefix_ls lp
;
3854 struct route_node
*rn
, *start
;
3855 struct ospf_lsa
*lsa
;
3857 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
3858 start
= route_node_get (rt
, (struct prefix
*) &lp
);
3861 route_lock_node (start
);
3862 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
3863 if ((lsa
= rn
->info
))
3865 if (show_function
[lsa
->data
->type
] != NULL
)
3866 show_function
[lsa
->data
->type
] (vty
, lsa
);
3868 route_unlock_node (start
);
3872 /* Show detail LSA information
3873 -- if id is NULL then show all LSAs. */
3875 show_lsa_detail (struct vty
*vty
, struct ospf
*ospf
, int type
,
3876 struct in_addr
*id
, struct in_addr
*adv_router
)
3878 struct listnode
*node
;
3879 struct ospf_area
*area
;
3883 case OSPF_AS_EXTERNAL_LSA
:
3884 #ifdef HAVE_OPAQUE_LSA
3885 case OSPF_OPAQUE_AS_LSA
:
3886 #endif /* HAVE_OPAQUE_LSA */
3887 vty_out (vty
, " %s %s%s",
3888 show_database_desc
[type
],
3889 VTY_NEWLINE
, VTY_NEWLINE
);
3890 show_lsa_detail_proc (vty
, AS_LSDB (ospf
, type
), id
, adv_router
);
3893 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
3895 vty_out (vty
, "%s %s (Area %s)%s%s",
3896 VTY_NEWLINE
, show_database_desc
[type
],
3897 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3898 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
3905 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
3906 struct in_addr
*adv_router
)
3908 struct route_node
*rn
;
3909 struct ospf_lsa
*lsa
;
3911 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
3912 if ((lsa
= rn
->info
))
3913 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
3915 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3917 if (show_function
[lsa
->data
->type
] != NULL
)
3918 show_function
[lsa
->data
->type
] (vty
, lsa
);
3922 /* Show detail LSA information. */
3924 show_lsa_detail_adv_router (struct vty
*vty
, struct ospf
*ospf
, int type
,
3925 struct in_addr
*adv_router
)
3927 struct listnode
*node
;
3928 struct ospf_area
*area
;
3932 case OSPF_AS_EXTERNAL_LSA
:
3933 #ifdef HAVE_OPAQUE_LSA
3934 case OSPF_OPAQUE_AS_LSA
:
3935 #endif /* HAVE_OPAQUE_LSA */
3936 vty_out (vty
, " %s %s%s",
3937 show_database_desc
[type
],
3938 VTY_NEWLINE
, VTY_NEWLINE
);
3939 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf
, type
),
3943 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
3945 vty_out (vty
, "%s %s (Area %s)%s%s",
3946 VTY_NEWLINE
, show_database_desc
[type
],
3947 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3948 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
3956 show_ip_ospf_database_summary (struct vty
*vty
, struct ospf
*ospf
, int self
)
3958 struct ospf_lsa
*lsa
;
3959 struct route_node
*rn
;
3960 struct ospf_area
*area
;
3961 struct listnode
*node
;
3964 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
3966 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3970 case OSPF_AS_EXTERNAL_LSA
:
3971 #ifdef HAVE_OPAQUE_LSA
3972 case OSPF_OPAQUE_AS_LSA
:
3973 #endif /* HAVE_OPAQUE_LSA */
3978 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
3979 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
3981 vty_out (vty
, " %s (Area %s)%s%s",
3982 show_database_desc
[type
],
3983 ospf_area_desc_string (area
),
3984 VTY_NEWLINE
, VTY_NEWLINE
);
3985 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
3987 LSDB_LOOP (AREA_LSDB (area
, type
), rn
, lsa
)
3988 show_lsa_summary (vty
, lsa
, self
);
3990 vty_out (vty
, "%s", VTY_NEWLINE
);
3995 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3999 case OSPF_AS_EXTERNAL_LSA
:
4000 #ifdef HAVE_OPAQUE_LSA
4001 case OSPF_OPAQUE_AS_LSA
:
4002 #endif /* HAVE_OPAQUE_LSA */
4007 if (ospf_lsdb_count_self (ospf
->lsdb
, type
) ||
4008 (!self
&& ospf_lsdb_count (ospf
->lsdb
, type
)))
4010 vty_out (vty
, " %s%s%s",
4011 show_database_desc
[type
],
4012 VTY_NEWLINE
, VTY_NEWLINE
);
4013 vty_out (vty
, "%s%s", show_database_header
[type
],
4016 LSDB_LOOP (AS_LSDB (ospf
, type
), rn
, lsa
)
4017 show_lsa_summary (vty
, lsa
, self
);
4019 vty_out (vty
, "%s", VTY_NEWLINE
);
4023 vty_out (vty
, "%s", VTY_NEWLINE
);
4027 show_ip_ospf_database_maxage (struct vty
*vty
, struct ospf
*ospf
)
4029 struct listnode
*node
;
4030 struct ospf_lsa
*lsa
;
4032 vty_out (vty
, "%s MaxAge Link States:%s%s",
4033 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
4035 for (ALL_LIST_ELEMENTS_RO (ospf
->maxage_lsa
, node
, lsa
))
4037 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
4038 vty_out (vty
, "Link State ID: %s%s",
4039 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
4040 vty_out (vty
, "Advertising Router: %s%s",
4041 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
4042 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
4043 vty_out (vty
, "%s", VTY_NEWLINE
);
4047 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
4048 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
4050 #ifdef HAVE_OPAQUE_LSA
4051 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
4052 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
4053 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
4054 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
4055 #else /* HAVE_OPAQUE_LSA */
4056 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
4057 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
4058 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
4059 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
4060 #endif /* HAVE_OPAQUE_LSA */
4062 #define OSPF_LSA_TYPES_CMD_STR \
4063 "asbr-summary|external|network|router|summary" \
4064 OSPF_LSA_TYPE_NSSA_CMD_STR \
4065 OSPF_LSA_TYPE_OPAQUE_CMD_STR
4067 #define OSPF_LSA_TYPES_DESC \
4068 "ASBR summary link states\n" \
4069 "External link states\n" \
4070 "Network link states\n" \
4071 "Router link states\n" \
4072 "Network summary link states\n" \
4073 OSPF_LSA_TYPE_NSSA_DESC \
4074 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
4075 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
4076 OSPF_LSA_TYPE_OPAQUE_AS_DESC
4078 DEFUN (show_ip_ospf_database
,
4079 show_ip_ospf_database_cmd
,
4080 "show ip ospf database",
4083 "OSPF information\n"
4084 "Database summary\n")
4088 struct in_addr id
, adv_router
;
4090 ospf
= ospf_lookup ();
4093 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
4097 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
4098 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
4103 show_ip_ospf_database_summary (vty
, ospf
, 0);
4107 /* Set database type to show. */
4108 if (strncmp (argv
[0], "r", 1) == 0)
4109 type
= OSPF_ROUTER_LSA
;
4110 else if (strncmp (argv
[0], "ne", 2) == 0)
4111 type
= OSPF_NETWORK_LSA
;
4112 else if (strncmp (argv
[0], "ns", 2) == 0)
4113 type
= OSPF_AS_NSSA_LSA
;
4114 else if (strncmp (argv
[0], "su", 2) == 0)
4115 type
= OSPF_SUMMARY_LSA
;
4116 else if (strncmp (argv
[0], "a", 1) == 0)
4117 type
= OSPF_ASBR_SUMMARY_LSA
;
4118 else if (strncmp (argv
[0], "e", 1) == 0)
4119 type
= OSPF_AS_EXTERNAL_LSA
;
4120 else if (strncmp (argv
[0], "se", 2) == 0)
4122 show_ip_ospf_database_summary (vty
, ospf
, 1);
4125 else if (strncmp (argv
[0], "m", 1) == 0)
4127 show_ip_ospf_database_maxage (vty
, ospf
);
4130 #ifdef HAVE_OPAQUE_LSA
4131 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
4132 type
= OSPF_OPAQUE_LINK_LSA
;
4133 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
4134 type
= OSPF_OPAQUE_AREA_LSA
;
4135 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
4136 type
= OSPF_OPAQUE_AS_LSA
;
4137 #endif /* HAVE_OPAQUE_LSA */
4141 /* `show ip ospf database LSA'. */
4143 show_lsa_detail (vty
, ospf
, type
, NULL
, NULL
);
4146 ret
= inet_aton (argv
[1], &id
);
4150 /* `show ip ospf database LSA ID'. */
4152 show_lsa_detail (vty
, ospf
, type
, &id
, NULL
);
4153 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
4156 if (strncmp (argv
[2], "s", 1) == 0)
4157 adv_router
= ospf
->router_id
;
4160 ret
= inet_aton (argv
[2], &adv_router
);
4164 show_lsa_detail (vty
, ospf
, type
, &id
, &adv_router
);
4171 ALIAS (show_ip_ospf_database
,
4172 show_ip_ospf_database_type_cmd
,
4173 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
4176 "OSPF information\n"
4177 "Database summary\n"
4179 "LSAs in MaxAge list\n"
4180 "Self-originated link states\n")
4182 ALIAS (show_ip_ospf_database
,
4183 show_ip_ospf_database_type_id_cmd
,
4184 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
4187 "OSPF information\n"
4188 "Database summary\n"
4190 "Link State ID (as an IP address)\n")
4192 ALIAS (show_ip_ospf_database
,
4193 show_ip_ospf_database_type_id_adv_router_cmd
,
4194 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
4197 "OSPF information\n"
4198 "Database summary\n"
4200 "Link State ID (as an IP address)\n"
4201 "Advertising Router link states\n"
4202 "Advertising Router (as an IP address)\n")
4204 ALIAS (show_ip_ospf_database
,
4205 show_ip_ospf_database_type_id_self_cmd
,
4206 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
4209 "OSPF information\n"
4210 "Database summary\n"
4212 "Link State ID (as an IP address)\n"
4213 "Self-originated link states\n"
4216 DEFUN (show_ip_ospf_database_type_adv_router
,
4217 show_ip_ospf_database_type_adv_router_cmd
,
4218 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
4221 "OSPF information\n"
4222 "Database summary\n"
4224 "Advertising Router link states\n"
4225 "Advertising Router (as an IP address)\n")
4229 struct in_addr adv_router
;
4231 ospf
= ospf_lookup ();
4234 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
4238 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
4239 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
4244 /* Set database type to show. */
4245 if (strncmp (argv
[0], "r", 1) == 0)
4246 type
= OSPF_ROUTER_LSA
;
4247 else if (strncmp (argv
[0], "ne", 2) == 0)
4248 type
= OSPF_NETWORK_LSA
;
4249 else if (strncmp (argv
[0], "ns", 2) == 0)
4250 type
= OSPF_AS_NSSA_LSA
;
4251 else if (strncmp (argv
[0], "s", 1) == 0)
4252 type
= OSPF_SUMMARY_LSA
;
4253 else if (strncmp (argv
[0], "a", 1) == 0)
4254 type
= OSPF_ASBR_SUMMARY_LSA
;
4255 else if (strncmp (argv
[0], "e", 1) == 0)
4256 type
= OSPF_AS_EXTERNAL_LSA
;
4257 #ifdef HAVE_OPAQUE_LSA
4258 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
4259 type
= OSPF_OPAQUE_LINK_LSA
;
4260 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
4261 type
= OSPF_OPAQUE_AREA_LSA
;
4262 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
4263 type
= OSPF_OPAQUE_AS_LSA
;
4264 #endif /* HAVE_OPAQUE_LSA */
4268 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
4269 if (strncmp (argv
[1], "s", 1) == 0)
4270 adv_router
= ospf
->router_id
;
4273 ret
= inet_aton (argv
[1], &adv_router
);
4278 show_lsa_detail_adv_router (vty
, ospf
, type
, &adv_router
);
4283 ALIAS (show_ip_ospf_database_type_adv_router
,
4284 show_ip_ospf_database_type_self_cmd
,
4285 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
4288 "OSPF information\n"
4289 "Database summary\n"
4291 "Self-originated link states\n")
4294 DEFUN (ip_ospf_authentication_args
,
4295 ip_ospf_authentication_args_addr_cmd
,
4296 "ip ospf authentication (null|message-digest) A.B.C.D",
4298 "OSPF interface commands\n"
4299 "Enable authentication on this interface\n"
4300 "Use null authentication\n"
4301 "Use message-digest authentication\n"
4302 "Address of interface")
4304 struct interface
*ifp
;
4305 struct in_addr addr
;
4307 struct ospf_if_params
*params
;
4310 params
= IF_DEF_PARAMS (ifp
);
4314 ret
= inet_aton(argv
[1], &addr
);
4317 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4322 params
= ospf_get_if_params (ifp
, addr
);
4323 ospf_if_update_params (ifp
, addr
);
4326 /* Handle null authentication */
4327 if ( argv
[0][0] == 'n' )
4329 SET_IF_PARAM (params
, auth_type
);
4330 params
->auth_type
= OSPF_AUTH_NULL
;
4334 /* Handle message-digest authentication */
4335 if ( argv
[0][0] == 'm' )
4337 SET_IF_PARAM (params
, auth_type
);
4338 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
4342 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
4346 ALIAS (ip_ospf_authentication_args
,
4347 ip_ospf_authentication_args_cmd
,
4348 "ip ospf authentication (null|message-digest)",
4350 "OSPF interface commands\n"
4351 "Enable authentication on this interface\n"
4352 "Use null authentication\n"
4353 "Use message-digest authentication\n")
4355 DEFUN (ip_ospf_authentication
,
4356 ip_ospf_authentication_addr_cmd
,
4357 "ip ospf authentication A.B.C.D",
4359 "OSPF interface commands\n"
4360 "Enable authentication on this interface\n"
4361 "Address of interface")
4363 struct interface
*ifp
;
4364 struct in_addr addr
;
4366 struct ospf_if_params
*params
;
4369 params
= IF_DEF_PARAMS (ifp
);
4373 ret
= inet_aton(argv
[0], &addr
);
4376 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4381 params
= ospf_get_if_params (ifp
, addr
);
4382 ospf_if_update_params (ifp
, addr
);
4385 SET_IF_PARAM (params
, auth_type
);
4386 params
->auth_type
= OSPF_AUTH_SIMPLE
;
4391 ALIAS (ip_ospf_authentication
,
4392 ip_ospf_authentication_cmd
,
4393 "ip ospf authentication",
4395 "OSPF interface commands\n"
4396 "Enable authentication on this interface\n")
4398 DEFUN (no_ip_ospf_authentication
,
4399 no_ip_ospf_authentication_addr_cmd
,
4400 "no ip ospf authentication A.B.C.D",
4403 "OSPF interface commands\n"
4404 "Enable authentication on this interface\n"
4405 "Address of interface")
4407 struct interface
*ifp
;
4408 struct in_addr addr
;
4410 struct ospf_if_params
*params
;
4413 params
= IF_DEF_PARAMS (ifp
);
4417 ret
= inet_aton(argv
[0], &addr
);
4420 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4425 params
= ospf_lookup_if_params (ifp
, addr
);
4430 params
->auth_type
= OSPF_AUTH_NOTSET
;
4431 UNSET_IF_PARAM (params
, auth_type
);
4433 if (params
!= IF_DEF_PARAMS (ifp
))
4435 ospf_free_if_params (ifp
, addr
);
4436 ospf_if_update_params (ifp
, addr
);
4442 ALIAS (no_ip_ospf_authentication
,
4443 no_ip_ospf_authentication_cmd
,
4444 "no ip ospf authentication",
4447 "OSPF interface commands\n"
4448 "Enable authentication on this interface\n")
4450 DEFUN (ip_ospf_authentication_key
,
4451 ip_ospf_authentication_key_addr_cmd
,
4452 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4454 "OSPF interface commands\n"
4455 "Authentication password (key)\n"
4456 "The OSPF password (key)\n"
4457 "Address of interface")
4459 struct interface
*ifp
;
4460 struct in_addr addr
;
4462 struct ospf_if_params
*params
;
4465 params
= IF_DEF_PARAMS (ifp
);
4469 ret
= inet_aton(argv
[1], &addr
);
4472 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4477 params
= ospf_get_if_params (ifp
, addr
);
4478 ospf_if_update_params (ifp
, addr
);
4482 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
4483 strncpy ((char *) params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
4484 SET_IF_PARAM (params
, auth_simple
);
4489 ALIAS (ip_ospf_authentication_key
,
4490 ip_ospf_authentication_key_cmd
,
4491 "ip ospf authentication-key AUTH_KEY",
4493 "OSPF interface commands\n"
4494 "Authentication password (key)\n"
4495 "The OSPF password (key)")
4497 ALIAS (ip_ospf_authentication_key
,
4498 ospf_authentication_key_cmd
,
4499 "ospf authentication-key AUTH_KEY",
4500 "OSPF interface commands\n"
4501 "Authentication password (key)\n"
4502 "The OSPF password (key)")
4504 DEFUN (no_ip_ospf_authentication_key
,
4505 no_ip_ospf_authentication_key_addr_cmd
,
4506 "no ip ospf authentication-key A.B.C.D",
4509 "OSPF interface commands\n"
4510 "Authentication password (key)\n"
4511 "Address of interface")
4513 struct interface
*ifp
;
4514 struct in_addr addr
;
4516 struct ospf_if_params
*params
;
4519 params
= IF_DEF_PARAMS (ifp
);
4523 ret
= inet_aton(argv
[0], &addr
);
4526 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4531 params
= ospf_lookup_if_params (ifp
, addr
);
4536 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
4537 UNSET_IF_PARAM (params
, auth_simple
);
4539 if (params
!= IF_DEF_PARAMS (ifp
))
4541 ospf_free_if_params (ifp
, addr
);
4542 ospf_if_update_params (ifp
, addr
);
4548 ALIAS (no_ip_ospf_authentication_key
,
4549 no_ip_ospf_authentication_key_cmd
,
4550 "no ip ospf authentication-key",
4553 "OSPF interface commands\n"
4554 "Authentication password (key)\n")
4556 ALIAS (no_ip_ospf_authentication_key
,
4557 no_ospf_authentication_key_cmd
,
4558 "no ospf authentication-key",
4560 "OSPF interface commands\n"
4561 "Authentication password (key)\n")
4563 DEFUN (ip_ospf_message_digest_key
,
4564 ip_ospf_message_digest_key_addr_cmd
,
4565 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4567 "OSPF interface commands\n"
4568 "Message digest authentication password (key)\n"
4570 "Use MD5 algorithm\n"
4571 "The OSPF password (key)"
4572 "Address of interface")
4574 struct interface
*ifp
;
4575 struct crypt_key
*ck
;
4577 struct in_addr addr
;
4579 struct ospf_if_params
*params
;
4582 params
= IF_DEF_PARAMS (ifp
);
4586 ret
= inet_aton(argv
[2], &addr
);
4589 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4594 params
= ospf_get_if_params (ifp
, addr
);
4595 ospf_if_update_params (ifp
, addr
);
4598 key_id
= strtol (argv
[0], NULL
, 10);
4599 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
4601 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
4605 ck
= ospf_crypt_key_new ();
4606 ck
->key_id
= (u_char
) key_id
;
4607 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
4608 strncpy ((char *) ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
4610 ospf_crypt_key_add (params
->auth_crypt
, ck
);
4611 SET_IF_PARAM (params
, auth_crypt
);
4616 ALIAS (ip_ospf_message_digest_key
,
4617 ip_ospf_message_digest_key_cmd
,
4618 "ip ospf message-digest-key <1-255> md5 KEY",
4620 "OSPF interface commands\n"
4621 "Message digest authentication password (key)\n"
4623 "Use MD5 algorithm\n"
4624 "The OSPF password (key)")
4626 ALIAS (ip_ospf_message_digest_key
,
4627 ospf_message_digest_key_cmd
,
4628 "ospf message-digest-key <1-255> md5 KEY",
4629 "OSPF interface commands\n"
4630 "Message digest authentication password (key)\n"
4632 "Use MD5 algorithm\n"
4633 "The OSPF password (key)")
4635 DEFUN (no_ip_ospf_message_digest_key
,
4636 no_ip_ospf_message_digest_key_addr_cmd
,
4637 "no ip ospf message-digest-key <1-255> A.B.C.D",
4640 "OSPF interface commands\n"
4641 "Message digest authentication password (key)\n"
4643 "Address of interface")
4645 struct interface
*ifp
;
4646 struct crypt_key
*ck
;
4648 struct in_addr addr
;
4650 struct ospf_if_params
*params
;
4653 params
= IF_DEF_PARAMS (ifp
);
4657 ret
= inet_aton(argv
[1], &addr
);
4660 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4665 params
= ospf_lookup_if_params (ifp
, addr
);
4670 key_id
= strtol (argv
[0], NULL
, 10);
4671 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
4674 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
4678 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
4680 if (params
!= IF_DEF_PARAMS (ifp
))
4682 ospf_free_if_params (ifp
, addr
);
4683 ospf_if_update_params (ifp
, addr
);
4689 ALIAS (no_ip_ospf_message_digest_key
,
4690 no_ip_ospf_message_digest_key_cmd
,
4691 "no ip ospf message-digest-key <1-255>",
4694 "OSPF interface commands\n"
4695 "Message digest authentication password (key)\n"
4698 ALIAS (no_ip_ospf_message_digest_key
,
4699 no_ospf_message_digest_key_cmd
,
4700 "no ospf message-digest-key <1-255>",
4702 "OSPF interface commands\n"
4703 "Message digest authentication password (key)\n"
4706 DEFUN (ip_ospf_cost
,
4707 ip_ospf_cost_u32_inet4_cmd
,
4708 "ip ospf cost <1-65535> A.B.C.D",
4710 "OSPF interface commands\n"
4713 "Address of interface")
4715 struct interface
*ifp
= vty
->index
;
4717 struct in_addr addr
;
4719 struct ospf_if_params
*params
;
4721 params
= IF_DEF_PARAMS (ifp
);
4723 cost
= strtol (argv
[0], NULL
, 10);
4725 /* cost range is <1-65535>. */
4726 if (cost
< 1 || cost
> 65535)
4728 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4734 ret
= inet_aton(argv
[1], &addr
);
4737 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4742 params
= ospf_get_if_params (ifp
, addr
);
4743 ospf_if_update_params (ifp
, addr
);
4746 SET_IF_PARAM (params
, output_cost_cmd
);
4747 params
->output_cost_cmd
= cost
;
4749 ospf_if_recalculate_output_cost (ifp
);
4754 ALIAS (ip_ospf_cost
,
4755 ip_ospf_cost_u32_cmd
,
4756 "ip ospf cost <1-65535>",
4758 "OSPF interface commands\n"
4762 ALIAS (ip_ospf_cost
,
4764 "ospf cost <1-65535>",
4765 "OSPF interface commands\n"
4769 ALIAS (ip_ospf_cost
,
4770 ospf_cost_u32_inet4_cmd
,
4771 "ospf cost <1-65535> A.B.C.D",
4772 "OSPF interface commands\n"
4775 "Address of interface")
4777 DEFUN (no_ip_ospf_cost
,
4778 no_ip_ospf_cost_inet4_cmd
,
4779 "no ip ospf cost A.B.C.D",
4782 "OSPF interface commands\n"
4784 "Address of interface")
4786 struct interface
*ifp
= vty
->index
;
4787 struct in_addr addr
;
4789 struct ospf_if_params
*params
;
4792 params
= IF_DEF_PARAMS (ifp
);
4796 ret
= inet_aton(argv
[0], &addr
);
4799 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4804 params
= ospf_lookup_if_params (ifp
, addr
);
4809 UNSET_IF_PARAM (params
, output_cost_cmd
);
4811 if (params
!= IF_DEF_PARAMS (ifp
))
4813 ospf_free_if_params (ifp
, addr
);
4814 ospf_if_update_params (ifp
, addr
);
4817 ospf_if_recalculate_output_cost (ifp
);
4822 ALIAS (no_ip_ospf_cost
,
4823 no_ip_ospf_cost_cmd
,
4827 "OSPF interface commands\n"
4830 ALIAS (no_ip_ospf_cost
,
4834 "OSPF interface commands\n"
4837 ALIAS (no_ip_ospf_cost
,
4838 no_ospf_cost_inet4_cmd
,
4839 "no ospf cost A.B.C.D",
4841 "OSPF interface commands\n"
4843 "Address of interface")
4845 DEFUN (no_ip_ospf_cost2
,
4846 no_ip_ospf_cost_u32_cmd
,
4847 "no ip ospf cost <1-65535>",
4850 "OSPF interface commands\n"
4854 struct interface
*ifp
= vty
->index
;
4855 struct in_addr addr
;
4858 struct ospf_if_params
*params
;
4861 params
= IF_DEF_PARAMS (ifp
);
4863 /* According to the semantics we are mimicking "no ip ospf cost N" is
4864 * always treated as "no ip ospf cost" regardless of the actual value
4865 * of N already configured for the interface. Thus the first argument
4866 * is always checked to be a number, but is ignored after that.
4868 cost
= strtol (argv
[0], NULL
, 10);
4869 if (cost
< 1 || cost
> 65535)
4871 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4877 ret
= inet_aton(argv
[1], &addr
);
4880 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4885 params
= ospf_lookup_if_params (ifp
, addr
);
4890 UNSET_IF_PARAM (params
, output_cost_cmd
);
4892 if (params
!= IF_DEF_PARAMS (ifp
))
4894 ospf_free_if_params (ifp
, addr
);
4895 ospf_if_update_params (ifp
, addr
);
4898 ospf_if_recalculate_output_cost (ifp
);
4903 ALIAS (no_ip_ospf_cost2
,
4904 no_ospf_cost_u32_cmd
,
4905 "no ospf cost <1-65535>",
4907 "OSPF interface commands\n"
4911 ALIAS (no_ip_ospf_cost2
,
4912 no_ip_ospf_cost_u32_inet4_cmd
,
4913 "no ip ospf cost <1-65535> A.B.C.D",
4916 "OSPF interface commands\n"
4919 "Address of interface")
4921 ALIAS (no_ip_ospf_cost2
,
4922 no_ospf_cost_u32_inet4_cmd
,
4923 "no ospf cost <1-65535> A.B.C.D",
4925 "OSPF interface commands\n"
4928 "Address of interface")
4931 ospf_nbr_timer_update (struct ospf_interface
*oi
)
4933 struct route_node
*rn
;
4934 struct ospf_neighbor
*nbr
;
4936 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4937 if ((nbr
= rn
->info
))
4939 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
4940 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4941 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4942 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4947 ospf_vty_dead_interval_set (struct vty
*vty
, const char *interval_str
,
4948 const char *nbr_str
,
4949 const char *fast_hello_str
)
4951 struct interface
*ifp
= vty
->index
;
4954 struct in_addr addr
;
4956 struct ospf_if_params
*params
;
4957 struct ospf_interface
*oi
;
4958 struct route_node
*rn
;
4960 params
= IF_DEF_PARAMS (ifp
);
4964 ret
= inet_aton(nbr_str
, &addr
);
4967 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4972 params
= ospf_get_if_params (ifp
, addr
);
4973 ospf_if_update_params (ifp
, addr
);
4978 VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds
, interval_str
,
4981 /* reset fast_hello too, just to be sure */
4982 UNSET_IF_PARAM (params
, fast_hello
);
4983 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
4985 else if (fast_hello_str
)
4987 VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult
, fast_hello_str
,
4989 /* 1s dead-interval with sub-second hellos desired */
4990 seconds
= OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
;
4991 SET_IF_PARAM (params
, fast_hello
);
4992 params
->fast_hello
= hellomult
;
4996 vty_out (vty
, "Please specify dead-interval or hello-multiplier%s",
5001 SET_IF_PARAM (params
, v_wait
);
5002 params
->v_wait
= seconds
;
5004 /* Update timer values in neighbor structure. */
5008 if ((ospf
= ospf_lookup()))
5010 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
5012 ospf_nbr_timer_update (oi
);
5017 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5018 if ((oi
= rn
->info
))
5019 ospf_nbr_timer_update (oi
);
5026 DEFUN (ip_ospf_dead_interval
,
5027 ip_ospf_dead_interval_addr_cmd
,
5028 "ip ospf dead-interval <1-65535> A.B.C.D",
5030 "OSPF interface commands\n"
5031 "Interval after which a neighbor is declared dead\n"
5033 "Address of interface\n")
5036 return ospf_vty_dead_interval_set (vty
, argv
[0], argv
[1], NULL
);
5038 return ospf_vty_dead_interval_set (vty
, argv
[0], NULL
, NULL
);
5041 ALIAS (ip_ospf_dead_interval
,
5042 ip_ospf_dead_interval_cmd
,
5043 "ip ospf dead-interval <1-65535>",
5045 "OSPF interface commands\n"
5046 "Interval after which a neighbor is declared dead\n"
5049 ALIAS (ip_ospf_dead_interval
,
5050 ospf_dead_interval_cmd
,
5051 "ospf dead-interval <1-65535>",
5052 "OSPF interface commands\n"
5053 "Interval after which a neighbor is declared dead\n"
5056 DEFUN (ip_ospf_dead_interval_minimal
,
5057 ip_ospf_dead_interval_minimal_addr_cmd
,
5058 "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
5060 "OSPF interface commands\n"
5061 "Interval after which a neighbor is declared dead\n"
5062 "Minimal 1s dead-interval with fast sub-second hellos\n"
5063 "Hello multiplier factor\n"
5064 "Number of Hellos to send each second\n"
5065 "Address of interface\n")
5068 return ospf_vty_dead_interval_set (vty
, NULL
, argv
[1], argv
[0]);
5070 return ospf_vty_dead_interval_set (vty
, NULL
, NULL
, argv
[0]);
5073 ALIAS (ip_ospf_dead_interval_minimal
,
5074 ip_ospf_dead_interval_minimal_cmd
,
5075 "ip ospf dead-interval minimal hello-multiplier <1-10>",
5077 "OSPF interface commands\n"
5078 "Interval after which a neighbor is declared dead\n"
5079 "Minimal 1s dead-interval with fast sub-second hellos\n"
5080 "Hello multiplier factor\n"
5081 "Number of Hellos to send each second\n")
5083 DEFUN (no_ip_ospf_dead_interval
,
5084 no_ip_ospf_dead_interval_addr_cmd
,
5085 "no ip ospf dead-interval A.B.C.D",
5088 "OSPF interface commands\n"
5089 "Interval after which a neighbor is declared dead\n"
5090 "Address of interface")
5092 struct interface
*ifp
= vty
->index
;
5093 struct in_addr addr
;
5095 struct ospf_if_params
*params
;
5096 struct ospf_interface
*oi
;
5097 struct route_node
*rn
;
5100 params
= IF_DEF_PARAMS (ifp
);
5104 ret
= inet_aton(argv
[0], &addr
);
5107 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5112 params
= ospf_lookup_if_params (ifp
, addr
);
5117 UNSET_IF_PARAM (params
, v_wait
);
5118 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
5120 UNSET_IF_PARAM (params
, fast_hello
);
5121 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
5123 if (params
!= IF_DEF_PARAMS (ifp
))
5125 ospf_free_if_params (ifp
, addr
);
5126 ospf_if_update_params (ifp
, addr
);
5129 /* Update timer values in neighbor structure. */
5134 if ((ospf
= ospf_lookup()))
5136 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
5138 ospf_nbr_timer_update (oi
);
5143 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5144 if ((oi
= rn
->info
))
5145 ospf_nbr_timer_update (oi
);
5151 ALIAS (no_ip_ospf_dead_interval
,
5152 no_ip_ospf_dead_interval_cmd
,
5153 "no ip ospf dead-interval",
5156 "OSPF interface commands\n"
5157 "Interval after which a neighbor is declared dead\n")
5159 ALIAS (no_ip_ospf_dead_interval
,
5160 no_ospf_dead_interval_cmd
,
5161 "no ospf dead-interval",
5163 "OSPF interface commands\n"
5164 "Interval after which a neighbor is declared dead\n")
5166 DEFUN (ip_ospf_hello_interval
,
5167 ip_ospf_hello_interval_addr_cmd
,
5168 "ip ospf hello-interval <1-65535> A.B.C.D",
5170 "OSPF interface commands\n"
5171 "Time between HELLO packets\n"
5173 "Address of interface")
5175 struct interface
*ifp
= vty
->index
;
5177 struct in_addr addr
;
5179 struct ospf_if_params
*params
;
5181 params
= IF_DEF_PARAMS (ifp
);
5183 seconds
= strtol (argv
[0], NULL
, 10);
5185 /* HelloInterval range is <1-65535>. */
5186 if (seconds
< 1 || seconds
> 65535)
5188 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
5194 ret
= inet_aton(argv
[1], &addr
);
5197 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5202 params
= ospf_get_if_params (ifp
, addr
);
5203 ospf_if_update_params (ifp
, addr
);
5206 SET_IF_PARAM (params
, v_hello
);
5207 params
->v_hello
= seconds
;
5212 ALIAS (ip_ospf_hello_interval
,
5213 ip_ospf_hello_interval_cmd
,
5214 "ip ospf hello-interval <1-65535>",
5216 "OSPF interface commands\n"
5217 "Time between HELLO packets\n"
5220 ALIAS (ip_ospf_hello_interval
,
5221 ospf_hello_interval_cmd
,
5222 "ospf hello-interval <1-65535>",
5223 "OSPF interface commands\n"
5224 "Time between HELLO packets\n"
5227 DEFUN (no_ip_ospf_hello_interval
,
5228 no_ip_ospf_hello_interval_addr_cmd
,
5229 "no ip ospf hello-interval A.B.C.D",
5232 "OSPF interface commands\n"
5233 "Time between HELLO packets\n"
5234 "Address of interface")
5236 struct interface
*ifp
= vty
->index
;
5237 struct in_addr addr
;
5239 struct ospf_if_params
*params
;
5242 params
= IF_DEF_PARAMS (ifp
);
5246 ret
= inet_aton(argv
[0], &addr
);
5249 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5254 params
= ospf_lookup_if_params (ifp
, addr
);
5259 UNSET_IF_PARAM (params
, v_hello
);
5260 params
->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
5262 if (params
!= IF_DEF_PARAMS (ifp
))
5264 ospf_free_if_params (ifp
, addr
);
5265 ospf_if_update_params (ifp
, addr
);
5271 ALIAS (no_ip_ospf_hello_interval
,
5272 no_ip_ospf_hello_interval_cmd
,
5273 "no ip ospf hello-interval",
5276 "OSPF interface commands\n"
5277 "Time between HELLO packets\n")
5279 ALIAS (no_ip_ospf_hello_interval
,
5280 no_ospf_hello_interval_cmd
,
5281 "no ospf hello-interval",
5283 "OSPF interface commands\n"
5284 "Time between HELLO packets\n")
5286 DEFUN (ip_ospf_network
,
5287 ip_ospf_network_cmd
,
5288 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
5290 "OSPF interface commands\n"
5292 "Specify OSPF broadcast multi-access network\n"
5293 "Specify OSPF NBMA network\n"
5294 "Specify OSPF point-to-multipoint network\n"
5295 "Specify OSPF point-to-point network\n")
5297 struct interface
*ifp
= vty
->index
;
5298 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
5299 struct route_node
*rn
;
5301 if (strncmp (argv
[0], "b", 1) == 0)
5302 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
5303 else if (strncmp (argv
[0], "n", 1) == 0)
5304 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
5305 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
5306 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
5307 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
5308 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
5310 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
5313 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
5315 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5317 struct ospf_interface
*oi
= rn
->info
;
5322 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
5324 if (oi
->state
> ISM_Down
)
5326 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
5327 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
5334 ALIAS (ip_ospf_network
,
5336 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
5337 "OSPF interface commands\n"
5339 "Specify OSPF broadcast multi-access network\n"
5340 "Specify OSPF NBMA network\n"
5341 "Specify OSPF point-to-multipoint network\n"
5342 "Specify OSPF point-to-point network\n")
5344 DEFUN (no_ip_ospf_network
,
5345 no_ip_ospf_network_cmd
,
5346 "no ip ospf network",
5349 "OSPF interface commands\n"
5352 struct interface
*ifp
= vty
->index
;
5353 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
5354 struct route_node
*rn
;
5356 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
5358 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
5361 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5363 struct ospf_interface
*oi
= rn
->info
;
5368 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
5370 if (oi
->state
> ISM_Down
)
5372 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
5373 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
5380 ALIAS (no_ip_ospf_network
,
5381 no_ospf_network_cmd
,
5384 "OSPF interface commands\n"
5387 DEFUN (ip_ospf_priority
,
5388 ip_ospf_priority_addr_cmd
,
5389 "ip ospf priority <0-255> A.B.C.D",
5391 "OSPF interface commands\n"
5394 "Address of interface")
5396 struct interface
*ifp
= vty
->index
;
5398 struct route_node
*rn
;
5399 struct in_addr addr
;
5401 struct ospf_if_params
*params
;
5403 params
= IF_DEF_PARAMS (ifp
);
5405 priority
= strtol (argv
[0], NULL
, 10);
5407 /* Router Priority range is <0-255>. */
5408 if (priority
< 0 || priority
> 255)
5410 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
5416 ret
= inet_aton(argv
[1], &addr
);
5419 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5424 params
= ospf_get_if_params (ifp
, addr
);
5425 ospf_if_update_params (ifp
, addr
);
5428 SET_IF_PARAM (params
, priority
);
5429 params
->priority
= priority
;
5431 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5433 struct ospf_interface
*oi
= rn
->info
;
5439 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
5441 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
5442 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
5449 ALIAS (ip_ospf_priority
,
5450 ip_ospf_priority_cmd
,
5451 "ip ospf priority <0-255>",
5453 "OSPF interface commands\n"
5457 ALIAS (ip_ospf_priority
,
5459 "ospf priority <0-255>",
5460 "OSPF interface commands\n"
5464 DEFUN (no_ip_ospf_priority
,
5465 no_ip_ospf_priority_addr_cmd
,
5466 "no ip ospf priority A.B.C.D",
5469 "OSPF interface commands\n"
5471 "Address of interface")
5473 struct interface
*ifp
= vty
->index
;
5474 struct route_node
*rn
;
5475 struct in_addr addr
;
5477 struct ospf_if_params
*params
;
5480 params
= IF_DEF_PARAMS (ifp
);
5484 ret
= inet_aton(argv
[0], &addr
);
5487 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5492 params
= ospf_lookup_if_params (ifp
, addr
);
5497 UNSET_IF_PARAM (params
, priority
);
5498 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
5500 if (params
!= IF_DEF_PARAMS (ifp
))
5502 ospf_free_if_params (ifp
, addr
);
5503 ospf_if_update_params (ifp
, addr
);
5506 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5508 struct ospf_interface
*oi
= rn
->info
;
5514 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
5516 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
5517 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
5524 ALIAS (no_ip_ospf_priority
,
5525 no_ip_ospf_priority_cmd
,
5526 "no ip ospf priority",
5529 "OSPF interface commands\n"
5530 "Router priority\n")
5532 ALIAS (no_ip_ospf_priority
,
5533 no_ospf_priority_cmd
,
5536 "OSPF interface commands\n"
5537 "Router priority\n")
5539 DEFUN (ip_ospf_retransmit_interval
,
5540 ip_ospf_retransmit_interval_addr_cmd
,
5541 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5543 "OSPF interface commands\n"
5544 "Time between retransmitting lost link state advertisements\n"
5546 "Address of interface")
5548 struct interface
*ifp
= vty
->index
;
5550 struct in_addr addr
;
5552 struct ospf_if_params
*params
;
5554 params
= IF_DEF_PARAMS (ifp
);
5555 seconds
= strtol (argv
[0], NULL
, 10);
5557 /* Retransmit Interval range is <3-65535>. */
5558 if (seconds
< 3 || seconds
> 65535)
5560 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
5567 ret
= inet_aton(argv
[1], &addr
);
5570 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5575 params
= ospf_get_if_params (ifp
, addr
);
5576 ospf_if_update_params (ifp
, addr
);
5579 SET_IF_PARAM (params
, retransmit_interval
);
5580 params
->retransmit_interval
= seconds
;
5585 ALIAS (ip_ospf_retransmit_interval
,
5586 ip_ospf_retransmit_interval_cmd
,
5587 "ip ospf retransmit-interval <3-65535>",
5589 "OSPF interface commands\n"
5590 "Time between retransmitting lost link state advertisements\n"
5593 ALIAS (ip_ospf_retransmit_interval
,
5594 ospf_retransmit_interval_cmd
,
5595 "ospf retransmit-interval <3-65535>",
5596 "OSPF interface commands\n"
5597 "Time between retransmitting lost link state advertisements\n"
5600 DEFUN (no_ip_ospf_retransmit_interval
,
5601 no_ip_ospf_retransmit_interval_addr_cmd
,
5602 "no ip ospf retransmit-interval A.B.C.D",
5605 "OSPF interface commands\n"
5606 "Time between retransmitting lost link state advertisements\n"
5607 "Address of interface")
5609 struct interface
*ifp
= vty
->index
;
5610 struct in_addr addr
;
5612 struct ospf_if_params
*params
;
5615 params
= IF_DEF_PARAMS (ifp
);
5619 ret
= inet_aton(argv
[0], &addr
);
5622 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5627 params
= ospf_lookup_if_params (ifp
, addr
);
5632 UNSET_IF_PARAM (params
, retransmit_interval
);
5633 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
5635 if (params
!= IF_DEF_PARAMS (ifp
))
5637 ospf_free_if_params (ifp
, addr
);
5638 ospf_if_update_params (ifp
, addr
);
5644 ALIAS (no_ip_ospf_retransmit_interval
,
5645 no_ip_ospf_retransmit_interval_cmd
,
5646 "no ip ospf retransmit-interval",
5649 "OSPF interface commands\n"
5650 "Time between retransmitting lost link state advertisements\n")
5652 ALIAS (no_ip_ospf_retransmit_interval
,
5653 no_ospf_retransmit_interval_cmd
,
5654 "no ospf retransmit-interval",
5656 "OSPF interface commands\n"
5657 "Time between retransmitting lost link state advertisements\n")
5659 DEFUN (ip_ospf_transmit_delay
,
5660 ip_ospf_transmit_delay_addr_cmd
,
5661 "ip ospf transmit-delay <1-65535> A.B.C.D",
5663 "OSPF interface commands\n"
5664 "Link state transmit delay\n"
5666 "Address of interface")
5668 struct interface
*ifp
= vty
->index
;
5670 struct in_addr addr
;
5672 struct ospf_if_params
*params
;
5674 params
= IF_DEF_PARAMS (ifp
);
5675 seconds
= strtol (argv
[0], NULL
, 10);
5677 /* Transmit Delay range is <1-65535>. */
5678 if (seconds
< 1 || seconds
> 65535)
5680 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
5686 ret
= inet_aton(argv
[1], &addr
);
5689 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5694 params
= ospf_get_if_params (ifp
, addr
);
5695 ospf_if_update_params (ifp
, addr
);
5698 SET_IF_PARAM (params
, transmit_delay
);
5699 params
->transmit_delay
= seconds
;
5704 ALIAS (ip_ospf_transmit_delay
,
5705 ip_ospf_transmit_delay_cmd
,
5706 "ip ospf transmit-delay <1-65535>",
5708 "OSPF interface commands\n"
5709 "Link state transmit delay\n"
5712 ALIAS (ip_ospf_transmit_delay
,
5713 ospf_transmit_delay_cmd
,
5714 "ospf transmit-delay <1-65535>",
5715 "OSPF interface commands\n"
5716 "Link state transmit delay\n"
5719 DEFUN (no_ip_ospf_transmit_delay
,
5720 no_ip_ospf_transmit_delay_addr_cmd
,
5721 "no ip ospf transmit-delay A.B.C.D",
5724 "OSPF interface commands\n"
5725 "Link state transmit delay\n"
5726 "Address of interface")
5728 struct interface
*ifp
= vty
->index
;
5729 struct in_addr addr
;
5731 struct ospf_if_params
*params
;
5734 params
= IF_DEF_PARAMS (ifp
);
5738 ret
= inet_aton(argv
[0], &addr
);
5741 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5746 params
= ospf_lookup_if_params (ifp
, addr
);
5751 UNSET_IF_PARAM (params
, transmit_delay
);
5752 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
5754 if (params
!= IF_DEF_PARAMS (ifp
))
5756 ospf_free_if_params (ifp
, addr
);
5757 ospf_if_update_params (ifp
, addr
);
5763 ALIAS (no_ip_ospf_transmit_delay
,
5764 no_ip_ospf_transmit_delay_cmd
,
5765 "no ip ospf transmit-delay",
5768 "OSPF interface commands\n"
5769 "Link state transmit delay\n")
5771 ALIAS (no_ip_ospf_transmit_delay
,
5772 no_ospf_transmit_delay_cmd
,
5773 "no ospf transmit-delay",
5775 "OSPF interface commands\n"
5776 "Link state transmit delay\n")
5779 DEFUN (ospf_redistribute_source_metric_type
,
5780 ospf_redistribute_source_metric_type_routemap_cmd
,
5781 "redistribute " QUAGGA_REDIST_STR_OSPFD
5782 " metric <0-16777214> metric-type (1|2) route-map WORD",
5784 QUAGGA_REDIST_HELP_STR_OSPFD
5785 "Metric for redistributed routes\n"
5786 "OSPF default metric\n"
5787 "OSPF exterior metric type for redistributed routes\n"
5788 "Set OSPF External Type 1 metrics\n"
5789 "Set OSPF External Type 2 metrics\n"
5790 "Route map reference\n"
5791 "Pointer to route-map entries\n")
5793 struct ospf
*ospf
= vty
->index
;
5798 /* Get distribute source. */
5799 source
= proto_redistnum(AFI_IP
, argv
[0]);
5800 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
5803 /* Get metric value. */
5805 if (!str2metric (argv
[1], &metric
))
5808 /* Get metric type. */
5810 if (!str2metric_type (argv
[2], &type
))
5814 ospf_routemap_set (ospf
, source
, argv
[3]);
5816 ospf_routemap_unset (ospf
, source
);
5818 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5821 ALIAS (ospf_redistribute_source_metric_type
,
5822 ospf_redistribute_source_metric_type_cmd
,
5823 "redistribute " QUAGGA_REDIST_STR_OSPFD
5824 " metric <0-16777214> metric-type (1|2)",
5826 QUAGGA_REDIST_HELP_STR_OSPFD
5827 "Metric for redistributed routes\n"
5828 "OSPF default metric\n"
5829 "OSPF exterior metric type for redistributed routes\n"
5830 "Set OSPF External Type 1 metrics\n"
5831 "Set OSPF External Type 2 metrics\n")
5833 ALIAS (ospf_redistribute_source_metric_type
,
5834 ospf_redistribute_source_metric_cmd
,
5835 "redistribute " QUAGGA_REDIST_STR_OSPFD
" metric <0-16777214>",
5837 QUAGGA_REDIST_HELP_STR_OSPFD
5838 "Metric for redistributed routes\n"
5839 "OSPF default metric\n")
5841 DEFUN (ospf_redistribute_source_type_metric
,
5842 ospf_redistribute_source_type_metric_routemap_cmd
,
5843 "redistribute " QUAGGA_REDIST_STR_OSPFD
5844 " metric-type (1|2) metric <0-16777214> route-map WORD",
5846 QUAGGA_REDIST_HELP_STR_OSPFD
5847 "OSPF exterior metric type for redistributed routes\n"
5848 "Set OSPF External Type 1 metrics\n"
5849 "Set OSPF External Type 2 metrics\n"
5850 "Metric for redistributed routes\n"
5851 "OSPF default metric\n"
5852 "Route map reference\n"
5853 "Pointer to route-map entries\n")
5855 struct ospf
*ospf
= vty
->index
;
5860 /* Get distribute source. */
5861 source
= proto_redistnum(AFI_IP
, argv
[0]);
5862 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
5865 /* Get metric value. */
5867 if (!str2metric_type (argv
[1], &type
))
5870 /* Get metric type. */
5872 if (!str2metric (argv
[2], &metric
))
5876 ospf_routemap_set (ospf
, source
, argv
[3]);
5878 ospf_routemap_unset (ospf
, source
);
5880 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5883 ALIAS (ospf_redistribute_source_type_metric
,
5884 ospf_redistribute_source_type_metric_cmd
,
5885 "redistribute " QUAGGA_REDIST_STR_OSPFD
5886 " metric-type (1|2) metric <0-16777214>",
5888 QUAGGA_REDIST_HELP_STR_OSPFD
5889 "OSPF exterior metric type for redistributed routes\n"
5890 "Set OSPF External Type 1 metrics\n"
5891 "Set OSPF External Type 2 metrics\n"
5892 "Metric for redistributed routes\n"
5893 "OSPF default metric\n")
5895 ALIAS (ospf_redistribute_source_type_metric
,
5896 ospf_redistribute_source_type_cmd
,
5897 "redistribute " QUAGGA_REDIST_STR_OSPFD
" metric-type (1|2)",
5899 QUAGGA_REDIST_HELP_STR_OSPFD
5900 "OSPF exterior metric type for redistributed routes\n"
5901 "Set OSPF External Type 1 metrics\n"
5902 "Set OSPF External Type 2 metrics\n")
5904 ALIAS (ospf_redistribute_source_type_metric
,
5905 ospf_redistribute_source_cmd
,
5906 "redistribute " QUAGGA_REDIST_STR_OSPFD
,
5908 QUAGGA_REDIST_HELP_STR_OSPFD
)
5910 DEFUN (ospf_redistribute_source_metric_routemap
,
5911 ospf_redistribute_source_metric_routemap_cmd
,
5912 "redistribute " QUAGGA_REDIST_STR_OSPFD
5913 " metric <0-16777214> route-map WORD",
5915 QUAGGA_REDIST_HELP_STR_OSPFD
5916 "Metric for redistributed routes\n"
5917 "OSPF default metric\n"
5918 "Route map reference\n"
5919 "Pointer to route-map entries\n")
5921 struct ospf
*ospf
= vty
->index
;
5925 /* Get distribute source. */
5926 source
= proto_redistnum(AFI_IP
, argv
[0]);
5927 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
5930 /* Get metric value. */
5932 if (!str2metric (argv
[1], &metric
))
5936 ospf_routemap_set (ospf
, source
, argv
[2]);
5938 ospf_routemap_unset (ospf
, source
);
5940 return ospf_redistribute_set (ospf
, source
, -1, metric
);
5943 DEFUN (ospf_redistribute_source_type_routemap
,
5944 ospf_redistribute_source_type_routemap_cmd
,
5945 "redistribute " QUAGGA_REDIST_STR_OSPFD
5946 " metric-type (1|2) route-map WORD",
5948 QUAGGA_REDIST_HELP_STR_OSPFD
5949 "OSPF exterior metric type for redistributed routes\n"
5950 "Set OSPF External Type 1 metrics\n"
5951 "Set OSPF External Type 2 metrics\n"
5952 "Route map reference\n"
5953 "Pointer to route-map entries\n")
5955 struct ospf
*ospf
= vty
->index
;
5959 /* Get distribute source. */
5960 source
= proto_redistnum(AFI_IP
, argv
[0]);
5961 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
5964 /* Get metric value. */
5966 if (!str2metric_type (argv
[1], &type
))
5970 ospf_routemap_set (ospf
, source
, argv
[2]);
5972 ospf_routemap_unset (ospf
, source
);
5974 return ospf_redistribute_set (ospf
, source
, type
, -1);
5977 DEFUN (ospf_redistribute_source_routemap
,
5978 ospf_redistribute_source_routemap_cmd
,
5979 "redistribute " QUAGGA_REDIST_STR_OSPFD
" route-map WORD",
5981 QUAGGA_REDIST_HELP_STR_OSPFD
5982 "Route map reference\n"
5983 "Pointer to route-map entries\n")
5985 struct ospf
*ospf
= vty
->index
;
5988 /* Get distribute source. */
5989 source
= proto_redistnum(AFI_IP
, argv
[0]);
5990 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
5994 ospf_routemap_set (ospf
, source
, argv
[1]);
5996 ospf_routemap_unset (ospf
, source
);
5998 return ospf_redistribute_set (ospf
, source
, -1, -1);
6001 DEFUN (no_ospf_redistribute_source
,
6002 no_ospf_redistribute_source_cmd
,
6003 "no redistribute " QUAGGA_REDIST_STR_OSPFD
,
6006 QUAGGA_REDIST_HELP_STR_OSPFD
)
6008 struct ospf
*ospf
= vty
->index
;
6011 source
= proto_redistnum(AFI_IP
, argv
[0]);
6012 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
6015 ospf_routemap_unset (ospf
, source
);
6016 return ospf_redistribute_unset (ospf
, source
);
6019 DEFUN (ospf_distribute_list_out
,
6020 ospf_distribute_list_out_cmd
,
6021 "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD
,
6022 "Filter networks in routing updates\n"
6023 "Access-list name\n"
6025 QUAGGA_REDIST_HELP_STR_OSPFD
)
6027 struct ospf
*ospf
= vty
->index
;
6030 /* Get distribute source. */
6031 source
= proto_redistnum(AFI_IP
, argv
[0]);
6032 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
6035 return ospf_distribute_list_out_set (ospf
, source
, argv
[0]);
6038 DEFUN (no_ospf_distribute_list_out
,
6039 no_ospf_distribute_list_out_cmd
,
6040 "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD
,
6042 "Filter networks in routing updates\n"
6043 "Access-list name\n"
6045 QUAGGA_REDIST_HELP_STR_OSPFD
)
6047 struct ospf
*ospf
= vty
->index
;
6050 source
= proto_redistnum(AFI_IP
, argv
[0]);
6051 if (source
< 0 || source
== ZEBRA_ROUTE_OSPF
)
6054 return ospf_distribute_list_out_unset (ospf
, source
, argv
[0]);
6057 /* Default information originate. */
6058 DEFUN (ospf_default_information_originate_metric_type_routemap
,
6059 ospf_default_information_originate_metric_type_routemap_cmd
,
6060 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
6061 "Control distribution of default information\n"
6062 "Distribute a default route\n"
6063 "OSPF default metric\n"
6065 "OSPF metric type for default routes\n"
6066 "Set OSPF External Type 1 metrics\n"
6067 "Set OSPF External Type 2 metrics\n"
6068 "Route map reference\n"
6069 "Pointer to route-map entries\n")
6071 struct ospf
*ospf
= vty
->index
;
6075 /* Get metric value. */
6077 if (!str2metric (argv
[0], &metric
))
6080 /* Get metric type. */
6082 if (!str2metric_type (argv
[1], &type
))
6086 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6088 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6090 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
6094 ALIAS (ospf_default_information_originate_metric_type_routemap
,
6095 ospf_default_information_originate_metric_type_cmd
,
6096 "default-information originate metric <0-16777214> metric-type (1|2)",
6097 "Control distribution of default information\n"
6098 "Distribute a default route\n"
6099 "OSPF default metric\n"
6101 "OSPF metric type for default routes\n"
6102 "Set OSPF External Type 1 metrics\n"
6103 "Set OSPF External Type 2 metrics\n")
6105 ALIAS (ospf_default_information_originate_metric_type_routemap
,
6106 ospf_default_information_originate_metric_cmd
,
6107 "default-information originate metric <0-16777214>",
6108 "Control distribution of default information\n"
6109 "Distribute a default route\n"
6110 "OSPF default metric\n"
6113 ALIAS (ospf_default_information_originate_metric_type_routemap
,
6114 ospf_default_information_originate_cmd
,
6115 "default-information originate",
6116 "Control distribution of default information\n"
6117 "Distribute a default route\n")
6119 /* Default information originate. */
6120 DEFUN (ospf_default_information_originate_metric_routemap
,
6121 ospf_default_information_originate_metric_routemap_cmd
,
6122 "default-information originate metric <0-16777214> route-map WORD",
6123 "Control distribution of default information\n"
6124 "Distribute a default route\n"
6125 "OSPF default metric\n"
6127 "Route map reference\n"
6128 "Pointer to route-map entries\n")
6130 struct ospf
*ospf
= vty
->index
;
6133 /* Get metric value. */
6135 if (!str2metric (argv
[0], &metric
))
6139 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6141 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6143 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
6147 /* Default information originate. */
6148 DEFUN (ospf_default_information_originate_routemap
,
6149 ospf_default_information_originate_routemap_cmd
,
6150 "default-information originate route-map WORD",
6151 "Control distribution of default information\n"
6152 "Distribute a default route\n"
6153 "Route map reference\n"
6154 "Pointer to route-map entries\n")
6156 struct ospf
*ospf
= vty
->index
;
6159 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
6161 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6163 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
, -1, -1);
6166 DEFUN (ospf_default_information_originate_type_metric_routemap
,
6167 ospf_default_information_originate_type_metric_routemap_cmd
,
6168 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
6169 "Control distribution of default information\n"
6170 "Distribute a default route\n"
6171 "OSPF metric type for default routes\n"
6172 "Set OSPF External Type 1 metrics\n"
6173 "Set OSPF External Type 2 metrics\n"
6174 "OSPF default metric\n"
6176 "Route map reference\n"
6177 "Pointer to route-map entries\n")
6179 struct ospf
*ospf
= vty
->index
;
6183 /* Get metric type. */
6185 if (!str2metric_type (argv
[0], &type
))
6188 /* Get metric value. */
6190 if (!str2metric (argv
[1], &metric
))
6194 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6196 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6198 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
6202 ALIAS (ospf_default_information_originate_type_metric_routemap
,
6203 ospf_default_information_originate_type_metric_cmd
,
6204 "default-information originate metric-type (1|2) metric <0-16777214>",
6205 "Control distribution of default information\n"
6206 "Distribute a default route\n"
6207 "OSPF metric type for default routes\n"
6208 "Set OSPF External Type 1 metrics\n"
6209 "Set OSPF External Type 2 metrics\n"
6210 "OSPF default metric\n"
6213 ALIAS (ospf_default_information_originate_type_metric_routemap
,
6214 ospf_default_information_originate_type_cmd
,
6215 "default-information originate metric-type (1|2)",
6216 "Control distribution of default information\n"
6217 "Distribute a default route\n"
6218 "OSPF metric type for default routes\n"
6219 "Set OSPF External Type 1 metrics\n"
6220 "Set OSPF External Type 2 metrics\n")
6222 DEFUN (ospf_default_information_originate_type_routemap
,
6223 ospf_default_information_originate_type_routemap_cmd
,
6224 "default-information originate metric-type (1|2) route-map WORD",
6225 "Control distribution of default information\n"
6226 "Distribute a default route\n"
6227 "OSPF metric type for default routes\n"
6228 "Set OSPF External Type 1 metrics\n"
6229 "Set OSPF External Type 2 metrics\n"
6230 "Route map reference\n"
6231 "Pointer to route-map entries\n")
6233 struct ospf
*ospf
= vty
->index
;
6236 /* Get metric type. */
6238 if (!str2metric_type (argv
[0], &type
))
6242 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6244 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6246 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
6250 DEFUN (ospf_default_information_originate_always_metric_type_routemap
,
6251 ospf_default_information_originate_always_metric_type_routemap_cmd
,
6252 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
6253 "Control distribution of default information\n"
6254 "Distribute a default route\n"
6255 "Always advertise default route\n"
6256 "OSPF default metric\n"
6258 "OSPF metric type for default routes\n"
6259 "Set OSPF External Type 1 metrics\n"
6260 "Set OSPF External Type 2 metrics\n"
6261 "Route map reference\n"
6262 "Pointer to route-map entries\n")
6264 struct ospf
*ospf
= vty
->index
;
6268 /* Get metric value. */
6270 if (!str2metric (argv
[0], &metric
))
6273 /* Get metric type. */
6275 if (!str2metric_type (argv
[1], &type
))
6279 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6281 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6283 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6287 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
6288 ospf_default_information_originate_always_metric_type_cmd
,
6289 "default-information originate always metric <0-16777214> metric-type (1|2)",
6290 "Control distribution of default information\n"
6291 "Distribute a default route\n"
6292 "Always advertise default route\n"
6293 "OSPF default metric\n"
6295 "OSPF metric type for default routes\n"
6296 "Set OSPF External Type 1 metrics\n"
6297 "Set OSPF External Type 2 metrics\n")
6299 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
6300 ospf_default_information_originate_always_metric_cmd
,
6301 "default-information originate always metric <0-16777214>",
6302 "Control distribution of default information\n"
6303 "Distribute a default route\n"
6304 "Always advertise default route\n"
6305 "OSPF default metric\n"
6307 "OSPF metric type for default routes\n")
6309 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
6310 ospf_default_information_originate_always_cmd
,
6311 "default-information originate always",
6312 "Control distribution of default information\n"
6313 "Distribute a default route\n"
6314 "Always advertise default route\n")
6316 DEFUN (ospf_default_information_originate_always_metric_routemap
,
6317 ospf_default_information_originate_always_metric_routemap_cmd
,
6318 "default-information originate always metric <0-16777214> route-map WORD",
6319 "Control distribution of default information\n"
6320 "Distribute a default route\n"
6321 "Always advertise default route\n"
6322 "OSPF default metric\n"
6324 "Route map reference\n"
6325 "Pointer to route-map entries\n")
6327 struct ospf
*ospf
= vty
->index
;
6330 /* Get metric value. */
6332 if (!str2metric (argv
[0], &metric
))
6336 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6338 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6340 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6344 DEFUN (ospf_default_information_originate_always_routemap
,
6345 ospf_default_information_originate_always_routemap_cmd
,
6346 "default-information originate always route-map WORD",
6347 "Control distribution of default information\n"
6348 "Distribute a default route\n"
6349 "Always advertise default route\n"
6350 "Route map reference\n"
6351 "Pointer to route-map entries\n")
6353 struct ospf
*ospf
= vty
->index
;
6356 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
6358 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6360 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
, -1, -1);
6363 DEFUN (ospf_default_information_originate_always_type_metric_routemap
,
6364 ospf_default_information_originate_always_type_metric_routemap_cmd
,
6365 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
6366 "Control distribution of default information\n"
6367 "Distribute a default route\n"
6368 "Always advertise default route\n"
6369 "OSPF metric type for default routes\n"
6370 "Set OSPF External Type 1 metrics\n"
6371 "Set OSPF External Type 2 metrics\n"
6372 "OSPF default metric\n"
6374 "Route map reference\n"
6375 "Pointer to route-map entries\n")
6377 struct ospf
*ospf
= vty
->index
;
6381 /* Get metric type. */
6383 if (!str2metric_type (argv
[0], &type
))
6386 /* Get metric value. */
6388 if (!str2metric (argv
[1], &metric
))
6392 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6394 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6396 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6400 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
6401 ospf_default_information_originate_always_type_metric_cmd
,
6402 "default-information originate always metric-type (1|2) metric <0-16777214>",
6403 "Control distribution of default information\n"
6404 "Distribute a default route\n"
6405 "Always advertise default route\n"
6406 "OSPF metric type for default routes\n"
6407 "Set OSPF External Type 1 metrics\n"
6408 "Set OSPF External Type 2 metrics\n"
6409 "OSPF default metric\n"
6412 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
6413 ospf_default_information_originate_always_type_cmd
,
6414 "default-information originate always metric-type (1|2)",
6415 "Control distribution of default information\n"
6416 "Distribute a default route\n"
6417 "Always advertise default route\n"
6418 "OSPF metric type for default routes\n"
6419 "Set OSPF External Type 1 metrics\n"
6420 "Set OSPF External Type 2 metrics\n")
6422 DEFUN (ospf_default_information_originate_always_type_routemap
,
6423 ospf_default_information_originate_always_type_routemap_cmd
,
6424 "default-information originate always metric-type (1|2) route-map WORD",
6425 "Control distribution of default information\n"
6426 "Distribute a default route\n"
6427 "Always advertise default route\n"
6428 "OSPF metric type for default routes\n"
6429 "Set OSPF External Type 1 metrics\n"
6430 "Set OSPF External Type 2 metrics\n"
6431 "Route map reference\n"
6432 "Pointer to route-map entries\n")
6434 struct ospf
*ospf
= vty
->index
;
6437 /* Get metric type. */
6439 if (!str2metric_type (argv
[0], &type
))
6443 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6445 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6447 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6451 DEFUN (no_ospf_default_information_originate
,
6452 no_ospf_default_information_originate_cmd
,
6453 "no default-information originate",
6455 "Control distribution of default information\n"
6456 "Distribute a default route\n")
6458 struct ospf
*ospf
= vty
->index
;
6459 struct prefix_ipv4 p
;
6462 p
.prefix
.s_addr
= 0;
6465 ospf_external_lsa_flush (ospf
, DEFAULT_ROUTE
, &p
, 0);
6467 if (EXTERNAL_INFO (DEFAULT_ROUTE
)) {
6468 ospf_external_info_delete (DEFAULT_ROUTE
, p
);
6469 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE
));
6470 EXTERNAL_INFO (DEFAULT_ROUTE
) = NULL
;
6473 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6474 return ospf_redistribute_default_unset (ospf
);
6477 DEFUN (ospf_default_metric
,
6478 ospf_default_metric_cmd
,
6479 "default-metric <0-16777214>",
6480 "Set metric of redistributed routes\n"
6483 struct ospf
*ospf
= vty
->index
;
6486 if (!str2metric (argv
[0], &metric
))
6489 ospf
->default_metric
= metric
;
6494 DEFUN (no_ospf_default_metric
,
6495 no_ospf_default_metric_cmd
,
6496 "no default-metric",
6498 "Set metric of redistributed routes\n")
6500 struct ospf
*ospf
= vty
->index
;
6502 ospf
->default_metric
= -1;
6507 ALIAS (no_ospf_default_metric
,
6508 no_ospf_default_metric_val_cmd
,
6509 "no default-metric <0-16777214>",
6511 "Set metric of redistributed routes\n"
6514 DEFUN (ospf_distance
,
6517 "Define an administrative distance\n"
6518 "OSPF Administrative distance\n")
6520 struct ospf
*ospf
= vty
->index
;
6522 ospf
->distance_all
= atoi (argv
[0]);
6527 DEFUN (no_ospf_distance
,
6528 no_ospf_distance_cmd
,
6529 "no distance <1-255>",
6531 "Define an administrative distance\n"
6532 "OSPF Administrative distance\n")
6534 struct ospf
*ospf
= vty
->index
;
6536 ospf
->distance_all
= 0;
6541 DEFUN (no_ospf_distance_ospf
,
6542 no_ospf_distance_ospf_cmd
,
6545 "Define an administrative distance\n"
6546 "OSPF Administrative distance\n"
6549 struct ospf
*ospf
= vty
->index
;
6551 ospf
->distance_intra
= 0;
6552 ospf
->distance_inter
= 0;
6553 ospf
->distance_external
= 0;
6558 DEFUN (ospf_distance_ospf_intra
,
6559 ospf_distance_ospf_intra_cmd
,
6560 "distance ospf intra-area <1-255>",
6561 "Define an administrative distance\n"
6562 "OSPF Administrative distance\n"
6563 "Intra-area routes\n"
6564 "Distance for intra-area routes\n")
6566 struct ospf
*ospf
= vty
->index
;
6568 ospf
->distance_intra
= atoi (argv
[0]);
6573 DEFUN (ospf_distance_ospf_intra_inter
,
6574 ospf_distance_ospf_intra_inter_cmd
,
6575 "distance ospf intra-area <1-255> inter-area <1-255>",
6576 "Define an administrative distance\n"
6577 "OSPF Administrative distance\n"
6578 "Intra-area routes\n"
6579 "Distance for intra-area routes\n"
6580 "Inter-area routes\n"
6581 "Distance for inter-area routes\n")
6583 struct ospf
*ospf
= vty
->index
;
6585 ospf
->distance_intra
= atoi (argv
[0]);
6586 ospf
->distance_inter
= atoi (argv
[1]);
6591 DEFUN (ospf_distance_ospf_intra_external
,
6592 ospf_distance_ospf_intra_external_cmd
,
6593 "distance ospf intra-area <1-255> external <1-255>",
6594 "Define an administrative distance\n"
6595 "OSPF Administrative distance\n"
6596 "Intra-area routes\n"
6597 "Distance for intra-area routes\n"
6599 "Distance for external routes\n")
6601 struct ospf
*ospf
= vty
->index
;
6603 ospf
->distance_intra
= atoi (argv
[0]);
6604 ospf
->distance_external
= atoi (argv
[1]);
6609 DEFUN (ospf_distance_ospf_intra_inter_external
,
6610 ospf_distance_ospf_intra_inter_external_cmd
,
6611 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6612 "Define an administrative distance\n"
6613 "OSPF Administrative distance\n"
6614 "Intra-area routes\n"
6615 "Distance for intra-area routes\n"
6616 "Inter-area routes\n"
6617 "Distance for inter-area routes\n"
6619 "Distance for external routes\n")
6621 struct ospf
*ospf
= vty
->index
;
6623 ospf
->distance_intra
= atoi (argv
[0]);
6624 ospf
->distance_inter
= atoi (argv
[1]);
6625 ospf
->distance_external
= atoi (argv
[2]);
6630 DEFUN (ospf_distance_ospf_intra_external_inter
,
6631 ospf_distance_ospf_intra_external_inter_cmd
,
6632 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6633 "Define an administrative distance\n"
6634 "OSPF Administrative distance\n"
6635 "Intra-area routes\n"
6636 "Distance for intra-area routes\n"
6638 "Distance for external routes\n"
6639 "Inter-area routes\n"
6640 "Distance for inter-area routes\n")
6642 struct ospf
*ospf
= vty
->index
;
6644 ospf
->distance_intra
= atoi (argv
[0]);
6645 ospf
->distance_external
= atoi (argv
[1]);
6646 ospf
->distance_inter
= atoi (argv
[2]);
6651 DEFUN (ospf_distance_ospf_inter
,
6652 ospf_distance_ospf_inter_cmd
,
6653 "distance ospf inter-area <1-255>",
6654 "Define an administrative distance\n"
6655 "OSPF Administrative distance\n"
6656 "Inter-area routes\n"
6657 "Distance for inter-area routes\n")
6659 struct ospf
*ospf
= vty
->index
;
6661 ospf
->distance_inter
= atoi (argv
[0]);
6666 DEFUN (ospf_distance_ospf_inter_intra
,
6667 ospf_distance_ospf_inter_intra_cmd
,
6668 "distance ospf inter-area <1-255> intra-area <1-255>",
6669 "Define an administrative distance\n"
6670 "OSPF Administrative distance\n"
6671 "Inter-area routes\n"
6672 "Distance for inter-area routes\n"
6673 "Intra-area routes\n"
6674 "Distance for intra-area routes\n")
6676 struct ospf
*ospf
= vty
->index
;
6678 ospf
->distance_inter
= atoi (argv
[0]);
6679 ospf
->distance_intra
= atoi (argv
[1]);
6684 DEFUN (ospf_distance_ospf_inter_external
,
6685 ospf_distance_ospf_inter_external_cmd
,
6686 "distance ospf inter-area <1-255> external <1-255>",
6687 "Define an administrative distance\n"
6688 "OSPF Administrative distance\n"
6689 "Inter-area routes\n"
6690 "Distance for inter-area routes\n"
6692 "Distance for external routes\n")
6694 struct ospf
*ospf
= vty
->index
;
6696 ospf
->distance_inter
= atoi (argv
[0]);
6697 ospf
->distance_external
= atoi (argv
[1]);
6702 DEFUN (ospf_distance_ospf_inter_intra_external
,
6703 ospf_distance_ospf_inter_intra_external_cmd
,
6704 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6705 "Define an administrative distance\n"
6706 "OSPF Administrative distance\n"
6707 "Inter-area routes\n"
6708 "Distance for inter-area routes\n"
6709 "Intra-area routes\n"
6710 "Distance for intra-area routes\n"
6712 "Distance for external routes\n")
6714 struct ospf
*ospf
= vty
->index
;
6716 ospf
->distance_inter
= atoi (argv
[0]);
6717 ospf
->distance_intra
= atoi (argv
[1]);
6718 ospf
->distance_external
= atoi (argv
[2]);
6723 DEFUN (ospf_distance_ospf_inter_external_intra
,
6724 ospf_distance_ospf_inter_external_intra_cmd
,
6725 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6726 "Define an administrative distance\n"
6727 "OSPF Administrative distance\n"
6728 "Inter-area routes\n"
6729 "Distance for inter-area routes\n"
6731 "Distance for external routes\n"
6732 "Intra-area routes\n"
6733 "Distance for intra-area routes\n")
6735 struct ospf
*ospf
= vty
->index
;
6737 ospf
->distance_inter
= atoi (argv
[0]);
6738 ospf
->distance_external
= atoi (argv
[1]);
6739 ospf
->distance_intra
= atoi (argv
[2]);
6744 DEFUN (ospf_distance_ospf_external
,
6745 ospf_distance_ospf_external_cmd
,
6746 "distance ospf external <1-255>",
6747 "Define an administrative distance\n"
6748 "OSPF Administrative distance\n"
6750 "Distance for external routes\n")
6752 struct ospf
*ospf
= vty
->index
;
6754 ospf
->distance_external
= atoi (argv
[0]);
6759 DEFUN (ospf_distance_ospf_external_intra
,
6760 ospf_distance_ospf_external_intra_cmd
,
6761 "distance ospf external <1-255> intra-area <1-255>",
6762 "Define an administrative distance\n"
6763 "OSPF Administrative distance\n"
6765 "Distance for external routes\n"
6766 "Intra-area routes\n"
6767 "Distance for intra-area routes\n")
6769 struct ospf
*ospf
= vty
->index
;
6771 ospf
->distance_external
= atoi (argv
[0]);
6772 ospf
->distance_intra
= atoi (argv
[1]);
6777 DEFUN (ospf_distance_ospf_external_inter
,
6778 ospf_distance_ospf_external_inter_cmd
,
6779 "distance ospf external <1-255> inter-area <1-255>",
6780 "Define an administrative distance\n"
6781 "OSPF Administrative distance\n"
6783 "Distance for external routes\n"
6784 "Inter-area routes\n"
6785 "Distance for inter-area routes\n")
6787 struct ospf
*ospf
= vty
->index
;
6789 ospf
->distance_external
= atoi (argv
[0]);
6790 ospf
->distance_inter
= atoi (argv
[1]);
6795 DEFUN (ospf_distance_ospf_external_intra_inter
,
6796 ospf_distance_ospf_external_intra_inter_cmd
,
6797 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6798 "Define an administrative distance\n"
6799 "OSPF Administrative distance\n"
6801 "Distance for external routes\n"
6802 "Intra-area routes\n"
6803 "Distance for intra-area routes\n"
6804 "Inter-area routes\n"
6805 "Distance for inter-area routes\n")
6807 struct ospf
*ospf
= vty
->index
;
6809 ospf
->distance_external
= atoi (argv
[0]);
6810 ospf
->distance_intra
= atoi (argv
[1]);
6811 ospf
->distance_inter
= atoi (argv
[2]);
6816 DEFUN (ospf_distance_ospf_external_inter_intra
,
6817 ospf_distance_ospf_external_inter_intra_cmd
,
6818 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6819 "Define an administrative distance\n"
6820 "OSPF Administrative distance\n"
6822 "Distance for external routes\n"
6823 "Inter-area routes\n"
6824 "Distance for inter-area routes\n"
6825 "Intra-area routes\n"
6826 "Distance for intra-area routes\n")
6828 struct ospf
*ospf
= vty
->index
;
6830 ospf
->distance_external
= atoi (argv
[0]);
6831 ospf
->distance_inter
= atoi (argv
[1]);
6832 ospf
->distance_intra
= atoi (argv
[2]);
6837 DEFUN (ospf_distance_source
,
6838 ospf_distance_source_cmd
,
6839 "distance <1-255> A.B.C.D/M",
6840 "Administrative distance\n"
6842 "IP source prefix\n")
6844 struct ospf
*ospf
= vty
->index
;
6846 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], NULL
);
6851 DEFUN (no_ospf_distance_source
,
6852 no_ospf_distance_source_cmd
,
6853 "no distance <1-255> A.B.C.D/M",
6855 "Administrative distance\n"
6857 "IP source prefix\n")
6859 struct ospf
*ospf
= vty
->index
;
6861 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], NULL
);
6866 DEFUN (ospf_distance_source_access_list
,
6867 ospf_distance_source_access_list_cmd
,
6868 "distance <1-255> A.B.C.D/M WORD",
6869 "Administrative distance\n"
6871 "IP source prefix\n"
6872 "Access list name\n")
6874 struct ospf
*ospf
= vty
->index
;
6876 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6881 DEFUN (no_ospf_distance_source_access_list
,
6882 no_ospf_distance_source_access_list_cmd
,
6883 "no distance <1-255> A.B.C.D/M WORD",
6885 "Administrative distance\n"
6887 "IP source prefix\n"
6888 "Access list name\n")
6890 struct ospf
*ospf
= vty
->index
;
6892 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6897 DEFUN (ip_ospf_mtu_ignore
,
6898 ip_ospf_mtu_ignore_addr_cmd
,
6899 "ip ospf mtu-ignore A.B.C.D",
6901 "OSPF interface commands\n"
6902 "Disable mtu mismatch detection\n"
6903 "Address of interface")
6905 struct interface
*ifp
= vty
->index
;
6906 struct in_addr addr
;
6909 struct ospf_if_params
*params
;
6910 params
= IF_DEF_PARAMS (ifp
);
6914 ret
= inet_aton(argv
[0], &addr
);
6917 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6921 params
= ospf_get_if_params (ifp
, addr
);
6922 ospf_if_update_params (ifp
, addr
);
6924 params
->mtu_ignore
= 1;
6925 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
6926 SET_IF_PARAM (params
, mtu_ignore
);
6929 UNSET_IF_PARAM (params
, mtu_ignore
);
6930 if (params
!= IF_DEF_PARAMS (ifp
))
6932 ospf_free_if_params (ifp
, addr
);
6933 ospf_if_update_params (ifp
, addr
);
6939 ALIAS (ip_ospf_mtu_ignore
,
6940 ip_ospf_mtu_ignore_cmd
,
6941 "ip ospf mtu-ignore",
6943 "OSPF interface commands\n"
6944 "Disable mtu mismatch detection\n")
6947 DEFUN (no_ip_ospf_mtu_ignore
,
6948 no_ip_ospf_mtu_ignore_addr_cmd
,
6949 "no ip ospf mtu-ignore A.B.C.D",
6951 "OSPF interface commands\n"
6952 "Disable mtu mismatch detection\n"
6953 "Address of interface")
6955 struct interface
*ifp
= vty
->index
;
6956 struct in_addr addr
;
6959 struct ospf_if_params
*params
;
6960 params
= IF_DEF_PARAMS (ifp
);
6964 ret
= inet_aton(argv
[0], &addr
);
6967 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6971 params
= ospf_get_if_params (ifp
, addr
);
6972 ospf_if_update_params (ifp
, addr
);
6974 params
->mtu_ignore
= 0;
6975 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
6976 SET_IF_PARAM (params
, mtu_ignore
);
6979 UNSET_IF_PARAM (params
, mtu_ignore
);
6980 if (params
!= IF_DEF_PARAMS (ifp
))
6982 ospf_free_if_params (ifp
, addr
);
6983 ospf_if_update_params (ifp
, addr
);
6989 ALIAS (no_ip_ospf_mtu_ignore
,
6990 no_ip_ospf_mtu_ignore_cmd
,
6991 "no ip ospf mtu-ignore",
6993 "OSPF interface commands\n"
6994 "Disable mtu mismatch detection\n")
6996 DEFUN (ospf_max_metric_router_lsa_admin
,
6997 ospf_max_metric_router_lsa_admin_cmd
,
6998 "max-metric router-lsa administrative",
6999 "OSPF maximum / infinite-distance metric\n"
7000 "Advertise own Router-LSA with infinite distance (stub router)\n"
7001 "Administratively applied, for an indefinite period\n")
7003 struct listnode
*ln
;
7004 struct ospf_area
*area
;
7005 struct ospf
*ospf
= vty
->index
;
7007 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
7009 SET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
7011 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
7012 ospf_router_lsa_timer_add (area
);
7017 DEFUN (no_ospf_max_metric_router_lsa_admin
,
7018 no_ospf_max_metric_router_lsa_admin_cmd
,
7019 "no max-metric router-lsa administrative",
7021 "OSPF maximum / infinite-distance metric\n"
7022 "Advertise own Router-LSA with infinite distance (stub router)\n"
7023 "Administratively applied, for an indefinite period\n")
7025 struct listnode
*ln
;
7026 struct ospf_area
*area
;
7027 struct ospf
*ospf
= vty
->index
;
7029 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
7031 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
7033 /* Don't trample on the start-up stub timer */
7034 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
)
7035 && !area
->t_stub_router
)
7037 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
7038 ospf_router_lsa_timer_add (area
);
7044 DEFUN (ospf_max_metric_router_lsa_startup
,
7045 ospf_max_metric_router_lsa_startup_cmd
,
7046 "max-metric router-lsa on-startup <5-86400>",
7047 "OSPF maximum / infinite-distance metric\n"
7048 "Advertise own Router-LSA with infinite distance (stub router)\n"
7049 "Automatically advertise stub Router-LSA on startup of OSPF\n"
7050 "Time (seconds) to advertise self as stub-router\n")
7052 unsigned int seconds
;
7053 struct ospf
*ospf
= vty
->index
;
7057 vty_out (vty
, "%% Must supply stub-router period");
7061 VTY_GET_INTEGER ("stub-router startup period", seconds
, argv
[0]);
7063 ospf
->stub_router_startup_time
= seconds
;
7068 DEFUN (no_ospf_max_metric_router_lsa_startup
,
7069 no_ospf_max_metric_router_lsa_startup_cmd
,
7070 "no max-metric router-lsa on-startup",
7072 "OSPF maximum / infinite-distance metric\n"
7073 "Advertise own Router-LSA with infinite distance (stub router)\n"
7074 "Automatically advertise stub Router-LSA on startup of OSPF\n")
7076 struct listnode
*ln
;
7077 struct ospf_area
*area
;
7078 struct ospf
*ospf
= vty
->index
;
7080 ospf
->stub_router_startup_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
7082 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
7084 SET_FLAG (area
->stub_router_state
, OSPF_AREA_WAS_START_STUB_ROUTED
);
7085 OSPF_TIMER_OFF (area
->t_stub_router
);
7087 /* Don't trample on admin stub routed */
7088 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
7090 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
7091 ospf_router_lsa_timer_add (area
);
7097 DEFUN (ospf_max_metric_router_lsa_shutdown
,
7098 ospf_max_metric_router_lsa_shutdown_cmd
,
7099 "max-metric router-lsa on-shutdown <5-86400>",
7100 "OSPF maximum / infinite-distance metric\n"
7101 "Advertise own Router-LSA with infinite distance (stub router)\n"
7102 "Advertise stub-router prior to full shutdown of OSPF\n"
7103 "Time (seconds) to wait till full shutdown\n")
7105 unsigned int seconds
;
7106 struct ospf
*ospf
= vty
->index
;
7110 vty_out (vty
, "%% Must supply stub-router shutdown period");
7114 VTY_GET_INTEGER ("stub-router shutdown wait period", seconds
, argv
[0]);
7116 ospf
->stub_router_shutdown_time
= seconds
;
7121 DEFUN (no_ospf_max_metric_router_lsa_shutdown
,
7122 no_ospf_max_metric_router_lsa_shutdown_cmd
,
7123 "no max-metric router-lsa on-shutdown",
7125 "OSPF maximum / infinite-distance metric\n"
7126 "Advertise own Router-LSA with infinite distance (stub router)\n"
7127 "Advertise stub-router prior to full shutdown of OSPF\n")
7129 struct ospf
*ospf
= vty
->index
;
7131 ospf
->stub_router_shutdown_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
7137 config_write_stub_router (struct vty
*vty
, struct ospf
*ospf
)
7139 struct listnode
*ln
;
7140 struct ospf_area
*area
;
7142 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
7143 vty_out (vty
, " max-metric router-lsa on-startup %u%s",
7144 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
7145 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
7146 vty_out (vty
, " max-metric router-lsa on-shutdown %u%s",
7147 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
7148 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
7150 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
7152 vty_out (vty
, " max-metric router-lsa administrative%s",
7161 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
7163 struct route_node
*rn
;
7164 struct ospf_route
*or;
7165 struct listnode
*pnode
, *pnnode
;
7166 struct ospf_path
*path
;
7168 vty_out (vty
, "============ OSPF network routing table ============%s",
7171 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
7172 if ((or = rn
->info
) != NULL
)
7175 snprintf (buf1
, 19, "%s/%d",
7176 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
7178 switch (or->path_type
)
7180 case OSPF_PATH_INTER_AREA
:
7181 if (or->type
== OSPF_DESTINATION_NETWORK
)
7182 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
7183 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
7184 else if (or->type
== OSPF_DESTINATION_DISCARD
)
7185 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
7187 case OSPF_PATH_INTRA_AREA
:
7188 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
7189 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
7195 if (or->type
== OSPF_DESTINATION_NETWORK
)
7196 for (ALL_LIST_ELEMENTS (or->paths
, pnode
, pnnode
, path
))
7198 if (if_lookup_by_index(path
->ifindex
))
7200 if (path
->nexthop
.s_addr
== 0)
7201 vty_out (vty
, "%24s directly attached to %s%s",
7202 "", ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
7204 vty_out (vty
, "%24s via %s, %s%s", "",
7205 inet_ntoa (path
->nexthop
),
7206 ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
7210 vty_out (vty
, "%s", VTY_NEWLINE
);
7214 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
7216 struct route_node
*rn
;
7217 struct ospf_route
*or;
7218 struct listnode
*pnode
;
7219 struct listnode
*node
;
7220 struct ospf_path
*path
;
7222 vty_out (vty
, "============ OSPF router routing table =============%s",
7224 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
7229 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
7231 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, or))
7234 vty_out (vty
, "%24s", "");
7237 vty_out (vty
, "%s [%d] area: %s",
7238 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
7239 or->cost
, inet_ntoa (or->u
.std
.area_id
));
7241 vty_out (vty
, "%s%s%s",
7242 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
7243 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
7246 for (ALL_LIST_ELEMENTS_RO (or->paths
, pnode
, path
))
7248 if (if_lookup_by_index(path
->ifindex
))
7250 if (path
->nexthop
.s_addr
== 0)
7251 vty_out (vty
, "%24s directly attached to %s%s",
7252 "", ifindex2ifname (path
->ifindex
),
7255 vty_out (vty
, "%24s via %s, %s%s", "",
7256 inet_ntoa (path
->nexthop
),
7257 ifindex2ifname (path
->ifindex
),
7263 vty_out (vty
, "%s", VTY_NEWLINE
);
7267 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
7269 struct route_node
*rn
;
7270 struct ospf_route
*er
;
7271 struct listnode
*pnode
, *pnnode
;
7272 struct ospf_path
*path
;
7274 vty_out (vty
, "============ OSPF external routing table ===========%s",
7276 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
7277 if ((er
= rn
->info
) != NULL
)
7280 snprintf (buf1
, 19, "%s/%d",
7281 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
7283 switch (er
->path_type
)
7285 case OSPF_PATH_TYPE1_EXTERNAL
:
7286 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
7287 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
7289 case OSPF_PATH_TYPE2_EXTERNAL
:
7290 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
7291 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
7295 for (ALL_LIST_ELEMENTS (er
->paths
, pnode
, pnnode
, path
))
7297 if (if_lookup_by_index(path
->ifindex
))
7299 if (path
->nexthop
.s_addr
== 0)
7300 vty_out (vty
, "%24s directly attached to %s%s",
7301 "", ifindex2ifname (path
->ifindex
), VTY_NEWLINE
);
7303 vty_out (vty
, "%24s via %s, %s%s", "",
7304 inet_ntoa (path
->nexthop
),
7305 ifindex2ifname (path
->ifindex
),
7310 vty_out (vty
, "%s", VTY_NEWLINE
);
7313 DEFUN (show_ip_ospf_border_routers
,
7314 show_ip_ospf_border_routers_cmd
,
7315 "show ip ospf border-routers",
7318 "show all the ABR's and ASBR's\n"
7323 if ((ospf
= ospf_lookup ()) == NULL
)
7325 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
7329 if (ospf
->new_table
== NULL
)
7331 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
7335 /* Show Network routes.
7336 show_ip_ospf_route_network (vty, ospf->new_table); */
7338 /* Show Router routes. */
7339 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
7344 DEFUN (show_ip_ospf_route
,
7345 show_ip_ospf_route_cmd
,
7346 "show ip ospf route",
7349 "OSPF information\n"
7350 "OSPF routing table\n")
7354 if ((ospf
= ospf_lookup ()) == NULL
)
7356 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
7360 if (ospf
->new_table
== NULL
)
7362 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
7366 /* Show Network routes. */
7367 show_ip_ospf_route_network (vty
, ospf
->new_table
);
7369 /* Show Router routes. */
7370 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
7372 /* Show AS External routes. */
7373 show_ip_ospf_route_external (vty
, ospf
->old_external_route
);
7379 const char *ospf_abr_type_str
[] =
7388 const char *ospf_shortcut_mode_str
[] =
7397 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
7399 memset (buf
, 0, length
);
7401 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7402 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
7404 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
7408 const char *ospf_int_type_str
[] =
7410 "unknown", /* should never be used. */
7414 "point-to-multipoint",
7415 "virtual-link", /* should never be used. */
7419 /* Configuration write function for ospfd. */
7421 config_write_interface (struct vty
*vty
)
7423 struct listnode
*n1
, *n2
;
7424 struct interface
*ifp
;
7425 struct crypt_key
*ck
;
7427 struct route_node
*rn
= NULL
;
7428 struct ospf_if_params
*params
;
7430 for (ALL_LIST_ELEMENTS_RO (iflist
, n1
, ifp
))
7432 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
7435 vty_out (vty
, "!%s", VTY_NEWLINE
);
7436 vty_out (vty
, "interface %s%s", ifp
->name
,
7439 vty_out (vty
, " description %s%s", ifp
->desc
,
7444 params
= IF_DEF_PARAMS (ifp
);
7447 /* Interface Network print. */
7448 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
7449 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
7451 if (params
->type
!= ospf_default_iftype(ifp
))
7453 vty_out (vty
, " ip ospf network %s",
7454 ospf_int_type_str
[params
->type
]);
7455 if (params
!= IF_DEF_PARAMS (ifp
))
7456 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7457 vty_out (vty
, "%s", VTY_NEWLINE
);
7461 /* OSPF interface authentication print */
7462 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
7463 params
->auth_type
!= OSPF_AUTH_NOTSET
)
7465 const char *auth_str
;
7467 /* Translation tables are not that much help here due to syntax
7468 of the simple option */
7469 switch (params
->auth_type
)
7472 case OSPF_AUTH_NULL
:
7476 case OSPF_AUTH_SIMPLE
:
7480 case OSPF_AUTH_CRYPTOGRAPHIC
:
7481 auth_str
= " message-digest";
7489 vty_out (vty
, " ip ospf authentication%s", auth_str
);
7490 if (params
!= IF_DEF_PARAMS (ifp
))
7491 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7492 vty_out (vty
, "%s", VTY_NEWLINE
);
7495 /* Simple Authentication Password print. */
7496 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
7497 params
->auth_simple
[0] != '\0')
7499 vty_out (vty
, " ip ospf authentication-key %s",
7500 params
->auth_simple
);
7501 if (params
!= IF_DEF_PARAMS (ifp
))
7502 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7503 vty_out (vty
, "%s", VTY_NEWLINE
);
7506 /* Cryptographic Authentication Key print. */
7507 for (ALL_LIST_ELEMENTS_RO (params
->auth_crypt
, n2
, ck
))
7509 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
7510 ck
->key_id
, ck
->auth_key
);
7511 if (params
!= IF_DEF_PARAMS (ifp
))
7512 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7513 vty_out (vty
, "%s", VTY_NEWLINE
);
7516 /* Interface Output Cost print. */
7517 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
7519 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
7520 if (params
!= IF_DEF_PARAMS (ifp
))
7521 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7522 vty_out (vty
, "%s", VTY_NEWLINE
);
7525 /* Hello Interval print. */
7526 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
7527 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
7529 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
7530 if (params
!= IF_DEF_PARAMS (ifp
))
7531 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7532 vty_out (vty
, "%s", VTY_NEWLINE
);
7536 /* Router Dead Interval print. */
7537 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
7538 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
7540 vty_out (vty
, " ip ospf dead-interval ");
7543 if (OSPF_IF_PARAM_CONFIGURED (params
, fast_hello
))
7544 vty_out (vty
, "minimal hello-multiplier %d",
7545 params
->fast_hello
);
7547 vty_out (vty
, "%u", params
->v_wait
);
7549 if (params
!= IF_DEF_PARAMS (ifp
))
7550 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7551 vty_out (vty
, "%s", VTY_NEWLINE
);
7554 /* Router Priority print. */
7555 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
7556 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
7558 vty_out (vty
, " ip ospf priority %u", params
->priority
);
7559 if (params
!= IF_DEF_PARAMS (ifp
))
7560 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7561 vty_out (vty
, "%s", VTY_NEWLINE
);
7564 /* Retransmit Interval print. */
7565 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
7566 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
7568 vty_out (vty
, " ip ospf retransmit-interval %u",
7569 params
->retransmit_interval
);
7570 if (params
!= IF_DEF_PARAMS (ifp
))
7571 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7572 vty_out (vty
, "%s", VTY_NEWLINE
);
7575 /* Transmit Delay print. */
7576 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
7577 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
7579 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
7580 if (params
!= IF_DEF_PARAMS (ifp
))
7581 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7582 vty_out (vty
, "%s", VTY_NEWLINE
);
7585 /* MTU ignore print. */
7586 if (OSPF_IF_PARAM_CONFIGURED (params
, mtu_ignore
) &&
7587 params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
7589 if (params
->mtu_ignore
== 0)
7590 vty_out (vty
, " no ip ospf mtu-ignore");
7592 vty_out (vty
, " ip ospf mtu-ignore");
7593 if (params
!= IF_DEF_PARAMS (ifp
))
7594 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7595 vty_out (vty
, "%s", VTY_NEWLINE
);
7602 rn
= route_top (IF_OIFS_PARAMS (ifp
));
7604 rn
= route_next (rn
);
7614 #ifdef HAVE_OPAQUE_LSA
7615 ospf_opaque_config_write_if (vty
, ifp
);
7616 #endif /* HAVE_OPAQUE_LSA */
7623 config_write_network_area (struct vty
*vty
, struct ospf
*ospf
)
7625 struct route_node
*rn
;
7626 u_char buf
[INET_ADDRSTRLEN
];
7628 /* `network area' print. */
7629 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
7632 struct ospf_network
*n
= rn
->info
;
7634 memset (buf
, 0, INET_ADDRSTRLEN
);
7636 /* Create Area ID string by specified Area ID format. */
7637 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7638 strncpy ((char *) buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
7640 sprintf ((char *) buf
, "%lu",
7641 (unsigned long int) ntohl (n
->area_id
.s_addr
));
7643 /* Network print. */
7644 vty_out (vty
, " network %s/%d area %s%s",
7645 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7653 config_write_ospf_area (struct vty
*vty
, struct ospf
*ospf
)
7655 struct listnode
*node
;
7656 struct ospf_area
*area
;
7657 u_char buf
[INET_ADDRSTRLEN
];
7659 /* Area configuration print. */
7660 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
7662 struct route_node
*rn1
;
7664 area_id2str ((char *) buf
, INET_ADDRSTRLEN
, area
);
7666 if (area
->auth_type
!= OSPF_AUTH_NULL
)
7668 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
7669 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
7671 vty_out (vty
, " area %s authentication message-digest%s",
7675 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
7676 vty_out (vty
, " area %s shortcut %s%s", buf
,
7677 ospf_shortcut_mode_str
[area
->shortcut_configured
],
7680 if ((area
->external_routing
== OSPF_AREA_STUB
)
7681 || (area
->external_routing
== OSPF_AREA_NSSA
)
7684 if (area
->external_routing
== OSPF_AREA_STUB
)
7685 vty_out (vty
, " area %s stub", buf
);
7686 else if (area
->external_routing
== OSPF_AREA_NSSA
)
7688 vty_out (vty
, " area %s nssa", buf
);
7689 switch (area
->NSSATranslatorRole
)
7691 case OSPF_NSSA_ROLE_NEVER
:
7692 vty_out (vty
, " translate-never");
7694 case OSPF_NSSA_ROLE_ALWAYS
:
7695 vty_out (vty
, " translate-always");
7697 case OSPF_NSSA_ROLE_CANDIDATE
:
7699 vty_out (vty
, " translate-candidate");
7703 if (area
->no_summary
)
7704 vty_out (vty
, " no-summary");
7706 vty_out (vty
, "%s", VTY_NEWLINE
);
7708 if (area
->default_cost
!= 1)
7709 vty_out (vty
, " area %s default-cost %d%s", buf
,
7710 area
->default_cost
, VTY_NEWLINE
);
7713 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
7716 struct ospf_area_range
*range
= rn1
->info
;
7718 vty_out (vty
, " area %s range %s/%d", buf
,
7719 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
7721 if (range
->cost_config
!= OSPF_AREA_RANGE_COST_UNSPEC
)
7722 vty_out (vty
, " cost %d", range
->cost_config
);
7724 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
7725 vty_out (vty
, " not-advertise");
7727 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
7728 vty_out (vty
, " substitute %s/%d",
7729 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
7731 vty_out (vty
, "%s", VTY_NEWLINE
);
7734 if (EXPORT_NAME (area
))
7735 vty_out (vty
, " area %s export-list %s%s", buf
,
7736 EXPORT_NAME (area
), VTY_NEWLINE
);
7738 if (IMPORT_NAME (area
))
7739 vty_out (vty
, " area %s import-list %s%s", buf
,
7740 IMPORT_NAME (area
), VTY_NEWLINE
);
7742 if (PREFIX_NAME_IN (area
))
7743 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
7744 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
7746 if (PREFIX_NAME_OUT (area
))
7747 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
7748 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
7755 config_write_ospf_nbr_nbma (struct vty
*vty
, struct ospf
*ospf
)
7757 struct ospf_nbr_nbma
*nbr_nbma
;
7758 struct route_node
*rn
;
7760 /* Static Neighbor configuration print. */
7761 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
7762 if ((nbr_nbma
= rn
->info
))
7764 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
7766 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
7767 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
7769 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
7770 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
7772 vty_out (vty
, "%s", VTY_NEWLINE
);
7779 config_write_virtual_link (struct vty
*vty
, struct ospf
*ospf
)
7781 struct listnode
*node
;
7782 struct ospf_vl_data
*vl_data
;
7783 u_char buf
[INET_ADDRSTRLEN
];
7785 /* Virtual-Link print */
7786 for (ALL_LIST_ELEMENTS_RO (ospf
->vlinks
, node
, vl_data
))
7788 struct listnode
*n2
;
7789 struct crypt_key
*ck
;
7790 struct ospf_interface
*oi
;
7792 if (vl_data
!= NULL
)
7794 memset (buf
, 0, INET_ADDRSTRLEN
);
7796 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7797 strncpy ((char *) buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
7799 sprintf ((char *) buf
, "%lu",
7800 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
7801 oi
= vl_data
->vl_oi
;
7804 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
7805 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
7806 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
7807 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
7808 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7810 inet_ntoa (vl_data
->vl_peer
),
7811 OSPF_IF_PARAM (oi
, v_hello
),
7812 OSPF_IF_PARAM (oi
, retransmit_interval
),
7813 OSPF_IF_PARAM (oi
, transmit_delay
),
7814 OSPF_IF_PARAM (oi
, v_wait
),
7817 vty_out (vty
, " area %s virtual-link %s%s", buf
,
7818 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
7820 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
7821 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
7823 inet_ntoa (vl_data
->vl_peer
),
7824 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
7827 for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
,
7829 vty_out (vty
, " area %s virtual-link %s"
7830 " message-digest-key %d md5 %s%s",
7832 inet_ntoa (vl_data
->vl_peer
),
7833 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
7843 config_write_ospf_redistribute (struct vty
*vty
, struct ospf
*ospf
)
7847 /* redistribute print. */
7848 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7849 if (type
!= zclient
->redist_default
&& zclient
->redist
[type
])
7851 vty_out (vty
, " redistribute %s", zebra_route_string(type
));
7852 if (ospf
->dmetric
[type
].value
>= 0)
7853 vty_out (vty
, " metric %d", ospf
->dmetric
[type
].value
);
7855 if (ospf
->dmetric
[type
].type
== EXTERNAL_METRIC_TYPE_1
)
7856 vty_out (vty
, " metric-type 1");
7858 if (ROUTEMAP_NAME (ospf
, type
))
7859 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (ospf
, type
));
7861 vty_out (vty
, "%s", VTY_NEWLINE
);
7868 config_write_ospf_default_metric (struct vty
*vty
, struct ospf
*ospf
)
7870 if (ospf
->default_metric
!= -1)
7871 vty_out (vty
, " default-metric %d%s", ospf
->default_metric
,
7877 config_write_ospf_distribute (struct vty
*vty
, struct ospf
*ospf
)
7883 /* distribute-list print. */
7884 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7885 if (DISTRIBUTE_NAME (ospf
, type
))
7886 vty_out (vty
, " distribute-list %s out %s%s",
7887 DISTRIBUTE_NAME (ospf
, type
),
7888 zebra_route_string(type
), VTY_NEWLINE
);
7890 /* default-information print. */
7891 if (ospf
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
7893 vty_out (vty
, " default-information originate");
7894 if (ospf
->default_originate
== DEFAULT_ORIGINATE_ALWAYS
)
7895 vty_out (vty
, " always");
7897 if (ospf
->dmetric
[DEFAULT_ROUTE
].value
>= 0)
7898 vty_out (vty
, " metric %d",
7899 ospf
->dmetric
[DEFAULT_ROUTE
].value
);
7900 if (ospf
->dmetric
[DEFAULT_ROUTE
].type
== EXTERNAL_METRIC_TYPE_1
)
7901 vty_out (vty
, " metric-type 1");
7903 if (ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
))
7904 vty_out (vty
, " route-map %s",
7905 ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
));
7907 vty_out (vty
, "%s", VTY_NEWLINE
);
7916 config_write_ospf_distance (struct vty
*vty
, struct ospf
*ospf
)
7918 struct route_node
*rn
;
7919 struct ospf_distance
*odistance
;
7921 if (ospf
->distance_all
)
7922 vty_out (vty
, " distance %d%s", ospf
->distance_all
, VTY_NEWLINE
);
7924 if (ospf
->distance_intra
7925 || ospf
->distance_inter
7926 || ospf
->distance_external
)
7928 vty_out (vty
, " distance ospf");
7930 if (ospf
->distance_intra
)
7931 vty_out (vty
, " intra-area %d", ospf
->distance_intra
);
7932 if (ospf
->distance_inter
)
7933 vty_out (vty
, " inter-area %d", ospf
->distance_inter
);
7934 if (ospf
->distance_external
)
7935 vty_out (vty
, " external %d", ospf
->distance_external
);
7937 vty_out (vty
, "%s", VTY_NEWLINE
);
7940 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
7941 if ((odistance
= rn
->info
) != NULL
)
7943 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
7944 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7945 odistance
->access_list
? odistance
->access_list
: "",
7951 /* OSPF configuration write function. */
7953 ospf_config_write (struct vty
*vty
)
7956 struct interface
*ifp
;
7957 struct ospf_interface
*oi
;
7958 struct listnode
*node
;
7961 ospf
= ospf_lookup ();
7964 /* `router ospf' print. */
7965 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
7969 if (!ospf
->networks
)
7972 /* Router ID print. */
7973 if (ospf
->router_id_static
.s_addr
!= 0)
7974 vty_out (vty
, " ospf router-id %s%s",
7975 inet_ntoa (ospf
->router_id_static
), VTY_NEWLINE
);
7977 /* ABR type print. */
7978 if (ospf
->abr_type
!= OSPF_ABR_DEFAULT
)
7979 vty_out (vty
, " ospf abr-type %s%s",
7980 ospf_abr_type_str
[ospf
->abr_type
], VTY_NEWLINE
);
7982 /* log-adjacency-changes flag print. */
7983 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_CHANGES
))
7985 vty_out(vty
, " log-adjacency-changes");
7986 if (CHECK_FLAG(ospf
->config
, OSPF_LOG_ADJACENCY_DETAIL
))
7987 vty_out(vty
, " detail");
7988 vty_out(vty
, "%s", VTY_NEWLINE
);
7991 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
7992 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
7993 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
7995 /* auto-cost reference-bandwidth configuration. */
7996 if (ospf
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
7998 vty_out (vty
, "! Important: ensure reference bandwidth "
7999 "is consistent across all routers%s", VTY_NEWLINE
);
8000 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
8001 ospf
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
8004 /* SPF timers print. */
8005 if (ospf
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
8006 ospf
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
||
8007 ospf
->spf_max_holdtime
!= OSPF_SPF_MAX_HOLDTIME_DEFAULT
)
8008 vty_out (vty
, " timers throttle spf %d %d %d%s",
8009 ospf
->spf_delay
, ospf
->spf_holdtime
,
8010 ospf
->spf_max_holdtime
, VTY_NEWLINE
);
8012 /* Max-metric router-lsa print */
8013 config_write_stub_router (vty
, ospf
);
8015 /* SPF refresh parameters print. */
8016 if (ospf
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
8017 vty_out (vty
, " refresh timer %d%s",
8018 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
8020 /* Redistribute information print. */
8021 config_write_ospf_redistribute (vty
, ospf
);
8023 /* passive-interface print. */
8024 if (ospf
->passive_interface_default
== OSPF_IF_PASSIVE
)
8025 vty_out (vty
, " passive-interface default%s", VTY_NEWLINE
);
8027 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
8028 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp
), passive_interface
)
8029 && IF_DEF_PARAMS (ifp
)->passive_interface
!=
8030 ospf
->passive_interface_default
)
8032 vty_out (vty
, " %spassive-interface %s%s",
8033 IF_DEF_PARAMS (ifp
)->passive_interface
? "" : "no ",
8034 ifp
->name
, VTY_NEWLINE
);
8036 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
8038 if (!OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
))
8040 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi
->ifp
),
8043 if (oi
->params
->passive_interface
== IF_DEF_PARAMS (oi
->ifp
)->passive_interface
)
8046 else if (oi
->params
->passive_interface
== ospf
->passive_interface_default
)
8049 vty_out (vty
, " %spassive-interface %s %s%s",
8050 oi
->params
->passive_interface
? "" : "no ",
8052 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
8055 /* Network area print. */
8056 config_write_network_area (vty
, ospf
);
8058 /* Area config print. */
8059 config_write_ospf_area (vty
, ospf
);
8061 /* static neighbor print. */
8062 config_write_ospf_nbr_nbma (vty
, ospf
);
8064 /* Virtual-Link print. */
8065 config_write_virtual_link (vty
, ospf
);
8067 /* Default metric configuration. */
8068 config_write_ospf_default_metric (vty
, ospf
);
8070 /* Distribute-list and default-information print. */
8071 config_write_ospf_distribute (vty
, ospf
);
8073 /* Distance configuration. */
8074 config_write_ospf_distance (vty
, ospf
);
8076 #ifdef HAVE_OPAQUE_LSA
8077 ospf_opaque_config_write_router (vty
, ospf
);
8078 #endif /* HAVE_OPAQUE_LSA */
8085 ospf_vty_show_init (void)
8087 /* "show ip ospf" commands. */
8088 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
8089 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
8091 /* "show ip ospf database" commands. */
8092 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
8093 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
8094 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
8095 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
8096 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
8097 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
8098 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
8099 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
8100 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
8101 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
8102 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
8103 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
8104 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
8105 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
8107 /* "show ip ospf interface" commands. */
8108 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
8109 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
8111 /* "show ip ospf neighbor" commands. */
8112 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
8113 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
8114 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
8115 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
8116 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
8117 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
8118 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
8119 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
8120 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
8121 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
8122 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
8123 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
8124 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
8125 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
8127 /* "show ip ospf route" commands. */
8128 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
8129 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
8130 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
8131 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
8135 /* ospfd's interface node. */
8136 static struct cmd_node interface_node
=
8143 /* Initialization of OSPF interface. */
8145 ospf_vty_if_init (void)
8147 /* Install interface node. */
8148 install_node (&interface_node
, config_write_interface
);
8150 install_element (CONFIG_NODE
, &interface_cmd
);
8151 install_element (CONFIG_NODE
, &no_interface_cmd
);
8152 install_default (INTERFACE_NODE
);
8154 /* "description" commands. */
8155 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
8156 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
8158 /* "ip ospf authentication" commands. */
8159 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
8160 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
8161 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
8162 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
8163 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
8164 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
8165 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
8166 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
8167 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
8168 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
8170 /* "ip ospf message-digest-key" commands. */
8171 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
8172 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
8173 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
8174 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
8176 /* "ip ospf cost" commands. */
8177 install_element (INTERFACE_NODE
, &ip_ospf_cost_u32_inet4_cmd
);
8178 install_element (INTERFACE_NODE
, &ip_ospf_cost_u32_cmd
);
8179 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_u32_cmd
);
8180 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_u32_inet4_cmd
);
8181 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_inet4_cmd
);
8182 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
8184 /* "ip ospf mtu-ignore" commands. */
8185 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_addr_cmd
);
8186 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_cmd
);
8187 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_addr_cmd
);
8188 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_cmd
);
8190 /* "ip ospf dead-interval" commands. */
8191 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
8192 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
8193 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_addr_cmd
);
8194 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_cmd
);
8195 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
8196 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
8198 /* "ip ospf hello-interval" commands. */
8199 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
8200 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
8201 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
8202 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
8204 /* "ip ospf network" commands. */
8205 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
8206 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
8208 /* "ip ospf priority" commands. */
8209 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
8210 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
8211 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
8212 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
8214 /* "ip ospf retransmit-interval" commands. */
8215 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
8216 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
8217 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
8218 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
8220 /* "ip ospf transmit-delay" commands. */
8221 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
8222 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
8223 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
8224 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
8226 /* These commands are compatibitliy for previous version. */
8227 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
8228 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
8229 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
8230 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
8231 install_element (INTERFACE_NODE
, &ospf_cost_u32_cmd
);
8232 install_element (INTERFACE_NODE
, &ospf_cost_u32_inet4_cmd
);
8233 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
8234 install_element (INTERFACE_NODE
, &no_ospf_cost_u32_cmd
);
8235 install_element (INTERFACE_NODE
, &no_ospf_cost_u32_inet4_cmd
);
8236 install_element (INTERFACE_NODE
, &no_ospf_cost_inet4_cmd
);
8237 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
8238 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
8239 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
8240 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
8241 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
8242 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
8243 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
8244 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
8245 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
8246 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
8247 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
8248 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
8252 ospf_vty_zebra_init (void)
8254 install_element (OSPF_NODE
, &ospf_redistribute_source_type_metric_cmd
);
8255 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_type_cmd
);
8256 install_element (OSPF_NODE
, &ospf_redistribute_source_type_cmd
);
8257 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_cmd
);
8258 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
8259 install_element (OSPF_NODE
,
8260 &ospf_redistribute_source_metric_type_routemap_cmd
);
8261 install_element (OSPF_NODE
,
8262 &ospf_redistribute_source_type_metric_routemap_cmd
);
8263 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_routemap_cmd
);
8264 install_element (OSPF_NODE
, &ospf_redistribute_source_type_routemap_cmd
);
8265 install_element (OSPF_NODE
, &ospf_redistribute_source_routemap_cmd
);
8267 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
8269 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
8270 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
8272 install_element (OSPF_NODE
,
8273 &ospf_default_information_originate_metric_type_cmd
);
8274 install_element (OSPF_NODE
, &ospf_default_information_originate_metric_cmd
);
8275 install_element (OSPF_NODE
,
8276 &ospf_default_information_originate_type_metric_cmd
);
8277 install_element (OSPF_NODE
, &ospf_default_information_originate_type_cmd
);
8278 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
8279 install_element (OSPF_NODE
,
8280 &ospf_default_information_originate_always_metric_type_cmd
);
8281 install_element (OSPF_NODE
,
8282 &ospf_default_information_originate_always_metric_cmd
);
8283 install_element (OSPF_NODE
,
8284 &ospf_default_information_originate_always_cmd
);
8285 install_element (OSPF_NODE
,
8286 &ospf_default_information_originate_always_type_metric_cmd
);
8287 install_element (OSPF_NODE
,
8288 &ospf_default_information_originate_always_type_cmd
);
8290 install_element (OSPF_NODE
,
8291 &ospf_default_information_originate_metric_type_routemap_cmd
);
8292 install_element (OSPF_NODE
,
8293 &ospf_default_information_originate_metric_routemap_cmd
);
8294 install_element (OSPF_NODE
,
8295 &ospf_default_information_originate_routemap_cmd
);
8296 install_element (OSPF_NODE
,
8297 &ospf_default_information_originate_type_metric_routemap_cmd
);
8298 install_element (OSPF_NODE
,
8299 &ospf_default_information_originate_type_routemap_cmd
);
8300 install_element (OSPF_NODE
,
8301 &ospf_default_information_originate_always_metric_type_routemap_cmd
);
8302 install_element (OSPF_NODE
,
8303 &ospf_default_information_originate_always_metric_routemap_cmd
);
8304 install_element (OSPF_NODE
,
8305 &ospf_default_information_originate_always_routemap_cmd
);
8306 install_element (OSPF_NODE
,
8307 &ospf_default_information_originate_always_type_metric_routemap_cmd
);
8308 install_element (OSPF_NODE
,
8309 &ospf_default_information_originate_always_type_routemap_cmd
);
8311 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
8313 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
8314 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
8315 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
8317 install_element (OSPF_NODE
, &ospf_distance_cmd
);
8318 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
8319 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
8320 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_cmd
);
8321 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_cmd
);
8322 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_cmd
);
8323 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_external_cmd
);
8324 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_inter_cmd
);
8325 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_cmd
);
8326 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_cmd
);
8327 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_cmd
);
8328 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_external_cmd
);
8329 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_intra_cmd
);
8330 install_element (OSPF_NODE
, &ospf_distance_ospf_external_cmd
);
8331 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_cmd
);
8332 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_cmd
);
8333 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_inter_cmd
);
8334 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_intra_cmd
);
8336 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
8337 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
8338 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
8339 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
8343 static struct cmd_node ospf_node
=
8346 "%s(config-router)# ",
8351 /* Install OSPF related vty commands. */
8353 ospf_vty_init (void)
8355 /* Install ospf top node. */
8356 install_node (&ospf_node
, ospf_config_write
);
8358 /* "router ospf" commands. */
8359 install_element (CONFIG_NODE
, &router_ospf_cmd
);
8360 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
8362 install_default (OSPF_NODE
);
8364 /* "ospf router-id" commands. */
8365 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
8366 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
8367 install_element (OSPF_NODE
, &router_ospf_id_cmd
);
8368 install_element (OSPF_NODE
, &no_router_ospf_id_cmd
);
8370 /* "passive-interface" commands. */
8371 install_element (OSPF_NODE
, &ospf_passive_interface_addr_cmd
);
8372 install_element (OSPF_NODE
, &ospf_passive_interface_cmd
);
8373 install_element (OSPF_NODE
, &ospf_passive_interface_default_cmd
);
8374 install_element (OSPF_NODE
, &no_ospf_passive_interface_addr_cmd
);
8375 install_element (OSPF_NODE
, &no_ospf_passive_interface_cmd
);
8376 install_element (OSPF_NODE
, &no_ospf_passive_interface_default_cmd
);
8378 /* "ospf abr-type" commands. */
8379 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
8380 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
8382 /* "ospf log-adjacency-changes" commands. */
8383 install_element (OSPF_NODE
, &ospf_log_adjacency_changes_cmd
);
8384 install_element (OSPF_NODE
, &ospf_log_adjacency_changes_detail_cmd
);
8385 install_element (OSPF_NODE
, &no_ospf_log_adjacency_changes_cmd
);
8386 install_element (OSPF_NODE
, &no_ospf_log_adjacency_changes_detail_cmd
);
8388 /* "ospf rfc1583-compatible" commands. */
8389 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
8390 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
8391 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
8392 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
8394 /* "network area" commands. */
8395 install_element (OSPF_NODE
, &ospf_network_area_cmd
);
8396 install_element (OSPF_NODE
, &no_ospf_network_area_cmd
);
8398 /* "area authentication" commands. */
8399 install_element (OSPF_NODE
, &ospf_area_authentication_message_digest_cmd
);
8400 install_element (OSPF_NODE
, &ospf_area_authentication_cmd
);
8401 install_element (OSPF_NODE
, &no_ospf_area_authentication_cmd
);
8403 /* "area range" commands. */
8404 install_element (OSPF_NODE
, &ospf_area_range_cmd
);
8405 install_element (OSPF_NODE
, &ospf_area_range_advertise_cmd
);
8406 install_element (OSPF_NODE
, &ospf_area_range_cost_cmd
);
8407 install_element (OSPF_NODE
, &ospf_area_range_advertise_cost_cmd
);
8408 install_element (OSPF_NODE
, &ospf_area_range_not_advertise_cmd
);
8409 install_element (OSPF_NODE
, &no_ospf_area_range_cmd
);
8410 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cmd
);
8411 install_element (OSPF_NODE
, &no_ospf_area_range_cost_cmd
);
8412 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cost_cmd
);
8413 install_element (OSPF_NODE
, &ospf_area_range_substitute_cmd
);
8414 install_element (OSPF_NODE
, &no_ospf_area_range_substitute_cmd
);
8416 /* "area virtual-link" commands. */
8417 install_element (OSPF_NODE
, &ospf_area_vlink_cmd
);
8418 install_element (OSPF_NODE
, &no_ospf_area_vlink_cmd
);
8420 install_element (OSPF_NODE
, &ospf_area_vlink_param1_cmd
);
8421 install_element (OSPF_NODE
, &no_ospf_area_vlink_param1_cmd
);
8423 install_element (OSPF_NODE
, &ospf_area_vlink_param2_cmd
);
8424 install_element (OSPF_NODE
, &no_ospf_area_vlink_param2_cmd
);
8426 install_element (OSPF_NODE
, &ospf_area_vlink_param3_cmd
);
8427 install_element (OSPF_NODE
, &no_ospf_area_vlink_param3_cmd
);
8429 install_element (OSPF_NODE
, &ospf_area_vlink_param4_cmd
);
8430 install_element (OSPF_NODE
, &no_ospf_area_vlink_param4_cmd
);
8432 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_cmd
);
8433 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_cmd
);
8434 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_cmd
);
8436 install_element (OSPF_NODE
, &ospf_area_vlink_md5_cmd
);
8437 install_element (OSPF_NODE
, &no_ospf_area_vlink_md5_cmd
);
8439 install_element (OSPF_NODE
, &ospf_area_vlink_authkey_cmd
);
8440 install_element (OSPF_NODE
, &no_ospf_area_vlink_authkey_cmd
);
8442 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_authkey_cmd
);
8443 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_authkey_cmd
);
8444 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_authkey_cmd
);
8446 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_md5_cmd
);
8447 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_md5_cmd
);
8448 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_md5_cmd
);
8450 /* "area stub" commands. */
8451 install_element (OSPF_NODE
, &ospf_area_stub_no_summary_cmd
);
8452 install_element (OSPF_NODE
, &ospf_area_stub_cmd
);
8453 install_element (OSPF_NODE
, &no_ospf_area_stub_no_summary_cmd
);
8454 install_element (OSPF_NODE
, &no_ospf_area_stub_cmd
);
8456 /* "area nssa" commands. */
8457 install_element (OSPF_NODE
, &ospf_area_nssa_cmd
);
8458 install_element (OSPF_NODE
, &ospf_area_nssa_translate_no_summary_cmd
);
8459 install_element (OSPF_NODE
, &ospf_area_nssa_translate_cmd
);
8460 install_element (OSPF_NODE
, &ospf_area_nssa_no_summary_cmd
);
8461 install_element (OSPF_NODE
, &no_ospf_area_nssa_cmd
);
8462 install_element (OSPF_NODE
, &no_ospf_area_nssa_no_summary_cmd
);
8464 install_element (OSPF_NODE
, &ospf_area_default_cost_cmd
);
8465 install_element (OSPF_NODE
, &no_ospf_area_default_cost_cmd
);
8467 install_element (OSPF_NODE
, &ospf_area_shortcut_cmd
);
8468 install_element (OSPF_NODE
, &no_ospf_area_shortcut_cmd
);
8470 install_element (OSPF_NODE
, &ospf_area_export_list_cmd
);
8471 install_element (OSPF_NODE
, &no_ospf_area_export_list_cmd
);
8473 install_element (OSPF_NODE
, &ospf_area_filter_list_cmd
);
8474 install_element (OSPF_NODE
, &no_ospf_area_filter_list_cmd
);
8476 install_element (OSPF_NODE
, &ospf_area_import_list_cmd
);
8477 install_element (OSPF_NODE
, &no_ospf_area_import_list_cmd
);
8479 /* SPF timer commands */
8480 install_element (OSPF_NODE
, &ospf_timers_spf_cmd
);
8481 install_element (OSPF_NODE
, &no_ospf_timers_spf_cmd
);
8482 install_element (OSPF_NODE
, &ospf_timers_throttle_spf_cmd
);
8483 install_element (OSPF_NODE
, &no_ospf_timers_throttle_spf_cmd
);
8485 /* refresh timer commands */
8486 install_element (OSPF_NODE
, &ospf_refresh_timer_cmd
);
8487 install_element (OSPF_NODE
, &no_ospf_refresh_timer_val_cmd
);
8488 install_element (OSPF_NODE
, &no_ospf_refresh_timer_cmd
);
8490 /* max-metric commands */
8491 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_admin_cmd
);
8492 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_admin_cmd
);
8493 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_startup_cmd
);
8494 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_startup_cmd
);
8495 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_shutdown_cmd
);
8496 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_shutdown_cmd
);
8498 /* reference bandwidth commands */
8499 install_element (OSPF_NODE
, &ospf_auto_cost_reference_bandwidth_cmd
);
8500 install_element (OSPF_NODE
, &no_ospf_auto_cost_reference_bandwidth_cmd
);
8502 /* "neighbor" commands. */
8503 install_element (OSPF_NODE
, &ospf_neighbor_cmd
);
8504 install_element (OSPF_NODE
, &ospf_neighbor_priority_poll_interval_cmd
);
8505 install_element (OSPF_NODE
, &ospf_neighbor_priority_cmd
);
8506 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_cmd
);
8507 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_priority_cmd
);
8508 install_element (OSPF_NODE
, &no_ospf_neighbor_cmd
);
8509 install_element (OSPF_NODE
, &no_ospf_neighbor_priority_cmd
);
8510 install_element (OSPF_NODE
, &no_ospf_neighbor_poll_interval_cmd
);
8512 /* Init interface related vty commands. */
8513 ospf_vty_if_init ();
8515 /* Init zebra related vty commands. */
8516 ospf_vty_zebra_init ();