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? */
2529 if (if_is_operative (ifp
)) {
2530 vty_out (vty
, "%s is up%s", ifp
->name
, VTY_NEWLINE
);
2533 vty_out (vty
, "%s is down%s", ifp
->name
, VTY_NEWLINE
);
2537 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2539 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
2544 /* Is interface OSPF enabled? */
2547 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2551 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
2553 struct ospf_interface
*oi
= rn
->info
;
2558 /* Show OSPF interface information. */
2559 vty_out (vty
, " Internet Address %s/%d,",
2560 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
2562 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
2565 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
2566 inet_ntoa (ospf_top
->router_id
), ospf_network_type_str
[oi
->type
],
2567 oi
->output_cost
, VTY_NEWLINE
);
2569 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
2570 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
2571 PRIORITY (oi
), VTY_NEWLINE
);
2573 /* Show DR information. */
2574 if (DR (oi
).s_addr
== 0)
2575 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2578 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &DR (oi
));
2580 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2583 vty_out (vty
, " Designated Router (ID) %s,",
2584 inet_ntoa (nbr
->router_id
));
2585 vty_out (vty
, " Interface Address %s%s",
2586 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2590 /* Show BDR information. */
2591 if (BDR (oi
).s_addr
== 0)
2592 vty_out (vty
, " No backup designated router on this network%s",
2596 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
2598 vty_out (vty
, " No backup designated router on this network%s",
2602 vty_out (vty
, " Backup Designated Router (ID) %s,",
2603 inet_ntoa (nbr
->router_id
));
2604 vty_out (vty
, " Interface Address %s%s",
2605 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2608 vty_out (vty
, " Timer intervals configured,");
2609 vty_out (vty
, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2610 OSPF_IF_PARAM (oi
, v_hello
), OSPF_IF_PARAM (oi
, v_wait
),
2611 OSPF_IF_PARAM (oi
, v_wait
),
2612 OSPF_IF_PARAM (oi
, retransmit_interval
),
2615 if (OSPF_IF_PARAM (oi
, passive_interface
) == OSPF_IF_ACTIVE
)
2616 vty_out (vty
, " Hello due in %s%s",
2617 ospf_timer_dump (oi
->t_hello
, buf
, 9), VTY_NEWLINE
);
2618 else /* OSPF_IF_PASSIVE is set */
2619 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
2621 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
2622 ospf_nbr_count (oi
->nbrs
, 0), ospf_nbr_count (oi
->nbrs
, NSM_Full
),
2627 DEFUN (show_ip_ospf_interface
,
2628 show_ip_ospf_interface_cmd
,
2629 "show ip ospf interface [INTERFACE]",
2632 "OSPF information\n"
2633 "Interface information\n"
2636 struct interface
*ifp
;
2639 /* Show All Interfaces. */
2641 for (node
= listhead (iflist
); node
; nextnode (node
))
2642 show_ip_ospf_interface_sub (vty
, node
->data
);
2643 /* Interface name is specified. */
2646 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
2647 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
2649 show_ip_ospf_interface_sub (vty
, ifp
);
2656 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
)
2658 struct route_node
*rn
;
2659 struct ospf_neighbor
*nbr
;
2663 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2664 if ((nbr
= rn
->info
))
2665 /* Do not show myself. */
2666 if (nbr
!= oi
->nbr_self
)
2667 /* Down state is not shown. */
2668 if (nbr
->state
!= NSM_Down
)
2670 ospf_nbr_state_message (nbr
, msgbuf
, 16);
2672 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2673 vty_out (vty
, "%-15s %3d %-15s %8s ",
2675 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2677 vty_out (vty
, "%-15s %3d %-15s %8s ",
2678 inet_ntoa (nbr
->router_id
), nbr
->priority
,
2679 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2680 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
2681 vty_out (vty
, "%-15s %5ld %5ld %5d%s",
2682 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
2683 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
2688 DEFUN (show_ip_ospf_neighbor
,
2689 show_ip_ospf_neighbor_cmd
,
2690 "show ip ospf neighbor",
2693 "OSPF information\n"
2700 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2704 /* Show All neighbors. */
2705 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2706 "Time Address Interface RXmtL "
2707 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2709 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2710 show_ip_ospf_neighbor_sub (vty
, getdata (node
));
2715 DEFUN (show_ip_ospf_neighbor_all
,
2716 show_ip_ospf_neighbor_all_cmd
,
2717 "show ip ospf neighbor all",
2720 "OSPF information\n"
2722 "include down status neighbor\n")
2728 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2732 /* Show All neighbors. */
2733 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2734 "Time Address Interface RXmtL "
2735 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2737 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2739 struct ospf_interface
*oi
= getdata (node
);
2742 show_ip_ospf_neighbor_sub (vty
, oi
);
2744 /* print Down neighbor status */
2745 for (nbr_node
= listhead (oi
->nbr_nbma
); nbr_node
; nextnode (nbr_node
))
2747 struct ospf_nbr_nbma
*nbr_nbma
;
2749 nbr_nbma
= getdata (nbr_node
);
2751 if (nbr_nbma
->nbr
== NULL
2752 || nbr_nbma
->nbr
->state
== NSM_Down
)
2754 vty_out (vty
, "%-15s %3d %-15s %8s ",
2755 "-", nbr_nbma
->priority
, "Down", "-");
2756 vty_out (vty
, "%-15s %-15s %5d %5d %5d%s",
2757 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
2758 0, 0, 0, VTY_NEWLINE
);
2766 DEFUN (show_ip_ospf_neighbor_int
,
2767 show_ip_ospf_neighbor_int_cmd
,
2768 "show ip ospf neighbor A.B.C.D",
2771 "OSPF information\n"
2775 struct ospf_interface
*oi
;
2776 struct in_addr addr
;
2781 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2785 ret
= inet_aton (argv
[0], &addr
);
2788 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
2793 if ((oi
= ospf_if_is_configured (&addr
)) == NULL
)
2794 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
2797 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2798 "Time Address Interface RXmtL "
2799 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2800 show_ip_ospf_neighbor_sub (vty
, oi
);
2807 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2808 struct ospf_nbr_nbma
*nbr_nbma
)
2812 /* Show neighbor ID. */
2813 vty_out (vty
, " Neighbor %s,", "-");
2815 /* Show interface address. */
2816 vty_out (vty
, " interface address %s%s",
2817 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
2819 vty_out (vty
, " In the area %s via interface %s%s",
2820 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
2821 /* Show neighbor priority and state. */
2822 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2823 nbr_nbma
->priority
, "Down");
2824 /* Show state changes. */
2825 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
2827 /* Show PollInterval */
2828 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
2830 /* Show poll-interval timer. */
2831 vty_out (vty
, " Poll timer due in %s%s",
2832 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, 9), VTY_NEWLINE
);
2834 /* Show poll-interval timer thread. */
2835 vty_out (vty
, " Thread Poll Timer %s%s",
2836 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
2840 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2841 struct ospf_neighbor
*nbr
)
2845 /* Show neighbor ID. */
2846 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2847 vty_out (vty
, " Neighbor %s,", "-");
2849 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
2851 /* Show interface address. */
2852 vty_out (vty
, " interface address %s%s",
2853 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2855 vty_out (vty
, " In the area %s via interface %s%s",
2856 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
2857 /* Show neighbor priority and state. */
2858 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2859 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
2860 /* Show state changes. */
2861 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
2863 /* Show Designated Rotuer ID. */
2864 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
2865 /* Show Backup Designated Rotuer ID. */
2866 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
2868 vty_out (vty
, " Options %d %s%s", nbr
->options
,
2869 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
2870 /* Show Router Dead interval timer. */
2871 vty_out (vty
, " Dead timer due in %s%s",
2872 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9), VTY_NEWLINE
);
2873 /* Show Database Summary list. */
2874 vty_out (vty
, " Database Summary List %d%s",
2875 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
2876 /* Show Link State Request list. */
2877 vty_out (vty
, " Link State Request List %ld%s",
2878 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
2879 /* Show Link State Retransmission list. */
2880 vty_out (vty
, " Link State Retransmission List %ld%s",
2881 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
2882 /* Show inactivity timer thread. */
2883 vty_out (vty
, " Thread Inactivity Timer %s%s",
2884 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
2885 /* Show Database Description retransmission thread. */
2886 vty_out (vty
, " Thread Database Description Retransmision %s%s",
2887 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
2888 /* Show Link State Request Retransmission thread. */
2889 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
2890 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
2891 /* Show Link State Update Retransmission thread. */
2892 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
2893 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
2896 DEFUN (show_ip_ospf_neighbor_id
,
2897 show_ip_ospf_neighbor_id_cmd
,
2898 "show ip ospf neighbor A.B.C.D",
2901 "OSPF information\n"
2906 struct ospf_neighbor
*nbr
;
2907 struct in_addr router_id
;
2910 ret
= inet_aton (argv
[0], &router_id
);
2913 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
2917 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2919 struct ospf_interface
*oi
= getdata (node
);
2921 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
2923 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2928 /* Nothing to show. */
2932 DEFUN (show_ip_ospf_neighbor_detail
,
2933 show_ip_ospf_neighbor_detail_cmd
,
2934 "show ip ospf neighbor detail",
2937 "OSPF information\n"
2939 "detail of all neighbors\n")
2946 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2948 struct ospf_interface
*oi
= getdata (node
);
2949 struct route_node
*rn
;
2950 struct ospf_neighbor
*nbr
;
2952 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2953 if ((nbr
= rn
->info
))
2954 if (nbr
!= oi
->nbr_self
)
2955 if (nbr
->state
!= NSM_Down
)
2956 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2962 DEFUN (show_ip_ospf_neighbor_detail_all
,
2963 show_ip_ospf_neighbor_detail_all_cmd
,
2964 "show ip ospf neighbor detail all",
2967 "OSPF information\n"
2969 "detail of all neighbors\n"
2970 "include down status neighbor\n")
2977 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
2979 struct ospf_interface
*oi
= getdata (node
);
2980 struct route_node
*rn
;
2981 struct ospf_neighbor
*nbr
;
2983 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2984 if ((nbr
= rn
->info
))
2985 if (nbr
!= oi
->nbr_self
)
2986 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
2987 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
);
2989 if (oi
->type
== OSPF_IFTYPE_NBMA
)
2993 for (nd
= listhead (oi
->nbr_nbma
); nd
; nextnode (nd
))
2995 struct ospf_nbr_nbma
*nbr_nbma
= getdata (nd
);
2996 if (nbr_nbma
->nbr
== NULL
2997 || nbr_nbma
->nbr
->state
== NSM_Down
)
2998 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
);
3006 DEFUN (show_ip_ospf_neighbor_int_detail
,
3007 show_ip_ospf_neighbor_int_detail_cmd
,
3008 "show ip ospf neighbor A.B.C.D detail",
3011 "OSPF information\n"
3013 "Interface address\n"
3014 "detail of all neighbors")
3016 struct ospf_interface
*oi
;
3017 struct in_addr addr
;
3020 ret
= inet_aton (argv
[0], &addr
);
3023 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3028 if ((oi
= ospf_if_is_configured (&addr
)) == NULL
)
3029 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
3032 struct route_node
*rn
;
3033 struct ospf_neighbor
*nbr
;
3035 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3036 if ((nbr
= rn
->info
))
3037 if (nbr
!= oi
->nbr_self
)
3038 if (nbr
->state
!= NSM_Down
)
3039 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3046 /* Show functions */
3048 show_lsa_summary (struct ospf_lsa
*lsa
, void *v
, int self
)
3050 struct vty
*vty
= (struct vty
*) v
;
3051 struct router_lsa
*rl
;
3052 struct summary_lsa
*sl
;
3053 struct as_external_lsa
*asel
;
3054 struct prefix_ipv4 p
;
3057 /* If self option is set, check LSA self flag. */
3058 if (self
== 0 || IS_LSA_SELF (lsa
))
3060 /* LSA common part show. */
3061 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
3062 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
3063 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
3064 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
3065 /* LSA specific part show. */
3066 switch (lsa
->data
->type
)
3068 case OSPF_ROUTER_LSA
:
3069 rl
= (struct router_lsa
*) lsa
->data
;
3070 vty_out (vty
, " %-d", ntohs (rl
->links
));
3072 case OSPF_SUMMARY_LSA
:
3073 sl
= (struct summary_lsa
*) lsa
->data
;
3076 p
.prefix
= sl
->header
.id
;
3077 p
.prefixlen
= ip_masklen (sl
->mask
);
3078 apply_mask_ipv4 (&p
);
3080 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
3082 case OSPF_AS_EXTERNAL_LSA
:
3083 asel
= (struct as_external_lsa
*) lsa
->data
;
3086 p
.prefix
= asel
->header
.id
;
3087 p
.prefixlen
= ip_masklen (asel
->mask
);
3088 apply_mask_ipv4 (&p
);
3090 vty_out (vty
, " %s %s/%d [0x%lx]",
3091 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
3092 inet_ntoa (p
.prefix
), p
.prefixlen
,
3093 (u_long
)ntohl (asel
->e
[0].route_tag
));
3095 case OSPF_NETWORK_LSA
:
3096 case OSPF_ASBR_SUMMARY_LSA
:
3097 #ifdef HAVE_OPAQUE_LSA
3098 case OSPF_OPAQUE_LINK_LSA
:
3099 case OSPF_OPAQUE_AREA_LSA
:
3100 case OSPF_OPAQUE_AS_LSA
:
3101 #endif /* HAVE_OPAQUE_LSA */
3105 vty_out (vty
, VTY_NEWLINE
);
3111 char *show_database_desc
[] =
3114 "Router Link States",
3116 "Summary Link States",
3117 "ASBR-Summary Link States",
3118 "AS External Link States",
3119 #if defined (HAVE_NSSA) || defined (HAVE_OPAQUE_LSA)
3120 "Group Membership LSA",
3121 "NSSA-external Link States",
3122 #endif /* HAVE_NSSA */
3123 #ifdef HAVE_OPAQUE_LSA
3125 "Link-Local Opaque-LSA",
3126 "Area-Local Opaque-LSA",
3127 "AS-external Opaque-LSA",
3128 #endif /* HAVE_OPAQUE_LSA */
3131 #define SHOW_OSPF_COMMON_HEADER \
3132 "Link ID ADV Router Age Seq# CkSum"
3134 char *show_database_header
[] =
3137 "Link ID ADV Router Age Seq# CkSum Link count",
3138 "Link ID ADV Router Age Seq# CkSum",
3139 "Link ID ADV Router Age Seq# CkSum Route",
3140 "Link ID ADV Router Age Seq# CkSum",
3141 "Link ID ADV Router Age Seq# CkSum Route",
3143 " --- header for Group Member ----",
3144 "Link ID ADV Router Age Seq# CkSum Route",
3145 #endif /* HAVE_NSSA */
3146 #ifdef HAVE_OPAQUE_LSA
3150 #endif /* HAVE_NSSA */
3152 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3153 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3154 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3155 #endif /* HAVE_OPAQUE_LSA */
3159 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
3161 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
3163 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
3164 vty_out (vty
, " Options: %d%s", lsa
->data
->options
, VTY_NEWLINE
);
3166 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
3168 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
3171 vty_out (vty
, " :%s%s%s%s",
3172 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
3173 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
3174 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
3175 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
3177 vty_out (vty
, "%s", VTY_NEWLINE
);
3179 vty_out (vty
, " LS Type: %s%s",
3180 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3181 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
3182 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3183 vty_out (vty
, " Advertising Router: %s%s",
3184 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3185 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
3187 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
3189 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
3192 char *link_type_desc
[] =
3195 "another Router (point-to-point)",
3196 "a Transit Network",
3201 char *link_id_desc
[] =
3204 "Neighboring Router ID",
3205 "Designated Router address",
3206 "Network/subnet number",
3207 "Neighboring Router ID",
3210 char *link_data_desc
[] =
3213 "Router Interface address",
3214 "Router Interface address",
3216 "Router Interface address",
3219 /* Show router-LSA each Link information. */
3221 show_ip_ospf_database_router_links (struct vty
*vty
,
3222 struct router_lsa
*rl
)
3226 len
= ntohs (rl
->header
.length
) - 4;
3227 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
3229 type
= rl
->link
[i
].type
;
3231 vty_out (vty
, " Link connected to: %s%s",
3232 link_type_desc
[type
], VTY_NEWLINE
);
3233 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
3234 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
3235 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
3236 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
3237 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
3238 vty_out (vty
, " TOS 0 Metric: %d%s",
3239 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
3240 vty_out (vty
, "%s", VTY_NEWLINE
);
3244 /* Show router-LSA detail information. */
3246 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3250 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
3252 show_ip_ospf_database_header (vty
, lsa
);
3254 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
3255 VTY_NEWLINE
, VTY_NEWLINE
);
3257 show_ip_ospf_database_router_links (vty
, rl
);
3263 /* Show network-LSA detail information. */
3265 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3271 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
3273 show_ip_ospf_database_header (vty
, lsa
);
3275 vty_out (vty
, " Network Mask: /%d%s",
3276 ip_masklen (nl
->mask
), VTY_NEWLINE
);
3278 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
3280 for (i
= 0; length
> 0; i
++, length
-= 4)
3281 vty_out (vty
, " Attached Router: %s%s",
3282 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
3284 vty_out (vty
, "%s", VTY_NEWLINE
);
3290 /* Show summary-LSA detail information. */
3292 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3296 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3298 show_ip_ospf_database_header (vty
, lsa
);
3300 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
3302 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3309 /* Show summary-ASBR-LSA detail information. */
3311 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3315 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3317 show_ip_ospf_database_header (vty
, lsa
);
3319 vty_out (vty
, " Network Mask: /%d%s",
3320 ip_masklen (sl
->mask
), VTY_NEWLINE
);
3321 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3328 /* Show AS-external-LSA detail information. */
3330 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3334 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3336 show_ip_ospf_database_header (vty
, lsa
);
3338 vty_out (vty
, " Network Mask: /%d%s",
3339 ip_masklen (al
->mask
), VTY_NEWLINE
);
3340 vty_out (vty
, " Metric Type: %s%s",
3341 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3342 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3343 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3344 vty_out (vty
, " Metric: %d%s",
3345 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3346 vty_out (vty
, " Forward Address: %s%s",
3347 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3349 vty_out (vty
, " External Route Tag: %lu%s%s",
3350 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3358 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
3360 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3362 /* show_ip_ospf_database_header (vty, lsa); */
3364 zlog_info( " Network Mask: /%d%s",
3365 ip_masklen (al
->mask
), "\n");
3366 zlog_info( " Metric Type: %s%s",
3367 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3368 "2 (Larger than any link state path)" : "1", "\n");
3369 zlog_info( " TOS: 0%s", "\n");
3370 zlog_info( " Metric: %d%s",
3371 GET_METRIC (al
->e
[0].metric
), "\n");
3372 zlog_info( " Forward Address: %s%s",
3373 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
3375 zlog_info( " External Route Tag: %u%s%s",
3376 ntohl (al
->e
[0].route_tag
), "\n", "\n");
3381 /* Show AS-NSSA-LSA detail information. */
3383 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3387 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3389 show_ip_ospf_database_header (vty
, lsa
);
3391 vty_out (vty
, " Network Mask: /%d%s",
3392 ip_masklen (al
->mask
), VTY_NEWLINE
);
3393 vty_out (vty
, " Metric Type: %s%s",
3394 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3395 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3396 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3397 vty_out (vty
, " Metric: %d%s",
3398 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3399 vty_out (vty
, " NSSA: Forward Address: %s%s",
3400 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3402 vty_out (vty
, " External Route Tag: %u%s%s",
3403 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3409 #endif /* HAVE_NSSA */
3412 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
3417 #ifdef HAVE_OPAQUE_LSA
3419 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3423 show_ip_ospf_database_header (vty
, lsa
);
3424 show_opaque_info_detail (vty
, lsa
);
3426 vty_out (vty
, "%s", VTY_NEWLINE
);
3430 #endif /* HAVE_OPAQUE_LSA */
3432 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
3435 show_router_lsa_detail
,
3436 show_network_lsa_detail
,
3437 show_summary_lsa_detail
,
3438 show_summary_asbr_lsa_detail
,
3439 show_as_external_lsa_detail
,
3442 show_as_nssa_lsa_detail
, /* almost same as external */
3443 #endif /* HAVE_NSSA */
3444 #ifdef HAVE_OPAQUE_LSA
3448 #endif /* HAVE_NSSA */
3450 show_opaque_lsa_detail
,
3451 show_opaque_lsa_detail
,
3452 show_opaque_lsa_detail
,
3453 #endif /* HAVE_OPAQUE_LSA */
3457 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
3458 struct in_addr
*adv_router
)
3460 memset (lp
, 0, sizeof (struct prefix_ls
));
3464 else if (adv_router
== NULL
)
3473 lp
->adv_router
= *adv_router
;
3478 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
3479 struct in_addr
*id
, struct in_addr
*adv_router
)
3481 struct prefix_ls lp
;
3482 struct route_node
*rn
, *start
;
3483 struct ospf_lsa
*lsa
;
3485 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
3486 start
= route_node_get (rt
, (struct prefix
*) &lp
);
3489 route_lock_node (start
);
3490 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
3491 if ((lsa
= rn
->info
))
3494 /* Stay away from any Local Translated Type-7 LSAs */
3495 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3497 #endif /* HAVE_NSSA */
3499 if (show_function
[lsa
->data
->type
] != NULL
)
3500 show_function
[lsa
->data
->type
] (vty
, lsa
);
3502 route_unlock_node (start
);
3506 /* Show detail LSA information
3507 -- if id is NULL then show all LSAs. */
3509 show_lsa_detail (struct vty
*vty
, int type
,
3510 struct in_addr
*id
, struct in_addr
*adv_router
)
3516 case OSPF_AS_EXTERNAL_LSA
:
3517 #ifdef HAVE_OPAQUE_LSA
3518 case OSPF_OPAQUE_AS_LSA
:
3519 #endif /* HAVE_OPAQUE_LSA */
3520 vty_out (vty
, " %s %s%s",
3521 show_database_desc
[type
],
3522 VTY_NEWLINE
, VTY_NEWLINE
);
3523 show_lsa_detail_proc (vty
, AS_LSDB (ospf_top
, type
), id
, adv_router
);
3526 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
3528 struct ospf_area
*area
= node
->data
;
3529 vty_out (vty
, "%s %s (Area %s)%s%s",
3530 VTY_NEWLINE
, show_database_desc
[type
],
3531 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3532 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
3539 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
3540 struct in_addr
*adv_router
)
3542 struct route_node
*rn
;
3543 struct ospf_lsa
*lsa
;
3545 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
3546 if ((lsa
= rn
->info
))
3547 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
3550 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3552 #endif /* HAVE_NSSA */
3553 if (show_function
[lsa
->data
->type
] != NULL
)
3554 show_function
[lsa
->data
->type
] (vty
, lsa
);
3558 /* Show detail LSA information. */
3560 show_lsa_detail_adv_router (struct vty
*vty
, int type
,
3561 struct in_addr
*adv_router
)
3567 case OSPF_AS_EXTERNAL_LSA
:
3568 #ifdef HAVE_OPAQUE_LSA
3569 case OSPF_OPAQUE_AS_LSA
:
3570 #endif /* HAVE_OPAQUE_LSA */
3571 vty_out (vty
, " %s %s%s",
3572 show_database_desc
[type
],
3573 VTY_NEWLINE
, VTY_NEWLINE
);
3574 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf_top
, type
),
3578 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
3580 struct ospf_area
*area
= node
->data
;
3581 vty_out (vty
, "%s %s (Area %s)%s%s",
3582 VTY_NEWLINE
, show_database_desc
[type
],
3583 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3584 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
3592 show_ip_ospf_database_summary (struct vty
*vty
, int self
)
3597 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
3599 struct ospf_area
*area
= node
->data
;
3600 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3604 case OSPF_AS_EXTERNAL_LSA
:
3605 #ifdef HAVE_OPAQUE_LSA
3606 case OSPF_OPAQUE_AS_LSA
:
3607 #endif /* HAVE_OPAQUE_LSA */
3612 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
3613 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
3615 vty_out (vty
, " %s (Area %s)%s%s",
3616 show_database_desc
[type
],
3617 ospf_area_desc_string (area
),
3618 VTY_NEWLINE
, VTY_NEWLINE
);
3619 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
3621 foreach_lsa (AREA_LSDB (area
, type
), vty
, self
, show_lsa_summary
);
3623 vty_out (vty
, "%s", VTY_NEWLINE
);
3628 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3632 case OSPF_AS_EXTERNAL_LSA
:
3633 #ifdef HAVE_OPAQUE_LSA
3634 case OSPF_OPAQUE_AS_LSA
:
3635 #endif /* HAVE_OPAQUE_LSA */
3640 if (ospf_lsdb_count_self (ospf_top
->lsdb
, type
) ||
3641 (!self
&& ospf_lsdb_count (ospf_top
->lsdb
, type
)))
3643 vty_out (vty
, " %s%s%s",
3644 show_database_desc
[type
],
3645 VTY_NEWLINE
, VTY_NEWLINE
);
3646 vty_out (vty
, "%s%s", show_database_header
[type
],
3648 foreach_lsa (AS_LSDB (ospf_top
, type
), vty
, self
, show_lsa_summary
);
3649 vty_out (vty
, "%s", VTY_NEWLINE
);
3653 vty_out (vty
, "%s", VTY_NEWLINE
);
3657 show_ip_ospf_database_maxage (struct vty
*vty
)
3660 struct ospf_lsa
*lsa
;
3662 vty_out (vty
, "%s MaxAge Link States:%s%s",
3663 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
3665 for (node
= listhead (ospf_top
->maxage_lsa
); node
; nextnode (node
))
3666 if ((lsa
= node
->data
) != NULL
)
3668 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
3669 vty_out (vty
, "Link State ID: %s%s",
3670 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
3671 vty_out (vty
, "Advertising Router: %s%s",
3672 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3673 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
3674 vty_out (vty
, "%s", VTY_NEWLINE
);
3679 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3680 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3681 #else /* HAVE_NSSA */
3682 #define OSPF_LSA_TYPE_NSSA_DESC ""
3683 #define OSPF_LSA_TYPE_NSSA_CMD_STR ""
3684 #endif /* HAVE_NSSA */
3686 #ifdef HAVE_OPAQUE_LSA
3687 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3688 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3689 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3690 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3691 #else /* HAVE_OPAQUE_LSA */
3692 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3693 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3694 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3695 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3696 #endif /* HAVE_OPAQUE_LSA */
3698 #define OSPF_LSA_TYPES_CMD_STR \
3699 "asbr-summary|external|network|router|summary" \
3700 OSPF_LSA_TYPE_NSSA_CMD_STR \
3701 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3703 #define OSPF_LSA_TYPES_DESC \
3704 "ASBR summary link states\n" \
3705 "External link states\n" \
3706 "Network link states\n" \
3707 "Router link states\n" \
3708 "Network summary link states\n" \
3709 OSPF_LSA_TYPE_NSSA_DESC \
3710 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3711 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3712 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3714 DEFUN (show_ip_ospf_database
,
3715 show_ip_ospf_database_cmd
,
3716 "show ip ospf database",
3719 "OSPF information\n"
3720 "Database summary\n")
3723 struct in_addr id
, adv_router
;
3725 if (ospf_top
== NULL
)
3728 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3729 inet_ntoa (ospf_top
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3734 show_ip_ospf_database_summary (vty
, 0);
3738 /* Set database type to show. */
3739 if (strncmp (argv
[0], "r", 1) == 0)
3740 type
= OSPF_ROUTER_LSA
;
3741 else if (strncmp (argv
[0], "ne", 2) == 0)
3742 type
= OSPF_NETWORK_LSA
;
3744 else if (strncmp (argv
[0], "ns", 2) == 0)
3745 type
= OSPF_AS_NSSA_LSA
;
3746 #endif /* HAVE_NSSA */
3747 else if (strncmp (argv
[0], "su", 2) == 0)
3748 type
= OSPF_SUMMARY_LSA
;
3749 else if (strncmp (argv
[0], "a", 1) == 0)
3750 type
= OSPF_ASBR_SUMMARY_LSA
;
3751 else if (strncmp (argv
[0], "e", 1) == 0)
3752 type
= OSPF_AS_EXTERNAL_LSA
;
3753 else if (strncmp (argv
[0], "se", 2) == 0)
3755 show_ip_ospf_database_summary (vty
, 1);
3758 else if (strncmp (argv
[0], "m", 1) == 0)
3760 show_ip_ospf_database_maxage (vty
);
3763 #ifdef HAVE_OPAQUE_LSA
3764 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3765 type
= OSPF_OPAQUE_LINK_LSA
;
3766 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3767 type
= OSPF_OPAQUE_AREA_LSA
;
3768 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3769 type
= OSPF_OPAQUE_AS_LSA
;
3770 #endif /* HAVE_OPAQUE_LSA */
3774 /* `show ip ospf database LSA'. */
3776 show_lsa_detail (vty
, type
, NULL
, NULL
);
3779 ret
= inet_aton (argv
[1], &id
);
3783 /* `show ip ospf database LSA ID'. */
3785 show_lsa_detail (vty
, type
, &id
, NULL
);
3786 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3789 if (strncmp (argv
[2], "s", 1) == 0)
3790 adv_router
= ospf_top
->router_id
;
3793 ret
= inet_aton (argv
[2], &adv_router
);
3797 show_lsa_detail (vty
, type
, &id
, &adv_router
);
3804 ALIAS (show_ip_ospf_database
,
3805 show_ip_ospf_database_type_cmd
,
3806 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
3809 "OSPF information\n"
3810 "Database summary\n"
3812 "LSAs in MaxAge list\n"
3813 "Self-originated link states\n")
3815 ALIAS (show_ip_ospf_database
,
3816 show_ip_ospf_database_type_id_cmd
,
3817 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
3820 "OSPF information\n"
3821 "Database summary\n"
3823 "Link State ID (as an IP address)\n")
3825 ALIAS (show_ip_ospf_database
,
3826 show_ip_ospf_database_type_id_adv_router_cmd
,
3827 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
3830 "OSPF information\n"
3831 "Database summary\n"
3833 "Link State ID (as an IP address)\n"
3834 "Advertising Router link states\n"
3835 "Advertising Router (as an IP address)\n")
3837 ALIAS (show_ip_ospf_database
,
3838 show_ip_ospf_database_type_id_self_cmd
,
3839 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
3842 "OSPF information\n"
3843 "Database summary\n"
3845 "Link State ID (as an IP address)\n"
3846 "Self-originated link states\n"
3849 DEFUN (show_ip_ospf_database_type_adv_router
,
3850 show_ip_ospf_database_type_adv_router_cmd
,
3851 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
3854 "OSPF information\n"
3855 "Database summary\n"
3857 "Advertising Router link states\n"
3858 "Advertising Router (as an IP address)\n")
3861 struct in_addr adv_router
;
3863 if (ospf_top
== NULL
)
3866 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3867 inet_ntoa (ospf_top
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3872 /* Set database type to show. */
3873 if (strncmp (argv
[0], "r", 1) == 0)
3874 type
= OSPF_ROUTER_LSA
;
3875 else if (strncmp (argv
[0], "ne", 2) == 0)
3876 type
= OSPF_NETWORK_LSA
;
3878 else if (strncmp (argv
[0], "ns", 2) == 0)
3879 type
= OSPF_AS_NSSA_LSA
;
3880 #endif /* HAVE_NSSA */
3881 else if (strncmp (argv
[0], "s", 1) == 0)
3882 type
= OSPF_SUMMARY_LSA
;
3883 else if (strncmp (argv
[0], "a", 1) == 0)
3884 type
= OSPF_ASBR_SUMMARY_LSA
;
3885 else if (strncmp (argv
[0], "e", 1) == 0)
3886 type
= OSPF_AS_EXTERNAL_LSA
;
3887 #ifdef HAVE_OPAQUE_LSA
3888 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3889 type
= OSPF_OPAQUE_LINK_LSA
;
3890 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3891 type
= OSPF_OPAQUE_AREA_LSA
;
3892 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3893 type
= OSPF_OPAQUE_AS_LSA
;
3894 #endif /* HAVE_OPAQUE_LSA */
3898 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3899 if (strncmp (argv
[1], "s", 1) == 0)
3900 adv_router
= ospf_top
->router_id
;
3903 ret
= inet_aton (argv
[1], &adv_router
);
3908 show_lsa_detail_adv_router (vty
, type
, &adv_router
);
3913 ALIAS (show_ip_ospf_database_type_adv_router
,
3914 show_ip_ospf_database_type_self_cmd
,
3915 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
3918 "OSPF information\n"
3919 "Database summary\n"
3921 "Self-originated link states\n")
3924 DEFUN (ip_ospf_authentication_args
,
3925 ip_ospf_authentication_args_addr_cmd
,
3926 "ip ospf authentication (null|message-digest) A.B.C.D",
3928 "OSPF interface commands\n"
3929 "Enable authentication on this interface\n"
3930 "Use null authentication\n"
3931 "Use message-digest authentication\n"
3932 "Address of interface")
3934 struct interface
*ifp
;
3935 struct in_addr addr
;
3937 struct ospf_if_params
*params
;
3940 params
= IF_DEF_PARAMS (ifp
);
3944 ret
= inet_aton(argv
[1], &addr
);
3947 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3952 params
= ospf_get_if_params (ifp
, addr
);
3953 ospf_if_update_params (ifp
, addr
);
3956 /* Handle null authentication */
3957 if ( argv
[0][0] == 'n' )
3959 SET_IF_PARAM (params
, auth_type
);
3960 params
->auth_type
= OSPF_AUTH_NULL
;
3964 /* Handle message-digest authentication */
3965 if ( argv
[0][0] == 'm' )
3967 SET_IF_PARAM (params
, auth_type
);
3968 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
3972 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
3976 ALIAS (ip_ospf_authentication_args
,
3977 ip_ospf_authentication_args_cmd
,
3978 "ip ospf authentication (null|message-digest)",
3980 "OSPF interface commands\n"
3981 "Enable authentication on this interface\n"
3982 "Use null authentication\n"
3983 "Use message-digest authentication\n")
3985 DEFUN (ip_ospf_authentication
,
3986 ip_ospf_authentication_addr_cmd
,
3987 "ip ospf authentication A.B.C.D",
3989 "OSPF interface commands\n"
3990 "Enable authentication on this interface\n"
3991 "Address of interface")
3993 struct interface
*ifp
;
3994 struct in_addr addr
;
3996 struct ospf_if_params
*params
;
3999 params
= IF_DEF_PARAMS (ifp
);
4003 ret
= inet_aton(argv
[1], &addr
);
4006 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4011 params
= ospf_get_if_params (ifp
, addr
);
4012 ospf_if_update_params (ifp
, addr
);
4015 SET_IF_PARAM (params
, auth_type
);
4016 params
->auth_type
= OSPF_AUTH_SIMPLE
;
4021 ALIAS (ip_ospf_authentication
,
4022 ip_ospf_authentication_cmd
,
4023 "ip ospf authentication",
4025 "OSPF interface commands\n"
4026 "Enable authentication on this interface\n")
4028 DEFUN (no_ip_ospf_authentication
,
4029 no_ip_ospf_authentication_addr_cmd
,
4030 "no ip ospf authentication A.B.C.D",
4033 "OSPF interface commands\n"
4034 "Enable authentication on this interface\n"
4035 "Address of interface")
4037 struct interface
*ifp
;
4038 struct in_addr addr
;
4040 struct ospf_if_params
*params
;
4043 params
= IF_DEF_PARAMS (ifp
);
4047 ret
= inet_aton(argv
[1], &addr
);
4050 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4055 params
= ospf_lookup_if_params (ifp
, addr
);
4060 params
->auth_type
= OSPF_AUTH_NOTSET
;
4061 UNSET_IF_PARAM (params
, auth_type
);
4063 if (params
!= IF_DEF_PARAMS (ifp
))
4065 ospf_free_if_params (ifp
, addr
);
4066 ospf_if_update_params (ifp
, addr
);
4072 ALIAS (no_ip_ospf_authentication
,
4073 no_ip_ospf_authentication_cmd
,
4074 "no ip ospf authentication",
4077 "OSPF interface commands\n"
4078 "Enable authentication on this interface\n")
4080 DEFUN (ip_ospf_authentication_key
,
4081 ip_ospf_authentication_key_addr_cmd
,
4082 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4084 "OSPF interface commands\n"
4085 "Authentication password (key)\n"
4086 "The OSPF password (key)\n"
4087 "Address of interface")
4089 struct interface
*ifp
;
4090 struct in_addr addr
;
4092 struct ospf_if_params
*params
;
4095 params
= IF_DEF_PARAMS (ifp
);
4099 ret
= inet_aton(argv
[1], &addr
);
4102 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4107 params
= ospf_get_if_params (ifp
, addr
);
4108 ospf_if_update_params (ifp
, addr
);
4112 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
4113 strncpy (params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
4114 SET_IF_PARAM (params
, auth_simple
);
4119 ALIAS (ip_ospf_authentication_key
,
4120 ip_ospf_authentication_key_cmd
,
4121 "ip ospf authentication-key AUTH_KEY",
4123 "OSPF interface commands\n"
4124 "Authentication password (key)\n"
4125 "The OSPF password (key)")
4127 ALIAS (ip_ospf_authentication_key
,
4128 ospf_authentication_key_cmd
,
4129 "ospf authentication-key AUTH_KEY",
4130 "OSPF interface commands\n"
4131 "Authentication password (key)\n"
4132 "The OSPF password (key)")
4134 DEFUN (no_ip_ospf_authentication_key
,
4135 no_ip_ospf_authentication_key_addr_cmd
,
4136 "no ip ospf authentication-key A.B.C.D",
4139 "OSPF interface commands\n"
4140 "Authentication password (key)\n"
4141 "Address of interface")
4143 struct interface
*ifp
;
4144 struct in_addr addr
;
4146 struct ospf_if_params
*params
;
4149 params
= IF_DEF_PARAMS (ifp
);
4153 ret
= inet_aton(argv
[1], &addr
);
4156 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4161 params
= ospf_lookup_if_params (ifp
, addr
);
4166 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
4167 UNSET_IF_PARAM (params
, auth_simple
);
4169 if (params
!= IF_DEF_PARAMS (ifp
))
4171 ospf_free_if_params (ifp
, addr
);
4172 ospf_if_update_params (ifp
, addr
);
4178 ALIAS (no_ip_ospf_authentication_key
,
4179 no_ip_ospf_authentication_key_cmd
,
4180 "no ip ospf authentication-key",
4183 "OSPF interface commands\n"
4184 "Authentication password (key)\n")
4186 ALIAS (no_ip_ospf_authentication_key
,
4187 no_ospf_authentication_key_cmd
,
4188 "no ospf authentication-key",
4190 "OSPF interface commands\n"
4191 "Authentication password (key)\n")
4193 DEFUN (ip_ospf_message_digest_key
,
4194 ip_ospf_message_digest_key_addr_cmd
,
4195 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4197 "OSPF interface commands\n"
4198 "Message digest authentication password (key)\n"
4200 "Use MD5 algorithm\n"
4201 "The OSPF password (key)"
4202 "Address of interface")
4204 struct interface
*ifp
;
4205 struct crypt_key
*ck
;
4207 struct in_addr addr
;
4209 struct ospf_if_params
*params
;
4212 params
= IF_DEF_PARAMS (ifp
);
4216 ret
= inet_aton(argv
[2], &addr
);
4219 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4224 params
= ospf_get_if_params (ifp
, addr
);
4225 ospf_if_update_params (ifp
, addr
);
4228 key_id
= strtol (argv
[0], NULL
, 10);
4229 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
4231 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
4235 ck
= ospf_crypt_key_new ();
4236 ck
->key_id
= (u_char
) key_id
;
4237 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
4238 strncpy (ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
4240 ospf_crypt_key_add (params
->auth_crypt
, ck
);
4241 SET_IF_PARAM (params
, auth_crypt
);
4246 ALIAS (ip_ospf_message_digest_key
,
4247 ip_ospf_message_digest_key_cmd
,
4248 "ip ospf message-digest-key <1-255> md5 KEY",
4250 "OSPF interface commands\n"
4251 "Message digest authentication password (key)\n"
4253 "Use MD5 algorithm\n"
4254 "The OSPF password (key)")
4256 ALIAS (ip_ospf_message_digest_key
,
4257 ospf_message_digest_key_cmd
,
4258 "ospf message-digest-key <1-255> md5 KEY",
4259 "OSPF interface commands\n"
4260 "Message digest authentication password (key)\n"
4262 "Use MD5 algorithm\n"
4263 "The OSPF password (key)")
4265 DEFUN (no_ip_ospf_message_digest_key
,
4266 no_ip_ospf_message_digest_key_addr_cmd
,
4267 "no ip ospf message-digest-key <1-255> A.B.C.D",
4270 "OSPF interface commands\n"
4271 "Message digest authentication password (key)\n"
4273 "Address of interface")
4275 struct interface
*ifp
;
4276 struct crypt_key
*ck
;
4278 struct in_addr addr
;
4280 struct ospf_if_params
*params
;
4283 params
= IF_DEF_PARAMS (ifp
);
4287 ret
= inet_aton(argv
[1], &addr
);
4290 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4295 params
= ospf_lookup_if_params (ifp
, addr
);
4300 key_id
= strtol (argv
[0], NULL
, 10);
4301 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
4304 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
4308 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
4310 if (params
!= IF_DEF_PARAMS (ifp
))
4312 ospf_free_if_params (ifp
, addr
);
4313 ospf_if_update_params (ifp
, addr
);
4319 ALIAS (no_ip_ospf_message_digest_key
,
4320 no_ip_ospf_message_digest_key_cmd
,
4321 "no ip ospf message-digest-key <1-255>",
4324 "OSPF interface commands\n"
4325 "Message digest authentication password (key)\n"
4328 ALIAS (no_ip_ospf_message_digest_key
,
4329 no_ospf_message_digest_key_cmd
,
4330 "no ospf message-digest-key <1-255>",
4332 "OSPF interface commands\n"
4333 "Message digest authentication password (key)\n"
4336 DEFUN (ip_ospf_cost
,
4337 ip_ospf_cost_addr_cmd
,
4338 "ip ospf cost <1-65535> A.B.C.D",
4340 "OSPF interface commands\n"
4343 "Address of interface")
4345 struct interface
*ifp
= vty
->index
;
4347 struct in_addr addr
;
4349 struct ospf_if_params
*params
;
4351 params
= IF_DEF_PARAMS (ifp
);
4353 cost
= strtol (argv
[0], NULL
, 10);
4355 /* cost range is <1-65535>. */
4356 if (cost
< 1 || cost
> 65535)
4358 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4364 ret
= inet_aton(argv
[1], &addr
);
4367 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4372 params
= ospf_get_if_params (ifp
, addr
);
4373 ospf_if_update_params (ifp
, addr
);
4376 SET_IF_PARAM (params
, output_cost_cmd
);
4377 params
->output_cost_cmd
= cost
;
4379 ospf_if_recalculate_output_cost (ifp
);
4384 ALIAS (ip_ospf_cost
,
4386 "ip ospf cost <1-65535>",
4388 "OSPF interface commands\n"
4392 ALIAS (ip_ospf_cost
,
4394 "ospf cost <1-65535>",
4395 "OSPF interface commands\n"
4399 DEFUN (no_ip_ospf_cost
,
4400 no_ip_ospf_cost_addr_cmd
,
4401 "no ip ospf cost A.B.C.D",
4404 "OSPF interface commands\n"
4406 "Address of interface")
4408 struct interface
*ifp
= vty
->index
;
4409 struct in_addr addr
;
4411 struct ospf_if_params
*params
;
4414 params
= IF_DEF_PARAMS (ifp
);
4418 ret
= inet_aton(argv
[0], &addr
);
4421 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4426 params
= ospf_lookup_if_params (ifp
, addr
);
4431 UNSET_IF_PARAM (params
, output_cost_cmd
);
4433 if (params
!= IF_DEF_PARAMS (ifp
))
4435 ospf_free_if_params (ifp
, addr
);
4436 ospf_if_update_params (ifp
, addr
);
4439 ospf_if_recalculate_output_cost (ifp
);
4444 ALIAS (no_ip_ospf_cost
,
4445 no_ip_ospf_cost_cmd
,
4449 "OSPF interface commands\n"
4452 ALIAS (no_ip_ospf_cost
,
4456 "OSPF interface commands\n"
4460 ospf_nbr_timer_update (struct ospf_interface
*oi
)
4462 struct route_node
*rn
;
4463 struct ospf_neighbor
*nbr
;
4465 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4466 if ((nbr
= rn
->info
))
4468 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
4469 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4470 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4471 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4475 DEFUN (ip_ospf_dead_interval
,
4476 ip_ospf_dead_interval_addr_cmd
,
4477 "ip ospf dead-interval <1-65535> A.B.C.D",
4479 "OSPF interface commands\n"
4480 "Interval after which a neighbor is declared dead\n"
4482 "Address of interface")
4484 struct interface
*ifp
= vty
->index
;
4486 struct in_addr addr
;
4488 struct ospf_if_params
*params
;
4489 struct ospf_interface
*oi
;
4490 struct route_node
*rn
;
4492 params
= IF_DEF_PARAMS (ifp
);
4494 seconds
= strtol (argv
[0], NULL
, 10);
4496 /* dead_interval range is <1-65535>. */
4497 if (seconds
< 1 || seconds
> 65535)
4499 vty_out (vty
, "Router Dead Interval is invalid%s", VTY_NEWLINE
);
4505 ret
= inet_aton(argv
[1], &addr
);
4508 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4513 params
= ospf_get_if_params (ifp
, addr
);
4514 ospf_if_update_params (ifp
, addr
);
4517 SET_IF_PARAM (params
, v_wait
);
4518 params
->v_wait
= seconds
;
4520 /* Update timer values in neighbor structure. */
4523 oi
= ospf_if_lookup_by_local_addr (ifp
, addr
);
4525 ospf_nbr_timer_update (oi
);
4529 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4530 if ((oi
= rn
->info
))
4531 ospf_nbr_timer_update (oi
);
4537 ALIAS (ip_ospf_dead_interval
,
4538 ip_ospf_dead_interval_cmd
,
4539 "ip ospf dead-interval <1-65535>",
4541 "OSPF interface commands\n"
4542 "Interval after which a neighbor is declared dead\n"
4545 ALIAS (ip_ospf_dead_interval
,
4546 ospf_dead_interval_cmd
,
4547 "ospf dead-interval <1-65535>",
4548 "OSPF interface commands\n"
4549 "Interval after which a neighbor is declared dead\n"
4552 DEFUN (no_ip_ospf_dead_interval
,
4553 no_ip_ospf_dead_interval_addr_cmd
,
4554 "no ip ospf dead-interval A.B.C.D",
4557 "OSPF interface commands\n"
4558 "Interval after which a neighbor is declared dead\n"
4559 "Address of interface")
4561 struct interface
*ifp
= vty
->index
;
4562 struct in_addr addr
;
4564 struct ospf_if_params
*params
;
4565 struct ospf_interface
*oi
;
4566 struct route_node
*rn
;
4569 params
= IF_DEF_PARAMS (ifp
);
4573 ret
= inet_aton(argv
[0], &addr
);
4576 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4581 params
= ospf_lookup_if_params (ifp
, addr
);
4586 UNSET_IF_PARAM (params
, v_wait
);
4587 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4589 if (params
!= IF_DEF_PARAMS (ifp
))
4591 ospf_free_if_params (ifp
, addr
);
4592 ospf_if_update_params (ifp
, addr
);
4595 /* Update timer values in neighbor structure. */
4598 oi
= ospf_if_lookup_by_local_addr (ifp
, addr
);
4600 ospf_nbr_timer_update (oi
);
4604 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4605 if ((oi
= rn
->info
))
4606 ospf_nbr_timer_update (oi
);
4612 ALIAS (no_ip_ospf_dead_interval
,
4613 no_ip_ospf_dead_interval_cmd
,
4614 "no ip ospf dead-interval",
4617 "OSPF interface commands\n"
4618 "Interval after which a neighbor is declared dead\n")
4620 ALIAS (no_ip_ospf_dead_interval
,
4621 no_ospf_dead_interval_cmd
,
4622 "no ospf dead-interval",
4624 "OSPF interface commands\n"
4625 "Interval after which a neighbor is declared dead\n")
4627 DEFUN (ip_ospf_hello_interval
,
4628 ip_ospf_hello_interval_addr_cmd
,
4629 "ip ospf hello-interval <1-65535> A.B.C.D",
4631 "OSPF interface commands\n"
4632 "Time between HELLO packets\n"
4634 "Address of interface")
4636 struct interface
*ifp
= vty
->index
;
4638 struct in_addr addr
;
4640 struct ospf_if_params
*params
;
4642 params
= IF_DEF_PARAMS (ifp
);
4644 seconds
= strtol (argv
[0], NULL
, 10);
4646 /* HelloInterval range is <1-65535>. */
4647 if (seconds
< 1 || seconds
> 65535)
4649 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
4655 ret
= inet_aton(argv
[1], &addr
);
4658 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4663 params
= ospf_get_if_params (ifp
, addr
);
4664 ospf_if_update_params (ifp
, addr
);
4667 SET_IF_PARAM (params
, v_hello
);
4668 params
->v_hello
= seconds
;
4673 ALIAS (ip_ospf_hello_interval
,
4674 ip_ospf_hello_interval_cmd
,
4675 "ip ospf hello-interval <1-65535>",
4677 "OSPF interface commands\n"
4678 "Time between HELLO packets\n"
4681 ALIAS (ip_ospf_hello_interval
,
4682 ospf_hello_interval_cmd
,
4683 "ospf hello-interval <1-65535>",
4684 "OSPF interface commands\n"
4685 "Time between HELLO packets\n"
4688 DEFUN (no_ip_ospf_hello_interval
,
4689 no_ip_ospf_hello_interval_addr_cmd
,
4690 "no ip ospf hello-interval A.B.C.D",
4693 "OSPF interface commands\n"
4694 "Time between HELLO packets\n"
4695 "Address of interface")
4697 struct interface
*ifp
= vty
->index
;
4698 struct in_addr addr
;
4700 struct ospf_if_params
*params
;
4703 params
= IF_DEF_PARAMS (ifp
);
4707 ret
= inet_aton(argv
[0], &addr
);
4710 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4715 params
= ospf_lookup_if_params (ifp
, addr
);
4720 UNSET_IF_PARAM (params
, v_hello
);
4721 params
->v_hello
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4723 if (params
!= IF_DEF_PARAMS (ifp
))
4725 ospf_free_if_params (ifp
, addr
);
4726 ospf_if_update_params (ifp
, addr
);
4732 ALIAS (no_ip_ospf_hello_interval
,
4733 no_ip_ospf_hello_interval_cmd
,
4734 "no ip ospf hello-interval",
4737 "OSPF interface commands\n"
4738 "Time between HELLO packets\n")
4740 ALIAS (no_ip_ospf_hello_interval
,
4741 no_ospf_hello_interval_cmd
,
4742 "no ospf hello-interval",
4744 "OSPF interface commands\n"
4745 "Time between HELLO packets\n")
4747 DEFUN (ip_ospf_network
,
4748 ip_ospf_network_cmd
,
4749 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4751 "OSPF interface commands\n"
4753 "Specify OSPF broadcast multi-access network\n"
4754 "Specify OSPF NBMA network\n"
4755 "Specify OSPF point-to-multipoint network\n"
4756 "Specify OSPF point-to-point network\n")
4758 struct interface
*ifp
= vty
->index
;
4759 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4760 struct route_node
*rn
;
4762 if (strncmp (argv
[0], "b", 1) == 0)
4763 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4764 else if (strncmp (argv
[0], "n", 1) == 0)
4765 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
4766 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
4767 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
4768 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
4769 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
4771 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4774 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
4776 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4778 struct ospf_interface
*oi
= rn
->info
;
4783 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4785 if (oi
->state
> ISM_Down
)
4787 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4788 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4795 ALIAS (ip_ospf_network
,
4797 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4798 "OSPF interface commands\n"
4800 "Specify OSPF broadcast multi-access network\n"
4801 "Specify OSPF NBMA network\n"
4802 "Specify OSPF point-to-multipoint network\n"
4803 "Specify OSPF point-to-point network\n")
4805 DEFUN (no_ip_ospf_network
,
4806 no_ip_ospf_network_cmd
,
4807 "no ip ospf network",
4810 "OSPF interface commands\n"
4813 struct interface
*ifp
= vty
->index
;
4814 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4815 struct route_node
*rn
;
4817 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4819 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4822 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4824 struct ospf_interface
*oi
= rn
->info
;
4829 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4831 if (oi
->state
> ISM_Down
)
4833 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4834 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4841 ALIAS (no_ip_ospf_network
,
4842 no_ospf_network_cmd
,
4845 "OSPF interface commands\n"
4848 DEFUN (ip_ospf_priority
,
4849 ip_ospf_priority_addr_cmd
,
4850 "ip ospf priority <0-255> A.B.C.D",
4852 "OSPF interface commands\n"
4855 "Address of interface")
4857 struct interface
*ifp
= vty
->index
;
4859 struct route_node
*rn
;
4860 struct in_addr addr
;
4862 struct ospf_if_params
*params
;
4864 params
= IF_DEF_PARAMS (ifp
);
4866 priority
= strtol (argv
[0], NULL
, 10);
4868 /* Router Priority range is <0-255>. */
4869 if (priority
< 0 || priority
> 255)
4871 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
4877 ret
= inet_aton(argv
[1], &addr
);
4880 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4885 params
= ospf_get_if_params (ifp
, addr
);
4886 ospf_if_update_params (ifp
, addr
);
4889 SET_IF_PARAM (params
, priority
);
4890 params
->priority
= priority
;
4892 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4894 struct ospf_interface
*oi
= rn
->info
;
4900 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
4902 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
4903 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
4910 ALIAS (ip_ospf_priority
,
4911 ip_ospf_priority_cmd
,
4912 "ip ospf priority <0-255>",
4914 "OSPF interface commands\n"
4918 ALIAS (ip_ospf_priority
,
4920 "ospf priority <0-255>",
4921 "OSPF interface commands\n"
4925 DEFUN (no_ip_ospf_priority
,
4926 no_ip_ospf_priority_addr_cmd
,
4927 "no ip ospf priority A.B.C.D",
4930 "OSPF interface commands\n"
4932 "Address of interface")
4934 struct interface
*ifp
= vty
->index
;
4935 struct route_node
*rn
;
4936 struct in_addr addr
;
4938 struct ospf_if_params
*params
;
4941 params
= IF_DEF_PARAMS (ifp
);
4945 ret
= inet_aton(argv
[0], &addr
);
4948 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4953 params
= ospf_lookup_if_params (ifp
, addr
);
4958 UNSET_IF_PARAM (params
, priority
);
4959 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
4961 if (params
!= IF_DEF_PARAMS (ifp
))
4963 ospf_free_if_params (ifp
, addr
);
4964 ospf_if_update_params (ifp
, addr
);
4967 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4969 struct ospf_interface
*oi
= rn
->info
;
4975 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
4977 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
4978 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
4985 ALIAS (no_ip_ospf_priority
,
4986 no_ip_ospf_priority_cmd
,
4987 "no ip ospf priority",
4990 "OSPF interface commands\n"
4991 "Router priority\n")
4993 ALIAS (no_ip_ospf_priority
,
4994 no_ospf_priority_cmd
,
4997 "OSPF interface commands\n"
4998 "Router priority\n")
5000 DEFUN (ip_ospf_retransmit_interval
,
5001 ip_ospf_retransmit_interval_addr_cmd
,
5002 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5004 "OSPF interface commands\n"
5005 "Time between retransmitting lost link state advertisements\n"
5007 "Address of interface")
5009 struct interface
*ifp
= vty
->index
;
5011 struct in_addr addr
;
5013 struct ospf_if_params
*params
;
5015 params
= IF_DEF_PARAMS (ifp
);
5016 seconds
= strtol (argv
[0], NULL
, 10);
5018 /* Retransmit Interval range is <3-65535>. */
5019 if (seconds
< 3 || seconds
> 65535)
5021 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
5028 ret
= inet_aton(argv
[1], &addr
);
5031 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5036 params
= ospf_get_if_params (ifp
, addr
);
5037 ospf_if_update_params (ifp
, addr
);
5040 SET_IF_PARAM (params
, retransmit_interval
);
5041 params
->retransmit_interval
= seconds
;
5046 ALIAS (ip_ospf_retransmit_interval
,
5047 ip_ospf_retransmit_interval_cmd
,
5048 "ip ospf retransmit-interval <3-65535>",
5050 "OSPF interface commands\n"
5051 "Time between retransmitting lost link state advertisements\n"
5054 ALIAS (ip_ospf_retransmit_interval
,
5055 ospf_retransmit_interval_cmd
,
5056 "ospf retransmit-interval <3-65535>",
5057 "OSPF interface commands\n"
5058 "Time between retransmitting lost link state advertisements\n"
5061 DEFUN (no_ip_ospf_retransmit_interval
,
5062 no_ip_ospf_retransmit_interval_addr_cmd
,
5063 "no ip ospf retransmit-interval A.B.C.D",
5066 "OSPF interface commands\n"
5067 "Time between retransmitting lost link state advertisements\n"
5068 "Address of interface")
5070 struct interface
*ifp
= vty
->index
;
5071 struct in_addr addr
;
5073 struct ospf_if_params
*params
;
5076 params
= IF_DEF_PARAMS (ifp
);
5080 ret
= inet_aton(argv
[0], &addr
);
5083 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5088 params
= ospf_lookup_if_params (ifp
, addr
);
5093 UNSET_IF_PARAM (params
, retransmit_interval
);
5094 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
5096 if (params
!= IF_DEF_PARAMS (ifp
))
5098 ospf_free_if_params (ifp
, addr
);
5099 ospf_if_update_params (ifp
, addr
);
5105 ALIAS (no_ip_ospf_retransmit_interval
,
5106 no_ip_ospf_retransmit_interval_cmd
,
5107 "no ip ospf retransmit-interval",
5110 "OSPF interface commands\n"
5111 "Time between retransmitting lost link state advertisements\n")
5113 ALIAS (no_ip_ospf_retransmit_interval
,
5114 no_ospf_retransmit_interval_cmd
,
5115 "no ospf retransmit-interval",
5117 "OSPF interface commands\n"
5118 "Time between retransmitting lost link state advertisements\n")
5120 DEFUN (ip_ospf_transmit_delay
,
5121 ip_ospf_transmit_delay_addr_cmd
,
5122 "ip ospf transmit-delay <1-65535> A.B.C.D",
5124 "OSPF interface commands\n"
5125 "Link state transmit delay\n"
5127 "Address of interface")
5129 struct interface
*ifp
= vty
->index
;
5131 struct in_addr addr
;
5133 struct ospf_if_params
*params
;
5135 params
= IF_DEF_PARAMS (ifp
);
5136 seconds
= strtol (argv
[0], NULL
, 10);
5138 /* Transmit Delay range is <1-65535>. */
5139 if (seconds
< 1 || seconds
> 65535)
5141 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
5147 ret
= inet_aton(argv
[1], &addr
);
5150 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5155 params
= ospf_get_if_params (ifp
, addr
);
5156 ospf_if_update_params (ifp
, addr
);
5159 SET_IF_PARAM (params
, transmit_delay
);
5160 params
->transmit_delay
= seconds
;
5165 ALIAS (ip_ospf_transmit_delay
,
5166 ip_ospf_transmit_delay_cmd
,
5167 "ip ospf transmit-delay <1-65535>",
5169 "OSPF interface commands\n"
5170 "Link state transmit delay\n"
5173 ALIAS (ip_ospf_transmit_delay
,
5174 ospf_transmit_delay_cmd
,
5175 "ospf transmit-delay <1-65535>",
5176 "OSPF interface commands\n"
5177 "Link state transmit delay\n"
5180 DEFUN (no_ip_ospf_transmit_delay
,
5181 no_ip_ospf_transmit_delay_addr_cmd
,
5182 "no ip ospf transmit-delay A.B.C.D",
5185 "OSPF interface commands\n"
5186 "Link state transmit delay\n"
5187 "Address of interface")
5189 struct interface
*ifp
= vty
->index
;
5190 struct in_addr addr
;
5192 struct ospf_if_params
*params
;
5195 params
= IF_DEF_PARAMS (ifp
);
5199 ret
= inet_aton(argv
[0], &addr
);
5202 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5207 params
= ospf_lookup_if_params (ifp
, addr
);
5212 UNSET_IF_PARAM (params
, transmit_delay
);
5213 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
5215 if (params
!= IF_DEF_PARAMS (ifp
))
5217 ospf_free_if_params (ifp
, addr
);
5218 ospf_if_update_params (ifp
, addr
);
5224 ALIAS (no_ip_ospf_transmit_delay
,
5225 no_ip_ospf_transmit_delay_cmd
,
5226 "no ip ospf transmit-delay",
5229 "OSPF interface commands\n"
5230 "Link state transmit delay\n")
5232 ALIAS (no_ip_ospf_transmit_delay
,
5233 no_ospf_transmit_delay_cmd
,
5234 "no ospf transmit-delay",
5236 "OSPF interface commands\n"
5237 "Link state transmit delay\n")
5240 DEFUN (ospf_redistribute_source_metric_type
,
5241 ospf_redistribute_source_metric_type_routemap_cmd
,
5242 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5243 "Redistribute information from another routing protocol\n"
5247 "Routing Information Protocol (RIP)\n"
5248 "Border Gateway Protocol (BGP)\n"
5249 "Metric for redistributed routes\n"
5250 "OSPF default metric\n"
5251 "OSPF exterior metric type for redistributed routes\n"
5252 "Set OSPF External Type 1 metrics\n"
5253 "Set OSPF External Type 2 metrics\n"
5254 "Route map reference\n"
5255 "Pointer to route-map entries\n")
5261 /* Get distribute source. */
5262 if (!str2distribute_source (argv
[0], &source
))
5265 /* Get metric value. */
5267 if (!str2metric (argv
[1], &metric
))
5270 /* Get metric type. */
5272 if (!str2metric_type (argv
[2], &type
))
5276 ospf_routemap_set (source
, argv
[3]);
5278 ospf_routemap_unset (source
);
5280 return ospf_redistribute_set (source
, type
, metric
);
5283 ALIAS (ospf_redistribute_source_metric_type
,
5284 ospf_redistribute_source_metric_type_cmd
,
5285 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5286 "Redistribute information from another routing protocol\n"
5290 "Routing Information Protocol (RIP)\n"
5291 "Border Gateway Protocol (BGP)\n"
5292 "Metric for redistributed routes\n"
5293 "OSPF default metric\n"
5294 "OSPF exterior metric type for redistributed routes\n"
5295 "Set OSPF External Type 1 metrics\n"
5296 "Set OSPF External Type 2 metrics\n")
5298 ALIAS (ospf_redistribute_source_metric_type
,
5299 ospf_redistribute_source_metric_cmd
,
5300 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5301 "Redistribute information from another routing protocol\n"
5305 "Routing Information Protocol (RIP)\n"
5306 "Border Gateway Protocol (BGP)\n"
5307 "Metric for redistributed routes\n"
5308 "OSPF default metric\n")
5310 DEFUN (ospf_redistribute_source_type_metric
,
5311 ospf_redistribute_source_type_metric_routemap_cmd
,
5312 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5313 "Redistribute information from another routing protocol\n"
5317 "Routing Information Protocol (RIP)\n"
5318 "Border Gateway Protocol (BGP)\n"
5319 "OSPF exterior metric type for redistributed routes\n"
5320 "Set OSPF External Type 1 metrics\n"
5321 "Set OSPF External Type 2 metrics\n"
5322 "Metric for redistributed routes\n"
5323 "OSPF default metric\n"
5324 "Route map reference\n"
5325 "Pointer to route-map entries\n")
5331 /* Get distribute source. */
5332 if (!str2distribute_source (argv
[0], &source
))
5335 /* Get metric value. */
5337 if (!str2metric_type (argv
[1], &type
))
5340 /* Get metric type. */
5342 if (!str2metric (argv
[2], &metric
))
5346 ospf_routemap_set (source
, argv
[3]);
5348 ospf_routemap_unset (source
);
5350 return ospf_redistribute_set (source
, type
, metric
);
5353 ALIAS (ospf_redistribute_source_type_metric
,
5354 ospf_redistribute_source_type_metric_cmd
,
5355 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5356 "Redistribute information from another routing protocol\n"
5360 "Routing Information Protocol (RIP)\n"
5361 "Border Gateway Protocol (BGP)\n"
5362 "OSPF exterior metric type for redistributed routes\n"
5363 "Set OSPF External Type 1 metrics\n"
5364 "Set OSPF External Type 2 metrics\n"
5365 "Metric for redistributed routes\n"
5366 "OSPF default metric\n")
5368 ALIAS (ospf_redistribute_source_type_metric
,
5369 ospf_redistribute_source_type_cmd
,
5370 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5371 "Redistribute information from another routing protocol\n"
5375 "Routing Information Protocol (RIP)\n"
5376 "Border Gateway Protocol (BGP)\n"
5377 "OSPF exterior metric type for redistributed routes\n"
5378 "Set OSPF External Type 1 metrics\n"
5379 "Set OSPF External Type 2 metrics\n")
5381 ALIAS (ospf_redistribute_source_type_metric
,
5382 ospf_redistribute_source_cmd
,
5383 "redistribute (kernel|connected|static|rip|bgp)",
5384 "Redistribute information from another routing protocol\n"
5388 "Routing Information Protocol (RIP)\n"
5389 "Border Gateway Protocol (BGP)\n")
5391 DEFUN (ospf_redistribute_source_metric_routemap
,
5392 ospf_redistribute_source_metric_routemap_cmd
,
5393 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5394 "Redistribute information from another routing protocol\n"
5398 "Routing Information Protocol (RIP)\n"
5399 "Border Gateway Protocol (BGP)\n"
5400 "Metric for redistributed routes\n"
5401 "OSPF default metric\n"
5402 "Route map reference\n"
5403 "Pointer to route-map entries\n")
5408 /* Get distribute source. */
5409 if (!str2distribute_source (argv
[0], &source
))
5412 /* Get metric value. */
5414 if (!str2metric (argv
[1], &metric
))
5418 ospf_routemap_set (source
, argv
[2]);
5420 ospf_routemap_unset (source
);
5422 return ospf_redistribute_set (source
, -1, metric
);
5425 DEFUN (ospf_redistribute_source_type_routemap
,
5426 ospf_redistribute_source_type_routemap_cmd
,
5427 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5428 "Redistribute information from another routing protocol\n"
5432 "Routing Information Protocol (RIP)\n"
5433 "Border Gateway Protocol (BGP)\n"
5434 "OSPF exterior metric type for redistributed routes\n"
5435 "Set OSPF External Type 1 metrics\n"
5436 "Set OSPF External Type 2 metrics\n"
5437 "Route map reference\n"
5438 "Pointer to route-map entries\n")
5443 /* Get distribute source. */
5444 if (!str2distribute_source (argv
[0], &source
))
5447 /* Get metric value. */
5449 if (!str2metric_type (argv
[1], &type
))
5453 ospf_routemap_set (source
, argv
[2]);
5455 ospf_routemap_unset (source
);
5457 return ospf_redistribute_set (source
, type
, -1);
5460 DEFUN (ospf_redistribute_source_routemap
,
5461 ospf_redistribute_source_routemap_cmd
,
5462 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5463 "Redistribute information from another routing protocol\n"
5467 "Routing Information Protocol (RIP)\n"
5468 "Border Gateway Protocol (BGP)\n"
5469 "Route map reference\n"
5470 "Pointer to route-map entries\n")
5474 /* Get distribute source. */
5475 if (!str2distribute_source (argv
[0], &source
))
5479 ospf_routemap_set (source
, argv
[1]);
5481 ospf_routemap_unset (source
);
5483 return ospf_redistribute_set (source
, -1, -1);
5486 DEFUN (no_ospf_redistribute_source
,
5487 no_ospf_redistribute_source_cmd
,
5488 "no redistribute (kernel|connected|static|rip|bgp)",
5490 "Redistribute information from another routing protocol\n"
5494 "Routing Information Protocol (RIP)\n"
5495 "Border Gateway Protocol (BGP)\n")
5499 if (!str2distribute_source (argv
[0], &source
))
5502 ospf_routemap_unset (source
);
5503 return ospf_redistribute_unset (source
);
5506 DEFUN (ospf_distribute_list_out
,
5507 ospf_distribute_list_out_cmd
,
5508 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5509 "Filter networks in routing updates\n"
5510 "Access-list name\n"
5515 "Routing Information Protocol (RIP)\n"
5516 "Border Gateway Protocol (BGP)\n")
5520 /* Get distribute source. */
5521 if (!str2distribute_source (argv
[1], &source
))
5524 return ospf_distribute_list_out_set (source
, argv
[0]);
5527 DEFUN (no_ospf_distribute_list_out
,
5528 no_ospf_distribute_list_out_cmd
,
5529 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5531 "Filter networks in routing updates\n"
5532 "Access-list name\n"
5537 "Routing Information Protocol (RIP)\n"
5538 "Border Gateway Protocol (BGP)\n")
5542 if (!str2distribute_source (argv
[1], &source
))
5545 return ospf_distribute_list_out_unset (source
, argv
[0]);
5548 /* Default information originate. */
5549 DEFUN (ospf_default_information_originate_metric_type_routemap
,
5550 ospf_default_information_originate_metric_type_routemap_cmd
,
5551 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5552 "Control distribution of default information\n"
5553 "Distribute a default route\n"
5554 "OSPF default metric\n"
5556 "OSPF metric type for default routes\n"
5557 "Set OSPF External Type 1 metrics\n"
5558 "Set OSPF External Type 2 metrics\n"
5559 "Route map reference\n"
5560 "Pointer to route-map entries\n")
5565 /* Get metric value. */
5567 if (!str2metric (argv
[0], &metric
))
5570 /* Get metric type. */
5572 if (!str2metric_type (argv
[1], &type
))
5576 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5578 ospf_routemap_unset (DEFAULT_ROUTE
);
5580 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, type
, metric
);
5583 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5584 ospf_default_information_originate_metric_type_cmd
,
5585 "default-information originate metric <0-16777214> metric-type (1|2)",
5586 "Control distribution of default information\n"
5587 "Distribute a default route\n"
5588 "OSPF default metric\n"
5590 "OSPF metric type for default routes\n"
5591 "Set OSPF External Type 1 metrics\n"
5592 "Set OSPF External Type 2 metrics\n")
5594 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5595 ospf_default_information_originate_metric_cmd
,
5596 "default-information originate metric <0-16777214>",
5597 "Control distribution of default information\n"
5598 "Distribute a default route\n"
5599 "OSPF default metric\n"
5602 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5603 ospf_default_information_originate_cmd
,
5604 "default-information originate",
5605 "Control distribution of default information\n"
5606 "Distribute a default route\n")
5608 /* Default information originate. */
5609 DEFUN (ospf_default_information_originate_metric_routemap
,
5610 ospf_default_information_originate_metric_routemap_cmd
,
5611 "default-information originate metric <0-16777214> route-map WORD",
5612 "Control distribution of default information\n"
5613 "Distribute a default route\n"
5614 "OSPF default metric\n"
5616 "Route map reference\n"
5617 "Pointer to route-map entries\n")
5621 /* Get metric value. */
5623 if (!str2metric (argv
[0], &metric
))
5627 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5629 ospf_routemap_unset (DEFAULT_ROUTE
);
5631 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, -1, metric
);
5634 /* Default information originate. */
5635 DEFUN (ospf_default_information_originate_routemap
,
5636 ospf_default_information_originate_routemap_cmd
,
5637 "default-information originate route-map WORD",
5638 "Control distribution of default information\n"
5639 "Distribute a default route\n"
5640 "Route map reference\n"
5641 "Pointer to route-map entries\n")
5644 ospf_routemap_set (DEFAULT_ROUTE
, argv
[0]);
5646 ospf_routemap_unset (DEFAULT_ROUTE
);
5648 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, -1, -1);
5651 DEFUN (ospf_default_information_originate_type_metric_routemap
,
5652 ospf_default_information_originate_type_metric_routemap_cmd
,
5653 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
5654 "Control distribution of default information\n"
5655 "Distribute a default route\n"
5656 "OSPF metric type for default routes\n"
5657 "Set OSPF External Type 1 metrics\n"
5658 "Set OSPF External Type 2 metrics\n"
5659 "OSPF default metric\n"
5661 "Route map reference\n"
5662 "Pointer to route-map entries\n")
5667 /* Get metric type. */
5669 if (!str2metric_type (argv
[0], &type
))
5672 /* Get metric value. */
5674 if (!str2metric (argv
[1], &metric
))
5678 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5680 ospf_routemap_unset (DEFAULT_ROUTE
);
5682 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, type
, metric
);
5685 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5686 ospf_default_information_originate_type_metric_cmd
,
5687 "default-information originate metric-type (1|2) metric <0-16777214>",
5688 "Control distribution of default information\n"
5689 "Distribute a default route\n"
5690 "OSPF metric type for default routes\n"
5691 "Set OSPF External Type 1 metrics\n"
5692 "Set OSPF External Type 2 metrics\n"
5693 "OSPF default metric\n"
5696 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5697 ospf_default_information_originate_type_cmd
,
5698 "default-information originate metric-type (1|2)",
5699 "Control distribution of default information\n"
5700 "Distribute a default route\n"
5701 "OSPF metric type for default routes\n"
5702 "Set OSPF External Type 1 metrics\n"
5703 "Set OSPF External Type 2 metrics\n")
5705 DEFUN (ospf_default_information_originate_type_routemap
,
5706 ospf_default_information_originate_type_routemap_cmd
,
5707 "default-information originate metric-type (1|2) route-map WORD",
5708 "Control distribution of default information\n"
5709 "Distribute a default route\n"
5710 "OSPF metric type for default routes\n"
5711 "Set OSPF External Type 1 metrics\n"
5712 "Set OSPF External Type 2 metrics\n"
5713 "Route map reference\n"
5714 "Pointer to route-map entries\n")
5718 /* Get metric type. */
5720 if (!str2metric_type (argv
[0], &type
))
5724 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5726 ospf_routemap_unset (DEFAULT_ROUTE
);
5728 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA
, type
, -1);
5731 DEFUN (ospf_default_information_originate_always_metric_type_routemap
,
5732 ospf_default_information_originate_always_metric_type_routemap_cmd
,
5733 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5734 "Control distribution of default information\n"
5735 "Distribute a default route\n"
5736 "Always advertise default route\n"
5737 "OSPF default metric\n"
5739 "OSPF metric type for default routes\n"
5740 "Set OSPF External Type 1 metrics\n"
5741 "Set OSPF External Type 2 metrics\n"
5742 "Route map reference\n"
5743 "Pointer to route-map entries\n")
5748 /* Get metric value. */
5750 if (!str2metric (argv
[0], &metric
))
5753 /* Get metric type. */
5755 if (!str2metric_type (argv
[1], &type
))
5759 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5761 ospf_routemap_unset (DEFAULT_ROUTE
);
5763 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
,
5767 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5768 ospf_default_information_originate_always_metric_type_cmd
,
5769 "default-information originate always metric <0-16777214> metric-type (1|2)",
5770 "Control distribution of default information\n"
5771 "Distribute a default route\n"
5772 "Always advertise default route\n"
5773 "OSPF default metric\n"
5775 "OSPF metric type for default routes\n"
5776 "Set OSPF External Type 1 metrics\n"
5777 "Set OSPF External Type 2 metrics\n")
5779 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5780 ospf_default_information_originate_always_metric_cmd
,
5781 "default-information originate always metric <0-16777214>",
5782 "Control distribution of default information\n"
5783 "Distribute a default route\n"
5784 "Always advertise default route\n"
5785 "OSPF default metric\n"
5787 "OSPF metric type for default routes\n")
5789 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5790 ospf_default_information_originate_always_cmd
,
5791 "default-information originate always",
5792 "Control distribution of default information\n"
5793 "Distribute a default route\n"
5794 "Always advertise default route\n")
5796 DEFUN (ospf_default_information_originate_always_metric_routemap
,
5797 ospf_default_information_originate_always_metric_routemap_cmd
,
5798 "default-information originate always metric <0-16777214> route-map WORD",
5799 "Control distribution of default information\n"
5800 "Distribute a default route\n"
5801 "Always advertise default route\n"
5802 "OSPF default metric\n"
5804 "Route map reference\n"
5805 "Pointer to route-map entries\n")
5809 /* Get metric value. */
5811 if (!str2metric (argv
[0], &metric
))
5815 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5817 ospf_routemap_unset (DEFAULT_ROUTE
);
5819 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
, -1, metric
);
5822 DEFUN (ospf_default_information_originate_always_routemap
,
5823 ospf_default_information_originate_always_routemap_cmd
,
5824 "default-information originate always route-map WORD",
5825 "Control distribution of default information\n"
5826 "Distribute a default route\n"
5827 "Always advertise default route\n"
5828 "Route map reference\n"
5829 "Pointer to route-map entries\n")
5832 ospf_routemap_set (DEFAULT_ROUTE
, argv
[0]);
5834 ospf_routemap_unset (DEFAULT_ROUTE
);
5836 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
, -1, -1);
5839 DEFUN (ospf_default_information_originate_always_type_metric_routemap
,
5840 ospf_default_information_originate_always_type_metric_routemap_cmd
,
5841 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
5842 "Control distribution of default information\n"
5843 "Distribute a default route\n"
5844 "Always advertise default route\n"
5845 "OSPF metric type for default routes\n"
5846 "Set OSPF External Type 1 metrics\n"
5847 "Set OSPF External Type 2 metrics\n"
5848 "OSPF default metric\n"
5850 "Route map reference\n"
5851 "Pointer to route-map entries\n")
5856 /* Get metric type. */
5858 if (!str2metric_type (argv
[0], &type
))
5861 /* Get metric value. */
5863 if (!str2metric (argv
[1], &metric
))
5867 ospf_routemap_set (DEFAULT_ROUTE
, argv
[2]);
5869 ospf_routemap_unset (DEFAULT_ROUTE
);
5871 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
,
5875 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5876 ospf_default_information_originate_always_type_metric_cmd
,
5877 "default-information originate always metric-type (1|2) metric <0-16777214>",
5878 "Control distribution of default information\n"
5879 "Distribute a default route\n"
5880 "Always advertise default route\n"
5881 "OSPF metric type for default routes\n"
5882 "Set OSPF External Type 1 metrics\n"
5883 "Set OSPF External Type 2 metrics\n"
5884 "OSPF default metric\n"
5887 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5888 ospf_default_information_originate_always_type_cmd
,
5889 "default-information originate always metric-type (1|2)",
5890 "Control distribution of default information\n"
5891 "Distribute a default route\n"
5892 "Always advertise default route\n"
5893 "OSPF metric type for default routes\n"
5894 "Set OSPF External Type 1 metrics\n"
5895 "Set OSPF External Type 2 metrics\n")
5897 DEFUN (ospf_default_information_originate_always_type_routemap
,
5898 ospf_default_information_originate_always_type_routemap_cmd
,
5899 "default-information originate always metric-type (1|2) route-map WORD",
5900 "Control distribution of default information\n"
5901 "Distribute a default route\n"
5902 "Always advertise default route\n"
5903 "OSPF metric type for default routes\n"
5904 "Set OSPF External Type 1 metrics\n"
5905 "Set OSPF External Type 2 metrics\n"
5906 "Route map reference\n"
5907 "Pointer to route-map entries\n")
5911 /* Get metric type. */
5913 if (!str2metric_type (argv
[0], &type
))
5917 ospf_routemap_set (DEFAULT_ROUTE
, argv
[1]);
5919 ospf_routemap_unset (DEFAULT_ROUTE
);
5921 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS
,
5925 DEFUN (no_ospf_default_information_originate
,
5926 no_ospf_default_information_originate_cmd
,
5927 "no default-information originate",
5929 "Control distribution of default information\n"
5930 "Distribute a default route\n")
5932 struct prefix_ipv4 p
;
5933 struct in_addr nexthop
;
5936 p
.prefix
.s_addr
= 0;
5939 ospf_external_lsa_flush (DEFAULT_ROUTE
, &p
, 0, nexthop
);
5941 if (EXTERNAL_INFO (DEFAULT_ROUTE
)) {
5942 ospf_external_info_delete (DEFAULT_ROUTE
, p
);
5943 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE
));
5944 EXTERNAL_INFO (DEFAULT_ROUTE
) = NULL
;
5947 ospf_routemap_unset (DEFAULT_ROUTE
);
5948 return ospf_redistribute_default_unset ();
5951 DEFUN (ospf_default_metric
,
5952 ospf_default_metric_cmd
,
5953 "default-metric <0-16777214>",
5954 "Set metric of redistributed routes\n"
5959 if (!str2metric (argv
[0], &metric
))
5962 ospf_top
->default_metric
= metric
;
5967 DEFUN (no_ospf_default_metric
,
5968 no_ospf_default_metric_cmd
,
5969 "no default-metric",
5971 "Set metric of redistributed routes\n")
5973 ospf_top
->default_metric
= -1;
5977 ALIAS (no_ospf_default_metric
,
5978 no_ospf_default_metric_val_cmd
,
5979 "no default-metric <0-16777214>",
5981 "Set metric of redistributed routes\n"
5984 DEFUN (ospf_distance
,
5987 "Define an administrative distance\n"
5988 "OSPF Administrative distance\n")
5990 ospf_top
->distance_all
= atoi (argv
[0]);
5994 DEFUN (no_ospf_distance
,
5995 no_ospf_distance_cmd
,
5996 "no distance <1-255>",
5998 "Define an administrative distance\n"
5999 "OSPF Administrative distance\n")
6001 ospf_top
->distance_all
= 0;
6005 DEFUN (no_ospf_distance_ospf
,
6006 no_ospf_distance_ospf_cmd
,
6009 "Define an administrative distance\n"
6010 "OSPF Administrative distance\n"
6013 ospf_top
->distance_intra
= 0;
6014 ospf_top
->distance_inter
= 0;
6015 ospf_top
->distance_external
= 0;
6019 DEFUN (ospf_distance_ospf_intra
,
6020 ospf_distance_ospf_intra_cmd
,
6021 "distance ospf intra-area <1-255>",
6022 "Define an administrative distance\n"
6023 "OSPF Administrative distance\n"
6024 "Intra-area routes\n"
6025 "Distance for intra-area routes\n")
6027 ospf_top
->distance_intra
= atoi (argv
[0]);
6031 DEFUN (ospf_distance_ospf_intra_inter
,
6032 ospf_distance_ospf_intra_inter_cmd
,
6033 "distance ospf intra-area <1-255> inter-area <1-255>",
6034 "Define an administrative distance\n"
6035 "OSPF Administrative distance\n"
6036 "Intra-area routes\n"
6037 "Distance for intra-area routes\n"
6038 "Inter-area routes\n"
6039 "Distance for inter-area routes\n")
6041 ospf_top
->distance_intra
= atoi (argv
[0]);
6042 ospf_top
->distance_inter
= atoi (argv
[1]);
6046 DEFUN (ospf_distance_ospf_intra_external
,
6047 ospf_distance_ospf_intra_external_cmd
,
6048 "distance ospf intra-area <1-255> external <1-255>",
6049 "Define an administrative distance\n"
6050 "OSPF Administrative distance\n"
6051 "Intra-area routes\n"
6052 "Distance for intra-area routes\n"
6054 "Distance for external routes\n")
6056 ospf_top
->distance_intra
= atoi (argv
[0]);
6057 ospf_top
->distance_external
= atoi (argv
[1]);
6061 DEFUN (ospf_distance_ospf_intra_inter_external
,
6062 ospf_distance_ospf_intra_inter_external_cmd
,
6063 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6064 "Define an administrative distance\n"
6065 "OSPF Administrative distance\n"
6066 "Intra-area routes\n"
6067 "Distance for intra-area routes\n"
6068 "Inter-area routes\n"
6069 "Distance for inter-area routes\n"
6071 "Distance for external routes\n")
6073 ospf_top
->distance_intra
= atoi (argv
[0]);
6074 ospf_top
->distance_inter
= atoi (argv
[1]);
6075 ospf_top
->distance_external
= atoi (argv
[2]);
6079 DEFUN (ospf_distance_ospf_intra_external_inter
,
6080 ospf_distance_ospf_intra_external_inter_cmd
,
6081 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6082 "Define an administrative distance\n"
6083 "OSPF Administrative distance\n"
6084 "Intra-area routes\n"
6085 "Distance for intra-area routes\n"
6087 "Distance for external routes\n"
6088 "Inter-area routes\n"
6089 "Distance for inter-area routes\n")
6091 ospf_top
->distance_intra
= atoi (argv
[0]);
6092 ospf_top
->distance_external
= atoi (argv
[1]);
6093 ospf_top
->distance_inter
= atoi (argv
[2]);
6097 DEFUN (ospf_distance_ospf_inter
,
6098 ospf_distance_ospf_inter_cmd
,
6099 "distance ospf inter-area <1-255>",
6100 "Define an administrative distance\n"
6101 "OSPF Administrative distance\n"
6102 "Inter-area routes\n"
6103 "Distance for inter-area routes\n")
6105 ospf_top
->distance_inter
= atoi (argv
[0]);
6109 DEFUN (ospf_distance_ospf_inter_intra
,
6110 ospf_distance_ospf_inter_intra_cmd
,
6111 "distance ospf inter-area <1-255> intra-area <1-255>",
6112 "Define an administrative distance\n"
6113 "OSPF Administrative distance\n"
6114 "Inter-area routes\n"
6115 "Distance for inter-area routes\n"
6116 "Intra-area routes\n"
6117 "Distance for intra-area routes\n")
6119 ospf_top
->distance_inter
= atoi (argv
[0]);
6120 ospf_top
->distance_intra
= atoi (argv
[1]);
6124 DEFUN (ospf_distance_ospf_inter_external
,
6125 ospf_distance_ospf_inter_external_cmd
,
6126 "distance ospf inter-area <1-255> external <1-255>",
6127 "Define an administrative distance\n"
6128 "OSPF Administrative distance\n"
6129 "Inter-area routes\n"
6130 "Distance for inter-area routes\n"
6132 "Distance for external routes\n")
6134 ospf_top
->distance_inter
= atoi (argv
[0]);
6135 ospf_top
->distance_external
= atoi (argv
[1]);
6139 DEFUN (ospf_distance_ospf_inter_intra_external
,
6140 ospf_distance_ospf_inter_intra_external_cmd
,
6141 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6142 "Define an administrative distance\n"
6143 "OSPF Administrative distance\n"
6144 "Inter-area routes\n"
6145 "Distance for inter-area routes\n"
6146 "Intra-area routes\n"
6147 "Distance for intra-area routes\n"
6149 "Distance for external routes\n")
6151 ospf_top
->distance_inter
= atoi (argv
[0]);
6152 ospf_top
->distance_intra
= atoi (argv
[1]);
6153 ospf_top
->distance_external
= atoi (argv
[2]);
6157 DEFUN (ospf_distance_ospf_inter_external_intra
,
6158 ospf_distance_ospf_inter_external_intra_cmd
,
6159 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6160 "Define an administrative distance\n"
6161 "OSPF Administrative distance\n"
6162 "Inter-area routes\n"
6163 "Distance for inter-area routes\n"
6165 "Distance for external routes\n"
6166 "Intra-area routes\n"
6167 "Distance for intra-area routes\n")
6169 ospf_top
->distance_inter
= atoi (argv
[0]);
6170 ospf_top
->distance_external
= atoi (argv
[1]);
6171 ospf_top
->distance_intra
= atoi (argv
[2]);
6175 DEFUN (ospf_distance_ospf_external
,
6176 ospf_distance_ospf_external_cmd
,
6177 "distance ospf external <1-255>",
6178 "Define an administrative distance\n"
6179 "OSPF Administrative distance\n"
6181 "Distance for external routes\n")
6183 ospf_top
->distance_external
= atoi (argv
[0]);
6187 DEFUN (ospf_distance_ospf_external_intra
,
6188 ospf_distance_ospf_external_intra_cmd
,
6189 "distance ospf external <1-255> intra-area <1-255>",
6190 "Define an administrative distance\n"
6191 "OSPF Administrative distance\n"
6193 "Distance for external routes\n"
6194 "Intra-area routes\n"
6195 "Distance for intra-area routes\n")
6197 ospf_top
->distance_external
= atoi (argv
[0]);
6198 ospf_top
->distance_intra
= atoi (argv
[1]);
6202 DEFUN (ospf_distance_ospf_external_inter
,
6203 ospf_distance_ospf_external_inter_cmd
,
6204 "distance ospf external <1-255> inter-area <1-255>",
6205 "Define an administrative distance\n"
6206 "OSPF Administrative distance\n"
6208 "Distance for external routes\n"
6209 "Inter-area routes\n"
6210 "Distance for inter-area routes\n")
6212 ospf_top
->distance_external
= atoi (argv
[0]);
6213 ospf_top
->distance_inter
= atoi (argv
[1]);
6217 DEFUN (ospf_distance_ospf_external_intra_inter
,
6218 ospf_distance_ospf_external_intra_inter_cmd
,
6219 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6220 "Define an administrative distance\n"
6221 "OSPF Administrative distance\n"
6223 "Distance for external routes\n"
6224 "Intra-area routes\n"
6225 "Distance for intra-area routes\n"
6226 "Inter-area routes\n"
6227 "Distance for inter-area routes\n")
6229 ospf_top
->distance_external
= atoi (argv
[0]);
6230 ospf_top
->distance_intra
= atoi (argv
[1]);
6231 ospf_top
->distance_inter
= atoi (argv
[2]);
6235 DEFUN (ospf_distance_ospf_external_inter_intra
,
6236 ospf_distance_ospf_external_inter_intra_cmd
,
6237 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6238 "Define an administrative distance\n"
6239 "OSPF Administrative distance\n"
6241 "Distance for external routes\n"
6242 "Inter-area routes\n"
6243 "Distance for inter-area routes\n"
6244 "Intra-area routes\n"
6245 "Distance for intra-area routes\n")
6247 ospf_top
->distance_external
= atoi (argv
[0]);
6248 ospf_top
->distance_inter
= atoi (argv
[1]);
6249 ospf_top
->distance_intra
= atoi (argv
[2]);
6253 DEFUN (ospf_distance_source
,
6254 ospf_distance_source_cmd
,
6255 "distance <1-255> A.B.C.D/M",
6256 "Administrative distance\n"
6258 "IP source prefix\n")
6260 ospf_distance_set (vty
, argv
[0], argv
[1], NULL
);
6264 DEFUN (no_ospf_distance_source
,
6265 no_ospf_distance_source_cmd
,
6266 "no distance <1-255> A.B.C.D/M",
6268 "Administrative distance\n"
6270 "IP source prefix\n")
6272 ospf_distance_unset (vty
, argv
[0], argv
[1], NULL
);
6276 DEFUN (ospf_distance_source_access_list
,
6277 ospf_distance_source_access_list_cmd
,
6278 "distance <1-255> A.B.C.D/M WORD",
6279 "Administrative distance\n"
6281 "IP source prefix\n"
6282 "Access list name\n")
6284 ospf_distance_set (vty
, argv
[0], argv
[1], argv
[2]);
6288 DEFUN (no_ospf_distance_source_access_list
,
6289 no_ospf_distance_source_access_list_cmd
,
6290 "no distance <1-255> A.B.C.D/M WORD",
6292 "Administrative distance\n"
6294 "IP source prefix\n"
6295 "Access list name\n")
6297 ospf_distance_unset (vty
, argv
[0], argv
[1], argv
[2]);
6302 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
6304 struct route_node
*rn
;
6305 struct ospf_route
*or;
6307 struct ospf_path
*path
;
6309 vty_out (vty
, "============ OSPF network routing table ============%s",
6312 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6313 if ((or = rn
->info
) != NULL
)
6316 snprintf (buf1
, 19, "%s/%d",
6317 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6319 switch (or->path_type
)
6321 case OSPF_PATH_INTER_AREA
:
6322 if (or->type
== OSPF_DESTINATION_NETWORK
)
6323 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
6324 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6325 else if (or->type
== OSPF_DESTINATION_DISCARD
)
6326 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
6328 case OSPF_PATH_INTRA_AREA
:
6329 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
6330 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6336 if (or->type
== OSPF_DESTINATION_NETWORK
)
6337 for (pnode
= listhead (or->path
); pnode
; nextnode (pnode
))
6339 path
= getdata (pnode
);
6340 if (path
->oi
!= NULL
)
6342 if (path
->nexthop
.s_addr
== 0)
6343 vty_out (vty
, "%24s directly attached to %s%s",
6344 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6346 vty_out (vty
, "%24s via %s, %s%s", "",
6347 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6352 vty_out (vty
, "%s", VTY_NEWLINE
);
6356 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
6358 struct route_node
*rn
;
6359 struct ospf_route
*or;
6361 struct ospf_path
*path
;
6363 vty_out (vty
, "============ OSPF router routing table =============%s",
6365 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
6370 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
6372 for (nn
= listhead ((list
) rn
->info
); nn
; nextnode (nn
))
6373 if ((or = getdata (nn
)) != NULL
)
6379 vty_out (vty
, "%s [%d] area: %s",
6380 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
6381 or->cost
, inet_ntoa (or->u
.std
.area_id
));
6383 vty_out (vty
, "%s%s%s",
6384 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
6385 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
6388 for (pn
= listhead (or->path
); pn
; nextnode (pn
))
6390 path
= getdata (pn
);
6391 if (path
->nexthop
.s_addr
== 0)
6392 vty_out (vty
, "%24s directly attached to %s%s",
6393 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6395 vty_out (vty
, "%24s via %s, %s%s", "",
6396 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6401 vty_out (vty
, "%s", VTY_NEWLINE
);
6405 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
6407 struct route_node
*rn
;
6408 struct ospf_route
*er
;
6410 struct ospf_path
*path
;
6412 vty_out (vty
, "============ OSPF external routing table ===========%s",
6414 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6415 if ((er
= rn
->info
) != NULL
)
6418 snprintf (buf1
, 19, "%s/%d",
6419 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6421 switch (er
->path_type
)
6423 case OSPF_PATH_TYPE1_EXTERNAL
:
6424 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
6425 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6427 case OSPF_PATH_TYPE2_EXTERNAL
:
6428 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
6429 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6433 for (pnode
= listhead (er
->path
); pnode
; nextnode (pnode
))
6435 path
= getdata (pnode
);
6436 if (path
->oi
!= NULL
)
6438 if (path
->nexthop
.s_addr
== 0)
6439 vty_out (vty
, "%24s directly attached to %s%s",
6440 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6442 vty_out (vty
, "%24s via %s, %s%s", "",
6443 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6448 vty_out (vty
, "%s", VTY_NEWLINE
);
6452 DEFUN (show_ip_ospf_border_routers
,
6453 show_ip_ospf_border_routers_cmd
,
6454 "show ip ospf border-routers",
6457 "show all the ABR's and ASBR's\n"
6460 if (ospf_top
== NULL
)
6462 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6466 if (ospf_top
->new_table
== NULL
)
6468 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6472 /* Show Network routes.
6473 show_ip_ospf_route_network (vty, ospf_top->new_table); */
6475 /* Show Router routes. */
6476 show_ip_ospf_route_router (vty
, ospf_top
->new_rtrs
);
6480 #endif /* HAVE_NSSA */
6482 DEFUN (show_ip_ospf_route
,
6483 show_ip_ospf_route_cmd
,
6484 "show ip ospf route",
6487 "OSPF information\n"
6488 "OSPF routing table\n")
6490 if (ospf_top
== NULL
)
6492 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6496 if (ospf_top
->new_table
== NULL
)
6498 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6502 /* Show Network routes. */
6503 show_ip_ospf_route_network (vty
, ospf_top
->new_table
);
6505 /* Show Router routes. */
6506 show_ip_ospf_route_router (vty
, ospf_top
->new_rtrs
);
6508 /* Show AS External routes. */
6509 show_ip_ospf_route_external (vty
, ospf_top
->old_external_route
);
6515 char *ospf_abr_type_str
[] =
6524 char *ospf_shortcut_mode_str
[] =
6533 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
6535 memset (buf
, 0, length
);
6537 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6538 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
6540 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
6544 char *ospf_int_type_str
[] =
6546 "unknown", /* should never be used. */
6550 "point-to-multipoint",
6551 "virtual-link", /* should never be used. */
6555 /* Configuration write function for ospfd. */
6557 config_write_interface (struct vty
*vty
)
6560 struct interface
*ifp
;
6561 struct crypt_key
*ck
;
6563 struct route_node
*rn
= NULL
;
6564 struct ospf_if_params
*params
;
6566 for (n1
= listhead (iflist
); n1
; nextnode (n1
))
6570 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
6573 vty_out (vty
, "!%s", VTY_NEWLINE
);
6574 vty_out (vty
, "interface %s%s", ifp
->name
,
6577 vty_out (vty
, " description %s%s", ifp
->desc
,
6582 params
= IF_DEF_PARAMS (ifp
);
6585 /* Interface Network print. */
6586 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
6587 params
->type
!= OSPF_IFTYPE_BROADCAST
&&
6588 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
6590 vty_out (vty
, " ip ospf network %s",
6591 ospf_int_type_str
[params
->type
]);
6592 if (params
!= IF_DEF_PARAMS (ifp
))
6593 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6594 vty_out (vty
, "%s", VTY_NEWLINE
);
6597 /* OSPF interface authentication print */
6598 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
6599 params
->auth_type
!= OSPF_AUTH_NOTSET
)
6603 /* Translation tables are not that much help here due to syntax
6604 of the simple option */
6605 switch (params
->auth_type
)
6608 case OSPF_AUTH_NULL
:
6612 case OSPF_AUTH_SIMPLE
:
6616 case OSPF_AUTH_CRYPTOGRAPHIC
:
6617 auth_str
= " message-digest";
6625 vty_out (vty
, " ip ospf authentication%s", auth_str
);
6626 if (params
!= IF_DEF_PARAMS (ifp
))
6627 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6628 vty_out (vty
, "%s", VTY_NEWLINE
);
6631 /* Simple Authentication Password print. */
6632 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
6633 params
->auth_simple
[0] != '\0')
6635 vty_out (vty
, " ip ospf authentication-key %s",
6636 params
->auth_simple
);
6637 if (params
!= IF_DEF_PARAMS (ifp
))
6638 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6639 vty_out (vty
, "%s", VTY_NEWLINE
);
6642 /* Cryptographic Authentication Key print. */
6643 for (n2
= listhead (params
->auth_crypt
); n2
; nextnode (n2
))
6646 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
6647 ck
->key_id
, ck
->auth_key
);
6648 if (params
!= IF_DEF_PARAMS (ifp
))
6649 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6650 vty_out (vty
, "%s", VTY_NEWLINE
);
6653 /* Interface Output Cost print. */
6654 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
6656 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
6657 if (params
!= IF_DEF_PARAMS (ifp
))
6658 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6659 vty_out (vty
, "%s", VTY_NEWLINE
);
6662 /* Hello Interval print. */
6663 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
6664 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
6666 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
6667 if (params
!= IF_DEF_PARAMS (ifp
))
6668 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6669 vty_out (vty
, "%s", VTY_NEWLINE
);
6673 /* Router Dead Interval print. */
6674 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
6675 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
6677 vty_out (vty
, " ip ospf dead-interval %u", params
->v_wait
);
6678 if (params
!= IF_DEF_PARAMS (ifp
))
6679 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6680 vty_out (vty
, "%s", VTY_NEWLINE
);
6683 /* Router Priority print. */
6684 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
6685 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
6687 vty_out (vty
, " ip ospf priority %u", params
->priority
);
6688 if (params
!= IF_DEF_PARAMS (ifp
))
6689 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6690 vty_out (vty
, "%s", VTY_NEWLINE
);
6693 /* Retransmit Interval print. */
6694 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
6695 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
6697 vty_out (vty
, " ip ospf retransmit-interval %u",
6698 params
->retransmit_interval
);
6699 if (params
!= IF_DEF_PARAMS (ifp
))
6700 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6701 vty_out (vty
, "%s", VTY_NEWLINE
);
6704 /* Transmit Delay print. */
6705 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
6706 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
6708 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
6709 if (params
!= IF_DEF_PARAMS (ifp
))
6710 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6711 vty_out (vty
, "%s", VTY_NEWLINE
);
6717 rn
= route_top (IF_OIFS_PARAMS (ifp
));
6719 rn
= route_next (rn
);
6729 #ifdef HAVE_OPAQUE_LSA
6730 ospf_opaque_config_write_if (vty
, ifp
);
6731 #endif /* HAVE_OPAQUE_LSA */
6738 config_write_network_area (struct vty
*vty
)
6740 struct route_node
*rn
;
6741 u_char buf
[INET_ADDRSTRLEN
];
6743 /* `network area' print. */
6744 for (rn
= route_top (ospf_top
->networks
); rn
; rn
= route_next (rn
))
6747 struct ospf_network
*n
= rn
->info
;
6749 memset (buf
, 0, INET_ADDRSTRLEN
);
6751 /* Create Area ID string by specified Area ID format. */
6752 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6753 strncpy (buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
6755 sprintf (buf
, "%lu",
6756 (unsigned long int) ntohl (n
->area_id
.s_addr
));
6758 /* Network print. */
6759 vty_out (vty
, " network %s/%d area %s%s",
6760 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
6768 config_write_ospf_area (struct vty
*vty
)
6771 u_char buf
[INET_ADDRSTRLEN
];
6773 /* Area configuration print. */
6774 for (node
= listhead (ospf_top
->areas
); node
; nextnode (node
))
6776 struct ospf_area
*area
= getdata (node
);
6777 struct route_node
*rn1
;
6779 area_id2str (buf
, INET_ADDRSTRLEN
, area
);
6781 if (area
->auth_type
!= OSPF_AUTH_NULL
)
6783 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
6784 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
6786 vty_out (vty
, " area %s authentication message-digest%s",
6790 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
6791 vty_out (vty
, " area %s shortcut %s%s", buf
,
6792 ospf_shortcut_mode_str
[area
->shortcut_configured
],
6795 if ((area
->external_routing
== OSPF_AREA_STUB
)
6797 || (area
->external_routing
== OSPF_AREA_NSSA
)
6798 #endif /* HAVE_NSSA */
6802 if (area
->external_routing
== OSPF_AREA_NSSA
)
6803 vty_out (vty
, " area %s nssa", buf
);
6805 #endif /* HAVE_NSSA */
6806 vty_out (vty
, " area %s stub", buf
);
6808 if (area
->no_summary
)
6809 vty_out (vty
, " no-summary");
6811 vty_out (vty
, "%s", VTY_NEWLINE
);
6813 if (area
->default_cost
!= 1)
6814 vty_out (vty
, " area %s default-cost %d%s", buf
,
6815 area
->default_cost
, VTY_NEWLINE
);
6818 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
6821 struct ospf_area_range
*range
= rn1
->info
;
6823 vty_out (vty
, " area %s range %s/%d", buf
,
6824 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
6826 if (range
->cost_config
!= -1)
6827 vty_out (vty
, " cost %d", range
->cost_config
);
6829 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
6830 vty_out (vty
, " not-advertise");
6832 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
6833 vty_out (vty
, " substitute %s/%d",
6834 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
6836 vty_out (vty
, "%s", VTY_NEWLINE
);
6839 if (EXPORT_NAME (area
))
6840 vty_out (vty
, " area %s export-list %s%s", buf
,
6841 EXPORT_NAME (area
), VTY_NEWLINE
);
6843 if (IMPORT_NAME (area
))
6844 vty_out (vty
, " area %s import-list %s%s", buf
,
6845 IMPORT_NAME (area
), VTY_NEWLINE
);
6847 if (PREFIX_NAME_IN (area
))
6848 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
6849 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
6851 if (PREFIX_NAME_OUT (area
))
6852 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
6853 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
6860 config_write_ospf_nbr_nbma (struct vty
*vty
)
6862 struct ospf_nbr_nbma
*nbr_nbma
;
6863 struct route_node
*rn
;
6865 /* Static Neighbor configuration print. */
6866 for (rn
= route_top (ospf_top
->nbr_nbma
); rn
; rn
= route_next (rn
))
6867 if ((nbr_nbma
= rn
->info
))
6869 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
6871 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
6872 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
6874 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
6875 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
6877 vty_out (vty
, "%s", VTY_NEWLINE
);
6884 config_write_virtual_link (struct vty
*vty
)
6887 u_char buf
[INET_ADDRSTRLEN
];
6889 /* Virtual-Link print */
6890 for (node
= listhead (ospf_top
->vlinks
); node
; nextnode (node
))
6893 struct crypt_key
*ck
;
6894 struct ospf_vl_data
*vl_data
= getdata (node
);
6895 struct ospf_interface
*oi
;
6897 if (vl_data
!= NULL
)
6899 memset (buf
, 0, INET_ADDRSTRLEN
);
6901 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6902 strncpy (buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
6904 sprintf (buf
, "%lu",
6905 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
6906 oi
= vl_data
->vl_oi
;
6909 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
6910 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
6911 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
6912 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
6913 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
6915 inet_ntoa (vl_data
->vl_peer
),
6916 OSPF_IF_PARAM (oi
, v_hello
),
6917 OSPF_IF_PARAM (oi
, retransmit_interval
),
6918 OSPF_IF_PARAM (oi
, transmit_delay
),
6919 OSPF_IF_PARAM (oi
, v_wait
),
6922 vty_out (vty
, " area %s virtual-link %s%s", buf
,
6923 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
6925 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
6926 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
6928 inet_ntoa (vl_data
->vl_peer
),
6929 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
6932 for (n2
= listhead (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
); n2
; nextnode (n2
))
6935 vty_out (vty
, " area %s virtual-link %s message-digest-key %d md5 %s%s",
6937 inet_ntoa (vl_data
->vl_peer
),
6938 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
6948 char *distribute_str
[] = { "system", "kernel", "connected", "static", "rip",
6949 "ripng", "ospf", "ospf6", "bgp"};
6951 config_write_ospf_redistribute (struct vty
*vty
)
6955 /* redistribute print. */
6956 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
6957 if (type
!= zclient
->redist_default
&& zclient
->redist
[type
])
6959 vty_out (vty
, " redistribute %s", distribute_str
[type
]);
6960 if (ospf_top
->dmetric
[type
].value
>= 0)
6961 vty_out (vty
, " metric %d", ospf_top
->dmetric
[type
].value
);
6963 if (ospf_top
->dmetric
[type
].type
== EXTERNAL_METRIC_TYPE_1
)
6964 vty_out (vty
, " metric-type 1");
6966 if (ROUTEMAP_NAME (type
))
6967 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (type
));
6969 vty_out (vty
, "%s", VTY_NEWLINE
);
6976 config_write_ospf_default_metric (struct vty
*vty
)
6978 if (ospf_top
->default_metric
!= -1)
6979 vty_out (vty
, " default-metric %d%s", ospf_top
->default_metric
,
6985 config_write_ospf_distribute (struct vty
*vty
)
6991 /* distribute-list print. */
6992 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
6993 if (ospf_top
->dlist
[type
].name
)
6994 vty_out (vty
, " distribute-list %s out %s%s",
6995 ospf_top
->dlist
[type
].name
,
6996 distribute_str
[type
], VTY_NEWLINE
);
6998 /* default-information print. */
6999 if (ospf_top
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
7001 if (ospf_top
->default_originate
== DEFAULT_ORIGINATE_ZEBRA
)
7002 vty_out (vty
, " default-information originate");
7004 vty_out (vty
, " default-information originate always");
7006 if (ospf_top
->dmetric
[DEFAULT_ROUTE
].value
>= 0)
7007 vty_out (vty
, " metric %d",
7008 ospf_top
->dmetric
[DEFAULT_ROUTE
].value
);
7009 if (ospf_top
->dmetric
[DEFAULT_ROUTE
].type
== EXTERNAL_METRIC_TYPE_1
)
7010 vty_out (vty
, " metric-type 1");
7012 if (ROUTEMAP_NAME (DEFAULT_ROUTE
))
7013 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (DEFAULT_ROUTE
));
7015 vty_out (vty
, "%s", VTY_NEWLINE
);
7024 config_write_ospf_distance (struct vty
*vty
)
7026 struct route_node
*rn
;
7027 struct ospf_distance
*odistance
;
7029 if (ospf_top
->distance_all
)
7030 vty_out (vty
, " distance %d%s", ospf_top
->distance_all
, VTY_NEWLINE
);
7032 if (ospf_top
->distance_intra
7033 || ospf_top
->distance_inter
7034 || ospf_top
->distance_external
)
7036 vty_out (vty
, " distance ospf");
7038 if (ospf_top
->distance_intra
)
7039 vty_out (vty
, " intra-area %d", ospf_top
->distance_intra
);
7040 if (ospf_top
->distance_inter
)
7041 vty_out (vty
, " inter-area %d", ospf_top
->distance_inter
);
7042 if (ospf_top
->distance_external
)
7043 vty_out (vty
, " external %d", ospf_top
->distance_external
);
7045 vty_out (vty
, "%s", VTY_NEWLINE
);
7048 for (rn
= route_top (ospf_top
->distance_table
); rn
; rn
= route_next (rn
))
7049 if ((odistance
= rn
->info
) != NULL
)
7051 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
7052 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7053 odistance
->access_list
? odistance
->access_list
: "",
7059 /* OSPF configuration write function. */
7061 ospf_config_write (struct vty
*vty
)
7066 if (ospf_top
!= NULL
)
7068 /* `router ospf' print. */
7069 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
7073 if (!ospf_top
->networks
)
7076 /* Router ID print. */
7077 if (ospf_top
->router_id_static
.s_addr
!= 0)
7078 vty_out (vty
, " ospf router-id %s%s",
7079 inet_ntoa (ospf_top
->router_id_static
), VTY_NEWLINE
);
7081 /* ABR type print. */
7082 if (ospf_top
->abr_type
!= OSPF_ABR_STAND
)
7083 vty_out (vty
, " ospf abr-type %s%s",
7084 ospf_abr_type_str
[ospf_top
->abr_type
], VTY_NEWLINE
);
7086 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
7087 if (CHECK_FLAG (ospf_top
->config
, OSPF_RFC1583_COMPATIBLE
))
7088 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
7090 /* auto-cost reference-bandwidth configuration. */
7091 if (ospf_top
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
7092 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
7093 ospf_top
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
7095 /* SPF timers print. */
7096 if (ospf_top
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
7097 ospf_top
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
)
7098 vty_out (vty
, " timers spf %d %d%s",
7099 ospf_top
->spf_delay
, ospf_top
->spf_holdtime
, VTY_NEWLINE
);
7101 /* SPF refresh parameters print. */
7102 if (ospf_top
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
7103 vty_out (vty
, " refresh timer %d%s",
7104 ospf_top
->lsa_refresh_interval
, VTY_NEWLINE
);
7106 /* Redistribute information print. */
7107 config_write_ospf_redistribute (vty
);
7109 /* passive-interface print. */
7110 for (node
= listhead (ospf_top
->iflist
); node
; nextnode (node
))
7112 struct interface
*ifp
= getdata (node
);
7116 if (IF_DEF_PARAMS (ifp
)->passive_interface
== OSPF_IF_PASSIVE
)
7117 vty_out (vty
, " passive-interface %s%s",
7118 ifp
->name
, VTY_NEWLINE
);
7121 for (node
= listhead (ospf_top
->oiflist
); node
; nextnode (node
))
7123 struct ospf_interface
*oi
= getdata (node
);
7125 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
) &&
7126 oi
->params
->passive_interface
== OSPF_IF_PASSIVE
)
7127 vty_out (vty
, " passive-interface %s%s",
7128 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
7132 /* Network area print. */
7133 config_write_network_area (vty
);
7135 /* Area config print. */
7136 config_write_ospf_area (vty
);
7138 /* static neighbor print. */
7139 config_write_ospf_nbr_nbma (vty
);
7141 /* Virtual-Link print. */
7142 config_write_virtual_link (vty
);
7144 /* Default metric configuration. */
7145 config_write_ospf_default_metric (vty
);
7147 /* Distribute-list and default-information print. */
7148 config_write_ospf_distribute (vty
);
7150 /* Distance configuration. */
7151 config_write_ospf_distance (vty
);
7153 #ifdef HAVE_OPAQUE_LSA
7154 ospf_opaque_config_write_router (vty
, ospf_top
);
7155 #endif /* HAVE_OPAQUE_LSA */
7162 ospf_vty_show_init ()
7164 /* "show ip ospf" commands. */
7165 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
7166 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
7168 /* "show ip ospf database" commands. */
7169 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
7170 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
7171 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7172 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7173 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7174 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
7175 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
7176 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
7177 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
7178 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7179 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7180 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7181 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
7182 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
7184 /* "show ip ospf interface" commands. */
7185 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
7186 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
7188 /* "show ip ospf neighbor" commands. */
7189 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7190 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7191 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7192 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7193 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7194 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
7195 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7196 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7197 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7198 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7199 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7200 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7201 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
7202 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7204 /* "show ip ospf route" commands. */
7205 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
7206 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
7208 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
7209 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
7210 #endif /* HAVE_NSSA */
7214 /* ospfd's interface node. */
7215 struct cmd_node interface_node
=
7222 /* Initialization of OSPF interface. */
7226 /* Install interface node. */
7227 install_node (&interface_node
, config_write_interface
);
7229 install_element (CONFIG_NODE
, &interface_cmd
);
7230 install_default (INTERFACE_NODE
);
7232 /* "description" commands. */
7233 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
7234 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
7236 /* "ip ospf authentication" commands. */
7237 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
7238 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
7239 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
7240 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
7241 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
7242 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
7243 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
7244 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
7245 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
7246 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
7248 /* "ip ospf message-digest-key" commands. */
7249 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
7250 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
7251 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
7252 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
7254 /* "ip ospf cost" commands. */
7255 install_element (INTERFACE_NODE
, &ip_ospf_cost_addr_cmd
);
7256 install_element (INTERFACE_NODE
, &ip_ospf_cost_cmd
);
7257 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_addr_cmd
);
7258 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
7260 /* "ip ospf dead-interval" commands. */
7261 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
7262 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
7263 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
7264 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
7266 /* "ip ospf hello-interval" commands. */
7267 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
7268 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
7269 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
7270 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
7272 /* "ip ospf network" commands. */
7273 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
7274 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
7276 /* "ip ospf priority" commands. */
7277 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
7278 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
7279 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
7280 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
7282 /* "ip ospf retransmit-interval" commands. */
7283 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
7284 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
7285 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
7286 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
7288 /* "ip ospf transmit-delay" commands. */
7289 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
7290 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
7291 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
7292 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
7294 /* These commands are compatibitliy for previous version. */
7295 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
7296 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
7297 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
7298 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
7299 install_element (INTERFACE_NODE
, &ospf_cost_cmd
);
7300 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
7301 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
7302 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
7303 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
7304 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
7305 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
7306 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
7307 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
7308 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
7309 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
7310 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
7311 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
7312 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
7315 /* Zebra node structure. */
7316 struct cmd_node zebra_node
=
7319 "%s(config-router)#",
7323 ospf_vty_zebra_init ()
7325 install_element (OSPF_NODE
, &ospf_redistribute_source_type_metric_cmd
);
7326 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_type_cmd
);
7327 install_element (OSPF_NODE
, &ospf_redistribute_source_type_cmd
);
7328 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_cmd
);
7329 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
7330 install_element (OSPF_NODE
,
7331 &ospf_redistribute_source_metric_type_routemap_cmd
);
7332 install_element (OSPF_NODE
,
7333 &ospf_redistribute_source_type_metric_routemap_cmd
);
7334 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_routemap_cmd
);
7335 install_element (OSPF_NODE
, &ospf_redistribute_source_type_routemap_cmd
);
7336 install_element (OSPF_NODE
, &ospf_redistribute_source_routemap_cmd
);
7338 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
7340 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
7341 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
7343 install_element (OSPF_NODE
,
7344 &ospf_default_information_originate_metric_type_cmd
);
7345 install_element (OSPF_NODE
, &ospf_default_information_originate_metric_cmd
);
7346 install_element (OSPF_NODE
,
7347 &ospf_default_information_originate_type_metric_cmd
);
7348 install_element (OSPF_NODE
, &ospf_default_information_originate_type_cmd
);
7349 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
7350 install_element (OSPF_NODE
,
7351 &ospf_default_information_originate_always_metric_type_cmd
);
7352 install_element (OSPF_NODE
,
7353 &ospf_default_information_originate_always_metric_cmd
);
7354 install_element (OSPF_NODE
,
7355 &ospf_default_information_originate_always_cmd
);
7356 install_element (OSPF_NODE
,
7357 &ospf_default_information_originate_always_type_metric_cmd
);
7358 install_element (OSPF_NODE
,
7359 &ospf_default_information_originate_always_type_cmd
);
7361 install_element (OSPF_NODE
,
7362 &ospf_default_information_originate_metric_type_routemap_cmd
);
7363 install_element (OSPF_NODE
,
7364 &ospf_default_information_originate_metric_routemap_cmd
);
7365 install_element (OSPF_NODE
,
7366 &ospf_default_information_originate_routemap_cmd
);
7367 install_element (OSPF_NODE
,
7368 &ospf_default_information_originate_type_metric_routemap_cmd
);
7369 install_element (OSPF_NODE
,
7370 &ospf_default_information_originate_type_routemap_cmd
);
7371 install_element (OSPF_NODE
,
7372 &ospf_default_information_originate_always_metric_type_routemap_cmd
);
7373 install_element (OSPF_NODE
,
7374 &ospf_default_information_originate_always_metric_routemap_cmd
);
7375 install_element (OSPF_NODE
,
7376 &ospf_default_information_originate_always_routemap_cmd
);
7377 install_element (OSPF_NODE
,
7378 &ospf_default_information_originate_always_type_metric_routemap_cmd
);
7379 install_element (OSPF_NODE
,
7380 &ospf_default_information_originate_always_type_routemap_cmd
);
7382 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
7384 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
7385 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
7386 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
7388 install_element (OSPF_NODE
, &ospf_distance_cmd
);
7389 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
7390 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
7391 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_cmd
);
7392 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_cmd
);
7393 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_cmd
);
7394 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_external_cmd
);
7395 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_inter_cmd
);
7396 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_cmd
);
7397 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_cmd
);
7398 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_cmd
);
7399 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_external_cmd
);
7400 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_intra_cmd
);
7401 install_element (OSPF_NODE
, &ospf_distance_ospf_external_cmd
);
7402 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_cmd
);
7403 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_cmd
);
7404 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_inter_cmd
);
7405 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_intra_cmd
);
7407 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
7408 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
7409 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
7410 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
7414 struct cmd_node ospf_node
=
7417 "%s(config-router)# ",
7422 /* Install OSPF related vty commands. */
7426 /* Install ospf top node. */
7427 install_node (&ospf_node
, ospf_config_write
);
7429 /* "router ospf" commands. */
7430 install_element (CONFIG_NODE
, &router_ospf_cmd
);
7431 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
7433 install_default (OSPF_NODE
);
7435 /* "ospf router-id" commands. */
7436 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
7437 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
7438 install_element (OSPF_NODE
, &router_id_cmd
);
7439 install_element (OSPF_NODE
, &no_router_id_cmd
);
7441 /* "passive-interface" commands. */
7442 install_element (OSPF_NODE
, &passive_interface_addr_cmd
);
7443 install_element (OSPF_NODE
, &passive_interface_cmd
);
7444 install_element (OSPF_NODE
, &no_passive_interface_addr_cmd
);
7445 install_element (OSPF_NODE
, &no_passive_interface_cmd
);
7447 /* "ospf abr-type" commands. */
7448 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
7449 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
7451 /* "ospf rfc1583-compatible" commands. */
7452 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
7453 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
7454 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
7455 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
7457 /* "network area" commands. */
7458 install_element (OSPF_NODE
, &network_area_cmd
);
7459 install_element (OSPF_NODE
, &no_network_area_cmd
);
7461 /* "area authentication" commands. */
7462 install_element (OSPF_NODE
, &area_authentication_message_digest_cmd
);
7463 install_element (OSPF_NODE
, &area_authentication_cmd
);
7464 install_element (OSPF_NODE
, &no_area_authentication_cmd
);
7466 /* "area range" commands. */
7467 install_element (OSPF_NODE
, &area_range_cmd
);
7468 install_element (OSPF_NODE
, &area_range_advertise_cmd
);
7469 install_element (OSPF_NODE
, &area_range_cost_cmd
);
7470 install_element (OSPF_NODE
, &area_range_advertise_cost_cmd
);
7471 install_element (OSPF_NODE
, &area_range_not_advertise_cmd
);
7472 install_element (OSPF_NODE
, &no_area_range_cmd
);
7473 install_element (OSPF_NODE
, &no_area_range_advertise_cmd
);
7474 install_element (OSPF_NODE
, &no_area_range_cost_cmd
);
7475 install_element (OSPF_NODE
, &no_area_range_advertise_cost_cmd
);
7476 install_element (OSPF_NODE
, &area_range_substitute_cmd
);
7477 install_element (OSPF_NODE
, &no_area_range_substitute_cmd
);
7479 /* "area virtual-link" commands. */
7480 install_element (OSPF_NODE
, &area_vlink_cmd
);
7481 install_element (OSPF_NODE
, &no_area_vlink_cmd
);
7483 install_element (OSPF_NODE
, &area_vlink_param1_cmd
);
7484 install_element (OSPF_NODE
, &no_area_vlink_param1_cmd
);
7486 install_element (OSPF_NODE
, &area_vlink_param2_cmd
);
7487 install_element (OSPF_NODE
, &no_area_vlink_param2_cmd
);
7489 install_element (OSPF_NODE
, &area_vlink_param3_cmd
);
7490 install_element (OSPF_NODE
, &no_area_vlink_param3_cmd
);
7492 install_element (OSPF_NODE
, &area_vlink_param4_cmd
);
7493 install_element (OSPF_NODE
, &no_area_vlink_param4_cmd
);
7495 install_element (OSPF_NODE
, &area_vlink_authtype_args_cmd
);
7496 install_element (OSPF_NODE
, &area_vlink_authtype_cmd
);
7497 install_element (OSPF_NODE
, &no_area_vlink_authtype_cmd
);
7499 install_element (OSPF_NODE
, &area_vlink_md5_cmd
);
7500 install_element (OSPF_NODE
, &no_area_vlink_md5_cmd
);
7502 install_element (OSPF_NODE
, &area_vlink_authkey_cmd
);
7503 install_element (OSPF_NODE
, &no_area_vlink_authkey_cmd
);
7505 install_element (OSPF_NODE
, &area_vlink_authtype_args_authkey_cmd
);
7506 install_element (OSPF_NODE
, &area_vlink_authtype_authkey_cmd
);
7507 install_element (OSPF_NODE
, &no_area_vlink_authtype_authkey_cmd
);
7509 install_element (OSPF_NODE
, &area_vlink_authtype_args_md5_cmd
);
7510 install_element (OSPF_NODE
, &area_vlink_authtype_md5_cmd
);
7511 install_element (OSPF_NODE
, &no_area_vlink_authtype_md5_cmd
);
7513 /* "area stub" commands. */
7514 install_element (OSPF_NODE
, &area_stub_no_summary_cmd
);
7515 install_element (OSPF_NODE
, &area_stub_cmd
);
7516 install_element (OSPF_NODE
, &no_area_stub_no_summary_cmd
);
7517 install_element (OSPF_NODE
, &no_area_stub_cmd
);
7520 /* "area nssa" commands. */
7521 install_element (OSPF_NODE
, &area_nssa_cmd
);
7522 install_element (OSPF_NODE
, &area_nssa_translate_no_summary_cmd
);
7523 install_element (OSPF_NODE
, &area_nssa_translate_cmd
);
7524 install_element (OSPF_NODE
, &area_nssa_no_summary_cmd
);
7525 install_element (OSPF_NODE
, &no_area_nssa_cmd
);
7526 install_element (OSPF_NODE
, &no_area_nssa_no_summary_cmd
);
7527 #endif /* HAVE_NSSA */
7529 install_element (OSPF_NODE
, &area_default_cost_cmd
);
7530 install_element (OSPF_NODE
, &no_area_default_cost_cmd
);
7532 install_element (OSPF_NODE
, &area_shortcut_cmd
);
7533 install_element (OSPF_NODE
, &no_area_shortcut_cmd
);
7535 install_element (OSPF_NODE
, &area_export_list_cmd
);
7536 install_element (OSPF_NODE
, &no_area_export_list_cmd
);
7538 install_element (OSPF_NODE
, &area_filter_list_cmd
);
7539 install_element (OSPF_NODE
, &no_area_filter_list_cmd
);
7541 install_element (OSPF_NODE
, &area_import_list_cmd
);
7542 install_element (OSPF_NODE
, &no_area_import_list_cmd
);
7544 install_element (OSPF_NODE
, &timers_spf_cmd
);
7545 install_element (OSPF_NODE
, &no_timers_spf_cmd
);
7547 install_element (OSPF_NODE
, &refresh_timer_cmd
);
7548 install_element (OSPF_NODE
, &no_refresh_timer_val_cmd
);
7549 install_element (OSPF_NODE
, &no_refresh_timer_cmd
);
7551 install_element (OSPF_NODE
, &auto_cost_reference_bandwidth_cmd
);
7552 install_element (OSPF_NODE
, &no_auto_cost_reference_bandwidth_cmd
);
7554 /* "neighbor" commands. */
7555 install_element (OSPF_NODE
, &neighbor_cmd
);
7556 install_element (OSPF_NODE
, &neighbor_priority_poll_interval_cmd
);
7557 install_element (OSPF_NODE
, &neighbor_priority_cmd
);
7558 install_element (OSPF_NODE
, &neighbor_poll_interval_cmd
);
7559 install_element (OSPF_NODE
, &neighbor_poll_interval_priority_cmd
);
7560 install_element (OSPF_NODE
, &no_neighbor_cmd
);
7561 install_element (OSPF_NODE
, &no_neighbor_priority_cmd
);
7562 install_element (OSPF_NODE
, &no_neighbor_poll_interval_cmd
);
7564 /* Init interface related vty commands. */
7565 ospf_vty_if_init ();
7567 /* Init zebra related vty commands. */
7568 ospf_vty_zebra_init ();