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")
186 ospf
= ospf_lookup ();
189 vty_out (vty
, "There isn't active ospf instance%s", VTY_NEWLINE
);
198 DEFUN (ospf_router_id
,
200 "ospf router-id A.B.C.D",
201 "OSPF specific commands\n"
202 "router-id for the OSPF process\n"
203 "OSPF router-id in IP address format\n")
205 struct ospf
*ospf
= vty
->index
;
206 struct in_addr router_id
;
209 ret
= inet_aton (argv
[0], &router_id
);
212 vty_out (vty
, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE
);
216 ospf
->router_id_static
= router_id
;
218 if (ospf
->t_router_id_update
== NULL
)
219 OSPF_TIMER_ON (ospf
->t_router_id_update
, ospf_router_id_update_timer
,
220 OSPF_ROUTER_ID_UPDATE_DELAY
);
225 ALIAS (ospf_router_id
,
228 "router-id for the OSPF process\n"
229 "OSPF router-id in IP address format\n")
231 DEFUN (no_ospf_router_id
,
232 no_ospf_router_id_cmd
,
235 "OSPF specific commands\n"
236 "router-id for the OSPF process\n")
238 struct ospf
*ospf
= vty
->index
;
240 ospf
->router_id_static
.s_addr
= 0;
242 ospf_router_id_update (ospf
);
247 ALIAS (no_ospf_router_id
,
248 no_router_ospf_id_cmd
,
251 "router-id for the OSPF process\n")
253 DEFUN (ospf_passive_interface
,
254 ospf_passive_interface_addr_cmd
,
255 "passive-interface IFNAME A.B.C.D",
256 "Suppress routing updates on an interface\n"
257 "Interface's name\n")
259 struct interface
*ifp
;
262 struct ospf_if_params
*params
;
264 ifp
= if_lookup_by_name (argv
[0]);
268 vty_out (vty
, "Please specify an existing interface%s", VTY_NEWLINE
);
272 params
= IF_DEF_PARAMS (ifp
);
276 ret
= inet_aton(argv
[1], &addr
);
279 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
284 params
= ospf_get_if_params (ifp
, addr
);
285 ospf_if_update_params (ifp
, addr
);
288 SET_IF_PARAM (params
, passive_interface
);
289 params
->passive_interface
= OSPF_IF_PASSIVE
;
294 ALIAS (ospf_passive_interface
,
295 ospf_passive_interface_cmd
,
296 "passive-interface IFNAME",
297 "Suppress routing updates on an interface\n"
298 "Interface's name\n")
300 DEFUN (no_ospf_passive_interface
,
301 no_ospf_passive_interface_addr_cmd
,
302 "no passive-interface IFNAME A.B.C.D",
304 "Allow routing updates on an interface\n"
305 "Interface's name\n")
307 struct interface
*ifp
;
309 struct ospf_if_params
*params
;
312 ifp
= if_lookup_by_name (argv
[0]);
316 vty_out (vty
, "Please specify an existing interface%s", VTY_NEWLINE
);
320 params
= IF_DEF_PARAMS (ifp
);
324 ret
= inet_aton(argv
[1], &addr
);
327 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
332 params
= ospf_lookup_if_params (ifp
, addr
);
337 UNSET_IF_PARAM (params
, passive_interface
);
338 params
->passive_interface
= OSPF_IF_ACTIVE
;
340 if (params
!= IF_DEF_PARAMS (ifp
))
342 ospf_free_if_params (ifp
, addr
);
343 ospf_if_update_params (ifp
, addr
);
349 ALIAS (no_ospf_passive_interface
,
350 no_ospf_passive_interface_cmd
,
351 "no passive-interface IFNAME",
353 "Allow routing updates on an interface\n"
354 "Interface's name\n")
356 DEFUN (ospf_network_area
,
357 ospf_network_area_cmd
,
358 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
359 "Enable routing on an IP network\n"
360 "OSPF network prefix\n"
361 "Set the OSPF area ID\n"
362 "OSPF area ID in IP address format\n"
363 "OSPF area ID as a decimal value\n")
365 struct ospf
*ospf
= vty
->index
;
366 struct prefix_ipv4 p
;
367 struct in_addr area_id
;
370 /* Get network prefix and Area ID. */
371 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
372 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
374 ret
= ospf_network_set (ospf
, &p
, area_id
);
377 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
384 DEFUN (no_ospf_network_area
,
385 no_ospf_network_area_cmd
,
386 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
388 "Enable routing on an IP network\n"
389 "OSPF network prefix\n"
390 "Set the OSPF area ID\n"
391 "OSPF area ID in IP address format\n"
392 "OSPF area ID as a decimal value\n")
394 struct ospf
*ospf
= (struct ospf
*) vty
->index
;
395 struct prefix_ipv4 p
;
396 struct in_addr area_id
;
399 /* Get network prefix and Area ID. */
400 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
401 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
403 ret
= ospf_network_unset (ospf
, &p
, area_id
);
406 vty_out (vty
, "Can't find specified network area configuration.%s",
415 DEFUN (ospf_area_range
,
417 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
418 "OSPF area parameters\n"
419 "OSPF area ID in IP address format\n"
420 "OSPF area ID as a decimal value\n"
421 "Summarize routes matching address/mask (border routers only)\n"
422 "Area range prefix\n")
424 struct ospf
*ospf
= vty
->index
;
425 struct prefix_ipv4 p
;
426 struct in_addr area_id
;
430 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
431 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
433 ospf_area_range_set (ospf
, area_id
, &p
, OSPF_AREA_RANGE_ADVERTISE
);
436 VTY_GET_UINT32 ("range cost", cost
, argv
[2]);
437 ospf_area_range_cost_set (ospf
, area_id
, &p
, cost
);
443 ALIAS (ospf_area_range
,
444 ospf_area_range_advertise_cmd
,
445 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
446 "OSPF area parameters\n"
447 "OSPF area ID in IP address format\n"
448 "OSPF area ID as a decimal value\n"
449 "OSPF area range for route advertise (default)\n"
450 "Area range prefix\n"
451 "Advertise this range (default)\n")
453 ALIAS (ospf_area_range
,
454 ospf_area_range_cost_cmd
,
455 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
456 "OSPF area parameters\n"
457 "OSPF area ID in IP address format\n"
458 "OSPF area ID as a decimal value\n"
459 "Summarize routes matching address/mask (border routers only)\n"
460 "Area range prefix\n"
461 "User specified metric for this range\n"
462 "Advertised metric for this range\n")
464 ALIAS (ospf_area_range
,
465 ospf_area_range_advertise_cost_cmd
,
466 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
467 "OSPF area parameters\n"
468 "OSPF area ID in IP address format\n"
469 "OSPF area ID as a decimal value\n"
470 "Summarize routes matching address/mask (border routers only)\n"
471 "Area range prefix\n"
472 "Advertise this range (default)\n"
473 "User specified metric for this range\n"
474 "Advertised metric for this range\n")
476 DEFUN (ospf_area_range_not_advertise
,
477 ospf_area_range_not_advertise_cmd
,
478 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
479 "OSPF area parameters\n"
480 "OSPF area ID in IP address format\n"
481 "OSPF area ID as a decimal value\n"
482 "Summarize routes matching address/mask (border routers only)\n"
483 "Area range prefix\n"
484 "DoNotAdvertise this range\n")
486 struct ospf
*ospf
= vty
->index
;
487 struct prefix_ipv4 p
;
488 struct in_addr area_id
;
491 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
492 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
494 ospf_area_range_set (ospf
, area_id
, &p
, 0);
499 DEFUN (no_ospf_area_range
,
500 no_ospf_area_range_cmd
,
501 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
503 "OSPF area parameters\n"
504 "OSPF area ID in IP address format\n"
505 "OSPF area ID as a decimal value\n"
506 "Summarize routes matching address/mask (border routers only)\n"
507 "Area range prefix\n")
509 struct ospf
*ospf
= vty
->index
;
510 struct prefix_ipv4 p
;
511 struct in_addr area_id
;
514 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
515 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
517 ospf_area_range_unset (ospf
, area_id
, &p
);
522 ALIAS (no_ospf_area_range
,
523 no_ospf_area_range_advertise_cmd
,
524 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
526 "OSPF area parameters\n"
527 "OSPF area ID in IP address format\n"
528 "OSPF area ID as a decimal value\n"
529 "Summarize routes matching address/mask (border routers only)\n"
530 "Area range prefix\n"
531 "Advertise this range (default)\n"
532 "DoNotAdvertise this range\n")
534 ALIAS (no_ospf_area_range
,
535 no_ospf_area_range_cost_cmd
,
536 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
538 "OSPF area parameters\n"
539 "OSPF area ID in IP address format\n"
540 "OSPF area ID as a decimal value\n"
541 "Summarize routes matching address/mask (border routers only)\n"
542 "Area range prefix\n"
543 "User specified metric for this range\n"
544 "Advertised metric for this range\n")
546 ALIAS (no_ospf_area_range
,
547 no_ospf_area_range_advertise_cost_cmd
,
548 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
550 "OSPF area parameters\n"
551 "OSPF area ID in IP address format\n"
552 "OSPF area ID as a decimal value\n"
553 "Summarize routes matching address/mask (border routers only)\n"
554 "Area range prefix\n"
555 "Advertise this range (default)\n"
556 "User specified metric for this range\n"
557 "Advertised metric for this range\n")
559 DEFUN (ospf_area_range_substitute
,
560 ospf_area_range_substitute_cmd
,
561 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
562 "OSPF area parameters\n"
563 "OSPF area ID in IP address format\n"
564 "OSPF area ID as a decimal value\n"
565 "Summarize routes matching address/mask (border routers only)\n"
566 "Area range prefix\n"
567 "Announce area range as another prefix\n"
568 "Network prefix to be announced instead of range\n")
570 struct ospf
*ospf
= vty
->index
;
571 struct prefix_ipv4 p
, s
;
572 struct in_addr area_id
;
575 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
576 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
577 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
579 ospf_area_range_substitute_set (ospf
, area_id
, &p
, &s
);
584 DEFUN (no_ospf_area_range_substitute
,
585 no_ospf_area_range_substitute_cmd
,
586 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
588 "OSPF area parameters\n"
589 "OSPF area ID in IP address format\n"
590 "OSPF area ID as a decimal value\n"
591 "Summarize routes matching address/mask (border routers only)\n"
592 "Area range prefix\n"
593 "Announce area range as another prefix\n"
594 "Network prefix to be announced instead of range\n")
596 struct ospf
*ospf
= vty
->index
;
597 struct prefix_ipv4 p
, s
;
598 struct in_addr area_id
;
601 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
602 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
603 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
605 ospf_area_range_substitute_unset (ospf
, area_id
, &p
);
611 /* Command Handler Logic in VLink stuff is delicate!!
613 ALTER AT YOUR OWN RISK!!!!
615 Various dummy values are used to represent 'NoChange' state for
616 VLink configuration NOT being changed by a VLink command, and
617 special syntax is used within the command strings so that the
618 typed in command verbs can be seen in the configuration command
619 bacckend handler. This is to drastically reduce the verbeage
620 required to coe up with a reasonably compatible Cisco VLink command
622 - Matthew Grant <grantma@anathoth.gen.nz>
623 Wed, 21 Feb 2001 15:13:52 +1300
627 /* Configuration data for virtual links
629 struct ospf_vl_config_data
{
630 struct vty
*vty
; /* vty stuff */
631 struct in_addr area_id
; /* area ID from command line */
632 int format
; /* command line area ID format */
633 struct in_addr vl_peer
; /* command line vl_peer */
634 int auth_type
; /* Authehntication type, if given */
635 char *auth_key
; /* simple password if present */
636 int crypto_key_id
; /* Cryptographic key ID */
637 char *md5_key
; /* MD5 authentication key */
638 int hello_interval
; /* Obvious what these are... */
639 int retransmit_interval
;
645 ospf_vl_config_data_init (struct ospf_vl_config_data
*vl_config
,
648 memset (vl_config
, 0, sizeof (struct ospf_vl_config_data
));
649 vl_config
->auth_type
= OSPF_AUTH_CMD_NOTSEEN
;
650 vl_config
->vty
= vty
;
653 struct ospf_vl_data
*
654 ospf_find_vl_data (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
656 struct ospf_area
*area
;
657 struct ospf_vl_data
*vl_data
;
659 struct in_addr area_id
;
661 vty
= vl_config
->vty
;
662 area_id
= vl_config
->area_id
;
664 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
667 "Configuring VLs over the backbone is not allowed%s",
671 area
= ospf_area_get (ospf
, area_id
, vl_config
->format
);
673 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
675 if (vl_config
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
676 vty_out (vty
, "Area %s is %s%s",
679 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
682 #endif /* HAVE_NSSA */
685 vty_out (vty
, "Area %ld is %s%s",
686 (u_long
)ntohl (area_id
.s_addr
),
688 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
691 #endif /* HAVE_NSSA */
696 if ((vl_data
= ospf_vl_lookup (area
, vl_config
->vl_peer
)) == NULL
)
698 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
699 if (vl_data
->vl_oi
== NULL
)
701 vl_data
->vl_oi
= ospf_vl_new (ospf
, vl_data
);
702 ospf_vl_add (ospf
, vl_data
);
703 ospf_spf_calculate_schedule (ospf
);
711 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
712 struct ospf_vl_config_data
*vl_config
)
714 struct crypt_key
*ck
;
716 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
718 vty
= vl_config
->vty
;
720 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
722 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
723 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
726 if (vl_config
->auth_key
)
728 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
729 strncpy (IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
730 OSPF_AUTH_SIMPLE_SIZE
);
732 else if (vl_config
->md5_key
)
734 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
737 vty_out (vty
, "OSPF: Key %d already exists%s",
738 vl_config
->crypto_key_id
, VTY_NEWLINE
);
741 ck
= ospf_crypt_key_new ();
742 ck
->key_id
= vl_config
->crypto_key_id
;
743 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
744 strncpy (ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
746 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
748 else if (vl_config
->crypto_key_id
!= 0)
752 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
753 vl_config
->crypto_key_id
) == NULL
)
755 vty_out (vty
, "OSPF: Key %d does not exist%s",
756 vl_config
->crypto_key_id
, VTY_NEWLINE
);
760 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
770 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
771 struct ospf_vl_config_data
*vl_config
)
773 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
774 /* Virtual Link data initialised to defaults, so only set
776 if (vl_config
->hello_interval
)
778 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
779 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
782 if (vl_config
->dead_interval
)
784 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
785 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
788 if (vl_config
->retransmit_interval
)
790 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
791 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
794 if (vl_config
->transmit_delay
)
796 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
797 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
805 /* The business end of all of the above */
807 ospf_vl_set (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
809 struct ospf_vl_data
*vl_data
;
812 vl_data
= ospf_find_vl_data (ospf
, vl_config
);
816 /* Process this one first as it can have a fatal result, which can
817 only logically occur if the virtual link exists already
818 Thus a command error does not result in a change to the
819 running configuration such as unexpectedly altered timer
821 ret
= ospf_vl_set_security (vl_data
, vl_config
);
822 if (ret
!= CMD_SUCCESS
)
825 /* Set any time based parameters, these area already range checked */
827 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
828 if (ret
!= CMD_SUCCESS
)
835 /* This stuff exists to make specifying all the alias commands A LOT simpler
837 #define VLINK_HELPSTR_IPADDR \
838 "OSPF area parameters\n" \
839 "OSPF area ID in IP address format\n" \
840 "OSPF area ID as a decimal value\n" \
841 "Configure a virtual link\n" \
842 "Router ID of the remote ABR\n"
844 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
845 "Enable authentication on this virtual link\n" \
848 #define VLINK_HELPSTR_AUTHTYPE_ALL \
849 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
850 "Use null authentication\n" \
851 "Use message-digest authentication\n"
853 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
854 "Time between HELLO packets\n" \
855 "Time between retransmitting lost link state advertisements\n" \
856 "Link state transmit delay\n" \
857 "Interval after which a neighbor is declared dead\n"
859 #define VLINK_HELPSTR_TIME_PARAM \
860 VLINK_HELPSTR_TIME_PARAM_NOSECS \
863 #define VLINK_HELPSTR_AUTH_SIMPLE \
864 "Authentication password (key)\n" \
865 "The OSPF password (key)"
867 #define VLINK_HELPSTR_AUTH_MD5 \
868 "Message digest authentication password (key)\n" \
871 "Use MD5 algorithm\n" \
872 "The OSPF password (key)"
874 DEFUN (ospf_area_vlink
,
876 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
877 VLINK_HELPSTR_IPADDR
)
879 struct ospf
*ospf
= vty
->index
;
880 struct ospf_vl_config_data vl_config
;
881 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
882 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
886 ospf_vl_config_data_init(&vl_config
, vty
);
888 /* Read off first 2 parameters and check them */
889 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &vl_config
.format
);
892 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
896 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
899 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
906 /* Thats all folks! - BUGS B. strikes again!!!*/
908 return ospf_vl_set (ospf
, &vl_config
);
911 /* Deal with other parameters */
912 for (i
=2; i
< argc
; i
++)
915 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
921 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
923 /* authentication-key - this option can occur anywhere on
924 command line. At start of command line
925 must check for authentication option. */
926 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
927 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
928 vl_config
.auth_key
= auth_key
;
931 else if (strncmp (argv
[i
], "authentication", 14) == 0)
933 /* authentication - this option can only occur at start
935 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
938 if (strncmp (argv
[i
+1], "n", 1) == 0)
940 /* "authentication null" */
941 vl_config
.auth_type
= OSPF_AUTH_NULL
;
944 else if (strncmp (argv
[i
+1], "m", 1) == 0
945 && strcmp (argv
[i
+1], "message-digest-") != 0)
947 /* "authentication message-digest" */
948 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
956 /* message-digest-key */
958 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
959 if (vl_config
.crypto_key_id
< 0)
962 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
963 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
964 vl_config
.md5_key
= md5_key
;
970 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
971 if (vl_config
.hello_interval
< 0)
976 /* Retransmit Interval */
978 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
979 if (vl_config
.retransmit_interval
< 0)
986 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
987 if (vl_config
.transmit_delay
< 0)
994 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
995 if (vl_config
.dead_interval
< 0)
1002 /* Action configuration */
1004 return ospf_vl_set (ospf
, &vl_config
);
1008 DEFUN (no_ospf_area_vlink
,
1009 no_ospf_area_vlink_cmd
,
1010 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1012 VLINK_HELPSTR_IPADDR
)
1014 struct ospf
*ospf
= vty
->index
;
1015 struct ospf_area
*area
;
1016 struct ospf_vl_config_data vl_config
;
1017 struct ospf_vl_data
*vl_data
= NULL
;
1018 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1022 ospf_vl_config_data_init(&vl_config
, vty
);
1024 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &format
);
1027 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1031 area
= ospf_area_lookup_by_area_id (ospf
, vl_config
.area_id
);
1034 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1038 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1041 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1048 /* Basic VLink no command */
1049 /* Thats all folks! - BUGS B. strikes again!!!*/
1050 if ((vl_data
= ospf_vl_lookup (area
, vl_config
.vl_peer
)))
1051 ospf_vl_delete (ospf
, vl_data
);
1053 ospf_area_check_free (ospf
, vl_config
.area_id
);
1058 /* If we are down here, we are reseting parameters */
1060 /* Deal with other parameters */
1061 for (i
=2; i
< argc
; i
++)
1063 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1069 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1071 /* authentication-key - this option can occur anywhere on
1072 command line. At start of command line
1073 must check for authentication option. */
1074 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1075 vl_config
.auth_key
= auth_key
;
1077 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1079 /* authentication - this option can only occur at start
1081 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1086 /* message-digest-key */
1087 /* Delete one key */
1089 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1090 if (vl_config
.crypto_key_id
< 0)
1092 vl_config
.md5_key
= NULL
;
1096 /* Hello interval */
1097 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1101 /* Retransmit Interval */
1102 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1106 /* Transmit Delay */
1107 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1113 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1119 /* Action configuration */
1121 return ospf_vl_set (ospf
, &vl_config
);
1124 ALIAS (ospf_area_vlink
,
1125 ospf_area_vlink_param1_cmd
,
1126 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1127 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1128 VLINK_HELPSTR_IPADDR
1129 VLINK_HELPSTR_TIME_PARAM
)
1131 ALIAS (no_ospf_area_vlink
,
1132 no_ospf_area_vlink_param1_cmd
,
1133 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1134 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1136 VLINK_HELPSTR_IPADDR
1137 VLINK_HELPSTR_TIME_PARAM
)
1139 ALIAS (ospf_area_vlink
,
1140 ospf_area_vlink_param2_cmd
,
1141 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1142 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1143 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1144 VLINK_HELPSTR_IPADDR
1145 VLINK_HELPSTR_TIME_PARAM
1146 VLINK_HELPSTR_TIME_PARAM
)
1148 ALIAS (no_ospf_area_vlink
,
1149 no_ospf_area_vlink_param2_cmd
,
1150 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1151 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1152 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1154 VLINK_HELPSTR_IPADDR
1155 VLINK_HELPSTR_TIME_PARAM
1156 VLINK_HELPSTR_TIME_PARAM
)
1158 ALIAS (ospf_area_vlink
,
1159 ospf_area_vlink_param3_cmd
,
1160 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1161 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1162 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1163 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1164 VLINK_HELPSTR_IPADDR
1165 VLINK_HELPSTR_TIME_PARAM
1166 VLINK_HELPSTR_TIME_PARAM
1167 VLINK_HELPSTR_TIME_PARAM
)
1169 ALIAS (no_ospf_area_vlink
,
1170 no_ospf_area_vlink_param3_cmd
,
1171 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1172 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1173 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1174 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1176 VLINK_HELPSTR_IPADDR
1177 VLINK_HELPSTR_TIME_PARAM
1178 VLINK_HELPSTR_TIME_PARAM
1179 VLINK_HELPSTR_TIME_PARAM
)
1181 ALIAS (ospf_area_vlink
,
1182 ospf_area_vlink_param4_cmd
,
1183 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1184 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1185 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1186 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1187 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1188 VLINK_HELPSTR_IPADDR
1189 VLINK_HELPSTR_TIME_PARAM
1190 VLINK_HELPSTR_TIME_PARAM
1191 VLINK_HELPSTR_TIME_PARAM
1192 VLINK_HELPSTR_TIME_PARAM
)
1194 ALIAS (no_ospf_area_vlink
,
1195 no_ospf_area_vlink_param4_cmd
,
1196 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1197 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1198 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1199 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1200 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1202 VLINK_HELPSTR_IPADDR
1203 VLINK_HELPSTR_TIME_PARAM
1204 VLINK_HELPSTR_TIME_PARAM
1205 VLINK_HELPSTR_TIME_PARAM
1206 VLINK_HELPSTR_TIME_PARAM
)
1208 ALIAS (ospf_area_vlink
,
1209 ospf_area_vlink_authtype_args_cmd
,
1210 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1211 "(authentication|) (message-digest|null)",
1212 VLINK_HELPSTR_IPADDR
1213 VLINK_HELPSTR_AUTHTYPE_ALL
)
1215 ALIAS (ospf_area_vlink
,
1216 ospf_area_vlink_authtype_cmd
,
1217 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1218 "(authentication|)",
1219 VLINK_HELPSTR_IPADDR
1220 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1222 ALIAS (no_ospf_area_vlink
,
1223 no_ospf_area_vlink_authtype_cmd
,
1224 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1225 "(authentication|)",
1227 VLINK_HELPSTR_IPADDR
1228 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1230 ALIAS (ospf_area_vlink
,
1231 ospf_area_vlink_md5_cmd
,
1232 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1233 "(message-digest-key|) <1-255> md5 KEY",
1234 VLINK_HELPSTR_IPADDR
1235 VLINK_HELPSTR_AUTH_MD5
)
1237 ALIAS (no_ospf_area_vlink
,
1238 no_ospf_area_vlink_md5_cmd
,
1239 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1240 "(message-digest-key|) <1-255>",
1242 VLINK_HELPSTR_IPADDR
1243 VLINK_HELPSTR_AUTH_MD5
)
1245 ALIAS (ospf_area_vlink
,
1246 ospf_area_vlink_authkey_cmd
,
1247 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1248 "(authentication-key|) AUTH_KEY",
1249 VLINK_HELPSTR_IPADDR
1250 VLINK_HELPSTR_AUTH_SIMPLE
)
1252 ALIAS (no_ospf_area_vlink
,
1253 no_ospf_area_vlink_authkey_cmd
,
1254 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1255 "(authentication-key|)",
1257 VLINK_HELPSTR_IPADDR
1258 VLINK_HELPSTR_AUTH_SIMPLE
)
1260 ALIAS (ospf_area_vlink
,
1261 ospf_area_vlink_authtype_args_authkey_cmd
,
1262 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1263 "(authentication|) (message-digest|null) "
1264 "(authentication-key|) AUTH_KEY",
1265 VLINK_HELPSTR_IPADDR
1266 VLINK_HELPSTR_AUTHTYPE_ALL
1267 VLINK_HELPSTR_AUTH_SIMPLE
)
1269 ALIAS (ospf_area_vlink
,
1270 ospf_area_vlink_authtype_authkey_cmd
,
1271 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1272 "(authentication|) "
1273 "(authentication-key|) AUTH_KEY",
1274 VLINK_HELPSTR_IPADDR
1275 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1276 VLINK_HELPSTR_AUTH_SIMPLE
)
1278 ALIAS (no_ospf_area_vlink
,
1279 no_ospf_area_vlink_authtype_authkey_cmd
,
1280 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1281 "(authentication|) "
1282 "(authentication-key|)",
1284 VLINK_HELPSTR_IPADDR
1285 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1286 VLINK_HELPSTR_AUTH_SIMPLE
)
1288 ALIAS (ospf_area_vlink
,
1289 ospf_area_vlink_authtype_args_md5_cmd
,
1290 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1291 "(authentication|) (message-digest|null) "
1292 "(message-digest-key|) <1-255> md5 KEY",
1293 VLINK_HELPSTR_IPADDR
1294 VLINK_HELPSTR_AUTHTYPE_ALL
1295 VLINK_HELPSTR_AUTH_MD5
)
1297 ALIAS (ospf_area_vlink
,
1298 ospf_area_vlink_authtype_md5_cmd
,
1299 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1300 "(authentication|) "
1301 "(message-digest-key|) <1-255> md5 KEY",
1302 VLINK_HELPSTR_IPADDR
1303 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1304 VLINK_HELPSTR_AUTH_MD5
)
1306 ALIAS (no_ospf_area_vlink
,
1307 no_ospf_area_vlink_authtype_md5_cmd
,
1308 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1309 "(authentication|) "
1310 "(message-digest-key|)",
1312 VLINK_HELPSTR_IPADDR
1313 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1314 VLINK_HELPSTR_AUTH_MD5
)
1317 DEFUN (ospf_area_shortcut
,
1318 ospf_area_shortcut_cmd
,
1319 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1320 "OSPF area parameters\n"
1321 "OSPF area ID in IP address format\n"
1322 "OSPF area ID as a decimal value\n"
1323 "Configure the area's shortcutting mode\n"
1324 "Set default shortcutting behavior\n"
1325 "Enable shortcutting through the area\n"
1326 "Disable shortcutting through the area\n")
1328 struct ospf
*ospf
= vty
->index
;
1329 struct ospf_area
*area
;
1330 struct in_addr area_id
;
1334 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1336 area
= ospf_area_get (ospf
, area_id
, format
);
1338 if (strncmp (argv
[1], "de", 2) == 0)
1339 mode
= OSPF_SHORTCUT_DEFAULT
;
1340 else if (strncmp (argv
[1], "di", 2) == 0)
1341 mode
= OSPF_SHORTCUT_DISABLE
;
1342 else if (strncmp (argv
[1], "e", 1) == 0)
1343 mode
= OSPF_SHORTCUT_ENABLE
;
1347 ospf_area_shortcut_set (ospf
, area
, mode
);
1349 if (ospf
->abr_type
!= OSPF_ABR_SHORTCUT
)
1350 vty_out (vty
, "Shortcut area setting will take effect "
1351 "only when the router is configured as Shortcut ABR%s",
1357 DEFUN (no_ospf_area_shortcut
,
1358 no_ospf_area_shortcut_cmd
,
1359 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1361 "OSPF area parameters\n"
1362 "OSPF area ID in IP address format\n"
1363 "OSPF area ID as a decimal value\n"
1364 "Deconfigure the area's shortcutting mode\n"
1365 "Deconfigure enabled shortcutting through the area\n"
1366 "Deconfigure disabled shortcutting through the area\n")
1368 struct ospf
*ospf
= vty
->index
;
1369 struct ospf_area
*area
;
1370 struct in_addr area_id
;
1373 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1375 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1379 ospf_area_shortcut_unset (ospf
, area
);
1385 DEFUN (ospf_area_stub
,
1387 "area (A.B.C.D|<0-4294967295>) stub",
1388 "OSPF area parameters\n"
1389 "OSPF area ID in IP address format\n"
1390 "OSPF area ID as a decimal value\n"
1391 "Configure OSPF area as stub\n")
1393 struct ospf
*ospf
= vty
->index
;
1394 struct in_addr area_id
;
1397 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1399 ret
= ospf_area_stub_set (ospf
, area_id
);
1402 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1407 ospf_area_no_summary_unset (ospf
, area_id
);
1412 DEFUN (ospf_area_stub_no_summary
,
1413 ospf_area_stub_no_summary_cmd
,
1414 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1415 "OSPF stub parameters\n"
1416 "OSPF area ID in IP address format\n"
1417 "OSPF area ID as a decimal value\n"
1418 "Configure OSPF area as stub\n"
1419 "Do not inject inter-area routes into stub\n")
1421 struct ospf
*ospf
= vty
->index
;
1422 struct in_addr area_id
;
1425 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1427 ret
= ospf_area_stub_set (ospf
, area_id
);
1430 vty_out (vty
, "%% Area cannot be stub as it contains a virtual link%s",
1435 ospf_area_no_summary_set (ospf
, area_id
);
1440 DEFUN (no_ospf_area_stub
,
1441 no_ospf_area_stub_cmd
,
1442 "no area (A.B.C.D|<0-4294967295>) stub",
1444 "OSPF area parameters\n"
1445 "OSPF area ID in IP address format\n"
1446 "OSPF area ID as a decimal value\n"
1447 "Configure OSPF area as stub\n")
1449 struct ospf
*ospf
= vty
->index
;
1450 struct in_addr area_id
;
1453 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1455 ospf_area_stub_unset (ospf
, area_id
);
1456 ospf_area_no_summary_unset (ospf
, area_id
);
1461 DEFUN (no_ospf_area_stub_no_summary
,
1462 no_ospf_area_stub_no_summary_cmd
,
1463 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1465 "OSPF area parameters\n"
1466 "OSPF area ID in IP address format\n"
1467 "OSPF area ID as a decimal value\n"
1468 "Configure OSPF area as stub\n"
1469 "Do not inject inter-area routes into area\n")
1471 struct ospf
*ospf
= vty
->index
;
1472 struct in_addr area_id
;
1475 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1476 ospf_area_no_summary_unset (ospf
, area_id
);
1483 ospf_area_nssa_cmd_handler (struct vty
*vty
, int argc
, char **argv
, int nosum
)
1485 struct ospf
*ospf
= vty
->index
;
1486 struct in_addr area_id
;
1489 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1491 ret
= ospf_area_nssa_set (ospf
, area_id
);
1494 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1501 if (strncmp (argv
[1], "translate-c", 11) == 0)
1502 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1503 OSPF_NSSA_ROLE_CANDIDATE
);
1504 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1505 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1506 OSPF_NSSA_ROLE_NEVER
);
1507 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1508 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1509 OSPF_NSSA_ROLE_ALWAYS
);
1513 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1514 OSPF_NSSA_ROLE_CANDIDATE
);
1518 ospf_area_no_summary_set (ospf
, area_id
);
1520 ospf_area_no_summary_unset (ospf
, area_id
);
1522 ospf_schedule_abr_task (ospf
);
1527 DEFUN (ospf_area_nssa_translate_no_summary
,
1528 ospf_area_nssa_translate_no_summary_cmd
,
1529 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
1530 "OSPF area parameters\n"
1531 "OSPF area ID in IP address format\n"
1532 "OSPF area ID as a decimal value\n"
1533 "Configure OSPF area as nssa\n"
1534 "Configure NSSA-ABR for translate election (default)\n"
1535 "Configure NSSA-ABR to never translate\n"
1536 "Configure NSSA-ABR to always translate\n"
1537 "Do not inject inter-area routes into nssa\n")
1539 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1542 DEFUN (ospf_area_nssa_translate
,
1543 ospf_area_nssa_translate_cmd
,
1544 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1545 "OSPF area parameters\n"
1546 "OSPF area ID in IP address format\n"
1547 "OSPF area ID as a decimal value\n"
1548 "Configure OSPF area as nssa\n"
1549 "Configure NSSA-ABR for translate election (default)\n"
1550 "Configure NSSA-ABR to never translate\n"
1551 "Configure NSSA-ABR to always translate\n")
1553 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1556 DEFUN (ospf_area_nssa
,
1558 "area (A.B.C.D|<0-4294967295>) nssa",
1559 "OSPF area parameters\n"
1560 "OSPF area ID in IP address format\n"
1561 "OSPF area ID as a decimal value\n"
1562 "Configure OSPF area as nssa\n")
1564 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1567 DEFUN (ospf_area_nssa_no_summary
,
1568 ospf_area_nssa_no_summary_cmd
,
1569 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1570 "OSPF area parameters\n"
1571 "OSPF area ID in IP address format\n"
1572 "OSPF area ID as a decimal value\n"
1573 "Configure OSPF area as nssa\n"
1574 "Do not inject inter-area routes into nssa\n")
1576 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1579 DEFUN (no_ospf_area_nssa
,
1580 no_ospf_area_nssa_cmd
,
1581 "no area (A.B.C.D|<0-4294967295>) nssa",
1583 "OSPF area parameters\n"
1584 "OSPF area ID in IP address format\n"
1585 "OSPF area ID as a decimal value\n"
1586 "Configure OSPF area as nssa\n")
1588 struct ospf
*ospf
= vty
->index
;
1589 struct in_addr area_id
;
1592 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1594 ospf_area_nssa_unset (ospf
, area_id
);
1595 ospf_area_no_summary_unset (ospf
, area_id
);
1597 ospf_schedule_abr_task (ospf
);
1602 DEFUN (no_ospf_area_nssa_no_summary
,
1603 no_ospf_area_nssa_no_summary_cmd
,
1604 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1606 "OSPF area parameters\n"
1607 "OSPF area ID in IP address format\n"
1608 "OSPF area ID as a decimal value\n"
1609 "Configure OSPF area as nssa\n"
1610 "Do not inject inter-area routes into nssa\n")
1612 struct ospf
*ospf
= vty
->index
;
1613 struct in_addr area_id
;
1616 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1617 ospf_area_no_summary_unset (ospf
, area_id
);
1622 #endif /* HAVE_NSSA */
1624 DEFUN (ospf_area_default_cost
,
1625 ospf_area_default_cost_cmd
,
1626 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1627 "OSPF area parameters\n"
1628 "OSPF area ID in IP address format\n"
1629 "OSPF area ID as a decimal value\n"
1630 "Set the summary-default cost of a NSSA or stub area\n"
1631 "Stub's advertised default summary cost\n")
1633 struct ospf
*ospf
= vty
->index
;
1634 struct ospf_area
*area
;
1635 struct in_addr area_id
;
1639 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1640 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1642 area
= ospf_area_get (ospf
, area_id
, format
);
1644 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1646 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1650 area
->default_cost
= cost
;
1655 DEFUN (no_ospf_area_default_cost
,
1656 no_ospf_area_default_cost_cmd
,
1657 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1659 "OSPF area parameters\n"
1660 "OSPF area ID in IP address format\n"
1661 "OSPF area ID as a decimal value\n"
1662 "Set the summary-default cost of a NSSA or stub area\n"
1663 "Stub's advertised default summary cost\n")
1665 struct ospf
*ospf
= vty
->index
;
1666 struct ospf_area
*area
;
1667 struct in_addr area_id
;
1671 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1672 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1674 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1678 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1680 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1684 area
->default_cost
= 1;
1686 ospf_area_check_free (ospf
, area_id
);
1691 DEFUN (ospf_area_export_list
,
1692 ospf_area_export_list_cmd
,
1693 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1694 "OSPF area parameters\n"
1695 "OSPF area ID in IP address format\n"
1696 "OSPF area ID as a decimal value\n"
1697 "Set the filter for networks announced to other areas\n"
1698 "Name of the access-list\n")
1700 struct ospf
*ospf
= vty
->index
;
1701 struct ospf_area
*area
;
1702 struct in_addr area_id
;
1705 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id
, format
, argv
[0]);
1707 area
= ospf_area_get (ospf
, area_id
, format
);
1708 ospf_area_export_list_set (ospf
, area
, argv
[1]);
1713 DEFUN (no_ospf_area_export_list
,
1714 no_ospf_area_export_list_cmd
,
1715 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1717 "OSPF area parameters\n"
1718 "OSPF area ID in IP address format\n"
1719 "OSPF area ID as a decimal value\n"
1720 "Unset the filter for networks announced to other areas\n"
1721 "Name of the access-list\n")
1723 struct ospf
*ospf
= vty
->index
;
1724 struct ospf_area
*area
;
1725 struct in_addr area_id
;
1728 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id
, format
, argv
[0]);
1730 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1734 ospf_area_export_list_unset (ospf
, area
);
1740 DEFUN (ospf_area_import_list
,
1741 ospf_area_import_list_cmd
,
1742 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1743 "OSPF area parameters\n"
1744 "OSPF area ID in IP address format\n"
1745 "OSPF area ID as a decimal value\n"
1746 "Set the filter for networks from other areas announced to the specified one\n"
1747 "Name of the access-list\n")
1749 struct ospf
*ospf
= vty
->index
;
1750 struct ospf_area
*area
;
1751 struct in_addr area_id
;
1754 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id
, format
, argv
[0]);
1756 area
= ospf_area_get (ospf
, area_id
, format
);
1757 ospf_area_import_list_set (ospf
, area
, argv
[1]);
1762 DEFUN (no_ospf_area_import_list
,
1763 no_ospf_area_import_list_cmd
,
1764 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1766 "OSPF area parameters\n"
1767 "OSPF area ID in IP address format\n"
1768 "OSPF area ID as a decimal value\n"
1769 "Unset the filter for networks announced to other areas\n"
1770 "Name of the access-list\n")
1772 struct ospf
*ospf
= vty
->index
;
1773 struct ospf_area
*area
;
1774 struct in_addr area_id
;
1777 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id
, format
, argv
[0]);
1778 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1782 ospf_area_import_list_unset (ospf
, area
);
1787 DEFUN (ospf_area_filter_list
,
1788 ospf_area_filter_list_cmd
,
1789 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1790 "OSPF area parameters\n"
1791 "OSPF area ID in IP address format\n"
1792 "OSPF area ID as a decimal value\n"
1793 "Filter networks between OSPF areas\n"
1794 "Filter prefixes between OSPF areas\n"
1795 "Name of an IP prefix-list\n"
1796 "Filter networks sent to this area\n"
1797 "Filter networks sent from this area\n")
1799 struct ospf
*ospf
= vty
->index
;
1800 struct ospf_area
*area
;
1801 struct in_addr area_id
;
1802 struct prefix_list
*plist
;
1805 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1807 area
= ospf_area_get (ospf
, area_id
, format
);
1808 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1809 if (strncmp (argv
[2], "in", 2) == 0)
1811 PREFIX_LIST_IN (area
) = plist
;
1812 if (PREFIX_NAME_IN (area
))
1813 free (PREFIX_NAME_IN (area
));
1815 PREFIX_NAME_IN (area
) = strdup (argv
[1]);
1816 ospf_schedule_abr_task (ospf
);
1820 PREFIX_LIST_OUT (area
) = plist
;
1821 if (PREFIX_NAME_OUT (area
))
1822 free (PREFIX_NAME_OUT (area
));
1824 PREFIX_NAME_OUT (area
) = strdup (argv
[1]);
1825 ospf_schedule_abr_task (ospf
);
1831 DEFUN (no_ospf_area_filter_list
,
1832 no_ospf_area_filter_list_cmd
,
1833 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1835 "OSPF area parameters\n"
1836 "OSPF area ID in IP address format\n"
1837 "OSPF area ID as a decimal value\n"
1838 "Filter networks between OSPF areas\n"
1839 "Filter prefixes between OSPF areas\n"
1840 "Name of an IP prefix-list\n"
1841 "Filter networks sent to this area\n"
1842 "Filter networks sent from this area\n")
1844 struct ospf
*ospf
= vty
->index
;
1845 struct ospf_area
*area
;
1846 struct in_addr area_id
;
1847 struct prefix_list
*plist
;
1850 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1852 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1853 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1854 if (strncmp (argv
[2], "in", 2) == 0)
1856 if (PREFIX_NAME_IN (area
))
1857 if (strcmp (PREFIX_NAME_IN (area
), argv
[1]) != 0)
1860 PREFIX_LIST_IN (area
) = NULL
;
1861 if (PREFIX_NAME_IN (area
))
1862 free (PREFIX_NAME_IN (area
));
1864 PREFIX_NAME_IN (area
) = NULL
;
1866 ospf_schedule_abr_task (ospf
);
1870 if (PREFIX_NAME_OUT (area
))
1871 if (strcmp (PREFIX_NAME_OUT (area
), argv
[1]) != 0)
1874 PREFIX_LIST_OUT (area
) = NULL
;
1875 if (PREFIX_NAME_OUT (area
))
1876 free (PREFIX_NAME_OUT (area
));
1878 PREFIX_NAME_OUT (area
) = NULL
;
1880 ospf_schedule_abr_task (ospf
);
1887 DEFUN (ospf_area_authentication_message_digest
,
1888 ospf_area_authentication_message_digest_cmd
,
1889 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1890 "OSPF area parameters\n"
1891 "Enable authentication\n"
1892 "Use message-digest authentication\n")
1894 struct ospf
*ospf
= vty
->index
;
1895 struct ospf_area
*area
;
1896 struct in_addr area_id
;
1899 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1901 area
= ospf_area_get (ospf
, area_id
, format
);
1902 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1907 DEFUN (ospf_area_authentication
,
1908 ospf_area_authentication_cmd
,
1909 "area (A.B.C.D|<0-4294967295>) authentication",
1910 "OSPF area parameters\n"
1911 "OSPF area ID in IP address format\n"
1912 "OSPF area ID as a decimal value\n"
1913 "Enable authentication\n")
1915 struct ospf
*ospf
= vty
->index
;
1916 struct ospf_area
*area
;
1917 struct in_addr area_id
;
1920 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1922 area
= ospf_area_get (ospf
, area_id
, format
);
1923 area
->auth_type
= OSPF_AUTH_SIMPLE
;
1928 DEFUN (no_ospf_area_authentication
,
1929 no_ospf_area_authentication_cmd
,
1930 "no area (A.B.C.D|<0-4294967295>) authentication",
1932 "OSPF area parameters\n"
1933 "OSPF area ID in IP address format\n"
1934 "OSPF area ID as a decimal value\n"
1935 "Enable authentication\n")
1937 struct ospf
*ospf
= vty
->index
;
1938 struct ospf_area
*area
;
1939 struct in_addr area_id
;
1942 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1944 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1948 area
->auth_type
= OSPF_AUTH_NULL
;
1950 ospf_area_check_free (ospf
, area_id
);
1956 DEFUN (ospf_abr_type
,
1958 "ospf abr-type (cisco|ibm|shortcut|standard)",
1959 "OSPF specific commands\n"
1960 "Set OSPF ABR type\n"
1961 "Alternative ABR, cisco implementation\n"
1962 "Alternative ABR, IBM implementation\n"
1964 "Standard behavior (RFC2328)\n")
1966 struct ospf
*ospf
= vty
->index
;
1967 u_char abr_type
= OSPF_ABR_UNKNOWN
;
1969 if (strncmp (argv
[0], "c", 1) == 0)
1970 abr_type
= OSPF_ABR_CISCO
;
1971 else if (strncmp (argv
[0], "i", 1) == 0)
1972 abr_type
= OSPF_ABR_IBM
;
1973 else if (strncmp (argv
[0], "sh", 2) == 0)
1974 abr_type
= OSPF_ABR_SHORTCUT
;
1975 else if (strncmp (argv
[0], "st", 2) == 0)
1976 abr_type
= OSPF_ABR_STAND
;
1980 /* If ABR type value is changed, schedule ABR task. */
1981 if (ospf
->abr_type
!= abr_type
)
1983 ospf
->abr_type
= abr_type
;
1984 ospf_schedule_abr_task (ospf
);
1990 DEFUN (no_ospf_abr_type
,
1991 no_ospf_abr_type_cmd
,
1992 "no ospf abr-type (cisco|ibm|shortcut)",
1994 "OSPF specific commands\n"
1995 "Set OSPF ABR type\n"
1996 "Alternative ABR, cisco implementation\n"
1997 "Alternative ABR, IBM implementation\n"
2000 struct ospf
*ospf
= vty
->index
;
2001 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2003 if (strncmp (argv
[0], "c", 1) == 0)
2004 abr_type
= OSPF_ABR_CISCO
;
2005 else if (strncmp (argv
[0], "i", 1) == 0)
2006 abr_type
= OSPF_ABR_IBM
;
2007 else if (strncmp (argv
[0], "s", 1) == 0)
2008 abr_type
= OSPF_ABR_SHORTCUT
;
2012 /* If ABR type value is changed, schedule ABR task. */
2013 if (ospf
->abr_type
== abr_type
)
2015 ospf
->abr_type
= OSPF_ABR_STAND
;
2016 ospf_schedule_abr_task (ospf
);
2022 DEFUN (ospf_compatible_rfc1583
,
2023 ospf_compatible_rfc1583_cmd
,
2024 "compatible rfc1583",
2025 "OSPF compatibility list\n"
2026 "compatible with RFC 1583\n")
2028 struct ospf
*ospf
= vty
->index
;
2030 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2032 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2033 ospf_spf_calculate_schedule (ospf
);
2038 DEFUN (no_ospf_compatible_rfc1583
,
2039 no_ospf_compatible_rfc1583_cmd
,
2040 "no compatible rfc1583",
2042 "OSPF compatibility list\n"
2043 "compatible with RFC 1583\n")
2045 struct ospf
*ospf
= vty
->index
;
2047 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2049 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2050 ospf_spf_calculate_schedule (ospf
);
2055 ALIAS (ospf_compatible_rfc1583
,
2056 ospf_rfc1583_flag_cmd
,
2057 "ospf rfc1583compatibility",
2058 "OSPF specific commands\n"
2059 "Enable the RFC1583Compatibility flag\n")
2061 ALIAS (no_ospf_compatible_rfc1583
,
2062 no_ospf_rfc1583_flag_cmd
,
2063 "no ospf rfc1583compatibility",
2065 "OSPF specific commands\n"
2066 "Disable the RFC1583Compatibility flag\n")
2068 DEFUN (ospf_timers_spf
,
2069 ospf_timers_spf_cmd
,
2070 "timers spf <0-4294967295> <0-4294967295>",
2071 "Adjust routing timers\n"
2073 "Delay between receiving a change to SPF calculation\n"
2074 "Hold time between consecutive SPF calculations\n")
2076 struct ospf
*ospf
= vty
->index
;
2077 u_int32_t delay
, hold
;
2079 VTY_GET_UINT32 ("SPF delay timer", delay
, argv
[0]);
2080 VTY_GET_UINT32 ("SPF hold timer", hold
, argv
[1]);
2082 ospf_timers_spf_set (ospf
, delay
, hold
);
2087 DEFUN (no_ospf_timers_spf
,
2088 no_ospf_timers_spf_cmd
,
2091 "Adjust routing timers\n"
2092 "OSPF SPF timers\n")
2094 struct ospf
*ospf
= vty
->index
;
2096 ospf
->spf_delay
= OSPF_SPF_DELAY_DEFAULT
;
2097 ospf
->spf_holdtime
= OSPF_SPF_HOLDTIME_DEFAULT
;
2103 DEFUN (ospf_neighbor
,
2107 "Neighbor IP address\n")
2109 struct ospf
*ospf
= vty
->index
;
2110 struct in_addr nbr_addr
;
2111 int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2112 int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2114 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2117 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2120 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2122 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2124 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2126 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, priority
);
2131 ALIAS (ospf_neighbor
,
2132 ospf_neighbor_priority_poll_interval_cmd
,
2133 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2135 "Neighbor IP address\n"
2136 "Neighbor Priority\n"
2138 "Dead Neighbor Polling interval\n"
2141 ALIAS (ospf_neighbor
,
2142 ospf_neighbor_priority_cmd
,
2143 "neighbor A.B.C.D priority <0-255>",
2145 "Neighbor IP address\n"
2146 "Neighbor Priority\n"
2149 DEFUN (ospf_neighbor_poll_interval
,
2150 ospf_neighbor_poll_interval_cmd
,
2151 "neighbor A.B.C.D poll-interval <1-65535>",
2153 "Neighbor IP address\n"
2154 "Dead Neighbor Polling interval\n"
2157 struct ospf
*ospf
= vty
->index
;
2158 struct in_addr nbr_addr
;
2159 int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2160 int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2162 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2165 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[1], 1, 65535);
2168 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2170 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2172 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2174 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2179 ALIAS (ospf_neighbor_poll_interval
,
2180 ospf_neighbor_poll_interval_priority_cmd
,
2181 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2183 "Neighbor address\n"
2184 "OSPF dead-router polling interval\n"
2186 "OSPF priority of non-broadcast neighbor\n"
2189 DEFUN (no_ospf_neighbor
,
2190 no_ospf_neighbor_cmd
,
2191 "no neighbor A.B.C.D",
2194 "Neighbor IP address\n")
2196 struct ospf
*ospf
= vty
->index
;
2197 struct in_addr nbr_addr
;
2200 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2202 ret
= ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2207 ALIAS (no_ospf_neighbor
,
2208 no_ospf_neighbor_priority_cmd
,
2209 "no neighbor A.B.C.D priority <0-255>",
2212 "Neighbor IP address\n"
2213 "Neighbor Priority\n"
2216 ALIAS (no_ospf_neighbor
,
2217 no_ospf_neighbor_poll_interval_cmd
,
2218 "no neighbor A.B.C.D poll-interval <1-65535>",
2221 "Neighbor IP address\n"
2222 "Dead Neighbor Polling interval\n"
2225 ALIAS (no_ospf_neighbor
,
2226 no_ospf_neighbor_priority_pollinterval_cmd
,
2227 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2230 "Neighbor IP address\n"
2231 "Neighbor Priority\n"
2233 "Dead Neighbor Polling interval\n"
2237 DEFUN (ospf_refresh_timer
, ospf_refresh_timer_cmd
,
2238 "refresh timer <10-1800>",
2239 "Adjust refresh parameters\n"
2240 "Set refresh timer\n"
2241 "Timer value in seconds\n")
2243 struct ospf
*ospf
= vty
->index
;
2246 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2247 interval
= (interval
/ 10) * 10;
2249 ospf_timers_refresh_set (ospf
, interval
);
2254 DEFUN (no_ospf_refresh_timer
, no_ospf_refresh_timer_val_cmd
,
2255 "no refresh timer <10-1800>",
2256 "Adjust refresh parameters\n"
2257 "Unset refresh timer\n"
2258 "Timer value in seconds\n")
2260 struct ospf
*ospf
= vty
->index
;
2265 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2267 if (ospf
->lsa_refresh_interval
!= interval
||
2268 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2272 ospf_timers_refresh_unset (ospf
);
2277 ALIAS (no_ospf_refresh_timer
,
2278 no_ospf_refresh_timer_cmd
,
2280 "Adjust refresh parameters\n"
2281 "Unset refresh timer\n")
2283 DEFUN (ospf_auto_cost_reference_bandwidth
,
2284 ospf_auto_cost_reference_bandwidth_cmd
,
2285 "auto-cost reference-bandwidth <1-4294967>",
2286 "Calculate OSPF interface cost according to bandwidth\n"
2287 "Use reference bandwidth method to assign OSPF cost\n"
2288 "The reference bandwidth in terms of Mbits per second\n")
2290 struct ospf
*ospf
= vty
->index
;
2294 refbw
= strtol (argv
[0], NULL
, 10);
2295 if (refbw
< 1 || refbw
> 4294967)
2297 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2301 /* If reference bandwidth is changed. */
2302 if ((refbw
* 1000) == ospf
->ref_bandwidth
)
2305 ospf
->ref_bandwidth
= refbw
* 1000;
2306 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2307 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2309 for (node
= listhead (om
->iflist
); node
; nextnode (node
))
2310 ospf_if_recalculate_output_cost (getdata (node
));
2315 DEFUN (no_ospf_auto_cost_reference_bandwidth
,
2316 no_ospf_auto_cost_reference_bandwidth_cmd
,
2317 "no auto-cost reference-bandwidth",
2319 "Calculate OSPF interface cost according to bandwidth\n"
2320 "Use reference bandwidth method to assign OSPF cost\n")
2322 struct ospf
*ospf
= vty
->index
;
2325 if (ospf
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
2328 ospf
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
2329 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2330 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2332 for (node
= listhead (om
->iflist
); node
; nextnode (node
))
2333 ospf_if_recalculate_output_cost (getdata (node
));
2338 char *ospf_abr_type_descr_str
[] =
2341 "Standard (RFC2328)",
2343 "Alternative Cisco",
2344 "Alternative Shortcut"
2347 char *ospf_shortcut_mode_descr_str
[] =
2357 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
)
2360 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
2362 /* Show Area type/mode. */
2363 if (OSPF_IS_AREA_BACKBONE (area
))
2364 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
2367 if (area
->external_routing
== OSPF_AREA_STUB
)
2368 vty_out (vty
, " (Stub%s%s)",
2369 area
->no_summary
? ", no summary" : "",
2370 area
->shortcut_configured
? "; " : "");
2374 else if (area
->external_routing
== OSPF_AREA_NSSA
)
2375 vty_out (vty
, " (NSSA%s%s)",
2376 area
->no_summary
? ", no summary" : "",
2377 area
->shortcut_configured
? "; " : "");
2378 #endif /* HAVE_NSSA */
2380 vty_out (vty
, "%s", VTY_NEWLINE
);
2381 vty_out (vty
, " Shortcutting mode: %s",
2382 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
2383 vty_out (vty
, ", S-bit consensus: %s%s",
2384 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
2387 /* Show number of interfaces. */
2388 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
2389 "Active: %d%s", listcount (area
->oiflist
),
2390 area
->act_ints
, VTY_NEWLINE
);
2393 if (area
->external_routing
== OSPF_AREA_NSSA
)
2395 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
2396 if (! IS_OSPF_ABR (area
->ospf
))
2397 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
2399 else if (area
->NSSATranslatorState
)
2401 vty_out (vty
, " We are an ABR and ");
2402 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2403 vty_out (vty
, "the NSSA Elected Translator. %s",
2405 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
2406 vty_out (vty
, "always an NSSA Translator. %s",
2411 vty_out (vty
, " We are an ABR, but ");
2412 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2413 vty_out (vty
, "not the NSSA Elected Translator. %s",
2416 vty_out (vty
, "not the NSSA Elected Translator. %s",
2420 #endif /* HAVE_NSSA */
2422 /* Show number of fully adjacent neighbors. */
2423 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
2424 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
2426 /* Show authentication type. */
2427 vty_out (vty
, " Area has ");
2428 if (area
->auth_type
== OSPF_AUTH_NULL
)
2429 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
2430 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
2431 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
2432 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
2433 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
2435 if (!OSPF_IS_AREA_BACKBONE (area
))
2436 vty_out (vty
, " Number of full virtual adjacencies going through"
2437 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
2439 /* Show SPF calculation times. */
2440 vty_out (vty
, " SPF algorithm executed %d times%s",
2441 area
->spf_calculation
, VTY_NEWLINE
);
2443 /* Show number of LSA. */
2444 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
2446 vty_out (vty
, "%s", VTY_NEWLINE
);
2449 DEFUN (show_ip_ospf
,
2454 "OSPF information\n")
2457 struct ospf_area
* area
;
2460 /* Check OSPF is enable. */
2461 ospf
= ospf_lookup ();
2464 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2468 /* Show Router ID. */
2469 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
2470 inet_ntoa (ospf
->router_id
),
2473 /* Show capability. */
2474 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
2475 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
2476 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
2477 CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
) ?
2478 "enabled" : "disabled", VTY_NEWLINE
);
2479 #ifdef HAVE_OPAQUE_LSA
2480 vty_out (vty
, " OpaqueCapability flag is %s%s%s",
2481 CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
) ?
2482 "enabled" : "disabled",
2483 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf
->opaque
) ?
2484 " (origination blocked)" : "",
2486 #endif /* HAVE_OPAQUE_LSA */
2488 /* Show SPF timers. */
2489 vty_out (vty
, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s",
2490 ospf
->spf_delay
, ospf
->spf_holdtime
, VTY_NEWLINE
);
2492 /* Show refresh parameters. */
2493 vty_out (vty
, " Refresh timer %d secs%s",
2494 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
2496 /* Show ABR/ASBR flags. */
2497 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
2498 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
2499 ospf_abr_type_descr_str
[ospf
->abr_type
], VTY_NEWLINE
);
2501 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
2502 vty_out (vty
, " This router is an ASBR "
2503 "(injecting external routing information)%s", VTY_NEWLINE
);
2505 /* Show Number of AS-external-LSAs. */
2506 vty_out (vty
, " Number of external LSA %ld%s",
2507 ospf_lsdb_count_all (ospf
->lsdb
), VTY_NEWLINE
);
2509 /* Show number of areas attached. */
2510 vty_out (vty
, " Number of areas attached to this router: %d%s%s",
2511 listcount (ospf
->areas
), VTY_NEWLINE
, VTY_NEWLINE
);
2513 /* Show each area status. */
2514 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
2515 if ((area
= getdata (node
)) != NULL
)
2516 show_ip_ospf_area (vty
, area
);
2523 show_ip_ospf_interface_sub (struct vty
*vty
, struct ospf
*ospf
,
2524 struct interface
*ifp
)
2526 struct ospf_neighbor
*nbr
;
2528 struct route_node
*rn
;
2531 oi_count
= ospf_oi_count (ifp
);
2533 /* Is interface up? */
2534 if (if_is_operative (ifp
)) {
2535 vty_out (vty
, "%s is up%s", ifp
->name
, VTY_NEWLINE
);
2538 vty_out (vty
, "%s is down%s", ifp
->name
, VTY_NEWLINE
);
2542 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2544 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
2549 /* Is interface OSPF enabled? */
2552 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2556 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
2558 struct ospf_interface
*oi
= rn
->info
;
2563 /* Show OSPF interface information. */
2564 vty_out (vty
, " Internet Address %s/%d,",
2565 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
2567 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
2570 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
2571 inet_ntoa (ospf
->router_id
), ospf_network_type_str
[oi
->type
],
2572 oi
->output_cost
, VTY_NEWLINE
);
2574 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
2575 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
2576 PRIORITY (oi
), VTY_NEWLINE
);
2578 /* Show DR information. */
2579 if (DR (oi
).s_addr
== 0)
2580 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2583 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &DR (oi
));
2585 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2588 vty_out (vty
, " Designated Router (ID) %s,",
2589 inet_ntoa (nbr
->router_id
));
2590 vty_out (vty
, " Interface Address %s%s",
2591 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2595 /* Show BDR information. */
2596 if (BDR (oi
).s_addr
== 0)
2597 vty_out (vty
, " No backup designated router on this network%s",
2601 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
2603 vty_out (vty
, " No backup designated router on this network%s",
2607 vty_out (vty
, " Backup Designated Router (ID) %s,",
2608 inet_ntoa (nbr
->router_id
));
2609 vty_out (vty
, " Interface Address %s%s",
2610 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2613 vty_out (vty
, " Timer intervals configured,");
2614 vty_out (vty
, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2615 OSPF_IF_PARAM (oi
, v_hello
), OSPF_IF_PARAM (oi
, v_wait
),
2616 OSPF_IF_PARAM (oi
, v_wait
),
2617 OSPF_IF_PARAM (oi
, retransmit_interval
),
2620 if (OSPF_IF_PARAM (oi
, passive_interface
) == OSPF_IF_ACTIVE
)
2621 vty_out (vty
, " Hello due in %s%s",
2622 ospf_timer_dump (oi
->t_hello
, buf
, 9), VTY_NEWLINE
);
2623 else /* OSPF_IF_PASSIVE is set */
2624 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
2626 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
2627 ospf_nbr_count (oi
, 0), ospf_nbr_count (oi
, NSM_Full
),
2632 DEFUN (show_ip_ospf_interface
,
2633 show_ip_ospf_interface_cmd
,
2634 "show ip ospf interface [INTERFACE]",
2637 "OSPF information\n"
2638 "Interface information\n"
2641 struct interface
*ifp
;
2645 ospf
= ospf_lookup ();
2647 /* Show All Interfaces. */
2649 for (node
= listhead (iflist
); node
; nextnode (node
))
2650 show_ip_ospf_interface_sub (vty
, ospf
, node
->data
);
2651 /* Interface name is specified. */
2654 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
2655 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
2657 show_ip_ospf_interface_sub (vty
, ospf
, ifp
);
2664 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
)
2666 struct route_node
*rn
;
2667 struct ospf_neighbor
*nbr
;
2671 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2672 if ((nbr
= rn
->info
))
2673 /* Do not show myself. */
2674 if (nbr
!= oi
->nbr_self
)
2675 /* Down state is not shown. */
2676 if (nbr
->state
!= NSM_Down
)
2678 ospf_nbr_state_message (nbr
, msgbuf
, 16);
2680 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2681 vty_out (vty
, "%-15s %3d %-15s %8s ",
2683 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2685 vty_out (vty
, "%-15s %3d %-15s %8s ",
2686 inet_ntoa (nbr
->router_id
), nbr
->priority
,
2687 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2688 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
2689 vty_out (vty
, "%-15s %5ld %5ld %5d%s",
2690 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
2691 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
2696 DEFUN (show_ip_ospf_neighbor
,
2697 show_ip_ospf_neighbor_cmd
,
2698 "show ip ospf neighbor",
2701 "OSPF information\n"
2707 ospf
= ospf_lookup ();
2710 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2714 /* Show All neighbors. */
2715 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2716 "Time Address Interface RXmtL "
2717 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2719 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2720 show_ip_ospf_neighbor_sub (vty
, getdata (node
));
2725 DEFUN (show_ip_ospf_neighbor_all
,
2726 show_ip_ospf_neighbor_all_cmd
,
2727 "show ip ospf neighbor all",
2730 "OSPF information\n"
2732 "include down status neighbor\n")
2734 struct ospf
*ospf
= vty
->index
;
2739 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2743 /* Show All neighbors. */
2744 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2745 "Time Address Interface RXmtL "
2746 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2748 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2750 struct ospf_interface
*oi
= getdata (node
);
2753 show_ip_ospf_neighbor_sub (vty
, oi
);
2755 /* print Down neighbor status */
2756 for (nbr_node
= listhead (oi
->nbr_nbma
); nbr_node
; nextnode (nbr_node
))
2758 struct ospf_nbr_nbma
*nbr_nbma
;
2760 nbr_nbma
= getdata (nbr_node
);
2762 if (nbr_nbma
->nbr
== NULL
2763 || nbr_nbma
->nbr
->state
== NSM_Down
)
2765 vty_out (vty
, "%-15s %3d %-15s %8s ",
2766 "-", nbr_nbma
->priority
, "Down", "-");
2767 vty_out (vty
, "%-15s %-15s %5d %5d %5d%s",
2768 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
2769 0, 0, 0, VTY_NEWLINE
);
2777 DEFUN (show_ip_ospf_neighbor_int
,
2778 show_ip_ospf_neighbor_int_cmd
,
2779 "show ip ospf neighbor A.B.C.D",
2782 "OSPF information\n"
2787 struct ospf_interface
*oi
;
2788 struct in_addr addr
;
2791 ret
= inet_aton (argv
[0], &addr
);
2794 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
2799 ospf
= ospf_lookup ();
2802 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2806 if ((oi
= ospf_if_is_configured (ospf
, &addr
)) == NULL
)
2807 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
2810 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2811 "Time Address Interface RXmtL "
2812 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2813 show_ip_ospf_neighbor_sub (vty
, oi
);
2820 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2821 struct ospf_nbr_nbma
*nbr_nbma
)
2825 /* Show neighbor ID. */
2826 vty_out (vty
, " Neighbor %s,", "-");
2828 /* Show interface address. */
2829 vty_out (vty
, " interface address %s%s",
2830 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
2832 vty_out (vty
, " In the area %s via interface %s%s",
2833 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
2834 /* Show neighbor priority and state. */
2835 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2836 nbr_nbma
->priority
, "Down");
2837 /* Show state changes. */
2838 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
2840 /* Show PollInterval */
2841 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
2843 /* Show poll-interval timer. */
2844 vty_out (vty
, " Poll timer due in %s%s",
2845 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, 9), VTY_NEWLINE
);
2847 /* Show poll-interval timer thread. */
2848 vty_out (vty
, " Thread Poll Timer %s%s",
2849 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
2853 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2854 struct ospf_neighbor
*nbr
)
2858 /* Show neighbor ID. */
2859 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2860 vty_out (vty
, " Neighbor %s,", "-");
2862 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
2864 /* Show interface address. */
2865 vty_out (vty
, " interface address %s%s",
2866 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2868 vty_out (vty
, " In the area %s via interface %s%s",
2869 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
2870 /* Show neighbor priority and state. */
2871 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2872 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
2873 /* Show state changes. */
2874 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
2876 /* Show Designated Rotuer ID. */
2877 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
2878 /* Show Backup Designated Rotuer ID. */
2879 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
2881 vty_out (vty
, " Options %d %s%s", nbr
->options
,
2882 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
2883 /* Show Router Dead interval timer. */
2884 vty_out (vty
, " Dead timer due in %s%s",
2885 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9), VTY_NEWLINE
);
2886 /* Show Database Summary list. */
2887 vty_out (vty
, " Database Summary List %d%s",
2888 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
2889 /* Show Link State Request list. */
2890 vty_out (vty
, " Link State Request List %ld%s",
2891 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
2892 /* Show Link State Retransmission list. */
2893 vty_out (vty
, " Link State Retransmission List %ld%s",
2894 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
2895 /* Show inactivity timer thread. */
2896 vty_out (vty
, " Thread Inactivity Timer %s%s",
2897 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
2898 /* Show Database Description retransmission thread. */
2899 vty_out (vty
, " Thread Database Description Retransmision %s%s",
2900 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
2901 /* Show Link State Request Retransmission thread. */
2902 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
2903 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
2904 /* Show Link State Update Retransmission thread. */
2905 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
2906 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
2909 DEFUN (show_ip_ospf_neighbor_id
,
2910 show_ip_ospf_neighbor_id_cmd
,
2911 "show ip ospf neighbor A.B.C.D",
2914 "OSPF information\n"
2920 struct ospf_neighbor
*nbr
;
2921 struct in_addr router_id
;
2924 ret
= inet_aton (argv
[0], &router_id
);
2927 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
2931 ospf
= ospf_lookup ();
2934 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2938 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2940 struct ospf_interface
*oi
= getdata (node
);
2942 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
2944 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2949 /* Nothing to show. */
2953 DEFUN (show_ip_ospf_neighbor_detail
,
2954 show_ip_ospf_neighbor_detail_cmd
,
2955 "show ip ospf neighbor detail",
2958 "OSPF information\n"
2960 "detail of all neighbors\n")
2965 ospf
= ospf_lookup ();
2968 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2972 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2974 struct ospf_interface
*oi
= getdata (node
);
2975 struct route_node
*rn
;
2976 struct ospf_neighbor
*nbr
;
2978 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2979 if ((nbr
= rn
->info
))
2980 if (nbr
!= oi
->nbr_self
)
2981 if (nbr
->state
!= NSM_Down
)
2982 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2988 DEFUN (show_ip_ospf_neighbor_detail_all
,
2989 show_ip_ospf_neighbor_detail_all_cmd
,
2990 "show ip ospf neighbor detail all",
2993 "OSPF information\n"
2995 "detail of all neighbors\n"
2996 "include down status neighbor\n")
3001 ospf
= ospf_lookup ();
3004 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3008 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
3010 struct ospf_interface
*oi
= getdata (node
);
3011 struct route_node
*rn
;
3012 struct ospf_neighbor
*nbr
;
3014 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3015 if ((nbr
= rn
->info
))
3016 if (nbr
!= oi
->nbr_self
)
3017 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
3018 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
);
3020 if (oi
->type
== OSPF_IFTYPE_NBMA
)
3024 for (nd
= listhead (oi
->nbr_nbma
); nd
; nextnode (nd
))
3026 struct ospf_nbr_nbma
*nbr_nbma
= getdata (nd
);
3027 if (nbr_nbma
->nbr
== NULL
3028 || nbr_nbma
->nbr
->state
== NSM_Down
)
3029 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
);
3037 DEFUN (show_ip_ospf_neighbor_int_detail
,
3038 show_ip_ospf_neighbor_int_detail_cmd
,
3039 "show ip ospf neighbor A.B.C.D detail",
3042 "OSPF information\n"
3044 "Interface address\n"
3045 "detail of all neighbors")
3048 struct ospf_interface
*oi
;
3049 struct in_addr addr
;
3052 ret
= inet_aton (argv
[0], &addr
);
3055 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3060 ospf
= ospf_lookup ();
3063 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3067 if ((oi
= ospf_if_is_configured (ospf
, &addr
)) == NULL
)
3068 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
3071 struct route_node
*rn
;
3072 struct ospf_neighbor
*nbr
;
3074 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3075 if ((nbr
= rn
->info
))
3076 if (nbr
!= oi
->nbr_self
)
3077 if (nbr
->state
!= NSM_Down
)
3078 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3085 /* Show functions */
3087 show_lsa_summary (struct vty
*vty
, struct ospf_lsa
*lsa
, int self
)
3089 struct router_lsa
*rl
;
3090 struct summary_lsa
*sl
;
3091 struct as_external_lsa
*asel
;
3092 struct prefix_ipv4 p
;
3095 /* If self option is set, check LSA self flag. */
3096 if (self
== 0 || IS_LSA_SELF (lsa
))
3098 /* LSA common part show. */
3099 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
3100 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
3101 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
3102 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
3103 /* LSA specific part show. */
3104 switch (lsa
->data
->type
)
3106 case OSPF_ROUTER_LSA
:
3107 rl
= (struct router_lsa
*) lsa
->data
;
3108 vty_out (vty
, " %-d", ntohs (rl
->links
));
3110 case OSPF_SUMMARY_LSA
:
3111 sl
= (struct summary_lsa
*) lsa
->data
;
3114 p
.prefix
= sl
->header
.id
;
3115 p
.prefixlen
= ip_masklen (sl
->mask
);
3116 apply_mask_ipv4 (&p
);
3118 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
3120 case OSPF_AS_EXTERNAL_LSA
:
3122 case OSPF_AS_NSSA_LSA
:
3123 #endif /* HAVE_NSSA */
3124 asel
= (struct as_external_lsa
*) lsa
->data
;
3127 p
.prefix
= asel
->header
.id
;
3128 p
.prefixlen
= ip_masklen (asel
->mask
);
3129 apply_mask_ipv4 (&p
);
3131 vty_out (vty
, " %s %s/%d [0x%lx]",
3132 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
3133 inet_ntoa (p
.prefix
), p
.prefixlen
,
3134 (u_long
)ntohl (asel
->e
[0].route_tag
));
3136 case OSPF_NETWORK_LSA
:
3137 case OSPF_ASBR_SUMMARY_LSA
:
3138 #ifdef HAVE_OPAQUE_LSA
3139 case OSPF_OPAQUE_LINK_LSA
:
3140 case OSPF_OPAQUE_AREA_LSA
:
3141 case OSPF_OPAQUE_AS_LSA
:
3142 #endif /* HAVE_OPAQUE_LSA */
3146 vty_out (vty
, VTY_NEWLINE
);
3152 char *show_database_desc
[] =
3155 "Router Link States",
3157 "Summary Link States",
3158 "ASBR-Summary Link States",
3159 "AS External Link States",
3160 #if defined (HAVE_NSSA) || defined (HAVE_OPAQUE_LSA)
3161 "Group Membership LSA",
3162 "NSSA-external Link States",
3163 #endif /* HAVE_NSSA */
3164 #ifdef HAVE_OPAQUE_LSA
3166 "Link-Local Opaque-LSA",
3167 "Area-Local Opaque-LSA",
3168 "AS-external Opaque-LSA",
3169 #endif /* HAVE_OPAQUE_LSA */
3172 #define SHOW_OSPF_COMMON_HEADER \
3173 "Link ID ADV Router Age Seq# CkSum"
3175 char *show_database_header
[] =
3178 "Link ID ADV Router Age Seq# CkSum Link count",
3179 "Link ID ADV Router Age Seq# CkSum",
3180 "Link ID ADV Router Age Seq# CkSum Route",
3181 "Link ID ADV Router Age Seq# CkSum",
3182 "Link ID ADV Router Age Seq# CkSum Route",
3184 " --- header for Group Member ----",
3185 "Link ID ADV Router Age Seq# CkSum Route",
3186 #endif /* HAVE_NSSA */
3187 #ifdef HAVE_OPAQUE_LSA
3191 #endif /* HAVE_NSSA */
3193 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3194 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3195 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3196 #endif /* HAVE_OPAQUE_LSA */
3199 char *show_lsa_flags
[] =
3212 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
3214 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
3216 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
3217 vty_out (vty
, " Options: 0x%-2x : %s%s",
3219 ospf_options_dump(lsa
->data
->options
),
3221 vty_out (vty
, " LS Flags: 0x%-2x %s%s",
3224 ((lsa
->flags
& OSPF_LSA_LOCAL_XLT
) ? "(Translated from Type-7)" : ""),
3227 #endif /* HAVE_NSSA */
3230 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
3232 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
3235 vty_out (vty
, " :%s%s%s%s",
3236 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
3237 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
3238 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
3239 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
3241 vty_out (vty
, "%s", VTY_NEWLINE
);
3243 vty_out (vty
, " LS Type: %s%s",
3244 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3245 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
3246 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3247 vty_out (vty
, " Advertising Router: %s%s",
3248 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3249 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
3251 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
3253 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
3256 char *link_type_desc
[] =
3259 "another Router (point-to-point)",
3260 "a Transit Network",
3265 char *link_id_desc
[] =
3268 "Neighboring Router ID",
3269 "Designated Router address",
3271 "Neighboring Router ID",
3274 char *link_data_desc
[] =
3277 "Router Interface address",
3278 "Router Interface address",
3280 "Router Interface address",
3283 /* Show router-LSA each Link information. */
3285 show_ip_ospf_database_router_links (struct vty
*vty
,
3286 struct router_lsa
*rl
)
3290 len
= ntohs (rl
->header
.length
) - 4;
3291 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
3293 type
= rl
->link
[i
].type
;
3295 vty_out (vty
, " Link connected to: %s%s",
3296 link_type_desc
[type
], VTY_NEWLINE
);
3297 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
3298 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
3299 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
3300 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
3301 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
3302 vty_out (vty
, " TOS 0 Metric: %d%s",
3303 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
3304 vty_out (vty
, "%s", VTY_NEWLINE
);
3308 /* Show router-LSA detail information. */
3310 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3314 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
3316 show_ip_ospf_database_header (vty
, lsa
);
3318 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
3319 VTY_NEWLINE
, VTY_NEWLINE
);
3321 show_ip_ospf_database_router_links (vty
, rl
);
3322 vty_out (vty
, "%s", VTY_NEWLINE
);
3328 /* Show network-LSA detail information. */
3330 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3336 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
3338 show_ip_ospf_database_header (vty
, lsa
);
3340 vty_out (vty
, " Network Mask: /%d%s",
3341 ip_masklen (nl
->mask
), VTY_NEWLINE
);
3343 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
3345 for (i
= 0; length
> 0; i
++, length
-= 4)
3346 vty_out (vty
, " Attached Router: %s%s",
3347 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
3349 vty_out (vty
, "%s", VTY_NEWLINE
);
3355 /* Show summary-LSA detail information. */
3357 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3361 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3363 show_ip_ospf_database_header (vty
, lsa
);
3365 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
3367 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3369 vty_out (vty
, "%s", VTY_NEWLINE
);
3375 /* Show summary-ASBR-LSA detail information. */
3377 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3381 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3383 show_ip_ospf_database_header (vty
, lsa
);
3385 vty_out (vty
, " Network Mask: /%d%s",
3386 ip_masklen (sl
->mask
), VTY_NEWLINE
);
3387 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3389 vty_out (vty
, "%s", VTY_NEWLINE
);
3395 /* Show AS-external-LSA detail information. */
3397 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3401 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3403 show_ip_ospf_database_header (vty
, lsa
);
3405 vty_out (vty
, " Network Mask: /%d%s",
3406 ip_masklen (al
->mask
), VTY_NEWLINE
);
3407 vty_out (vty
, " Metric Type: %s%s",
3408 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3409 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3410 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3411 vty_out (vty
, " Metric: %d%s",
3412 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3413 vty_out (vty
, " Forward Address: %s%s",
3414 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3416 vty_out (vty
, " External Route Tag: %lu%s%s",
3417 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3425 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
3427 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3429 /* show_ip_ospf_database_header (vty, lsa); */
3431 zlog_info( " Network Mask: /%d%s",
3432 ip_masklen (al
->mask
), "\n");
3433 zlog_info( " Metric Type: %s%s",
3434 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3435 "2 (Larger than any link state path)" : "1", "\n");
3436 zlog_info( " TOS: 0%s", "\n");
3437 zlog_info( " Metric: %d%s",
3438 GET_METRIC (al
->e
[0].metric
), "\n");
3439 zlog_info( " Forward Address: %s%s",
3440 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
3442 zlog_info( " External Route Tag: %u%s%s",
3443 ntohl (al
->e
[0].route_tag
), "\n", "\n");
3448 /* Show AS-NSSA-LSA detail information. */
3450 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3454 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3456 show_ip_ospf_database_header (vty
, lsa
);
3458 vty_out (vty
, " Network Mask: /%d%s",
3459 ip_masklen (al
->mask
), VTY_NEWLINE
);
3460 vty_out (vty
, " Metric Type: %s%s",
3461 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3462 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3463 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3464 vty_out (vty
, " Metric: %d%s",
3465 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3466 vty_out (vty
, " NSSA: Forward Address: %s%s",
3467 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3469 vty_out (vty
, " External Route Tag: %u%s%s",
3470 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3476 #endif /* HAVE_NSSA */
3479 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
3484 #ifdef HAVE_OPAQUE_LSA
3486 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3490 show_ip_ospf_database_header (vty
, lsa
);
3491 show_opaque_info_detail (vty
, lsa
);
3493 vty_out (vty
, "%s", VTY_NEWLINE
);
3497 #endif /* HAVE_OPAQUE_LSA */
3499 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
3502 show_router_lsa_detail
,
3503 show_network_lsa_detail
,
3504 show_summary_lsa_detail
,
3505 show_summary_asbr_lsa_detail
,
3506 show_as_external_lsa_detail
,
3509 show_as_nssa_lsa_detail
, /* almost same as external */
3510 #endif /* HAVE_NSSA */
3511 #ifdef HAVE_OPAQUE_LSA
3515 #endif /* HAVE_NSSA */
3517 show_opaque_lsa_detail
,
3518 show_opaque_lsa_detail
,
3519 show_opaque_lsa_detail
,
3520 #endif /* HAVE_OPAQUE_LSA */
3524 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
3525 struct in_addr
*adv_router
)
3527 memset (lp
, 0, sizeof (struct prefix_ls
));
3531 else if (adv_router
== NULL
)
3540 lp
->adv_router
= *adv_router
;
3545 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
3546 struct in_addr
*id
, struct in_addr
*adv_router
)
3548 struct prefix_ls lp
;
3549 struct route_node
*rn
, *start
;
3550 struct ospf_lsa
*lsa
;
3552 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
3553 start
= route_node_get (rt
, (struct prefix
*) &lp
);
3556 route_lock_node (start
);
3557 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
3558 if ((lsa
= rn
->info
))
3560 if (show_function
[lsa
->data
->type
] != NULL
)
3561 show_function
[lsa
->data
->type
] (vty
, lsa
);
3563 route_unlock_node (start
);
3567 /* Show detail LSA information
3568 -- if id is NULL then show all LSAs. */
3570 show_lsa_detail (struct vty
*vty
, struct ospf
*ospf
, int type
,
3571 struct in_addr
*id
, struct in_addr
*adv_router
)
3577 case OSPF_AS_EXTERNAL_LSA
:
3578 #ifdef HAVE_OPAQUE_LSA
3579 case OSPF_OPAQUE_AS_LSA
:
3580 #endif /* HAVE_OPAQUE_LSA */
3581 vty_out (vty
, " %s %s%s",
3582 show_database_desc
[type
],
3583 VTY_NEWLINE
, VTY_NEWLINE
);
3584 show_lsa_detail_proc (vty
, AS_LSDB (ospf
, type
), id
, adv_router
);
3587 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
3589 struct ospf_area
*area
= node
->data
;
3590 vty_out (vty
, "%s %s (Area %s)%s%s",
3591 VTY_NEWLINE
, show_database_desc
[type
],
3592 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3593 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
3600 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
3601 struct in_addr
*adv_router
)
3603 struct route_node
*rn
;
3604 struct ospf_lsa
*lsa
;
3606 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
3607 if ((lsa
= rn
->info
))
3608 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
3611 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3613 #endif /* HAVE_NSSA */
3614 if (show_function
[lsa
->data
->type
] != NULL
)
3615 show_function
[lsa
->data
->type
] (vty
, lsa
);
3619 /* Show detail LSA information. */
3621 show_lsa_detail_adv_router (struct vty
*vty
, struct ospf
*ospf
, int type
,
3622 struct in_addr
*adv_router
)
3628 case OSPF_AS_EXTERNAL_LSA
:
3629 #ifdef HAVE_OPAQUE_LSA
3630 case OSPF_OPAQUE_AS_LSA
:
3631 #endif /* HAVE_OPAQUE_LSA */
3632 vty_out (vty
, " %s %s%s",
3633 show_database_desc
[type
],
3634 VTY_NEWLINE
, VTY_NEWLINE
);
3635 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf
, type
),
3639 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
3641 struct ospf_area
*area
= node
->data
;
3642 vty_out (vty
, "%s %s (Area %s)%s%s",
3643 VTY_NEWLINE
, show_database_desc
[type
],
3644 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3645 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
3653 show_ip_ospf_database_summary (struct vty
*vty
, struct ospf
*ospf
, int self
)
3655 struct ospf_lsa
*lsa
;
3656 struct route_node
*rn
;
3660 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
3662 struct ospf_area
*area
= node
->data
;
3663 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3667 case OSPF_AS_EXTERNAL_LSA
:
3668 #ifdef HAVE_OPAQUE_LSA
3669 case OSPF_OPAQUE_AS_LSA
:
3670 #endif /* HAVE_OPAQUE_LSA */
3675 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
3676 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
3678 vty_out (vty
, " %s (Area %s)%s%s",
3679 show_database_desc
[type
],
3680 ospf_area_desc_string (area
),
3681 VTY_NEWLINE
, VTY_NEWLINE
);
3682 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
3684 LSDB_LOOP (AREA_LSDB (area
, type
), rn
, lsa
)
3685 show_lsa_summary (vty
, lsa
, self
);
3687 vty_out (vty
, "%s", VTY_NEWLINE
);
3692 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3696 case OSPF_AS_EXTERNAL_LSA
:
3697 #ifdef HAVE_OPAQUE_LSA
3698 case OSPF_OPAQUE_AS_LSA
:
3699 #endif /* HAVE_OPAQUE_LSA */
3704 if (ospf_lsdb_count_self (ospf
->lsdb
, type
) ||
3705 (!self
&& ospf_lsdb_count (ospf
->lsdb
, type
)))
3707 vty_out (vty
, " %s%s%s",
3708 show_database_desc
[type
],
3709 VTY_NEWLINE
, VTY_NEWLINE
);
3710 vty_out (vty
, "%s%s", show_database_header
[type
],
3713 LSDB_LOOP (AS_LSDB (ospf
, type
), rn
, lsa
)
3714 show_lsa_summary (vty
, lsa
, self
);
3716 vty_out (vty
, "%s", VTY_NEWLINE
);
3720 vty_out (vty
, "%s", VTY_NEWLINE
);
3724 show_ip_ospf_database_maxage (struct vty
*vty
, struct ospf
*ospf
)
3727 struct ospf_lsa
*lsa
;
3729 vty_out (vty
, "%s MaxAge Link States:%s%s",
3730 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
3732 for (node
= listhead (ospf
->maxage_lsa
); node
; nextnode (node
))
3733 if ((lsa
= node
->data
) != NULL
)
3735 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
3736 vty_out (vty
, "Link State ID: %s%s",
3737 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
3738 vty_out (vty
, "Advertising Router: %s%s",
3739 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3740 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
3741 vty_out (vty
, "%s", VTY_NEWLINE
);
3746 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3747 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3748 #else /* HAVE_NSSA */
3749 #define OSPF_LSA_TYPE_NSSA_DESC ""
3750 #define OSPF_LSA_TYPE_NSSA_CMD_STR ""
3751 #endif /* HAVE_NSSA */
3753 #ifdef HAVE_OPAQUE_LSA
3754 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3755 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3756 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3757 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3758 #else /* HAVE_OPAQUE_LSA */
3759 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3760 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3761 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3762 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3763 #endif /* HAVE_OPAQUE_LSA */
3765 #define OSPF_LSA_TYPES_CMD_STR \
3766 "asbr-summary|external|network|router|summary" \
3767 OSPF_LSA_TYPE_NSSA_CMD_STR \
3768 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3770 #define OSPF_LSA_TYPES_DESC \
3771 "ASBR summary link states\n" \
3772 "External link states\n" \
3773 "Network link states\n" \
3774 "Router link states\n" \
3775 "Network summary link states\n" \
3776 OSPF_LSA_TYPE_NSSA_DESC \
3777 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3778 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3779 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3781 DEFUN (show_ip_ospf_database
,
3782 show_ip_ospf_database_cmd
,
3783 "show ip ospf database",
3786 "OSPF information\n"
3787 "Database summary\n")
3791 struct in_addr id
, adv_router
;
3793 ospf
= ospf_lookup ();
3797 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3798 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3803 show_ip_ospf_database_summary (vty
, ospf
, 0);
3807 /* Set database type to show. */
3808 if (strncmp (argv
[0], "r", 1) == 0)
3809 type
= OSPF_ROUTER_LSA
;
3810 else if (strncmp (argv
[0], "ne", 2) == 0)
3811 type
= OSPF_NETWORK_LSA
;
3813 else if (strncmp (argv
[0], "ns", 2) == 0)
3814 type
= OSPF_AS_NSSA_LSA
;
3815 #endif /* HAVE_NSSA */
3816 else if (strncmp (argv
[0], "su", 2) == 0)
3817 type
= OSPF_SUMMARY_LSA
;
3818 else if (strncmp (argv
[0], "a", 1) == 0)
3819 type
= OSPF_ASBR_SUMMARY_LSA
;
3820 else if (strncmp (argv
[0], "e", 1) == 0)
3821 type
= OSPF_AS_EXTERNAL_LSA
;
3822 else if (strncmp (argv
[0], "se", 2) == 0)
3824 show_ip_ospf_database_summary (vty
, ospf
, 1);
3827 else if (strncmp (argv
[0], "m", 1) == 0)
3829 show_ip_ospf_database_maxage (vty
, ospf
);
3832 #ifdef HAVE_OPAQUE_LSA
3833 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3834 type
= OSPF_OPAQUE_LINK_LSA
;
3835 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3836 type
= OSPF_OPAQUE_AREA_LSA
;
3837 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3838 type
= OSPF_OPAQUE_AS_LSA
;
3839 #endif /* HAVE_OPAQUE_LSA */
3843 /* `show ip ospf database LSA'. */
3845 show_lsa_detail (vty
, ospf
, type
, NULL
, NULL
);
3848 ret
= inet_aton (argv
[1], &id
);
3852 /* `show ip ospf database LSA ID'. */
3854 show_lsa_detail (vty
, ospf
, type
, &id
, NULL
);
3855 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3858 if (strncmp (argv
[2], "s", 1) == 0)
3859 adv_router
= ospf
->router_id
;
3862 ret
= inet_aton (argv
[2], &adv_router
);
3866 show_lsa_detail (vty
, ospf
, type
, &id
, &adv_router
);
3873 ALIAS (show_ip_ospf_database
,
3874 show_ip_ospf_database_type_cmd
,
3875 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
3878 "OSPF information\n"
3879 "Database summary\n"
3881 "LSAs in MaxAge list\n"
3882 "Self-originated link states\n")
3884 ALIAS (show_ip_ospf_database
,
3885 show_ip_ospf_database_type_id_cmd
,
3886 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
3889 "OSPF information\n"
3890 "Database summary\n"
3892 "Link State ID (as an IP address)\n")
3894 ALIAS (show_ip_ospf_database
,
3895 show_ip_ospf_database_type_id_adv_router_cmd
,
3896 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
3899 "OSPF information\n"
3900 "Database summary\n"
3902 "Link State ID (as an IP address)\n"
3903 "Advertising Router link states\n"
3904 "Advertising Router (as an IP address)\n")
3906 ALIAS (show_ip_ospf_database
,
3907 show_ip_ospf_database_type_id_self_cmd
,
3908 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
3911 "OSPF information\n"
3912 "Database summary\n"
3914 "Link State ID (as an IP address)\n"
3915 "Self-originated link states\n"
3918 DEFUN (show_ip_ospf_database_type_adv_router
,
3919 show_ip_ospf_database_type_adv_router_cmd
,
3920 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
3923 "OSPF information\n"
3924 "Database summary\n"
3926 "Advertising Router link states\n"
3927 "Advertising Router (as an IP address)\n")
3931 struct in_addr adv_router
;
3933 ospf
= ospf_lookup ();
3937 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3938 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3943 /* Set database type to show. */
3944 if (strncmp (argv
[0], "r", 1) == 0)
3945 type
= OSPF_ROUTER_LSA
;
3946 else if (strncmp (argv
[0], "ne", 2) == 0)
3947 type
= OSPF_NETWORK_LSA
;
3949 else if (strncmp (argv
[0], "ns", 2) == 0)
3950 type
= OSPF_AS_NSSA_LSA
;
3951 #endif /* HAVE_NSSA */
3952 else if (strncmp (argv
[0], "s", 1) == 0)
3953 type
= OSPF_SUMMARY_LSA
;
3954 else if (strncmp (argv
[0], "a", 1) == 0)
3955 type
= OSPF_ASBR_SUMMARY_LSA
;
3956 else if (strncmp (argv
[0], "e", 1) == 0)
3957 type
= OSPF_AS_EXTERNAL_LSA
;
3958 #ifdef HAVE_OPAQUE_LSA
3959 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3960 type
= OSPF_OPAQUE_LINK_LSA
;
3961 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3962 type
= OSPF_OPAQUE_AREA_LSA
;
3963 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3964 type
= OSPF_OPAQUE_AS_LSA
;
3965 #endif /* HAVE_OPAQUE_LSA */
3969 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3970 if (strncmp (argv
[1], "s", 1) == 0)
3971 adv_router
= ospf
->router_id
;
3974 ret
= inet_aton (argv
[1], &adv_router
);
3979 show_lsa_detail_adv_router (vty
, ospf
, type
, &adv_router
);
3984 ALIAS (show_ip_ospf_database_type_adv_router
,
3985 show_ip_ospf_database_type_self_cmd
,
3986 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
3989 "OSPF information\n"
3990 "Database summary\n"
3992 "Self-originated link states\n")
3995 DEFUN (ip_ospf_authentication_args
,
3996 ip_ospf_authentication_args_addr_cmd
,
3997 "ip ospf authentication (null|message-digest) A.B.C.D",
3999 "OSPF interface commands\n"
4000 "Enable authentication on this interface\n"
4001 "Use null authentication\n"
4002 "Use message-digest authentication\n"
4003 "Address of interface")
4005 struct interface
*ifp
;
4006 struct in_addr addr
;
4008 struct ospf_if_params
*params
;
4011 params
= IF_DEF_PARAMS (ifp
);
4015 ret
= inet_aton(argv
[1], &addr
);
4018 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4023 params
= ospf_get_if_params (ifp
, addr
);
4024 ospf_if_update_params (ifp
, addr
);
4027 /* Handle null authentication */
4028 if ( argv
[0][0] == 'n' )
4030 SET_IF_PARAM (params
, auth_type
);
4031 params
->auth_type
= OSPF_AUTH_NULL
;
4035 /* Handle message-digest authentication */
4036 if ( argv
[0][0] == 'm' )
4038 SET_IF_PARAM (params
, auth_type
);
4039 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
4043 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
4047 ALIAS (ip_ospf_authentication_args
,
4048 ip_ospf_authentication_args_cmd
,
4049 "ip ospf authentication (null|message-digest)",
4051 "OSPF interface commands\n"
4052 "Enable authentication on this interface\n"
4053 "Use null authentication\n"
4054 "Use message-digest authentication\n")
4056 DEFUN (ip_ospf_authentication
,
4057 ip_ospf_authentication_addr_cmd
,
4058 "ip ospf authentication A.B.C.D",
4060 "OSPF interface commands\n"
4061 "Enable authentication on this interface\n"
4062 "Address of interface")
4064 struct interface
*ifp
;
4065 struct in_addr addr
;
4067 struct ospf_if_params
*params
;
4070 params
= IF_DEF_PARAMS (ifp
);
4074 ret
= inet_aton(argv
[1], &addr
);
4077 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4082 params
= ospf_get_if_params (ifp
, addr
);
4083 ospf_if_update_params (ifp
, addr
);
4086 SET_IF_PARAM (params
, auth_type
);
4087 params
->auth_type
= OSPF_AUTH_SIMPLE
;
4092 ALIAS (ip_ospf_authentication
,
4093 ip_ospf_authentication_cmd
,
4094 "ip ospf authentication",
4096 "OSPF interface commands\n"
4097 "Enable authentication on this interface\n")
4099 DEFUN (no_ip_ospf_authentication
,
4100 no_ip_ospf_authentication_addr_cmd
,
4101 "no ip ospf authentication A.B.C.D",
4104 "OSPF interface commands\n"
4105 "Enable authentication on this interface\n"
4106 "Address of interface")
4108 struct interface
*ifp
;
4109 struct in_addr addr
;
4111 struct ospf_if_params
*params
;
4114 params
= IF_DEF_PARAMS (ifp
);
4118 ret
= inet_aton(argv
[1], &addr
);
4121 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4126 params
= ospf_lookup_if_params (ifp
, addr
);
4131 params
->auth_type
= OSPF_AUTH_NOTSET
;
4132 UNSET_IF_PARAM (params
, auth_type
);
4134 if (params
!= IF_DEF_PARAMS (ifp
))
4136 ospf_free_if_params (ifp
, addr
);
4137 ospf_if_update_params (ifp
, addr
);
4143 ALIAS (no_ip_ospf_authentication
,
4144 no_ip_ospf_authentication_cmd
,
4145 "no ip ospf authentication",
4148 "OSPF interface commands\n"
4149 "Enable authentication on this interface\n")
4151 DEFUN (ip_ospf_authentication_key
,
4152 ip_ospf_authentication_key_addr_cmd
,
4153 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4155 "OSPF interface commands\n"
4156 "Authentication password (key)\n"
4157 "The OSPF password (key)\n"
4158 "Address of interface")
4160 struct interface
*ifp
;
4161 struct in_addr addr
;
4163 struct ospf_if_params
*params
;
4166 params
= IF_DEF_PARAMS (ifp
);
4170 ret
= inet_aton(argv
[1], &addr
);
4173 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4178 params
= ospf_get_if_params (ifp
, addr
);
4179 ospf_if_update_params (ifp
, addr
);
4183 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
4184 strncpy (params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
4185 SET_IF_PARAM (params
, auth_simple
);
4190 ALIAS (ip_ospf_authentication_key
,
4191 ip_ospf_authentication_key_cmd
,
4192 "ip ospf authentication-key AUTH_KEY",
4194 "OSPF interface commands\n"
4195 "Authentication password (key)\n"
4196 "The OSPF password (key)")
4198 ALIAS (ip_ospf_authentication_key
,
4199 ospf_authentication_key_cmd
,
4200 "ospf authentication-key AUTH_KEY",
4201 "OSPF interface commands\n"
4202 "Authentication password (key)\n"
4203 "The OSPF password (key)")
4205 DEFUN (no_ip_ospf_authentication_key
,
4206 no_ip_ospf_authentication_key_addr_cmd
,
4207 "no ip ospf authentication-key A.B.C.D",
4210 "OSPF interface commands\n"
4211 "Authentication password (key)\n"
4212 "Address of interface")
4214 struct interface
*ifp
;
4215 struct in_addr addr
;
4217 struct ospf_if_params
*params
;
4220 params
= IF_DEF_PARAMS (ifp
);
4224 ret
= inet_aton(argv
[1], &addr
);
4227 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4232 params
= ospf_lookup_if_params (ifp
, addr
);
4237 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
4238 UNSET_IF_PARAM (params
, auth_simple
);
4240 if (params
!= IF_DEF_PARAMS (ifp
))
4242 ospf_free_if_params (ifp
, addr
);
4243 ospf_if_update_params (ifp
, addr
);
4249 ALIAS (no_ip_ospf_authentication_key
,
4250 no_ip_ospf_authentication_key_cmd
,
4251 "no ip ospf authentication-key",
4254 "OSPF interface commands\n"
4255 "Authentication password (key)\n")
4257 ALIAS (no_ip_ospf_authentication_key
,
4258 no_ospf_authentication_key_cmd
,
4259 "no ospf authentication-key",
4261 "OSPF interface commands\n"
4262 "Authentication password (key)\n")
4264 DEFUN (ip_ospf_message_digest_key
,
4265 ip_ospf_message_digest_key_addr_cmd
,
4266 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4268 "OSPF interface commands\n"
4269 "Message digest authentication password (key)\n"
4271 "Use MD5 algorithm\n"
4272 "The OSPF password (key)"
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
[2], &addr
);
4290 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4295 params
= ospf_get_if_params (ifp
, addr
);
4296 ospf_if_update_params (ifp
, addr
);
4299 key_id
= strtol (argv
[0], NULL
, 10);
4300 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
4302 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
4306 ck
= ospf_crypt_key_new ();
4307 ck
->key_id
= (u_char
) key_id
;
4308 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
4309 strncpy (ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
4311 ospf_crypt_key_add (params
->auth_crypt
, ck
);
4312 SET_IF_PARAM (params
, auth_crypt
);
4317 ALIAS (ip_ospf_message_digest_key
,
4318 ip_ospf_message_digest_key_cmd
,
4319 "ip ospf message-digest-key <1-255> md5 KEY",
4321 "OSPF interface commands\n"
4322 "Message digest authentication password (key)\n"
4324 "Use MD5 algorithm\n"
4325 "The OSPF password (key)")
4327 ALIAS (ip_ospf_message_digest_key
,
4328 ospf_message_digest_key_cmd
,
4329 "ospf message-digest-key <1-255> md5 KEY",
4330 "OSPF interface commands\n"
4331 "Message digest authentication password (key)\n"
4333 "Use MD5 algorithm\n"
4334 "The OSPF password (key)")
4336 DEFUN (no_ip_ospf_message_digest_key
,
4337 no_ip_ospf_message_digest_key_addr_cmd
,
4338 "no ip ospf message-digest-key <1-255> A.B.C.D",
4341 "OSPF interface commands\n"
4342 "Message digest authentication password (key)\n"
4344 "Address of interface")
4346 struct interface
*ifp
;
4347 struct crypt_key
*ck
;
4349 struct in_addr addr
;
4351 struct ospf_if_params
*params
;
4354 params
= IF_DEF_PARAMS (ifp
);
4358 ret
= inet_aton(argv
[1], &addr
);
4361 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4366 params
= ospf_lookup_if_params (ifp
, addr
);
4371 key_id
= strtol (argv
[0], NULL
, 10);
4372 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
4375 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
4379 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
4381 if (params
!= IF_DEF_PARAMS (ifp
))
4383 ospf_free_if_params (ifp
, addr
);
4384 ospf_if_update_params (ifp
, addr
);
4390 ALIAS (no_ip_ospf_message_digest_key
,
4391 no_ip_ospf_message_digest_key_cmd
,
4392 "no ip ospf message-digest-key <1-255>",
4395 "OSPF interface commands\n"
4396 "Message digest authentication password (key)\n"
4399 ALIAS (no_ip_ospf_message_digest_key
,
4400 no_ospf_message_digest_key_cmd
,
4401 "no ospf message-digest-key <1-255>",
4403 "OSPF interface commands\n"
4404 "Message digest authentication password (key)\n"
4407 DEFUN (ip_ospf_cost
,
4408 ip_ospf_cost_addr_cmd
,
4409 "ip ospf cost <1-65535> A.B.C.D",
4411 "OSPF interface commands\n"
4414 "Address of interface")
4416 struct interface
*ifp
= vty
->index
;
4418 struct in_addr addr
;
4420 struct ospf_if_params
*params
;
4422 params
= IF_DEF_PARAMS (ifp
);
4424 cost
= strtol (argv
[0], NULL
, 10);
4426 /* cost range is <1-65535>. */
4427 if (cost
< 1 || cost
> 65535)
4429 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4435 ret
= inet_aton(argv
[1], &addr
);
4438 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4443 params
= ospf_get_if_params (ifp
, addr
);
4444 ospf_if_update_params (ifp
, addr
);
4447 SET_IF_PARAM (params
, output_cost_cmd
);
4448 params
->output_cost_cmd
= cost
;
4450 ospf_if_recalculate_output_cost (ifp
);
4455 ALIAS (ip_ospf_cost
,
4457 "ip ospf cost <1-65535>",
4459 "OSPF interface commands\n"
4463 ALIAS (ip_ospf_cost
,
4465 "ospf cost <1-65535>",
4466 "OSPF interface commands\n"
4470 DEFUN (no_ip_ospf_cost
,
4471 no_ip_ospf_cost_addr_cmd
,
4472 "no ip ospf cost A.B.C.D",
4475 "OSPF interface commands\n"
4477 "Address of interface")
4479 struct interface
*ifp
= vty
->index
;
4480 struct in_addr addr
;
4482 struct ospf_if_params
*params
;
4485 params
= IF_DEF_PARAMS (ifp
);
4489 ret
= inet_aton(argv
[0], &addr
);
4492 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4497 params
= ospf_lookup_if_params (ifp
, addr
);
4502 UNSET_IF_PARAM (params
, output_cost_cmd
);
4504 if (params
!= IF_DEF_PARAMS (ifp
))
4506 ospf_free_if_params (ifp
, addr
);
4507 ospf_if_update_params (ifp
, addr
);
4510 ospf_if_recalculate_output_cost (ifp
);
4515 ALIAS (no_ip_ospf_cost
,
4516 no_ip_ospf_cost_cmd
,
4520 "OSPF interface commands\n"
4523 ALIAS (no_ip_ospf_cost
,
4527 "OSPF interface commands\n"
4531 ospf_nbr_timer_update (struct ospf_interface
*oi
)
4533 struct route_node
*rn
;
4534 struct ospf_neighbor
*nbr
;
4536 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4537 if ((nbr
= rn
->info
))
4539 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
4540 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4541 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4542 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4546 DEFUN (ip_ospf_dead_interval
,
4547 ip_ospf_dead_interval_addr_cmd
,
4548 "ip ospf dead-interval <1-65535> A.B.C.D",
4550 "OSPF interface commands\n"
4551 "Interval after which a neighbor is declared dead\n"
4553 "Address of interface")
4555 struct interface
*ifp
= vty
->index
;
4557 struct in_addr addr
;
4559 struct ospf_if_params
*params
;
4560 struct ospf_interface
*oi
;
4561 struct route_node
*rn
;
4564 ospf
= ospf_lookup ();
4566 params
= IF_DEF_PARAMS (ifp
);
4568 seconds
= strtol (argv
[0], NULL
, 10);
4570 /* dead_interval range is <1-65535>. */
4571 if (seconds
< 1 || seconds
> 65535)
4573 vty_out (vty
, "Router Dead Interval is invalid%s", VTY_NEWLINE
);
4579 ret
= inet_aton(argv
[1], &addr
);
4582 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4587 params
= ospf_get_if_params (ifp
, addr
);
4588 ospf_if_update_params (ifp
, addr
);
4591 SET_IF_PARAM (params
, v_wait
);
4592 params
->v_wait
= seconds
;
4594 /* Update timer values in neighbor structure. */
4599 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
4601 ospf_nbr_timer_update (oi
);
4606 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4607 if ((oi
= rn
->info
))
4608 ospf_nbr_timer_update (oi
);
4614 ALIAS (ip_ospf_dead_interval
,
4615 ip_ospf_dead_interval_cmd
,
4616 "ip ospf dead-interval <1-65535>",
4618 "OSPF interface commands\n"
4619 "Interval after which a neighbor is declared dead\n"
4622 ALIAS (ip_ospf_dead_interval
,
4623 ospf_dead_interval_cmd
,
4624 "ospf dead-interval <1-65535>",
4625 "OSPF interface commands\n"
4626 "Interval after which a neighbor is declared dead\n"
4629 DEFUN (no_ip_ospf_dead_interval
,
4630 no_ip_ospf_dead_interval_addr_cmd
,
4631 "no ip ospf dead-interval A.B.C.D",
4634 "OSPF interface commands\n"
4635 "Interval after which a neighbor is declared dead\n"
4636 "Address of interface")
4638 struct interface
*ifp
= vty
->index
;
4639 struct in_addr addr
;
4641 struct ospf_if_params
*params
;
4642 struct ospf_interface
*oi
;
4643 struct route_node
*rn
;
4646 ospf
= ospf_lookup ();
4649 params
= IF_DEF_PARAMS (ifp
);
4653 ret
= inet_aton(argv
[0], &addr
);
4656 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4661 params
= ospf_lookup_if_params (ifp
, addr
);
4666 UNSET_IF_PARAM (params
, v_wait
);
4667 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4669 if (params
!= IF_DEF_PARAMS (ifp
))
4671 ospf_free_if_params (ifp
, addr
);
4672 ospf_if_update_params (ifp
, addr
);
4675 /* Update timer values in neighbor structure. */
4680 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
4682 ospf_nbr_timer_update (oi
);
4687 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4688 if ((oi
= rn
->info
))
4689 ospf_nbr_timer_update (oi
);
4695 ALIAS (no_ip_ospf_dead_interval
,
4696 no_ip_ospf_dead_interval_cmd
,
4697 "no ip ospf dead-interval",
4700 "OSPF interface commands\n"
4701 "Interval after which a neighbor is declared dead\n")
4703 ALIAS (no_ip_ospf_dead_interval
,
4704 no_ospf_dead_interval_cmd
,
4705 "no ospf dead-interval",
4707 "OSPF interface commands\n"
4708 "Interval after which a neighbor is declared dead\n")
4710 DEFUN (ip_ospf_hello_interval
,
4711 ip_ospf_hello_interval_addr_cmd
,
4712 "ip ospf hello-interval <1-65535> A.B.C.D",
4714 "OSPF interface commands\n"
4715 "Time between HELLO packets\n"
4717 "Address of interface")
4719 struct interface
*ifp
= vty
->index
;
4721 struct in_addr addr
;
4723 struct ospf_if_params
*params
;
4725 params
= IF_DEF_PARAMS (ifp
);
4727 seconds
= strtol (argv
[0], NULL
, 10);
4729 /* HelloInterval range is <1-65535>. */
4730 if (seconds
< 1 || seconds
> 65535)
4732 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
4738 ret
= inet_aton(argv
[1], &addr
);
4741 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4746 params
= ospf_get_if_params (ifp
, addr
);
4747 ospf_if_update_params (ifp
, addr
);
4750 SET_IF_PARAM (params
, v_hello
);
4751 params
->v_hello
= seconds
;
4756 ALIAS (ip_ospf_hello_interval
,
4757 ip_ospf_hello_interval_cmd
,
4758 "ip ospf hello-interval <1-65535>",
4760 "OSPF interface commands\n"
4761 "Time between HELLO packets\n"
4764 ALIAS (ip_ospf_hello_interval
,
4765 ospf_hello_interval_cmd
,
4766 "ospf hello-interval <1-65535>",
4767 "OSPF interface commands\n"
4768 "Time between HELLO packets\n"
4771 DEFUN (no_ip_ospf_hello_interval
,
4772 no_ip_ospf_hello_interval_addr_cmd
,
4773 "no ip ospf hello-interval A.B.C.D",
4776 "OSPF interface commands\n"
4777 "Time between HELLO packets\n"
4778 "Address of interface")
4780 struct interface
*ifp
= vty
->index
;
4781 struct in_addr addr
;
4783 struct ospf_if_params
*params
;
4786 params
= IF_DEF_PARAMS (ifp
);
4790 ret
= inet_aton(argv
[0], &addr
);
4793 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4798 params
= ospf_lookup_if_params (ifp
, addr
);
4803 UNSET_IF_PARAM (params
, v_hello
);
4804 params
->v_hello
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4806 if (params
!= IF_DEF_PARAMS (ifp
))
4808 ospf_free_if_params (ifp
, addr
);
4809 ospf_if_update_params (ifp
, addr
);
4815 ALIAS (no_ip_ospf_hello_interval
,
4816 no_ip_ospf_hello_interval_cmd
,
4817 "no ip ospf hello-interval",
4820 "OSPF interface commands\n"
4821 "Time between HELLO packets\n")
4823 ALIAS (no_ip_ospf_hello_interval
,
4824 no_ospf_hello_interval_cmd
,
4825 "no ospf hello-interval",
4827 "OSPF interface commands\n"
4828 "Time between HELLO packets\n")
4830 DEFUN (ip_ospf_network
,
4831 ip_ospf_network_cmd
,
4832 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4834 "OSPF interface commands\n"
4836 "Specify OSPF broadcast multi-access network\n"
4837 "Specify OSPF NBMA network\n"
4838 "Specify OSPF point-to-multipoint network\n"
4839 "Specify OSPF point-to-point network\n")
4841 struct interface
*ifp
= vty
->index
;
4842 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4843 struct route_node
*rn
;
4845 if (strncmp (argv
[0], "b", 1) == 0)
4846 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4847 else if (strncmp (argv
[0], "n", 1) == 0)
4848 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
4849 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
4850 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
4851 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
4852 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
4854 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4857 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
4859 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4861 struct ospf_interface
*oi
= rn
->info
;
4866 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4868 if (oi
->state
> ISM_Down
)
4870 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4871 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4878 ALIAS (ip_ospf_network
,
4880 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4881 "OSPF interface commands\n"
4883 "Specify OSPF broadcast multi-access network\n"
4884 "Specify OSPF NBMA network\n"
4885 "Specify OSPF point-to-multipoint network\n"
4886 "Specify OSPF point-to-point network\n")
4888 DEFUN (no_ip_ospf_network
,
4889 no_ip_ospf_network_cmd
,
4890 "no ip ospf network",
4893 "OSPF interface commands\n"
4896 struct interface
*ifp
= vty
->index
;
4897 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4898 struct route_node
*rn
;
4900 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4902 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4905 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4907 struct ospf_interface
*oi
= rn
->info
;
4912 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4914 if (oi
->state
> ISM_Down
)
4916 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4917 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4924 ALIAS (no_ip_ospf_network
,
4925 no_ospf_network_cmd
,
4928 "OSPF interface commands\n"
4931 DEFUN (ip_ospf_priority
,
4932 ip_ospf_priority_addr_cmd
,
4933 "ip ospf priority <0-255> A.B.C.D",
4935 "OSPF interface commands\n"
4938 "Address of interface")
4940 struct interface
*ifp
= vty
->index
;
4942 struct route_node
*rn
;
4943 struct in_addr addr
;
4945 struct ospf_if_params
*params
;
4947 params
= IF_DEF_PARAMS (ifp
);
4949 priority
= strtol (argv
[0], NULL
, 10);
4951 /* Router Priority range is <0-255>. */
4952 if (priority
< 0 || priority
> 255)
4954 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
4960 ret
= inet_aton(argv
[1], &addr
);
4963 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4968 params
= ospf_get_if_params (ifp
, addr
);
4969 ospf_if_update_params (ifp
, addr
);
4972 SET_IF_PARAM (params
, priority
);
4973 params
->priority
= priority
;
4975 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4977 struct ospf_interface
*oi
= rn
->info
;
4983 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
4985 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
4986 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
4993 ALIAS (ip_ospf_priority
,
4994 ip_ospf_priority_cmd
,
4995 "ip ospf priority <0-255>",
4997 "OSPF interface commands\n"
5001 ALIAS (ip_ospf_priority
,
5003 "ospf priority <0-255>",
5004 "OSPF interface commands\n"
5008 DEFUN (no_ip_ospf_priority
,
5009 no_ip_ospf_priority_addr_cmd
,
5010 "no ip ospf priority A.B.C.D",
5013 "OSPF interface commands\n"
5015 "Address of interface")
5017 struct interface
*ifp
= vty
->index
;
5018 struct route_node
*rn
;
5019 struct in_addr addr
;
5021 struct ospf_if_params
*params
;
5024 params
= IF_DEF_PARAMS (ifp
);
5028 ret
= inet_aton(argv
[0], &addr
);
5031 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5036 params
= ospf_lookup_if_params (ifp
, addr
);
5041 UNSET_IF_PARAM (params
, priority
);
5042 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
5044 if (params
!= IF_DEF_PARAMS (ifp
))
5046 ospf_free_if_params (ifp
, addr
);
5047 ospf_if_update_params (ifp
, addr
);
5050 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5052 struct ospf_interface
*oi
= rn
->info
;
5058 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
5060 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
5061 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
5068 ALIAS (no_ip_ospf_priority
,
5069 no_ip_ospf_priority_cmd
,
5070 "no ip ospf priority",
5073 "OSPF interface commands\n"
5074 "Router priority\n")
5076 ALIAS (no_ip_ospf_priority
,
5077 no_ospf_priority_cmd
,
5080 "OSPF interface commands\n"
5081 "Router priority\n")
5083 DEFUN (ip_ospf_retransmit_interval
,
5084 ip_ospf_retransmit_interval_addr_cmd
,
5085 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5087 "OSPF interface commands\n"
5088 "Time between retransmitting lost link state advertisements\n"
5090 "Address of interface")
5092 struct interface
*ifp
= vty
->index
;
5094 struct in_addr addr
;
5096 struct ospf_if_params
*params
;
5098 params
= IF_DEF_PARAMS (ifp
);
5099 seconds
= strtol (argv
[0], NULL
, 10);
5101 /* Retransmit Interval range is <3-65535>. */
5102 if (seconds
< 3 || seconds
> 65535)
5104 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
5111 ret
= inet_aton(argv
[1], &addr
);
5114 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5119 params
= ospf_get_if_params (ifp
, addr
);
5120 ospf_if_update_params (ifp
, addr
);
5123 SET_IF_PARAM (params
, retransmit_interval
);
5124 params
->retransmit_interval
= seconds
;
5129 ALIAS (ip_ospf_retransmit_interval
,
5130 ip_ospf_retransmit_interval_cmd
,
5131 "ip ospf retransmit-interval <3-65535>",
5133 "OSPF interface commands\n"
5134 "Time between retransmitting lost link state advertisements\n"
5137 ALIAS (ip_ospf_retransmit_interval
,
5138 ospf_retransmit_interval_cmd
,
5139 "ospf retransmit-interval <3-65535>",
5140 "OSPF interface commands\n"
5141 "Time between retransmitting lost link state advertisements\n"
5144 DEFUN (no_ip_ospf_retransmit_interval
,
5145 no_ip_ospf_retransmit_interval_addr_cmd
,
5146 "no ip ospf retransmit-interval A.B.C.D",
5149 "OSPF interface commands\n"
5150 "Time between retransmitting lost link state advertisements\n"
5151 "Address of interface")
5153 struct interface
*ifp
= vty
->index
;
5154 struct in_addr addr
;
5156 struct ospf_if_params
*params
;
5159 params
= IF_DEF_PARAMS (ifp
);
5163 ret
= inet_aton(argv
[0], &addr
);
5166 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5171 params
= ospf_lookup_if_params (ifp
, addr
);
5176 UNSET_IF_PARAM (params
, retransmit_interval
);
5177 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
5179 if (params
!= IF_DEF_PARAMS (ifp
))
5181 ospf_free_if_params (ifp
, addr
);
5182 ospf_if_update_params (ifp
, addr
);
5188 ALIAS (no_ip_ospf_retransmit_interval
,
5189 no_ip_ospf_retransmit_interval_cmd
,
5190 "no ip ospf retransmit-interval",
5193 "OSPF interface commands\n"
5194 "Time between retransmitting lost link state advertisements\n")
5196 ALIAS (no_ip_ospf_retransmit_interval
,
5197 no_ospf_retransmit_interval_cmd
,
5198 "no ospf retransmit-interval",
5200 "OSPF interface commands\n"
5201 "Time between retransmitting lost link state advertisements\n")
5203 DEFUN (ip_ospf_transmit_delay
,
5204 ip_ospf_transmit_delay_addr_cmd
,
5205 "ip ospf transmit-delay <1-65535> A.B.C.D",
5207 "OSPF interface commands\n"
5208 "Link state transmit delay\n"
5210 "Address of interface")
5212 struct interface
*ifp
= vty
->index
;
5214 struct in_addr addr
;
5216 struct ospf_if_params
*params
;
5218 params
= IF_DEF_PARAMS (ifp
);
5219 seconds
= strtol (argv
[0], NULL
, 10);
5221 /* Transmit Delay range is <1-65535>. */
5222 if (seconds
< 1 || seconds
> 65535)
5224 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
5230 ret
= inet_aton(argv
[1], &addr
);
5233 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5238 params
= ospf_get_if_params (ifp
, addr
);
5239 ospf_if_update_params (ifp
, addr
);
5242 SET_IF_PARAM (params
, transmit_delay
);
5243 params
->transmit_delay
= seconds
;
5248 ALIAS (ip_ospf_transmit_delay
,
5249 ip_ospf_transmit_delay_cmd
,
5250 "ip ospf transmit-delay <1-65535>",
5252 "OSPF interface commands\n"
5253 "Link state transmit delay\n"
5256 ALIAS (ip_ospf_transmit_delay
,
5257 ospf_transmit_delay_cmd
,
5258 "ospf transmit-delay <1-65535>",
5259 "OSPF interface commands\n"
5260 "Link state transmit delay\n"
5263 DEFUN (no_ip_ospf_transmit_delay
,
5264 no_ip_ospf_transmit_delay_addr_cmd
,
5265 "no ip ospf transmit-delay A.B.C.D",
5268 "OSPF interface commands\n"
5269 "Link state transmit delay\n"
5270 "Address of interface")
5272 struct interface
*ifp
= vty
->index
;
5273 struct in_addr addr
;
5275 struct ospf_if_params
*params
;
5278 params
= IF_DEF_PARAMS (ifp
);
5282 ret
= inet_aton(argv
[0], &addr
);
5285 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5290 params
= ospf_lookup_if_params (ifp
, addr
);
5295 UNSET_IF_PARAM (params
, transmit_delay
);
5296 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
5298 if (params
!= IF_DEF_PARAMS (ifp
))
5300 ospf_free_if_params (ifp
, addr
);
5301 ospf_if_update_params (ifp
, addr
);
5307 ALIAS (no_ip_ospf_transmit_delay
,
5308 no_ip_ospf_transmit_delay_cmd
,
5309 "no ip ospf transmit-delay",
5312 "OSPF interface commands\n"
5313 "Link state transmit delay\n")
5315 ALIAS (no_ip_ospf_transmit_delay
,
5316 no_ospf_transmit_delay_cmd
,
5317 "no ospf transmit-delay",
5319 "OSPF interface commands\n"
5320 "Link state transmit delay\n")
5323 DEFUN (ospf_redistribute_source_metric_type
,
5324 ospf_redistribute_source_metric_type_routemap_cmd
,
5325 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5326 "Redistribute information from another routing protocol\n"
5330 "Routing Information Protocol (RIP)\n"
5331 "Border Gateway Protocol (BGP)\n"
5332 "Metric for redistributed routes\n"
5333 "OSPF default metric\n"
5334 "OSPF exterior metric type for redistributed routes\n"
5335 "Set OSPF External Type 1 metrics\n"
5336 "Set OSPF External Type 2 metrics\n"
5337 "Route map reference\n"
5338 "Pointer to route-map entries\n")
5340 struct ospf
*ospf
= vty
->index
;
5345 /* Get distribute source. */
5346 if (!str2distribute_source (argv
[0], &source
))
5349 /* Get metric value. */
5351 if (!str2metric (argv
[1], &metric
))
5354 /* Get metric type. */
5356 if (!str2metric_type (argv
[2], &type
))
5360 ospf_routemap_set (ospf
, source
, argv
[3]);
5362 ospf_routemap_unset (ospf
, source
);
5364 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5367 ALIAS (ospf_redistribute_source_metric_type
,
5368 ospf_redistribute_source_metric_type_cmd
,
5369 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5370 "Redistribute information from another routing protocol\n"
5374 "Routing Information Protocol (RIP)\n"
5375 "Border Gateway Protocol (BGP)\n"
5376 "Metric for redistributed routes\n"
5377 "OSPF default metric\n"
5378 "OSPF exterior metric type for redistributed routes\n"
5379 "Set OSPF External Type 1 metrics\n"
5380 "Set OSPF External Type 2 metrics\n")
5382 ALIAS (ospf_redistribute_source_metric_type
,
5383 ospf_redistribute_source_metric_cmd
,
5384 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5385 "Redistribute information from another routing protocol\n"
5389 "Routing Information Protocol (RIP)\n"
5390 "Border Gateway Protocol (BGP)\n"
5391 "Metric for redistributed routes\n"
5392 "OSPF default metric\n")
5394 DEFUN (ospf_redistribute_source_type_metric
,
5395 ospf_redistribute_source_type_metric_routemap_cmd
,
5396 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5397 "Redistribute information from another routing protocol\n"
5401 "Routing Information Protocol (RIP)\n"
5402 "Border Gateway Protocol (BGP)\n"
5403 "OSPF exterior metric type for redistributed routes\n"
5404 "Set OSPF External Type 1 metrics\n"
5405 "Set OSPF External Type 2 metrics\n"
5406 "Metric for redistributed routes\n"
5407 "OSPF default metric\n"
5408 "Route map reference\n"
5409 "Pointer to route-map entries\n")
5411 struct ospf
*ospf
= vty
->index
;
5416 /* Get distribute source. */
5417 if (!str2distribute_source (argv
[0], &source
))
5420 /* Get metric value. */
5422 if (!str2metric_type (argv
[1], &type
))
5425 /* Get metric type. */
5427 if (!str2metric (argv
[2], &metric
))
5431 ospf_routemap_set (ospf
, source
, argv
[3]);
5433 ospf_routemap_unset (ospf
, source
);
5435 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5438 ALIAS (ospf_redistribute_source_type_metric
,
5439 ospf_redistribute_source_type_metric_cmd
,
5440 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5441 "Redistribute information from another routing protocol\n"
5445 "Routing Information Protocol (RIP)\n"
5446 "Border Gateway Protocol (BGP)\n"
5447 "OSPF exterior metric type for redistributed routes\n"
5448 "Set OSPF External Type 1 metrics\n"
5449 "Set OSPF External Type 2 metrics\n"
5450 "Metric for redistributed routes\n"
5451 "OSPF default metric\n")
5453 ALIAS (ospf_redistribute_source_type_metric
,
5454 ospf_redistribute_source_type_cmd
,
5455 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5456 "Redistribute information from another routing protocol\n"
5460 "Routing Information Protocol (RIP)\n"
5461 "Border Gateway Protocol (BGP)\n"
5462 "OSPF exterior metric type for redistributed routes\n"
5463 "Set OSPF External Type 1 metrics\n"
5464 "Set OSPF External Type 2 metrics\n")
5466 ALIAS (ospf_redistribute_source_type_metric
,
5467 ospf_redistribute_source_cmd
,
5468 "redistribute (kernel|connected|static|rip|bgp)",
5469 "Redistribute information from another routing protocol\n"
5473 "Routing Information Protocol (RIP)\n"
5474 "Border Gateway Protocol (BGP)\n")
5476 DEFUN (ospf_redistribute_source_metric_routemap
,
5477 ospf_redistribute_source_metric_routemap_cmd
,
5478 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5479 "Redistribute information from another routing protocol\n"
5483 "Routing Information Protocol (RIP)\n"
5484 "Border Gateway Protocol (BGP)\n"
5485 "Metric for redistributed routes\n"
5486 "OSPF default metric\n"
5487 "Route map reference\n"
5488 "Pointer to route-map entries\n")
5490 struct ospf
*ospf
= vty
->index
;
5494 /* Get distribute source. */
5495 if (!str2distribute_source (argv
[0], &source
))
5498 /* Get metric value. */
5500 if (!str2metric (argv
[1], &metric
))
5504 ospf_routemap_set (ospf
, source
, argv
[2]);
5506 ospf_routemap_unset (ospf
, source
);
5508 return ospf_redistribute_set (ospf
, source
, -1, metric
);
5511 DEFUN (ospf_redistribute_source_type_routemap
,
5512 ospf_redistribute_source_type_routemap_cmd
,
5513 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5514 "Redistribute information from another routing protocol\n"
5518 "Routing Information Protocol (RIP)\n"
5519 "Border Gateway Protocol (BGP)\n"
5520 "OSPF exterior metric type for redistributed routes\n"
5521 "Set OSPF External Type 1 metrics\n"
5522 "Set OSPF External Type 2 metrics\n"
5523 "Route map reference\n"
5524 "Pointer to route-map entries\n")
5526 struct ospf
*ospf
= vty
->index
;
5530 /* Get distribute source. */
5531 if (!str2distribute_source (argv
[0], &source
))
5534 /* Get metric value. */
5536 if (!str2metric_type (argv
[1], &type
))
5540 ospf_routemap_set (ospf
, source
, argv
[2]);
5542 ospf_routemap_unset (ospf
, source
);
5544 return ospf_redistribute_set (ospf
, source
, type
, -1);
5547 DEFUN (ospf_redistribute_source_routemap
,
5548 ospf_redistribute_source_routemap_cmd
,
5549 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5550 "Redistribute information from another routing protocol\n"
5554 "Routing Information Protocol (RIP)\n"
5555 "Border Gateway Protocol (BGP)\n"
5556 "Route map reference\n"
5557 "Pointer to route-map entries\n")
5559 struct ospf
*ospf
= vty
->index
;
5562 /* Get distribute source. */
5563 if (!str2distribute_source (argv
[0], &source
))
5567 ospf_routemap_set (ospf
, source
, argv
[1]);
5569 ospf_routemap_unset (ospf
, source
);
5571 return ospf_redistribute_set (ospf
, source
, -1, -1);
5574 DEFUN (no_ospf_redistribute_source
,
5575 no_ospf_redistribute_source_cmd
,
5576 "no redistribute (kernel|connected|static|rip|bgp)",
5578 "Redistribute information from another routing protocol\n"
5582 "Routing Information Protocol (RIP)\n"
5583 "Border Gateway Protocol (BGP)\n")
5585 struct ospf
*ospf
= vty
->index
;
5588 if (!str2distribute_source (argv
[0], &source
))
5591 ospf_routemap_unset (ospf
, source
);
5592 return ospf_redistribute_unset (ospf
, source
);
5595 DEFUN (ospf_distribute_list_out
,
5596 ospf_distribute_list_out_cmd
,
5597 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5598 "Filter networks in routing updates\n"
5599 "Access-list name\n"
5604 "Routing Information Protocol (RIP)\n"
5605 "Border Gateway Protocol (BGP)\n")
5607 struct ospf
*ospf
= vty
->index
;
5610 /* Get distribute source. */
5611 if (!str2distribute_source (argv
[1], &source
))
5614 return ospf_distribute_list_out_set (ospf
, source
, argv
[0]);
5617 DEFUN (no_ospf_distribute_list_out
,
5618 no_ospf_distribute_list_out_cmd
,
5619 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5621 "Filter networks in routing updates\n"
5622 "Access-list name\n"
5627 "Routing Information Protocol (RIP)\n"
5628 "Border Gateway Protocol (BGP)\n")
5630 struct ospf
*ospf
= vty
->index
;
5633 if (!str2distribute_source (argv
[1], &source
))
5636 return ospf_distribute_list_out_unset (ospf
, source
, argv
[0]);
5639 /* Default information originate. */
5640 DEFUN (ospf_default_information_originate_metric_type_routemap
,
5641 ospf_default_information_originate_metric_type_routemap_cmd
,
5642 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5643 "Control distribution of default information\n"
5644 "Distribute a default route\n"
5645 "OSPF default metric\n"
5647 "OSPF metric type for default routes\n"
5648 "Set OSPF External Type 1 metrics\n"
5649 "Set OSPF External Type 2 metrics\n"
5650 "Route map reference\n"
5651 "Pointer to route-map entries\n")
5653 struct ospf
*ospf
= vty
->index
;
5657 /* Get metric value. */
5659 if (!str2metric (argv
[0], &metric
))
5662 /* Get metric type. */
5664 if (!str2metric_type (argv
[1], &type
))
5668 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5670 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5672 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5676 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5677 ospf_default_information_originate_metric_type_cmd
,
5678 "default-information originate metric <0-16777214> metric-type (1|2)",
5679 "Control distribution of default information\n"
5680 "Distribute a default route\n"
5681 "OSPF default metric\n"
5683 "OSPF metric type for default routes\n"
5684 "Set OSPF External Type 1 metrics\n"
5685 "Set OSPF External Type 2 metrics\n")
5687 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5688 ospf_default_information_originate_metric_cmd
,
5689 "default-information originate metric <0-16777214>",
5690 "Control distribution of default information\n"
5691 "Distribute a default route\n"
5692 "OSPF default metric\n"
5695 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5696 ospf_default_information_originate_cmd
,
5697 "default-information originate",
5698 "Control distribution of default information\n"
5699 "Distribute a default route\n")
5701 /* Default information originate. */
5702 DEFUN (ospf_default_information_originate_metric_routemap
,
5703 ospf_default_information_originate_metric_routemap_cmd
,
5704 "default-information originate metric <0-16777214> route-map WORD",
5705 "Control distribution of default information\n"
5706 "Distribute a default route\n"
5707 "OSPF default metric\n"
5709 "Route map reference\n"
5710 "Pointer to route-map entries\n")
5712 struct ospf
*ospf
= vty
->index
;
5715 /* Get metric value. */
5717 if (!str2metric (argv
[0], &metric
))
5721 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5723 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5725 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5729 /* Default information originate. */
5730 DEFUN (ospf_default_information_originate_routemap
,
5731 ospf_default_information_originate_routemap_cmd
,
5732 "default-information originate route-map WORD",
5733 "Control distribution of default information\n"
5734 "Distribute a default route\n"
5735 "Route map reference\n"
5736 "Pointer to route-map entries\n")
5738 struct ospf
*ospf
= vty
->index
;
5741 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
5743 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5745 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
, -1, -1);
5748 DEFUN (ospf_default_information_originate_type_metric_routemap
,
5749 ospf_default_information_originate_type_metric_routemap_cmd
,
5750 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
5751 "Control distribution of default information\n"
5752 "Distribute a default route\n"
5753 "OSPF metric type for default routes\n"
5754 "Set OSPF External Type 1 metrics\n"
5755 "Set OSPF External Type 2 metrics\n"
5756 "OSPF default metric\n"
5758 "Route map reference\n"
5759 "Pointer to route-map entries\n")
5761 struct ospf
*ospf
= vty
->index
;
5765 /* Get metric type. */
5767 if (!str2metric_type (argv
[0], &type
))
5770 /* Get metric value. */
5772 if (!str2metric (argv
[1], &metric
))
5776 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5778 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5780 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5784 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5785 ospf_default_information_originate_type_metric_cmd
,
5786 "default-information originate metric-type (1|2) metric <0-16777214>",
5787 "Control distribution of default information\n"
5788 "Distribute a default route\n"
5789 "OSPF metric type for default routes\n"
5790 "Set OSPF External Type 1 metrics\n"
5791 "Set OSPF External Type 2 metrics\n"
5792 "OSPF default metric\n"
5795 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5796 ospf_default_information_originate_type_cmd
,
5797 "default-information originate metric-type (1|2)",
5798 "Control distribution of default information\n"
5799 "Distribute a default route\n"
5800 "OSPF metric type for default routes\n"
5801 "Set OSPF External Type 1 metrics\n"
5802 "Set OSPF External Type 2 metrics\n")
5804 DEFUN (ospf_default_information_originate_type_routemap
,
5805 ospf_default_information_originate_type_routemap_cmd
,
5806 "default-information originate metric-type (1|2) route-map WORD",
5807 "Control distribution of default information\n"
5808 "Distribute a default route\n"
5809 "OSPF metric type for default routes\n"
5810 "Set OSPF External Type 1 metrics\n"
5811 "Set OSPF External Type 2 metrics\n"
5812 "Route map reference\n"
5813 "Pointer to route-map entries\n")
5815 struct ospf
*ospf
= vty
->index
;
5818 /* Get metric type. */
5820 if (!str2metric_type (argv
[0], &type
))
5824 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5826 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5828 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5832 DEFUN (ospf_default_information_originate_always_metric_type_routemap
,
5833 ospf_default_information_originate_always_metric_type_routemap_cmd
,
5834 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5835 "Control distribution of default information\n"
5836 "Distribute a default route\n"
5837 "Always advertise default route\n"
5838 "OSPF default metric\n"
5840 "OSPF metric type for default routes\n"
5841 "Set OSPF External Type 1 metrics\n"
5842 "Set OSPF External Type 2 metrics\n"
5843 "Route map reference\n"
5844 "Pointer to route-map entries\n")
5846 struct ospf
*ospf
= vty
->index
;
5850 /* Get metric value. */
5852 if (!str2metric (argv
[0], &metric
))
5855 /* Get metric type. */
5857 if (!str2metric_type (argv
[1], &type
))
5861 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5863 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5865 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5869 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5870 ospf_default_information_originate_always_metric_type_cmd
,
5871 "default-information originate always metric <0-16777214> metric-type (1|2)",
5872 "Control distribution of default information\n"
5873 "Distribute a default route\n"
5874 "Always advertise default route\n"
5875 "OSPF default metric\n"
5877 "OSPF metric type for default routes\n"
5878 "Set OSPF External Type 1 metrics\n"
5879 "Set OSPF External Type 2 metrics\n")
5881 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5882 ospf_default_information_originate_always_metric_cmd
,
5883 "default-information originate always metric <0-16777214>",
5884 "Control distribution of default information\n"
5885 "Distribute a default route\n"
5886 "Always advertise default route\n"
5887 "OSPF default metric\n"
5889 "OSPF metric type for default routes\n")
5891 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5892 ospf_default_information_originate_always_cmd
,
5893 "default-information originate always",
5894 "Control distribution of default information\n"
5895 "Distribute a default route\n"
5896 "Always advertise default route\n")
5898 DEFUN (ospf_default_information_originate_always_metric_routemap
,
5899 ospf_default_information_originate_always_metric_routemap_cmd
,
5900 "default-information originate always metric <0-16777214> route-map WORD",
5901 "Control distribution of default information\n"
5902 "Distribute a default route\n"
5903 "Always advertise default route\n"
5904 "OSPF default metric\n"
5906 "Route map reference\n"
5907 "Pointer to route-map entries\n")
5909 struct ospf
*ospf
= vty
->index
;
5912 /* Get metric value. */
5914 if (!str2metric (argv
[0], &metric
))
5918 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5920 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5922 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5926 DEFUN (ospf_default_information_originate_always_routemap
,
5927 ospf_default_information_originate_always_routemap_cmd
,
5928 "default-information originate always route-map WORD",
5929 "Control distribution of default information\n"
5930 "Distribute a default route\n"
5931 "Always advertise default route\n"
5932 "Route map reference\n"
5933 "Pointer to route-map entries\n")
5935 struct ospf
*ospf
= vty
->index
;
5938 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
5940 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5942 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
, -1, -1);
5945 DEFUN (ospf_default_information_originate_always_type_metric_routemap
,
5946 ospf_default_information_originate_always_type_metric_routemap_cmd
,
5947 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
5948 "Control distribution of default information\n"
5949 "Distribute a default route\n"
5950 "Always advertise default route\n"
5951 "OSPF metric type for default routes\n"
5952 "Set OSPF External Type 1 metrics\n"
5953 "Set OSPF External Type 2 metrics\n"
5954 "OSPF default metric\n"
5956 "Route map reference\n"
5957 "Pointer to route-map entries\n")
5959 struct ospf
*ospf
= vty
->index
;
5963 /* Get metric type. */
5965 if (!str2metric_type (argv
[0], &type
))
5968 /* Get metric value. */
5970 if (!str2metric (argv
[1], &metric
))
5974 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5976 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5978 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5982 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5983 ospf_default_information_originate_always_type_metric_cmd
,
5984 "default-information originate always metric-type (1|2) metric <0-16777214>",
5985 "Control distribution of default information\n"
5986 "Distribute a default route\n"
5987 "Always advertise default route\n"
5988 "OSPF metric type for default routes\n"
5989 "Set OSPF External Type 1 metrics\n"
5990 "Set OSPF External Type 2 metrics\n"
5991 "OSPF default metric\n"
5994 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5995 ospf_default_information_originate_always_type_cmd
,
5996 "default-information originate always metric-type (1|2)",
5997 "Control distribution of default information\n"
5998 "Distribute a default route\n"
5999 "Always advertise default route\n"
6000 "OSPF metric type for default routes\n"
6001 "Set OSPF External Type 1 metrics\n"
6002 "Set OSPF External Type 2 metrics\n")
6004 DEFUN (ospf_default_information_originate_always_type_routemap
,
6005 ospf_default_information_originate_always_type_routemap_cmd
,
6006 "default-information originate always metric-type (1|2) route-map WORD",
6007 "Control distribution of default information\n"
6008 "Distribute a default route\n"
6009 "Always advertise default route\n"
6010 "OSPF metric type for default routes\n"
6011 "Set OSPF External Type 1 metrics\n"
6012 "Set OSPF External Type 2 metrics\n"
6013 "Route map reference\n"
6014 "Pointer to route-map entries\n")
6016 struct ospf
*ospf
= vty
->index
;
6019 /* Get metric type. */
6021 if (!str2metric_type (argv
[0], &type
))
6025 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6027 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6029 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6033 DEFUN (no_ospf_default_information_originate
,
6034 no_ospf_default_information_originate_cmd
,
6035 "no default-information originate",
6037 "Control distribution of default information\n"
6038 "Distribute a default route\n")
6040 struct ospf
*ospf
= vty
->index
;
6041 struct prefix_ipv4 p
;
6042 struct in_addr nexthop
;
6045 p
.prefix
.s_addr
= 0;
6048 ospf_external_lsa_flush (ospf
, DEFAULT_ROUTE
, &p
, 0, nexthop
);
6050 if (EXTERNAL_INFO (DEFAULT_ROUTE
)) {
6051 ospf_external_info_delete (DEFAULT_ROUTE
, p
);
6052 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE
));
6053 EXTERNAL_INFO (DEFAULT_ROUTE
) = NULL
;
6056 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6057 return ospf_redistribute_default_unset (ospf
);
6060 DEFUN (ospf_default_metric
,
6061 ospf_default_metric_cmd
,
6062 "default-metric <0-16777214>",
6063 "Set metric of redistributed routes\n"
6066 struct ospf
*ospf
= vty
->index
;
6069 if (!str2metric (argv
[0], &metric
))
6072 ospf
->default_metric
= metric
;
6077 DEFUN (no_ospf_default_metric
,
6078 no_ospf_default_metric_cmd
,
6079 "no default-metric",
6081 "Set metric of redistributed routes\n")
6083 struct ospf
*ospf
= vty
->index
;
6085 ospf
->default_metric
= -1;
6090 ALIAS (no_ospf_default_metric
,
6091 no_ospf_default_metric_val_cmd
,
6092 "no default-metric <0-16777214>",
6094 "Set metric of redistributed routes\n"
6097 DEFUN (ospf_distance
,
6100 "Define an administrative distance\n"
6101 "OSPF Administrative distance\n")
6103 struct ospf
*ospf
= vty
->index
;
6105 ospf
->distance_all
= atoi (argv
[0]);
6110 DEFUN (no_ospf_distance
,
6111 no_ospf_distance_cmd
,
6112 "no distance <1-255>",
6114 "Define an administrative distance\n"
6115 "OSPF Administrative distance\n")
6117 struct ospf
*ospf
= vty
->index
;
6119 ospf
->distance_all
= 0;
6124 DEFUN (no_ospf_distance_ospf
,
6125 no_ospf_distance_ospf_cmd
,
6128 "Define an administrative distance\n"
6129 "OSPF Administrative distance\n"
6132 struct ospf
*ospf
= vty
->index
;
6134 ospf
->distance_intra
= 0;
6135 ospf
->distance_inter
= 0;
6136 ospf
->distance_external
= 0;
6141 DEFUN (ospf_distance_ospf_intra
,
6142 ospf_distance_ospf_intra_cmd
,
6143 "distance ospf intra-area <1-255>",
6144 "Define an administrative distance\n"
6145 "OSPF Administrative distance\n"
6146 "Intra-area routes\n"
6147 "Distance for intra-area routes\n")
6149 struct ospf
*ospf
= vty
->index
;
6151 ospf
->distance_intra
= atoi (argv
[0]);
6156 DEFUN (ospf_distance_ospf_intra_inter
,
6157 ospf_distance_ospf_intra_inter_cmd
,
6158 "distance ospf intra-area <1-255> inter-area <1-255>",
6159 "Define an administrative distance\n"
6160 "OSPF Administrative distance\n"
6161 "Intra-area routes\n"
6162 "Distance for intra-area routes\n"
6163 "Inter-area routes\n"
6164 "Distance for inter-area routes\n")
6166 struct ospf
*ospf
= vty
->index
;
6168 ospf
->distance_intra
= atoi (argv
[0]);
6169 ospf
->distance_inter
= atoi (argv
[1]);
6174 DEFUN (ospf_distance_ospf_intra_external
,
6175 ospf_distance_ospf_intra_external_cmd
,
6176 "distance ospf intra-area <1-255> external <1-255>",
6177 "Define an administrative distance\n"
6178 "OSPF Administrative distance\n"
6179 "Intra-area routes\n"
6180 "Distance for intra-area routes\n"
6182 "Distance for external routes\n")
6184 struct ospf
*ospf
= vty
->index
;
6186 ospf
->distance_intra
= atoi (argv
[0]);
6187 ospf
->distance_external
= atoi (argv
[1]);
6192 DEFUN (ospf_distance_ospf_intra_inter_external
,
6193 ospf_distance_ospf_intra_inter_external_cmd
,
6194 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6195 "Define an administrative distance\n"
6196 "OSPF Administrative distance\n"
6197 "Intra-area routes\n"
6198 "Distance for intra-area routes\n"
6199 "Inter-area routes\n"
6200 "Distance for inter-area routes\n"
6202 "Distance for external routes\n")
6204 struct ospf
*ospf
= vty
->index
;
6206 ospf
->distance_intra
= atoi (argv
[0]);
6207 ospf
->distance_inter
= atoi (argv
[1]);
6208 ospf
->distance_external
= atoi (argv
[2]);
6213 DEFUN (ospf_distance_ospf_intra_external_inter
,
6214 ospf_distance_ospf_intra_external_inter_cmd
,
6215 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6216 "Define an administrative distance\n"
6217 "OSPF Administrative distance\n"
6218 "Intra-area routes\n"
6219 "Distance for intra-area routes\n"
6221 "Distance for external routes\n"
6222 "Inter-area routes\n"
6223 "Distance for inter-area routes\n")
6225 struct ospf
*ospf
= vty
->index
;
6227 ospf
->distance_intra
= atoi (argv
[0]);
6228 ospf
->distance_external
= atoi (argv
[1]);
6229 ospf
->distance_inter
= atoi (argv
[2]);
6234 DEFUN (ospf_distance_ospf_inter
,
6235 ospf_distance_ospf_inter_cmd
,
6236 "distance ospf inter-area <1-255>",
6237 "Define an administrative distance\n"
6238 "OSPF Administrative distance\n"
6239 "Inter-area routes\n"
6240 "Distance for inter-area routes\n")
6242 struct ospf
*ospf
= vty
->index
;
6244 ospf
->distance_inter
= atoi (argv
[0]);
6249 DEFUN (ospf_distance_ospf_inter_intra
,
6250 ospf_distance_ospf_inter_intra_cmd
,
6251 "distance ospf inter-area <1-255> intra-area <1-255>",
6252 "Define an administrative distance\n"
6253 "OSPF Administrative distance\n"
6254 "Inter-area routes\n"
6255 "Distance for inter-area routes\n"
6256 "Intra-area routes\n"
6257 "Distance for intra-area routes\n")
6259 struct ospf
*ospf
= vty
->index
;
6261 ospf
->distance_inter
= atoi (argv
[0]);
6262 ospf
->distance_intra
= atoi (argv
[1]);
6267 DEFUN (ospf_distance_ospf_inter_external
,
6268 ospf_distance_ospf_inter_external_cmd
,
6269 "distance ospf inter-area <1-255> external <1-255>",
6270 "Define an administrative distance\n"
6271 "OSPF Administrative distance\n"
6272 "Inter-area routes\n"
6273 "Distance for inter-area routes\n"
6275 "Distance for external routes\n")
6277 struct ospf
*ospf
= vty
->index
;
6279 ospf
->distance_inter
= atoi (argv
[0]);
6280 ospf
->distance_external
= atoi (argv
[1]);
6285 DEFUN (ospf_distance_ospf_inter_intra_external
,
6286 ospf_distance_ospf_inter_intra_external_cmd
,
6287 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6288 "Define an administrative distance\n"
6289 "OSPF Administrative distance\n"
6290 "Inter-area routes\n"
6291 "Distance for inter-area routes\n"
6292 "Intra-area routes\n"
6293 "Distance for intra-area routes\n"
6295 "Distance for external routes\n")
6297 struct ospf
*ospf
= vty
->index
;
6299 ospf
->distance_inter
= atoi (argv
[0]);
6300 ospf
->distance_intra
= atoi (argv
[1]);
6301 ospf
->distance_external
= atoi (argv
[2]);
6306 DEFUN (ospf_distance_ospf_inter_external_intra
,
6307 ospf_distance_ospf_inter_external_intra_cmd
,
6308 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6309 "Define an administrative distance\n"
6310 "OSPF Administrative distance\n"
6311 "Inter-area routes\n"
6312 "Distance for inter-area routes\n"
6314 "Distance for external routes\n"
6315 "Intra-area routes\n"
6316 "Distance for intra-area routes\n")
6318 struct ospf
*ospf
= vty
->index
;
6320 ospf
->distance_inter
= atoi (argv
[0]);
6321 ospf
->distance_external
= atoi (argv
[1]);
6322 ospf
->distance_intra
= atoi (argv
[2]);
6327 DEFUN (ospf_distance_ospf_external
,
6328 ospf_distance_ospf_external_cmd
,
6329 "distance ospf external <1-255>",
6330 "Define an administrative distance\n"
6331 "OSPF Administrative distance\n"
6333 "Distance for external routes\n")
6335 struct ospf
*ospf
= vty
->index
;
6337 ospf
->distance_external
= atoi (argv
[0]);
6342 DEFUN (ospf_distance_ospf_external_intra
,
6343 ospf_distance_ospf_external_intra_cmd
,
6344 "distance ospf external <1-255> intra-area <1-255>",
6345 "Define an administrative distance\n"
6346 "OSPF Administrative distance\n"
6348 "Distance for external routes\n"
6349 "Intra-area routes\n"
6350 "Distance for intra-area routes\n")
6352 struct ospf
*ospf
= vty
->index
;
6354 ospf
->distance_external
= atoi (argv
[0]);
6355 ospf
->distance_intra
= atoi (argv
[1]);
6360 DEFUN (ospf_distance_ospf_external_inter
,
6361 ospf_distance_ospf_external_inter_cmd
,
6362 "distance ospf external <1-255> inter-area <1-255>",
6363 "Define an administrative distance\n"
6364 "OSPF Administrative distance\n"
6366 "Distance for external routes\n"
6367 "Inter-area routes\n"
6368 "Distance for inter-area routes\n")
6370 struct ospf
*ospf
= vty
->index
;
6372 ospf
->distance_external
= atoi (argv
[0]);
6373 ospf
->distance_inter
= atoi (argv
[1]);
6378 DEFUN (ospf_distance_ospf_external_intra_inter
,
6379 ospf_distance_ospf_external_intra_inter_cmd
,
6380 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6381 "Define an administrative distance\n"
6382 "OSPF Administrative distance\n"
6384 "Distance for external routes\n"
6385 "Intra-area routes\n"
6386 "Distance for intra-area routes\n"
6387 "Inter-area routes\n"
6388 "Distance for inter-area routes\n")
6390 struct ospf
*ospf
= vty
->index
;
6392 ospf
->distance_external
= atoi (argv
[0]);
6393 ospf
->distance_intra
= atoi (argv
[1]);
6394 ospf
->distance_inter
= atoi (argv
[2]);
6399 DEFUN (ospf_distance_ospf_external_inter_intra
,
6400 ospf_distance_ospf_external_inter_intra_cmd
,
6401 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6402 "Define an administrative distance\n"
6403 "OSPF Administrative distance\n"
6405 "Distance for external routes\n"
6406 "Inter-area routes\n"
6407 "Distance for inter-area routes\n"
6408 "Intra-area routes\n"
6409 "Distance for intra-area routes\n")
6411 struct ospf
*ospf
= vty
->index
;
6413 ospf
->distance_external
= atoi (argv
[0]);
6414 ospf
->distance_inter
= atoi (argv
[1]);
6415 ospf
->distance_intra
= atoi (argv
[2]);
6420 DEFUN (ospf_distance_source
,
6421 ospf_distance_source_cmd
,
6422 "distance <1-255> A.B.C.D/M",
6423 "Administrative distance\n"
6425 "IP source prefix\n")
6427 struct ospf
*ospf
= vty
->index
;
6429 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], NULL
);
6434 DEFUN (no_ospf_distance_source
,
6435 no_ospf_distance_source_cmd
,
6436 "no distance <1-255> A.B.C.D/M",
6438 "Administrative distance\n"
6440 "IP source prefix\n")
6442 struct ospf
*ospf
= vty
->index
;
6444 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], NULL
);
6449 DEFUN (ospf_distance_source_access_list
,
6450 ospf_distance_source_access_list_cmd
,
6451 "distance <1-255> A.B.C.D/M WORD",
6452 "Administrative distance\n"
6454 "IP source prefix\n"
6455 "Access list name\n")
6457 struct ospf
*ospf
= vty
->index
;
6459 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6464 DEFUN (no_ospf_distance_source_access_list
,
6465 no_ospf_distance_source_access_list_cmd
,
6466 "no distance <1-255> A.B.C.D/M WORD",
6468 "Administrative distance\n"
6470 "IP source prefix\n"
6471 "Access list name\n")
6473 struct ospf
*ospf
= vty
->index
;
6475 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6481 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
6483 struct route_node
*rn
;
6484 struct ospf_route
*or;
6486 struct ospf_path
*path
;
6488 vty_out (vty
, "============ OSPF network routing table ============%s",
6491 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6492 if ((or = rn
->info
) != NULL
)
6495 snprintf (buf1
, 19, "%s/%d",
6496 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6498 switch (or->path_type
)
6500 case OSPF_PATH_INTER_AREA
:
6501 if (or->type
== OSPF_DESTINATION_NETWORK
)
6502 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
6503 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6504 else if (or->type
== OSPF_DESTINATION_DISCARD
)
6505 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
6507 case OSPF_PATH_INTRA_AREA
:
6508 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
6509 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6515 if (or->type
== OSPF_DESTINATION_NETWORK
)
6516 LIST_LOOP (or->paths
, path
, pnode
)
6518 if (path
->oi
!= NULL
)
6520 if (path
->nexthop
.s_addr
== 0)
6521 vty_out (vty
, "%24s directly attached to %s%s",
6522 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6524 vty_out (vty
, "%24s via %s, %s%s", "",
6525 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6530 vty_out (vty
, "%s", VTY_NEWLINE
);
6534 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
6536 struct route_node
*rn
;
6537 struct ospf_route
*or;
6539 struct ospf_path
*path
;
6541 vty_out (vty
, "============ OSPF router routing table =============%s",
6543 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
6548 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
6550 for (nn
= listhead ((list
) rn
->info
); nn
; nextnode (nn
))
6551 if ((or = getdata (nn
)) != NULL
)
6554 vty_out (vty
, "%24s", "");
6557 vty_out (vty
, "%s [%d] area: %s",
6558 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
6559 or->cost
, inet_ntoa (or->u
.std
.area_id
));
6561 vty_out (vty
, "%s%s%s",
6562 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
6563 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
6566 LIST_LOOP (or->paths
, path
, pn
)
6568 if (path
->nexthop
.s_addr
== 0)
6569 vty_out (vty
, "%24s directly attached to %s%s",
6570 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6572 vty_out (vty
, "%24s via %s, %s%s", "",
6573 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6578 vty_out (vty
, "%s", VTY_NEWLINE
);
6582 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
6584 struct route_node
*rn
;
6585 struct ospf_route
*er
;
6587 struct ospf_path
*path
;
6589 vty_out (vty
, "============ OSPF external routing table ===========%s",
6591 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6592 if ((er
= rn
->info
) != NULL
)
6595 snprintf (buf1
, 19, "%s/%d",
6596 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6598 switch (er
->path_type
)
6600 case OSPF_PATH_TYPE1_EXTERNAL
:
6601 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
6602 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6604 case OSPF_PATH_TYPE2_EXTERNAL
:
6605 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
6606 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6610 LIST_LOOP (er
->paths
, path
, pnode
)
6612 if (path
->oi
!= NULL
)
6614 if (path
->nexthop
.s_addr
== 0)
6615 vty_out (vty
, "%24s directly attached to %s%s",
6616 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6618 vty_out (vty
, "%24s via %s, %s%s", "",
6619 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6624 vty_out (vty
, "%s", VTY_NEWLINE
);
6628 DEFUN (show_ip_ospf_border_routers
,
6629 show_ip_ospf_border_routers_cmd
,
6630 "show ip ospf border-routers",
6633 "show all the ABR's and ASBR's\n"
6638 ospf
= ospf_lookup ();
6641 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6645 if (ospf
->new_table
== NULL
)
6647 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6651 /* Show Network routes.
6652 show_ip_ospf_route_network (vty, ospf->new_table); */
6654 /* Show Router routes. */
6655 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
6659 #endif /* HAVE_NSSA */
6661 DEFUN (show_ip_ospf_route
,
6662 show_ip_ospf_route_cmd
,
6663 "show ip ospf route",
6666 "OSPF information\n"
6667 "OSPF routing table\n")
6671 ospf
= ospf_lookup ();
6674 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6678 if (ospf
->new_table
== NULL
)
6680 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6684 /* Show Network routes. */
6685 show_ip_ospf_route_network (vty
, ospf
->new_table
);
6687 /* Show Router routes. */
6688 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
6690 /* Show AS External routes. */
6691 show_ip_ospf_route_external (vty
, ospf
->old_external_route
);
6697 char *ospf_abr_type_str
[] =
6706 char *ospf_shortcut_mode_str
[] =
6715 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
6717 memset (buf
, 0, length
);
6719 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6720 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
6722 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
6726 char *ospf_int_type_str
[] =
6728 "unknown", /* should never be used. */
6732 "point-to-multipoint",
6733 "virtual-link", /* should never be used. */
6737 /* Configuration write function for ospfd. */
6739 config_write_interface (struct vty
*vty
)
6742 struct interface
*ifp
;
6743 struct crypt_key
*ck
;
6745 struct route_node
*rn
= NULL
;
6746 struct ospf_if_params
*params
;
6748 for (n1
= listhead (iflist
); n1
; nextnode (n1
))
6752 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
6755 vty_out (vty
, "!%s", VTY_NEWLINE
);
6756 vty_out (vty
, "interface %s%s", ifp
->name
,
6759 vty_out (vty
, " description %s%s", ifp
->desc
,
6764 params
= IF_DEF_PARAMS (ifp
);
6767 /* Interface Network print. */
6768 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
6769 params
->type
!= OSPF_IFTYPE_BROADCAST
&&
6770 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
6772 vty_out (vty
, " ip ospf network %s",
6773 ospf_int_type_str
[params
->type
]);
6774 if (params
!= IF_DEF_PARAMS (ifp
))
6775 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6776 vty_out (vty
, "%s", VTY_NEWLINE
);
6779 /* OSPF interface authentication print */
6780 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
6781 params
->auth_type
!= OSPF_AUTH_NOTSET
)
6785 /* Translation tables are not that much help here due to syntax
6786 of the simple option */
6787 switch (params
->auth_type
)
6790 case OSPF_AUTH_NULL
:
6794 case OSPF_AUTH_SIMPLE
:
6798 case OSPF_AUTH_CRYPTOGRAPHIC
:
6799 auth_str
= " message-digest";
6807 vty_out (vty
, " ip ospf authentication%s", auth_str
);
6808 if (params
!= IF_DEF_PARAMS (ifp
))
6809 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6810 vty_out (vty
, "%s", VTY_NEWLINE
);
6813 /* Simple Authentication Password print. */
6814 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
6815 params
->auth_simple
[0] != '\0')
6817 vty_out (vty
, " ip ospf authentication-key %s",
6818 params
->auth_simple
);
6819 if (params
!= IF_DEF_PARAMS (ifp
))
6820 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6821 vty_out (vty
, "%s", VTY_NEWLINE
);
6824 /* Cryptographic Authentication Key print. */
6825 for (n2
= listhead (params
->auth_crypt
); n2
; nextnode (n2
))
6828 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
6829 ck
->key_id
, ck
->auth_key
);
6830 if (params
!= IF_DEF_PARAMS (ifp
))
6831 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6832 vty_out (vty
, "%s", VTY_NEWLINE
);
6835 /* Interface Output Cost print. */
6836 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
6838 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
6839 if (params
!= IF_DEF_PARAMS (ifp
))
6840 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6841 vty_out (vty
, "%s", VTY_NEWLINE
);
6844 /* Hello Interval print. */
6845 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
6846 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
6848 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
6849 if (params
!= IF_DEF_PARAMS (ifp
))
6850 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6851 vty_out (vty
, "%s", VTY_NEWLINE
);
6855 /* Router Dead Interval print. */
6856 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
6857 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
6859 vty_out (vty
, " ip ospf dead-interval %u", params
->v_wait
);
6860 if (params
!= IF_DEF_PARAMS (ifp
))
6861 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6862 vty_out (vty
, "%s", VTY_NEWLINE
);
6865 /* Router Priority print. */
6866 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
6867 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
6869 vty_out (vty
, " ip ospf priority %u", params
->priority
);
6870 if (params
!= IF_DEF_PARAMS (ifp
))
6871 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6872 vty_out (vty
, "%s", VTY_NEWLINE
);
6875 /* Retransmit Interval print. */
6876 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
6877 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
6879 vty_out (vty
, " ip ospf retransmit-interval %u",
6880 params
->retransmit_interval
);
6881 if (params
!= IF_DEF_PARAMS (ifp
))
6882 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6883 vty_out (vty
, "%s", VTY_NEWLINE
);
6886 /* Transmit Delay print. */
6887 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
6888 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
6890 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
6891 if (params
!= IF_DEF_PARAMS (ifp
))
6892 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6893 vty_out (vty
, "%s", VTY_NEWLINE
);
6899 rn
= route_top (IF_OIFS_PARAMS (ifp
));
6901 rn
= route_next (rn
);
6911 #ifdef HAVE_OPAQUE_LSA
6912 ospf_opaque_config_write_if (vty
, ifp
);
6913 #endif /* HAVE_OPAQUE_LSA */
6920 config_write_network_area (struct vty
*vty
, struct ospf
*ospf
)
6922 struct route_node
*rn
;
6923 u_char buf
[INET_ADDRSTRLEN
];
6925 /* `network area' print. */
6926 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
6929 struct ospf_network
*n
= rn
->info
;
6931 memset (buf
, 0, INET_ADDRSTRLEN
);
6933 /* Create Area ID string by specified Area ID format. */
6934 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6935 strncpy (buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
6937 sprintf (buf
, "%lu",
6938 (unsigned long int) ntohl (n
->area_id
.s_addr
));
6940 /* Network print. */
6941 vty_out (vty
, " network %s/%d area %s%s",
6942 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
6950 config_write_ospf_area (struct vty
*vty
, struct ospf
*ospf
)
6953 u_char buf
[INET_ADDRSTRLEN
];
6955 /* Area configuration print. */
6956 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
6958 struct ospf_area
*area
= getdata (node
);
6959 struct route_node
*rn1
;
6961 area_id2str (buf
, INET_ADDRSTRLEN
, area
);
6963 if (area
->auth_type
!= OSPF_AUTH_NULL
)
6965 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
6966 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
6968 vty_out (vty
, " area %s authentication message-digest%s",
6972 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
6973 vty_out (vty
, " area %s shortcut %s%s", buf
,
6974 ospf_shortcut_mode_str
[area
->shortcut_configured
],
6977 if ((area
->external_routing
== OSPF_AREA_STUB
)
6979 || (area
->external_routing
== OSPF_AREA_NSSA
)
6980 #endif /* HAVE_NSSA */
6983 if (area
->external_routing
== OSPF_AREA_STUB
)
6984 vty_out (vty
, " area %s stub", buf
);
6986 else if (area
->external_routing
== OSPF_AREA_NSSA
)
6988 vty_out (vty
, " area %s nssa", buf
);
6989 switch (area
->NSSATranslatorRole
)
6991 case OSPF_NSSA_ROLE_NEVER
:
6992 vty_out (vty
, " translate-never");
6994 case OSPF_NSSA_ROLE_ALWAYS
:
6995 vty_out (vty
, " translate-always");
6997 case OSPF_NSSA_ROLE_CANDIDATE
:
6999 vty_out (vty
, " translate-candidate");
7002 #endif /* HAVE_NSSA */
7004 if (area
->no_summary
)
7005 vty_out (vty
, " no-summary");
7007 vty_out (vty
, "%s", VTY_NEWLINE
);
7009 if (area
->default_cost
!= 1)
7010 vty_out (vty
, " area %s default-cost %d%s", buf
,
7011 area
->default_cost
, VTY_NEWLINE
);
7014 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
7017 struct ospf_area_range
*range
= rn1
->info
;
7019 vty_out (vty
, " area %s range %s/%d", buf
,
7020 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
7022 if (range
->cost_config
!= -1)
7023 vty_out (vty
, " cost %d", range
->cost_config
);
7025 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
7026 vty_out (vty
, " not-advertise");
7028 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
7029 vty_out (vty
, " substitute %s/%d",
7030 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
7032 vty_out (vty
, "%s", VTY_NEWLINE
);
7035 if (EXPORT_NAME (area
))
7036 vty_out (vty
, " area %s export-list %s%s", buf
,
7037 EXPORT_NAME (area
), VTY_NEWLINE
);
7039 if (IMPORT_NAME (area
))
7040 vty_out (vty
, " area %s import-list %s%s", buf
,
7041 IMPORT_NAME (area
), VTY_NEWLINE
);
7043 if (PREFIX_NAME_IN (area
))
7044 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
7045 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
7047 if (PREFIX_NAME_OUT (area
))
7048 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
7049 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
7056 config_write_ospf_nbr_nbma (struct vty
*vty
, struct ospf
*ospf
)
7058 struct ospf_nbr_nbma
*nbr_nbma
;
7059 struct route_node
*rn
;
7061 /* Static Neighbor configuration print. */
7062 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
7063 if ((nbr_nbma
= rn
->info
))
7065 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
7067 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
7068 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
7070 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
7071 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
7073 vty_out (vty
, "%s", VTY_NEWLINE
);
7080 config_write_virtual_link (struct vty
*vty
, struct ospf
*ospf
)
7083 u_char buf
[INET_ADDRSTRLEN
];
7085 /* Virtual-Link print */
7086 for (node
= listhead (ospf
->vlinks
); node
; nextnode (node
))
7089 struct crypt_key
*ck
;
7090 struct ospf_vl_data
*vl_data
= getdata (node
);
7091 struct ospf_interface
*oi
;
7093 if (vl_data
!= NULL
)
7095 memset (buf
, 0, INET_ADDRSTRLEN
);
7097 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7098 strncpy (buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
7100 sprintf (buf
, "%lu",
7101 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
7102 oi
= vl_data
->vl_oi
;
7105 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
7106 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
7107 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
7108 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
7109 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7111 inet_ntoa (vl_data
->vl_peer
),
7112 OSPF_IF_PARAM (oi
, v_hello
),
7113 OSPF_IF_PARAM (oi
, retransmit_interval
),
7114 OSPF_IF_PARAM (oi
, transmit_delay
),
7115 OSPF_IF_PARAM (oi
, v_wait
),
7118 vty_out (vty
, " area %s virtual-link %s%s", buf
,
7119 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
7121 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
7122 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
7124 inet_ntoa (vl_data
->vl_peer
),
7125 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
7128 for (n2
= listhead (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
); n2
; nextnode (n2
))
7131 vty_out (vty
, " area %s virtual-link %s message-digest-key %d md5 %s%s",
7133 inet_ntoa (vl_data
->vl_peer
),
7134 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
7144 char *distribute_str
[] = { "system", "kernel", "connected", "static", "rip",
7145 "ripng", "ospf", "ospf6", "isis", "bgp"};
7147 config_write_ospf_redistribute (struct vty
*vty
, struct ospf
*ospf
)
7151 /* redistribute print. */
7152 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7153 if (type
!= zclient
->redist_default
&& zclient
->redist
[type
])
7155 vty_out (vty
, " redistribute %s", distribute_str
[type
]);
7156 if (ospf
->dmetric
[type
].value
>= 0)
7157 vty_out (vty
, " metric %d", ospf
->dmetric
[type
].value
);
7159 if (ospf
->dmetric
[type
].type
== EXTERNAL_METRIC_TYPE_1
)
7160 vty_out (vty
, " metric-type 1");
7162 if (ROUTEMAP_NAME (ospf
, type
))
7163 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (ospf
, type
));
7165 vty_out (vty
, "%s", VTY_NEWLINE
);
7172 config_write_ospf_default_metric (struct vty
*vty
, struct ospf
*ospf
)
7174 if (ospf
->default_metric
!= -1)
7175 vty_out (vty
, " default-metric %d%s", ospf
->default_metric
,
7181 config_write_ospf_distribute (struct vty
*vty
, struct ospf
*ospf
)
7187 /* distribute-list print. */
7188 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7189 if (ospf
->dlist
[type
].name
)
7190 vty_out (vty
, " distribute-list %s out %s%s",
7191 ospf
->dlist
[type
].name
,
7192 distribute_str
[type
], VTY_NEWLINE
);
7194 /* default-information print. */
7195 if (ospf
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
7197 if (ospf
->default_originate
== DEFAULT_ORIGINATE_ZEBRA
)
7198 vty_out (vty
, " default-information originate");
7200 vty_out (vty
, " default-information originate always");
7202 if (ospf
->dmetric
[DEFAULT_ROUTE
].value
>= 0)
7203 vty_out (vty
, " metric %d",
7204 ospf
->dmetric
[DEFAULT_ROUTE
].value
);
7205 if (ospf
->dmetric
[DEFAULT_ROUTE
].type
== EXTERNAL_METRIC_TYPE_1
)
7206 vty_out (vty
, " metric-type 1");
7208 if (ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
))
7209 vty_out (vty
, " route-map %s",
7210 ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
));
7212 vty_out (vty
, "%s", VTY_NEWLINE
);
7221 config_write_ospf_distance (struct vty
*vty
, struct ospf
*ospf
)
7223 struct route_node
*rn
;
7224 struct ospf_distance
*odistance
;
7226 if (ospf
->distance_all
)
7227 vty_out (vty
, " distance %d%s", ospf
->distance_all
, VTY_NEWLINE
);
7229 if (ospf
->distance_intra
7230 || ospf
->distance_inter
7231 || ospf
->distance_external
)
7233 vty_out (vty
, " distance ospf");
7235 if (ospf
->distance_intra
)
7236 vty_out (vty
, " intra-area %d", ospf
->distance_intra
);
7237 if (ospf
->distance_inter
)
7238 vty_out (vty
, " inter-area %d", ospf
->distance_inter
);
7239 if (ospf
->distance_external
)
7240 vty_out (vty
, " external %d", ospf
->distance_external
);
7242 vty_out (vty
, "%s", VTY_NEWLINE
);
7245 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
7246 if ((odistance
= rn
->info
) != NULL
)
7248 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
7249 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7250 odistance
->access_list
? odistance
->access_list
: "",
7256 /* OSPF configuration write function. */
7258 ospf_config_write (struct vty
*vty
)
7264 ospf
= ospf_lookup ();
7267 /* `router ospf' print. */
7268 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
7272 if (!ospf
->networks
)
7275 /* Router ID print. */
7276 if (ospf
->router_id_static
.s_addr
!= 0)
7277 vty_out (vty
, " ospf router-id %s%s",
7278 inet_ntoa (ospf
->router_id_static
), VTY_NEWLINE
);
7280 /* ABR type print. */
7281 if (ospf
->abr_type
!= OSPF_ABR_STAND
)
7282 vty_out (vty
, " ospf abr-type %s%s",
7283 ospf_abr_type_str
[ospf
->abr_type
], VTY_NEWLINE
);
7285 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
7286 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
7287 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
7289 /* auto-cost reference-bandwidth configuration. */
7290 if (ospf
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
7291 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
7292 ospf
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
7294 /* SPF timers print. */
7295 if (ospf
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
7296 ospf
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
)
7297 vty_out (vty
, " timers spf %d %d%s",
7298 ospf
->spf_delay
, ospf
->spf_holdtime
, VTY_NEWLINE
);
7300 /* SPF refresh parameters print. */
7301 if (ospf
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
7302 vty_out (vty
, " refresh timer %d%s",
7303 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
7305 /* Redistribute information print. */
7306 config_write_ospf_redistribute (vty
, ospf
);
7308 /* passive-interface print. */
7309 for (node
= listhead (om
->iflist
); node
; nextnode (node
))
7311 struct interface
*ifp
= getdata (node
);
7315 if (IF_DEF_PARAMS (ifp
)->passive_interface
== OSPF_IF_PASSIVE
)
7316 vty_out (vty
, " passive-interface %s%s",
7317 ifp
->name
, VTY_NEWLINE
);
7320 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
7322 struct ospf_interface
*oi
= getdata (node
);
7324 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
) &&
7325 oi
->params
->passive_interface
== OSPF_IF_PASSIVE
)
7326 vty_out (vty
, " passive-interface %s %s%s",
7328 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
7332 /* Network area print. */
7333 config_write_network_area (vty
, ospf
);
7335 /* Area config print. */
7336 config_write_ospf_area (vty
, ospf
);
7338 /* static neighbor print. */
7339 config_write_ospf_nbr_nbma (vty
, ospf
);
7341 /* Virtual-Link print. */
7342 config_write_virtual_link (vty
, ospf
);
7344 /* Default metric configuration. */
7345 config_write_ospf_default_metric (vty
, ospf
);
7347 /* Distribute-list and default-information print. */
7348 config_write_ospf_distribute (vty
, ospf
);
7350 /* Distance configuration. */
7351 config_write_ospf_distance (vty
, ospf
);
7353 #ifdef HAVE_OPAQUE_LSA
7354 ospf_opaque_config_write_router (vty
, ospf
);
7355 #endif /* HAVE_OPAQUE_LSA */
7362 ospf_vty_show_init ()
7364 /* "show ip ospf" commands. */
7365 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
7366 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
7368 /* "show ip ospf database" commands. */
7369 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
7370 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
7371 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7372 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7373 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7374 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
7375 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
7376 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
7377 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
7378 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7379 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7380 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7381 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
7382 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
7384 /* "show ip ospf interface" commands. */
7385 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
7386 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
7388 /* "show ip ospf neighbor" commands. */
7389 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7390 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7391 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7392 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7393 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7394 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
7395 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7396 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7397 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7398 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7399 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7400 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7401 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
7402 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7404 /* "show ip ospf route" commands. */
7405 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
7406 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
7408 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
7409 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
7410 #endif /* HAVE_NSSA */
7414 /* ospfd's interface node. */
7415 struct cmd_node interface_node
=
7422 /* Initialization of OSPF interface. */
7426 /* Install interface node. */
7427 install_node (&interface_node
, config_write_interface
);
7429 install_element (CONFIG_NODE
, &interface_cmd
);
7430 install_element (CONFIG_NODE
, &no_interface_cmd
);
7431 install_default (INTERFACE_NODE
);
7433 /* "description" commands. */
7434 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
7435 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
7437 /* "ip ospf authentication" commands. */
7438 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
7439 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
7440 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
7441 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
7442 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
7443 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
7444 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
7445 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
7446 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
7447 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
7449 /* "ip ospf message-digest-key" commands. */
7450 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
7451 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
7452 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
7453 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
7455 /* "ip ospf cost" commands. */
7456 install_element (INTERFACE_NODE
, &ip_ospf_cost_addr_cmd
);
7457 install_element (INTERFACE_NODE
, &ip_ospf_cost_cmd
);
7458 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_addr_cmd
);
7459 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
7461 /* "ip ospf dead-interval" commands. */
7462 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
7463 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
7464 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
7465 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
7467 /* "ip ospf hello-interval" commands. */
7468 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
7469 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
7470 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
7471 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
7473 /* "ip ospf network" commands. */
7474 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
7475 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
7477 /* "ip ospf priority" commands. */
7478 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
7479 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
7480 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
7481 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
7483 /* "ip ospf retransmit-interval" commands. */
7484 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
7485 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
7486 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
7487 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
7489 /* "ip ospf transmit-delay" commands. */
7490 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
7491 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
7492 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
7493 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
7495 /* These commands are compatibitliy for previous version. */
7496 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
7497 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
7498 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
7499 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
7500 install_element (INTERFACE_NODE
, &ospf_cost_cmd
);
7501 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
7502 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
7503 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
7504 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
7505 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
7506 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
7507 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
7508 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
7509 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
7510 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
7511 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
7512 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
7513 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
7516 /* Zebra node structure. */
7517 struct cmd_node zebra_node
=
7520 "%s(config-router)#",
7524 ospf_vty_zebra_init ()
7526 install_element (OSPF_NODE
, &ospf_redistribute_source_type_metric_cmd
);
7527 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_type_cmd
);
7528 install_element (OSPF_NODE
, &ospf_redistribute_source_type_cmd
);
7529 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_cmd
);
7530 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
7531 install_element (OSPF_NODE
,
7532 &ospf_redistribute_source_metric_type_routemap_cmd
);
7533 install_element (OSPF_NODE
,
7534 &ospf_redistribute_source_type_metric_routemap_cmd
);
7535 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_routemap_cmd
);
7536 install_element (OSPF_NODE
, &ospf_redistribute_source_type_routemap_cmd
);
7537 install_element (OSPF_NODE
, &ospf_redistribute_source_routemap_cmd
);
7539 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
7541 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
7542 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
7544 install_element (OSPF_NODE
,
7545 &ospf_default_information_originate_metric_type_cmd
);
7546 install_element (OSPF_NODE
, &ospf_default_information_originate_metric_cmd
);
7547 install_element (OSPF_NODE
,
7548 &ospf_default_information_originate_type_metric_cmd
);
7549 install_element (OSPF_NODE
, &ospf_default_information_originate_type_cmd
);
7550 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
7551 install_element (OSPF_NODE
,
7552 &ospf_default_information_originate_always_metric_type_cmd
);
7553 install_element (OSPF_NODE
,
7554 &ospf_default_information_originate_always_metric_cmd
);
7555 install_element (OSPF_NODE
,
7556 &ospf_default_information_originate_always_cmd
);
7557 install_element (OSPF_NODE
,
7558 &ospf_default_information_originate_always_type_metric_cmd
);
7559 install_element (OSPF_NODE
,
7560 &ospf_default_information_originate_always_type_cmd
);
7562 install_element (OSPF_NODE
,
7563 &ospf_default_information_originate_metric_type_routemap_cmd
);
7564 install_element (OSPF_NODE
,
7565 &ospf_default_information_originate_metric_routemap_cmd
);
7566 install_element (OSPF_NODE
,
7567 &ospf_default_information_originate_routemap_cmd
);
7568 install_element (OSPF_NODE
,
7569 &ospf_default_information_originate_type_metric_routemap_cmd
);
7570 install_element (OSPF_NODE
,
7571 &ospf_default_information_originate_type_routemap_cmd
);
7572 install_element (OSPF_NODE
,
7573 &ospf_default_information_originate_always_metric_type_routemap_cmd
);
7574 install_element (OSPF_NODE
,
7575 &ospf_default_information_originate_always_metric_routemap_cmd
);
7576 install_element (OSPF_NODE
,
7577 &ospf_default_information_originate_always_routemap_cmd
);
7578 install_element (OSPF_NODE
,
7579 &ospf_default_information_originate_always_type_metric_routemap_cmd
);
7580 install_element (OSPF_NODE
,
7581 &ospf_default_information_originate_always_type_routemap_cmd
);
7583 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
7585 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
7586 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
7587 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
7589 install_element (OSPF_NODE
, &ospf_distance_cmd
);
7590 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
7591 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
7592 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_cmd
);
7593 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_cmd
);
7594 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_cmd
);
7595 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_external_cmd
);
7596 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_inter_cmd
);
7597 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_cmd
);
7598 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_cmd
);
7599 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_cmd
);
7600 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_external_cmd
);
7601 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_intra_cmd
);
7602 install_element (OSPF_NODE
, &ospf_distance_ospf_external_cmd
);
7603 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_cmd
);
7604 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_cmd
);
7605 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_inter_cmd
);
7606 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_intra_cmd
);
7608 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
7609 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
7610 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
7611 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
7615 struct cmd_node ospf_node
=
7618 "%s(config-router)# ",
7623 /* Install OSPF related vty commands. */
7627 /* Install ospf top node. */
7628 install_node (&ospf_node
, ospf_config_write
);
7630 /* "router ospf" commands. */
7631 install_element (CONFIG_NODE
, &router_ospf_cmd
);
7632 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
7634 install_default (OSPF_NODE
);
7636 /* "ospf router-id" commands. */
7637 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
7638 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
7639 install_element (OSPF_NODE
, &router_ospf_id_cmd
);
7640 install_element (OSPF_NODE
, &no_router_ospf_id_cmd
);
7642 /* "passive-interface" commands. */
7643 install_element (OSPF_NODE
, &ospf_passive_interface_addr_cmd
);
7644 install_element (OSPF_NODE
, &ospf_passive_interface_cmd
);
7645 install_element (OSPF_NODE
, &no_ospf_passive_interface_addr_cmd
);
7646 install_element (OSPF_NODE
, &no_ospf_passive_interface_cmd
);
7648 /* "ospf abr-type" commands. */
7649 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
7650 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
7652 /* "ospf rfc1583-compatible" commands. */
7653 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
7654 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
7655 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
7656 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
7658 /* "network area" commands. */
7659 install_element (OSPF_NODE
, &ospf_network_area_cmd
);
7660 install_element (OSPF_NODE
, &no_ospf_network_area_cmd
);
7662 /* "area authentication" commands. */
7663 install_element (OSPF_NODE
, &ospf_area_authentication_message_digest_cmd
);
7664 install_element (OSPF_NODE
, &ospf_area_authentication_cmd
);
7665 install_element (OSPF_NODE
, &no_ospf_area_authentication_cmd
);
7667 /* "area range" commands. */
7668 install_element (OSPF_NODE
, &ospf_area_range_cmd
);
7669 install_element (OSPF_NODE
, &ospf_area_range_advertise_cmd
);
7670 install_element (OSPF_NODE
, &ospf_area_range_cost_cmd
);
7671 install_element (OSPF_NODE
, &ospf_area_range_advertise_cost_cmd
);
7672 install_element (OSPF_NODE
, &ospf_area_range_not_advertise_cmd
);
7673 install_element (OSPF_NODE
, &no_ospf_area_range_cmd
);
7674 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cmd
);
7675 install_element (OSPF_NODE
, &no_ospf_area_range_cost_cmd
);
7676 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cost_cmd
);
7677 install_element (OSPF_NODE
, &ospf_area_range_substitute_cmd
);
7678 install_element (OSPF_NODE
, &no_ospf_area_range_substitute_cmd
);
7680 /* "area virtual-link" commands. */
7681 install_element (OSPF_NODE
, &ospf_area_vlink_cmd
);
7682 install_element (OSPF_NODE
, &no_ospf_area_vlink_cmd
);
7684 install_element (OSPF_NODE
, &ospf_area_vlink_param1_cmd
);
7685 install_element (OSPF_NODE
, &no_ospf_area_vlink_param1_cmd
);
7687 install_element (OSPF_NODE
, &ospf_area_vlink_param2_cmd
);
7688 install_element (OSPF_NODE
, &no_ospf_area_vlink_param2_cmd
);
7690 install_element (OSPF_NODE
, &ospf_area_vlink_param3_cmd
);
7691 install_element (OSPF_NODE
, &no_ospf_area_vlink_param3_cmd
);
7693 install_element (OSPF_NODE
, &ospf_area_vlink_param4_cmd
);
7694 install_element (OSPF_NODE
, &no_ospf_area_vlink_param4_cmd
);
7696 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_cmd
);
7697 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_cmd
);
7698 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_cmd
);
7700 install_element (OSPF_NODE
, &ospf_area_vlink_md5_cmd
);
7701 install_element (OSPF_NODE
, &no_ospf_area_vlink_md5_cmd
);
7703 install_element (OSPF_NODE
, &ospf_area_vlink_authkey_cmd
);
7704 install_element (OSPF_NODE
, &no_ospf_area_vlink_authkey_cmd
);
7706 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_authkey_cmd
);
7707 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_authkey_cmd
);
7708 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_authkey_cmd
);
7710 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_md5_cmd
);
7711 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_md5_cmd
);
7712 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_md5_cmd
);
7714 /* "area stub" commands. */
7715 install_element (OSPF_NODE
, &ospf_area_stub_no_summary_cmd
);
7716 install_element (OSPF_NODE
, &ospf_area_stub_cmd
);
7717 install_element (OSPF_NODE
, &no_ospf_area_stub_no_summary_cmd
);
7718 install_element (OSPF_NODE
, &no_ospf_area_stub_cmd
);
7721 /* "area nssa" commands. */
7722 install_element (OSPF_NODE
, &ospf_area_nssa_cmd
);
7723 install_element (OSPF_NODE
, &ospf_area_nssa_translate_no_summary_cmd
);
7724 install_element (OSPF_NODE
, &ospf_area_nssa_translate_cmd
);
7725 install_element (OSPF_NODE
, &ospf_area_nssa_no_summary_cmd
);
7726 install_element (OSPF_NODE
, &no_ospf_area_nssa_cmd
);
7727 install_element (OSPF_NODE
, &no_ospf_area_nssa_no_summary_cmd
);
7728 #endif /* HAVE_NSSA */
7730 install_element (OSPF_NODE
, &ospf_area_default_cost_cmd
);
7731 install_element (OSPF_NODE
, &no_ospf_area_default_cost_cmd
);
7733 install_element (OSPF_NODE
, &ospf_area_shortcut_cmd
);
7734 install_element (OSPF_NODE
, &no_ospf_area_shortcut_cmd
);
7736 install_element (OSPF_NODE
, &ospf_area_export_list_cmd
);
7737 install_element (OSPF_NODE
, &no_ospf_area_export_list_cmd
);
7739 install_element (OSPF_NODE
, &ospf_area_filter_list_cmd
);
7740 install_element (OSPF_NODE
, &no_ospf_area_filter_list_cmd
);
7742 install_element (OSPF_NODE
, &ospf_area_import_list_cmd
);
7743 install_element (OSPF_NODE
, &no_ospf_area_import_list_cmd
);
7745 install_element (OSPF_NODE
, &ospf_timers_spf_cmd
);
7746 install_element (OSPF_NODE
, &no_ospf_timers_spf_cmd
);
7748 install_element (OSPF_NODE
, &ospf_refresh_timer_cmd
);
7749 install_element (OSPF_NODE
, &no_ospf_refresh_timer_val_cmd
);
7750 install_element (OSPF_NODE
, &no_ospf_refresh_timer_cmd
);
7752 install_element (OSPF_NODE
, &ospf_auto_cost_reference_bandwidth_cmd
);
7753 install_element (OSPF_NODE
, &no_ospf_auto_cost_reference_bandwidth_cmd
);
7755 /* "neighbor" commands. */
7756 install_element (OSPF_NODE
, &ospf_neighbor_cmd
);
7757 install_element (OSPF_NODE
, &ospf_neighbor_priority_poll_interval_cmd
);
7758 install_element (OSPF_NODE
, &ospf_neighbor_priority_cmd
);
7759 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_cmd
);
7760 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_priority_cmd
);
7761 install_element (OSPF_NODE
, &no_ospf_neighbor_cmd
);
7762 install_element (OSPF_NODE
, &no_ospf_neighbor_priority_cmd
);
7763 install_element (OSPF_NODE
, &no_ospf_neighbor_poll_interval_cmd
);
7765 /* Init interface related vty commands. */
7766 ospf_vty_if_init ();
7768 /* Init zebra related vty commands. */
7769 ospf_vty_zebra_init ();