2 * Copyright (C) 2000 Toshiaki Takada
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
34 #include "ospfd/ospfd.h"
35 #include "ospfd/ospf_asbr.h"
36 #include "ospfd/ospf_lsa.h"
37 #include "ospfd/ospf_lsdb.h"
38 #include "ospfd/ospf_ism.h"
39 #include "ospfd/ospf_interface.h"
40 #include "ospfd/ospf_nsm.h"
41 #include "ospfd/ospf_neighbor.h"
42 #include "ospfd/ospf_flood.h"
43 #include "ospfd/ospf_abr.h"
44 #include "ospfd/ospf_spf.h"
45 #include "ospfd/ospf_route.h"
46 #include "ospfd/ospf_zebra.h"
47 /*#include "ospfd/ospf_routemap.h" */
48 #include "ospfd/ospf_vty.h"
49 #include "ospfd/ospf_dump.h"
52 static char *ospf_network_type_str
[] =
64 /* Utility functions. */
66 ospf_str2area_id (char *str
, struct in_addr
*area_id
, int *format
)
71 /* match "A.B.C.D". */
72 if (strchr (str
, '.') != NULL
)
74 ret
= inet_aton (str
, area_id
);
77 *format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
79 /* match "<0-4294967295>". */
82 ret
= strtoul (str
, &endptr
, 10);
83 if (*endptr
!= '\0' || (ret
== ULONG_MAX
&& errno
== ERANGE
))
86 area_id
->s_addr
= htonl (ret
);
87 *format
= OSPF_AREA_ID_FORMAT_DECIMAL
;
95 str2distribute_source (char *str
, int *source
)
101 if (strncmp (str
, "k", 1) == 0)
102 *source
= ZEBRA_ROUTE_KERNEL
;
103 else if (strncmp (str
, "c", 1) == 0)
104 *source
= ZEBRA_ROUTE_CONNECT
;
105 else if (strncmp (str
, "s", 1) == 0)
106 *source
= ZEBRA_ROUTE_STATIC
;
107 else if (strncmp (str
, "r", 1) == 0)
108 *source
= ZEBRA_ROUTE_RIP
;
109 else if (strncmp (str
, "b", 1) == 0)
110 *source
= ZEBRA_ROUTE_BGP
;
118 str2metric (char *str
, int *metric
)
124 *metric
= strtol (str
, NULL
, 10);
125 if (*metric
< 0 && *metric
> 16777214)
127 /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
135 str2metric_type (char *str
, int *metric_type
)
141 if (strncmp (str
, "1", 1) == 0)
142 *metric_type
= EXTERNAL_METRIC_TYPE_1
;
143 else if (strncmp (str
, "2", 1) == 0)
144 *metric_type
= EXTERNAL_METRIC_TYPE_2
;
152 ospf_oi_count (struct interface
*ifp
)
154 struct route_node
*rn
;
157 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
168 "Enable a routing process\n"
169 "Start OSPF configuration\n")
171 vty
->node
= OSPF_NODE
;
172 vty
->index
= ospf_get ();
177 DEFUN (no_router_ospf
,
181 "Enable a routing process\n"
182 "Start OSPF configuration\n")
184 if (ospf_top
== NULL
)
186 vty_out (vty
, "There isn't active ospf instance.%s", VTY_NEWLINE
);
190 ospf_finish (ospf_top
);
195 DEFUN (ospf_router_id
,
197 "ospf router-id A.B.C.D",
198 "OSPF specific commands\n"
199 "router-id for the OSPF process\n"
200 "OSPF router-id in IP address format\n")
203 struct in_addr router_id
;
205 ret
= inet_aton (argv
[0], &router_id
);
208 vty_out (vty
, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE
);
212 /* ospf_top->router_id = router_id; */
213 ospf_top
->router_id_static
= router_id
;
215 if (ospf_top
->t_router_id_update
== NULL
)
216 ospf_top
->t_router_id_update
=
217 thread_add_timer (master
, ospf_router_id_update_timer
, NULL
,
218 OSPF_ROUTER_ID_UPDATE_DELAY
);
223 ALIAS (ospf_router_id
,
226 "router-id for the OSPF process\n"
227 "OSPF router-id in IP address format\n")
229 DEFUN (no_ospf_router_id
,
230 no_ospf_router_id_cmd
,
233 "OSPF specific commands\n"
234 "router-id for the OSPF process\n")
236 ospf_top
->router_id_static
.s_addr
= 0;
238 ospf_router_id_update ();
243 ALIAS (no_ospf_router_id
,
247 "router-id for the OSPF process\n")
249 DEFUN (passive_interface
,
250 passive_interface_addr_cmd
,
251 "passive-interface IFNAME A.B.C.D",
252 "Suppress routing updates on an interface\n"
253 "Interface's name\n")
255 struct interface
*ifp
;
258 struct ospf_if_params
*params
;
260 ifp
= if_lookup_by_name (argv
[0]);
264 vty_out (vty
, "Please specify an existing interface%s", VTY_NEWLINE
);
268 params
= IF_DEF_PARAMS (ifp
);
272 ret
= inet_aton(argv
[1], &addr
);
275 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
280 params
= ospf_get_if_params (ifp
, addr
);
281 ospf_if_update_params (ifp
, addr
);
284 SET_IF_PARAM (params
, passive_interface
);
285 params
->passive_interface
= OSPF_IF_PASSIVE
;
290 ALIAS (passive_interface
,
291 passive_interface_cmd
,
292 "passive-interface IFNAME",
293 "Suppress routing updates on an interface\n"
294 "Interface's name\n")
296 DEFUN (no_passive_interface
,
297 no_passive_interface_addr_cmd
,
298 "no passive-interface IFNAME A.B.C.D",
300 "Allow routing updates on an interface\n"
301 "Interface's name\n")
303 struct interface
*ifp
;
305 struct ospf_if_params
*params
;
308 ifp
= if_lookup_by_name (argv
[0]);
312 vty_out (vty
, "Please specify an existing interface%s", VTY_NEWLINE
);
316 params
= IF_DEF_PARAMS (ifp
);
320 ret
= inet_aton(argv
[1], &addr
);
323 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
328 params
= ospf_lookup_if_params (ifp
, addr
);
333 UNSET_IF_PARAM (params
, passive_interface
);
334 params
->passive_interface
= OSPF_IF_ACTIVE
;
336 if (params
!= IF_DEF_PARAMS (ifp
))
338 ospf_free_if_params (ifp
, addr
);
339 ospf_if_update_params (ifp
, addr
);
345 ALIAS (no_passive_interface
,
346 no_passive_interface_cmd
,
347 "no passive-interface IFNAME",
349 "Allow routing updates on an interface\n"
350 "Interface's name\n")
354 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
355 "Enable routing on an IP network\n"
356 "OSPF network prefix\n"
357 "Set the OSPF area ID\n"
358 "OSPF area ID in IP address format\n"
359 "OSPF area ID as a decimal value\n")
361 struct ospf
*ospf
= vty
->index
;
362 struct prefix_ipv4 p
;
363 struct in_addr area_id
;
366 /* Get network prefix and Area ID. */
367 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
368 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
370 ret
= ospf_network_set (ospf
, &p
, area_id
);
373 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
380 DEFUN (no_network_area
,
382 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
384 "Enable routing on an IP network\n"
385 "OSPF network prefix\n"
386 "Set the OSPF area ID\n"
387 "OSPF area ID in IP address format\n"
388 "OSPF area ID as a decimal value\n")
390 struct ospf
*ospf
= (struct ospf
*) vty
->index
;
391 struct prefix_ipv4 p
;
392 struct in_addr area_id
;
395 /* Get network prefix and Area ID. */
396 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
397 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
399 ret
= ospf_network_unset (ospf
, &p
, area_id
);
402 vty_out (vty
, "Can't find specified network area configuration.%s",
413 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
414 "OSPF area parameters\n"
415 "OSPF area ID in IP address format\n"
416 "OSPF area ID as a decimal value\n"
417 "Summarize routes matching address/mask (border routers only)\n"
418 "Area range prefix\n")
420 struct ospf
*ospf
= vty
->index
;
421 struct prefix_ipv4 p
;
422 struct in_addr area_id
;
426 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
427 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
429 ospf_area_range_set (ospf
, area_id
, &p
, OSPF_AREA_RANGE_ADVERTISE
);
432 VTY_GET_UINT32 ("range cost", cost
, argv
[2]);
433 ospf_area_range_cost_set (ospf
, area_id
, &p
, cost
);
440 area_range_advertise_cmd
,
441 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
442 "OSPF area parameters\n"
443 "OSPF area ID in IP address format\n"
444 "OSPF area ID as a decimal value\n"
445 "OSPF area range for route advertise (default)\n"
446 "Area range prefix\n"
447 "Advertise this range (default)\n")
451 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
452 "OSPF area parameters\n"
453 "OSPF area ID in IP address format\n"
454 "OSPF area ID as a decimal value\n"
455 "Summarize routes matching address/mask (border routers only)\n"
456 "Area range prefix\n"
457 "User specified metric for this range\n"
458 "Advertised metric for this range\n")
461 area_range_advertise_cost_cmd
,
462 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
463 "OSPF area parameters\n"
464 "OSPF area ID in IP address format\n"
465 "OSPF area ID as a decimal value\n"
466 "Summarize routes matching address/mask (border routers only)\n"
467 "Area range prefix\n"
468 "Advertise this range (default)\n"
469 "User specified metric for this range\n"
470 "Advertised metric for this range\n")
472 DEFUN (area_range_not_advertise
,
473 area_range_not_advertise_cmd
,
474 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
475 "OSPF area parameters\n"
476 "OSPF area ID in IP address format\n"
477 "OSPF area ID as a decimal value\n"
478 "Summarize routes matching address/mask (border routers only)\n"
479 "Area range prefix\n"
480 "DoNotAdvertise this range\n")
482 struct ospf
*ospf
= vty
->index
;
483 struct prefix_ipv4 p
;
484 struct in_addr area_id
;
487 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
488 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
490 ospf_area_range_set (ospf
, area_id
, &p
, 0);
495 DEFUN (no_area_range
,
497 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
499 "OSPF area parameters\n"
500 "OSPF area ID in IP address format\n"
501 "OSPF area ID as a decimal value\n"
502 "Summarize routes matching address/mask (border routers only)\n"
503 "Area range prefix\n")
505 struct ospf
*ospf
= vty
->index
;
506 struct prefix_ipv4 p
;
507 struct in_addr area_id
;
510 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
511 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
513 ospf_area_range_unset (ospf
, area_id
, &p
);
518 ALIAS (no_area_range
,
519 no_area_range_advertise_cmd
,
520 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-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 "Summarize routes matching address/mask (border routers only)\n"
526 "Area range prefix\n"
527 "Advertise this range (default)\n"
528 "DoNotAdvertise this range\n")
530 ALIAS (no_area_range
,
531 no_area_range_cost_cmd
,
532 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
534 "OSPF area parameters\n"
535 "OSPF area ID in IP address format\n"
536 "OSPF area ID as a decimal value\n"
537 "Summarize routes matching address/mask (border routers only)\n"
538 "Area range prefix\n"
539 "User specified metric for this range\n"
540 "Advertised metric for this range\n")
542 ALIAS (no_area_range
,
543 no_area_range_advertise_cost_cmd
,
544 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
546 "OSPF area parameters\n"
547 "OSPF area ID in IP address format\n"
548 "OSPF area ID as a decimal value\n"
549 "Summarize routes matching address/mask (border routers only)\n"
550 "Area range prefix\n"
551 "Advertise this range (default)\n"
552 "User specified metric for this range\n"
553 "Advertised metric for this range\n")
555 DEFUN (area_range_substitute
,
556 area_range_substitute_cmd
,
557 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
558 "OSPF area parameters\n"
559 "OSPF area ID in IP address format\n"
560 "OSPF area ID as a decimal value\n"
561 "Summarize routes matching address/mask (border routers only)\n"
562 "Area range prefix\n"
563 "Announce area range as another prefix\n"
564 "Network prefix to be announced instead of range\n")
566 struct ospf
*ospf
= vty
->index
;
567 struct prefix_ipv4 p
, s
;
568 struct in_addr area_id
;
571 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
572 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
573 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
575 ospf_area_range_substitute_set (ospf
, area_id
, &p
, &s
);
580 DEFUN (no_area_range_substitute
,
581 no_area_range_substitute_cmd
,
582 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
584 "OSPF area parameters\n"
585 "OSPF area ID in IP address format\n"
586 "OSPF area ID as a decimal value\n"
587 "Summarize routes matching address/mask (border routers only)\n"
588 "Area range prefix\n"
589 "Announce area range as another prefix\n"
590 "Network prefix to be announced instead of range\n")
592 struct ospf
*ospf
= vty
->index
;
593 struct prefix_ipv4 p
, s
;
594 struct in_addr area_id
;
597 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
598 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
599 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
601 ospf_area_range_substitute_unset (ospf
, area_id
, &p
);
607 /* Command Handler Logic in VLink stuff is delicate!!
609 ALTER AT YOUR OWN RISK!!!!
611 Various dummy values are used to represent 'NoChange' state for
612 VLink configuration NOT being changed by a VLink command, and
613 special syntax is used within the command strings so that the
614 typed in command verbs can be seen in the configuration command
615 bacckend handler. This is to drastically reduce the verbeage
616 required to coe up with a reasonably compatible Cisco VLink command
618 - Matthew Grant <grantma@anathoth.gen.nz>
619 Wed, 21 Feb 2001 15:13:52 +1300
623 /* Configuration data for virtual links
625 struct ospf_vl_config_data
{
626 struct vty
*vty
; /* vty stuff */
627 struct in_addr area_id
; /* area ID from command line */
628 int format
; /* command line area ID format */
629 struct in_addr vl_peer
; /* command line vl_peer */
630 int auth_type
; /* Authehntication type, if given */
631 char *auth_key
; /* simple password if present */
632 int crypto_key_id
; /* Cryptographic key ID */
633 char *md5_key
; /* MD5 authentication key */
634 int hello_interval
; /* Obvious what these are... */
635 int retransmit_interval
;
641 ospf_vl_config_data_init (struct ospf_vl_config_data
*vl_config
,
644 memset (vl_config
, 0, sizeof (struct ospf_vl_config_data
));
645 vl_config
->auth_type
= OSPF_AUTH_CMD_NOTSEEN
;
646 vl_config
->vty
= vty
;
649 struct ospf_vl_data
*
650 ospf_find_vl_data (struct ospf_vl_config_data
*vl_config
)
652 struct ospf_area
*area
;
653 struct ospf_vl_data
*vl_data
;
655 struct in_addr area_id
;
657 vty
= vl_config
->vty
;
658 area_id
= vl_config
->area_id
;
660 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
663 "Configuring VLs over the backbone is not allowed%s",
667 area
= ospf_area_get (area_id
, vl_config
->format
);
669 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
671 if (vl_config
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
672 vty_out (vty
, "Area %s is %s%s",
675 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
678 #endif /* HAVE_NSSA */
681 vty_out (vty
, "Area %ld is %s%s",
682 (u_long
)ntohl (area_id
.s_addr
),
684 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
687 #endif /* HAVE_NSSA */
692 if ((vl_data
= ospf_vl_lookup (area
, vl_config
->vl_peer
)) == NULL
)
694 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
695 if (vl_data
->vl_oi
== NULL
)
697 vl_data
->vl_oi
= ospf_vl_new (vl_data
);
698 ospf_vl_add (vl_data
);
699 ospf_spf_calculate_schedule ();
707 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
708 struct ospf_vl_config_data
*vl_config
)
710 struct crypt_key
*ck
;
712 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
714 vty
= vl_config
->vty
;
716 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
718 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
719 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
722 if (vl_config
->auth_key
)
724 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
725 strncpy (IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
726 OSPF_AUTH_SIMPLE_SIZE
);
728 else if (vl_config
->md5_key
)
730 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
733 vty_out (vty
, "OSPF: Key %d already exists%s",
734 vl_config
->crypto_key_id
, VTY_NEWLINE
);
737 ck
= ospf_crypt_key_new ();
738 ck
->key_id
= vl_config
->crypto_key_id
;
739 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
740 strncpy (ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
742 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
744 else if (vl_config
->crypto_key_id
!= 0)
748 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
749 vl_config
->crypto_key_id
) == NULL
)
751 vty_out (vty
, "OSPF: Key %d does not exist%s",
752 vl_config
->crypto_key_id
, VTY_NEWLINE
);
756 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
766 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
767 struct ospf_vl_config_data
*vl_config
)
769 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
770 /* Virtual Link data initialised to defaults, so only set
772 if (vl_config
->hello_interval
)
774 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
775 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
778 if (vl_config
->dead_interval
)
780 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
781 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
784 if (vl_config
->retransmit_interval
)
786 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
787 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
790 if (vl_config
->transmit_delay
)
792 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
793 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
801 /* The business end of all of the above */
803 ospf_vl_set (struct ospf_vl_config_data
*vl_config
)
805 struct ospf_vl_data
*vl_data
;
808 vl_data
= ospf_find_vl_data (vl_config
);
812 /* Process this one first as it can have a fatal result, which can
813 only logically occur if the virtual link exists already
814 Thus a command error does not result in a change to the
815 running configuration such as unexpectedly altered timer
817 ret
= ospf_vl_set_security (vl_data
, vl_config
);
818 if (ret
!= CMD_SUCCESS
)
821 /* Set any time based parameters, these area already range checked */
823 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
824 if (ret
!= CMD_SUCCESS
)
831 /* This stuff exists to make specifying all the alias commands A LOT simpler
833 #define VLINK_HELPSTR_IPADDR \
834 "OSPF area parameters\n" \
835 "OSPF area ID in IP address format\n" \
836 "OSPF area ID as a decimal value\n" \
837 "Configure a virtual link\n" \
838 "Router ID of the remote ABR\n"
840 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
841 "Enable authentication on this virtual link\n" \
844 #define VLINK_HELPSTR_AUTHTYPE_ALL \
845 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
846 "Use null authentication\n" \
847 "Use message-digest authentication\n"
849 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
850 "Time between HELLO packets\n" \
851 "Time between retransmitting lost link state advertisements\n" \
852 "Link state transmit delay\n" \
853 "Interval after which a neighbor is declared dead\n"
855 #define VLINK_HELPSTR_TIME_PARAM \
856 VLINK_HELPSTR_TIME_PARAM_NOSECS \
859 #define VLINK_HELPSTR_AUTH_SIMPLE \
860 "Authentication password (key)\n" \
861 "The OSPF password (key)"
863 #define VLINK_HELPSTR_AUTH_MD5 \
864 "Message digest authentication password (key)\n" \
867 "Use MD5 algorithm\n" \
868 "The OSPF password (key)"
872 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
873 VLINK_HELPSTR_IPADDR
)
875 struct ospf_vl_config_data vl_config
;
876 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
877 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
881 ospf_vl_config_data_init(&vl_config
, vty
);
883 /* Read off first 2 parameters and check them */
884 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &vl_config
.format
);
887 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
891 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
894 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
901 /* Thats all folks! - BUGS B. strikes again!!!*/
903 return ospf_vl_set (&vl_config
);
906 /* Deal with other parameters */
907 for (i
=2; i
< argc
; i
++)
910 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
916 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
918 /* authentication-key - this option can occur anywhere on
919 command line. At start of command line
920 must check for authentication option. */
921 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
922 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
923 vl_config
.auth_key
= auth_key
;
926 else if (strncmp (argv
[i
], "authentication", 14) == 0)
928 /* authentication - this option can only occur at start
930 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
933 if (strncmp (argv
[i
+1], "n", 1) == 0)
935 /* "authentication null" */
936 vl_config
.auth_type
= OSPF_AUTH_NULL
;
939 else if (strncmp (argv
[i
+1], "m", 1) == 0
940 && strcmp (argv
[i
+1], "message-digest-") != 0)
942 /* "authentication message-digest" */
943 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
951 /* message-digest-key */
953 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
954 if (vl_config
.crypto_key_id
< 0)
957 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
958 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
959 vl_config
.md5_key
= md5_key
;
965 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
966 if (vl_config
.hello_interval
< 0)
971 /* Retransmit Interval */
973 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
974 if (vl_config
.retransmit_interval
< 0)
981 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
982 if (vl_config
.transmit_delay
< 0)
989 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
990 if (vl_config
.dead_interval
< 0)
997 /* Action configuration */
999 return ospf_vl_set (&vl_config
);
1003 DEFUN (no_area_vlink
,
1005 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1007 VLINK_HELPSTR_IPADDR
)
1009 struct ospf_area
*area
;
1010 struct ospf_vl_config_data vl_config
;
1011 struct ospf_vl_data
*vl_data
= NULL
;
1012 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1016 ospf_vl_config_data_init(&vl_config
, vty
);
1018 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &format
);
1021 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1025 area
= ospf_area_lookup_by_area_id (vl_config
.area_id
);
1028 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1032 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1035 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1042 /* Basic VLink no command */
1043 /* Thats all folks! - BUGS B. strikes again!!!*/
1044 if ((vl_data
= ospf_vl_lookup (area
, vl_config
.vl_peer
)))
1045 ospf_vl_delete (vl_data
);
1047 ospf_area_check_free (vl_config
.area_id
);
1052 /* If we are down here, we are reseting parameters */
1054 /* Deal with other parameters */
1055 for (i
=2; i
< argc
; i
++)
1058 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1064 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1066 /* authentication-key - this option can occur anywhere on
1067 command line. At start of command line
1068 must check for authentication option. */
1069 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1070 vl_config
.auth_key
= auth_key
;
1072 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1074 /* authentication - this option can only occur at start
1076 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1081 /* message-digest-key */
1082 /* Delete one key */
1084 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1085 if (vl_config
.crypto_key_id
< 0)
1087 vl_config
.md5_key
= NULL
;
1091 /* Hello interval */
1092 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1096 /* Retransmit Interval */
1097 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1101 /* Transmit Delay */
1102 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1108 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1114 /* Action configuration */
1116 return ospf_vl_set (&vl_config
);
1120 area_vlink_param1_cmd
,
1121 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1122 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1123 VLINK_HELPSTR_IPADDR
1124 VLINK_HELPSTR_TIME_PARAM
)
1126 ALIAS (no_area_vlink
,
1127 no_area_vlink_param1_cmd
,
1128 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1129 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1131 VLINK_HELPSTR_IPADDR
1132 VLINK_HELPSTR_TIME_PARAM
)
1135 area_vlink_param2_cmd
,
1136 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1137 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1138 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1139 VLINK_HELPSTR_IPADDR
1140 VLINK_HELPSTR_TIME_PARAM
1141 VLINK_HELPSTR_TIME_PARAM
)
1143 ALIAS (no_area_vlink
,
1144 no_area_vlink_param2_cmd
,
1145 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1146 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1147 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1149 VLINK_HELPSTR_IPADDR
1150 VLINK_HELPSTR_TIME_PARAM
1151 VLINK_HELPSTR_TIME_PARAM
)
1154 area_vlink_param3_cmd
,
1155 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1156 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1157 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1158 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1159 VLINK_HELPSTR_IPADDR
1160 VLINK_HELPSTR_TIME_PARAM
1161 VLINK_HELPSTR_TIME_PARAM
1162 VLINK_HELPSTR_TIME_PARAM
)
1164 ALIAS (no_area_vlink
,
1165 no_area_vlink_param3_cmd
,
1166 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1167 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1168 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1169 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1171 VLINK_HELPSTR_IPADDR
1172 VLINK_HELPSTR_TIME_PARAM
1173 VLINK_HELPSTR_TIME_PARAM
1174 VLINK_HELPSTR_TIME_PARAM
)
1177 area_vlink_param4_cmd
,
1178 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1179 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1180 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1181 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1182 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1183 VLINK_HELPSTR_IPADDR
1184 VLINK_HELPSTR_TIME_PARAM
1185 VLINK_HELPSTR_TIME_PARAM
1186 VLINK_HELPSTR_TIME_PARAM
1187 VLINK_HELPSTR_TIME_PARAM
)
1189 ALIAS (no_area_vlink
,
1190 no_area_vlink_param4_cmd
,
1191 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1192 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1193 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1194 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1195 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1197 VLINK_HELPSTR_IPADDR
1198 VLINK_HELPSTR_TIME_PARAM
1199 VLINK_HELPSTR_TIME_PARAM
1200 VLINK_HELPSTR_TIME_PARAM
1201 VLINK_HELPSTR_TIME_PARAM
)
1204 area_vlink_authtype_args_cmd
,
1205 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1206 "(authentication|) (message-digest|null)",
1207 VLINK_HELPSTR_IPADDR
1208 VLINK_HELPSTR_AUTHTYPE_ALL
)
1211 area_vlink_authtype_cmd
,
1212 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1213 "(authentication|)",
1214 VLINK_HELPSTR_IPADDR
1215 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1217 ALIAS (no_area_vlink
,
1218 no_area_vlink_authtype_cmd
,
1219 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1220 "(authentication|)",
1222 VLINK_HELPSTR_IPADDR
1223 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1227 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1228 "(message-digest-key|) <1-255> md5 KEY",
1229 VLINK_HELPSTR_IPADDR
1230 VLINK_HELPSTR_AUTH_MD5
)
1232 ALIAS (no_area_vlink
,
1233 no_area_vlink_md5_cmd
,
1234 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1235 "(message-digest-key|) <1-255>",
1237 VLINK_HELPSTR_IPADDR
1238 VLINK_HELPSTR_AUTH_MD5
)
1241 area_vlink_authkey_cmd
,
1242 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1243 "(authentication-key|) AUTH_KEY",
1244 VLINK_HELPSTR_IPADDR
1245 VLINK_HELPSTR_AUTH_SIMPLE
)
1247 ALIAS (no_area_vlink
,
1248 no_area_vlink_authkey_cmd
,
1249 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1250 "(authentication-key|)",
1252 VLINK_HELPSTR_IPADDR
1253 VLINK_HELPSTR_AUTH_SIMPLE
)
1256 area_vlink_authtype_args_authkey_cmd
,
1257 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1258 "(authentication|) (message-digest|null) "
1259 "(authentication-key|) AUTH_KEY",
1260 VLINK_HELPSTR_IPADDR
1261 VLINK_HELPSTR_AUTHTYPE_ALL
1262 VLINK_HELPSTR_AUTH_SIMPLE
)
1265 area_vlink_authtype_authkey_cmd
,
1266 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1267 "(authentication|) "
1268 "(authentication-key|) AUTH_KEY",
1269 VLINK_HELPSTR_IPADDR
1270 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1271 VLINK_HELPSTR_AUTH_SIMPLE
)
1273 ALIAS (no_area_vlink
,
1274 no_area_vlink_authtype_authkey_cmd
,
1275 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1276 "(authentication|) "
1277 "(authentication-key|)",
1279 VLINK_HELPSTR_IPADDR
1280 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1281 VLINK_HELPSTR_AUTH_SIMPLE
)
1284 area_vlink_authtype_args_md5_cmd
,
1285 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1286 "(authentication|) (message-digest|null) "
1287 "(message-digest-key|) <1-255> md5 KEY",
1288 VLINK_HELPSTR_IPADDR
1289 VLINK_HELPSTR_AUTHTYPE_ALL
1290 VLINK_HELPSTR_AUTH_MD5
)
1293 area_vlink_authtype_md5_cmd
,
1294 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1295 "(authentication|) "
1296 "(message-digest-key|) <1-255> md5 KEY",
1297 VLINK_HELPSTR_IPADDR
1298 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1299 VLINK_HELPSTR_AUTH_MD5
)
1301 ALIAS (no_area_vlink
,
1302 no_area_vlink_authtype_md5_cmd
,
1303 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1304 "(authentication|) "
1305 "(message-digest-key|)",
1307 VLINK_HELPSTR_IPADDR
1308 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1309 VLINK_HELPSTR_AUTH_MD5
)
1312 DEFUN (area_shortcut
,
1314 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1315 "OSPF area parameters\n"
1316 "OSPF area ID in IP address format\n"
1317 "OSPF area ID as a decimal value\n"
1318 "Configure the area's shortcutting mode\n"
1319 "Set default shortcutting behavior\n"
1320 "Enable shortcutting through the area\n"
1321 "Disable shortcutting through the area\n")
1323 struct ospf_area
*area
;
1324 struct in_addr area_id
;
1328 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1330 area
= ospf_area_get (area_id
, format
);
1332 if (strncmp (argv
[1], "de", 2) == 0)
1333 mode
= OSPF_SHORTCUT_DEFAULT
;
1334 else if (strncmp (argv
[1], "di", 2) == 0)
1335 mode
= OSPF_SHORTCUT_DISABLE
;
1336 else if (strncmp (argv
[1], "e", 1) == 0)
1337 mode
= OSPF_SHORTCUT_ENABLE
;
1341 ospf_area_shortcut_set (area
, mode
);
1343 if (ospf_top
->abr_type
!= OSPF_ABR_SHORTCUT
)
1344 vty_out (vty
, "Shortcut area setting will take effect "
1345 "only when the router is configured as Shortcut ABR%s",
1351 DEFUN (no_area_shortcut
,
1352 no_area_shortcut_cmd
,
1353 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1355 "OSPF area parameters\n"
1356 "OSPF area ID in IP address format\n"
1357 "OSPF area ID as a decimal value\n"
1358 "Deconfigure the area's shortcutting mode\n"
1359 "Deconfigure enabled shortcutting through the area\n"
1360 "Deconfigure disabled shortcutting through the area\n")
1362 struct ospf_area
*area
;
1363 struct in_addr area_id
;
1366 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1368 area
= ospf_area_lookup_by_area_id (area_id
);
1372 ospf_area_shortcut_unset (area
);
1380 "area (A.B.C.D|<0-4294967295>) stub",
1381 "OSPF area parameters\n"
1382 "OSPF area ID in IP address format\n"
1383 "OSPF area ID as a decimal value\n"
1384 "Configure OSPF area as stub\n")
1386 struct ospf
*ospf
= vty
->index
;
1387 struct in_addr area_id
;
1390 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1392 ret
= ospf_area_stub_set (ospf
, area_id
);
1395 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1400 ospf_area_no_summary_unset (ospf
, area_id
);
1405 DEFUN (area_stub_no_summary
,
1406 area_stub_no_summary_cmd
,
1407 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1408 "OSPF stub parameters\n"
1409 "OSPF area ID in IP address format\n"
1410 "OSPF area ID as a decimal value\n"
1411 "Configure OSPF area as stub\n"
1412 "Do not inject inter-area routes into stub\n")
1414 struct ospf
*ospf
= vty
->index
;
1415 struct in_addr area_id
;
1418 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1420 ret
= ospf_area_stub_set (ospf
, area_id
);
1423 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1428 ospf_area_no_summary_set (ospf
, area_id
);
1433 DEFUN (no_area_stub
,
1435 "no area (A.B.C.D|<0-4294967295>) stub",
1437 "OSPF area parameters\n"
1438 "OSPF area ID in IP address format\n"
1439 "OSPF area ID as a decimal value\n"
1440 "Configure OSPF area as stub\n")
1442 struct ospf
*ospf
= vty
->index
;
1443 struct in_addr area_id
;
1446 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1448 ospf_area_stub_unset (ospf
, area_id
);
1449 ospf_area_no_summary_unset (ospf
, area_id
);
1454 DEFUN (no_area_stub_no_summary
,
1455 no_area_stub_no_summary_cmd
,
1456 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1458 "OSPF area parameters\n"
1459 "OSPF area ID in IP address format\n"
1460 "OSPF area ID as a decimal value\n"
1461 "Configure OSPF area as stub\n"
1462 "Do not inject inter-area routes into area\n")
1464 struct ospf
*ospf
= vty
->index
;
1465 struct in_addr area_id
;
1468 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1469 ospf_area_no_summary_unset (ospf
, area_id
);
1477 "area (A.B.C.D|<0-4294967295>) nssa",
1478 "OSPF area parameters\n"
1479 "OSPF area ID in IP address format\n"
1480 "OSPF area ID as a decimal value\n"
1481 "Configure OSPF area as nssa\n")
1483 struct ospf
*ospf
= vty
->index
;
1484 struct in_addr area_id
;
1487 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1489 ret
= ospf_area_nssa_set (ospf
, area_id
);
1492 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1499 if (strncmp (argv
[1], "translate-c", 11) == 0)
1500 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1501 OSPF_NSSA_ROLE_CANDIDATE
);
1502 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1503 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1504 OSPF_NSSA_ROLE_NEVER
);
1505 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1506 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1507 OSPF_NSSA_ROLE_ALWAYS
);
1511 ospf_area_no_summary_set (ospf
, area_id
);
1517 area_nssa_translate_no_summary_cmd
,
1518 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) (no-summary|)",
1519 "OSPF area parameters\n"
1520 "OSPF area ID in IP address format\n"
1521 "OSPF area ID as a decimal value\n"
1522 "Configure OSPF area as nssa\n"
1523 "Configure NSSA-ABR for translate election (default)\n"
1524 "Configure NSSA-ABR to never translate\n"
1525 "Configure NSSA-ABR to always translate\n"
1526 "Do not inject inter-area routes into nssa\n"
1530 area_nssa_translate_cmd
,
1531 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1532 "OSPF area parameters\n"
1533 "OSPF area ID in IP address format\n"
1534 "OSPF area ID as a decimal value\n"
1535 "Configure OSPF area as nssa\n"
1536 "Configure NSSA-ABR for translate election (default)\n"
1537 "Configure NSSA-ABR to never translate\n"
1538 "Configure NSSA-ABR to always translate\n")
1540 DEFUN (area_nssa_no_summary
,
1541 area_nssa_no_summary_cmd
,
1542 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1543 "OSPF area parameters\n"
1544 "OSPF area ID in IP address format\n"
1545 "OSPF area ID as a decimal value\n"
1546 "Configure OSPF area as nssa\n"
1547 "Do not inject inter-area routes into nssa\n")
1549 struct ospf
*ospf
= vty
->index
;
1550 struct in_addr area_id
;
1553 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1555 ret
= ospf_area_nssa_set (ospf
, area_id
);
1558 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1563 ospf_area_no_summary_set (ospf
, area_id
);
1568 DEFUN (no_area_nssa
,
1570 "no area (A.B.C.D|<0-4294967295>) nssa",
1572 "OSPF area parameters\n"
1573 "OSPF area ID in IP address format\n"
1574 "OSPF area ID as a decimal value\n"
1575 "Configure OSPF area as nssa\n")
1577 struct ospf
*ospf
= vty
->index
;
1578 struct in_addr area_id
;
1581 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1583 ospf_area_nssa_unset (ospf
, area_id
);
1584 ospf_area_no_summary_unset (ospf
, area_id
);
1589 DEFUN (no_area_nssa_no_summary
,
1590 no_area_nssa_no_summary_cmd
,
1591 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1593 "OSPF area parameters\n"
1594 "OSPF area ID in IP address format\n"
1595 "OSPF area ID as a decimal value\n"
1596 "Configure OSPF area as nssa\n"
1597 "Do not inject inter-area routes into nssa\n")
1599 struct ospf
*ospf
= vty
->index
;
1600 struct in_addr area_id
;
1603 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1604 ospf_area_no_summary_unset (ospf
, area_id
);
1609 #endif /* HAVE_NSSA */
1611 DEFUN (area_default_cost
,
1612 area_default_cost_cmd
,
1613 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1614 "OSPF area parameters\n"
1615 "OSPF area ID in IP address format\n"
1616 "OSPF area ID as a decimal value\n"
1617 "Set the summary-default cost of a NSSA or stub area\n"
1618 "Stub's advertised default summary cost\n")
1620 struct ospf_area
*area
;
1621 struct in_addr area_id
;
1625 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1626 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1628 area
= ospf_area_get (area_id
, format
);
1630 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1632 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1636 area
->default_cost
= cost
;
1641 DEFUN (no_area_default_cost
,
1642 no_area_default_cost_cmd
,
1643 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1645 "OSPF area parameters\n"
1646 "OSPF area ID in IP address format\n"
1647 "OSPF area ID as a decimal value\n"
1648 "Set the summary-default cost of a NSSA or stub area\n"
1649 "Stub's advertised default summary cost\n")
1651 struct ospf_area
*area
;
1652 struct in_addr area_id
;
1656 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1657 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1659 area
= ospf_area_lookup_by_area_id (area_id
);
1663 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1665 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1669 area
->default_cost
= 1;
1671 ospf_area_check_free (area_id
);
1676 DEFUN (area_export_list
,
1677 area_export_list_cmd
,
1678 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1679 "OSPF area parameters\n"
1680 "OSPF area ID in IP address format\n"
1681 "OSPF area ID as a decimal value\n"
1682 "Set the filter for networks announced to other areas\n"
1683 "Name of the access-list\n")
1685 struct ospf_area
*area
;
1686 struct in_addr area_id
;
1689 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id
, format
, argv
[0]);
1691 area
= ospf_area_get (area_id
, format
);
1692 ospf_area_export_list_set (area
, argv
[1]);
1697 DEFUN (no_area_export_list
,
1698 no_area_export_list_cmd
,
1699 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1701 "OSPF area parameters\n"
1702 "OSPF area ID in IP address format\n"
1703 "OSPF area ID as a decimal value\n"
1704 "Unset the filter for networks announced to other areas\n"
1705 "Name of the access-list\n")
1707 struct ospf_area
*area
;
1708 struct in_addr area_id
;
1711 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id
, format
, argv
[0]);
1713 area
= ospf_area_lookup_by_area_id (area_id
);
1717 ospf_area_export_list_unset (area
);
1723 DEFUN (area_import_list
,
1724 area_import_list_cmd
,
1725 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1726 "OSPF area parameters\n"
1727 "OSPF area ID in IP address format\n"
1728 "OSPF area ID as a decimal value\n"
1729 "Set the filter for networks from other areas announced to the specified one\n"
1730 "Name of the access-list\n")
1732 struct ospf_area
*area
;
1733 struct in_addr area_id
;
1736 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id
, format
, argv
[0]);
1738 area
= ospf_area_get (area_id
, format
);
1739 ospf_area_import_list_set (area
, argv
[1]);
1744 DEFUN (no_area_import_list
,
1745 no_area_import_list_cmd
,
1746 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1748 "OSPF area parameters\n"
1749 "OSPF area ID in IP address format\n"
1750 "OSPF area ID as a decimal value\n"
1751 "Unset the filter for networks announced to other areas\n"
1752 "Name of the access-list\n")
1754 struct ospf_area
*area
;
1755 struct in_addr area_id
;
1758 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id
, format
, argv
[0]);
1759 area
= ospf_area_lookup_by_area_id (area_id
);
1763 ospf_area_import_list_unset (area
);
1768 DEFUN (area_filter_list
,
1769 area_filter_list_cmd
,
1770 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1771 "OSPF area parameters\n"
1772 "OSPF area ID in IP address format\n"
1773 "OSPF area ID as a decimal value\n"
1774 "Filter networks between OSPF areas\n"
1775 "Filter prefixes between OSPF areas\n"
1776 "Name of an IP prefix-list\n"
1777 "Filter networks sent to this area\n"
1778 "Filter networks sent from this area\n")
1780 struct ospf_area
*area
;
1781 struct in_addr area_id
;
1782 struct prefix_list
*plist
;
1785 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1787 area
= ospf_area_get (area_id
, format
);
1788 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1789 if (strncmp (argv
[2], "in", 2) == 0)
1791 PREFIX_LIST_IN (area
) = plist
;
1792 if (PREFIX_NAME_IN (area
))
1793 free (PREFIX_NAME_IN (area
));
1795 PREFIX_NAME_IN (area
) = strdup (argv
[1]);
1796 ospf_schedule_abr_task ();
1800 PREFIX_LIST_OUT (area
) = plist
;
1801 if (PREFIX_NAME_OUT (area
))
1802 free (PREFIX_NAME_OUT (area
));
1804 PREFIX_NAME_OUT (area
) = strdup (argv
[1]);
1805 ospf_schedule_abr_task ();
1811 DEFUN (no_area_filter_list
,
1812 no_area_filter_list_cmd
,
1813 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1815 "OSPF area parameters\n"
1816 "OSPF area ID in IP address format\n"
1817 "OSPF area ID as a decimal value\n"
1818 "Filter networks between OSPF areas\n"
1819 "Filter prefixes between OSPF areas\n"
1820 "Name of an IP prefix-list\n"
1821 "Filter networks sent to this area\n"
1822 "Filter networks sent from this area\n")
1824 struct ospf_area
*area
;
1825 struct in_addr area_id
;
1826 struct prefix_list
*plist
;
1829 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1831 area
= ospf_area_lookup_by_area_id (area_id
);
1832 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1833 if (strncmp (argv
[2], "in", 2) == 0)
1835 if (PREFIX_NAME_IN (area
))
1836 if (strcmp (PREFIX_NAME_IN (area
), argv
[1]) != 0)
1839 PREFIX_LIST_IN (area
) = NULL
;
1840 if (PREFIX_NAME_IN (area
))
1841 free (PREFIX_NAME_IN (area
));
1843 PREFIX_NAME_IN (area
) = NULL
;
1845 ospf_schedule_abr_task ();
1849 if (PREFIX_NAME_OUT (area
))
1850 if (strcmp (PREFIX_NAME_OUT (area
), argv
[1]) != 0)
1853 PREFIX_LIST_OUT (area
) = NULL
;
1854 if (PREFIX_NAME_OUT (area
))
1855 free (PREFIX_NAME_OUT (area
));
1857 PREFIX_NAME_OUT (area
) = NULL
;
1859 ospf_schedule_abr_task ();
1866 DEFUN (area_authentication_message_digest
,
1867 area_authentication_message_digest_cmd
,
1868 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1869 "OSPF area parameters\n"
1870 "Enable authentication\n"
1871 "Use message-digest authentication\n")
1873 struct ospf_area
*area
;
1874 struct in_addr area_id
;
1877 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1879 area
= ospf_area_get (area_id
, format
);
1880 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1885 DEFUN (area_authentication
,
1886 area_authentication_cmd
,
1887 "area (A.B.C.D|<0-4294967295>) authentication",
1888 "OSPF area parameters\n"
1889 "OSPF area ID in IP address format\n"
1890 "OSPF area ID as a decimal value\n"
1891 "Enable authentication\n")
1893 struct ospf_area
*area
;
1894 struct in_addr area_id
;
1897 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1899 area
= ospf_area_get (area_id
, format
);
1900 area
->auth_type
= OSPF_AUTH_SIMPLE
;
1905 DEFUN (no_area_authentication
,
1906 no_area_authentication_cmd
,
1907 "no area (A.B.C.D|<0-4294967295>) authentication",
1909 "OSPF area parameters\n"
1910 "OSPF area ID in IP address format\n"
1911 "OSPF area ID as a decimal value\n"
1912 "Enable authentication\n")
1914 struct ospf_area
*area
;
1915 struct in_addr area_id
;
1918 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1920 area
= ospf_area_lookup_by_area_id (area_id
);
1924 area
->auth_type
= OSPF_AUTH_NULL
;
1926 ospf_area_check_free (area_id
);
1932 DEFUN (ospf_abr_type
,
1934 "ospf abr-type (cisco|ibm|shortcut|standard)",
1935 "OSPF specific commands\n"
1936 "Set OSPF ABR type\n"
1937 "Alternative ABR, cisco implementation\n"
1938 "Alternative ABR, IBM implementation\n"
1940 "Standard behavior (RFC2328)\n")
1942 u_char abr_type
= OSPF_ABR_UNKNOWN
;
1944 if (strncmp (argv
[0], "c", 1) == 0)
1945 abr_type
= OSPF_ABR_CISCO
;
1946 else if (strncmp (argv
[0], "i", 1) == 0)
1947 abr_type
= OSPF_ABR_IBM
;
1948 else if (strncmp (argv
[0], "sh", 2) == 0)
1949 abr_type
= OSPF_ABR_SHORTCUT
;
1950 else if (strncmp (argv
[0], "st", 2) == 0)
1951 abr_type
= OSPF_ABR_STAND
;
1955 /* If ABR type value is changed, schedule ABR task. */
1956 if (ospf_top
->abr_type
!= abr_type
)
1958 ospf_top
->abr_type
= abr_type
;
1959 ospf_schedule_abr_task ();
1965 DEFUN (no_ospf_abr_type
,
1966 no_ospf_abr_type_cmd
,
1967 "no ospf abr-type (cisco|ibm|shortcut)",
1969 "OSPF specific commands\n"
1970 "Set OSPF ABR type\n"
1971 "Alternative ABR, cisco implementation\n"
1972 "Alternative ABR, IBM implementation\n"
1975 u_char abr_type
= OSPF_ABR_UNKNOWN
;
1977 if (strncmp (argv
[0], "c", 1) == 0)
1978 abr_type
= OSPF_ABR_CISCO
;
1979 else if (strncmp (argv
[0], "i", 1) == 0)
1980 abr_type
= OSPF_ABR_IBM
;
1981 else if (strncmp (argv
[0], "s", 1) == 0)
1982 abr_type
= OSPF_ABR_SHORTCUT
;
1986 /* If ABR type value is changed, schedule ABR task. */
1987 if (ospf_top
->abr_type
== abr_type
)
1989 ospf_top
->abr_type
= OSPF_ABR_STAND
;
1990 ospf_schedule_abr_task ();
1996 DEFUN (ospf_compatible_rfc1583
,
1997 ospf_compatible_rfc1583_cmd
,
1998 "compatible rfc1583",
1999 "OSPF compatibility list\n"
2000 "compatible with RFC 1583\n")
2002 struct ospf
*ospf
= vty
->index
;
2004 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2006 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2007 ospf_spf_calculate_schedule ();
2012 DEFUN (no_ospf_compatible_rfc1583
,
2013 no_ospf_compatible_rfc1583_cmd
,
2014 "no compatible rfc1583",
2016 "OSPF compatibility list\n"
2017 "compatible with RFC 1583\n")
2019 struct ospf
*ospf
= vty
->index
;
2021 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2023 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2024 ospf_spf_calculate_schedule ();
2029 ALIAS (ospf_compatible_rfc1583
,
2030 ospf_rfc1583_flag_cmd
,
2031 "ospf rfc1583compatibility",
2032 "OSPF specific commands\n"
2033 "Enable the RFC1583Compatibility flag\n")
2035 ALIAS (no_ospf_compatible_rfc1583
,
2036 no_ospf_rfc1583_flag_cmd
,
2037 "no ospf rfc1583compatibility",
2039 "OSPF specific commands\n"
2040 "Disable the RFC1583Compatibility flag\n")
2044 "timers spf <0-4294967295> <0-4294967295>",
2045 "Adjust routing timers\n"
2047 "Delay between receiving a change to SPF calculation\n"
2048 "Hold time between consecutive SPF calculations\n")
2050 struct ospf
*ospf
= vty
->index
;
2051 u_int32_t delay
, hold
;
2053 VTY_GET_UINT32 ("SPF delay timer", delay
, argv
[0]);
2054 VTY_GET_UINT32 ("SPF hold timer", hold
, argv
[1]);
2056 ospf_timers_spf_set (ospf
, delay
, hold
);
2061 DEFUN (no_timers_spf
,
2065 "Adjust routing timers\n"
2066 "OSPF SPF timers\n")
2068 ospf_top
->spf_delay
= OSPF_SPF_DELAY_DEFAULT
;
2069 ospf_top
->spf_holdtime
= OSPF_SPF_HOLDTIME_DEFAULT
;
2079 "Neighbor IP address\n")
2081 struct ospf
*ospf
= vty
->index
;
2082 struct in_addr nbr_addr
;
2083 int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2084 int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2086 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2089 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2092 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2094 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2096 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2098 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, priority
);
2104 neighbor_priority_poll_interval_cmd
,
2105 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2107 "Neighbor IP address\n"
2108 "Neighbor Priority\n"
2110 "Dead Neighbor Polling interval\n"
2114 neighbor_priority_cmd
,
2115 "neighbor A.B.C.D priority <0-255>",
2117 "Neighbor IP address\n"
2118 "Neighbor Priority\n"
2121 DEFUN (neighbor_poll_interval
,
2122 neighbor_poll_interval_cmd
,
2123 "neighbor A.B.C.D poll-interval <1-65535>",
2125 "Neighbor IP address\n"
2126 "Dead Neighbor Polling interval\n"
2129 struct ospf
*ospf
= vty
->index
;
2130 struct in_addr nbr_addr
;
2131 int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2132 int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2134 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2137 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[1], 1, 65535);
2140 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2142 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2144 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2146 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2151 ALIAS (neighbor_poll_interval
,
2152 neighbor_poll_interval_priority_cmd
,
2153 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2155 "Neighbor address\n"
2156 "OSPF dead-router polling interval\n"
2158 "OSPF priority of non-broadcast neighbor\n"
2163 "no neighbor A.B.C.D",
2166 "Neighbor IP address\n")
2168 struct ospf
*ospf
= vty
->index
;
2169 struct in_addr nbr_addr
;
2172 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2174 ret
= ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2180 no_neighbor_priority_cmd
,
2181 "no neighbor A.B.C.D priority <0-255>",
2184 "Neighbor IP address\n"
2185 "Neighbor Priority\n"
2189 no_neighbor_poll_interval_cmd
,
2190 "no neighbor A.B.C.D poll-interval <1-65535>",
2193 "Neighbor IP address\n"
2194 "Dead Neighbor Polling interval\n"
2198 no_neighbor_priority_pollinterval_cmd
,
2199 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2202 "Neighbor IP address\n"
2203 "Neighbor Priority\n"
2205 "Dead Neighbor Polling interval\n"
2209 DEFUN (refresh_timer
, refresh_timer_cmd
,
2210 "refresh timer <10-1800>",
2211 "Adjust refresh parameters\n"
2212 "Set refresh timer\n"
2213 "Timer value in seconds\n")
2215 struct ospf
*ospf
= vty
->index
;
2218 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2219 interval
= (interval
/ 10) * 10;
2221 ospf_timers_refresh_set (ospf
, interval
);
2226 DEFUN (no_refresh_timer
, no_refresh_timer_val_cmd
,
2227 "no refresh timer <10-1800>",
2228 "Adjust refresh parameters\n"
2229 "Unset refresh timer\n"
2230 "Timer value in seconds\n")
2232 struct ospf
*ospf
= vty
->index
;
2237 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2239 if (ospf
->lsa_refresh_interval
!= interval
||
2240 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2244 ospf_timers_refresh_unset (ospf
);
2249 ALIAS (no_refresh_timer
,
2250 no_refresh_timer_cmd
,
2252 "Adjust refresh parameters\n"
2253 "Unset refresh timer\n")
2255 DEFUN (auto_cost_reference_bandwidth
,
2256 auto_cost_reference_bandwidth_cmd
,
2257 "auto-cost reference-bandwidth <1-4294967>",
2258 "Calculate OSPF interface cost according to bandwidth\n"
2259 "Use reference bandwidth method to assign OSPF cost\n"
2260 "The reference bandwidth in terms of Mbits per second\n")
2265 refbw
= strtol (argv
[0], NULL
, 10);
2266 if (refbw
< 1 || refbw
> 4294967)
2268 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2272 /* If reference bandwidth is changed. */
2273 if ((refbw
* 1000) == ospf_top
->ref_bandwidth
)
2276 ospf_top
->ref_bandwidth
= refbw
* 1000;
2277 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2278 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2280 for (node
= listhead (ospf_top
->iflist
); node
; nextnode (node
))
2281 ospf_if_recalculate_output_cost (getdata (node
));
2286 DEFUN (no_auto_cost_reference_bandwidth
,
2287 no_auto_cost_reference_bandwidth_cmd
,
2288 "no auto-cost reference-bandwidth",
2290 "Calculate OSPF interface cost according to bandwidth\n"
2291 "Use reference bandwidth method to assign OSPF cost\n")
2295 if (ospf_top
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
2298 ospf_top
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
2299 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2300 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2303 for (node
= listhead (ospf_top
->iflist
); node
; nextnode (node
))
2304 ospf_if_recalculate_output_cost (getdata (node
));
2310 DEFUN (clear_ip_ospf_neighbor
,
2311 clear_ip_ospf_neighbor_cmd
,
2312 "clear ip ospf neighbor A.B.C.D",
2320 struct ospf_neighbor
*nbr
;
2321 struct in_addr router_id
;
2324 ret
= inet_aton (argv
[0], &router_id
);
2327 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
2331 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2333 struct ospf_interface
*oi
= getdata (node
);
2335 nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
);
2339 OSPF_NSM_EVENT_SCHEDULE (nbr
, NSM_SeqNumberMismatch
);
2340 vty_out (vty
, "clear neighbor %s%s", argv
[0], VTY_NEWLINE
);
2348 char *ospf_abr_type_descr_str
[] =
2351 "Standard (RFC2328)",
2353 "Alternative Cisco",
2354 "Alternative Shortcut"
2357 char *ospf_shortcut_mode_descr_str
[] =
2367 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
)
2370 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
2372 /* Show Area type/mode. */
2373 if (OSPF_IS_AREA_BACKBONE (area
))
2374 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
2377 if (area
->external_routing
== OSPF_AREA_STUB
)
2378 vty_out (vty
, " (Stub%s%s)",
2379 area
->no_summary
? ", no summary" : "",
2380 area
->shortcut_configured
? "; " : "");
2385 if (area
->external_routing
== OSPF_AREA_NSSA
)
2386 vty_out (vty
, " (NSSA%s%s)",
2387 area
->no_summary
? ", no summary" : "",
2388 area
->shortcut_configured
? "; " : "");
2389 #endif /* HAVE_NSSA */
2391 vty_out (vty
, "%s", VTY_NEWLINE
);
2392 vty_out (vty
, " Shortcutting mode: %s",
2393 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
2394 vty_out (vty
, ", S-bit consensus: %s%s",
2395 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
2398 /* Show number of interfaces. */
2399 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
2400 "Active: %d%s", listcount (area
->oiflist
),
2401 area
->act_ints
, VTY_NEWLINE
);
2404 if (area
->external_routing
== OSPF_AREA_NSSA
)
2406 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
2408 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
2412 if (area
->NSSATranslator
)
2413 vty_out (vty
, " We are an ABR and the NSSA Elected Translator. %s", VTY_NEWLINE
);
2415 vty_out (vty
, " We are an ABR, but not the NSSA Elected Translator. %s", VTY_NEWLINE
);
2418 #endif /* HAVE_NSSA */
2420 /* Show number of fully adjacent neighbors. */
2421 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
2422 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
2424 /* Show authentication type. */
2425 vty_out (vty
, " Area has ");
2426 if (area
->auth_type
== OSPF_AUTH_NULL
)
2427 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
2428 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
2429 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
2430 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
2431 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
2433 if (!OSPF_IS_AREA_BACKBONE (area
))
2434 vty_out (vty
, " Number of full virtual adjacencies going through"
2435 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
2437 /* Show SPF calculation times. */
2438 vty_out (vty
, " SPF algorithm executed %d times%s",
2439 area
->spf_calculation
, VTY_NEWLINE
);
2441 /* Show number of LSA. */
2442 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
2444 vty_out (vty
, "%s", VTY_NEWLINE
);
2447 DEFUN (show_ip_ospf
,
2452 "OSPF information\n")
2455 struct ospf_area
* area
;
2457 /* Check OSPF is enable. */
2458 if (ospf_top
== NULL
)
2460 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2464 /* Show Router ID. */
2465 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
2466 inet_ntoa (ospf_top
->router_id
),
2469 /* Show capability. */
2470 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
2471 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
2472 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
2473 CHECK_FLAG (ospf_top
->config
, OSPF_RFC1583_COMPATIBLE
) ?
2474 "enabled" : "disabled", VTY_NEWLINE
);
2475 #ifdef HAVE_OPAQUE_LSA
2476 vty_out (vty
, " OpaqueCapability flag is %s%s%s",
2477 CHECK_FLAG (ospf_top
->config
, OSPF_OPAQUE_CAPABLE
) ?
2478 "enabled" : "disabled",
2479 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf_top
->opaque
) ?
2480 " (origination blocked)" : "",
2482 #endif /* HAVE_OPAQUE_LSA */
2484 /* Show SPF timers. */
2485 vty_out (vty
, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s",
2486 ospf_top
->spf_delay
, ospf_top
->spf_holdtime
, VTY_NEWLINE
);
2488 /* Show refresh parameters. */
2489 vty_out (vty
, " Refresh timer %d secs%s",
2490 ospf_top
->lsa_refresh_interval
, VTY_NEWLINE
);
2492 /* Show ABR/ASBR flags. */
2493 if (CHECK_FLAG (ospf_top
->flags
, OSPF_FLAG_ABR
))
2494 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
2495 ospf_abr_type_descr_str
[ospf_top
->abr_type
], VTY_NEWLINE
);
2497 if (CHECK_FLAG (ospf_top
->flags
, OSPF_FLAG_ASBR
))
2498 vty_out (vty
, " This router is an ASBR "
2499 "(injecting external routing information)%s", VTY_NEWLINE
);
2501 /* Show Number of AS-external-LSAs. */
2502 vty_out (vty
, " Number of external LSA %ld%s",
2503 ospf_lsdb_count_all (ospf_top
->lsdb
), VTY_NEWLINE
);
2505 /* Show number of areas attached. */
2506 vty_out (vty
, " Number of areas attached to this router: %d%s%s",
2507 listcount (ospf_top
->areas
), VTY_NEWLINE
, VTY_NEWLINE
);
2509 /* Show each area status. */
2510 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
2511 if ((area
= getdata (node
)) != NULL
)
2512 show_ip_ospf_area (vty
, area
);
2519 show_ip_ospf_interface_sub (struct vty
*vty
, struct interface
*ifp
)
2521 struct ospf_neighbor
*nbr
;
2523 struct route_node
*rn
;
2526 oi_count
= ospf_oi_count (ifp
);
2528 /* Is interface up? */
2530 vty_out (vty
, "%s is up, line protocol is up%s", ifp
->name
, VTY_NEWLINE
);
2533 vty_out (vty
, "%s is down, line protocol is down%s", ifp
->name
,
2538 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2540 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
2545 /* Is interface OSPF enabled? */
2548 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2552 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
2554 struct ospf_interface
*oi
= rn
->info
;
2559 /* Show OSPF interface information. */
2560 vty_out (vty
, " Internet Address %s/%d,",
2561 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
2563 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
2566 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
2567 inet_ntoa (ospf_top
->router_id
), ospf_network_type_str
[oi
->type
],
2568 oi
->output_cost
, VTY_NEWLINE
);
2570 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
2571 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
2572 PRIORITY (oi
), VTY_NEWLINE
);
2574 /* Show DR information. */
2575 if (DR (oi
).s_addr
== 0)
2576 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2579 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &DR (oi
));
2581 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2584 vty_out (vty
, " Designated Router (ID) %s,",
2585 inet_ntoa (nbr
->router_id
));
2586 vty_out (vty
, " Interface Address %s%s",
2587 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2591 /* Show BDR information. */
2592 if (BDR (oi
).s_addr
== 0)
2593 vty_out (vty
, " No backup designated router on this network%s",
2597 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
2599 vty_out (vty
, " No backup designated router on this network%s",
2603 vty_out (vty
, " Backup Designated Router (ID) %s,",
2604 inet_ntoa (nbr
->router_id
));
2605 vty_out (vty
, " Interface Address %s%s",
2606 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2609 vty_out (vty
, " Timer intervals configured,");
2610 vty_out (vty
, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2611 OSPF_IF_PARAM (oi
, v_hello
), OSPF_IF_PARAM (oi
, v_wait
),
2612 OSPF_IF_PARAM (oi
, v_wait
),
2613 OSPF_IF_PARAM (oi
, retransmit_interval
),
2616 if (OSPF_IF_PARAM (oi
, passive_interface
) == OSPF_IF_ACTIVE
)
2617 vty_out (vty
, " Hello due in %s%s",
2618 ospf_timer_dump (oi
->t_hello
, buf
, 9), VTY_NEWLINE
);
2619 else /* OSPF_IF_PASSIVE is set */
2620 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
2622 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
2623 ospf_nbr_count (oi
->nbrs
, 0), ospf_nbr_count (oi
->nbrs
, NSM_Full
),
2628 DEFUN (show_ip_ospf_interface
,
2629 show_ip_ospf_interface_cmd
,
2630 "show ip ospf interface [INTERFACE]",
2633 "OSPF information\n"
2634 "Interface information\n"
2637 struct interface
*ifp
;
2640 /* Show All Interfaces. */
2642 for (node
= listhead (iflist
); node
; nextnode (node
))
2643 show_ip_ospf_interface_sub (vty
, node
->data
);
2644 /* Interface name is specified. */
2647 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
2648 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
2650 show_ip_ospf_interface_sub (vty
, ifp
);
2657 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
)
2659 struct route_node
*rn
;
2660 struct ospf_neighbor
*nbr
;
2664 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2665 if ((nbr
= rn
->info
))
2666 /* Do not show myself. */
2667 if (nbr
!= oi
->nbr_self
)
2668 /* Down state is not shown. */
2669 if (nbr
->state
!= NSM_Down
)
2671 ospf_nbr_state_message (nbr
, msgbuf
, 16);
2673 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2674 vty_out (vty
, "%-15s %3d %-15s %8s ",
2676 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2678 vty_out (vty
, "%-15s %3d %-15s %8s ",
2679 inet_ntoa (nbr
->router_id
), nbr
->priority
,
2680 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2681 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
2682 vty_out (vty
, "%-15s %5ld %5ld %5d%s",
2683 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
2684 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
2689 DEFUN (show_ip_ospf_neighbor
,
2690 show_ip_ospf_neighbor_cmd
,
2691 "show ip ospf neighbor",
2694 "OSPF information\n"
2701 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2705 /* Show All neighbors. */
2706 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2707 "Time Address Interface RXmtL "
2708 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2710 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2711 show_ip_ospf_neighbor_sub (vty
, getdata (node
));
2716 DEFUN (show_ip_ospf_neighbor_all
,
2717 show_ip_ospf_neighbor_all_cmd
,
2718 "show ip ospf neighbor all",
2721 "OSPF information\n"
2723 "include down status neighbor\n")
2729 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2733 /* Show All neighbors. */
2734 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2735 "Time Address Interface RXmtL "
2736 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2738 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2740 struct ospf_interface
*oi
= getdata (node
);
2743 show_ip_ospf_neighbor_sub (vty
, oi
);
2745 /* print Down neighbor status */
2746 for (nbr_node
= listhead (oi
->nbr_nbma
); nbr_node
; nextnode (nbr_node
))
2748 struct ospf_nbr_nbma
*nbr_nbma
;
2750 nbr_nbma
= getdata (nbr_node
);
2752 if (nbr_nbma
->nbr
== NULL
2753 || nbr_nbma
->nbr
->state
== NSM_Down
)
2755 vty_out (vty
, "%-15s %3d %-15s %8s ",
2756 "-", nbr_nbma
->priority
, "Down", "-");
2757 vty_out (vty
, "%-15s %-15s %5d %5d %5d%s",
2758 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
2759 0, 0, 0, VTY_NEWLINE
);
2767 DEFUN (show_ip_ospf_neighbor_int
,
2768 show_ip_ospf_neighbor_int_cmd
,
2769 "show ip ospf neighbor A.B.C.D",
2772 "OSPF information\n"
2776 struct ospf_interface
*oi
;
2777 struct in_addr addr
;
2782 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2786 ret
= inet_aton (argv
[0], &addr
);
2789 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
2794 if ((oi
= ospf_if_is_configured (&addr
)) == NULL
)
2795 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
2798 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2799 "Time Address Interface RXmtL "
2800 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2801 show_ip_ospf_neighbor_sub (vty
, oi
);
2808 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2809 struct ospf_nbr_nbma
*nbr_nbma
)
2813 /* Show neighbor ID. */
2814 vty_out (vty
, " Neighbor %s,", "-");
2816 /* Show interface address. */
2817 vty_out (vty
, " interface address %s%s",
2818 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
2820 vty_out (vty
, " In the area %s via interface %s%s",
2821 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
2822 /* Show neighbor priority and state. */
2823 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2824 nbr_nbma
->priority
, "Down");
2825 /* Show state changes. */
2826 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
2828 /* Show PollInterval */
2829 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
2831 /* Show poll-interval timer. */
2832 vty_out (vty
, " Poll timer due in %s%s",
2833 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, 9), VTY_NEWLINE
);
2835 /* Show poll-interval timer thread. */
2836 vty_out (vty
, " Thread Poll Timer %s%s",
2837 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
2841 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2842 struct ospf_neighbor
*nbr
)
2846 /* Show neighbor ID. */
2847 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2848 vty_out (vty
, " Neighbor %s,", "-");
2850 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
2852 /* Show interface address. */
2853 vty_out (vty
, " interface address %s%s",
2854 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2856 vty_out (vty
, " In the area %s via interface %s%s",
2857 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
2858 /* Show neighbor priority and state. */
2859 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2860 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
2861 /* Show state changes. */
2862 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
2864 /* Show Designated Rotuer ID. */
2865 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
2866 /* Show Backup Designated Rotuer ID. */
2867 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
2869 vty_out (vty
, " Options %d %s%s", nbr
->options
,
2870 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
2871 /* Show Router Dead interval timer. */
2872 vty_out (vty
, " Dead timer due in %s%s",
2873 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9), VTY_NEWLINE
);
2874 /* Show Database Summary list. */
2875 vty_out (vty
, " Database Summary List %d%s",
2876 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
2877 /* Show Link State Request list. */
2878 vty_out (vty
, " Link State Request List %ld%s",
2879 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
2880 /* Show Link State Retransmission list. */
2881 vty_out (vty
, " Link State Retransmission List %ld%s",
2882 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
2883 /* Show inactivity timer thread. */
2884 vty_out (vty
, " Thread Inactivity Timer %s%s",
2885 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
2886 /* Show Database Description retransmission thread. */
2887 vty_out (vty
, " Thread Database Description Retransmision %s%s",
2888 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
2889 /* Show Link State Request Retransmission thread. */
2890 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
2891 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
2892 /* Show Link State Update Retransmission thread. */
2893 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
2894 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
2897 DEFUN (show_ip_ospf_neighbor_id
,
2898 show_ip_ospf_neighbor_id_cmd
,
2899 "show ip ospf neighbor A.B.C.D",
2902 "OSPF information\n"
2907 struct ospf_neighbor
*nbr
;
2908 struct in_addr router_id
;
2911 ret
= inet_aton (argv
[0], &router_id
);
2914 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
2918 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2920 struct ospf_interface
*oi
= getdata (node
);
2922 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
2924 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2929 /* Nothing to show. */
2933 DEFUN (show_ip_ospf_neighbor_detail
,
2934 show_ip_ospf_neighbor_detail_cmd
,
2935 "show ip ospf neighbor detail",
2938 "OSPF information\n"
2940 "detail of all neighbors\n")
2947 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2949 struct ospf_interface
*oi
= getdata (node
);
2950 struct route_node
*rn
;
2951 struct ospf_neighbor
*nbr
;
2953 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2954 if ((nbr
= rn
->info
))
2955 if (nbr
!= oi
->nbr_self
)
2956 if (nbr
->state
!= NSM_Down
)
2957 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2963 DEFUN (show_ip_ospf_neighbor_detail_all
,
2964 show_ip_ospf_neighbor_detail_all_cmd
,
2965 "show ip ospf neighbor detail all",
2968 "OSPF information\n"
2970 "detail of all neighbors\n"
2971 "include down status neighbor\n")
2978 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2980 struct ospf_interface
*oi
= getdata (node
);
2981 struct route_node
*rn
;
2982 struct ospf_neighbor
*nbr
;
2984 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2985 if ((nbr
= rn
->info
))
2986 if (nbr
!= oi
->nbr_self
)
2987 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
2988 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
);
2990 if (oi
->type
== OSPF_IFTYPE_NBMA
)
2994 for (nd
= listhead (oi
->nbr_nbma
); nd
; nextnode (nd
))
2996 struct ospf_nbr_nbma
*nbr_nbma
= getdata (nd
);
2997 if (nbr_nbma
->nbr
== NULL
2998 || nbr_nbma
->nbr
->state
== NSM_Down
)
2999 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
);
3007 DEFUN (show_ip_ospf_neighbor_int_detail
,
3008 show_ip_ospf_neighbor_int_detail_cmd
,
3009 "show ip ospf neighbor A.B.C.D detail",
3012 "OSPF information\n"
3014 "Interface address\n"
3015 "detail of all neighbors")
3017 struct ospf_interface
*oi
;
3018 struct in_addr addr
;
3021 ret
= inet_aton (argv
[0], &addr
);
3024 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3029 if ((oi
= ospf_if_is_configured (&addr
)) == NULL
)
3030 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
3033 struct route_node
*rn
;
3034 struct ospf_neighbor
*nbr
;
3036 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3037 if ((nbr
= rn
->info
))
3038 if (nbr
!= oi
->nbr_self
)
3039 if (nbr
->state
!= NSM_Down
)
3040 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3047 /* Show functions */
3049 show_lsa_summary (struct ospf_lsa
*lsa
, void *v
, int self
)
3051 struct vty
*vty
= (struct vty
*) v
;
3052 struct router_lsa
*rl
;
3053 struct summary_lsa
*sl
;
3054 struct as_external_lsa
*asel
;
3055 struct prefix_ipv4 p
;
3058 /* If self option is set, check LSA self flag. */
3059 if (self
== 0 || IS_LSA_SELF (lsa
))
3061 /* LSA common part show. */
3062 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
3063 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
3064 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
3065 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
3066 /* LSA specific part show. */
3067 switch (lsa
->data
->type
)
3069 case OSPF_ROUTER_LSA
:
3070 rl
= (struct router_lsa
*) lsa
->data
;
3071 vty_out (vty
, " %-d", ntohs (rl
->links
));
3073 case OSPF_SUMMARY_LSA
:
3074 sl
= (struct summary_lsa
*) lsa
->data
;
3077 p
.prefix
= sl
->header
.id
;
3078 p
.prefixlen
= ip_masklen (sl
->mask
);
3079 apply_mask_ipv4 (&p
);
3081 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
3083 case OSPF_AS_EXTERNAL_LSA
:
3084 asel
= (struct as_external_lsa
*) lsa
->data
;
3087 p
.prefix
= asel
->header
.id
;
3088 p
.prefixlen
= ip_masklen (asel
->mask
);
3089 apply_mask_ipv4 (&p
);
3091 vty_out (vty
, " %s %s/%d [0x%lx]",
3092 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
3093 inet_ntoa (p
.prefix
), p
.prefixlen
,
3094 (u_long
)ntohl (asel
->e
[0].route_tag
));
3096 case OSPF_NETWORK_LSA
:
3097 case OSPF_ASBR_SUMMARY_LSA
:
3098 #ifdef HAVE_OPAQUE_LSA
3099 case OSPF_OPAQUE_LINK_LSA
:
3100 case OSPF_OPAQUE_AREA_LSA
:
3101 case OSPF_OPAQUE_AS_LSA
:
3102 #endif /* HAVE_OPAQUE_LSA */
3106 vty_out (vty
, VTY_NEWLINE
);
3112 char *show_database_desc
[] =
3115 "Router Link States",
3117 "Summary Link States",
3118 "ASBR-Summary Link States",
3119 "AS External Link States",
3120 #if defined (HAVE_NSSA) || defined (HAVE_OPAQUE_LSA)
3121 "Group Membership LSA",
3122 "NSSA-external Link States",
3123 #endif /* HAVE_NSSA */
3124 #ifdef HAVE_OPAQUE_LSA
3126 "Link-Local Opaque-LSA",
3127 "Area-Local Opaque-LSA",
3128 "AS-external Opaque-LSA",
3129 #endif /* HAVE_OPAQUE_LSA */
3132 #define SHOW_OSPF_COMMON_HEADER \
3133 "Link ID ADV Router Age Seq# CkSum"
3135 char *show_database_header
[] =
3138 "Link ID ADV Router Age Seq# CkSum Link count",
3139 "Link ID ADV Router Age Seq# CkSum",
3140 "Link ID ADV Router Age Seq# CkSum Route",
3141 "Link ID ADV Router Age Seq# CkSum",
3142 "Link ID ADV Router Age Seq# CkSum Route",
3144 " --- header for Group Member ----",
3145 "Link ID ADV Router Age Seq# CkSum Route",
3146 #endif /* HAVE_NSSA */
3147 #ifdef HAVE_OPAQUE_LSA
3151 #endif /* HAVE_NSSA */
3153 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3154 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3155 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3156 #endif /* HAVE_OPAQUE_LSA */
3160 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
3162 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
3164 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
3165 vty_out (vty
, " Options: %d%s", lsa
->data
->options
, VTY_NEWLINE
);
3167 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
3169 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
3172 vty_out (vty
, " :%s%s%s%s",
3173 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
3174 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
3175 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
3176 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
3178 vty_out (vty
, "%s", VTY_NEWLINE
);
3180 vty_out (vty
, " LS Type: %s%s",
3181 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3182 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
3183 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3184 vty_out (vty
, " Advertising Router: %s%s",
3185 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3186 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
3188 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
3190 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
3193 char *link_type_desc
[] =
3196 "another Router (point-to-point)",
3197 "a Transit Network",
3202 char *link_id_desc
[] =
3205 "Neighboring Router ID",
3206 "Designated Router address",
3207 "Network/subnet number",
3208 "Neighboring Router ID",
3211 char *link_data_desc
[] =
3214 "Router Interface address",
3215 "Router Interface address",
3217 "Router Interface address",
3220 /* Show router-LSA each Link information. */
3222 show_ip_ospf_database_router_links (struct vty
*vty
,
3223 struct router_lsa
*rl
)
3227 len
= ntohs (rl
->header
.length
) - 4;
3228 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
3230 type
= rl
->link
[i
].type
;
3232 vty_out (vty
, " Link connected to: %s%s",
3233 link_type_desc
[type
], VTY_NEWLINE
);
3234 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
3235 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
3236 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
3237 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
3238 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
3239 vty_out (vty
, " TOS 0 Metric: %d%s",
3240 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
3241 vty_out (vty
, "%s", VTY_NEWLINE
);
3245 /* Show router-LSA detail information. */
3247 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3251 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
3253 show_ip_ospf_database_header (vty
, lsa
);
3255 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
3256 VTY_NEWLINE
, VTY_NEWLINE
);
3258 show_ip_ospf_database_router_links (vty
, rl
);
3264 /* Show network-LSA detail information. */
3266 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3272 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
3274 show_ip_ospf_database_header (vty
, lsa
);
3276 vty_out (vty
, " Network Mask: /%d%s",
3277 ip_masklen (nl
->mask
), VTY_NEWLINE
);
3279 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
3281 for (i
= 0; length
> 0; i
++, length
-= 4)
3282 vty_out (vty
, " Attached Router: %s%s",
3283 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
3285 vty_out (vty
, "%s", VTY_NEWLINE
);
3291 /* Show summary-LSA detail information. */
3293 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3297 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3299 show_ip_ospf_database_header (vty
, lsa
);
3301 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
3303 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3310 /* Show summary-ASBR-LSA detail information. */
3312 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3316 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3318 show_ip_ospf_database_header (vty
, lsa
);
3320 vty_out (vty
, " Network Mask: /%d%s",
3321 ip_masklen (sl
->mask
), VTY_NEWLINE
);
3322 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3329 /* Show AS-external-LSA detail information. */
3331 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3335 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3337 show_ip_ospf_database_header (vty
, lsa
);
3339 vty_out (vty
, " Network Mask: /%d%s",
3340 ip_masklen (al
->mask
), VTY_NEWLINE
);
3341 vty_out (vty
, " Metric Type: %s%s",
3342 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3343 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3344 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3345 vty_out (vty
, " Metric: %d%s",
3346 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3347 vty_out (vty
, " Forward Address: %s%s",
3348 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3350 vty_out (vty
, " External Route Tag: %lu%s%s",
3351 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3359 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
3361 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3363 /* show_ip_ospf_database_header (vty, lsa); */
3365 zlog_info( " Network Mask: /%d%s",
3366 ip_masklen (al
->mask
), "\n");
3367 zlog_info( " Metric Type: %s%s",
3368 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3369 "2 (Larger than any link state path)" : "1", "\n");
3370 zlog_info( " TOS: 0%s", "\n");
3371 zlog_info( " Metric: %d%s",
3372 GET_METRIC (al
->e
[0].metric
), "\n");
3373 zlog_info( " Forward Address: %s%s",
3374 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
3376 zlog_info( " External Route Tag: %u%s%s",
3377 ntohl (al
->e
[0].route_tag
), "\n", "\n");
3382 /* Show AS-NSSA-LSA detail information. */
3384 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3388 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3390 show_ip_ospf_database_header (vty
, lsa
);
3392 vty_out (vty
, " Network Mask: /%d%s",
3393 ip_masklen (al
->mask
), VTY_NEWLINE
);
3394 vty_out (vty
, " Metric Type: %s%s",
3395 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3396 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3397 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3398 vty_out (vty
, " Metric: %d%s",
3399 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3400 vty_out (vty
, " NSSA: Forward Address: %s%s",
3401 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3403 vty_out (vty
, " External Route Tag: %u%s%s",
3404 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3410 #endif /* HAVE_NSSA */
3413 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
3418 #ifdef HAVE_OPAQUE_LSA
3420 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3424 show_ip_ospf_database_header (vty
, lsa
);
3425 show_opaque_info_detail (vty
, lsa
);
3427 vty_out (vty
, "%s", VTY_NEWLINE
);
3431 #endif /* HAVE_OPAQUE_LSA */
3433 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
3436 show_router_lsa_detail
,
3437 show_network_lsa_detail
,
3438 show_summary_lsa_detail
,
3439 show_summary_asbr_lsa_detail
,
3440 show_as_external_lsa_detail
,
3443 show_as_nssa_lsa_detail
, /* almost same as external */
3444 #endif /* HAVE_NSSA */
3445 #ifdef HAVE_OPAQUE_LSA
3449 #endif /* HAVE_NSSA */
3451 show_opaque_lsa_detail
,
3452 show_opaque_lsa_detail
,
3453 show_opaque_lsa_detail
,
3454 #endif /* HAVE_OPAQUE_LSA */
3458 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
3459 struct in_addr
*adv_router
)
3461 memset (lp
, 0, sizeof (struct prefix_ls
));
3465 else if (adv_router
== NULL
)
3474 lp
->adv_router
= *adv_router
;
3479 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
3480 struct in_addr
*id
, struct in_addr
*adv_router
)
3482 struct prefix_ls lp
;
3483 struct route_node
*rn
, *start
;
3484 struct ospf_lsa
*lsa
;
3486 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
3487 start
= route_node_get (rt
, (struct prefix
*) &lp
);
3490 route_lock_node (start
);
3491 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
3492 if ((lsa
= rn
->info
))
3495 /* Stay away from any Local Translated Type-7 LSAs */
3496 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3498 #endif /* HAVE_NSSA */
3500 if (show_function
[lsa
->data
->type
] != NULL
)
3501 show_function
[lsa
->data
->type
] (vty
, lsa
);
3503 route_unlock_node (start
);
3507 /* Show detail LSA information
3508 -- if id is NULL then show all LSAs. */
3510 show_lsa_detail (struct vty
*vty
, int type
,
3511 struct in_addr
*id
, struct in_addr
*adv_router
)
3517 case OSPF_AS_EXTERNAL_LSA
:
3518 #ifdef HAVE_OPAQUE_LSA
3519 case OSPF_OPAQUE_AS_LSA
:
3520 #endif /* HAVE_OPAQUE_LSA */
3521 vty_out (vty
, " %s %s%s",
3522 show_database_desc
[type
],
3523 VTY_NEWLINE
, VTY_NEWLINE
);
3524 show_lsa_detail_proc (vty
, AS_LSDB (ospf_top
, type
), id
, adv_router
);
3527 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
3529 struct ospf_area
*area
= node
->data
;
3530 vty_out (vty
, "%s %s (Area %s)%s%s",
3531 VTY_NEWLINE
, show_database_desc
[type
],
3532 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3533 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
3540 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
3541 struct in_addr
*adv_router
)
3543 struct route_node
*rn
;
3544 struct ospf_lsa
*lsa
;
3546 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
3547 if ((lsa
= rn
->info
))
3548 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
3551 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3553 #endif /* HAVE_NSSA */
3554 if (show_function
[lsa
->data
->type
] != NULL
)
3555 show_function
[lsa
->data
->type
] (vty
, lsa
);
3559 /* Show detail LSA information. */
3561 show_lsa_detail_adv_router (struct vty
*vty
, int type
,
3562 struct in_addr
*adv_router
)
3568 case OSPF_AS_EXTERNAL_LSA
:
3569 #ifdef HAVE_OPAQUE_LSA
3570 case OSPF_OPAQUE_AS_LSA
:
3571 #endif /* HAVE_OPAQUE_LSA */
3572 vty_out (vty
, " %s %s%s",
3573 show_database_desc
[type
],
3574 VTY_NEWLINE
, VTY_NEWLINE
);
3575 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf_top
, type
),
3579 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
3581 struct ospf_area
*area
= node
->data
;
3582 vty_out (vty
, "%s %s (Area %s)%s%s",
3583 VTY_NEWLINE
, show_database_desc
[type
],
3584 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3585 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
3593 show_ip_ospf_database_summary (struct vty
*vty
, int self
)
3598 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
3600 struct ospf_area
*area
= node
->data
;
3601 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3605 case OSPF_AS_EXTERNAL_LSA
:
3606 #ifdef HAVE_OPAQUE_LSA
3607 case OSPF_OPAQUE_AS_LSA
:
3608 #endif /* HAVE_OPAQUE_LSA */
3613 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
3614 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
3616 vty_out (vty
, " %s (Area %s)%s%s",
3617 show_database_desc
[type
],
3618 ospf_area_desc_string (area
),
3619 VTY_NEWLINE
, VTY_NEWLINE
);
3620 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
3622 foreach_lsa (AREA_LSDB (area
, type
), vty
, self
, show_lsa_summary
);
3624 vty_out (vty
, "%s", VTY_NEWLINE
);
3629 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3633 case OSPF_AS_EXTERNAL_LSA
:
3634 #ifdef HAVE_OPAQUE_LSA
3635 case OSPF_OPAQUE_AS_LSA
:
3636 #endif /* HAVE_OPAQUE_LSA */
3641 if (ospf_lsdb_count_self (ospf_top
->lsdb
, type
) ||
3642 (!self
&& ospf_lsdb_count (ospf_top
->lsdb
, type
)))
3644 vty_out (vty
, " %s%s%s",
3645 show_database_desc
[type
],
3646 VTY_NEWLINE
, VTY_NEWLINE
);
3647 vty_out (vty
, "%s%s", show_database_header
[type
],
3649 foreach_lsa (AS_LSDB (ospf_top
, type
), vty
, self
, show_lsa_summary
);
3650 vty_out (vty
, "%s", VTY_NEWLINE
);
3654 vty_out (vty
, "%s", VTY_NEWLINE
);
3658 show_ip_ospf_database_maxage (struct vty
*vty
)
3661 struct ospf_lsa
*lsa
;
3663 vty_out (vty
, "%s MaxAge Link States:%s%s",
3664 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
3666 for (node
= listhead (ospf_top
->maxage_lsa
); node
; nextnode (node
))
3667 if ((lsa
= node
->data
) != NULL
)
3669 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
3670 vty_out (vty
, "Link State ID: %s%s",
3671 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
3672 vty_out (vty
, "Advertising Router: %s%s",
3673 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3674 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
3675 vty_out (vty
, "%s", VTY_NEWLINE
);
3680 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3681 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3682 #else /* HAVE_NSSA */
3683 #define OSPF_LSA_TYPE_NSSA_DESC ""
3684 #define OSPF_LSA_TYPE_NSSA_CMD_STR ""
3685 #endif /* HAVE_NSSA */
3687 #ifdef HAVE_OPAQUE_LSA
3688 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3689 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3690 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3691 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3692 #else /* HAVE_OPAQUE_LSA */
3693 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3694 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3695 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3696 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3697 #endif /* HAVE_OPAQUE_LSA */
3699 #define OSPF_LSA_TYPES_CMD_STR \
3700 "asbr-summary|external|network|router|summary" \
3701 OSPF_LSA_TYPE_NSSA_CMD_STR \
3702 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3704 #define OSPF_LSA_TYPES_DESC \
3705 "ASBR summary link states\n" \
3706 "External link states\n" \
3707 "Network link states\n" \
3708 "Router link states\n" \
3709 "Network summary link states\n" \
3710 OSPF_LSA_TYPE_NSSA_DESC \
3711 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3712 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3713 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3715 DEFUN (show_ip_ospf_database
,
3716 show_ip_ospf_database_cmd
,
3717 "show ip ospf database",
3720 "OSPF information\n"
3721 "Database summary\n")
3724 struct in_addr id
, adv_router
;
3726 if (ospf_top
== NULL
)
3729 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3730 inet_ntoa (ospf_top
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3735 show_ip_ospf_database_summary (vty
, 0);
3739 /* Set database type to show. */
3740 if (strncmp (argv
[0], "r", 1) == 0)
3741 type
= OSPF_ROUTER_LSA
;
3742 else if (strncmp (argv
[0], "ne", 2) == 0)
3743 type
= OSPF_NETWORK_LSA
;
3745 else if (strncmp (argv
[0], "ns", 2) == 0)
3746 type
= OSPF_AS_NSSA_LSA
;
3747 #endif /* HAVE_NSSA */
3748 else if (strncmp (argv
[0], "su", 2) == 0)
3749 type
= OSPF_SUMMARY_LSA
;
3750 else if (strncmp (argv
[0], "a", 1) == 0)
3751 type
= OSPF_ASBR_SUMMARY_LSA
;
3752 else if (strncmp (argv
[0], "e", 1) == 0)
3753 type
= OSPF_AS_EXTERNAL_LSA
;
3754 else if (strncmp (argv
[0], "se", 2) == 0)
3756 show_ip_ospf_database_summary (vty
, 1);
3759 else if (strncmp (argv
[0], "m", 1) == 0)
3761 show_ip_ospf_database_maxage (vty
);
3764 #ifdef HAVE_OPAQUE_LSA
3765 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3766 type
= OSPF_OPAQUE_LINK_LSA
;
3767 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3768 type
= OSPF_OPAQUE_AREA_LSA
;
3769 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3770 type
= OSPF_OPAQUE_AS_LSA
;
3771 #endif /* HAVE_OPAQUE_LSA */
3775 /* `show ip ospf database LSA'. */
3777 show_lsa_detail (vty
, type
, NULL
, NULL
);
3780 ret
= inet_aton (argv
[1], &id
);
3784 /* `show ip ospf database LSA ID'. */
3786 show_lsa_detail (vty
, type
, &id
, NULL
);
3787 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3790 if (strncmp (argv
[2], "s", 1) == 0)
3791 adv_router
= ospf_top
->router_id
;
3794 ret
= inet_aton (argv
[2], &adv_router
);
3798 show_lsa_detail (vty
, type
, &id
, &adv_router
);
3805 ALIAS (show_ip_ospf_database
,
3806 show_ip_ospf_database_type_cmd
,
3807 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
3810 "OSPF information\n"
3811 "Database summary\n"
3813 "LSAs in MaxAge list\n"
3814 "Self-originated link states\n")
3816 ALIAS (show_ip_ospf_database
,
3817 show_ip_ospf_database_type_id_cmd
,
3818 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
3821 "OSPF information\n"
3822 "Database summary\n"
3824 "Link State ID (as an IP address)\n")
3826 ALIAS (show_ip_ospf_database
,
3827 show_ip_ospf_database_type_id_adv_router_cmd
,
3828 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
3831 "OSPF information\n"
3832 "Database summary\n"
3834 "Link State ID (as an IP address)\n"
3835 "Advertising Router link states\n"
3836 "Advertising Router (as an IP address)\n")
3838 ALIAS (show_ip_ospf_database
,
3839 show_ip_ospf_database_type_id_self_cmd
,
3840 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
3843 "OSPF information\n"
3844 "Database summary\n"
3846 "Link State ID (as an IP address)\n"
3847 "Self-originated link states\n"
3850 DEFUN (show_ip_ospf_database_type_adv_router
,
3851 show_ip_ospf_database_type_adv_router_cmd
,
3852 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
3855 "OSPF information\n"
3856 "Database summary\n"
3858 "Advertising Router link states\n"
3859 "Advertising Router (as an IP address)\n")
3862 struct in_addr adv_router
;
3864 if (ospf_top
== NULL
)
3867 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3868 inet_ntoa (ospf_top
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3873 /* Set database type to show. */
3874 if (strncmp (argv
[0], "r", 1) == 0)
3875 type
= OSPF_ROUTER_LSA
;
3876 else if (strncmp (argv
[0], "ne", 2) == 0)
3877 type
= OSPF_NETWORK_LSA
;
3879 else if (strncmp (argv
[0], "ns", 2) == 0)
3880 type
= OSPF_AS_NSSA_LSA
;
3881 #endif /* HAVE_NSSA */
3882 else if (strncmp (argv
[0], "s", 1) == 0)
3883 type
= OSPF_SUMMARY_LSA
;
3884 else if (strncmp (argv
[0], "a", 1) == 0)
3885 type
= OSPF_ASBR_SUMMARY_LSA
;
3886 else if (strncmp (argv
[0], "e", 1) == 0)
3887 type
= OSPF_AS_EXTERNAL_LSA
;
3888 #ifdef HAVE_OPAQUE_LSA
3889 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3890 type
= OSPF_OPAQUE_LINK_LSA
;
3891 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3892 type
= OSPF_OPAQUE_AREA_LSA
;
3893 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3894 type
= OSPF_OPAQUE_AS_LSA
;
3895 #endif /* HAVE_OPAQUE_LSA */
3899 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3900 if (strncmp (argv
[1], "s", 1) == 0)
3901 adv_router
= ospf_top
->router_id
;
3904 ret
= inet_aton (argv
[1], &adv_router
);
3909 show_lsa_detail_adv_router (vty
, type
, &adv_router
);
3914 ALIAS (show_ip_ospf_database_type_adv_router
,
3915 show_ip_ospf_database_type_self_cmd
,
3916 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
3919 "OSPF information\n"
3920 "Database summary\n"
3922 "Self-originated link states\n")
3925 DEFUN (ip_ospf_authentication_args
,
3926 ip_ospf_authentication_args_addr_cmd
,
3927 "ip ospf authentication (null|message-digest) A.B.C.D",
3929 "OSPF interface commands\n"
3930 "Enable authentication on this interface\n"
3931 "Use null authentication\n"
3932 "Use message-digest authentication\n"
3933 "Address of interface")
3935 struct interface
*ifp
;
3936 struct in_addr addr
;
3938 struct ospf_if_params
*params
;
3941 params
= IF_DEF_PARAMS (ifp
);
3945 ret
= inet_aton(argv
[1], &addr
);
3948 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3953 params
= ospf_get_if_params (ifp
, addr
);
3954 ospf_if_update_params (ifp
, addr
);
3957 /* Handle null authentication */
3958 if ( argv
[0][0] == 'n' )
3960 SET_IF_PARAM (params
, auth_type
);
3961 params
->auth_type
= OSPF_AUTH_NULL
;
3965 /* Handle message-digest authentication */
3966 if ( argv
[0][0] == 'm' )
3968 SET_IF_PARAM (params
, auth_type
);
3969 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
3973 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
3977 ALIAS (ip_ospf_authentication_args
,
3978 ip_ospf_authentication_args_cmd
,
3979 "ip ospf authentication (null|message-digest)",
3981 "OSPF interface commands\n"
3982 "Enable authentication on this interface\n"
3983 "Use null authentication\n"
3984 "Use message-digest authentication\n")
3986 DEFUN (ip_ospf_authentication
,
3987 ip_ospf_authentication_addr_cmd
,
3988 "ip ospf authentication A.B.C.D",
3990 "OSPF interface commands\n"
3991 "Enable authentication on this interface\n"
3992 "Address of interface")
3994 struct interface
*ifp
;
3995 struct in_addr addr
;
3997 struct ospf_if_params
*params
;
4000 params
= IF_DEF_PARAMS (ifp
);
4004 ret
= inet_aton(argv
[1], &addr
);
4007 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4012 params
= ospf_get_if_params (ifp
, addr
);
4013 ospf_if_update_params (ifp
, addr
);
4016 SET_IF_PARAM (params
, auth_type
);
4017 params
->auth_type
= OSPF_AUTH_SIMPLE
;
4022 ALIAS (ip_ospf_authentication
,
4023 ip_ospf_authentication_cmd
,
4024 "ip ospf authentication",
4026 "OSPF interface commands\n"
4027 "Enable authentication on this interface\n")
4029 DEFUN (no_ip_ospf_authentication
,
4030 no_ip_ospf_authentication_addr_cmd
,
4031 "no ip ospf authentication A.B.C.D",
4034 "OSPF interface commands\n"
4035 "Enable authentication on this interface\n"
4036 "Address of interface")
4038 struct interface
*ifp
;
4039 struct in_addr addr
;
4041 struct ospf_if_params
*params
;
4044 params
= IF_DEF_PARAMS (ifp
);
4048 ret
= inet_aton(argv
[1], &addr
);
4051 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4056 params
= ospf_lookup_if_params (ifp
, addr
);
4061 params
->auth_type
= OSPF_AUTH_NOTSET
;
4062 UNSET_IF_PARAM (params
, auth_type
);
4064 if (params
!= IF_DEF_PARAMS (ifp
))
4066 ospf_free_if_params (ifp
, addr
);
4067 ospf_if_update_params (ifp
, addr
);
4073 ALIAS (no_ip_ospf_authentication
,
4074 no_ip_ospf_authentication_cmd
,
4075 "no ip ospf authentication",
4078 "OSPF interface commands\n"
4079 "Enable authentication on this interface\n")
4081 DEFUN (ip_ospf_authentication_key
,
4082 ip_ospf_authentication_key_addr_cmd
,
4083 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4085 "OSPF interface commands\n"
4086 "Authentication password (key)\n"
4087 "The OSPF password (key)\n"
4088 "Address of interface")
4090 struct interface
*ifp
;
4091 struct in_addr addr
;
4093 struct ospf_if_params
*params
;
4096 params
= IF_DEF_PARAMS (ifp
);
4100 ret
= inet_aton(argv
[1], &addr
);
4103 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4108 params
= ospf_get_if_params (ifp
, addr
);
4109 ospf_if_update_params (ifp
, addr
);
4113 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
4114 strncpy (params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
4115 SET_IF_PARAM (params
, auth_simple
);
4120 ALIAS (ip_ospf_authentication_key
,
4121 ip_ospf_authentication_key_cmd
,
4122 "ip ospf authentication-key AUTH_KEY",
4124 "OSPF interface commands\n"
4125 "Authentication password (key)\n"
4126 "The OSPF password (key)")
4128 ALIAS (ip_ospf_authentication_key
,
4129 ospf_authentication_key_cmd
,
4130 "ospf authentication-key AUTH_KEY",
4131 "OSPF interface commands\n"
4132 "Authentication password (key)\n"
4133 "The OSPF password (key)")
4135 DEFUN (no_ip_ospf_authentication_key
,
4136 no_ip_ospf_authentication_key_addr_cmd
,
4137 "no ip ospf authentication-key A.B.C.D",
4140 "OSPF interface commands\n"
4141 "Authentication password (key)\n"
4142 "Address of interface")
4144 struct interface
*ifp
;
4145 struct in_addr addr
;
4147 struct ospf_if_params
*params
;
4150 params
= IF_DEF_PARAMS (ifp
);
4154 ret
= inet_aton(argv
[1], &addr
);
4157 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4162 params
= ospf_lookup_if_params (ifp
, addr
);
4167 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
4168 UNSET_IF_PARAM (params
, auth_simple
);
4170 if (params
!= IF_DEF_PARAMS (ifp
))
4172 ospf_free_if_params (ifp
, addr
);
4173 ospf_if_update_params (ifp
, addr
);
4179 ALIAS (no_ip_ospf_authentication_key
,
4180 no_ip_ospf_authentication_key_cmd
,
4181 "no ip ospf authentication-key",
4184 "OSPF interface commands\n"
4185 "Authentication password (key)\n")
4187 ALIAS (no_ip_ospf_authentication_key
,
4188 no_ospf_authentication_key_cmd
,
4189 "no ospf authentication-key",
4191 "OSPF interface commands\n"
4192 "Authentication password (key)\n")
4194 DEFUN (ip_ospf_message_digest_key
,
4195 ip_ospf_message_digest_key_addr_cmd
,
4196 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4198 "OSPF interface commands\n"
4199 "Message digest authentication password (key)\n"
4201 "Use MD5 algorithm\n"
4202 "The OSPF password (key)"
4203 "Address of interface")
4205 struct interface
*ifp
;
4206 struct crypt_key
*ck
;
4208 struct in_addr addr
;
4210 struct ospf_if_params
*params
;
4213 params
= IF_DEF_PARAMS (ifp
);
4217 ret
= inet_aton(argv
[2], &addr
);
4220 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4225 params
= ospf_get_if_params (ifp
, addr
);
4226 ospf_if_update_params (ifp
, addr
);
4229 key_id
= strtol (argv
[0], NULL
, 10);
4230 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
4232 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
4236 ck
= ospf_crypt_key_new ();
4237 ck
->key_id
= (u_char
) key_id
;
4238 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
4239 strncpy (ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
4241 ospf_crypt_key_add (params
->auth_crypt
, ck
);
4242 SET_IF_PARAM (params
, auth_crypt
);
4247 ALIAS (ip_ospf_message_digest_key
,
4248 ip_ospf_message_digest_key_cmd
,
4249 "ip ospf message-digest-key <1-255> md5 KEY",
4251 "OSPF interface commands\n"
4252 "Message digest authentication password (key)\n"
4254 "Use MD5 algorithm\n"
4255 "The OSPF password (key)")
4257 ALIAS (ip_ospf_message_digest_key
,
4258 ospf_message_digest_key_cmd
,
4259 "ospf message-digest-key <1-255> md5 KEY",
4260 "OSPF interface commands\n"
4261 "Message digest authentication password (key)\n"
4263 "Use MD5 algorithm\n"
4264 "The OSPF password (key)")
4266 DEFUN (no_ip_ospf_message_digest_key
,
4267 no_ip_ospf_message_digest_key_addr_cmd
,
4268 "no ip ospf message-digest-key <1-255> A.B.C.D",
4271 "OSPF interface commands\n"
4272 "Message digest authentication password (key)\n"
4274 "Address of interface")
4276 struct interface
*ifp
;
4277 struct crypt_key
*ck
;
4279 struct in_addr addr
;
4281 struct ospf_if_params
*params
;
4284 params
= IF_DEF_PARAMS (ifp
);
4288 ret
= inet_aton(argv
[1], &addr
);
4291 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4296 params
= ospf_lookup_if_params (ifp
, addr
);
4301 key_id
= strtol (argv
[0], NULL
, 10);
4302 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
4305 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
4309 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
4311 if (params
!= IF_DEF_PARAMS (ifp
))
4313 ospf_free_if_params (ifp
, addr
);
4314 ospf_if_update_params (ifp
, addr
);
4320 ALIAS (no_ip_ospf_message_digest_key
,
4321 no_ip_ospf_message_digest_key_cmd
,
4322 "no ip ospf message-digest-key <1-255>",
4325 "OSPF interface commands\n"
4326 "Message digest authentication password (key)\n"
4329 ALIAS (no_ip_ospf_message_digest_key
,
4330 no_ospf_message_digest_key_cmd
,
4331 "no ospf message-digest-key <1-255>",
4333 "OSPF interface commands\n"
4334 "Message digest authentication password (key)\n"
4337 DEFUN (ip_ospf_cost
,
4338 ip_ospf_cost_addr_cmd
,
4339 "ip ospf cost <1-65535> A.B.C.D",
4341 "OSPF interface commands\n"
4344 "Address of interface")
4346 struct interface
*ifp
= vty
->index
;
4348 struct in_addr addr
;
4350 struct ospf_if_params
*params
;
4352 params
= IF_DEF_PARAMS (ifp
);
4354 cost
= strtol (argv
[0], NULL
, 10);
4356 /* cost range is <1-65535>. */
4357 if (cost
< 1 || cost
> 65535)
4359 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4365 ret
= inet_aton(argv
[1], &addr
);
4368 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4373 params
= ospf_get_if_params (ifp
, addr
);
4374 ospf_if_update_params (ifp
, addr
);
4377 SET_IF_PARAM (params
, output_cost_cmd
);
4378 params
->output_cost_cmd
= cost
;
4380 ospf_if_recalculate_output_cost (ifp
);
4385 ALIAS (ip_ospf_cost
,
4387 "ip ospf cost <1-65535>",
4389 "OSPF interface commands\n"
4393 ALIAS (ip_ospf_cost
,
4395 "ospf cost <1-65535>",
4396 "OSPF interface commands\n"
4400 DEFUN (no_ip_ospf_cost
,
4401 no_ip_ospf_cost_addr_cmd
,
4402 "no ip ospf cost A.B.C.D",
4405 "OSPF interface commands\n"
4407 "Address of interface")
4409 struct interface
*ifp
= vty
->index
;
4410 struct in_addr addr
;
4412 struct ospf_if_params
*params
;
4415 params
= IF_DEF_PARAMS (ifp
);
4419 ret
= inet_aton(argv
[0], &addr
);
4422 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4427 params
= ospf_lookup_if_params (ifp
, addr
);
4432 UNSET_IF_PARAM (params
, output_cost_cmd
);
4434 if (params
!= IF_DEF_PARAMS (ifp
))
4436 ospf_free_if_params (ifp
, addr
);
4437 ospf_if_update_params (ifp
, addr
);
4440 ospf_if_recalculate_output_cost (ifp
);
4445 ALIAS (no_ip_ospf_cost
,
4446 no_ip_ospf_cost_cmd
,
4450 "OSPF interface commands\n"
4453 ALIAS (no_ip_ospf_cost
,
4457 "OSPF interface commands\n"
4461 ospf_nbr_timer_update (struct ospf_interface
*oi
)
4463 struct route_node
*rn
;
4464 struct ospf_neighbor
*nbr
;
4466 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4467 if ((nbr
= rn
->info
))
4469 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
4470 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4471 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4472 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4476 DEFUN (ip_ospf_dead_interval
,
4477 ip_ospf_dead_interval_addr_cmd
,
4478 "ip ospf dead-interval <1-65535> A.B.C.D",
4480 "OSPF interface commands\n"
4481 "Interval after which a neighbor is declared dead\n"
4483 "Address of interface")
4485 struct interface
*ifp
= vty
->index
;
4487 struct in_addr addr
;
4489 struct ospf_if_params
*params
;
4490 struct ospf_interface
*oi
;
4491 struct route_node
*rn
;
4493 params
= IF_DEF_PARAMS (ifp
);
4495 seconds
= strtol (argv
[0], NULL
, 10);
4497 /* dead_interval range is <1-65535>. */
4498 if (seconds
< 1 || seconds
> 65535)
4500 vty_out (vty
, "Router Dead Interval is invalid%s", VTY_NEWLINE
);
4506 ret
= inet_aton(argv
[1], &addr
);
4509 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4514 params
= ospf_get_if_params (ifp
, addr
);
4515 ospf_if_update_params (ifp
, addr
);
4518 SET_IF_PARAM (params
, v_wait
);
4519 params
->v_wait
= seconds
;
4521 /* Update timer values in neighbor structure. */
4524 oi
= ospf_if_lookup_by_local_addr (ifp
, addr
);
4526 ospf_nbr_timer_update (oi
);
4530 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4531 if ((oi
= rn
->info
))
4532 ospf_nbr_timer_update (oi
);
4538 ALIAS (ip_ospf_dead_interval
,
4539 ip_ospf_dead_interval_cmd
,
4540 "ip ospf dead-interval <1-65535>",
4542 "OSPF interface commands\n"
4543 "Interval after which a neighbor is declared dead\n"
4546 ALIAS (ip_ospf_dead_interval
,
4547 ospf_dead_interval_cmd
,
4548 "ospf dead-interval <1-65535>",
4549 "OSPF interface commands\n"
4550 "Interval after which a neighbor is declared dead\n"
4553 DEFUN (no_ip_ospf_dead_interval
,
4554 no_ip_ospf_dead_interval_addr_cmd
,
4555 "no ip ospf dead-interval A.B.C.D",
4558 "OSPF interface commands\n"
4559 "Interval after which a neighbor is declared dead\n"
4560 "Address of interface")
4562 struct interface
*ifp
= vty
->index
;
4563 struct in_addr addr
;
4565 struct ospf_if_params
*params
;
4566 struct ospf_interface
*oi
;
4567 struct route_node
*rn
;
4570 params
= IF_DEF_PARAMS (ifp
);
4574 ret
= inet_aton(argv
[0], &addr
);
4577 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4582 params
= ospf_lookup_if_params (ifp
, addr
);
4587 UNSET_IF_PARAM (params
, v_wait
);
4588 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4590 if (params
!= IF_DEF_PARAMS (ifp
))
4592 ospf_free_if_params (ifp
, addr
);
4593 ospf_if_update_params (ifp
, addr
);
4596 /* Update timer values in neighbor structure. */
4599 oi
= ospf_if_lookup_by_local_addr (ifp
, addr
);
4601 ospf_nbr_timer_update (oi
);
4605 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4606 if ((oi
= rn
->info
))
4607 ospf_nbr_timer_update (oi
);
4613 ALIAS (no_ip_ospf_dead_interval
,
4614 no_ip_ospf_dead_interval_cmd
,
4615 "no ip ospf dead-interval",
4618 "OSPF interface commands\n"
4619 "Interval after which a neighbor is declared dead\n")
4621 ALIAS (no_ip_ospf_dead_interval
,
4622 no_ospf_dead_interval_cmd
,
4623 "no ospf dead-interval",
4625 "OSPF interface commands\n"
4626 "Interval after which a neighbor is declared dead\n")
4628 DEFUN (ip_ospf_hello_interval
,
4629 ip_ospf_hello_interval_addr_cmd
,
4630 "ip ospf hello-interval <1-65535> A.B.C.D",
4632 "OSPF interface commands\n"
4633 "Time between HELLO packets\n"
4635 "Address of interface")
4637 struct interface
*ifp
= vty
->index
;
4639 struct in_addr addr
;
4641 struct ospf_if_params
*params
;
4643 params
= IF_DEF_PARAMS (ifp
);
4645 seconds
= strtol (argv
[0], NULL
, 10);
4647 /* HelloInterval range is <1-65535>. */
4648 if (seconds
< 1 || seconds
> 65535)
4650 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
4656 ret
= inet_aton(argv
[1], &addr
);
4659 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4664 params
= ospf_get_if_params (ifp
, addr
);
4665 ospf_if_update_params (ifp
, addr
);
4668 SET_IF_PARAM (params
, v_hello
);
4669 params
->v_hello
= seconds
;
4674 ALIAS (ip_ospf_hello_interval
,
4675 ip_ospf_hello_interval_cmd
,
4676 "ip ospf hello-interval <1-65535>",
4678 "OSPF interface commands\n"
4679 "Time between HELLO packets\n"
4682 ALIAS (ip_ospf_hello_interval
,
4683 ospf_hello_interval_cmd
,
4684 "ospf hello-interval <1-65535>",
4685 "OSPF interface commands\n"
4686 "Time between HELLO packets\n"
4689 DEFUN (no_ip_ospf_hello_interval
,
4690 no_ip_ospf_hello_interval_addr_cmd
,
4691 "no ip ospf hello-interval A.B.C.D",
4694 "OSPF interface commands\n"
4695 "Time between HELLO packets\n"
4696 "Address of interface")
4698 struct interface
*ifp
= vty
->index
;
4699 struct in_addr addr
;
4701 struct ospf_if_params
*params
;
4704 params
= IF_DEF_PARAMS (ifp
);
4708 ret
= inet_aton(argv
[0], &addr
);
4711 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4716 params
= ospf_lookup_if_params (ifp
, addr
);
4721 UNSET_IF_PARAM (params
, v_hello
);
4722 params
->v_hello
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4724 if (params
!= IF_DEF_PARAMS (ifp
))
4726 ospf_free_if_params (ifp
, addr
);
4727 ospf_if_update_params (ifp
, addr
);
4733 ALIAS (no_ip_ospf_hello_interval
,
4734 no_ip_ospf_hello_interval_cmd
,
4735 "no ip ospf hello-interval",
4738 "OSPF interface commands\n"
4739 "Time between HELLO packets\n")
4741 ALIAS (no_ip_ospf_hello_interval
,
4742 no_ospf_hello_interval_cmd
,
4743 "no ospf hello-interval",
4745 "OSPF interface commands\n"
4746 "Time between HELLO packets\n")
4748 DEFUN (ip_ospf_network
,
4749 ip_ospf_network_cmd
,
4750 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4752 "OSPF interface commands\n"
4754 "Specify OSPF broadcast multi-access network\n"
4755 "Specify OSPF NBMA network\n"
4756 "Specify OSPF point-to-multipoint network\n"
4757 "Specify OSPF point-to-point network\n")
4759 struct interface
*ifp
= vty
->index
;
4760 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4761 struct route_node
*rn
;
4763 if (strncmp (argv
[0], "b", 1) == 0)
4764 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4765 else if (strncmp (argv
[0], "n", 1) == 0)
4766 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
4767 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
4768 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
4769 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
4770 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
4772 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4775 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
4777 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4779 struct ospf_interface
*oi
= rn
->info
;
4784 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4786 if (oi
->state
> ISM_Down
)
4788 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4789 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4796 ALIAS (ip_ospf_network
,
4798 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4799 "OSPF interface commands\n"
4801 "Specify OSPF broadcast multi-access network\n"
4802 "Specify OSPF NBMA network\n"
4803 "Specify OSPF point-to-multipoint network\n"
4804 "Specify OSPF point-to-point network\n")
4806 DEFUN (no_ip_ospf_network
,
4807 no_ip_ospf_network_cmd
,
4808 "no ip ospf network",
4811 "OSPF interface commands\n"
4814 struct interface
*ifp
= vty
->index
;
4815 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4816 struct route_node
*rn
;
4818 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4820 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4823 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4825 struct ospf_interface
*oi
= rn
->info
;
4830 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4832 if (oi
->state
> ISM_Down
)
4834 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4835 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4842 ALIAS (no_ip_ospf_network
,
4843 no_ospf_network_cmd
,
4846 "OSPF interface commands\n"
4849 DEFUN (ip_ospf_priority
,
4850 ip_ospf_priority_addr_cmd
,
4851 "ip ospf priority <0-255> A.B.C.D",
4853 "OSPF interface commands\n"
4856 "Address of interface")
4858 struct interface
*ifp
= vty
->index
;
4860 struct route_node
*rn
;
4861 struct in_addr addr
;
4863 struct ospf_if_params
*params
;
4865 params
= IF_DEF_PARAMS (ifp
);
4867 priority
= strtol (argv
[0], NULL
, 10);
4869 /* Router Priority range is <0-255>. */
4870 if (priority
< 0 || priority
> 255)
4872 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
4878 ret
= inet_aton(argv
[1], &addr
);
4881 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4886 params
= ospf_get_if_params (ifp
, addr
);
4887 ospf_if_update_params (ifp
, addr
);
4890 SET_IF_PARAM (params
, priority
);
4891 params
->priority
= priority
;
4893 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4895 struct ospf_interface
*oi
= rn
->info
;
4901 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
4903 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
4904 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
4911 ALIAS (ip_ospf_priority
,
4912 ip_ospf_priority_cmd
,
4913 "ip ospf priority <0-255>",
4915 "OSPF interface commands\n"
4919 ALIAS (ip_ospf_priority
,
4921 "ospf priority <0-255>",
4922 "OSPF interface commands\n"
4926 DEFUN (no_ip_ospf_priority
,
4927 no_ip_ospf_priority_addr_cmd
,
4928 "no ip ospf priority A.B.C.D",
4931 "OSPF interface commands\n"
4933 "Address of interface")
4935 struct interface
*ifp
= vty
->index
;
4936 struct route_node
*rn
;
4937 struct in_addr addr
;
4939 struct ospf_if_params
*params
;
4942 params
= IF_DEF_PARAMS (ifp
);
4946 ret
= inet_aton(argv
[0], &addr
);
4949 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4954 params
= ospf_lookup_if_params (ifp
, addr
);
4959 UNSET_IF_PARAM (params
, priority
);
4960 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
4962 if (params
!= IF_DEF_PARAMS (ifp
))
4964 ospf_free_if_params (ifp
, addr
);
4965 ospf_if_update_params (ifp
, addr
);
4968 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4970 struct ospf_interface
*oi
= rn
->info
;
4976 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
4978 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
4979 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
4986 ALIAS (no_ip_ospf_priority
,
4987 no_ip_ospf_priority_cmd
,
4988 "no ip ospf priority",
4991 "OSPF interface commands\n"
4992 "Router priority\n")
4994 ALIAS (no_ip_ospf_priority
,
4995 no_ospf_priority_cmd
,
4998 "OSPF interface commands\n"
4999 "Router priority\n")
5001 DEFUN (ip_ospf_retransmit_interval
,
5002 ip_ospf_retransmit_interval_addr_cmd
,
5003 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5005 "OSPF interface commands\n"
5006 "Time between retransmitting lost link state advertisements\n"
5008 "Address of interface")
5010 struct interface
*ifp
= vty
->index
;
5012 struct in_addr addr
;
5014 struct ospf_if_params
*params
;
5016 params
= IF_DEF_PARAMS (ifp
);
5017 seconds
= strtol (argv
[0], NULL
, 10);
5019 /* Retransmit Interval range is <3-65535>. */
5020 if (seconds
< 3 || seconds
> 65535)
5022 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
5029 ret
= inet_aton(argv
[1], &addr
);
5032 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5037 params
= ospf_get_if_params (ifp
, addr
);
5038 ospf_if_update_params (ifp
, addr
);
5041 SET_IF_PARAM (params
, retransmit_interval
);
5042 params
->retransmit_interval
= seconds
;
5047 ALIAS (ip_ospf_retransmit_interval
,
5048 ip_ospf_retransmit_interval_cmd
,
5049 "ip ospf retransmit-interval <3-65535>",
5051 "OSPF interface commands\n"
5052 "Time between retransmitting lost link state advertisements\n"
5055 ALIAS (ip_ospf_retransmit_interval
,
5056 ospf_retransmit_interval_cmd
,
5057 "ospf retransmit-interval <3-65535>",
5058 "OSPF interface commands\n"
5059 "Time between retransmitting lost link state advertisements\n"
5062 DEFUN (no_ip_ospf_retransmit_interval
,
5063 no_ip_ospf_retransmit_interval_addr_cmd
,
5064 "no ip ospf retransmit-interval A.B.C.D",
5067 "OSPF interface commands\n"
5068 "Time between retransmitting lost link state advertisements\n"
5069 "Address of interface")
5071 struct interface
*ifp
= vty
->index
;
5072 struct in_addr addr
;
5074 struct ospf_if_params
*params
;
5077 params
= IF_DEF_PARAMS (ifp
);
5081 ret
= inet_aton(argv
[0], &addr
);
5084 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5089 params
= ospf_lookup_if_params (ifp
, addr
);
5094 UNSET_IF_PARAM (params
, retransmit_interval
);
5095 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
5097 if (params
!= IF_DEF_PARAMS (ifp
))
5099 ospf_free_if_params (ifp
, addr
);
5100 ospf_if_update_params (ifp
, addr
);
5106 ALIAS (no_ip_ospf_retransmit_interval
,
5107 no_ip_ospf_retransmit_interval_cmd
,
5108 "no ip ospf retransmit-interval",
5111 "OSPF interface commands\n"
5112 "Time between retransmitting lost link state advertisements\n")
5114 ALIAS (no_ip_ospf_retransmit_interval
,
5115 no_ospf_retransmit_interval_cmd
,
5116 "no ospf retransmit-interval",
5118 "OSPF interface commands\n"
5119 "Time between retransmitting lost link state advertisements\n")
5121 DEFUN (ip_ospf_transmit_delay
,
5122 ip_ospf_transmit_delay_addr_cmd
,
5123 "ip ospf transmit-delay <1-65535> A.B.C.D",
5125 "OSPF interface commands\n"
5126 "Link state transmit delay\n"
5128 "Address of interface")
5130 struct interface
*ifp
= vty
->index
;
5132 struct in_addr addr
;
5134 struct ospf_if_params
*params
;
5136 params
= IF_DEF_PARAMS (ifp
);
5137 seconds
= strtol (argv
[0], NULL
, 10);
5139 /* Transmit Delay range is <1-65535>. */
5140 if (seconds
< 1 || seconds
> 65535)
5142 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
5148 ret
= inet_aton(argv
[1], &addr
);
5151 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5156 params
= ospf_get_if_params (ifp
, addr
);
5157 ospf_if_update_params (ifp
, addr
);
5160 SET_IF_PARAM (params
, transmit_delay
);
5161 params
->transmit_delay
= seconds
;
5166 ALIAS (ip_ospf_transmit_delay
,
5167 ip_ospf_transmit_delay_cmd
,
5168 "ip ospf transmit-delay <1-65535>",
5170 "OSPF interface commands\n"
5171 "Link state transmit delay\n"
5174 ALIAS (ip_ospf_transmit_delay
,
5175 ospf_transmit_delay_cmd
,
5176 "ospf transmit-delay <1-65535>",
5177 "OSPF interface commands\n"
5178 "Link state transmit delay\n"
5181 DEFUN (no_ip_ospf_transmit_delay
,
5182 no_ip_ospf_transmit_delay_addr_cmd
,
5183 "no ip ospf transmit-delay A.B.C.D",
5186 "OSPF interface commands\n"
5187 "Link state transmit delay\n"
5188 "Address of interface")
5190 struct interface
*ifp
= vty
->index
;
5191 struct in_addr addr
;
5193 struct ospf_if_params
*params
;
5196 params
= IF_DEF_PARAMS (ifp
);
5200 ret
= inet_aton(argv
[0], &addr
);
5203 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5208 params
= ospf_lookup_if_params (ifp
, addr
);
5213 UNSET_IF_PARAM (params
, transmit_delay
);
5214 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
5216 if (params
!= IF_DEF_PARAMS (ifp
))
5218 ospf_free_if_params (ifp
, addr
);
5219 ospf_if_update_params (ifp
, addr
);
5225 ALIAS (no_ip_ospf_transmit_delay
,
5226 no_ip_ospf_transmit_delay_cmd
,
5227 "no ip ospf transmit-delay",
5230 "OSPF interface commands\n"
5231 "Link state transmit delay\n")
5233 ALIAS (no_ip_ospf_transmit_delay
,
5234 no_ospf_transmit_delay_cmd
,
5235 "no ospf transmit-delay",
5237 "OSPF interface commands\n"
5238 "Link state transmit delay\n")
5241 DEFUN (ospf_redistribute_source_metric_type
,
5242 ospf_redistribute_source_metric_type_routemap_cmd
,
5243 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5244 "Redistribute information from another routing protocol\n"
5248 "Routing Information Protocol (RIP)\n"
5249 "Border Gateway Protocol (BGP)\n"
5250 "Metric for redistributed routes\n"
5251 "OSPF default metric\n"
5252 "OSPF exterior metric type for redistributed routes\n"
5253 "Set OSPF External Type 1 metrics\n"
5254 "Set OSPF External Type 2 metrics\n"
5255 "Route map reference\n"
5256 "Pointer to route-map entries\n")
5262 /* Get distribute source. */
5263 if (!str2distribute_source (argv
[0], &source
))
5266 /* Get metric value. */
5268 if (!str2metric (argv
[1], &metric
))
5271 /* Get metric type. */
5273 if (!str2metric_type (argv
[2], &type
))
5277 ospf_routemap_set (source
, argv
[3]);
5279 ospf_routemap_unset (source
);
5281 return ospf_redistribute_set (source
, type
, metric
);
5284 ALIAS (ospf_redistribute_source_metric_type
,
5285 ospf_redistribute_source_metric_type_cmd
,
5286 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5287 "Redistribute information from another routing protocol\n"
5291 "Routing Information Protocol (RIP)\n"
5292 "Border Gateway Protocol (BGP)\n"
5293 "Metric for redistributed routes\n"
5294 "OSPF default metric\n"
5295 "OSPF exterior metric type for redistributed routes\n"
5296 "Set OSPF External Type 1 metrics\n"
5297 "Set OSPF External Type 2 metrics\n")
5299 ALIAS (ospf_redistribute_source_metric_type
,
5300 ospf_redistribute_source_metric_cmd
,
5301 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5302 "Redistribute information from another routing protocol\n"
5306 "Routing Information Protocol (RIP)\n"
5307 "Border Gateway Protocol (BGP)\n"
5308 "Metric for redistributed routes\n"
5309 "OSPF default metric\n")
5311 DEFUN (ospf_redistribute_source_type_metric
,
5312 ospf_redistribute_source_type_metric_routemap_cmd
,
5313 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5314 "Redistribute information from another routing protocol\n"
5318 "Routing Information Protocol (RIP)\n"
5319 "Border Gateway Protocol (BGP)\n"
5320 "OSPF exterior metric type for redistributed routes\n"
5321 "Set OSPF External Type 1 metrics\n"
5322 "Set OSPF External Type 2 metrics\n"
5323 "Metric for redistributed routes\n"
5324 "OSPF default metric\n"
5325 "Route map reference\n"
5326 "Pointer to route-map entries\n")
5332 /* Get distribute source. */
5333 if (!str2distribute_source (argv
[0], &source
))
5336 /* Get metric value. */
5338 if (!str2metric_type (argv
[1], &type
))
5341 /* Get metric type. */
5343 if (!str2metric (argv
[2], &metric
))
5347 ospf_routemap_set (source
, argv
[3]);
5349 ospf_routemap_unset (source
);
5351 return ospf_redistribute_set (source
, type
, metric
);
5354 ALIAS (ospf_redistribute_source_type_metric
,
5355 ospf_redistribute_source_type_metric_cmd
,
5356 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5357 "Redistribute information from another routing protocol\n"
5361 "Routing Information Protocol (RIP)\n"
5362 "Border Gateway Protocol (BGP)\n"
5363 "OSPF exterior metric type for redistributed routes\n"
5364 "Set OSPF External Type 1 metrics\n"
5365 "Set OSPF External Type 2 metrics\n"
5366 "Metric for redistributed routes\n"
5367 "OSPF default metric\n")
5369 ALIAS (ospf_redistribute_source_type_metric
,
5370 ospf_redistribute_source_type_cmd
,
5371 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5372 "Redistribute information from another routing protocol\n"
5376 "Routing Information Protocol (RIP)\n"
5377 "Border Gateway Protocol (BGP)\n"
5378 "OSPF exterior metric type for redistributed routes\n"
5379 "Set OSPF External Type 1 metrics\n"
5380 "Set OSPF External Type 2 metrics\n")
5382 ALIAS (ospf_redistribute_source_type_metric
,
5383 ospf_redistribute_source_cmd
,
5384 "redistribute (kernel|connected|static|rip|bgp)",
5385 "Redistribute information from another routing protocol\n"
5389 "Routing Information Protocol (RIP)\n"
5390 "Border Gateway Protocol (BGP)\n")
5392 DEFUN (ospf_redistribute_source_metric_routemap
,
5393 ospf_redistribute_source_metric_routemap_cmd
,
5394 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5395 "Redistribute information from another routing protocol\n"
5399 "Routing Information Protocol (RIP)\n"
5400 "Border Gateway Protocol (BGP)\n"
5401 "Metric for redistributed routes\n"
5402 "OSPF default metric\n"
5403 "Route map reference\n"
5404 "Pointer to route-map entries\n")
5409 /* Get distribute source. */
5410 if (!str2distribute_source (argv
[0], &source
))
5413 /* Get metric value. */
5415 if (!str2metric (argv
[1], &metric
))
5419 ospf_routemap_set (source
, argv
[2]);
5421 ospf_routemap_unset (source
);
5423 return ospf_redistribute_set (source
, -1, metric
);
5426 DEFUN (ospf_redistribute_source_type_routemap
,
5427 ospf_redistribute_source_type_routemap_cmd
,
5428 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5429 "Redistribute information from another routing protocol\n"
5433 "Routing Information Protocol (RIP)\n"
5434 "Border Gateway Protocol (BGP)\n"
5435 "OSPF exterior metric type for redistributed routes\n"
5436 "Set OSPF External Type 1 metrics\n"
5437 "Set OSPF External Type 2 metrics\n"
5438 "Route map reference\n"
5439 "Pointer to route-map entries\n")
5444 /* Get distribute source. */
5445 if (!str2distribute_source (argv
[0], &source
))
5448 /* Get metric value. */
5450 if (!str2metric_type (argv
[1], &type
))
5454 ospf_routemap_set (source
, argv
[2]);
5456 ospf_routemap_unset (source
);
5458 return ospf_redistribute_set (source
, type
, -1);
5461 DEFUN (ospf_redistribute_source_routemap
,
5462 ospf_redistribute_source_routemap_cmd
,
5463 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5464 "Redistribute information from another routing protocol\n"
5468 "Routing Information Protocol (RIP)\n"
5469 "Border Gateway Protocol (BGP)\n"
5470 "Route map reference\n"
5471 "Pointer to route-map entries\n")
5475 /* Get distribute source. */
5476 if (!str2distribute_source (argv
[0], &source
))
5480 ospf_routemap_set (source
, argv
[1]);
5482 ospf_routemap_unset (source
);
5484 return ospf_redistribute_set (source
, -1, -1);
5487 DEFUN (no_ospf_redistribute_source
,
5488 no_ospf_redistribute_source_cmd
,
5489 "no redistribute (kernel|connected|static|rip|bgp)",
5491 "Redistribute information from another routing protocol\n"
5495 "Routing Information Protocol (RIP)\n"
5496 "Border Gateway Protocol (BGP)\n")
5500 if (!str2distribute_source (argv
[0], &source
))
5503 ospf_routemap_unset (source
);
5504 return ospf_redistribute_unset (source
);
5507 DEFUN (ospf_distribute_list_out
,
5508 ospf_distribute_list_out_cmd
,
5509 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5510 "Filter networks in routing updates\n"
5511 "Access-list name\n"
5516 "Routing Information Protocol (RIP)\n"
5517 "Border Gateway Protocol (BGP)\n")
5521 /* Get distribute source. */
5522 if (!str2distribute_source (argv
[1], &source
))
5525 return ospf_distribute_list_out_set (source
, argv
[0]);
5528 DEFUN (no_ospf_distribute_list_out
,
5529 no_ospf_distribute_list_out_cmd
,
5530 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5532 "Filter networks in routing updates\n"
5533 "Access-list name\n"
5538 "Routing Information Protocol (RIP)\n"
5539 "Border Gateway Protocol (BGP)\n")
5543 if (!str2distribute_source (argv
[1], &source
))
5546 return ospf_distribute_list_out_unset (source
, argv
[0]);
5549 /* Default information originate. */
5550 DEFUN (ospf_default_information_originate_metric_type_routemap
,
5551 ospf_default_information_originate_metric_type_routemap_cmd
,
5552 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5553 "Control distribution of default information\n"
5554 "Distribute a default route\n"
5555 "OSPF default metric\n"
5557 "OSPF metric type for default routes\n"
5558 "Set OSPF External Type 1 metrics\n"
5559 "Set OSPF External Type 2 metrics\n"
5560 "Route map reference\n"
5561 "Pointer to route-map entries\n")
5566 /* Get metric value. */
5568 if (!str2metric (argv
[0], &metric
))
5571 /* Get metric type. */
5573 if (!str2metric_type (argv
[1], &type
))
5577 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5579 ospf_routemap_unset (DEFAULT_ROUTE
);
5581 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, type
, metric
);
5584 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5585 ospf_default_information_originate_metric_type_cmd
,
5586 "default-information originate metric <0-16777214> metric-type (1|2)",
5587 "Control distribution of default information\n"
5588 "Distribute a default route\n"
5589 "OSPF default metric\n"
5591 "OSPF metric type for default routes\n"
5592 "Set OSPF External Type 1 metrics\n"
5593 "Set OSPF External Type 2 metrics\n")
5595 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5596 ospf_default_information_originate_metric_cmd
,
5597 "default-information originate metric <0-16777214>",
5598 "Control distribution of default information\n"
5599 "Distribute a default route\n"
5600 "OSPF default metric\n"
5603 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5604 ospf_default_information_originate_cmd
,
5605 "default-information originate",
5606 "Control distribution of default information\n"
5607 "Distribute a default route\n")
5609 /* Default information originate. */
5610 DEFUN (ospf_default_information_originate_metric_routemap
,
5611 ospf_default_information_originate_metric_routemap_cmd
,
5612 "default-information originate metric <0-16777214> route-map WORD",
5613 "Control distribution of default information\n"
5614 "Distribute a default route\n"
5615 "OSPF default metric\n"
5617 "Route map reference\n"
5618 "Pointer to route-map entries\n")
5622 /* Get metric value. */
5624 if (!str2metric (argv
[0], &metric
))
5628 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5630 ospf_routemap_unset (DEFAULT_ROUTE
);
5632 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, -1, metric
);
5635 /* Default information originate. */
5636 DEFUN (ospf_default_information_originate_routemap
,
5637 ospf_default_information_originate_routemap_cmd
,
5638 "default-information originate route-map WORD",
5639 "Control distribution of default information\n"
5640 "Distribute a default route\n"
5641 "Route map reference\n"
5642 "Pointer to route-map entries\n")
5645 ospf_routemap_set (DEFAULT_ROUTE
, argv
[0]);
5647 ospf_routemap_unset (DEFAULT_ROUTE
);
5649 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, -1, -1);
5652 DEFUN (ospf_default_information_originate_type_metric_routemap
,
5653 ospf_default_information_originate_type_metric_routemap_cmd
,
5654 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
5655 "Control distribution of default information\n"
5656 "Distribute a default route\n"
5657 "OSPF metric type for default routes\n"
5658 "Set OSPF External Type 1 metrics\n"
5659 "Set OSPF External Type 2 metrics\n"
5660 "OSPF default metric\n"
5662 "Route map reference\n"
5663 "Pointer to route-map entries\n")
5668 /* Get metric type. */
5670 if (!str2metric_type (argv
[0], &type
))
5673 /* Get metric value. */
5675 if (!str2metric (argv
[1], &metric
))
5679 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5681 ospf_routemap_unset (DEFAULT_ROUTE
);
5683 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, type
, metric
);
5686 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5687 ospf_default_information_originate_type_metric_cmd
,
5688 "default-information originate metric-type (1|2) metric <0-16777214>",
5689 "Control distribution of default information\n"
5690 "Distribute a default route\n"
5691 "OSPF metric type for default routes\n"
5692 "Set OSPF External Type 1 metrics\n"
5693 "Set OSPF External Type 2 metrics\n"
5694 "OSPF default metric\n"
5697 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5698 ospf_default_information_originate_type_cmd
,
5699 "default-information originate metric-type (1|2)",
5700 "Control distribution of default information\n"
5701 "Distribute a default route\n"
5702 "OSPF metric type for default routes\n"
5703 "Set OSPF External Type 1 metrics\n"
5704 "Set OSPF External Type 2 metrics\n")
5706 DEFUN (ospf_default_information_originate_type_routemap
,
5707 ospf_default_information_originate_type_routemap_cmd
,
5708 "default-information originate metric-type (1|2) route-map WORD",
5709 "Control distribution of default information\n"
5710 "Distribute a default route\n"
5711 "OSPF metric type for default routes\n"
5712 "Set OSPF External Type 1 metrics\n"
5713 "Set OSPF External Type 2 metrics\n"
5714 "Route map reference\n"
5715 "Pointer to route-map entries\n")
5719 /* Get metric type. */
5721 if (!str2metric_type (argv
[0], &type
))
5725 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5727 ospf_routemap_unset (DEFAULT_ROUTE
);
5729 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, type
, -1);
5732 DEFUN (ospf_default_information_originate_always_metric_type_routemap
,
5733 ospf_default_information_originate_always_metric_type_routemap_cmd
,
5734 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5735 "Control distribution of default information\n"
5736 "Distribute a default route\n"
5737 "Always advertise default route\n"
5738 "OSPF default metric\n"
5740 "OSPF metric type for default routes\n"
5741 "Set OSPF External Type 1 metrics\n"
5742 "Set OSPF External Type 2 metrics\n"
5743 "Route map reference\n"
5744 "Pointer to route-map entries\n")
5749 /* Get metric value. */
5751 if (!str2metric (argv
[0], &metric
))
5754 /* Get metric type. */
5756 if (!str2metric_type (argv
[1], &type
))
5760 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5762 ospf_routemap_unset (DEFAULT_ROUTE
);
5764 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
,
5768 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5769 ospf_default_information_originate_always_metric_type_cmd
,
5770 "default-information originate always metric <0-16777214> metric-type (1|2)",
5771 "Control distribution of default information\n"
5772 "Distribute a default route\n"
5773 "Always advertise default route\n"
5774 "OSPF default metric\n"
5776 "OSPF metric type for default routes\n"
5777 "Set OSPF External Type 1 metrics\n"
5778 "Set OSPF External Type 2 metrics\n")
5780 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5781 ospf_default_information_originate_always_metric_cmd
,
5782 "default-information originate always metric <0-16777214>",
5783 "Control distribution of default information\n"
5784 "Distribute a default route\n"
5785 "Always advertise default route\n"
5786 "OSPF default metric\n"
5788 "OSPF metric type for default routes\n")
5790 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5791 ospf_default_information_originate_always_cmd
,
5792 "default-information originate always",
5793 "Control distribution of default information\n"
5794 "Distribute a default route\n"
5795 "Always advertise default route\n")
5797 DEFUN (ospf_default_information_originate_always_metric_routemap
,
5798 ospf_default_information_originate_always_metric_routemap_cmd
,
5799 "default-information originate always metric <0-16777214> route-map WORD",
5800 "Control distribution of default information\n"
5801 "Distribute a default route\n"
5802 "Always advertise default route\n"
5803 "OSPF default metric\n"
5805 "Route map reference\n"
5806 "Pointer to route-map entries\n")
5810 /* Get metric value. */
5812 if (!str2metric (argv
[0], &metric
))
5816 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5818 ospf_routemap_unset (DEFAULT_ROUTE
);
5820 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
, -1, metric
);
5823 DEFUN (ospf_default_information_originate_always_routemap
,
5824 ospf_default_information_originate_always_routemap_cmd
,
5825 "default-information originate always route-map WORD",
5826 "Control distribution of default information\n"
5827 "Distribute a default route\n"
5828 "Always advertise default route\n"
5829 "Route map reference\n"
5830 "Pointer to route-map entries\n")
5833 ospf_routemap_set (DEFAULT_ROUTE
, argv
[0]);
5835 ospf_routemap_unset (DEFAULT_ROUTE
);
5837 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
, -1, -1);
5840 DEFUN (ospf_default_information_originate_always_type_metric_routemap
,
5841 ospf_default_information_originate_always_type_metric_routemap_cmd
,
5842 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
5843 "Control distribution of default information\n"
5844 "Distribute a default route\n"
5845 "Always advertise default route\n"
5846 "OSPF metric type for default routes\n"
5847 "Set OSPF External Type 1 metrics\n"
5848 "Set OSPF External Type 2 metrics\n"
5849 "OSPF default metric\n"
5851 "Route map reference\n"
5852 "Pointer to route-map entries\n")
5857 /* Get metric type. */
5859 if (!str2metric_type (argv
[0], &type
))
5862 /* Get metric value. */
5864 if (!str2metric (argv
[1], &metric
))
5868 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5870 ospf_routemap_unset (DEFAULT_ROUTE
);
5872 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
,
5876 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5877 ospf_default_information_originate_always_type_metric_cmd
,
5878 "default-information originate always metric-type (1|2) metric <0-16777214>",
5879 "Control distribution of default information\n"
5880 "Distribute a default route\n"
5881 "Always advertise default route\n"
5882 "OSPF metric type for default routes\n"
5883 "Set OSPF External Type 1 metrics\n"
5884 "Set OSPF External Type 2 metrics\n"
5885 "OSPF default metric\n"
5888 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5889 ospf_default_information_originate_always_type_cmd
,
5890 "default-information originate always metric-type (1|2)",
5891 "Control distribution of default information\n"
5892 "Distribute a default route\n"
5893 "Always advertise default route\n"
5894 "OSPF metric type for default routes\n"
5895 "Set OSPF External Type 1 metrics\n"
5896 "Set OSPF External Type 2 metrics\n")
5898 DEFUN (ospf_default_information_originate_always_type_routemap
,
5899 ospf_default_information_originate_always_type_routemap_cmd
,
5900 "default-information originate always metric-type (1|2) route-map WORD",
5901 "Control distribution of default information\n"
5902 "Distribute a default route\n"
5903 "Always advertise default route\n"
5904 "OSPF metric type for default routes\n"
5905 "Set OSPF External Type 1 metrics\n"
5906 "Set OSPF External Type 2 metrics\n"
5907 "Route map reference\n"
5908 "Pointer to route-map entries\n")
5912 /* Get metric type. */
5914 if (!str2metric_type (argv
[0], &type
))
5918 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5920 ospf_routemap_unset (DEFAULT_ROUTE
);
5922 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
,
5926 DEFUN (no_ospf_default_information_originate
,
5927 no_ospf_default_information_originate_cmd
,
5928 "no default-information originate",
5930 "Control distribution of default information\n"
5931 "Distribute a default route\n")
5933 struct prefix_ipv4 p
;
5934 struct in_addr nexthop
;
5937 p
.prefix
.s_addr
= 0;
5940 ospf_external_lsa_flush (DEFAULT_ROUTE
, &p
, 0, nexthop
);
5942 if (EXTERNAL_INFO (DEFAULT_ROUTE
)) {
5943 ospf_external_info_delete (DEFAULT_ROUTE
, p
);
5944 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE
));
5945 EXTERNAL_INFO (DEFAULT_ROUTE
) = NULL
;
5948 ospf_routemap_unset (DEFAULT_ROUTE
);
5949 return ospf_redistribute_default_unset ();
5952 DEFUN (ospf_default_metric
,
5953 ospf_default_metric_cmd
,
5954 "default-metric <0-16777214>",
5955 "Set metric of redistributed routes\n"
5960 if (!str2metric (argv
[0], &metric
))
5963 ospf_top
->default_metric
= metric
;
5968 DEFUN (no_ospf_default_metric
,
5969 no_ospf_default_metric_cmd
,
5970 "no default-metric",
5972 "Set metric of redistributed routes\n")
5974 ospf_top
->default_metric
= -1;
5978 ALIAS (no_ospf_default_metric
,
5979 no_ospf_default_metric_val_cmd
,
5980 "no default-metric <0-16777214>",
5982 "Set metric of redistributed routes\n"
5985 DEFUN (ospf_distance
,
5988 "Define an administrative distance\n"
5989 "OSPF Administrative distance\n")
5991 ospf_top
->distance_all
= atoi (argv
[0]);
5995 DEFUN (no_ospf_distance
,
5996 no_ospf_distance_cmd
,
5997 "no distance <1-255>",
5999 "Define an administrative distance\n"
6000 "OSPF Administrative distance\n")
6002 ospf_top
->distance_all
= 0;
6006 DEFUN (no_ospf_distance_ospf
,
6007 no_ospf_distance_ospf_cmd
,
6010 "Define an administrative distance\n"
6011 "OSPF Administrative distance\n"
6014 ospf_top
->distance_intra
= 0;
6015 ospf_top
->distance_inter
= 0;
6016 ospf_top
->distance_external
= 0;
6020 DEFUN (ospf_distance_ospf_intra
,
6021 ospf_distance_ospf_intra_cmd
,
6022 "distance ospf intra-area <1-255>",
6023 "Define an administrative distance\n"
6024 "OSPF Administrative distance\n"
6025 "Intra-area routes\n"
6026 "Distance for intra-area routes\n")
6028 ospf_top
->distance_intra
= atoi (argv
[0]);
6032 DEFUN (ospf_distance_ospf_intra_inter
,
6033 ospf_distance_ospf_intra_inter_cmd
,
6034 "distance ospf intra-area <1-255> inter-area <1-255>",
6035 "Define an administrative distance\n"
6036 "OSPF Administrative distance\n"
6037 "Intra-area routes\n"
6038 "Distance for intra-area routes\n"
6039 "Inter-area routes\n"
6040 "Distance for inter-area routes\n")
6042 ospf_top
->distance_intra
= atoi (argv
[0]);
6043 ospf_top
->distance_inter
= atoi (argv
[1]);
6047 DEFUN (ospf_distance_ospf_intra_external
,
6048 ospf_distance_ospf_intra_external_cmd
,
6049 "distance ospf intra-area <1-255> external <1-255>",
6050 "Define an administrative distance\n"
6051 "OSPF Administrative distance\n"
6052 "Intra-area routes\n"
6053 "Distance for intra-area routes\n"
6055 "Distance for external routes\n")
6057 ospf_top
->distance_intra
= atoi (argv
[0]);
6058 ospf_top
->distance_external
= atoi (argv
[1]);
6062 DEFUN (ospf_distance_ospf_intra_inter_external
,
6063 ospf_distance_ospf_intra_inter_external_cmd
,
6064 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6065 "Define an administrative distance\n"
6066 "OSPF Administrative distance\n"
6067 "Intra-area routes\n"
6068 "Distance for intra-area routes\n"
6069 "Inter-area routes\n"
6070 "Distance for inter-area routes\n"
6072 "Distance for external routes\n")
6074 ospf_top
->distance_intra
= atoi (argv
[0]);
6075 ospf_top
->distance_inter
= atoi (argv
[1]);
6076 ospf_top
->distance_external
= atoi (argv
[2]);
6080 DEFUN (ospf_distance_ospf_intra_external_inter
,
6081 ospf_distance_ospf_intra_external_inter_cmd
,
6082 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6083 "Define an administrative distance\n"
6084 "OSPF Administrative distance\n"
6085 "Intra-area routes\n"
6086 "Distance for intra-area routes\n"
6088 "Distance for external routes\n"
6089 "Inter-area routes\n"
6090 "Distance for inter-area routes\n")
6092 ospf_top
->distance_intra
= atoi (argv
[0]);
6093 ospf_top
->distance_external
= atoi (argv
[1]);
6094 ospf_top
->distance_inter
= atoi (argv
[2]);
6098 DEFUN (ospf_distance_ospf_inter
,
6099 ospf_distance_ospf_inter_cmd
,
6100 "distance ospf inter-area <1-255>",
6101 "Define an administrative distance\n"
6102 "OSPF Administrative distance\n"
6103 "Inter-area routes\n"
6104 "Distance for inter-area routes\n")
6106 ospf_top
->distance_inter
= atoi (argv
[0]);
6110 DEFUN (ospf_distance_ospf_inter_intra
,
6111 ospf_distance_ospf_inter_intra_cmd
,
6112 "distance ospf inter-area <1-255> intra-area <1-255>",
6113 "Define an administrative distance\n"
6114 "OSPF Administrative distance\n"
6115 "Inter-area routes\n"
6116 "Distance for inter-area routes\n"
6117 "Intra-area routes\n"
6118 "Distance for intra-area routes\n")
6120 ospf_top
->distance_inter
= atoi (argv
[0]);
6121 ospf_top
->distance_intra
= atoi (argv
[1]);
6125 DEFUN (ospf_distance_ospf_inter_external
,
6126 ospf_distance_ospf_inter_external_cmd
,
6127 "distance ospf inter-area <1-255> external <1-255>",
6128 "Define an administrative distance\n"
6129 "OSPF Administrative distance\n"
6130 "Inter-area routes\n"
6131 "Distance for inter-area routes\n"
6133 "Distance for external routes\n")
6135 ospf_top
->distance_inter
= atoi (argv
[0]);
6136 ospf_top
->distance_external
= atoi (argv
[1]);
6140 DEFUN (ospf_distance_ospf_inter_intra_external
,
6141 ospf_distance_ospf_inter_intra_external_cmd
,
6142 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6143 "Define an administrative distance\n"
6144 "OSPF Administrative distance\n"
6145 "Inter-area routes\n"
6146 "Distance for inter-area routes\n"
6147 "Intra-area routes\n"
6148 "Distance for intra-area routes\n"
6150 "Distance for external routes\n")
6152 ospf_top
->distance_inter
= atoi (argv
[0]);
6153 ospf_top
->distance_intra
= atoi (argv
[1]);
6154 ospf_top
->distance_external
= atoi (argv
[2]);
6158 DEFUN (ospf_distance_ospf_inter_external_intra
,
6159 ospf_distance_ospf_inter_external_intra_cmd
,
6160 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6161 "Define an administrative distance\n"
6162 "OSPF Administrative distance\n"
6163 "Inter-area routes\n"
6164 "Distance for inter-area routes\n"
6166 "Distance for external routes\n"
6167 "Intra-area routes\n"
6168 "Distance for intra-area routes\n")
6170 ospf_top
->distance_inter
= atoi (argv
[0]);
6171 ospf_top
->distance_external
= atoi (argv
[1]);
6172 ospf_top
->distance_intra
= atoi (argv
[2]);
6176 DEFUN (ospf_distance_ospf_external
,
6177 ospf_distance_ospf_external_cmd
,
6178 "distance ospf external <1-255>",
6179 "Define an administrative distance\n"
6180 "OSPF Administrative distance\n"
6182 "Distance for external routes\n")
6184 ospf_top
->distance_external
= atoi (argv
[0]);
6188 DEFUN (ospf_distance_ospf_external_intra
,
6189 ospf_distance_ospf_external_intra_cmd
,
6190 "distance ospf external <1-255> intra-area <1-255>",
6191 "Define an administrative distance\n"
6192 "OSPF Administrative distance\n"
6194 "Distance for external routes\n"
6195 "Intra-area routes\n"
6196 "Distance for intra-area routes\n")
6198 ospf_top
->distance_external
= atoi (argv
[0]);
6199 ospf_top
->distance_intra
= atoi (argv
[1]);
6203 DEFUN (ospf_distance_ospf_external_inter
,
6204 ospf_distance_ospf_external_inter_cmd
,
6205 "distance ospf external <1-255> inter-area <1-255>",
6206 "Define an administrative distance\n"
6207 "OSPF Administrative distance\n"
6209 "Distance for external routes\n"
6210 "Inter-area routes\n"
6211 "Distance for inter-area routes\n")
6213 ospf_top
->distance_external
= atoi (argv
[0]);
6214 ospf_top
->distance_inter
= atoi (argv
[1]);
6218 DEFUN (ospf_distance_ospf_external_intra_inter
,
6219 ospf_distance_ospf_external_intra_inter_cmd
,
6220 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6221 "Define an administrative distance\n"
6222 "OSPF Administrative distance\n"
6224 "Distance for external routes\n"
6225 "Intra-area routes\n"
6226 "Distance for intra-area routes\n"
6227 "Inter-area routes\n"
6228 "Distance for inter-area routes\n")
6230 ospf_top
->distance_external
= atoi (argv
[0]);
6231 ospf_top
->distance_intra
= atoi (argv
[1]);
6232 ospf_top
->distance_inter
= atoi (argv
[2]);
6236 DEFUN (ospf_distance_ospf_external_inter_intra
,
6237 ospf_distance_ospf_external_inter_intra_cmd
,
6238 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6239 "Define an administrative distance\n"
6240 "OSPF Administrative distance\n"
6242 "Distance for external routes\n"
6243 "Inter-area routes\n"
6244 "Distance for inter-area routes\n"
6245 "Intra-area routes\n"
6246 "Distance for intra-area routes\n")
6248 ospf_top
->distance_external
= atoi (argv
[0]);
6249 ospf_top
->distance_inter
= atoi (argv
[1]);
6250 ospf_top
->distance_intra
= atoi (argv
[2]);
6254 DEFUN (ospf_distance_source
,
6255 ospf_distance_source_cmd
,
6256 "distance <1-255> A.B.C.D/M",
6257 "Administrative distance\n"
6259 "IP source prefix\n")
6261 ospf_distance_set (vty
, argv
[0], argv
[1], NULL
);
6265 DEFUN (no_ospf_distance_source
,
6266 no_ospf_distance_source_cmd
,
6267 "no distance <1-255> A.B.C.D/M",
6269 "Administrative distance\n"
6271 "IP source prefix\n")
6273 ospf_distance_unset (vty
, argv
[0], argv
[1], NULL
);
6277 DEFUN (ospf_distance_source_access_list
,
6278 ospf_distance_source_access_list_cmd
,
6279 "distance <1-255> A.B.C.D/M WORD",
6280 "Administrative distance\n"
6282 "IP source prefix\n"
6283 "Access list name\n")
6285 ospf_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
6289 DEFUN (no_ospf_distance_source_access_list
,
6290 no_ospf_distance_source_access_list_cmd
,
6291 "no distance <1-255> A.B.C.D/M WORD",
6293 "Administrative distance\n"
6295 "IP source prefix\n"
6296 "Access list name\n")
6298 ospf_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
6303 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
6305 struct route_node
*rn
;
6306 struct ospf_route
*or;
6308 struct ospf_path
*path
;
6310 vty_out (vty
, "============ OSPF network routing table ============%s",
6313 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6314 if ((or = rn
->info
) != NULL
)
6317 snprintf (buf1
, 19, "%s/%d",
6318 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6320 switch (or->path_type
)
6322 case OSPF_PATH_INTER_AREA
:
6323 if (or->type
== OSPF_DESTINATION_NETWORK
)
6324 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
6325 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6326 else if (or->type
== OSPF_DESTINATION_DISCARD
)
6327 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
6329 case OSPF_PATH_INTRA_AREA
:
6330 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
6331 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6337 if (or->type
== OSPF_DESTINATION_NETWORK
)
6338 for (pnode
= listhead (or->path
); pnode
; nextnode (pnode
))
6340 path
= getdata (pnode
);
6341 if (path
->oi
!= NULL
)
6343 if (path
->nexthop
.s_addr
== 0)
6344 vty_out (vty
, "%24s directly attached to %s%s",
6345 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6347 vty_out (vty
, "%24s via %s, %s%s", "",
6348 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6353 vty_out (vty
, "%s", VTY_NEWLINE
);
6357 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
6359 struct route_node
*rn
;
6360 struct ospf_route
*or;
6362 struct ospf_path
*path
;
6364 vty_out (vty
, "============ OSPF router routing table =============%s",
6366 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
6371 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
6373 for (nn
= listhead ((list
) rn
->info
); nn
; nextnode (nn
))
6374 if ((or = getdata (nn
)) != NULL
)
6380 vty_out (vty
, "%s [%d] area: %s",
6381 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
6382 or->cost
, inet_ntoa (or->u
.std
.area_id
));
6384 vty_out (vty
, "%s%s%s",
6385 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
6386 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
6389 for (pn
= listhead (or->path
); pn
; nextnode (pn
))
6391 path
= getdata (pn
);
6392 if (path
->nexthop
.s_addr
== 0)
6393 vty_out (vty
, "%24s directly attached to %s%s",
6394 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6396 vty_out (vty
, "%24s via %s, %s%s", "",
6397 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6402 vty_out (vty
, "%s", VTY_NEWLINE
);
6406 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
6408 struct route_node
*rn
;
6409 struct ospf_route
*er
;
6411 struct ospf_path
*path
;
6413 vty_out (vty
, "============ OSPF external routing table ===========%s",
6415 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6416 if ((er
= rn
->info
) != NULL
)
6419 snprintf (buf1
, 19, "%s/%d",
6420 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6422 switch (er
->path_type
)
6424 case OSPF_PATH_TYPE1_EXTERNAL
:
6425 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
6426 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6428 case OSPF_PATH_TYPE2_EXTERNAL
:
6429 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
6430 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6434 for (pnode
= listhead (er
->path
); pnode
; nextnode (pnode
))
6436 path
= getdata (pnode
);
6437 if (path
->oi
!= NULL
)
6439 if (path
->nexthop
.s_addr
== 0)
6440 vty_out (vty
, "%24s directly attached to %s%s",
6441 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6443 vty_out (vty
, "%24s via %s, %s%s", "",
6444 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6449 vty_out (vty
, "%s", VTY_NEWLINE
);
6453 DEFUN (show_ip_ospf_border_routers
,
6454 show_ip_ospf_border_routers_cmd
,
6455 "show ip ospf border-routers",
6458 "show all the ABR's and ASBR's\n"
6461 if (ospf_top
== NULL
)
6463 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6467 if (ospf_top
->new_table
== NULL
)
6469 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6473 /* Show Network routes.
6474 show_ip_ospf_route_network (vty, ospf_top->new_table); */
6476 /* Show Router routes. */
6477 show_ip_ospf_route_router (vty
, ospf_top
->new_rtrs
);
6481 #endif /* HAVE_NSSA */
6483 DEFUN (show_ip_ospf_route
,
6484 show_ip_ospf_route_cmd
,
6485 "show ip ospf route",
6488 "OSPF information\n"
6489 "OSPF routing table\n")
6491 if (ospf_top
== NULL
)
6493 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6497 if (ospf_top
->new_table
== NULL
)
6499 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6503 /* Show Network routes. */
6504 show_ip_ospf_route_network (vty
, ospf_top
->new_table
);
6506 /* Show Router routes. */
6507 show_ip_ospf_route_router (vty
, ospf_top
->new_rtrs
);
6509 /* Show AS External routes. */
6510 show_ip_ospf_route_external (vty
, ospf_top
->old_external_route
);
6516 char *ospf_abr_type_str
[] =
6525 char *ospf_shortcut_mode_str
[] =
6534 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
6536 memset (buf
, 0, length
);
6538 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6539 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
6541 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
6545 char *ospf_int_type_str
[] =
6547 "unknown", /* should never be used. */
6551 "point-to-multipoint",
6552 "virtual-link", /* should never be used. */
6556 /* Configuration write function for ospfd. */
6558 config_write_interface (struct vty
*vty
)
6561 struct interface
*ifp
;
6562 struct crypt_key
*ck
;
6564 struct route_node
*rn
= NULL
;
6565 struct ospf_if_params
*params
;
6567 for (n1
= listhead (iflist
); n1
; nextnode (n1
))
6571 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
6574 vty_out (vty
, "!%s", VTY_NEWLINE
);
6575 vty_out (vty
, "interface %s%s", ifp
->name
,
6578 vty_out (vty
, " description %s%s", ifp
->desc
,
6583 params
= IF_DEF_PARAMS (ifp
);
6586 /* Interface Network print. */
6587 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
6588 params
->type
!= OSPF_IFTYPE_BROADCAST
&&
6589 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
6591 vty_out (vty
, " ip ospf network %s",
6592 ospf_int_type_str
[params
->type
]);
6593 if (params
!= IF_DEF_PARAMS (ifp
))
6594 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6595 vty_out (vty
, "%s", VTY_NEWLINE
);
6598 /* OSPF interface authentication print */
6599 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
6600 params
->auth_type
!= OSPF_AUTH_NOTSET
)
6604 /* Translation tables are not that much help here due to syntax
6605 of the simple option */
6606 switch (params
->auth_type
)
6609 case OSPF_AUTH_NULL
:
6613 case OSPF_AUTH_SIMPLE
:
6617 case OSPF_AUTH_CRYPTOGRAPHIC
:
6618 auth_str
= " message-digest";
6626 vty_out (vty
, " ip ospf authentication%s", auth_str
);
6627 if (params
!= IF_DEF_PARAMS (ifp
))
6628 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6629 vty_out (vty
, "%s", VTY_NEWLINE
);
6632 /* Simple Authentication Password print. */
6633 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
6634 params
->auth_simple
[0] != '\0')
6636 vty_out (vty
, " ip ospf authentication-key %s",
6637 params
->auth_simple
);
6638 if (params
!= IF_DEF_PARAMS (ifp
))
6639 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6640 vty_out (vty
, "%s", VTY_NEWLINE
);
6643 /* Cryptographic Authentication Key print. */
6644 for (n2
= listhead (params
->auth_crypt
); n2
; nextnode (n2
))
6647 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
6648 ck
->key_id
, ck
->auth_key
);
6649 if (params
!= IF_DEF_PARAMS (ifp
))
6650 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6651 vty_out (vty
, "%s", VTY_NEWLINE
);
6654 /* Interface Output Cost print. */
6655 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
6657 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
6658 if (params
!= IF_DEF_PARAMS (ifp
))
6659 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6660 vty_out (vty
, "%s", VTY_NEWLINE
);
6663 /* Hello Interval print. */
6664 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
6665 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
6667 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
6668 if (params
!= IF_DEF_PARAMS (ifp
))
6669 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6670 vty_out (vty
, "%s", VTY_NEWLINE
);
6674 /* Router Dead Interval print. */
6675 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
6676 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
6678 vty_out (vty
, " ip ospf dead-interval %u", params
->v_wait
);
6679 if (params
!= IF_DEF_PARAMS (ifp
))
6680 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6681 vty_out (vty
, "%s", VTY_NEWLINE
);
6684 /* Router Priority print. */
6685 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
6686 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
6688 vty_out (vty
, " ip ospf priority %u", params
->priority
);
6689 if (params
!= IF_DEF_PARAMS (ifp
))
6690 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6691 vty_out (vty
, "%s", VTY_NEWLINE
);
6694 /* Retransmit Interval print. */
6695 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
6696 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
6698 vty_out (vty
, " ip ospf retransmit-interval %u",
6699 params
->retransmit_interval
);
6700 if (params
!= IF_DEF_PARAMS (ifp
))
6701 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6702 vty_out (vty
, "%s", VTY_NEWLINE
);
6705 /* Transmit Delay print. */
6706 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
6707 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
6709 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
6710 if (params
!= IF_DEF_PARAMS (ifp
))
6711 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6712 vty_out (vty
, "%s", VTY_NEWLINE
);
6718 rn
= route_top (IF_OIFS_PARAMS (ifp
));
6720 rn
= route_next (rn
);
6730 #ifdef HAVE_OPAQUE_LSA
6731 ospf_opaque_config_write_if (vty
, ifp
);
6732 #endif /* HAVE_OPAQUE_LSA */
6739 config_write_network_area (struct vty
*vty
)
6741 struct route_node
*rn
;
6742 u_char buf
[INET_ADDRSTRLEN
];
6744 /* `network area' print. */
6745 for (rn
= route_top (ospf_top
->networks
); rn
; rn
= route_next (rn
))
6748 struct ospf_network
*n
= rn
->info
;
6750 memset (buf
, 0, INET_ADDRSTRLEN
);
6752 /* Create Area ID string by specified Area ID format. */
6753 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6754 strncpy (buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
6756 sprintf (buf
, "%lu",
6757 (unsigned long int) ntohl (n
->area_id
.s_addr
));
6759 /* Network print. */
6760 vty_out (vty
, " network %s/%d area %s%s",
6761 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
6769 config_write_ospf_area (struct vty
*vty
)
6772 u_char buf
[INET_ADDRSTRLEN
];
6774 /* Area configuration print. */
6775 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
6777 struct ospf_area
*area
= getdata (node
);
6778 struct route_node
*rn1
;
6780 area_id2str (buf
, INET_ADDRSTRLEN
, area
);
6782 if (area
->auth_type
!= OSPF_AUTH_NULL
)
6784 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
6785 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
6787 vty_out (vty
, " area %s authentication message-digest%s",
6791 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
6792 vty_out (vty
, " area %s shortcut %s%s", buf
,
6793 ospf_shortcut_mode_str
[area
->shortcut_configured
],
6796 if ((area
->external_routing
== OSPF_AREA_STUB
)
6798 || (area
->external_routing
== OSPF_AREA_NSSA
)
6799 #endif /* HAVE_NSSA */
6803 if (area
->external_routing
== OSPF_AREA_NSSA
)
6804 vty_out (vty
, " area %s nssa", buf
);
6806 #endif /* HAVE_NSSA */
6807 vty_out (vty
, " area %s stub", buf
);
6809 if (area
->no_summary
)
6810 vty_out (vty
, " no-summary");
6812 vty_out (vty
, "%s", VTY_NEWLINE
);
6814 if (area
->default_cost
!= 1)
6815 vty_out (vty
, " area %s default-cost %d%s", buf
,
6816 area
->default_cost
, VTY_NEWLINE
);
6819 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
6822 struct ospf_area_range
*range
= rn1
->info
;
6824 vty_out (vty
, " area %s range %s/%d", buf
,
6825 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
6827 if (range
->cost_config
!= -1)
6828 vty_out (vty
, " cost %d", range
->cost_config
);
6830 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
6831 vty_out (vty
, " not-advertise");
6833 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
6834 vty_out (vty
, " substitute %s/%d",
6835 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
6837 vty_out (vty
, "%s", VTY_NEWLINE
);
6840 if (EXPORT_NAME (area
))
6841 vty_out (vty
, " area %s export-list %s%s", buf
,
6842 EXPORT_NAME (area
), VTY_NEWLINE
);
6844 if (IMPORT_NAME (area
))
6845 vty_out (vty
, " area %s import-list %s%s", buf
,
6846 IMPORT_NAME (area
), VTY_NEWLINE
);
6848 if (PREFIX_NAME_IN (area
))
6849 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
6850 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
6852 if (PREFIX_NAME_OUT (area
))
6853 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
6854 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
6861 config_write_ospf_nbr_nbma (struct vty
*vty
)
6863 struct ospf_nbr_nbma
*nbr_nbma
;
6864 struct route_node
*rn
;
6866 /* Static Neighbor configuration print. */
6867 for (rn
= route_top (ospf_top
->nbr_nbma
); rn
; rn
= route_next (rn
))
6868 if ((nbr_nbma
= rn
->info
))
6870 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
6872 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
6873 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
6875 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
6876 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
6878 vty_out (vty
, "%s", VTY_NEWLINE
);
6885 config_write_virtual_link (struct vty
*vty
)
6888 u_char buf
[INET_ADDRSTRLEN
];
6890 /* Virtual-Link print */
6891 for (node
= listhead (ospf_top
->vlinks
); node
; nextnode (node
))
6894 struct crypt_key
*ck
;
6895 struct ospf_vl_data
*vl_data
= getdata (node
);
6896 struct ospf_interface
*oi
;
6898 if (vl_data
!= NULL
)
6900 memset (buf
, 0, INET_ADDRSTRLEN
);
6902 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6903 strncpy (buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
6905 sprintf (buf
, "%lu",
6906 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
6907 oi
= vl_data
->vl_oi
;
6910 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
6911 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
6912 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
6913 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
6914 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
6916 inet_ntoa (vl_data
->vl_peer
),
6917 OSPF_IF_PARAM (oi
, v_hello
),
6918 OSPF_IF_PARAM (oi
, retransmit_interval
),
6919 OSPF_IF_PARAM (oi
, transmit_delay
),
6920 OSPF_IF_PARAM (oi
, v_wait
),
6923 vty_out (vty
, " area %s virtual-link %s%s", buf
,
6924 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
6926 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
6927 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
6929 inet_ntoa (vl_data
->vl_peer
),
6930 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
6933 for (n2
= listhead (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
); n2
; nextnode (n2
))
6936 vty_out (vty
, " area %s virtual-link %s message-digest-key %d md5 %s%s",
6938 inet_ntoa (vl_data
->vl_peer
),
6939 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
6949 char *distribute_str
[] = { "system", "kernel", "connected", "static", "rip",
6950 "ripng", "ospf", "ospf6", "bgp"};
6952 config_write_ospf_redistribute (struct vty
*vty
)
6956 /* redistribute print. */
6957 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
6958 if (type
!= zclient
->redist_default
&& zclient
->redist
[type
])
6960 vty_out (vty
, " redistribute %s", distribute_str
[type
]);
6961 if (ospf_top
->dmetric
[type
].value
>= 0)
6962 vty_out (vty
, " metric %d", ospf_top
->dmetric
[type
].value
);
6964 if (ospf_top
->dmetric
[type
].type
== EXTERNAL_METRIC_TYPE_1
)
6965 vty_out (vty
, " metric-type 1");
6967 if (ROUTEMAP_NAME (type
))
6968 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (type
));
6970 vty_out (vty
, "%s", VTY_NEWLINE
);
6977 config_write_ospf_default_metric (struct vty
*vty
)
6979 if (ospf_top
->default_metric
!= -1)
6980 vty_out (vty
, " default-metric %d%s", ospf_top
->default_metric
,
6986 config_write_ospf_distribute (struct vty
*vty
)
6992 /* distribute-list print. */
6993 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
6994 if (ospf_top
->dlist
[type
].name
)
6995 vty_out (vty
, " distribute-list %s out %s%s",
6996 ospf_top
->dlist
[type
].name
,
6997 distribute_str
[type
], VTY_NEWLINE
);
6999 /* default-information print. */
7000 if (ospf_top
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
7002 if (ospf_top
->default_originate
== DEFAULT_ORIGINATE_ZEBRA
)
7003 vty_out (vty
, " default-information originate");
7005 vty_out (vty
, " default-information originate always");
7007 if (ospf_top
->dmetric
[DEFAULT_ROUTE
].value
>= 0)
7008 vty_out (vty
, " metric %d",
7009 ospf_top
->dmetric
[DEFAULT_ROUTE
].value
);
7010 if (ospf_top
->dmetric
[DEFAULT_ROUTE
].type
== EXTERNAL_METRIC_TYPE_1
)
7011 vty_out (vty
, " metric-type 1");
7013 if (ROUTEMAP_NAME (DEFAULT_ROUTE
))
7014 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (DEFAULT_ROUTE
));
7016 vty_out (vty
, "%s", VTY_NEWLINE
);
7025 config_write_ospf_distance (struct vty
*vty
)
7027 struct route_node
*rn
;
7028 struct ospf_distance
*odistance
;
7030 if (ospf_top
->distance_all
)
7031 vty_out (vty
, " distance %d%s", ospf_top
->distance_all
, VTY_NEWLINE
);
7033 if (ospf_top
->distance_intra
7034 || ospf_top
->distance_inter
7035 || ospf_top
->distance_external
)
7037 vty_out (vty
, " distance ospf");
7039 if (ospf_top
->distance_intra
)
7040 vty_out (vty
, " intra-area %d", ospf_top
->distance_intra
);
7041 if (ospf_top
->distance_inter
)
7042 vty_out (vty
, " inter-area %d", ospf_top
->distance_inter
);
7043 if (ospf_top
->distance_external
)
7044 vty_out (vty
, " external %d", ospf_top
->distance_external
);
7046 vty_out (vty
, "%s", VTY_NEWLINE
);
7049 for (rn
= route_top (ospf_top
->distance_table
); rn
; rn
= route_next (rn
))
7050 if ((odistance
= rn
->info
) != NULL
)
7052 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
7053 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7054 odistance
->access_list
? odistance
->access_list
: "",
7060 /* OSPF configuration write function. */
7062 ospf_config_write (struct vty
*vty
)
7067 if (ospf_top
!= NULL
)
7069 /* `router ospf' print. */
7070 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
7074 if (!ospf_top
->networks
)
7077 /* Router ID print. */
7078 if (ospf_top
->router_id_static
.s_addr
!= 0)
7079 vty_out (vty
, " ospf router-id %s%s",
7080 inet_ntoa (ospf_top
->router_id_static
), VTY_NEWLINE
);
7082 /* ABR type print. */
7083 if (ospf_top
->abr_type
!= OSPF_ABR_STAND
)
7084 vty_out (vty
, " ospf abr-type %s%s",
7085 ospf_abr_type_str
[ospf_top
->abr_type
], VTY_NEWLINE
);
7087 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
7088 if (CHECK_FLAG (ospf_top
->config
, OSPF_RFC1583_COMPATIBLE
))
7089 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
7091 /* auto-cost reference-bandwidth configuration. */
7092 if (ospf_top
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
7093 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
7094 ospf_top
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
7096 /* SPF timers print. */
7097 if (ospf_top
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
7098 ospf_top
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
)
7099 vty_out (vty
, " timers spf %d %d%s",
7100 ospf_top
->spf_delay
, ospf_top
->spf_holdtime
, VTY_NEWLINE
);
7102 /* SPF refresh parameters print. */
7103 if (ospf_top
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
7104 vty_out (vty
, " refresh timer %d%s",
7105 ospf_top
->lsa_refresh_interval
, VTY_NEWLINE
);
7107 /* Redistribute information print. */
7108 config_write_ospf_redistribute (vty
);
7110 /* passive-interface print. */
7111 for (node
= listhead (ospf_top
->iflist
); node
; nextnode (node
))
7113 struct interface
*ifp
= getdata (node
);
7117 if (IF_DEF_PARAMS (ifp
)->passive_interface
== OSPF_IF_PASSIVE
)
7118 vty_out (vty
, " passive-interface %s%s",
7119 ifp
->name
, VTY_NEWLINE
);
7122 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
7124 struct ospf_interface
*oi
= getdata (node
);
7126 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
) &&
7127 oi
->params
->passive_interface
== OSPF_IF_PASSIVE
)
7128 vty_out (vty
, " passive-interface %s%s",
7129 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
7133 /* Network area print. */
7134 config_write_network_area (vty
);
7136 /* Area config print. */
7137 config_write_ospf_area (vty
);
7139 /* static neighbor print. */
7140 config_write_ospf_nbr_nbma (vty
);
7142 /* Virtual-Link print. */
7143 config_write_virtual_link (vty
);
7145 /* Default metric configuration. */
7146 config_write_ospf_default_metric (vty
);
7148 /* Distribute-list and default-information print. */
7149 config_write_ospf_distribute (vty
);
7151 /* Distance configuration. */
7152 config_write_ospf_distance (vty
);
7154 #ifdef HAVE_OPAQUE_LSA
7155 ospf_opaque_config_write_router (vty
, ospf_top
);
7156 #endif /* HAVE_OPAQUE_LSA */
7163 ospf_vty_show_init ()
7165 /* "show ip ospf" commands. */
7166 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
7167 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
7169 /* "show ip ospf database" commands. */
7170 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
7171 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
7172 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7173 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7174 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7175 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
7176 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
7177 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
7178 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
7179 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7180 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7181 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7182 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
7183 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
7185 /* "show ip ospf interface" commands. */
7186 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
7187 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
7189 /* "show ip ospf neighbor" commands. */
7190 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7191 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7192 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7193 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7194 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7195 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
7196 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7197 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7198 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7199 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7200 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7201 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7202 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
7203 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7205 /* "show ip ospf route" commands. */
7206 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
7207 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
7209 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
7210 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
7211 #endif /* HAVE_NSSA */
7215 /* ospfd's interface node. */
7216 struct cmd_node interface_node
=
7223 /* Initialization of OSPF interface. */
7227 /* Install interface node. */
7228 install_node (&interface_node
, config_write_interface
);
7230 install_element (CONFIG_NODE
, &interface_cmd
);
7231 install_default (INTERFACE_NODE
);
7233 /* "description" commands. */
7234 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
7235 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
7237 /* "ip ospf authentication" commands. */
7238 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
7239 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
7240 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
7241 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
7242 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
7243 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
7244 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
7245 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
7246 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
7247 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
7249 /* "ip ospf message-digest-key" commands. */
7250 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
7251 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
7252 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
7253 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
7255 /* "ip ospf cost" commands. */
7256 install_element (INTERFACE_NODE
, &ip_ospf_cost_addr_cmd
);
7257 install_element (INTERFACE_NODE
, &ip_ospf_cost_cmd
);
7258 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_addr_cmd
);
7259 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
7261 /* "ip ospf dead-interval" commands. */
7262 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
7263 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
7264 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
7265 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
7267 /* "ip ospf hello-interval" commands. */
7268 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
7269 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
7270 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
7271 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
7273 /* "ip ospf network" commands. */
7274 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
7275 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
7277 /* "ip ospf priority" commands. */
7278 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
7279 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
7280 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
7281 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
7283 /* "ip ospf retransmit-interval" commands. */
7284 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
7285 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
7286 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
7287 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
7289 /* "ip ospf transmit-delay" commands. */
7290 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
7291 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
7292 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
7293 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
7295 /* These commands are compatibitliy for previous version. */
7296 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
7297 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
7298 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
7299 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
7300 install_element (INTERFACE_NODE
, &ospf_cost_cmd
);
7301 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
7302 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
7303 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
7304 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
7305 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
7306 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
7307 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
7308 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
7309 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
7310 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
7311 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
7312 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
7313 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
7316 /* Zebra node structure. */
7317 struct cmd_node zebra_node
=
7320 "%s(config-router)#",
7324 ospf_vty_zebra_init ()
7326 install_element (OSPF_NODE
, &ospf_redistribute_source_type_metric_cmd
);
7327 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_type_cmd
);
7328 install_element (OSPF_NODE
, &ospf_redistribute_source_type_cmd
);
7329 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_cmd
);
7330 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
7331 install_element (OSPF_NODE
,
7332 &ospf_redistribute_source_metric_type_routemap_cmd
);
7333 install_element (OSPF_NODE
,
7334 &ospf_redistribute_source_type_metric_routemap_cmd
);
7335 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_routemap_cmd
);
7336 install_element (OSPF_NODE
, &ospf_redistribute_source_type_routemap_cmd
);
7337 install_element (OSPF_NODE
, &ospf_redistribute_source_routemap_cmd
);
7339 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
7341 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
7342 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
7344 install_element (OSPF_NODE
,
7345 &ospf_default_information_originate_metric_type_cmd
);
7346 install_element (OSPF_NODE
, &ospf_default_information_originate_metric_cmd
);
7347 install_element (OSPF_NODE
,
7348 &ospf_default_information_originate_type_metric_cmd
);
7349 install_element (OSPF_NODE
, &ospf_default_information_originate_type_cmd
);
7350 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
7351 install_element (OSPF_NODE
,
7352 &ospf_default_information_originate_always_metric_type_cmd
);
7353 install_element (OSPF_NODE
,
7354 &ospf_default_information_originate_always_metric_cmd
);
7355 install_element (OSPF_NODE
,
7356 &ospf_default_information_originate_always_cmd
);
7357 install_element (OSPF_NODE
,
7358 &ospf_default_information_originate_always_type_metric_cmd
);
7359 install_element (OSPF_NODE
,
7360 &ospf_default_information_originate_always_type_cmd
);
7362 install_element (OSPF_NODE
,
7363 &ospf_default_information_originate_metric_type_routemap_cmd
);
7364 install_element (OSPF_NODE
,
7365 &ospf_default_information_originate_metric_routemap_cmd
);
7366 install_element (OSPF_NODE
,
7367 &ospf_default_information_originate_routemap_cmd
);
7368 install_element (OSPF_NODE
,
7369 &ospf_default_information_originate_type_metric_routemap_cmd
);
7370 install_element (OSPF_NODE
,
7371 &ospf_default_information_originate_type_routemap_cmd
);
7372 install_element (OSPF_NODE
,
7373 &ospf_default_information_originate_always_metric_type_routemap_cmd
);
7374 install_element (OSPF_NODE
,
7375 &ospf_default_information_originate_always_metric_routemap_cmd
);
7376 install_element (OSPF_NODE
,
7377 &ospf_default_information_originate_always_routemap_cmd
);
7378 install_element (OSPF_NODE
,
7379 &ospf_default_information_originate_always_type_metric_routemap_cmd
);
7380 install_element (OSPF_NODE
,
7381 &ospf_default_information_originate_always_type_routemap_cmd
);
7383 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
7385 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
7386 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
7387 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
7389 install_element (OSPF_NODE
, &ospf_distance_cmd
);
7390 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
7391 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
7392 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_cmd
);
7393 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_cmd
);
7394 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_cmd
);
7395 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_external_cmd
);
7396 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_inter_cmd
);
7397 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_cmd
);
7398 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_cmd
);
7399 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_cmd
);
7400 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_external_cmd
);
7401 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_intra_cmd
);
7402 install_element (OSPF_NODE
, &ospf_distance_ospf_external_cmd
);
7403 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_cmd
);
7404 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_cmd
);
7405 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_inter_cmd
);
7406 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_intra_cmd
);
7408 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
7409 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
7410 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
7411 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
7415 struct cmd_node ospf_node
=
7418 "%s(config-router)# ",
7423 /* Install OSPF related vty commands. */
7427 /* Install ospf top node. */
7428 install_node (&ospf_node
, ospf_config_write
);
7430 /* "router ospf" commands. */
7431 install_element (CONFIG_NODE
, &router_ospf_cmd
);
7432 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
7434 install_default (OSPF_NODE
);
7436 /* "ospf router-id" commands. */
7437 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
7438 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
7439 install_element (OSPF_NODE
, &router_id_cmd
);
7440 install_element (OSPF_NODE
, &no_router_id_cmd
);
7442 /* "passive-interface" commands. */
7443 install_element (OSPF_NODE
, &passive_interface_addr_cmd
);
7444 install_element (OSPF_NODE
, &passive_interface_cmd
);
7445 install_element (OSPF_NODE
, &no_passive_interface_addr_cmd
);
7446 install_element (OSPF_NODE
, &no_passive_interface_cmd
);
7448 /* "ospf abr-type" commands. */
7449 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
7450 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
7452 /* "ospf rfc1583-compatible" commands. */
7453 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
7454 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
7455 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
7456 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
7458 /* "network area" commands. */
7459 install_element (OSPF_NODE
, &network_area_cmd
);
7460 install_element (OSPF_NODE
, &no_network_area_cmd
);
7462 /* "area authentication" commands. */
7463 install_element (OSPF_NODE
, &area_authentication_message_digest_cmd
);
7464 install_element (OSPF_NODE
, &area_authentication_cmd
);
7465 install_element (OSPF_NODE
, &no_area_authentication_cmd
);
7467 /* "area range" commands. */
7468 install_element (OSPF_NODE
, &area_range_cmd
);
7469 install_element (OSPF_NODE
, &area_range_advertise_cmd
);
7470 install_element (OSPF_NODE
, &area_range_cost_cmd
);
7471 install_element (OSPF_NODE
, &area_range_advertise_cost_cmd
);
7472 install_element (OSPF_NODE
, &area_range_not_advertise_cmd
);
7473 install_element (OSPF_NODE
, &no_area_range_cmd
);
7474 install_element (OSPF_NODE
, &no_area_range_advertise_cmd
);
7475 install_element (OSPF_NODE
, &no_area_range_cost_cmd
);
7476 install_element (OSPF_NODE
, &no_area_range_advertise_cost_cmd
);
7477 install_element (OSPF_NODE
, &area_range_substitute_cmd
);
7478 install_element (OSPF_NODE
, &no_area_range_substitute_cmd
);
7480 /* "area virtual-link" commands. */
7481 install_element (OSPF_NODE
, &area_vlink_cmd
);
7482 install_element (OSPF_NODE
, &no_area_vlink_cmd
);
7484 install_element (OSPF_NODE
, &area_vlink_param1_cmd
);
7485 install_element (OSPF_NODE
, &no_area_vlink_param1_cmd
);
7487 install_element (OSPF_NODE
, &area_vlink_param2_cmd
);
7488 install_element (OSPF_NODE
, &no_area_vlink_param2_cmd
);
7490 install_element (OSPF_NODE
, &area_vlink_param3_cmd
);
7491 install_element (OSPF_NODE
, &no_area_vlink_param3_cmd
);
7493 install_element (OSPF_NODE
, &area_vlink_param4_cmd
);
7494 install_element (OSPF_NODE
, &no_area_vlink_param4_cmd
);
7496 install_element (OSPF_NODE
, &area_vlink_authtype_args_cmd
);
7497 install_element (OSPF_NODE
, &area_vlink_authtype_cmd
);
7498 install_element (OSPF_NODE
, &no_area_vlink_authtype_cmd
);
7500 install_element (OSPF_NODE
, &area_vlink_md5_cmd
);
7501 install_element (OSPF_NODE
, &no_area_vlink_md5_cmd
);
7503 install_element (OSPF_NODE
, &area_vlink_authkey_cmd
);
7504 install_element (OSPF_NODE
, &no_area_vlink_authkey_cmd
);
7506 install_element (OSPF_NODE
, &area_vlink_authtype_args_authkey_cmd
);
7507 install_element (OSPF_NODE
, &area_vlink_authtype_authkey_cmd
);
7508 install_element (OSPF_NODE
, &no_area_vlink_authtype_authkey_cmd
);
7510 install_element (OSPF_NODE
, &area_vlink_authtype_args_md5_cmd
);
7511 install_element (OSPF_NODE
, &area_vlink_authtype_md5_cmd
);
7512 install_element (OSPF_NODE
, &no_area_vlink_authtype_md5_cmd
);
7514 /* "area stub" commands. */
7515 install_element (OSPF_NODE
, &area_stub_no_summary_cmd
);
7516 install_element (OSPF_NODE
, &area_stub_cmd
);
7517 install_element (OSPF_NODE
, &no_area_stub_no_summary_cmd
);
7518 install_element (OSPF_NODE
, &no_area_stub_cmd
);
7521 /* "area nssa" commands. */
7522 install_element (OSPF_NODE
, &area_nssa_cmd
);
7523 install_element (OSPF_NODE
, &area_nssa_translate_no_summary_cmd
);
7524 install_element (OSPF_NODE
, &area_nssa_translate_cmd
);
7525 install_element (OSPF_NODE
, &area_nssa_no_summary_cmd
);
7526 install_element (OSPF_NODE
, &no_area_nssa_cmd
);
7527 install_element (OSPF_NODE
, &no_area_nssa_no_summary_cmd
);
7528 #endif /* HAVE_NSSA */
7530 install_element (OSPF_NODE
, &area_default_cost_cmd
);
7531 install_element (OSPF_NODE
, &no_area_default_cost_cmd
);
7533 install_element (OSPF_NODE
, &area_shortcut_cmd
);
7534 install_element (OSPF_NODE
, &no_area_shortcut_cmd
);
7536 install_element (OSPF_NODE
, &area_export_list_cmd
);
7537 install_element (OSPF_NODE
, &no_area_export_list_cmd
);
7539 install_element (OSPF_NODE
, &area_filter_list_cmd
);
7540 install_element (OSPF_NODE
, &no_area_filter_list_cmd
);
7542 install_element (OSPF_NODE
, &area_import_list_cmd
);
7543 install_element (OSPF_NODE
, &no_area_import_list_cmd
);
7545 install_element (OSPF_NODE
, &timers_spf_cmd
);
7546 install_element (OSPF_NODE
, &no_timers_spf_cmd
);
7548 install_element (OSPF_NODE
, &refresh_timer_cmd
);
7549 install_element (OSPF_NODE
, &no_refresh_timer_val_cmd
);
7550 install_element (OSPF_NODE
, &no_refresh_timer_cmd
);
7552 install_element (OSPF_NODE
, &auto_cost_reference_bandwidth_cmd
);
7553 install_element (OSPF_NODE
, &no_auto_cost_reference_bandwidth_cmd
);
7555 /* "neighbor" commands. */
7556 install_element (OSPF_NODE
, &neighbor_cmd
);
7557 install_element (OSPF_NODE
, &neighbor_priority_poll_interval_cmd
);
7558 install_element (OSPF_NODE
, &neighbor_priority_cmd
);
7559 install_element (OSPF_NODE
, &neighbor_poll_interval_cmd
);
7560 install_element (OSPF_NODE
, &neighbor_poll_interval_priority_cmd
);
7561 install_element (OSPF_NODE
, &no_neighbor_cmd
);
7562 install_element (OSPF_NODE
, &no_neighbor_priority_cmd
);
7563 install_element (OSPF_NODE
, &no_neighbor_poll_interval_cmd
);
7565 /* Init interface related vty commands. */
7566 ospf_vty_if_init ();
7568 /* Init zebra related vty commands. */
7569 ospf_vty_zebra_init ();