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 const static char *ospf_network_type_str
[] =
64 /* Utility functions. */
66 ospf_str2area_id (const 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 (const 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 (const 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 (const 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",
678 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
681 vty_out (vty
, "Area %ld is %s%s",
682 (u_long
)ntohl (area_id
.s_addr
),
683 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
688 if ((vl_data
= ospf_vl_lookup (area
, vl_config
->vl_peer
)) == NULL
)
690 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
691 if (vl_data
->vl_oi
== NULL
)
693 vl_data
->vl_oi
= ospf_vl_new (ospf
, vl_data
);
694 ospf_vl_add (ospf
, vl_data
);
695 ospf_spf_calculate_schedule (ospf
);
703 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
704 struct ospf_vl_config_data
*vl_config
)
706 struct crypt_key
*ck
;
708 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
710 vty
= vl_config
->vty
;
712 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
714 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
715 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
718 if (vl_config
->auth_key
)
720 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
721 strncpy ((char *) IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
722 OSPF_AUTH_SIMPLE_SIZE
);
724 else if (vl_config
->md5_key
)
726 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
729 vty_out (vty
, "OSPF: Key %d already exists%s",
730 vl_config
->crypto_key_id
, VTY_NEWLINE
);
733 ck
= ospf_crypt_key_new ();
734 ck
->key_id
= vl_config
->crypto_key_id
;
735 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
736 strncpy ((char *) ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
738 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
740 else if (vl_config
->crypto_key_id
!= 0)
744 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
745 vl_config
->crypto_key_id
) == NULL
)
747 vty_out (vty
, "OSPF: Key %d does not exist%s",
748 vl_config
->crypto_key_id
, VTY_NEWLINE
);
752 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
762 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
763 struct ospf_vl_config_data
*vl_config
)
765 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
766 /* Virtual Link data initialised to defaults, so only set
768 if (vl_config
->hello_interval
)
770 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
771 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
774 if (vl_config
->dead_interval
)
776 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
777 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
780 if (vl_config
->retransmit_interval
)
782 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
783 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
786 if (vl_config
->transmit_delay
)
788 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
789 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
797 /* The business end of all of the above */
799 ospf_vl_set (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
801 struct ospf_vl_data
*vl_data
;
804 vl_data
= ospf_find_vl_data (ospf
, vl_config
);
808 /* Process this one first as it can have a fatal result, which can
809 only logically occur if the virtual link exists already
810 Thus a command error does not result in a change to the
811 running configuration such as unexpectedly altered timer
813 ret
= ospf_vl_set_security (vl_data
, vl_config
);
814 if (ret
!= CMD_SUCCESS
)
817 /* Set any time based parameters, these area already range checked */
819 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
820 if (ret
!= CMD_SUCCESS
)
827 /* This stuff exists to make specifying all the alias commands A LOT simpler
829 #define VLINK_HELPSTR_IPADDR \
830 "OSPF area parameters\n" \
831 "OSPF area ID in IP address format\n" \
832 "OSPF area ID as a decimal value\n" \
833 "Configure a virtual link\n" \
834 "Router ID of the remote ABR\n"
836 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
837 "Enable authentication on this virtual link\n" \
840 #define VLINK_HELPSTR_AUTHTYPE_ALL \
841 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
842 "Use null authentication\n" \
843 "Use message-digest authentication\n"
845 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
846 "Time between HELLO packets\n" \
847 "Time between retransmitting lost link state advertisements\n" \
848 "Link state transmit delay\n" \
849 "Interval after which a neighbor is declared dead\n"
851 #define VLINK_HELPSTR_TIME_PARAM \
852 VLINK_HELPSTR_TIME_PARAM_NOSECS \
855 #define VLINK_HELPSTR_AUTH_SIMPLE \
856 "Authentication password (key)\n" \
857 "The OSPF password (key)"
859 #define VLINK_HELPSTR_AUTH_MD5 \
860 "Message digest authentication password (key)\n" \
863 "Use MD5 algorithm\n" \
864 "The OSPF password (key)"
866 DEFUN (ospf_area_vlink
,
868 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
869 VLINK_HELPSTR_IPADDR
)
871 struct ospf
*ospf
= vty
->index
;
872 struct ospf_vl_config_data vl_config
;
873 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
874 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
878 ospf_vl_config_data_init(&vl_config
, vty
);
880 /* Read off first 2 parameters and check them */
881 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &vl_config
.format
);
884 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
888 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
891 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
898 /* Thats all folks! - BUGS B. strikes again!!!*/
900 return ospf_vl_set (ospf
, &vl_config
);
903 /* Deal with other parameters */
904 for (i
=2; i
< argc
; i
++)
907 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
913 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
915 /* authentication-key - this option can occur anywhere on
916 command line. At start of command line
917 must check for authentication option. */
918 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
919 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
920 vl_config
.auth_key
= auth_key
;
923 else if (strncmp (argv
[i
], "authentication", 14) == 0)
925 /* authentication - this option can only occur at start
927 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
930 if (strncmp (argv
[i
+1], "n", 1) == 0)
932 /* "authentication null" */
933 vl_config
.auth_type
= OSPF_AUTH_NULL
;
936 else if (strncmp (argv
[i
+1], "m", 1) == 0
937 && strcmp (argv
[i
+1], "message-digest-") != 0)
939 /* "authentication message-digest" */
940 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
948 /* message-digest-key */
950 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
951 if (vl_config
.crypto_key_id
< 0)
954 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
955 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
956 vl_config
.md5_key
= md5_key
;
962 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
963 if (vl_config
.hello_interval
< 0)
968 /* Retransmit Interval */
970 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
971 if (vl_config
.retransmit_interval
< 0)
978 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
979 if (vl_config
.transmit_delay
< 0)
986 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
987 if (vl_config
.dead_interval
< 0)
994 /* Action configuration */
996 return ospf_vl_set (ospf
, &vl_config
);
1000 DEFUN (no_ospf_area_vlink
,
1001 no_ospf_area_vlink_cmd
,
1002 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1004 VLINK_HELPSTR_IPADDR
)
1006 struct ospf
*ospf
= vty
->index
;
1007 struct ospf_area
*area
;
1008 struct ospf_vl_config_data vl_config
;
1009 struct ospf_vl_data
*vl_data
= NULL
;
1010 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1014 ospf_vl_config_data_init(&vl_config
, vty
);
1016 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &format
);
1019 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1023 area
= ospf_area_lookup_by_area_id (ospf
, vl_config
.area_id
);
1026 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1030 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1033 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1040 /* Basic VLink no command */
1041 /* Thats all folks! - BUGS B. strikes again!!!*/
1042 if ((vl_data
= ospf_vl_lookup (area
, vl_config
.vl_peer
)))
1043 ospf_vl_delete (ospf
, vl_data
);
1045 ospf_area_check_free (ospf
, vl_config
.area_id
);
1050 /* If we are down here, we are reseting parameters */
1052 /* Deal with other parameters */
1053 for (i
=2; i
< argc
; i
++)
1055 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1061 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1063 /* authentication-key - this option can occur anywhere on
1064 command line. At start of command line
1065 must check for authentication option. */
1066 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1067 vl_config
.auth_key
= auth_key
;
1069 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1071 /* authentication - this option can only occur at start
1073 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1078 /* message-digest-key */
1079 /* Delete one key */
1081 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1082 if (vl_config
.crypto_key_id
< 0)
1084 vl_config
.md5_key
= NULL
;
1088 /* Hello interval */
1089 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1093 /* Retransmit Interval */
1094 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1098 /* Transmit Delay */
1099 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1105 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1111 /* Action configuration */
1113 return ospf_vl_set (ospf
, &vl_config
);
1116 ALIAS (ospf_area_vlink
,
1117 ospf_area_vlink_param1_cmd
,
1118 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1119 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1120 VLINK_HELPSTR_IPADDR
1121 VLINK_HELPSTR_TIME_PARAM
)
1123 ALIAS (no_ospf_area_vlink
,
1124 no_ospf_area_vlink_param1_cmd
,
1125 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1126 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1128 VLINK_HELPSTR_IPADDR
1129 VLINK_HELPSTR_TIME_PARAM
)
1131 ALIAS (ospf_area_vlink
,
1132 ospf_area_vlink_param2_cmd
,
1133 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1134 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1135 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1136 VLINK_HELPSTR_IPADDR
1137 VLINK_HELPSTR_TIME_PARAM
1138 VLINK_HELPSTR_TIME_PARAM
)
1140 ALIAS (no_ospf_area_vlink
,
1141 no_ospf_area_vlink_param2_cmd
,
1142 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1143 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1144 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1146 VLINK_HELPSTR_IPADDR
1147 VLINK_HELPSTR_TIME_PARAM
1148 VLINK_HELPSTR_TIME_PARAM
)
1150 ALIAS (ospf_area_vlink
,
1151 ospf_area_vlink_param3_cmd
,
1152 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1153 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1154 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1155 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1156 VLINK_HELPSTR_IPADDR
1157 VLINK_HELPSTR_TIME_PARAM
1158 VLINK_HELPSTR_TIME_PARAM
1159 VLINK_HELPSTR_TIME_PARAM
)
1161 ALIAS (no_ospf_area_vlink
,
1162 no_ospf_area_vlink_param3_cmd
,
1163 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1164 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1165 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1166 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1168 VLINK_HELPSTR_IPADDR
1169 VLINK_HELPSTR_TIME_PARAM
1170 VLINK_HELPSTR_TIME_PARAM
1171 VLINK_HELPSTR_TIME_PARAM
)
1173 ALIAS (ospf_area_vlink
,
1174 ospf_area_vlink_param4_cmd
,
1175 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1176 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1177 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1178 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1179 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1180 VLINK_HELPSTR_IPADDR
1181 VLINK_HELPSTR_TIME_PARAM
1182 VLINK_HELPSTR_TIME_PARAM
1183 VLINK_HELPSTR_TIME_PARAM
1184 VLINK_HELPSTR_TIME_PARAM
)
1186 ALIAS (no_ospf_area_vlink
,
1187 no_ospf_area_vlink_param4_cmd
,
1188 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1189 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1190 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1191 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1192 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1194 VLINK_HELPSTR_IPADDR
1195 VLINK_HELPSTR_TIME_PARAM
1196 VLINK_HELPSTR_TIME_PARAM
1197 VLINK_HELPSTR_TIME_PARAM
1198 VLINK_HELPSTR_TIME_PARAM
)
1200 ALIAS (ospf_area_vlink
,
1201 ospf_area_vlink_authtype_args_cmd
,
1202 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1203 "(authentication|) (message-digest|null)",
1204 VLINK_HELPSTR_IPADDR
1205 VLINK_HELPSTR_AUTHTYPE_ALL
)
1207 ALIAS (ospf_area_vlink
,
1208 ospf_area_vlink_authtype_cmd
,
1209 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1210 "(authentication|)",
1211 VLINK_HELPSTR_IPADDR
1212 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1214 ALIAS (no_ospf_area_vlink
,
1215 no_ospf_area_vlink_authtype_cmd
,
1216 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1217 "(authentication|)",
1219 VLINK_HELPSTR_IPADDR
1220 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1222 ALIAS (ospf_area_vlink
,
1223 ospf_area_vlink_md5_cmd
,
1224 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1225 "(message-digest-key|) <1-255> md5 KEY",
1226 VLINK_HELPSTR_IPADDR
1227 VLINK_HELPSTR_AUTH_MD5
)
1229 ALIAS (no_ospf_area_vlink
,
1230 no_ospf_area_vlink_md5_cmd
,
1231 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1232 "(message-digest-key|) <1-255>",
1234 VLINK_HELPSTR_IPADDR
1235 VLINK_HELPSTR_AUTH_MD5
)
1237 ALIAS (ospf_area_vlink
,
1238 ospf_area_vlink_authkey_cmd
,
1239 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1240 "(authentication-key|) AUTH_KEY",
1241 VLINK_HELPSTR_IPADDR
1242 VLINK_HELPSTR_AUTH_SIMPLE
)
1244 ALIAS (no_ospf_area_vlink
,
1245 no_ospf_area_vlink_authkey_cmd
,
1246 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1247 "(authentication-key|)",
1249 VLINK_HELPSTR_IPADDR
1250 VLINK_HELPSTR_AUTH_SIMPLE
)
1252 ALIAS (ospf_area_vlink
,
1253 ospf_area_vlink_authtype_args_authkey_cmd
,
1254 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1255 "(authentication|) (message-digest|null) "
1256 "(authentication-key|) AUTH_KEY",
1257 VLINK_HELPSTR_IPADDR
1258 VLINK_HELPSTR_AUTHTYPE_ALL
1259 VLINK_HELPSTR_AUTH_SIMPLE
)
1261 ALIAS (ospf_area_vlink
,
1262 ospf_area_vlink_authtype_authkey_cmd
,
1263 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1264 "(authentication|) "
1265 "(authentication-key|) AUTH_KEY",
1266 VLINK_HELPSTR_IPADDR
1267 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1268 VLINK_HELPSTR_AUTH_SIMPLE
)
1270 ALIAS (no_ospf_area_vlink
,
1271 no_ospf_area_vlink_authtype_authkey_cmd
,
1272 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1273 "(authentication|) "
1274 "(authentication-key|)",
1276 VLINK_HELPSTR_IPADDR
1277 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1278 VLINK_HELPSTR_AUTH_SIMPLE
)
1280 ALIAS (ospf_area_vlink
,
1281 ospf_area_vlink_authtype_args_md5_cmd
,
1282 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1283 "(authentication|) (message-digest|null) "
1284 "(message-digest-key|) <1-255> md5 KEY",
1285 VLINK_HELPSTR_IPADDR
1286 VLINK_HELPSTR_AUTHTYPE_ALL
1287 VLINK_HELPSTR_AUTH_MD5
)
1289 ALIAS (ospf_area_vlink
,
1290 ospf_area_vlink_authtype_md5_cmd
,
1291 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1292 "(authentication|) "
1293 "(message-digest-key|) <1-255> md5 KEY",
1294 VLINK_HELPSTR_IPADDR
1295 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1296 VLINK_HELPSTR_AUTH_MD5
)
1298 ALIAS (no_ospf_area_vlink
,
1299 no_ospf_area_vlink_authtype_md5_cmd
,
1300 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1301 "(authentication|) "
1302 "(message-digest-key|)",
1304 VLINK_HELPSTR_IPADDR
1305 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1306 VLINK_HELPSTR_AUTH_MD5
)
1309 DEFUN (ospf_area_shortcut
,
1310 ospf_area_shortcut_cmd
,
1311 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1312 "OSPF area parameters\n"
1313 "OSPF area ID in IP address format\n"
1314 "OSPF area ID as a decimal value\n"
1315 "Configure the area's shortcutting mode\n"
1316 "Set default shortcutting behavior\n"
1317 "Enable shortcutting through the area\n"
1318 "Disable shortcutting through the area\n")
1320 struct ospf
*ospf
= vty
->index
;
1321 struct ospf_area
*area
;
1322 struct in_addr area_id
;
1326 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1328 area
= ospf_area_get (ospf
, area_id
, format
);
1330 if (strncmp (argv
[1], "de", 2) == 0)
1331 mode
= OSPF_SHORTCUT_DEFAULT
;
1332 else if (strncmp (argv
[1], "di", 2) == 0)
1333 mode
= OSPF_SHORTCUT_DISABLE
;
1334 else if (strncmp (argv
[1], "e", 1) == 0)
1335 mode
= OSPF_SHORTCUT_ENABLE
;
1339 ospf_area_shortcut_set (ospf
, area
, mode
);
1341 if (ospf
->abr_type
!= OSPF_ABR_SHORTCUT
)
1342 vty_out (vty
, "Shortcut area setting will take effect "
1343 "only when the router is configured as Shortcut ABR%s",
1349 DEFUN (no_ospf_area_shortcut
,
1350 no_ospf_area_shortcut_cmd
,
1351 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1353 "OSPF area parameters\n"
1354 "OSPF area ID in IP address format\n"
1355 "OSPF area ID as a decimal value\n"
1356 "Deconfigure the area's shortcutting mode\n"
1357 "Deconfigure enabled shortcutting through the area\n"
1358 "Deconfigure disabled shortcutting through the area\n")
1360 struct ospf
*ospf
= vty
->index
;
1361 struct ospf_area
*area
;
1362 struct in_addr area_id
;
1365 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1367 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1371 ospf_area_shortcut_unset (ospf
, area
);
1377 DEFUN (ospf_area_stub
,
1379 "area (A.B.C.D|<0-4294967295>) stub",
1380 "OSPF area parameters\n"
1381 "OSPF area ID in IP address format\n"
1382 "OSPF area ID as a decimal value\n"
1383 "Configure OSPF area as stub\n")
1385 struct ospf
*ospf
= vty
->index
;
1386 struct in_addr area_id
;
1389 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1391 ret
= ospf_area_stub_set (ospf
, area_id
);
1394 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1399 ospf_area_no_summary_unset (ospf
, area_id
);
1404 DEFUN (ospf_area_stub_no_summary
,
1405 ospf_area_stub_no_summary_cmd
,
1406 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1407 "OSPF stub parameters\n"
1408 "OSPF area ID in IP address format\n"
1409 "OSPF area ID as a decimal value\n"
1410 "Configure OSPF area as stub\n"
1411 "Do not inject inter-area routes into stub\n")
1413 struct ospf
*ospf
= vty
->index
;
1414 struct in_addr area_id
;
1417 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1419 ret
= ospf_area_stub_set (ospf
, area_id
);
1422 vty_out (vty
, "%% Area cannot be stub as it contains a virtual link%s",
1427 ospf_area_no_summary_set (ospf
, area_id
);
1432 DEFUN (no_ospf_area_stub
,
1433 no_ospf_area_stub_cmd
,
1434 "no area (A.B.C.D|<0-4294967295>) stub",
1436 "OSPF area parameters\n"
1437 "OSPF area ID in IP address format\n"
1438 "OSPF area ID as a decimal value\n"
1439 "Configure OSPF area as stub\n")
1441 struct ospf
*ospf
= vty
->index
;
1442 struct in_addr area_id
;
1445 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1447 ospf_area_stub_unset (ospf
, area_id
);
1448 ospf_area_no_summary_unset (ospf
, area_id
);
1453 DEFUN (no_ospf_area_stub_no_summary
,
1454 no_ospf_area_stub_no_summary_cmd
,
1455 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1457 "OSPF area parameters\n"
1458 "OSPF area ID in IP address format\n"
1459 "OSPF area ID as a decimal value\n"
1460 "Configure OSPF area as stub\n"
1461 "Do not inject inter-area routes into area\n")
1463 struct ospf
*ospf
= vty
->index
;
1464 struct in_addr area_id
;
1467 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1468 ospf_area_no_summary_unset (ospf
, area_id
);
1474 ospf_area_nssa_cmd_handler (struct vty
*vty
, int argc
, const char *argv
[],
1477 struct ospf
*ospf
= vty
->index
;
1478 struct in_addr area_id
;
1481 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1483 ret
= ospf_area_nssa_set (ospf
, area_id
);
1486 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1493 if (strncmp (argv
[1], "translate-c", 11) == 0)
1494 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1495 OSPF_NSSA_ROLE_CANDIDATE
);
1496 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1497 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1498 OSPF_NSSA_ROLE_NEVER
);
1499 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1500 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1501 OSPF_NSSA_ROLE_ALWAYS
);
1505 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1506 OSPF_NSSA_ROLE_CANDIDATE
);
1510 ospf_area_no_summary_set (ospf
, area_id
);
1512 ospf_area_no_summary_unset (ospf
, area_id
);
1514 ospf_schedule_abr_task (ospf
);
1519 DEFUN (ospf_area_nssa_translate_no_summary
,
1520 ospf_area_nssa_translate_no_summary_cmd
,
1521 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
1522 "OSPF area parameters\n"
1523 "OSPF area ID in IP address format\n"
1524 "OSPF area ID as a decimal value\n"
1525 "Configure OSPF area as nssa\n"
1526 "Configure NSSA-ABR for translate election (default)\n"
1527 "Configure NSSA-ABR to never translate\n"
1528 "Configure NSSA-ABR to always translate\n"
1529 "Do not inject inter-area routes into nssa\n")
1531 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1534 DEFUN (ospf_area_nssa_translate
,
1535 ospf_area_nssa_translate_cmd
,
1536 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1537 "OSPF area parameters\n"
1538 "OSPF area ID in IP address format\n"
1539 "OSPF area ID as a decimal value\n"
1540 "Configure OSPF area as nssa\n"
1541 "Configure NSSA-ABR for translate election (default)\n"
1542 "Configure NSSA-ABR to never translate\n"
1543 "Configure NSSA-ABR to always translate\n")
1545 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1548 DEFUN (ospf_area_nssa
,
1550 "area (A.B.C.D|<0-4294967295>) nssa",
1551 "OSPF area parameters\n"
1552 "OSPF area ID in IP address format\n"
1553 "OSPF area ID as a decimal value\n"
1554 "Configure OSPF area as nssa\n")
1556 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1559 DEFUN (ospf_area_nssa_no_summary
,
1560 ospf_area_nssa_no_summary_cmd
,
1561 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1562 "OSPF area parameters\n"
1563 "OSPF area ID in IP address format\n"
1564 "OSPF area ID as a decimal value\n"
1565 "Configure OSPF area as nssa\n"
1566 "Do not inject inter-area routes into nssa\n")
1568 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1571 DEFUN (no_ospf_area_nssa
,
1572 no_ospf_area_nssa_cmd
,
1573 "no area (A.B.C.D|<0-4294967295>) nssa",
1575 "OSPF area parameters\n"
1576 "OSPF area ID in IP address format\n"
1577 "OSPF area ID as a decimal value\n"
1578 "Configure OSPF area as nssa\n")
1580 struct ospf
*ospf
= vty
->index
;
1581 struct in_addr area_id
;
1584 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1586 ospf_area_nssa_unset (ospf
, area_id
);
1587 ospf_area_no_summary_unset (ospf
, area_id
);
1589 ospf_schedule_abr_task (ospf
);
1594 DEFUN (no_ospf_area_nssa_no_summary
,
1595 no_ospf_area_nssa_no_summary_cmd
,
1596 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1598 "OSPF area parameters\n"
1599 "OSPF area ID in IP address format\n"
1600 "OSPF area ID as a decimal value\n"
1601 "Configure OSPF area as nssa\n"
1602 "Do not inject inter-area routes into nssa\n")
1604 struct ospf
*ospf
= vty
->index
;
1605 struct in_addr area_id
;
1608 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1609 ospf_area_no_summary_unset (ospf
, area_id
);
1614 DEFUN (ospf_area_default_cost
,
1615 ospf_area_default_cost_cmd
,
1616 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1617 "OSPF area parameters\n"
1618 "OSPF area ID in IP address format\n"
1619 "OSPF area ID as a decimal value\n"
1620 "Set the summary-default cost of a NSSA or stub area\n"
1621 "Stub's advertised default summary cost\n")
1623 struct ospf
*ospf
= vty
->index
;
1624 struct ospf_area
*area
;
1625 struct in_addr area_id
;
1629 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1630 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1632 area
= ospf_area_get (ospf
, area_id
, format
);
1634 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1636 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1640 area
->default_cost
= cost
;
1645 DEFUN (no_ospf_area_default_cost
,
1646 no_ospf_area_default_cost_cmd
,
1647 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1649 "OSPF area parameters\n"
1650 "OSPF area ID in IP address format\n"
1651 "OSPF area ID as a decimal value\n"
1652 "Set the summary-default cost of a NSSA or stub area\n"
1653 "Stub's advertised default summary cost\n")
1655 struct ospf
*ospf
= vty
->index
;
1656 struct ospf_area
*area
;
1657 struct in_addr area_id
;
1661 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1662 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1664 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1668 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1670 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1674 area
->default_cost
= 1;
1676 ospf_area_check_free (ospf
, area_id
);
1681 DEFUN (ospf_area_export_list
,
1682 ospf_area_export_list_cmd
,
1683 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1684 "OSPF area parameters\n"
1685 "OSPF area ID in IP address format\n"
1686 "OSPF area ID as a decimal value\n"
1687 "Set the filter for networks announced to other areas\n"
1688 "Name of the access-list\n")
1690 struct ospf
*ospf
= vty
->index
;
1691 struct ospf_area
*area
;
1692 struct in_addr area_id
;
1695 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1697 area
= ospf_area_get (ospf
, area_id
, format
);
1698 ospf_area_export_list_set (ospf
, area
, argv
[1]);
1703 DEFUN (no_ospf_area_export_list
,
1704 no_ospf_area_export_list_cmd
,
1705 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1707 "OSPF area parameters\n"
1708 "OSPF area ID in IP address format\n"
1709 "OSPF area ID as a decimal value\n"
1710 "Unset the filter for networks announced to other areas\n"
1711 "Name of the access-list\n")
1713 struct ospf
*ospf
= vty
->index
;
1714 struct ospf_area
*area
;
1715 struct in_addr area_id
;
1718 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1720 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1724 ospf_area_export_list_unset (ospf
, area
);
1730 DEFUN (ospf_area_import_list
,
1731 ospf_area_import_list_cmd
,
1732 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1733 "OSPF area parameters\n"
1734 "OSPF area ID in IP address format\n"
1735 "OSPF area ID as a decimal value\n"
1736 "Set the filter for networks from other areas announced to the specified one\n"
1737 "Name of the access-list\n")
1739 struct ospf
*ospf
= vty
->index
;
1740 struct ospf_area
*area
;
1741 struct in_addr area_id
;
1744 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1746 area
= ospf_area_get (ospf
, area_id
, format
);
1747 ospf_area_import_list_set (ospf
, area
, argv
[1]);
1752 DEFUN (no_ospf_area_import_list
,
1753 no_ospf_area_import_list_cmd
,
1754 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1756 "OSPF area parameters\n"
1757 "OSPF area ID in IP address format\n"
1758 "OSPF area ID as a decimal value\n"
1759 "Unset the filter for networks announced to other areas\n"
1760 "Name of the access-list\n")
1762 struct ospf
*ospf
= vty
->index
;
1763 struct ospf_area
*area
;
1764 struct in_addr area_id
;
1767 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1769 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1773 ospf_area_import_list_unset (ospf
, area
);
1778 DEFUN (ospf_area_filter_list
,
1779 ospf_area_filter_list_cmd
,
1780 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1781 "OSPF area parameters\n"
1782 "OSPF area ID in IP address format\n"
1783 "OSPF area ID as a decimal value\n"
1784 "Filter networks between OSPF areas\n"
1785 "Filter prefixes between OSPF areas\n"
1786 "Name of an IP prefix-list\n"
1787 "Filter networks sent to this area\n"
1788 "Filter networks sent from this area\n")
1790 struct ospf
*ospf
= vty
->index
;
1791 struct ospf_area
*area
;
1792 struct in_addr area_id
;
1793 struct prefix_list
*plist
;
1796 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1798 area
= ospf_area_get (ospf
, area_id
, format
);
1799 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1800 if (strncmp (argv
[2], "in", 2) == 0)
1802 PREFIX_LIST_IN (area
) = plist
;
1803 if (PREFIX_NAME_IN (area
))
1804 free (PREFIX_NAME_IN (area
));
1806 PREFIX_NAME_IN (area
) = strdup (argv
[1]);
1807 ospf_schedule_abr_task (ospf
);
1811 PREFIX_LIST_OUT (area
) = plist
;
1812 if (PREFIX_NAME_OUT (area
))
1813 free (PREFIX_NAME_OUT (area
));
1815 PREFIX_NAME_OUT (area
) = strdup (argv
[1]);
1816 ospf_schedule_abr_task (ospf
);
1822 DEFUN (no_ospf_area_filter_list
,
1823 no_ospf_area_filter_list_cmd
,
1824 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1826 "OSPF area parameters\n"
1827 "OSPF area ID in IP address format\n"
1828 "OSPF area ID as a decimal value\n"
1829 "Filter networks between OSPF areas\n"
1830 "Filter prefixes between OSPF areas\n"
1831 "Name of an IP prefix-list\n"
1832 "Filter networks sent to this area\n"
1833 "Filter networks sent from this area\n")
1835 struct ospf
*ospf
= vty
->index
;
1836 struct ospf_area
*area
;
1837 struct in_addr area_id
;
1838 struct prefix_list
*plist
;
1841 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1843 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1844 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1845 if (strncmp (argv
[2], "in", 2) == 0)
1847 if (PREFIX_NAME_IN (area
))
1848 if (strcmp (PREFIX_NAME_IN (area
), argv
[1]) != 0)
1851 PREFIX_LIST_IN (area
) = NULL
;
1852 if (PREFIX_NAME_IN (area
))
1853 free (PREFIX_NAME_IN (area
));
1855 PREFIX_NAME_IN (area
) = NULL
;
1857 ospf_schedule_abr_task (ospf
);
1861 if (PREFIX_NAME_OUT (area
))
1862 if (strcmp (PREFIX_NAME_OUT (area
), argv
[1]) != 0)
1865 PREFIX_LIST_OUT (area
) = NULL
;
1866 if (PREFIX_NAME_OUT (area
))
1867 free (PREFIX_NAME_OUT (area
));
1869 PREFIX_NAME_OUT (area
) = NULL
;
1871 ospf_schedule_abr_task (ospf
);
1878 DEFUN (ospf_area_authentication_message_digest
,
1879 ospf_area_authentication_message_digest_cmd
,
1880 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1881 "OSPF area parameters\n"
1882 "Enable authentication\n"
1883 "Use message-digest authentication\n")
1885 struct ospf
*ospf
= vty
->index
;
1886 struct ospf_area
*area
;
1887 struct in_addr area_id
;
1890 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1892 area
= ospf_area_get (ospf
, area_id
, format
);
1893 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1898 DEFUN (ospf_area_authentication
,
1899 ospf_area_authentication_cmd
,
1900 "area (A.B.C.D|<0-4294967295>) authentication",
1901 "OSPF area parameters\n"
1902 "OSPF area ID in IP address format\n"
1903 "OSPF area ID as a decimal value\n"
1904 "Enable authentication\n")
1906 struct ospf
*ospf
= vty
->index
;
1907 struct ospf_area
*area
;
1908 struct in_addr area_id
;
1911 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1913 area
= ospf_area_get (ospf
, area_id
, format
);
1914 area
->auth_type
= OSPF_AUTH_SIMPLE
;
1919 DEFUN (no_ospf_area_authentication
,
1920 no_ospf_area_authentication_cmd
,
1921 "no area (A.B.C.D|<0-4294967295>) authentication",
1923 "OSPF area parameters\n"
1924 "OSPF area ID in IP address format\n"
1925 "OSPF area ID as a decimal value\n"
1926 "Enable authentication\n")
1928 struct ospf
*ospf
= vty
->index
;
1929 struct ospf_area
*area
;
1930 struct in_addr area_id
;
1933 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1935 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1939 area
->auth_type
= OSPF_AUTH_NULL
;
1941 ospf_area_check_free (ospf
, area_id
);
1947 DEFUN (ospf_abr_type
,
1949 "ospf abr-type (cisco|ibm|shortcut|standard)",
1950 "OSPF specific commands\n"
1951 "Set OSPF ABR type\n"
1952 "Alternative ABR, cisco implementation\n"
1953 "Alternative ABR, IBM implementation\n"
1955 "Standard behavior (RFC2328)\n")
1957 struct ospf
*ospf
= vty
->index
;
1958 u_char abr_type
= OSPF_ABR_UNKNOWN
;
1960 if (strncmp (argv
[0], "c", 1) == 0)
1961 abr_type
= OSPF_ABR_CISCO
;
1962 else if (strncmp (argv
[0], "i", 1) == 0)
1963 abr_type
= OSPF_ABR_IBM
;
1964 else if (strncmp (argv
[0], "sh", 2) == 0)
1965 abr_type
= OSPF_ABR_SHORTCUT
;
1966 else if (strncmp (argv
[0], "st", 2) == 0)
1967 abr_type
= OSPF_ABR_STAND
;
1971 /* If ABR type value is changed, schedule ABR task. */
1972 if (ospf
->abr_type
!= abr_type
)
1974 ospf
->abr_type
= abr_type
;
1975 ospf_schedule_abr_task (ospf
);
1981 DEFUN (no_ospf_abr_type
,
1982 no_ospf_abr_type_cmd
,
1983 "no ospf abr-type (cisco|ibm|shortcut)",
1985 "OSPF specific commands\n"
1986 "Set OSPF ABR type\n"
1987 "Alternative ABR, cisco implementation\n"
1988 "Alternative ABR, IBM implementation\n"
1991 struct ospf
*ospf
= vty
->index
;
1992 u_char abr_type
= OSPF_ABR_UNKNOWN
;
1994 if (strncmp (argv
[0], "c", 1) == 0)
1995 abr_type
= OSPF_ABR_CISCO
;
1996 else if (strncmp (argv
[0], "i", 1) == 0)
1997 abr_type
= OSPF_ABR_IBM
;
1998 else if (strncmp (argv
[0], "s", 1) == 0)
1999 abr_type
= OSPF_ABR_SHORTCUT
;
2003 /* If ABR type value is changed, schedule ABR task. */
2004 if (ospf
->abr_type
== abr_type
)
2006 ospf
->abr_type
= OSPF_ABR_STAND
;
2007 ospf_schedule_abr_task (ospf
);
2013 DEFUN (ospf_compatible_rfc1583
,
2014 ospf_compatible_rfc1583_cmd
,
2015 "compatible rfc1583",
2016 "OSPF compatibility list\n"
2017 "compatible with RFC 1583\n")
2019 struct ospf
*ospf
= vty
->index
;
2021 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2023 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2024 ospf_spf_calculate_schedule (ospf
);
2029 DEFUN (no_ospf_compatible_rfc1583
,
2030 no_ospf_compatible_rfc1583_cmd
,
2031 "no compatible rfc1583",
2033 "OSPF compatibility list\n"
2034 "compatible with RFC 1583\n")
2036 struct ospf
*ospf
= vty
->index
;
2038 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2040 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2041 ospf_spf_calculate_schedule (ospf
);
2046 ALIAS (ospf_compatible_rfc1583
,
2047 ospf_rfc1583_flag_cmd
,
2048 "ospf rfc1583compatibility",
2049 "OSPF specific commands\n"
2050 "Enable the RFC1583Compatibility flag\n")
2052 ALIAS (no_ospf_compatible_rfc1583
,
2053 no_ospf_rfc1583_flag_cmd
,
2054 "no ospf rfc1583compatibility",
2056 "OSPF specific commands\n"
2057 "Disable the RFC1583Compatibility flag\n")
2059 DEFUN (ospf_timers_spf
,
2060 ospf_timers_spf_cmd
,
2061 "timers spf <0-4294967295> <0-4294967295>",
2062 "Adjust routing timers\n"
2064 "Delay between receiving a change to SPF calculation\n"
2065 "Hold time between consecutive SPF calculations\n")
2067 struct ospf
*ospf
= vty
->index
;
2068 u_int32_t delay
, hold
;
2070 VTY_GET_UINT32 ("SPF delay timer", delay
, argv
[0]);
2071 VTY_GET_UINT32 ("SPF hold timer", hold
, argv
[1]);
2073 ospf_timers_spf_set (ospf
, delay
, hold
);
2078 DEFUN (no_ospf_timers_spf
,
2079 no_ospf_timers_spf_cmd
,
2082 "Adjust routing timers\n"
2083 "OSPF SPF timers\n")
2085 struct ospf
*ospf
= vty
->index
;
2087 ospf
->spf_delay
= OSPF_SPF_DELAY_DEFAULT
;
2088 ospf
->spf_holdtime
= OSPF_SPF_HOLDTIME_DEFAULT
;
2094 DEFUN (ospf_neighbor
,
2098 "Neighbor IP address\n")
2100 struct ospf
*ospf
= vty
->index
;
2101 struct in_addr nbr_addr
;
2102 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2103 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2105 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2108 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2111 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2113 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2115 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2117 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, priority
);
2122 ALIAS (ospf_neighbor
,
2123 ospf_neighbor_priority_poll_interval_cmd
,
2124 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2126 "Neighbor IP address\n"
2127 "Neighbor Priority\n"
2129 "Dead Neighbor Polling interval\n"
2132 ALIAS (ospf_neighbor
,
2133 ospf_neighbor_priority_cmd
,
2134 "neighbor A.B.C.D priority <0-255>",
2136 "Neighbor IP address\n"
2137 "Neighbor Priority\n"
2140 DEFUN (ospf_neighbor_poll_interval
,
2141 ospf_neighbor_poll_interval_cmd
,
2142 "neighbor A.B.C.D poll-interval <1-65535>",
2144 "Neighbor IP address\n"
2145 "Dead Neighbor Polling interval\n"
2148 struct ospf
*ospf
= vty
->index
;
2149 struct in_addr nbr_addr
;
2150 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2151 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2153 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2156 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[1], 1, 65535);
2159 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2161 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2163 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2165 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2170 ALIAS (ospf_neighbor_poll_interval
,
2171 ospf_neighbor_poll_interval_priority_cmd
,
2172 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2174 "Neighbor address\n"
2175 "OSPF dead-router polling interval\n"
2177 "OSPF priority of non-broadcast neighbor\n"
2180 DEFUN (no_ospf_neighbor
,
2181 no_ospf_neighbor_cmd
,
2182 "no neighbor A.B.C.D",
2185 "Neighbor IP address\n")
2187 struct ospf
*ospf
= vty
->index
;
2188 struct in_addr nbr_addr
;
2191 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2193 ret
= ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2198 ALIAS (no_ospf_neighbor
,
2199 no_ospf_neighbor_priority_cmd
,
2200 "no neighbor A.B.C.D priority <0-255>",
2203 "Neighbor IP address\n"
2204 "Neighbor Priority\n"
2207 ALIAS (no_ospf_neighbor
,
2208 no_ospf_neighbor_poll_interval_cmd
,
2209 "no neighbor A.B.C.D poll-interval <1-65535>",
2212 "Neighbor IP address\n"
2213 "Dead Neighbor Polling interval\n"
2216 ALIAS (no_ospf_neighbor
,
2217 no_ospf_neighbor_priority_pollinterval_cmd
,
2218 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2221 "Neighbor IP address\n"
2222 "Neighbor Priority\n"
2224 "Dead Neighbor Polling interval\n"
2228 DEFUN (ospf_refresh_timer
, ospf_refresh_timer_cmd
,
2229 "refresh timer <10-1800>",
2230 "Adjust refresh parameters\n"
2231 "Set refresh timer\n"
2232 "Timer value in seconds\n")
2234 struct ospf
*ospf
= vty
->index
;
2235 unsigned int interval
;
2237 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2238 interval
= (interval
/ 10) * 10;
2240 ospf_timers_refresh_set (ospf
, interval
);
2245 DEFUN (no_ospf_refresh_timer
, no_ospf_refresh_timer_val_cmd
,
2246 "no refresh timer <10-1800>",
2247 "Adjust refresh parameters\n"
2248 "Unset refresh timer\n"
2249 "Timer value in seconds\n")
2251 struct ospf
*ospf
= vty
->index
;
2252 unsigned int interval
;
2256 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2258 if (ospf
->lsa_refresh_interval
!= interval
||
2259 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2263 ospf_timers_refresh_unset (ospf
);
2268 ALIAS (no_ospf_refresh_timer
,
2269 no_ospf_refresh_timer_cmd
,
2271 "Adjust refresh parameters\n"
2272 "Unset refresh timer\n")
2274 DEFUN (ospf_auto_cost_reference_bandwidth
,
2275 ospf_auto_cost_reference_bandwidth_cmd
,
2276 "auto-cost reference-bandwidth <1-4294967>",
2277 "Calculate OSPF interface cost according to bandwidth\n"
2278 "Use reference bandwidth method to assign OSPF cost\n"
2279 "The reference bandwidth in terms of Mbits per second\n")
2281 struct ospf
*ospf
= vty
->index
;
2283 struct listnode
*node
;
2285 refbw
= strtol (argv
[0], NULL
, 10);
2286 if (refbw
< 1 || refbw
> 4294967)
2288 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2292 /* If reference bandwidth is changed. */
2293 if ((refbw
* 1000) == ospf
->ref_bandwidth
)
2296 ospf
->ref_bandwidth
= refbw
* 1000;
2297 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2298 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2300 for (node
= listhead (om
->iflist
); node
; nextnode (node
))
2301 ospf_if_recalculate_output_cost (getdata (node
));
2306 DEFUN (no_ospf_auto_cost_reference_bandwidth
,
2307 no_ospf_auto_cost_reference_bandwidth_cmd
,
2308 "no auto-cost reference-bandwidth",
2310 "Calculate OSPF interface cost according to bandwidth\n"
2311 "Use reference bandwidth method to assign OSPF cost\n")
2313 struct ospf
*ospf
= vty
->index
;
2314 struct listnode
*node
;
2316 if (ospf
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
2319 ospf
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
2320 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2321 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2323 for (node
= listhead (om
->iflist
); node
; nextnode (node
))
2324 ospf_if_recalculate_output_cost (getdata (node
));
2329 const char *ospf_abr_type_descr_str
[] =
2332 "Standard (RFC2328)",
2334 "Alternative Cisco",
2335 "Alternative Shortcut"
2338 const char *ospf_shortcut_mode_descr_str
[] =
2348 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
)
2351 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
2353 /* Show Area type/mode. */
2354 if (OSPF_IS_AREA_BACKBONE (area
))
2355 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
2358 if (area
->external_routing
== OSPF_AREA_STUB
)
2359 vty_out (vty
, " (Stub%s%s)",
2360 area
->no_summary
? ", no summary" : "",
2361 area
->shortcut_configured
? "; " : "");
2363 else if (area
->external_routing
== OSPF_AREA_NSSA
)
2364 vty_out (vty
, " (NSSA%s%s)",
2365 area
->no_summary
? ", no summary" : "",
2366 area
->shortcut_configured
? "; " : "");
2368 vty_out (vty
, "%s", VTY_NEWLINE
);
2369 vty_out (vty
, " Shortcutting mode: %s",
2370 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
2371 vty_out (vty
, ", S-bit consensus: %s%s",
2372 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
2375 /* Show number of interfaces. */
2376 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
2377 "Active: %d%s", listcount (area
->oiflist
),
2378 area
->act_ints
, VTY_NEWLINE
);
2380 if (area
->external_routing
== OSPF_AREA_NSSA
)
2382 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
2383 if (! IS_OSPF_ABR (area
->ospf
))
2384 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
2386 else if (area
->NSSATranslatorState
)
2388 vty_out (vty
, " We are an ABR and ");
2389 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2390 vty_out (vty
, "the NSSA Elected Translator. %s",
2392 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
2393 vty_out (vty
, "always an NSSA Translator. %s",
2398 vty_out (vty
, " We are an ABR, but ");
2399 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2400 vty_out (vty
, "not the NSSA Elected Translator. %s",
2403 vty_out (vty
, "not the NSSA Elected Translator. %s",
2408 /* Show number of fully adjacent neighbors. */
2409 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
2410 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
2412 /* Show authentication type. */
2413 vty_out (vty
, " Area has ");
2414 if (area
->auth_type
== OSPF_AUTH_NULL
)
2415 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
2416 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
2417 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
2418 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
2419 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
2421 if (!OSPF_IS_AREA_BACKBONE (area
))
2422 vty_out (vty
, " Number of full virtual adjacencies going through"
2423 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
2425 /* Show SPF calculation times. */
2426 vty_out (vty
, " SPF algorithm executed %d times%s",
2427 area
->spf_calculation
, VTY_NEWLINE
);
2429 /* Show number of LSA. */
2430 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
2432 vty_out (vty
, "%s", VTY_NEWLINE
);
2435 DEFUN (show_ip_ospf
,
2440 "OSPF information\n")
2442 struct listnode
*node
;
2443 struct ospf_area
* area
;
2446 /* Check OSPF is enable. */
2447 ospf
= ospf_lookup ();
2450 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2454 /* Show Router ID. */
2455 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
2456 inet_ntoa (ospf
->router_id
),
2459 /* Show capability. */
2460 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
2461 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
2462 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
2463 CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
) ?
2464 "enabled" : "disabled", VTY_NEWLINE
);
2465 #ifdef HAVE_OPAQUE_LSA
2466 vty_out (vty
, " OpaqueCapability flag is %s%s%s",
2467 CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
) ?
2468 "enabled" : "disabled",
2469 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf
->opaque
) ?
2470 " (origination blocked)" : "",
2472 #endif /* HAVE_OPAQUE_LSA */
2474 /* Show SPF timers. */
2475 vty_out (vty
, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s",
2476 ospf
->spf_delay
, ospf
->spf_holdtime
, VTY_NEWLINE
);
2478 /* Show refresh parameters. */
2479 vty_out (vty
, " Refresh timer %d secs%s",
2480 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
2482 /* Show ABR/ASBR flags. */
2483 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
2484 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
2485 ospf_abr_type_descr_str
[ospf
->abr_type
], VTY_NEWLINE
);
2487 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
2488 vty_out (vty
, " This router is an ASBR "
2489 "(injecting external routing information)%s", VTY_NEWLINE
);
2491 /* Show Number of AS-external-LSAs. */
2492 vty_out (vty
, " Number of external LSA %ld%s",
2493 ospf_lsdb_count_all (ospf
->lsdb
), VTY_NEWLINE
);
2495 /* Show number of areas attached. */
2496 vty_out (vty
, " Number of areas attached to this router: %d%s%s",
2497 listcount (ospf
->areas
), VTY_NEWLINE
, VTY_NEWLINE
);
2499 /* Show each area status. */
2500 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
2501 if ((area
= getdata (node
)) != NULL
)
2502 show_ip_ospf_area (vty
, area
);
2509 show_ip_ospf_interface_sub (struct vty
*vty
, struct ospf
*ospf
,
2510 struct interface
*ifp
)
2512 struct ospf_neighbor
*nbr
;
2514 struct route_node
*rn
;
2517 oi_count
= ospf_oi_count (ifp
);
2519 /* Is interface up? */
2520 if (if_is_operative (ifp
)) {
2521 vty_out (vty
, "%s is up%s", ifp
->name
, VTY_NEWLINE
);
2524 vty_out (vty
, "%s is down%s", ifp
->name
, VTY_NEWLINE
);
2528 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2530 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
2535 /* Is interface OSPF enabled? */
2538 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2542 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
2544 struct ospf_interface
*oi
= rn
->info
;
2549 /* Show OSPF interface information. */
2550 vty_out (vty
, " Internet Address %s/%d,",
2551 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
2553 if (oi
->connected
->destination
)
2554 vty_out (vty
, " %s %s,",
2555 ((ifp
->flags
& IFF_POINTOPOINT
) ? "Peer" : "Broadcast"),
2556 inet_ntoa (oi
->connected
->destination
->u
.prefix4
));
2558 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
2561 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
2562 inet_ntoa (ospf
->router_id
), ospf_network_type_str
[oi
->type
],
2563 oi
->output_cost
, VTY_NEWLINE
);
2565 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
2566 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
2567 PRIORITY (oi
), VTY_NEWLINE
);
2569 /* Show DR information. */
2570 if (DR (oi
).s_addr
== 0)
2571 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2574 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &DR (oi
));
2576 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2579 vty_out (vty
, " Designated Router (ID) %s,",
2580 inet_ntoa (nbr
->router_id
));
2581 vty_out (vty
, " Interface Address %s%s",
2582 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2586 /* Show BDR information. */
2587 if (BDR (oi
).s_addr
== 0)
2588 vty_out (vty
, " No backup designated router on this network%s",
2592 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
2594 vty_out (vty
, " No backup designated router on this network%s",
2598 vty_out (vty
, " Backup Designated Router (ID) %s,",
2599 inet_ntoa (nbr
->router_id
));
2600 vty_out (vty
, " Interface Address %s%s",
2601 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2604 vty_out (vty
, " Timer intervals configured,");
2605 vty_out (vty
, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2606 OSPF_IF_PARAM (oi
, v_hello
), OSPF_IF_PARAM (oi
, v_wait
),
2607 OSPF_IF_PARAM (oi
, v_wait
),
2608 OSPF_IF_PARAM (oi
, retransmit_interval
),
2611 if (OSPF_IF_PARAM (oi
, passive_interface
) == OSPF_IF_ACTIVE
)
2612 vty_out (vty
, " Hello due in %s%s",
2613 ospf_timer_dump (oi
->t_hello
, buf
, 9), VTY_NEWLINE
);
2614 else /* OSPF_IF_PASSIVE is set */
2615 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
2617 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
2618 ospf_nbr_count (oi
, 0), ospf_nbr_count (oi
, NSM_Full
),
2623 DEFUN (show_ip_ospf_interface
,
2624 show_ip_ospf_interface_cmd
,
2625 "show ip ospf interface [INTERFACE]",
2628 "OSPF information\n"
2629 "Interface information\n"
2632 struct interface
*ifp
;
2634 struct listnode
*node
;
2636 ospf
= ospf_lookup ();
2638 /* Show All Interfaces. */
2640 for (node
= listhead (iflist
); node
; nextnode (node
))
2641 show_ip_ospf_interface_sub (vty
, ospf
, node
->data
);
2642 /* Interface name is specified. */
2645 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
2646 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
2648 show_ip_ospf_interface_sub (vty
, ospf
, ifp
);
2655 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
)
2657 struct route_node
*rn
;
2658 struct ospf_neighbor
*nbr
;
2662 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2663 if ((nbr
= rn
->info
))
2664 /* Do not show myself. */
2665 if (nbr
!= oi
->nbr_self
)
2666 /* Down state is not shown. */
2667 if (nbr
->state
!= NSM_Down
)
2669 ospf_nbr_state_message (nbr
, msgbuf
, 16);
2671 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2672 vty_out (vty
, "%-15s %3d %-15s %8s ",
2674 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2676 vty_out (vty
, "%-15s %3d %-15s %8s ",
2677 inet_ntoa (nbr
->router_id
), nbr
->priority
,
2678 msgbuf
, ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9));
2679 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
2680 vty_out (vty
, "%-15s %5ld %5ld %5d%s",
2681 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
2682 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
2687 DEFUN (show_ip_ospf_neighbor
,
2688 show_ip_ospf_neighbor_cmd
,
2689 "show ip ospf neighbor",
2692 "OSPF information\n"
2696 struct listnode
*node
;
2698 ospf
= ospf_lookup ();
2701 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2705 /* Show All neighbors. */
2706 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2707 "Time Address Interface RXmtL "
2708 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2710 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2711 show_ip_ospf_neighbor_sub (vty
, getdata (node
));
2716 DEFUN (show_ip_ospf_neighbor_all
,
2717 show_ip_ospf_neighbor_all_cmd
,
2718 "show ip ospf neighbor all",
2721 "OSPF information\n"
2723 "include down status neighbor\n")
2725 struct ospf
*ospf
= vty
->index
;
2726 struct listnode
*node
;
2730 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2734 /* Show All neighbors. */
2735 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2736 "Time Address Interface RXmtL "
2737 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2739 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2741 struct ospf_interface
*oi
= getdata (node
);
2742 struct listnode
*nbr_node
;
2744 show_ip_ospf_neighbor_sub (vty
, oi
);
2746 /* print Down neighbor status */
2747 for (nbr_node
= listhead (oi
->nbr_nbma
); nbr_node
; nextnode (nbr_node
))
2749 struct ospf_nbr_nbma
*nbr_nbma
;
2751 nbr_nbma
= getdata (nbr_node
);
2753 if (nbr_nbma
->nbr
== NULL
2754 || nbr_nbma
->nbr
->state
== NSM_Down
)
2756 vty_out (vty
, "%-15s %3d %-15s %8s ",
2757 "-", nbr_nbma
->priority
, "Down", "-");
2758 vty_out (vty
, "%-15s %-15s %5d %5d %5d%s",
2759 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
2760 0, 0, 0, VTY_NEWLINE
);
2768 DEFUN (show_ip_ospf_neighbor_int
,
2769 show_ip_ospf_neighbor_int_cmd
,
2770 "show ip ospf neighbor A.B.C.D",
2773 "OSPF information\n"
2778 struct ospf_interface
*oi
;
2779 struct in_addr addr
;
2782 ret
= inet_aton (argv
[0], &addr
);
2785 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
2790 ospf
= ospf_lookup ();
2793 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2797 if ((oi
= ospf_if_is_configured (ospf
, &addr
)) == NULL
)
2798 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
2801 vty_out (vty
, "%sNeighbor ID Pri State Dead "
2802 "Time Address Interface RXmtL "
2803 "RqstL DBsmL%s", VTY_NEWLINE
, VTY_NEWLINE
);
2804 show_ip_ospf_neighbor_sub (vty
, oi
);
2811 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2812 struct ospf_nbr_nbma
*nbr_nbma
)
2816 /* Show neighbor ID. */
2817 vty_out (vty
, " Neighbor %s,", "-");
2819 /* Show interface address. */
2820 vty_out (vty
, " interface address %s%s",
2821 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
2823 vty_out (vty
, " In the area %s via interface %s%s",
2824 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
2825 /* Show neighbor priority and state. */
2826 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2827 nbr_nbma
->priority
, "Down");
2828 /* Show state changes. */
2829 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
2831 /* Show PollInterval */
2832 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
2834 /* Show poll-interval timer. */
2835 vty_out (vty
, " Poll timer due in %s%s",
2836 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, 9), VTY_NEWLINE
);
2838 /* Show poll-interval timer thread. */
2839 vty_out (vty
, " Thread Poll Timer %s%s",
2840 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
2844 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
2845 struct ospf_neighbor
*nbr
)
2849 /* Show neighbor ID. */
2850 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2851 vty_out (vty
, " Neighbor %s,", "-");
2853 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
2855 /* Show interface address. */
2856 vty_out (vty
, " interface address %s%s",
2857 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2859 vty_out (vty
, " In the area %s via interface %s%s",
2860 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
2861 /* Show neighbor priority and state. */
2862 vty_out (vty
, " Neighbor priority is %d, State is %s,",
2863 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
2864 /* Show state changes. */
2865 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
2867 /* Show Designated Rotuer ID. */
2868 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
2869 /* Show Backup Designated Rotuer ID. */
2870 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
2872 vty_out (vty
, " Options %d %s%s", nbr
->options
,
2873 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
2874 /* Show Router Dead interval timer. */
2875 vty_out (vty
, " Dead timer due in %s%s",
2876 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, 9), VTY_NEWLINE
);
2877 /* Show Database Summary list. */
2878 vty_out (vty
, " Database Summary List %d%s",
2879 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
2880 /* Show Link State Request list. */
2881 vty_out (vty
, " Link State Request List %ld%s",
2882 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
2883 /* Show Link State Retransmission list. */
2884 vty_out (vty
, " Link State Retransmission List %ld%s",
2885 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
2886 /* Show inactivity timer thread. */
2887 vty_out (vty
, " Thread Inactivity Timer %s%s",
2888 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
2889 /* Show Database Description retransmission thread. */
2890 vty_out (vty
, " Thread Database Description Retransmision %s%s",
2891 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
2892 /* Show Link State Request Retransmission thread. */
2893 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
2894 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
2895 /* Show Link State Update Retransmission thread. */
2896 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
2897 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
2900 DEFUN (show_ip_ospf_neighbor_id
,
2901 show_ip_ospf_neighbor_id_cmd
,
2902 "show ip ospf neighbor A.B.C.D",
2905 "OSPF information\n"
2910 struct listnode
*node
;
2911 struct ospf_neighbor
*nbr
;
2912 struct in_addr router_id
;
2915 ret
= inet_aton (argv
[0], &router_id
);
2918 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
2922 ospf
= ospf_lookup ();
2925 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2929 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2931 struct ospf_interface
*oi
= getdata (node
);
2933 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
2935 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2940 /* Nothing to show. */
2944 DEFUN (show_ip_ospf_neighbor_detail
,
2945 show_ip_ospf_neighbor_detail_cmd
,
2946 "show ip ospf neighbor detail",
2949 "OSPF information\n"
2951 "detail of all neighbors\n")
2954 struct listnode
*node
;
2956 ospf
= ospf_lookup ();
2959 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2963 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
2965 struct ospf_interface
*oi
= getdata (node
);
2966 struct route_node
*rn
;
2967 struct ospf_neighbor
*nbr
;
2969 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2970 if ((nbr
= rn
->info
))
2971 if (nbr
!= oi
->nbr_self
)
2972 if (nbr
->state
!= NSM_Down
)
2973 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
2979 DEFUN (show_ip_ospf_neighbor_detail_all
,
2980 show_ip_ospf_neighbor_detail_all_cmd
,
2981 "show ip ospf neighbor detail all",
2984 "OSPF information\n"
2986 "detail of all neighbors\n"
2987 "include down status neighbor\n")
2990 struct listnode
*node
;
2992 ospf
= ospf_lookup ();
2995 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2999 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
3001 struct ospf_interface
*oi
= getdata (node
);
3002 struct route_node
*rn
;
3003 struct ospf_neighbor
*nbr
;
3005 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3006 if ((nbr
= rn
->info
))
3007 if (nbr
!= oi
->nbr_self
)
3008 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
3009 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
);
3011 if (oi
->type
== OSPF_IFTYPE_NBMA
)
3013 struct listnode
*nd
;
3015 for (nd
= listhead (oi
->nbr_nbma
); nd
; nextnode (nd
))
3017 struct ospf_nbr_nbma
*nbr_nbma
= getdata (nd
);
3018 if (nbr_nbma
->nbr
== NULL
3019 || nbr_nbma
->nbr
->state
== NSM_Down
)
3020 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
);
3028 DEFUN (show_ip_ospf_neighbor_int_detail
,
3029 show_ip_ospf_neighbor_int_detail_cmd
,
3030 "show ip ospf neighbor A.B.C.D detail",
3033 "OSPF information\n"
3035 "Interface address\n"
3036 "detail of all neighbors")
3039 struct ospf_interface
*oi
;
3040 struct in_addr addr
;
3043 ret
= inet_aton (argv
[0], &addr
);
3046 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3051 ospf
= ospf_lookup ();
3054 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3058 if ((oi
= ospf_if_is_configured (ospf
, &addr
)) == NULL
)
3059 vty_out (vty
, "No such interface address%s", VTY_NEWLINE
);
3062 struct route_node
*rn
;
3063 struct ospf_neighbor
*nbr
;
3065 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3066 if ((nbr
= rn
->info
))
3067 if (nbr
!= oi
->nbr_self
)
3068 if (nbr
->state
!= NSM_Down
)
3069 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3076 /* Show functions */
3078 show_lsa_summary (struct vty
*vty
, struct ospf_lsa
*lsa
, int self
)
3080 struct router_lsa
*rl
;
3081 struct summary_lsa
*sl
;
3082 struct as_external_lsa
*asel
;
3083 struct prefix_ipv4 p
;
3086 /* If self option is set, check LSA self flag. */
3087 if (self
== 0 || IS_LSA_SELF (lsa
))
3089 /* LSA common part show. */
3090 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
3091 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
3092 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
3093 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
3094 /* LSA specific part show. */
3095 switch (lsa
->data
->type
)
3097 case OSPF_ROUTER_LSA
:
3098 rl
= (struct router_lsa
*) lsa
->data
;
3099 vty_out (vty
, " %-d", ntohs (rl
->links
));
3101 case OSPF_SUMMARY_LSA
:
3102 sl
= (struct summary_lsa
*) lsa
->data
;
3105 p
.prefix
= sl
->header
.id
;
3106 p
.prefixlen
= ip_masklen (sl
->mask
);
3107 apply_mask_ipv4 (&p
);
3109 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
3111 case OSPF_AS_EXTERNAL_LSA
:
3112 case OSPF_AS_NSSA_LSA
:
3113 asel
= (struct as_external_lsa
*) lsa
->data
;
3116 p
.prefix
= asel
->header
.id
;
3117 p
.prefixlen
= ip_masklen (asel
->mask
);
3118 apply_mask_ipv4 (&p
);
3120 vty_out (vty
, " %s %s/%d [0x%lx]",
3121 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
3122 inet_ntoa (p
.prefix
), p
.prefixlen
,
3123 (u_long
)ntohl (asel
->e
[0].route_tag
));
3125 case OSPF_NETWORK_LSA
:
3126 case OSPF_ASBR_SUMMARY_LSA
:
3127 #ifdef HAVE_OPAQUE_LSA
3128 case OSPF_OPAQUE_LINK_LSA
:
3129 case OSPF_OPAQUE_AREA_LSA
:
3130 case OSPF_OPAQUE_AS_LSA
:
3131 #endif /* HAVE_OPAQUE_LSA */
3135 vty_out (vty
, VTY_NEWLINE
);
3141 const char *show_database_desc
[] =
3144 "Router Link States",
3146 "Summary Link States",
3147 "ASBR-Summary Link States",
3148 "AS External Link States",
3149 "Group Membership LSA",
3150 "NSSA-external Link States",
3151 #ifdef HAVE_OPAQUE_LSA
3153 "Link-Local Opaque-LSA",
3154 "Area-Local Opaque-LSA",
3155 "AS-external Opaque-LSA",
3156 #endif /* HAVE_OPAQUE_LSA */
3159 #define SHOW_OSPF_COMMON_HEADER \
3160 "Link ID ADV Router Age Seq# CkSum"
3162 const char *show_database_header
[] =
3165 "Link ID ADV Router Age Seq# CkSum Link count",
3166 "Link ID ADV Router Age Seq# CkSum",
3167 "Link ID ADV Router Age Seq# CkSum Route",
3168 "Link ID ADV Router Age Seq# CkSum",
3169 "Link ID ADV Router Age Seq# CkSum Route",
3170 " --- header for Group Member ----",
3171 "Link ID ADV Router Age Seq# CkSum Route",
3172 #ifdef HAVE_OPAQUE_LSA
3174 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3175 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3176 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3177 #endif /* HAVE_OPAQUE_LSA */
3180 const char *show_lsa_flags
[] =
3191 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
3193 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
3195 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
3196 vty_out (vty
, " Options: 0x%-2x : %s%s",
3198 ospf_options_dump(lsa
->data
->options
),
3200 vty_out (vty
, " LS Flags: 0x%-2x %s%s",
3202 ((lsa
->flags
& OSPF_LSA_LOCAL_XLT
) ? "(Translated from Type-7)" : ""),
3205 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
3207 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
3210 vty_out (vty
, " :%s%s%s%s",
3211 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
3212 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
3213 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
3214 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
3216 vty_out (vty
, "%s", VTY_NEWLINE
);
3218 vty_out (vty
, " LS Type: %s%s",
3219 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3220 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
3221 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3222 vty_out (vty
, " Advertising Router: %s%s",
3223 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3224 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
3226 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
3228 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
3231 const char *link_type_desc
[] =
3234 "another Router (point-to-point)",
3235 "a Transit Network",
3240 const char *link_id_desc
[] =
3243 "Neighboring Router ID",
3244 "Designated Router address",
3246 "Neighboring Router ID",
3249 const char *link_data_desc
[] =
3252 "Router Interface address",
3253 "Router Interface address",
3255 "Router Interface address",
3258 /* Show router-LSA each Link information. */
3260 show_ip_ospf_database_router_links (struct vty
*vty
,
3261 struct router_lsa
*rl
)
3265 len
= ntohs (rl
->header
.length
) - 4;
3266 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
3268 type
= rl
->link
[i
].type
;
3270 vty_out (vty
, " Link connected to: %s%s",
3271 link_type_desc
[type
], VTY_NEWLINE
);
3272 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
3273 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
3274 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
3275 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
3276 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
3277 vty_out (vty
, " TOS 0 Metric: %d%s",
3278 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
3279 vty_out (vty
, "%s", VTY_NEWLINE
);
3283 /* Show router-LSA detail information. */
3285 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3289 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
3291 show_ip_ospf_database_header (vty
, lsa
);
3293 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
3294 VTY_NEWLINE
, VTY_NEWLINE
);
3296 show_ip_ospf_database_router_links (vty
, rl
);
3297 vty_out (vty
, "%s", VTY_NEWLINE
);
3303 /* Show network-LSA detail information. */
3305 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3311 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
3313 show_ip_ospf_database_header (vty
, lsa
);
3315 vty_out (vty
, " Network Mask: /%d%s",
3316 ip_masklen (nl
->mask
), VTY_NEWLINE
);
3318 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
3320 for (i
= 0; length
> 0; i
++, length
-= 4)
3321 vty_out (vty
, " Attached Router: %s%s",
3322 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
3324 vty_out (vty
, "%s", VTY_NEWLINE
);
3330 /* Show summary-LSA detail information. */
3332 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3336 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3338 show_ip_ospf_database_header (vty
, lsa
);
3340 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
3342 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3344 vty_out (vty
, "%s", VTY_NEWLINE
);
3350 /* Show summary-ASBR-LSA detail information. */
3352 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3356 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3358 show_ip_ospf_database_header (vty
, lsa
);
3360 vty_out (vty
, " Network Mask: /%d%s",
3361 ip_masklen (sl
->mask
), VTY_NEWLINE
);
3362 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3364 vty_out (vty
, "%s", VTY_NEWLINE
);
3370 /* Show AS-external-LSA detail information. */
3372 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3376 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3378 show_ip_ospf_database_header (vty
, lsa
);
3380 vty_out (vty
, " Network Mask: /%d%s",
3381 ip_masklen (al
->mask
), VTY_NEWLINE
);
3382 vty_out (vty
, " Metric Type: %s%s",
3383 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3384 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3385 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3386 vty_out (vty
, " Metric: %d%s",
3387 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3388 vty_out (vty
, " Forward Address: %s%s",
3389 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3391 vty_out (vty
, " External Route Tag: %lu%s%s",
3392 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3399 show_as_external_lsa_stdvty (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 zlog_info( " Network Mask: /%d%s",
3406 ip_masklen (al
->mask
), "\n");
3407 zlog_info( " Metric Type: %s%s",
3408 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3409 "2 (Larger than any link state path)" : "1", "\n");
3410 zlog_info( " TOS: 0%s", "\n");
3411 zlog_info( " Metric: %d%s",
3412 GET_METRIC (al
->e
[0].metric
), "\n");
3413 zlog_info( " Forward Address: %s%s",
3414 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
3416 zlog_info( " External Route Tag: %u%s%s",
3417 ntohl (al
->e
[0].route_tag
), "\n", "\n");
3422 /* Show AS-NSSA-LSA detail information. */
3424 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3428 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3430 show_ip_ospf_database_header (vty
, lsa
);
3432 vty_out (vty
, " Network Mask: /%d%s",
3433 ip_masklen (al
->mask
), VTY_NEWLINE
);
3434 vty_out (vty
, " Metric Type: %s%s",
3435 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3436 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3437 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3438 vty_out (vty
, " Metric: %d%s",
3439 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3440 vty_out (vty
, " NSSA: Forward Address: %s%s",
3441 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3443 vty_out (vty
, " External Route Tag: %u%s%s",
3444 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3451 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
3456 #ifdef HAVE_OPAQUE_LSA
3458 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3462 show_ip_ospf_database_header (vty
, lsa
);
3463 show_opaque_info_detail (vty
, lsa
);
3465 vty_out (vty
, "%s", VTY_NEWLINE
);
3469 #endif /* HAVE_OPAQUE_LSA */
3471 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
3474 show_router_lsa_detail
,
3475 show_network_lsa_detail
,
3476 show_summary_lsa_detail
,
3477 show_summary_asbr_lsa_detail
,
3478 show_as_external_lsa_detail
,
3480 show_as_nssa_lsa_detail
, /* almost same as external */
3481 #ifdef HAVE_OPAQUE_LSA
3483 show_opaque_lsa_detail
,
3484 show_opaque_lsa_detail
,
3485 show_opaque_lsa_detail
,
3486 #endif /* HAVE_OPAQUE_LSA */
3490 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
3491 struct in_addr
*adv_router
)
3493 memset (lp
, 0, sizeof (struct prefix_ls
));
3497 else if (adv_router
== NULL
)
3506 lp
->adv_router
= *adv_router
;
3511 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
3512 struct in_addr
*id
, struct in_addr
*adv_router
)
3514 struct prefix_ls lp
;
3515 struct route_node
*rn
, *start
;
3516 struct ospf_lsa
*lsa
;
3518 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
3519 start
= route_node_get (rt
, (struct prefix
*) &lp
);
3522 route_lock_node (start
);
3523 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
3524 if ((lsa
= rn
->info
))
3526 if (show_function
[lsa
->data
->type
] != NULL
)
3527 show_function
[lsa
->data
->type
] (vty
, lsa
);
3529 route_unlock_node (start
);
3533 /* Show detail LSA information
3534 -- if id is NULL then show all LSAs. */
3536 show_lsa_detail (struct vty
*vty
, struct ospf
*ospf
, int type
,
3537 struct in_addr
*id
, struct in_addr
*adv_router
)
3539 struct listnode
*node
;
3543 case OSPF_AS_EXTERNAL_LSA
:
3544 #ifdef HAVE_OPAQUE_LSA
3545 case OSPF_OPAQUE_AS_LSA
:
3546 #endif /* HAVE_OPAQUE_LSA */
3547 vty_out (vty
, " %s %s%s",
3548 show_database_desc
[type
],
3549 VTY_NEWLINE
, VTY_NEWLINE
);
3550 show_lsa_detail_proc (vty
, AS_LSDB (ospf
, type
), id
, adv_router
);
3553 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
3555 struct ospf_area
*area
= node
->data
;
3556 vty_out (vty
, "%s %s (Area %s)%s%s",
3557 VTY_NEWLINE
, show_database_desc
[type
],
3558 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3559 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
3566 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
3567 struct in_addr
*adv_router
)
3569 struct route_node
*rn
;
3570 struct ospf_lsa
*lsa
;
3572 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
3573 if ((lsa
= rn
->info
))
3574 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
3576 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3578 if (show_function
[lsa
->data
->type
] != NULL
)
3579 show_function
[lsa
->data
->type
] (vty
, lsa
);
3583 /* Show detail LSA information. */
3585 show_lsa_detail_adv_router (struct vty
*vty
, struct ospf
*ospf
, int type
,
3586 struct in_addr
*adv_router
)
3588 struct listnode
*node
;
3592 case OSPF_AS_EXTERNAL_LSA
:
3593 #ifdef HAVE_OPAQUE_LSA
3594 case OSPF_OPAQUE_AS_LSA
:
3595 #endif /* HAVE_OPAQUE_LSA */
3596 vty_out (vty
, " %s %s%s",
3597 show_database_desc
[type
],
3598 VTY_NEWLINE
, VTY_NEWLINE
);
3599 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf
, type
),
3603 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
3605 struct ospf_area
*area
= node
->data
;
3606 vty_out (vty
, "%s %s (Area %s)%s%s",
3607 VTY_NEWLINE
, show_database_desc
[type
],
3608 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3609 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
3617 show_ip_ospf_database_summary (struct vty
*vty
, struct ospf
*ospf
, int self
)
3619 struct ospf_lsa
*lsa
;
3620 struct route_node
*rn
;
3621 struct listnode
*node
;
3624 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
3626 struct ospf_area
*area
= node
->data
;
3627 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3631 case OSPF_AS_EXTERNAL_LSA
:
3632 #ifdef HAVE_OPAQUE_LSA
3633 case OSPF_OPAQUE_AS_LSA
:
3634 #endif /* HAVE_OPAQUE_LSA */
3639 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
3640 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
3642 vty_out (vty
, " %s (Area %s)%s%s",
3643 show_database_desc
[type
],
3644 ospf_area_desc_string (area
),
3645 VTY_NEWLINE
, VTY_NEWLINE
);
3646 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
3648 LSDB_LOOP (AREA_LSDB (area
, type
), rn
, lsa
)
3649 show_lsa_summary (vty
, lsa
, self
);
3651 vty_out (vty
, "%s", VTY_NEWLINE
);
3656 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3660 case OSPF_AS_EXTERNAL_LSA
:
3661 #ifdef HAVE_OPAQUE_LSA
3662 case OSPF_OPAQUE_AS_LSA
:
3663 #endif /* HAVE_OPAQUE_LSA */
3668 if (ospf_lsdb_count_self (ospf
->lsdb
, type
) ||
3669 (!self
&& ospf_lsdb_count (ospf
->lsdb
, type
)))
3671 vty_out (vty
, " %s%s%s",
3672 show_database_desc
[type
],
3673 VTY_NEWLINE
, VTY_NEWLINE
);
3674 vty_out (vty
, "%s%s", show_database_header
[type
],
3677 LSDB_LOOP (AS_LSDB (ospf
, type
), rn
, lsa
)
3678 show_lsa_summary (vty
, lsa
, self
);
3680 vty_out (vty
, "%s", VTY_NEWLINE
);
3684 vty_out (vty
, "%s", VTY_NEWLINE
);
3688 show_ip_ospf_database_maxage (struct vty
*vty
, struct ospf
*ospf
)
3690 struct listnode
*node
;
3691 struct ospf_lsa
*lsa
;
3693 vty_out (vty
, "%s MaxAge Link States:%s%s",
3694 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
3696 for (node
= listhead (ospf
->maxage_lsa
); node
; nextnode (node
))
3697 if ((lsa
= node
->data
) != NULL
)
3699 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
3700 vty_out (vty
, "Link State ID: %s%s",
3701 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
3702 vty_out (vty
, "Advertising Router: %s%s",
3703 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3704 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
3705 vty_out (vty
, "%s", VTY_NEWLINE
);
3709 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3710 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3712 #ifdef HAVE_OPAQUE_LSA
3713 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3714 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3715 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3716 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3717 #else /* HAVE_OPAQUE_LSA */
3718 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3719 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3720 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3721 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3722 #endif /* HAVE_OPAQUE_LSA */
3724 #define OSPF_LSA_TYPES_CMD_STR \
3725 "asbr-summary|external|network|router|summary" \
3726 OSPF_LSA_TYPE_NSSA_CMD_STR \
3727 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3729 #define OSPF_LSA_TYPES_DESC \
3730 "ASBR summary link states\n" \
3731 "External link states\n" \
3732 "Network link states\n" \
3733 "Router link states\n" \
3734 "Network summary link states\n" \
3735 OSPF_LSA_TYPE_NSSA_DESC \
3736 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3737 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3738 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3740 DEFUN (show_ip_ospf_database
,
3741 show_ip_ospf_database_cmd
,
3742 "show ip ospf database",
3745 "OSPF information\n"
3746 "Database summary\n")
3750 struct in_addr id
, adv_router
;
3752 ospf
= ospf_lookup ();
3756 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3757 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3762 show_ip_ospf_database_summary (vty
, ospf
, 0);
3766 /* Set database type to show. */
3767 if (strncmp (argv
[0], "r", 1) == 0)
3768 type
= OSPF_ROUTER_LSA
;
3769 else if (strncmp (argv
[0], "ne", 2) == 0)
3770 type
= OSPF_NETWORK_LSA
;
3771 else if (strncmp (argv
[0], "ns", 2) == 0)
3772 type
= OSPF_AS_NSSA_LSA
;
3773 else if (strncmp (argv
[0], "su", 2) == 0)
3774 type
= OSPF_SUMMARY_LSA
;
3775 else if (strncmp (argv
[0], "a", 1) == 0)
3776 type
= OSPF_ASBR_SUMMARY_LSA
;
3777 else if (strncmp (argv
[0], "e", 1) == 0)
3778 type
= OSPF_AS_EXTERNAL_LSA
;
3779 else if (strncmp (argv
[0], "se", 2) == 0)
3781 show_ip_ospf_database_summary (vty
, ospf
, 1);
3784 else if (strncmp (argv
[0], "m", 1) == 0)
3786 show_ip_ospf_database_maxage (vty
, ospf
);
3789 #ifdef HAVE_OPAQUE_LSA
3790 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3791 type
= OSPF_OPAQUE_LINK_LSA
;
3792 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3793 type
= OSPF_OPAQUE_AREA_LSA
;
3794 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3795 type
= OSPF_OPAQUE_AS_LSA
;
3796 #endif /* HAVE_OPAQUE_LSA */
3800 /* `show ip ospf database LSA'. */
3802 show_lsa_detail (vty
, ospf
, type
, NULL
, NULL
);
3805 ret
= inet_aton (argv
[1], &id
);
3809 /* `show ip ospf database LSA ID'. */
3811 show_lsa_detail (vty
, ospf
, type
, &id
, NULL
);
3812 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3815 if (strncmp (argv
[2], "s", 1) == 0)
3816 adv_router
= ospf
->router_id
;
3819 ret
= inet_aton (argv
[2], &adv_router
);
3823 show_lsa_detail (vty
, ospf
, type
, &id
, &adv_router
);
3830 ALIAS (show_ip_ospf_database
,
3831 show_ip_ospf_database_type_cmd
,
3832 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
3835 "OSPF information\n"
3836 "Database summary\n"
3838 "LSAs in MaxAge list\n"
3839 "Self-originated link states\n")
3841 ALIAS (show_ip_ospf_database
,
3842 show_ip_ospf_database_type_id_cmd
,
3843 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
3846 "OSPF information\n"
3847 "Database summary\n"
3849 "Link State ID (as an IP address)\n")
3851 ALIAS (show_ip_ospf_database
,
3852 show_ip_ospf_database_type_id_adv_router_cmd
,
3853 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
3856 "OSPF information\n"
3857 "Database summary\n"
3859 "Link State ID (as an IP address)\n"
3860 "Advertising Router link states\n"
3861 "Advertising Router (as an IP address)\n")
3863 ALIAS (show_ip_ospf_database
,
3864 show_ip_ospf_database_type_id_self_cmd
,
3865 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
3868 "OSPF information\n"
3869 "Database summary\n"
3871 "Link State ID (as an IP address)\n"
3872 "Self-originated link states\n"
3875 DEFUN (show_ip_ospf_database_type_adv_router
,
3876 show_ip_ospf_database_type_adv_router_cmd
,
3877 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
3880 "OSPF information\n"
3881 "Database summary\n"
3883 "Advertising Router link states\n"
3884 "Advertising Router (as an IP address)\n")
3888 struct in_addr adv_router
;
3890 ospf
= ospf_lookup ();
3894 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3895 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3900 /* Set database type to show. */
3901 if (strncmp (argv
[0], "r", 1) == 0)
3902 type
= OSPF_ROUTER_LSA
;
3903 else if (strncmp (argv
[0], "ne", 2) == 0)
3904 type
= OSPF_NETWORK_LSA
;
3905 else if (strncmp (argv
[0], "ns", 2) == 0)
3906 type
= OSPF_AS_NSSA_LSA
;
3907 else if (strncmp (argv
[0], "s", 1) == 0)
3908 type
= OSPF_SUMMARY_LSA
;
3909 else if (strncmp (argv
[0], "a", 1) == 0)
3910 type
= OSPF_ASBR_SUMMARY_LSA
;
3911 else if (strncmp (argv
[0], "e", 1) == 0)
3912 type
= OSPF_AS_EXTERNAL_LSA
;
3913 #ifdef HAVE_OPAQUE_LSA
3914 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
3915 type
= OSPF_OPAQUE_LINK_LSA
;
3916 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
3917 type
= OSPF_OPAQUE_AREA_LSA
;
3918 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
3919 type
= OSPF_OPAQUE_AS_LSA
;
3920 #endif /* HAVE_OPAQUE_LSA */
3924 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3925 if (strncmp (argv
[1], "s", 1) == 0)
3926 adv_router
= ospf
->router_id
;
3929 ret
= inet_aton (argv
[1], &adv_router
);
3934 show_lsa_detail_adv_router (vty
, ospf
, type
, &adv_router
);
3939 ALIAS (show_ip_ospf_database_type_adv_router
,
3940 show_ip_ospf_database_type_self_cmd
,
3941 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
3944 "OSPF information\n"
3945 "Database summary\n"
3947 "Self-originated link states\n")
3950 DEFUN (ip_ospf_authentication_args
,
3951 ip_ospf_authentication_args_addr_cmd
,
3952 "ip ospf authentication (null|message-digest) A.B.C.D",
3954 "OSPF interface commands\n"
3955 "Enable authentication on this interface\n"
3956 "Use null authentication\n"
3957 "Use message-digest authentication\n"
3958 "Address of interface")
3960 struct interface
*ifp
;
3961 struct in_addr addr
;
3963 struct ospf_if_params
*params
;
3966 params
= IF_DEF_PARAMS (ifp
);
3970 ret
= inet_aton(argv
[1], &addr
);
3973 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
3978 params
= ospf_get_if_params (ifp
, addr
);
3979 ospf_if_update_params (ifp
, addr
);
3982 /* Handle null authentication */
3983 if ( argv
[0][0] == 'n' )
3985 SET_IF_PARAM (params
, auth_type
);
3986 params
->auth_type
= OSPF_AUTH_NULL
;
3990 /* Handle message-digest authentication */
3991 if ( argv
[0][0] == 'm' )
3993 SET_IF_PARAM (params
, auth_type
);
3994 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
3998 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
4002 ALIAS (ip_ospf_authentication_args
,
4003 ip_ospf_authentication_args_cmd
,
4004 "ip ospf authentication (null|message-digest)",
4006 "OSPF interface commands\n"
4007 "Enable authentication on this interface\n"
4008 "Use null authentication\n"
4009 "Use message-digest authentication\n")
4011 DEFUN (ip_ospf_authentication
,
4012 ip_ospf_authentication_addr_cmd
,
4013 "ip ospf authentication A.B.C.D",
4015 "OSPF interface commands\n"
4016 "Enable authentication on this interface\n"
4017 "Address of interface")
4019 struct interface
*ifp
;
4020 struct in_addr addr
;
4022 struct ospf_if_params
*params
;
4025 params
= IF_DEF_PARAMS (ifp
);
4029 ret
= inet_aton(argv
[1], &addr
);
4032 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4037 params
= ospf_get_if_params (ifp
, addr
);
4038 ospf_if_update_params (ifp
, addr
);
4041 SET_IF_PARAM (params
, auth_type
);
4042 params
->auth_type
= OSPF_AUTH_SIMPLE
;
4047 ALIAS (ip_ospf_authentication
,
4048 ip_ospf_authentication_cmd
,
4049 "ip ospf authentication",
4051 "OSPF interface commands\n"
4052 "Enable authentication on this interface\n")
4054 DEFUN (no_ip_ospf_authentication
,
4055 no_ip_ospf_authentication_addr_cmd
,
4056 "no ip ospf authentication A.B.C.D",
4059 "OSPF interface commands\n"
4060 "Enable authentication on this interface\n"
4061 "Address of interface")
4063 struct interface
*ifp
;
4064 struct in_addr addr
;
4066 struct ospf_if_params
*params
;
4069 params
= IF_DEF_PARAMS (ifp
);
4073 ret
= inet_aton(argv
[1], &addr
);
4076 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4081 params
= ospf_lookup_if_params (ifp
, addr
);
4086 params
->auth_type
= OSPF_AUTH_NOTSET
;
4087 UNSET_IF_PARAM (params
, auth_type
);
4089 if (params
!= IF_DEF_PARAMS (ifp
))
4091 ospf_free_if_params (ifp
, addr
);
4092 ospf_if_update_params (ifp
, addr
);
4098 ALIAS (no_ip_ospf_authentication
,
4099 no_ip_ospf_authentication_cmd
,
4100 "no ip ospf authentication",
4103 "OSPF interface commands\n"
4104 "Enable authentication on this interface\n")
4106 DEFUN (ip_ospf_authentication_key
,
4107 ip_ospf_authentication_key_addr_cmd
,
4108 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4110 "OSPF interface commands\n"
4111 "Authentication password (key)\n"
4112 "The OSPF password (key)\n"
4113 "Address of interface")
4115 struct interface
*ifp
;
4116 struct in_addr addr
;
4118 struct ospf_if_params
*params
;
4121 params
= IF_DEF_PARAMS (ifp
);
4125 ret
= inet_aton(argv
[1], &addr
);
4128 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4133 params
= ospf_get_if_params (ifp
, addr
);
4134 ospf_if_update_params (ifp
, addr
);
4138 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
4139 strncpy ((char *) params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
4140 SET_IF_PARAM (params
, auth_simple
);
4145 ALIAS (ip_ospf_authentication_key
,
4146 ip_ospf_authentication_key_cmd
,
4147 "ip ospf authentication-key AUTH_KEY",
4149 "OSPF interface commands\n"
4150 "Authentication password (key)\n"
4151 "The OSPF password (key)")
4153 ALIAS (ip_ospf_authentication_key
,
4154 ospf_authentication_key_cmd
,
4155 "ospf authentication-key AUTH_KEY",
4156 "OSPF interface commands\n"
4157 "Authentication password (key)\n"
4158 "The OSPF password (key)")
4160 DEFUN (no_ip_ospf_authentication_key
,
4161 no_ip_ospf_authentication_key_addr_cmd
,
4162 "no ip ospf authentication-key A.B.C.D",
4165 "OSPF interface commands\n"
4166 "Authentication password (key)\n"
4167 "Address of interface")
4169 struct interface
*ifp
;
4170 struct in_addr addr
;
4172 struct ospf_if_params
*params
;
4175 params
= IF_DEF_PARAMS (ifp
);
4179 ret
= inet_aton(argv
[1], &addr
);
4182 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4187 params
= ospf_lookup_if_params (ifp
, addr
);
4192 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
4193 UNSET_IF_PARAM (params
, auth_simple
);
4195 if (params
!= IF_DEF_PARAMS (ifp
))
4197 ospf_free_if_params (ifp
, addr
);
4198 ospf_if_update_params (ifp
, addr
);
4204 ALIAS (no_ip_ospf_authentication_key
,
4205 no_ip_ospf_authentication_key_cmd
,
4206 "no ip ospf authentication-key",
4209 "OSPF interface commands\n"
4210 "Authentication password (key)\n")
4212 ALIAS (no_ip_ospf_authentication_key
,
4213 no_ospf_authentication_key_cmd
,
4214 "no ospf authentication-key",
4216 "OSPF interface commands\n"
4217 "Authentication password (key)\n")
4219 DEFUN (ip_ospf_message_digest_key
,
4220 ip_ospf_message_digest_key_addr_cmd
,
4221 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4223 "OSPF interface commands\n"
4224 "Message digest authentication password (key)\n"
4226 "Use MD5 algorithm\n"
4227 "The OSPF password (key)"
4228 "Address of interface")
4230 struct interface
*ifp
;
4231 struct crypt_key
*ck
;
4233 struct in_addr addr
;
4235 struct ospf_if_params
*params
;
4238 params
= IF_DEF_PARAMS (ifp
);
4242 ret
= inet_aton(argv
[2], &addr
);
4245 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4250 params
= ospf_get_if_params (ifp
, addr
);
4251 ospf_if_update_params (ifp
, addr
);
4254 key_id
= strtol (argv
[0], NULL
, 10);
4255 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
4257 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
4261 ck
= ospf_crypt_key_new ();
4262 ck
->key_id
= (u_char
) key_id
;
4263 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
4264 strncpy ((char *) ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
4266 ospf_crypt_key_add (params
->auth_crypt
, ck
);
4267 SET_IF_PARAM (params
, auth_crypt
);
4272 ALIAS (ip_ospf_message_digest_key
,
4273 ip_ospf_message_digest_key_cmd
,
4274 "ip ospf message-digest-key <1-255> md5 KEY",
4276 "OSPF interface commands\n"
4277 "Message digest authentication password (key)\n"
4279 "Use MD5 algorithm\n"
4280 "The OSPF password (key)")
4282 ALIAS (ip_ospf_message_digest_key
,
4283 ospf_message_digest_key_cmd
,
4284 "ospf message-digest-key <1-255> md5 KEY",
4285 "OSPF interface commands\n"
4286 "Message digest authentication password (key)\n"
4288 "Use MD5 algorithm\n"
4289 "The OSPF password (key)")
4291 DEFUN (no_ip_ospf_message_digest_key
,
4292 no_ip_ospf_message_digest_key_addr_cmd
,
4293 "no ip ospf message-digest-key <1-255> A.B.C.D",
4296 "OSPF interface commands\n"
4297 "Message digest authentication password (key)\n"
4299 "Address of interface")
4301 struct interface
*ifp
;
4302 struct crypt_key
*ck
;
4304 struct in_addr addr
;
4306 struct ospf_if_params
*params
;
4309 params
= IF_DEF_PARAMS (ifp
);
4313 ret
= inet_aton(argv
[1], &addr
);
4316 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4321 params
= ospf_lookup_if_params (ifp
, addr
);
4326 key_id
= strtol (argv
[0], NULL
, 10);
4327 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
4330 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
4334 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
4336 if (params
!= IF_DEF_PARAMS (ifp
))
4338 ospf_free_if_params (ifp
, addr
);
4339 ospf_if_update_params (ifp
, addr
);
4345 ALIAS (no_ip_ospf_message_digest_key
,
4346 no_ip_ospf_message_digest_key_cmd
,
4347 "no ip ospf message-digest-key <1-255>",
4350 "OSPF interface commands\n"
4351 "Message digest authentication password (key)\n"
4354 ALIAS (no_ip_ospf_message_digest_key
,
4355 no_ospf_message_digest_key_cmd
,
4356 "no ospf message-digest-key <1-255>",
4358 "OSPF interface commands\n"
4359 "Message digest authentication password (key)\n"
4362 DEFUN (ip_ospf_cost
,
4363 ip_ospf_cost_addr_cmd
,
4364 "ip ospf cost <1-65535> A.B.C.D",
4366 "OSPF interface commands\n"
4369 "Address of interface")
4371 struct interface
*ifp
= vty
->index
;
4373 struct in_addr addr
;
4375 struct ospf_if_params
*params
;
4377 params
= IF_DEF_PARAMS (ifp
);
4379 cost
= strtol (argv
[0], NULL
, 10);
4381 /* cost range is <1-65535>. */
4382 if (cost
< 1 || cost
> 65535)
4384 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4390 ret
= inet_aton(argv
[1], &addr
);
4393 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4398 params
= ospf_get_if_params (ifp
, addr
);
4399 ospf_if_update_params (ifp
, addr
);
4402 SET_IF_PARAM (params
, output_cost_cmd
);
4403 params
->output_cost_cmd
= cost
;
4405 ospf_if_recalculate_output_cost (ifp
);
4410 ALIAS (ip_ospf_cost
,
4412 "ip ospf cost <1-65535>",
4414 "OSPF interface commands\n"
4418 ALIAS (ip_ospf_cost
,
4420 "ospf cost <1-65535>",
4421 "OSPF interface commands\n"
4425 DEFUN (no_ip_ospf_cost
,
4426 no_ip_ospf_cost_addr_cmd
,
4427 "no ip ospf cost A.B.C.D",
4430 "OSPF interface commands\n"
4432 "Address of interface")
4434 struct interface
*ifp
= vty
->index
;
4435 struct in_addr addr
;
4437 struct ospf_if_params
*params
;
4440 params
= IF_DEF_PARAMS (ifp
);
4444 ret
= inet_aton(argv
[0], &addr
);
4447 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4452 params
= ospf_lookup_if_params (ifp
, addr
);
4457 UNSET_IF_PARAM (params
, output_cost_cmd
);
4459 if (params
!= IF_DEF_PARAMS (ifp
))
4461 ospf_free_if_params (ifp
, addr
);
4462 ospf_if_update_params (ifp
, addr
);
4465 ospf_if_recalculate_output_cost (ifp
);
4470 ALIAS (no_ip_ospf_cost
,
4471 no_ip_ospf_cost_cmd
,
4475 "OSPF interface commands\n"
4478 ALIAS (no_ip_ospf_cost
,
4482 "OSPF interface commands\n"
4486 ospf_nbr_timer_update (struct ospf_interface
*oi
)
4488 struct route_node
*rn
;
4489 struct ospf_neighbor
*nbr
;
4491 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4492 if ((nbr
= rn
->info
))
4494 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
4495 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4496 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4497 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4501 DEFUN (ip_ospf_dead_interval
,
4502 ip_ospf_dead_interval_addr_cmd
,
4503 "ip ospf dead-interval <1-65535> A.B.C.D",
4505 "OSPF interface commands\n"
4506 "Interval after which a neighbor is declared dead\n"
4508 "Address of interface")
4510 struct interface
*ifp
= vty
->index
;
4512 struct in_addr addr
;
4514 struct ospf_if_params
*params
;
4515 struct ospf_interface
*oi
;
4516 struct route_node
*rn
;
4519 ospf
= ospf_lookup ();
4521 params
= IF_DEF_PARAMS (ifp
);
4523 seconds
= strtol (argv
[0], NULL
, 10);
4525 /* dead_interval range is <1-65535>. */
4526 if (seconds
< 1 || seconds
> 65535)
4528 vty_out (vty
, "Router Dead Interval is invalid%s", VTY_NEWLINE
);
4534 ret
= inet_aton(argv
[1], &addr
);
4537 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4542 params
= ospf_get_if_params (ifp
, addr
);
4543 ospf_if_update_params (ifp
, addr
);
4546 SET_IF_PARAM (params
, v_wait
);
4547 params
->v_wait
= seconds
;
4549 /* Update timer values in neighbor structure. */
4554 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
4556 ospf_nbr_timer_update (oi
);
4561 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4562 if ((oi
= rn
->info
))
4563 ospf_nbr_timer_update (oi
);
4569 ALIAS (ip_ospf_dead_interval
,
4570 ip_ospf_dead_interval_cmd
,
4571 "ip ospf dead-interval <1-65535>",
4573 "OSPF interface commands\n"
4574 "Interval after which a neighbor is declared dead\n"
4577 ALIAS (ip_ospf_dead_interval
,
4578 ospf_dead_interval_cmd
,
4579 "ospf dead-interval <1-65535>",
4580 "OSPF interface commands\n"
4581 "Interval after which a neighbor is declared dead\n"
4584 DEFUN (no_ip_ospf_dead_interval
,
4585 no_ip_ospf_dead_interval_addr_cmd
,
4586 "no ip ospf dead-interval A.B.C.D",
4589 "OSPF interface commands\n"
4590 "Interval after which a neighbor is declared dead\n"
4591 "Address of interface")
4593 struct interface
*ifp
= vty
->index
;
4594 struct in_addr addr
;
4596 struct ospf_if_params
*params
;
4597 struct ospf_interface
*oi
;
4598 struct route_node
*rn
;
4601 ospf
= ospf_lookup ();
4604 params
= IF_DEF_PARAMS (ifp
);
4608 ret
= inet_aton(argv
[0], &addr
);
4611 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4616 params
= ospf_lookup_if_params (ifp
, addr
);
4621 UNSET_IF_PARAM (params
, v_wait
);
4622 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4624 if (params
!= IF_DEF_PARAMS (ifp
))
4626 ospf_free_if_params (ifp
, addr
);
4627 ospf_if_update_params (ifp
, addr
);
4630 /* Update timer values in neighbor structure. */
4635 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
4637 ospf_nbr_timer_update (oi
);
4642 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4643 if ((oi
= rn
->info
))
4644 ospf_nbr_timer_update (oi
);
4650 ALIAS (no_ip_ospf_dead_interval
,
4651 no_ip_ospf_dead_interval_cmd
,
4652 "no ip ospf dead-interval",
4655 "OSPF interface commands\n"
4656 "Interval after which a neighbor is declared dead\n")
4658 ALIAS (no_ip_ospf_dead_interval
,
4659 no_ospf_dead_interval_cmd
,
4660 "no ospf dead-interval",
4662 "OSPF interface commands\n"
4663 "Interval after which a neighbor is declared dead\n")
4665 DEFUN (ip_ospf_hello_interval
,
4666 ip_ospf_hello_interval_addr_cmd
,
4667 "ip ospf hello-interval <1-65535> A.B.C.D",
4669 "OSPF interface commands\n"
4670 "Time between HELLO packets\n"
4672 "Address of interface")
4674 struct interface
*ifp
= vty
->index
;
4676 struct in_addr addr
;
4678 struct ospf_if_params
*params
;
4680 params
= IF_DEF_PARAMS (ifp
);
4682 seconds
= strtol (argv
[0], NULL
, 10);
4684 /* HelloInterval range is <1-65535>. */
4685 if (seconds
< 1 || seconds
> 65535)
4687 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
4693 ret
= inet_aton(argv
[1], &addr
);
4696 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4701 params
= ospf_get_if_params (ifp
, addr
);
4702 ospf_if_update_params (ifp
, addr
);
4705 SET_IF_PARAM (params
, v_hello
);
4706 params
->v_hello
= seconds
;
4711 ALIAS (ip_ospf_hello_interval
,
4712 ip_ospf_hello_interval_cmd
,
4713 "ip ospf hello-interval <1-65535>",
4715 "OSPF interface commands\n"
4716 "Time between HELLO packets\n"
4719 ALIAS (ip_ospf_hello_interval
,
4720 ospf_hello_interval_cmd
,
4721 "ospf hello-interval <1-65535>",
4722 "OSPF interface commands\n"
4723 "Time between HELLO packets\n"
4726 DEFUN (no_ip_ospf_hello_interval
,
4727 no_ip_ospf_hello_interval_addr_cmd
,
4728 "no ip ospf hello-interval A.B.C.D",
4731 "OSPF interface commands\n"
4732 "Time between HELLO packets\n"
4733 "Address of interface")
4735 struct interface
*ifp
= vty
->index
;
4736 struct in_addr addr
;
4738 struct ospf_if_params
*params
;
4741 params
= IF_DEF_PARAMS (ifp
);
4745 ret
= inet_aton(argv
[0], &addr
);
4748 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4753 params
= ospf_lookup_if_params (ifp
, addr
);
4758 UNSET_IF_PARAM (params
, v_hello
);
4759 params
->v_hello
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4761 if (params
!= IF_DEF_PARAMS (ifp
))
4763 ospf_free_if_params (ifp
, addr
);
4764 ospf_if_update_params (ifp
, addr
);
4770 ALIAS (no_ip_ospf_hello_interval
,
4771 no_ip_ospf_hello_interval_cmd
,
4772 "no ip ospf hello-interval",
4775 "OSPF interface commands\n"
4776 "Time between HELLO packets\n")
4778 ALIAS (no_ip_ospf_hello_interval
,
4779 no_ospf_hello_interval_cmd
,
4780 "no ospf hello-interval",
4782 "OSPF interface commands\n"
4783 "Time between HELLO packets\n")
4785 DEFUN (ip_ospf_network
,
4786 ip_ospf_network_cmd
,
4787 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4789 "OSPF interface commands\n"
4791 "Specify OSPF broadcast multi-access network\n"
4792 "Specify OSPF NBMA network\n"
4793 "Specify OSPF point-to-multipoint network\n"
4794 "Specify OSPF point-to-point network\n")
4796 struct interface
*ifp
= vty
->index
;
4797 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4798 struct route_node
*rn
;
4800 if (strncmp (argv
[0], "b", 1) == 0)
4801 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4802 else if (strncmp (argv
[0], "n", 1) == 0)
4803 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
4804 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
4805 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
4806 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
4807 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
4809 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4812 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
4814 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4816 struct ospf_interface
*oi
= rn
->info
;
4821 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4823 if (oi
->state
> ISM_Down
)
4825 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4826 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4833 ALIAS (ip_ospf_network
,
4835 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4836 "OSPF interface commands\n"
4838 "Specify OSPF broadcast multi-access network\n"
4839 "Specify OSPF NBMA network\n"
4840 "Specify OSPF point-to-multipoint network\n"
4841 "Specify OSPF point-to-point network\n")
4843 DEFUN (no_ip_ospf_network
,
4844 no_ip_ospf_network_cmd
,
4845 "no ip ospf network",
4848 "OSPF interface commands\n"
4851 struct interface
*ifp
= vty
->index
;
4852 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
4853 struct route_node
*rn
;
4855 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
4857 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
4860 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4862 struct ospf_interface
*oi
= rn
->info
;
4867 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
4869 if (oi
->state
> ISM_Down
)
4871 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
4872 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
4879 ALIAS (no_ip_ospf_network
,
4880 no_ospf_network_cmd
,
4883 "OSPF interface commands\n"
4886 DEFUN (ip_ospf_priority
,
4887 ip_ospf_priority_addr_cmd
,
4888 "ip ospf priority <0-255> A.B.C.D",
4890 "OSPF interface commands\n"
4893 "Address of interface")
4895 struct interface
*ifp
= vty
->index
;
4897 struct route_node
*rn
;
4898 struct in_addr addr
;
4900 struct ospf_if_params
*params
;
4902 params
= IF_DEF_PARAMS (ifp
);
4904 priority
= strtol (argv
[0], NULL
, 10);
4906 /* Router Priority range is <0-255>. */
4907 if (priority
< 0 || priority
> 255)
4909 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
4915 ret
= inet_aton(argv
[1], &addr
);
4918 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4923 params
= ospf_get_if_params (ifp
, addr
);
4924 ospf_if_update_params (ifp
, addr
);
4927 SET_IF_PARAM (params
, priority
);
4928 params
->priority
= priority
;
4930 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4932 struct ospf_interface
*oi
= rn
->info
;
4938 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
4940 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
4941 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
4948 ALIAS (ip_ospf_priority
,
4949 ip_ospf_priority_cmd
,
4950 "ip ospf priority <0-255>",
4952 "OSPF interface commands\n"
4956 ALIAS (ip_ospf_priority
,
4958 "ospf priority <0-255>",
4959 "OSPF interface commands\n"
4963 DEFUN (no_ip_ospf_priority
,
4964 no_ip_ospf_priority_addr_cmd
,
4965 "no ip ospf priority A.B.C.D",
4968 "OSPF interface commands\n"
4970 "Address of interface")
4972 struct interface
*ifp
= vty
->index
;
4973 struct route_node
*rn
;
4974 struct in_addr addr
;
4976 struct ospf_if_params
*params
;
4979 params
= IF_DEF_PARAMS (ifp
);
4983 ret
= inet_aton(argv
[0], &addr
);
4986 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4991 params
= ospf_lookup_if_params (ifp
, addr
);
4996 UNSET_IF_PARAM (params
, priority
);
4997 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
4999 if (params
!= IF_DEF_PARAMS (ifp
))
5001 ospf_free_if_params (ifp
, addr
);
5002 ospf_if_update_params (ifp
, addr
);
5005 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5007 struct ospf_interface
*oi
= rn
->info
;
5013 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
5015 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
5016 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
5023 ALIAS (no_ip_ospf_priority
,
5024 no_ip_ospf_priority_cmd
,
5025 "no ip ospf priority",
5028 "OSPF interface commands\n"
5029 "Router priority\n")
5031 ALIAS (no_ip_ospf_priority
,
5032 no_ospf_priority_cmd
,
5035 "OSPF interface commands\n"
5036 "Router priority\n")
5038 DEFUN (ip_ospf_retransmit_interval
,
5039 ip_ospf_retransmit_interval_addr_cmd
,
5040 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5042 "OSPF interface commands\n"
5043 "Time between retransmitting lost link state advertisements\n"
5045 "Address of interface")
5047 struct interface
*ifp
= vty
->index
;
5049 struct in_addr addr
;
5051 struct ospf_if_params
*params
;
5053 params
= IF_DEF_PARAMS (ifp
);
5054 seconds
= strtol (argv
[0], NULL
, 10);
5056 /* Retransmit Interval range is <3-65535>. */
5057 if (seconds
< 3 || seconds
> 65535)
5059 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
5066 ret
= inet_aton(argv
[1], &addr
);
5069 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5074 params
= ospf_get_if_params (ifp
, addr
);
5075 ospf_if_update_params (ifp
, addr
);
5078 SET_IF_PARAM (params
, retransmit_interval
);
5079 params
->retransmit_interval
= seconds
;
5084 ALIAS (ip_ospf_retransmit_interval
,
5085 ip_ospf_retransmit_interval_cmd
,
5086 "ip ospf retransmit-interval <3-65535>",
5088 "OSPF interface commands\n"
5089 "Time between retransmitting lost link state advertisements\n"
5092 ALIAS (ip_ospf_retransmit_interval
,
5093 ospf_retransmit_interval_cmd
,
5094 "ospf retransmit-interval <3-65535>",
5095 "OSPF interface commands\n"
5096 "Time between retransmitting lost link state advertisements\n"
5099 DEFUN (no_ip_ospf_retransmit_interval
,
5100 no_ip_ospf_retransmit_interval_addr_cmd
,
5101 "no ip ospf retransmit-interval A.B.C.D",
5104 "OSPF interface commands\n"
5105 "Time between retransmitting lost link state advertisements\n"
5106 "Address of interface")
5108 struct interface
*ifp
= vty
->index
;
5109 struct in_addr addr
;
5111 struct ospf_if_params
*params
;
5114 params
= IF_DEF_PARAMS (ifp
);
5118 ret
= inet_aton(argv
[0], &addr
);
5121 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5126 params
= ospf_lookup_if_params (ifp
, addr
);
5131 UNSET_IF_PARAM (params
, retransmit_interval
);
5132 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
5134 if (params
!= IF_DEF_PARAMS (ifp
))
5136 ospf_free_if_params (ifp
, addr
);
5137 ospf_if_update_params (ifp
, addr
);
5143 ALIAS (no_ip_ospf_retransmit_interval
,
5144 no_ip_ospf_retransmit_interval_cmd
,
5145 "no ip ospf retransmit-interval",
5148 "OSPF interface commands\n"
5149 "Time between retransmitting lost link state advertisements\n")
5151 ALIAS (no_ip_ospf_retransmit_interval
,
5152 no_ospf_retransmit_interval_cmd
,
5153 "no ospf retransmit-interval",
5155 "OSPF interface commands\n"
5156 "Time between retransmitting lost link state advertisements\n")
5158 DEFUN (ip_ospf_transmit_delay
,
5159 ip_ospf_transmit_delay_addr_cmd
,
5160 "ip ospf transmit-delay <1-65535> A.B.C.D",
5162 "OSPF interface commands\n"
5163 "Link state transmit delay\n"
5165 "Address of interface")
5167 struct interface
*ifp
= vty
->index
;
5169 struct in_addr addr
;
5171 struct ospf_if_params
*params
;
5173 params
= IF_DEF_PARAMS (ifp
);
5174 seconds
= strtol (argv
[0], NULL
, 10);
5176 /* Transmit Delay range is <1-65535>. */
5177 if (seconds
< 1 || seconds
> 65535)
5179 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
5185 ret
= inet_aton(argv
[1], &addr
);
5188 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5193 params
= ospf_get_if_params (ifp
, addr
);
5194 ospf_if_update_params (ifp
, addr
);
5197 SET_IF_PARAM (params
, transmit_delay
);
5198 params
->transmit_delay
= seconds
;
5203 ALIAS (ip_ospf_transmit_delay
,
5204 ip_ospf_transmit_delay_cmd
,
5205 "ip ospf transmit-delay <1-65535>",
5207 "OSPF interface commands\n"
5208 "Link state transmit delay\n"
5211 ALIAS (ip_ospf_transmit_delay
,
5212 ospf_transmit_delay_cmd
,
5213 "ospf transmit-delay <1-65535>",
5214 "OSPF interface commands\n"
5215 "Link state transmit delay\n"
5218 DEFUN (no_ip_ospf_transmit_delay
,
5219 no_ip_ospf_transmit_delay_addr_cmd
,
5220 "no ip ospf transmit-delay A.B.C.D",
5223 "OSPF interface commands\n"
5224 "Link state transmit delay\n"
5225 "Address of interface")
5227 struct interface
*ifp
= vty
->index
;
5228 struct in_addr addr
;
5230 struct ospf_if_params
*params
;
5233 params
= IF_DEF_PARAMS (ifp
);
5237 ret
= inet_aton(argv
[0], &addr
);
5240 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5245 params
= ospf_lookup_if_params (ifp
, addr
);
5250 UNSET_IF_PARAM (params
, transmit_delay
);
5251 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
5253 if (params
!= IF_DEF_PARAMS (ifp
))
5255 ospf_free_if_params (ifp
, addr
);
5256 ospf_if_update_params (ifp
, addr
);
5262 ALIAS (no_ip_ospf_transmit_delay
,
5263 no_ip_ospf_transmit_delay_cmd
,
5264 "no ip ospf transmit-delay",
5267 "OSPF interface commands\n"
5268 "Link state transmit delay\n")
5270 ALIAS (no_ip_ospf_transmit_delay
,
5271 no_ospf_transmit_delay_cmd
,
5272 "no ospf transmit-delay",
5274 "OSPF interface commands\n"
5275 "Link state transmit delay\n")
5278 DEFUN (ospf_redistribute_source_metric_type
,
5279 ospf_redistribute_source_metric_type_routemap_cmd
,
5280 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5281 "Redistribute information from another routing protocol\n"
5285 "Routing Information Protocol (RIP)\n"
5286 "Border Gateway Protocol (BGP)\n"
5287 "Metric for redistributed routes\n"
5288 "OSPF default metric\n"
5289 "OSPF exterior metric type for redistributed routes\n"
5290 "Set OSPF External Type 1 metrics\n"
5291 "Set OSPF External Type 2 metrics\n"
5292 "Route map reference\n"
5293 "Pointer to route-map entries\n")
5295 struct ospf
*ospf
= vty
->index
;
5300 /* Get distribute source. */
5301 if (!str2distribute_source (argv
[0], &source
))
5304 /* Get metric value. */
5306 if (!str2metric (argv
[1], &metric
))
5309 /* Get metric type. */
5311 if (!str2metric_type (argv
[2], &type
))
5315 ospf_routemap_set (ospf
, source
, argv
[3]);
5317 ospf_routemap_unset (ospf
, source
);
5319 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5322 ALIAS (ospf_redistribute_source_metric_type
,
5323 ospf_redistribute_source_metric_type_cmd
,
5324 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5325 "Redistribute information from another routing protocol\n"
5329 "Routing Information Protocol (RIP)\n"
5330 "Border Gateway Protocol (BGP)\n"
5331 "Metric for redistributed routes\n"
5332 "OSPF default metric\n"
5333 "OSPF exterior metric type for redistributed routes\n"
5334 "Set OSPF External Type 1 metrics\n"
5335 "Set OSPF External Type 2 metrics\n")
5337 ALIAS (ospf_redistribute_source_metric_type
,
5338 ospf_redistribute_source_metric_cmd
,
5339 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5340 "Redistribute information from another routing protocol\n"
5344 "Routing Information Protocol (RIP)\n"
5345 "Border Gateway Protocol (BGP)\n"
5346 "Metric for redistributed routes\n"
5347 "OSPF default metric\n")
5349 DEFUN (ospf_redistribute_source_type_metric
,
5350 ospf_redistribute_source_type_metric_routemap_cmd
,
5351 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5352 "Redistribute information from another routing protocol\n"
5356 "Routing Information Protocol (RIP)\n"
5357 "Border Gateway Protocol (BGP)\n"
5358 "OSPF exterior metric type for redistributed routes\n"
5359 "Set OSPF External Type 1 metrics\n"
5360 "Set OSPF External Type 2 metrics\n"
5361 "Metric for redistributed routes\n"
5362 "OSPF default metric\n"
5363 "Route map reference\n"
5364 "Pointer to route-map entries\n")
5366 struct ospf
*ospf
= vty
->index
;
5371 /* Get distribute source. */
5372 if (!str2distribute_source (argv
[0], &source
))
5375 /* Get metric value. */
5377 if (!str2metric_type (argv
[1], &type
))
5380 /* Get metric type. */
5382 if (!str2metric (argv
[2], &metric
))
5386 ospf_routemap_set (ospf
, source
, argv
[3]);
5388 ospf_routemap_unset (ospf
, source
);
5390 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5393 ALIAS (ospf_redistribute_source_type_metric
,
5394 ospf_redistribute_source_type_metric_cmd
,
5395 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5396 "Redistribute information from another routing protocol\n"
5400 "Routing Information Protocol (RIP)\n"
5401 "Border Gateway Protocol (BGP)\n"
5402 "OSPF exterior metric type for redistributed routes\n"
5403 "Set OSPF External Type 1 metrics\n"
5404 "Set OSPF External Type 2 metrics\n"
5405 "Metric for redistributed routes\n"
5406 "OSPF default metric\n")
5408 ALIAS (ospf_redistribute_source_type_metric
,
5409 ospf_redistribute_source_type_cmd
,
5410 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5411 "Redistribute information from another routing protocol\n"
5415 "Routing Information Protocol (RIP)\n"
5416 "Border Gateway Protocol (BGP)\n"
5417 "OSPF exterior metric type for redistributed routes\n"
5418 "Set OSPF External Type 1 metrics\n"
5419 "Set OSPF External Type 2 metrics\n")
5421 ALIAS (ospf_redistribute_source_type_metric
,
5422 ospf_redistribute_source_cmd
,
5423 "redistribute (kernel|connected|static|rip|bgp)",
5424 "Redistribute information from another routing protocol\n"
5428 "Routing Information Protocol (RIP)\n"
5429 "Border Gateway Protocol (BGP)\n")
5431 DEFUN (ospf_redistribute_source_metric_routemap
,
5432 ospf_redistribute_source_metric_routemap_cmd
,
5433 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5434 "Redistribute information from another routing protocol\n"
5438 "Routing Information Protocol (RIP)\n"
5439 "Border Gateway Protocol (BGP)\n"
5440 "Metric for redistributed routes\n"
5441 "OSPF default metric\n"
5442 "Route map reference\n"
5443 "Pointer to route-map entries\n")
5445 struct ospf
*ospf
= vty
->index
;
5449 /* Get distribute source. */
5450 if (!str2distribute_source (argv
[0], &source
))
5453 /* Get metric value. */
5455 if (!str2metric (argv
[1], &metric
))
5459 ospf_routemap_set (ospf
, source
, argv
[2]);
5461 ospf_routemap_unset (ospf
, source
);
5463 return ospf_redistribute_set (ospf
, source
, -1, metric
);
5466 DEFUN (ospf_redistribute_source_type_routemap
,
5467 ospf_redistribute_source_type_routemap_cmd
,
5468 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5469 "Redistribute information from another routing protocol\n"
5473 "Routing Information Protocol (RIP)\n"
5474 "Border Gateway Protocol (BGP)\n"
5475 "OSPF exterior metric type for redistributed routes\n"
5476 "Set OSPF External Type 1 metrics\n"
5477 "Set OSPF External Type 2 metrics\n"
5478 "Route map reference\n"
5479 "Pointer to route-map entries\n")
5481 struct ospf
*ospf
= vty
->index
;
5485 /* Get distribute source. */
5486 if (!str2distribute_source (argv
[0], &source
))
5489 /* Get metric value. */
5491 if (!str2metric_type (argv
[1], &type
))
5495 ospf_routemap_set (ospf
, source
, argv
[2]);
5497 ospf_routemap_unset (ospf
, source
);
5499 return ospf_redistribute_set (ospf
, source
, type
, -1);
5502 DEFUN (ospf_redistribute_source_routemap
,
5503 ospf_redistribute_source_routemap_cmd
,
5504 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5505 "Redistribute information from another routing protocol\n"
5509 "Routing Information Protocol (RIP)\n"
5510 "Border Gateway Protocol (BGP)\n"
5511 "Route map reference\n"
5512 "Pointer to route-map entries\n")
5514 struct ospf
*ospf
= vty
->index
;
5517 /* Get distribute source. */
5518 if (!str2distribute_source (argv
[0], &source
))
5522 ospf_routemap_set (ospf
, source
, argv
[1]);
5524 ospf_routemap_unset (ospf
, source
);
5526 return ospf_redistribute_set (ospf
, source
, -1, -1);
5529 DEFUN (no_ospf_redistribute_source
,
5530 no_ospf_redistribute_source_cmd
,
5531 "no redistribute (kernel|connected|static|rip|bgp)",
5533 "Redistribute information from another routing protocol\n"
5537 "Routing Information Protocol (RIP)\n"
5538 "Border Gateway Protocol (BGP)\n")
5540 struct ospf
*ospf
= vty
->index
;
5543 if (!str2distribute_source (argv
[0], &source
))
5546 ospf_routemap_unset (ospf
, source
);
5547 return ospf_redistribute_unset (ospf
, source
);
5550 DEFUN (ospf_distribute_list_out
,
5551 ospf_distribute_list_out_cmd
,
5552 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5553 "Filter networks in routing updates\n"
5554 "Access-list name\n"
5559 "Routing Information Protocol (RIP)\n"
5560 "Border Gateway Protocol (BGP)\n")
5562 struct ospf
*ospf
= vty
->index
;
5565 /* Get distribute source. */
5566 if (!str2distribute_source (argv
[1], &source
))
5569 return ospf_distribute_list_out_set (ospf
, source
, argv
[0]);
5572 DEFUN (no_ospf_distribute_list_out
,
5573 no_ospf_distribute_list_out_cmd
,
5574 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5576 "Filter networks in routing updates\n"
5577 "Access-list name\n"
5582 "Routing Information Protocol (RIP)\n"
5583 "Border Gateway Protocol (BGP)\n")
5585 struct ospf
*ospf
= vty
->index
;
5588 if (!str2distribute_source (argv
[1], &source
))
5591 return ospf_distribute_list_out_unset (ospf
, source
, argv
[0]);
5594 /* Default information originate. */
5595 DEFUN (ospf_default_information_originate_metric_type_routemap
,
5596 ospf_default_information_originate_metric_type_routemap_cmd
,
5597 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5598 "Control distribution of default information\n"
5599 "Distribute a default route\n"
5600 "OSPF default metric\n"
5602 "OSPF metric type for default routes\n"
5603 "Set OSPF External Type 1 metrics\n"
5604 "Set OSPF External Type 2 metrics\n"
5605 "Route map reference\n"
5606 "Pointer to route-map entries\n")
5608 struct ospf
*ospf
= vty
->index
;
5612 /* Get metric value. */
5614 if (!str2metric (argv
[0], &metric
))
5617 /* Get metric type. */
5619 if (!str2metric_type (argv
[1], &type
))
5623 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5625 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5627 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5631 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5632 ospf_default_information_originate_metric_type_cmd
,
5633 "default-information originate metric <0-16777214> metric-type (1|2)",
5634 "Control distribution of default information\n"
5635 "Distribute a default route\n"
5636 "OSPF default metric\n"
5638 "OSPF metric type for default routes\n"
5639 "Set OSPF External Type 1 metrics\n"
5640 "Set OSPF External Type 2 metrics\n")
5642 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5643 ospf_default_information_originate_metric_cmd
,
5644 "default-information originate metric <0-16777214>",
5645 "Control distribution of default information\n"
5646 "Distribute a default route\n"
5647 "OSPF default metric\n"
5650 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5651 ospf_default_information_originate_cmd
,
5652 "default-information originate",
5653 "Control distribution of default information\n"
5654 "Distribute a default route\n")
5656 /* Default information originate. */
5657 DEFUN (ospf_default_information_originate_metric_routemap
,
5658 ospf_default_information_originate_metric_routemap_cmd
,
5659 "default-information originate metric <0-16777214> route-map WORD",
5660 "Control distribution of default information\n"
5661 "Distribute a default route\n"
5662 "OSPF default metric\n"
5664 "Route map reference\n"
5665 "Pointer to route-map entries\n")
5667 struct ospf
*ospf
= vty
->index
;
5670 /* Get metric value. */
5672 if (!str2metric (argv
[0], &metric
))
5676 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5678 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5680 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5684 /* Default information originate. */
5685 DEFUN (ospf_default_information_originate_routemap
,
5686 ospf_default_information_originate_routemap_cmd
,
5687 "default-information originate route-map WORD",
5688 "Control distribution of default information\n"
5689 "Distribute a default route\n"
5690 "Route map reference\n"
5691 "Pointer to route-map entries\n")
5693 struct ospf
*ospf
= vty
->index
;
5696 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
5698 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5700 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
, -1, -1);
5703 DEFUN (ospf_default_information_originate_type_metric_routemap
,
5704 ospf_default_information_originate_type_metric_routemap_cmd
,
5705 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
5706 "Control distribution of default information\n"
5707 "Distribute a default route\n"
5708 "OSPF metric type for default routes\n"
5709 "Set OSPF External Type 1 metrics\n"
5710 "Set OSPF External Type 2 metrics\n"
5711 "OSPF default metric\n"
5713 "Route map reference\n"
5714 "Pointer to route-map entries\n")
5716 struct ospf
*ospf
= vty
->index
;
5720 /* Get metric type. */
5722 if (!str2metric_type (argv
[0], &type
))
5725 /* Get metric value. */
5727 if (!str2metric (argv
[1], &metric
))
5731 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5733 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5735 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5739 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5740 ospf_default_information_originate_type_metric_cmd
,
5741 "default-information originate metric-type (1|2) metric <0-16777214>",
5742 "Control distribution of default information\n"
5743 "Distribute a default route\n"
5744 "OSPF metric type for default routes\n"
5745 "Set OSPF External Type 1 metrics\n"
5746 "Set OSPF External Type 2 metrics\n"
5747 "OSPF default metric\n"
5750 ALIAS (ospf_default_information_originate_type_metric_routemap
,
5751 ospf_default_information_originate_type_cmd
,
5752 "default-information originate metric-type (1|2)",
5753 "Control distribution of default information\n"
5754 "Distribute a default route\n"
5755 "OSPF metric type for default routes\n"
5756 "Set OSPF External Type 1 metrics\n"
5757 "Set OSPF External Type 2 metrics\n")
5759 DEFUN (ospf_default_information_originate_type_routemap
,
5760 ospf_default_information_originate_type_routemap_cmd
,
5761 "default-information originate metric-type (1|2) route-map WORD",
5762 "Control distribution of default information\n"
5763 "Distribute a default route\n"
5764 "OSPF metric type for default routes\n"
5765 "Set OSPF External Type 1 metrics\n"
5766 "Set OSPF External Type 2 metrics\n"
5767 "Route map reference\n"
5768 "Pointer to route-map entries\n")
5770 struct ospf
*ospf
= vty
->index
;
5773 /* Get metric type. */
5775 if (!str2metric_type (argv
[0], &type
))
5779 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5781 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5783 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5787 DEFUN (ospf_default_information_originate_always_metric_type_routemap
,
5788 ospf_default_information_originate_always_metric_type_routemap_cmd
,
5789 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5790 "Control distribution of default information\n"
5791 "Distribute a default route\n"
5792 "Always advertise default route\n"
5793 "OSPF default metric\n"
5795 "OSPF metric type for default routes\n"
5796 "Set OSPF External Type 1 metrics\n"
5797 "Set OSPF External Type 2 metrics\n"
5798 "Route map reference\n"
5799 "Pointer to route-map entries\n")
5801 struct ospf
*ospf
= vty
->index
;
5805 /* Get metric value. */
5807 if (!str2metric (argv
[0], &metric
))
5810 /* Get metric type. */
5812 if (!str2metric_type (argv
[1], &type
))
5816 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5818 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5820 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5824 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5825 ospf_default_information_originate_always_metric_type_cmd
,
5826 "default-information originate always metric <0-16777214> metric-type (1|2)",
5827 "Control distribution of default information\n"
5828 "Distribute a default route\n"
5829 "Always advertise default route\n"
5830 "OSPF default metric\n"
5832 "OSPF metric type for default routes\n"
5833 "Set OSPF External Type 1 metrics\n"
5834 "Set OSPF External Type 2 metrics\n")
5836 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5837 ospf_default_information_originate_always_metric_cmd
,
5838 "default-information originate always metric <0-16777214>",
5839 "Control distribution of default information\n"
5840 "Distribute a default route\n"
5841 "Always advertise default route\n"
5842 "OSPF default metric\n"
5844 "OSPF metric type for default routes\n")
5846 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
5847 ospf_default_information_originate_always_cmd
,
5848 "default-information originate always",
5849 "Control distribution of default information\n"
5850 "Distribute a default route\n"
5851 "Always advertise default route\n")
5853 DEFUN (ospf_default_information_originate_always_metric_routemap
,
5854 ospf_default_information_originate_always_metric_routemap_cmd
,
5855 "default-information originate always metric <0-16777214> route-map WORD",
5856 "Control distribution of default information\n"
5857 "Distribute a default route\n"
5858 "Always advertise default route\n"
5859 "OSPF default metric\n"
5861 "Route map reference\n"
5862 "Pointer to route-map entries\n")
5864 struct ospf
*ospf
= vty
->index
;
5867 /* Get metric value. */
5869 if (!str2metric (argv
[0], &metric
))
5873 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5875 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5877 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5881 DEFUN (ospf_default_information_originate_always_routemap
,
5882 ospf_default_information_originate_always_routemap_cmd
,
5883 "default-information originate always route-map WORD",
5884 "Control distribution of default information\n"
5885 "Distribute a default route\n"
5886 "Always advertise default route\n"
5887 "Route map reference\n"
5888 "Pointer to route-map entries\n")
5890 struct ospf
*ospf
= vty
->index
;
5893 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
5895 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5897 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
, -1, -1);
5900 DEFUN (ospf_default_information_originate_always_type_metric_routemap
,
5901 ospf_default_information_originate_always_type_metric_routemap_cmd
,
5902 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
5903 "Control distribution of default information\n"
5904 "Distribute a default route\n"
5905 "Always advertise default route\n"
5906 "OSPF metric type for default routes\n"
5907 "Set OSPF External Type 1 metrics\n"
5908 "Set OSPF External Type 2 metrics\n"
5909 "OSPF default metric\n"
5911 "Route map reference\n"
5912 "Pointer to route-map entries\n")
5914 struct ospf
*ospf
= vty
->index
;
5918 /* Get metric type. */
5920 if (!str2metric_type (argv
[0], &type
))
5923 /* Get metric value. */
5925 if (!str2metric (argv
[1], &metric
))
5929 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5931 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5933 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5937 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5938 ospf_default_information_originate_always_type_metric_cmd
,
5939 "default-information originate always metric-type (1|2) metric <0-16777214>",
5940 "Control distribution of default information\n"
5941 "Distribute a default route\n"
5942 "Always advertise default route\n"
5943 "OSPF metric type for default routes\n"
5944 "Set OSPF External Type 1 metrics\n"
5945 "Set OSPF External Type 2 metrics\n"
5946 "OSPF default metric\n"
5949 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
5950 ospf_default_information_originate_always_type_cmd
,
5951 "default-information originate always metric-type (1|2)",
5952 "Control distribution of default information\n"
5953 "Distribute a default route\n"
5954 "Always advertise default route\n"
5955 "OSPF metric type for default routes\n"
5956 "Set OSPF External Type 1 metrics\n"
5957 "Set OSPF External Type 2 metrics\n")
5959 DEFUN (ospf_default_information_originate_always_type_routemap
,
5960 ospf_default_information_originate_always_type_routemap_cmd
,
5961 "default-information originate always metric-type (1|2) route-map WORD",
5962 "Control distribution of default information\n"
5963 "Distribute a default route\n"
5964 "Always advertise default route\n"
5965 "OSPF metric type for default routes\n"
5966 "Set OSPF External Type 1 metrics\n"
5967 "Set OSPF External Type 2 metrics\n"
5968 "Route map reference\n"
5969 "Pointer to route-map entries\n")
5971 struct ospf
*ospf
= vty
->index
;
5974 /* Get metric type. */
5976 if (!str2metric_type (argv
[0], &type
))
5980 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5982 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5984 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
5988 DEFUN (no_ospf_default_information_originate
,
5989 no_ospf_default_information_originate_cmd
,
5990 "no default-information originate",
5992 "Control distribution of default information\n"
5993 "Distribute a default route\n")
5995 struct ospf
*ospf
= vty
->index
;
5996 struct prefix_ipv4 p
;
5997 struct in_addr nexthop
;
6000 p
.prefix
.s_addr
= 0;
6003 ospf_external_lsa_flush (ospf
, DEFAULT_ROUTE
, &p
, 0, nexthop
);
6005 if (EXTERNAL_INFO (DEFAULT_ROUTE
)) {
6006 ospf_external_info_delete (DEFAULT_ROUTE
, p
);
6007 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE
));
6008 EXTERNAL_INFO (DEFAULT_ROUTE
) = NULL
;
6011 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6012 return ospf_redistribute_default_unset (ospf
);
6015 DEFUN (ospf_default_metric
,
6016 ospf_default_metric_cmd
,
6017 "default-metric <0-16777214>",
6018 "Set metric of redistributed routes\n"
6021 struct ospf
*ospf
= vty
->index
;
6024 if (!str2metric (argv
[0], &metric
))
6027 ospf
->default_metric
= metric
;
6032 DEFUN (no_ospf_default_metric
,
6033 no_ospf_default_metric_cmd
,
6034 "no default-metric",
6036 "Set metric of redistributed routes\n")
6038 struct ospf
*ospf
= vty
->index
;
6040 ospf
->default_metric
= -1;
6045 ALIAS (no_ospf_default_metric
,
6046 no_ospf_default_metric_val_cmd
,
6047 "no default-metric <0-16777214>",
6049 "Set metric of redistributed routes\n"
6052 DEFUN (ospf_distance
,
6055 "Define an administrative distance\n"
6056 "OSPF Administrative distance\n")
6058 struct ospf
*ospf
= vty
->index
;
6060 ospf
->distance_all
= atoi (argv
[0]);
6065 DEFUN (no_ospf_distance
,
6066 no_ospf_distance_cmd
,
6067 "no distance <1-255>",
6069 "Define an administrative distance\n"
6070 "OSPF Administrative distance\n")
6072 struct ospf
*ospf
= vty
->index
;
6074 ospf
->distance_all
= 0;
6079 DEFUN (no_ospf_distance_ospf
,
6080 no_ospf_distance_ospf_cmd
,
6083 "Define an administrative distance\n"
6084 "OSPF Administrative distance\n"
6087 struct ospf
*ospf
= vty
->index
;
6089 ospf
->distance_intra
= 0;
6090 ospf
->distance_inter
= 0;
6091 ospf
->distance_external
= 0;
6096 DEFUN (ospf_distance_ospf_intra
,
6097 ospf_distance_ospf_intra_cmd
,
6098 "distance ospf intra-area <1-255>",
6099 "Define an administrative distance\n"
6100 "OSPF Administrative distance\n"
6101 "Intra-area routes\n"
6102 "Distance for intra-area routes\n")
6104 struct ospf
*ospf
= vty
->index
;
6106 ospf
->distance_intra
= atoi (argv
[0]);
6111 DEFUN (ospf_distance_ospf_intra_inter
,
6112 ospf_distance_ospf_intra_inter_cmd
,
6113 "distance ospf intra-area <1-255> inter-area <1-255>",
6114 "Define an administrative distance\n"
6115 "OSPF Administrative distance\n"
6116 "Intra-area routes\n"
6117 "Distance for intra-area routes\n"
6118 "Inter-area routes\n"
6119 "Distance for inter-area routes\n")
6121 struct ospf
*ospf
= vty
->index
;
6123 ospf
->distance_intra
= atoi (argv
[0]);
6124 ospf
->distance_inter
= atoi (argv
[1]);
6129 DEFUN (ospf_distance_ospf_intra_external
,
6130 ospf_distance_ospf_intra_external_cmd
,
6131 "distance ospf intra-area <1-255> external <1-255>",
6132 "Define an administrative distance\n"
6133 "OSPF Administrative distance\n"
6134 "Intra-area routes\n"
6135 "Distance for intra-area routes\n"
6137 "Distance for external routes\n")
6139 struct ospf
*ospf
= vty
->index
;
6141 ospf
->distance_intra
= atoi (argv
[0]);
6142 ospf
->distance_external
= atoi (argv
[1]);
6147 DEFUN (ospf_distance_ospf_intra_inter_external
,
6148 ospf_distance_ospf_intra_inter_external_cmd
,
6149 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6150 "Define an administrative distance\n"
6151 "OSPF Administrative distance\n"
6152 "Intra-area routes\n"
6153 "Distance for intra-area routes\n"
6154 "Inter-area routes\n"
6155 "Distance for inter-area routes\n"
6157 "Distance for external routes\n")
6159 struct ospf
*ospf
= vty
->index
;
6161 ospf
->distance_intra
= atoi (argv
[0]);
6162 ospf
->distance_inter
= atoi (argv
[1]);
6163 ospf
->distance_external
= atoi (argv
[2]);
6168 DEFUN (ospf_distance_ospf_intra_external_inter
,
6169 ospf_distance_ospf_intra_external_inter_cmd
,
6170 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6171 "Define an administrative distance\n"
6172 "OSPF Administrative distance\n"
6173 "Intra-area routes\n"
6174 "Distance for intra-area routes\n"
6176 "Distance for external routes\n"
6177 "Inter-area routes\n"
6178 "Distance for inter-area routes\n")
6180 struct ospf
*ospf
= vty
->index
;
6182 ospf
->distance_intra
= atoi (argv
[0]);
6183 ospf
->distance_external
= atoi (argv
[1]);
6184 ospf
->distance_inter
= atoi (argv
[2]);
6189 DEFUN (ospf_distance_ospf_inter
,
6190 ospf_distance_ospf_inter_cmd
,
6191 "distance ospf inter-area <1-255>",
6192 "Define an administrative distance\n"
6193 "OSPF Administrative distance\n"
6194 "Inter-area routes\n"
6195 "Distance for inter-area routes\n")
6197 struct ospf
*ospf
= vty
->index
;
6199 ospf
->distance_inter
= atoi (argv
[0]);
6204 DEFUN (ospf_distance_ospf_inter_intra
,
6205 ospf_distance_ospf_inter_intra_cmd
,
6206 "distance ospf inter-area <1-255> intra-area <1-255>",
6207 "Define an administrative distance\n"
6208 "OSPF Administrative distance\n"
6209 "Inter-area routes\n"
6210 "Distance for inter-area routes\n"
6211 "Intra-area routes\n"
6212 "Distance for intra-area routes\n")
6214 struct ospf
*ospf
= vty
->index
;
6216 ospf
->distance_inter
= atoi (argv
[0]);
6217 ospf
->distance_intra
= atoi (argv
[1]);
6222 DEFUN (ospf_distance_ospf_inter_external
,
6223 ospf_distance_ospf_inter_external_cmd
,
6224 "distance ospf inter-area <1-255> external <1-255>",
6225 "Define an administrative distance\n"
6226 "OSPF Administrative distance\n"
6227 "Inter-area routes\n"
6228 "Distance for inter-area routes\n"
6230 "Distance for external routes\n")
6232 struct ospf
*ospf
= vty
->index
;
6234 ospf
->distance_inter
= atoi (argv
[0]);
6235 ospf
->distance_external
= atoi (argv
[1]);
6240 DEFUN (ospf_distance_ospf_inter_intra_external
,
6241 ospf_distance_ospf_inter_intra_external_cmd
,
6242 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6243 "Define an administrative distance\n"
6244 "OSPF Administrative distance\n"
6245 "Inter-area routes\n"
6246 "Distance for inter-area routes\n"
6247 "Intra-area routes\n"
6248 "Distance for intra-area routes\n"
6250 "Distance for external routes\n")
6252 struct ospf
*ospf
= vty
->index
;
6254 ospf
->distance_inter
= atoi (argv
[0]);
6255 ospf
->distance_intra
= atoi (argv
[1]);
6256 ospf
->distance_external
= atoi (argv
[2]);
6261 DEFUN (ospf_distance_ospf_inter_external_intra
,
6262 ospf_distance_ospf_inter_external_intra_cmd
,
6263 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6264 "Define an administrative distance\n"
6265 "OSPF Administrative distance\n"
6266 "Inter-area routes\n"
6267 "Distance for inter-area routes\n"
6269 "Distance for external routes\n"
6270 "Intra-area routes\n"
6271 "Distance for intra-area routes\n")
6273 struct ospf
*ospf
= vty
->index
;
6275 ospf
->distance_inter
= atoi (argv
[0]);
6276 ospf
->distance_external
= atoi (argv
[1]);
6277 ospf
->distance_intra
= atoi (argv
[2]);
6282 DEFUN (ospf_distance_ospf_external
,
6283 ospf_distance_ospf_external_cmd
,
6284 "distance ospf external <1-255>",
6285 "Define an administrative distance\n"
6286 "OSPF Administrative distance\n"
6288 "Distance for external routes\n")
6290 struct ospf
*ospf
= vty
->index
;
6292 ospf
->distance_external
= atoi (argv
[0]);
6297 DEFUN (ospf_distance_ospf_external_intra
,
6298 ospf_distance_ospf_external_intra_cmd
,
6299 "distance ospf external <1-255> intra-area <1-255>",
6300 "Define an administrative distance\n"
6301 "OSPF Administrative distance\n"
6303 "Distance for external routes\n"
6304 "Intra-area routes\n"
6305 "Distance for intra-area routes\n")
6307 struct ospf
*ospf
= vty
->index
;
6309 ospf
->distance_external
= atoi (argv
[0]);
6310 ospf
->distance_intra
= atoi (argv
[1]);
6315 DEFUN (ospf_distance_ospf_external_inter
,
6316 ospf_distance_ospf_external_inter_cmd
,
6317 "distance ospf external <1-255> inter-area <1-255>",
6318 "Define an administrative distance\n"
6319 "OSPF Administrative distance\n"
6321 "Distance for external routes\n"
6322 "Inter-area routes\n"
6323 "Distance for inter-area routes\n")
6325 struct ospf
*ospf
= vty
->index
;
6327 ospf
->distance_external
= atoi (argv
[0]);
6328 ospf
->distance_inter
= atoi (argv
[1]);
6333 DEFUN (ospf_distance_ospf_external_intra_inter
,
6334 ospf_distance_ospf_external_intra_inter_cmd
,
6335 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6336 "Define an administrative distance\n"
6337 "OSPF Administrative distance\n"
6339 "Distance for external routes\n"
6340 "Intra-area routes\n"
6341 "Distance for intra-area routes\n"
6342 "Inter-area routes\n"
6343 "Distance for inter-area routes\n")
6345 struct ospf
*ospf
= vty
->index
;
6347 ospf
->distance_external
= atoi (argv
[0]);
6348 ospf
->distance_intra
= atoi (argv
[1]);
6349 ospf
->distance_inter
= atoi (argv
[2]);
6354 DEFUN (ospf_distance_ospf_external_inter_intra
,
6355 ospf_distance_ospf_external_inter_intra_cmd
,
6356 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6357 "Define an administrative distance\n"
6358 "OSPF Administrative distance\n"
6360 "Distance for external routes\n"
6361 "Inter-area routes\n"
6362 "Distance for inter-area routes\n"
6363 "Intra-area routes\n"
6364 "Distance for intra-area routes\n")
6366 struct ospf
*ospf
= vty
->index
;
6368 ospf
->distance_external
= atoi (argv
[0]);
6369 ospf
->distance_inter
= atoi (argv
[1]);
6370 ospf
->distance_intra
= atoi (argv
[2]);
6375 DEFUN (ospf_distance_source
,
6376 ospf_distance_source_cmd
,
6377 "distance <1-255> A.B.C.D/M",
6378 "Administrative distance\n"
6380 "IP source prefix\n")
6382 struct ospf
*ospf
= vty
->index
;
6384 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], NULL
);
6389 DEFUN (no_ospf_distance_source
,
6390 no_ospf_distance_source_cmd
,
6391 "no distance <1-255> A.B.C.D/M",
6393 "Administrative distance\n"
6395 "IP source prefix\n")
6397 struct ospf
*ospf
= vty
->index
;
6399 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], NULL
);
6404 DEFUN (ospf_distance_source_access_list
,
6405 ospf_distance_source_access_list_cmd
,
6406 "distance <1-255> A.B.C.D/M WORD",
6407 "Administrative distance\n"
6409 "IP source prefix\n"
6410 "Access list name\n")
6412 struct ospf
*ospf
= vty
->index
;
6414 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6419 DEFUN (no_ospf_distance_source_access_list
,
6420 no_ospf_distance_source_access_list_cmd
,
6421 "no distance <1-255> A.B.C.D/M WORD",
6423 "Administrative distance\n"
6425 "IP source prefix\n"
6426 "Access list name\n")
6428 struct ospf
*ospf
= vty
->index
;
6430 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6436 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
6438 struct route_node
*rn
;
6439 struct ospf_route
*or;
6440 struct listnode
*pnode
;
6441 struct ospf_path
*path
;
6443 vty_out (vty
, "============ OSPF network routing table ============%s",
6446 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6447 if ((or = rn
->info
) != NULL
)
6450 snprintf (buf1
, 19, "%s/%d",
6451 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6453 switch (or->path_type
)
6455 case OSPF_PATH_INTER_AREA
:
6456 if (or->type
== OSPF_DESTINATION_NETWORK
)
6457 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
6458 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6459 else if (or->type
== OSPF_DESTINATION_DISCARD
)
6460 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
6462 case OSPF_PATH_INTRA_AREA
:
6463 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
6464 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
6470 if (or->type
== OSPF_DESTINATION_NETWORK
)
6471 LIST_LOOP (or->paths
, path
, pnode
)
6473 if (path
->oi
!= NULL
)
6475 if (path
->nexthop
.s_addr
== 0)
6476 vty_out (vty
, "%24s directly attached to %s%s",
6477 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6479 vty_out (vty
, "%24s via %s, %s%s", "",
6480 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6485 vty_out (vty
, "%s", VTY_NEWLINE
);
6489 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
6491 struct route_node
*rn
;
6492 struct ospf_route
*or;
6493 struct listnode
*pn
, *nn
;
6494 struct ospf_path
*path
;
6496 vty_out (vty
, "============ OSPF router routing table =============%s",
6498 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
6503 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
6505 for (nn
= listhead ((struct list
*) rn
->info
); nn
; nextnode (nn
))
6506 if ((or = getdata (nn
)) != NULL
)
6509 vty_out (vty
, "%24s", "");
6512 vty_out (vty
, "%s [%d] area: %s",
6513 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
6514 or->cost
, inet_ntoa (or->u
.std
.area_id
));
6516 vty_out (vty
, "%s%s%s",
6517 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
6518 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
6521 LIST_LOOP (or->paths
, path
, pn
)
6523 if (path
->nexthop
.s_addr
== 0)
6524 vty_out (vty
, "%24s directly attached to %s%s",
6525 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6527 vty_out (vty
, "%24s via %s, %s%s", "",
6528 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6533 vty_out (vty
, "%s", VTY_NEWLINE
);
6537 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
6539 struct route_node
*rn
;
6540 struct ospf_route
*er
;
6541 struct listnode
*pnode
;
6542 struct ospf_path
*path
;
6544 vty_out (vty
, "============ OSPF external routing table ===========%s",
6546 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
6547 if ((er
= rn
->info
) != NULL
)
6550 snprintf (buf1
, 19, "%s/%d",
6551 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
6553 switch (er
->path_type
)
6555 case OSPF_PATH_TYPE1_EXTERNAL
:
6556 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
6557 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6559 case OSPF_PATH_TYPE2_EXTERNAL
:
6560 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
6561 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
6565 LIST_LOOP (er
->paths
, path
, pnode
)
6567 if (path
->oi
!= NULL
)
6569 if (path
->nexthop
.s_addr
== 0)
6570 vty_out (vty
, "%24s directly attached to %s%s",
6571 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
6573 vty_out (vty
, "%24s via %s, %s%s", "",
6574 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
6579 vty_out (vty
, "%s", VTY_NEWLINE
);
6582 DEFUN (show_ip_ospf_border_routers
,
6583 show_ip_ospf_border_routers_cmd
,
6584 "show ip ospf border-routers",
6587 "show all the ABR's and ASBR's\n"
6592 ospf
= ospf_lookup ();
6595 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6599 if (ospf
->new_table
== NULL
)
6601 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6605 /* Show Network routes.
6606 show_ip_ospf_route_network (vty, ospf->new_table); */
6608 /* Show Router routes. */
6609 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
6614 DEFUN (show_ip_ospf_route
,
6615 show_ip_ospf_route_cmd
,
6616 "show ip ospf route",
6619 "OSPF information\n"
6620 "OSPF routing table\n")
6624 ospf
= ospf_lookup ();
6627 vty_out (vty
, "OSPF is not enabled%s", VTY_NEWLINE
);
6631 if (ospf
->new_table
== NULL
)
6633 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
6637 /* Show Network routes. */
6638 show_ip_ospf_route_network (vty
, ospf
->new_table
);
6640 /* Show Router routes. */
6641 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
6643 /* Show AS External routes. */
6644 show_ip_ospf_route_external (vty
, ospf
->old_external_route
);
6650 const char *ospf_abr_type_str
[] =
6659 const char *ospf_shortcut_mode_str
[] =
6668 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
6670 memset (buf
, 0, length
);
6672 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6673 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
6675 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
6679 const char *ospf_int_type_str
[] =
6681 "unknown", /* should never be used. */
6685 "point-to-multipoint",
6686 "virtual-link", /* should never be used. */
6690 /* Configuration write function for ospfd. */
6692 config_write_interface (struct vty
*vty
)
6694 struct listnode
*n1
, *n2
;
6695 struct interface
*ifp
;
6696 struct crypt_key
*ck
;
6698 struct route_node
*rn
= NULL
;
6699 struct ospf_if_params
*params
;
6701 for (n1
= listhead (iflist
); n1
; nextnode (n1
))
6705 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
6708 vty_out (vty
, "!%s", VTY_NEWLINE
);
6709 vty_out (vty
, "interface %s%s", ifp
->name
,
6712 vty_out (vty
, " description %s%s", ifp
->desc
,
6717 params
= IF_DEF_PARAMS (ifp
);
6720 /* Interface Network print. */
6721 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
6722 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
6724 if ((!if_is_broadcast(ifp
)) &&
6725 (params
->type
!= OSPF_IFTYPE_BROADCAST
))
6727 vty_out (vty
, " ip ospf network %s",
6728 ospf_int_type_str
[params
->type
]);
6729 if (params
!= IF_DEF_PARAMS (ifp
))
6730 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6731 vty_out (vty
, "%s", VTY_NEWLINE
);
6735 /* OSPF interface authentication print */
6736 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
6737 params
->auth_type
!= OSPF_AUTH_NOTSET
)
6739 const char *auth_str
;
6741 /* Translation tables are not that much help here due to syntax
6742 of the simple option */
6743 switch (params
->auth_type
)
6746 case OSPF_AUTH_NULL
:
6750 case OSPF_AUTH_SIMPLE
:
6754 case OSPF_AUTH_CRYPTOGRAPHIC
:
6755 auth_str
= " message-digest";
6763 vty_out (vty
, " ip ospf authentication%s", auth_str
);
6764 if (params
!= IF_DEF_PARAMS (ifp
))
6765 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6766 vty_out (vty
, "%s", VTY_NEWLINE
);
6769 /* Simple Authentication Password print. */
6770 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
6771 params
->auth_simple
[0] != '\0')
6773 vty_out (vty
, " ip ospf authentication-key %s",
6774 params
->auth_simple
);
6775 if (params
!= IF_DEF_PARAMS (ifp
))
6776 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6777 vty_out (vty
, "%s", VTY_NEWLINE
);
6780 /* Cryptographic Authentication Key print. */
6781 for (n2
= listhead (params
->auth_crypt
); n2
; nextnode (n2
))
6784 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
6785 ck
->key_id
, ck
->auth_key
);
6786 if (params
!= IF_DEF_PARAMS (ifp
))
6787 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6788 vty_out (vty
, "%s", VTY_NEWLINE
);
6791 /* Interface Output Cost print. */
6792 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
6794 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
6795 if (params
!= IF_DEF_PARAMS (ifp
))
6796 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6797 vty_out (vty
, "%s", VTY_NEWLINE
);
6800 /* Hello Interval print. */
6801 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
6802 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
6804 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
6805 if (params
!= IF_DEF_PARAMS (ifp
))
6806 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6807 vty_out (vty
, "%s", VTY_NEWLINE
);
6811 /* Router Dead Interval print. */
6812 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
6813 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
6815 vty_out (vty
, " ip ospf dead-interval %u", params
->v_wait
);
6816 if (params
!= IF_DEF_PARAMS (ifp
))
6817 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6818 vty_out (vty
, "%s", VTY_NEWLINE
);
6821 /* Router Priority print. */
6822 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
6823 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
6825 vty_out (vty
, " ip ospf priority %u", params
->priority
);
6826 if (params
!= IF_DEF_PARAMS (ifp
))
6827 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6828 vty_out (vty
, "%s", VTY_NEWLINE
);
6831 /* Retransmit Interval print. */
6832 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
6833 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
6835 vty_out (vty
, " ip ospf retransmit-interval %u",
6836 params
->retransmit_interval
);
6837 if (params
!= IF_DEF_PARAMS (ifp
))
6838 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6839 vty_out (vty
, "%s", VTY_NEWLINE
);
6842 /* Transmit Delay print. */
6843 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
6844 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
6846 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
6847 if (params
!= IF_DEF_PARAMS (ifp
))
6848 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
6849 vty_out (vty
, "%s", VTY_NEWLINE
);
6855 rn
= route_top (IF_OIFS_PARAMS (ifp
));
6857 rn
= route_next (rn
);
6867 #ifdef HAVE_OPAQUE_LSA
6868 ospf_opaque_config_write_if (vty
, ifp
);
6869 #endif /* HAVE_OPAQUE_LSA */
6876 config_write_network_area (struct vty
*vty
, struct ospf
*ospf
)
6878 struct route_node
*rn
;
6879 u_char buf
[INET_ADDRSTRLEN
];
6881 /* `network area' print. */
6882 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
6885 struct ospf_network
*n
= rn
->info
;
6887 memset (buf
, 0, INET_ADDRSTRLEN
);
6889 /* Create Area ID string by specified Area ID format. */
6890 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
6891 strncpy ((char *) buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
6893 sprintf ((char *) buf
, "%lu",
6894 (unsigned long int) ntohl (n
->area_id
.s_addr
));
6896 /* Network print. */
6897 vty_out (vty
, " network %s/%d area %s%s",
6898 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
6906 config_write_ospf_area (struct vty
*vty
, struct ospf
*ospf
)
6908 struct listnode
*node
;
6909 u_char buf
[INET_ADDRSTRLEN
];
6911 /* Area configuration print. */
6912 for (node
= listhead (ospf
->areas
); node
; nextnode (node
))
6914 struct ospf_area
*area
= getdata (node
);
6915 struct route_node
*rn1
;
6917 area_id2str ((char *) buf
, INET_ADDRSTRLEN
, area
);
6919 if (area
->auth_type
!= OSPF_AUTH_NULL
)
6921 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
6922 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
6924 vty_out (vty
, " area %s authentication message-digest%s",
6928 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
6929 vty_out (vty
, " area %s shortcut %s%s", buf
,
6930 ospf_shortcut_mode_str
[area
->shortcut_configured
],
6933 if ((area
->external_routing
== OSPF_AREA_STUB
)
6934 || (area
->external_routing
== OSPF_AREA_NSSA
)
6937 if (area
->external_routing
== OSPF_AREA_STUB
)
6938 vty_out (vty
, " area %s stub", buf
);
6939 else if (area
->external_routing
== OSPF_AREA_NSSA
)
6941 vty_out (vty
, " area %s nssa", buf
);
6942 switch (area
->NSSATranslatorRole
)
6944 case OSPF_NSSA_ROLE_NEVER
:
6945 vty_out (vty
, " translate-never");
6947 case OSPF_NSSA_ROLE_ALWAYS
:
6948 vty_out (vty
, " translate-always");
6950 case OSPF_NSSA_ROLE_CANDIDATE
:
6952 vty_out (vty
, " translate-candidate");
6956 if (area
->no_summary
)
6957 vty_out (vty
, " no-summary");
6959 vty_out (vty
, "%s", VTY_NEWLINE
);
6961 if (area
->default_cost
!= 1)
6962 vty_out (vty
, " area %s default-cost %d%s", buf
,
6963 area
->default_cost
, VTY_NEWLINE
);
6966 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
6969 struct ospf_area_range
*range
= rn1
->info
;
6971 vty_out (vty
, " area %s range %s/%d", buf
,
6972 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
6974 if (range
->cost_config
!= OSPF_AREA_RANGE_COST_UNSPEC
)
6975 vty_out (vty
, " cost %d", range
->cost_config
);
6977 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
6978 vty_out (vty
, " not-advertise");
6980 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
6981 vty_out (vty
, " substitute %s/%d",
6982 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
6984 vty_out (vty
, "%s", VTY_NEWLINE
);
6987 if (EXPORT_NAME (area
))
6988 vty_out (vty
, " area %s export-list %s%s", buf
,
6989 EXPORT_NAME (area
), VTY_NEWLINE
);
6991 if (IMPORT_NAME (area
))
6992 vty_out (vty
, " area %s import-list %s%s", buf
,
6993 IMPORT_NAME (area
), VTY_NEWLINE
);
6995 if (PREFIX_NAME_IN (area
))
6996 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
6997 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
6999 if (PREFIX_NAME_OUT (area
))
7000 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
7001 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
7008 config_write_ospf_nbr_nbma (struct vty
*vty
, struct ospf
*ospf
)
7010 struct ospf_nbr_nbma
*nbr_nbma
;
7011 struct route_node
*rn
;
7013 /* Static Neighbor configuration print. */
7014 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
7015 if ((nbr_nbma
= rn
->info
))
7017 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
7019 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
7020 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
7022 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
7023 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
7025 vty_out (vty
, "%s", VTY_NEWLINE
);
7032 config_write_virtual_link (struct vty
*vty
, struct ospf
*ospf
)
7034 struct listnode
*node
;
7035 u_char buf
[INET_ADDRSTRLEN
];
7037 /* Virtual-Link print */
7038 for (node
= listhead (ospf
->vlinks
); node
; nextnode (node
))
7040 struct listnode
*n2
;
7041 struct crypt_key
*ck
;
7042 struct ospf_vl_data
*vl_data
= getdata (node
);
7043 struct ospf_interface
*oi
;
7045 if (vl_data
!= NULL
)
7047 memset (buf
, 0, INET_ADDRSTRLEN
);
7049 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7050 strncpy ((char *) buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
7052 sprintf ((char *) buf
, "%lu",
7053 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
7054 oi
= vl_data
->vl_oi
;
7057 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
7058 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
7059 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
7060 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
7061 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7063 inet_ntoa (vl_data
->vl_peer
),
7064 OSPF_IF_PARAM (oi
, v_hello
),
7065 OSPF_IF_PARAM (oi
, retransmit_interval
),
7066 OSPF_IF_PARAM (oi
, transmit_delay
),
7067 OSPF_IF_PARAM (oi
, v_wait
),
7070 vty_out (vty
, " area %s virtual-link %s%s", buf
,
7071 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
7073 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
7074 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
7076 inet_ntoa (vl_data
->vl_peer
),
7077 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
7080 for (n2
= listhead (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
); n2
; nextnode (n2
))
7083 vty_out (vty
, " area %s virtual-link %s message-digest-key %d md5 %s%s",
7085 inet_ntoa (vl_data
->vl_peer
),
7086 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
7096 const char *distribute_str
[] = { "system", "kernel", "connected", "static",
7097 "rip", "ripng", "ospf", "ospf6", "isis", "bgp"};
7099 config_write_ospf_redistribute (struct vty
*vty
, struct ospf
*ospf
)
7103 /* redistribute print. */
7104 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7105 if (type
!= zclient
->redist_default
&& zclient
->redist
[type
])
7107 vty_out (vty
, " redistribute %s", distribute_str
[type
]);
7108 if (ospf
->dmetric
[type
].value
>= 0)
7109 vty_out (vty
, " metric %d", ospf
->dmetric
[type
].value
);
7111 if (ospf
->dmetric
[type
].type
== EXTERNAL_METRIC_TYPE_1
)
7112 vty_out (vty
, " metric-type 1");
7114 if (ROUTEMAP_NAME (ospf
, type
))
7115 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (ospf
, type
));
7117 vty_out (vty
, "%s", VTY_NEWLINE
);
7124 config_write_ospf_default_metric (struct vty
*vty
, struct ospf
*ospf
)
7126 if (ospf
->default_metric
!= -1)
7127 vty_out (vty
, " default-metric %d%s", ospf
->default_metric
,
7133 config_write_ospf_distribute (struct vty
*vty
, struct ospf
*ospf
)
7139 /* distribute-list print. */
7140 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7141 if (ospf
->dlist
[type
].name
)
7142 vty_out (vty
, " distribute-list %s out %s%s",
7143 ospf
->dlist
[type
].name
,
7144 distribute_str
[type
], VTY_NEWLINE
);
7146 /* default-information print. */
7147 if (ospf
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
7149 if (ospf
->default_originate
== DEFAULT_ORIGINATE_ZEBRA
)
7150 vty_out (vty
, " default-information originate");
7152 vty_out (vty
, " default-information originate always");
7154 if (ospf
->dmetric
[DEFAULT_ROUTE
].value
>= 0)
7155 vty_out (vty
, " metric %d",
7156 ospf
->dmetric
[DEFAULT_ROUTE
].value
);
7157 if (ospf
->dmetric
[DEFAULT_ROUTE
].type
== EXTERNAL_METRIC_TYPE_1
)
7158 vty_out (vty
, " metric-type 1");
7160 if (ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
))
7161 vty_out (vty
, " route-map %s",
7162 ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
));
7164 vty_out (vty
, "%s", VTY_NEWLINE
);
7173 config_write_ospf_distance (struct vty
*vty
, struct ospf
*ospf
)
7175 struct route_node
*rn
;
7176 struct ospf_distance
*odistance
;
7178 if (ospf
->distance_all
)
7179 vty_out (vty
, " distance %d%s", ospf
->distance_all
, VTY_NEWLINE
);
7181 if (ospf
->distance_intra
7182 || ospf
->distance_inter
7183 || ospf
->distance_external
)
7185 vty_out (vty
, " distance ospf");
7187 if (ospf
->distance_intra
)
7188 vty_out (vty
, " intra-area %d", ospf
->distance_intra
);
7189 if (ospf
->distance_inter
)
7190 vty_out (vty
, " inter-area %d", ospf
->distance_inter
);
7191 if (ospf
->distance_external
)
7192 vty_out (vty
, " external %d", ospf
->distance_external
);
7194 vty_out (vty
, "%s", VTY_NEWLINE
);
7197 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
7198 if ((odistance
= rn
->info
) != NULL
)
7200 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
7201 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7202 odistance
->access_list
? odistance
->access_list
: "",
7208 /* OSPF configuration write function. */
7210 ospf_config_write (struct vty
*vty
)
7213 struct listnode
*node
;
7216 ospf
= ospf_lookup ();
7219 /* `router ospf' print. */
7220 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
7224 if (!ospf
->networks
)
7227 /* Router ID print. */
7228 if (ospf
->router_id_static
.s_addr
!= 0)
7229 vty_out (vty
, " ospf router-id %s%s",
7230 inet_ntoa (ospf
->router_id_static
), VTY_NEWLINE
);
7232 /* ABR type print. */
7233 if (ospf
->abr_type
!= OSPF_ABR_STAND
)
7234 vty_out (vty
, " ospf abr-type %s%s",
7235 ospf_abr_type_str
[ospf
->abr_type
], VTY_NEWLINE
);
7237 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
7238 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
7239 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
7241 /* auto-cost reference-bandwidth configuration. */
7242 if (ospf
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
7243 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
7244 ospf
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
7246 /* SPF timers print. */
7247 if (ospf
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
7248 ospf
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
)
7249 vty_out (vty
, " timers spf %d %d%s",
7250 ospf
->spf_delay
, ospf
->spf_holdtime
, VTY_NEWLINE
);
7252 /* SPF refresh parameters print. */
7253 if (ospf
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
7254 vty_out (vty
, " refresh timer %d%s",
7255 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
7257 /* Redistribute information print. */
7258 config_write_ospf_redistribute (vty
, ospf
);
7260 /* passive-interface print. */
7261 for (node
= listhead (om
->iflist
); node
; nextnode (node
))
7263 struct interface
*ifp
= getdata (node
);
7267 if (IF_DEF_PARAMS (ifp
)->passive_interface
== OSPF_IF_PASSIVE
)
7268 vty_out (vty
, " passive-interface %s%s",
7269 ifp
->name
, VTY_NEWLINE
);
7272 for (node
= listhead (ospf
->oiflist
); node
; nextnode (node
))
7274 struct ospf_interface
*oi
= getdata (node
);
7276 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
) &&
7277 oi
->params
->passive_interface
== OSPF_IF_PASSIVE
)
7278 vty_out (vty
, " passive-interface %s %s%s",
7280 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
7284 /* Network area print. */
7285 config_write_network_area (vty
, ospf
);
7287 /* Area config print. */
7288 config_write_ospf_area (vty
, ospf
);
7290 /* static neighbor print. */
7291 config_write_ospf_nbr_nbma (vty
, ospf
);
7293 /* Virtual-Link print. */
7294 config_write_virtual_link (vty
, ospf
);
7296 /* Default metric configuration. */
7297 config_write_ospf_default_metric (vty
, ospf
);
7299 /* Distribute-list and default-information print. */
7300 config_write_ospf_distribute (vty
, ospf
);
7302 /* Distance configuration. */
7303 config_write_ospf_distance (vty
, ospf
);
7305 #ifdef HAVE_OPAQUE_LSA
7306 ospf_opaque_config_write_router (vty
, ospf
);
7307 #endif /* HAVE_OPAQUE_LSA */
7314 ospf_vty_show_init ()
7316 /* "show ip ospf" commands. */
7317 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
7318 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
7320 /* "show ip ospf database" commands. */
7321 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
7322 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
7323 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7324 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7325 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7326 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
7327 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
7328 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
7329 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
7330 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7331 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7332 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7333 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
7334 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
7336 /* "show ip ospf interface" commands. */
7337 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
7338 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
7340 /* "show ip ospf neighbor" commands. */
7341 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7342 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7343 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7344 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7345 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7346 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
7347 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7348 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7349 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7350 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7351 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7352 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7353 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
7354 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7356 /* "show ip ospf route" commands. */
7357 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
7358 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
7359 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
7360 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
7364 /* ospfd's interface node. */
7365 struct cmd_node interface_node
=
7372 /* Initialization of OSPF interface. */
7376 /* Install interface node. */
7377 install_node (&interface_node
, config_write_interface
);
7379 install_element (CONFIG_NODE
, &interface_cmd
);
7380 install_element (CONFIG_NODE
, &no_interface_cmd
);
7381 install_default (INTERFACE_NODE
);
7383 /* "description" commands. */
7384 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
7385 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
7387 /* "ip ospf authentication" commands. */
7388 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
7389 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
7390 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
7391 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
7392 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
7393 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
7394 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
7395 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
7396 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
7397 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
7399 /* "ip ospf message-digest-key" commands. */
7400 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
7401 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
7402 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
7403 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
7405 /* "ip ospf cost" commands. */
7406 install_element (INTERFACE_NODE
, &ip_ospf_cost_addr_cmd
);
7407 install_element (INTERFACE_NODE
, &ip_ospf_cost_cmd
);
7408 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_addr_cmd
);
7409 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
7411 /* "ip ospf dead-interval" commands. */
7412 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
7413 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
7414 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
7415 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
7417 /* "ip ospf hello-interval" commands. */
7418 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
7419 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
7420 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
7421 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
7423 /* "ip ospf network" commands. */
7424 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
7425 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
7427 /* "ip ospf priority" commands. */
7428 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
7429 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
7430 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
7431 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
7433 /* "ip ospf retransmit-interval" commands. */
7434 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
7435 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
7436 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
7437 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
7439 /* "ip ospf transmit-delay" commands. */
7440 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
7441 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
7442 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
7443 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
7445 /* These commands are compatibitliy for previous version. */
7446 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
7447 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
7448 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
7449 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
7450 install_element (INTERFACE_NODE
, &ospf_cost_cmd
);
7451 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
7452 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
7453 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
7454 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
7455 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
7456 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
7457 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
7458 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
7459 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
7460 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
7461 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
7462 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
7463 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
7466 /* Zebra node structure. */
7467 struct cmd_node zebra_node
=
7470 "%s(config-router)#",
7474 ospf_vty_zebra_init ()
7476 install_element (OSPF_NODE
, &ospf_redistribute_source_type_metric_cmd
);
7477 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_type_cmd
);
7478 install_element (OSPF_NODE
, &ospf_redistribute_source_type_cmd
);
7479 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_cmd
);
7480 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
7481 install_element (OSPF_NODE
,
7482 &ospf_redistribute_source_metric_type_routemap_cmd
);
7483 install_element (OSPF_NODE
,
7484 &ospf_redistribute_source_type_metric_routemap_cmd
);
7485 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_routemap_cmd
);
7486 install_element (OSPF_NODE
, &ospf_redistribute_source_type_routemap_cmd
);
7487 install_element (OSPF_NODE
, &ospf_redistribute_source_routemap_cmd
);
7489 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
7491 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
7492 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
7494 install_element (OSPF_NODE
,
7495 &ospf_default_information_originate_metric_type_cmd
);
7496 install_element (OSPF_NODE
, &ospf_default_information_originate_metric_cmd
);
7497 install_element (OSPF_NODE
,
7498 &ospf_default_information_originate_type_metric_cmd
);
7499 install_element (OSPF_NODE
, &ospf_default_information_originate_type_cmd
);
7500 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
7501 install_element (OSPF_NODE
,
7502 &ospf_default_information_originate_always_metric_type_cmd
);
7503 install_element (OSPF_NODE
,
7504 &ospf_default_information_originate_always_metric_cmd
);
7505 install_element (OSPF_NODE
,
7506 &ospf_default_information_originate_always_cmd
);
7507 install_element (OSPF_NODE
,
7508 &ospf_default_information_originate_always_type_metric_cmd
);
7509 install_element (OSPF_NODE
,
7510 &ospf_default_information_originate_always_type_cmd
);
7512 install_element (OSPF_NODE
,
7513 &ospf_default_information_originate_metric_type_routemap_cmd
);
7514 install_element (OSPF_NODE
,
7515 &ospf_default_information_originate_metric_routemap_cmd
);
7516 install_element (OSPF_NODE
,
7517 &ospf_default_information_originate_routemap_cmd
);
7518 install_element (OSPF_NODE
,
7519 &ospf_default_information_originate_type_metric_routemap_cmd
);
7520 install_element (OSPF_NODE
,
7521 &ospf_default_information_originate_type_routemap_cmd
);
7522 install_element (OSPF_NODE
,
7523 &ospf_default_information_originate_always_metric_type_routemap_cmd
);
7524 install_element (OSPF_NODE
,
7525 &ospf_default_information_originate_always_metric_routemap_cmd
);
7526 install_element (OSPF_NODE
,
7527 &ospf_default_information_originate_always_routemap_cmd
);
7528 install_element (OSPF_NODE
,
7529 &ospf_default_information_originate_always_type_metric_routemap_cmd
);
7530 install_element (OSPF_NODE
,
7531 &ospf_default_information_originate_always_type_routemap_cmd
);
7533 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
7535 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
7536 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
7537 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
7539 install_element (OSPF_NODE
, &ospf_distance_cmd
);
7540 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
7541 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
7542 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_cmd
);
7543 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_cmd
);
7544 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_cmd
);
7545 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_external_cmd
);
7546 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_inter_cmd
);
7547 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_cmd
);
7548 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_cmd
);
7549 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_cmd
);
7550 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_external_cmd
);
7551 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_intra_cmd
);
7552 install_element (OSPF_NODE
, &ospf_distance_ospf_external_cmd
);
7553 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_cmd
);
7554 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_cmd
);
7555 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_inter_cmd
);
7556 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_intra_cmd
);
7558 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
7559 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
7560 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
7561 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
7565 struct cmd_node ospf_node
=
7568 "%s(config-router)# ",
7573 /* Install OSPF related vty commands. */
7577 /* Install ospf top node. */
7578 install_node (&ospf_node
, ospf_config_write
);
7580 /* "router ospf" commands. */
7581 install_element (CONFIG_NODE
, &router_ospf_cmd
);
7582 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
7584 install_default (OSPF_NODE
);
7586 /* "ospf router-id" commands. */
7587 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
7588 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
7589 install_element (OSPF_NODE
, &router_ospf_id_cmd
);
7590 install_element (OSPF_NODE
, &no_router_ospf_id_cmd
);
7592 /* "passive-interface" commands. */
7593 install_element (OSPF_NODE
, &ospf_passive_interface_addr_cmd
);
7594 install_element (OSPF_NODE
, &ospf_passive_interface_cmd
);
7595 install_element (OSPF_NODE
, &no_ospf_passive_interface_addr_cmd
);
7596 install_element (OSPF_NODE
, &no_ospf_passive_interface_cmd
);
7598 /* "ospf abr-type" commands. */
7599 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
7600 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
7602 /* "ospf rfc1583-compatible" commands. */
7603 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
7604 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
7605 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
7606 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
7608 /* "network area" commands. */
7609 install_element (OSPF_NODE
, &ospf_network_area_cmd
);
7610 install_element (OSPF_NODE
, &no_ospf_network_area_cmd
);
7612 /* "area authentication" commands. */
7613 install_element (OSPF_NODE
, &ospf_area_authentication_message_digest_cmd
);
7614 install_element (OSPF_NODE
, &ospf_area_authentication_cmd
);
7615 install_element (OSPF_NODE
, &no_ospf_area_authentication_cmd
);
7617 /* "area range" commands. */
7618 install_element (OSPF_NODE
, &ospf_area_range_cmd
);
7619 install_element (OSPF_NODE
, &ospf_area_range_advertise_cmd
);
7620 install_element (OSPF_NODE
, &ospf_area_range_cost_cmd
);
7621 install_element (OSPF_NODE
, &ospf_area_range_advertise_cost_cmd
);
7622 install_element (OSPF_NODE
, &ospf_area_range_not_advertise_cmd
);
7623 install_element (OSPF_NODE
, &no_ospf_area_range_cmd
);
7624 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cmd
);
7625 install_element (OSPF_NODE
, &no_ospf_area_range_cost_cmd
);
7626 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cost_cmd
);
7627 install_element (OSPF_NODE
, &ospf_area_range_substitute_cmd
);
7628 install_element (OSPF_NODE
, &no_ospf_area_range_substitute_cmd
);
7630 /* "area virtual-link" commands. */
7631 install_element (OSPF_NODE
, &ospf_area_vlink_cmd
);
7632 install_element (OSPF_NODE
, &no_ospf_area_vlink_cmd
);
7634 install_element (OSPF_NODE
, &ospf_area_vlink_param1_cmd
);
7635 install_element (OSPF_NODE
, &no_ospf_area_vlink_param1_cmd
);
7637 install_element (OSPF_NODE
, &ospf_area_vlink_param2_cmd
);
7638 install_element (OSPF_NODE
, &no_ospf_area_vlink_param2_cmd
);
7640 install_element (OSPF_NODE
, &ospf_area_vlink_param3_cmd
);
7641 install_element (OSPF_NODE
, &no_ospf_area_vlink_param3_cmd
);
7643 install_element (OSPF_NODE
, &ospf_area_vlink_param4_cmd
);
7644 install_element (OSPF_NODE
, &no_ospf_area_vlink_param4_cmd
);
7646 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_cmd
);
7647 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_cmd
);
7648 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_cmd
);
7650 install_element (OSPF_NODE
, &ospf_area_vlink_md5_cmd
);
7651 install_element (OSPF_NODE
, &no_ospf_area_vlink_md5_cmd
);
7653 install_element (OSPF_NODE
, &ospf_area_vlink_authkey_cmd
);
7654 install_element (OSPF_NODE
, &no_ospf_area_vlink_authkey_cmd
);
7656 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_authkey_cmd
);
7657 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_authkey_cmd
);
7658 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_authkey_cmd
);
7660 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_md5_cmd
);
7661 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_md5_cmd
);
7662 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_md5_cmd
);
7664 /* "area stub" commands. */
7665 install_element (OSPF_NODE
, &ospf_area_stub_no_summary_cmd
);
7666 install_element (OSPF_NODE
, &ospf_area_stub_cmd
);
7667 install_element (OSPF_NODE
, &no_ospf_area_stub_no_summary_cmd
);
7668 install_element (OSPF_NODE
, &no_ospf_area_stub_cmd
);
7670 /* "area nssa" commands. */
7671 install_element (OSPF_NODE
, &ospf_area_nssa_cmd
);
7672 install_element (OSPF_NODE
, &ospf_area_nssa_translate_no_summary_cmd
);
7673 install_element (OSPF_NODE
, &ospf_area_nssa_translate_cmd
);
7674 install_element (OSPF_NODE
, &ospf_area_nssa_no_summary_cmd
);
7675 install_element (OSPF_NODE
, &no_ospf_area_nssa_cmd
);
7676 install_element (OSPF_NODE
, &no_ospf_area_nssa_no_summary_cmd
);
7678 install_element (OSPF_NODE
, &ospf_area_default_cost_cmd
);
7679 install_element (OSPF_NODE
, &no_ospf_area_default_cost_cmd
);
7681 install_element (OSPF_NODE
, &ospf_area_shortcut_cmd
);
7682 install_element (OSPF_NODE
, &no_ospf_area_shortcut_cmd
);
7684 install_element (OSPF_NODE
, &ospf_area_export_list_cmd
);
7685 install_element (OSPF_NODE
, &no_ospf_area_export_list_cmd
);
7687 install_element (OSPF_NODE
, &ospf_area_filter_list_cmd
);
7688 install_element (OSPF_NODE
, &no_ospf_area_filter_list_cmd
);
7690 install_element (OSPF_NODE
, &ospf_area_import_list_cmd
);
7691 install_element (OSPF_NODE
, &no_ospf_area_import_list_cmd
);
7693 install_element (OSPF_NODE
, &ospf_timers_spf_cmd
);
7694 install_element (OSPF_NODE
, &no_ospf_timers_spf_cmd
);
7696 install_element (OSPF_NODE
, &ospf_refresh_timer_cmd
);
7697 install_element (OSPF_NODE
, &no_ospf_refresh_timer_val_cmd
);
7698 install_element (OSPF_NODE
, &no_ospf_refresh_timer_cmd
);
7700 install_element (OSPF_NODE
, &ospf_auto_cost_reference_bandwidth_cmd
);
7701 install_element (OSPF_NODE
, &no_ospf_auto_cost_reference_bandwidth_cmd
);
7703 /* "neighbor" commands. */
7704 install_element (OSPF_NODE
, &ospf_neighbor_cmd
);
7705 install_element (OSPF_NODE
, &ospf_neighbor_priority_poll_interval_cmd
);
7706 install_element (OSPF_NODE
, &ospf_neighbor_priority_cmd
);
7707 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_cmd
);
7708 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_priority_cmd
);
7709 install_element (OSPF_NODE
, &no_ospf_neighbor_cmd
);
7710 install_element (OSPF_NODE
, &no_ospf_neighbor_priority_cmd
);
7711 install_element (OSPF_NODE
, &no_ospf_neighbor_poll_interval_cmd
);
7713 /* Init interface related vty commands. */
7714 ospf_vty_if_init ();
7716 /* Init zebra related vty commands. */
7717 ospf_vty_zebra_init ();