2 * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com>
3 * Copyright (C) 2000 Toshiaki Takada
5 * This file is part of GNU Zebra.
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
35 #include "ospfd/ospfd.h"
36 #include "ospfd/ospf_asbr.h"
37 #include "ospfd/ospf_lsa.h"
38 #include "ospfd/ospf_lsdb.h"
39 #include "ospfd/ospf_ism.h"
40 #include "ospfd/ospf_interface.h"
41 #include "ospfd/ospf_nsm.h"
42 #include "ospfd/ospf_neighbor.h"
43 #include "ospfd/ospf_flood.h"
44 #include "ospfd/ospf_abr.h"
45 #include "ospfd/ospf_spf.h"
46 #include "ospfd/ospf_route.h"
47 #include "ospfd/ospf_zebra.h"
48 /*#include "ospfd/ospf_routemap.h" */
49 #include "ospfd/ospf_vty.h"
50 #include "ospfd/ospf_dump.h"
53 const static char *ospf_network_type_str
[] =
65 /* Utility functions. */
67 ospf_str2area_id (const char *str
, struct in_addr
*area_id
, int *format
)
72 /* match "A.B.C.D". */
73 if (strchr (str
, '.') != NULL
)
75 ret
= inet_aton (str
, area_id
);
78 *format
= OSPF_AREA_ID_FORMAT_ADDRESS
;
80 /* match "<0-4294967295>". */
83 ret
= strtoul (str
, &endptr
, 10);
84 if (*endptr
!= '\0' || (ret
== ULONG_MAX
&& errno
== ERANGE
))
87 area_id
->s_addr
= htonl (ret
);
88 *format
= OSPF_AREA_ID_FORMAT_DECIMAL
;
96 str2distribute_source (const char *str
, int *source
)
102 if (strncmp (str
, "k", 1) == 0)
103 *source
= ZEBRA_ROUTE_KERNEL
;
104 else if (strncmp (str
, "c", 1) == 0)
105 *source
= ZEBRA_ROUTE_CONNECT
;
106 else if (strncmp (str
, "s", 1) == 0)
107 *source
= ZEBRA_ROUTE_STATIC
;
108 else if (strncmp (str
, "r", 1) == 0)
109 *source
= ZEBRA_ROUTE_RIP
;
110 else if (strncmp (str
, "b", 1) == 0)
111 *source
= ZEBRA_ROUTE_BGP
;
119 str2metric (const char *str
, int *metric
)
125 *metric
= strtol (str
, NULL
, 10);
126 if (*metric
< 0 && *metric
> 16777214)
128 /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
136 str2metric_type (const char *str
, int *metric_type
)
142 if (strncmp (str
, "1", 1) == 0)
143 *metric_type
= EXTERNAL_METRIC_TYPE_1
;
144 else if (strncmp (str
, "2", 1) == 0)
145 *metric_type
= EXTERNAL_METRIC_TYPE_2
;
153 ospf_oi_count (struct interface
*ifp
)
155 struct route_node
*rn
;
158 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
169 "Enable a routing process\n"
170 "Start OSPF configuration\n")
172 vty
->node
= OSPF_NODE
;
173 vty
->index
= ospf_get ();
178 DEFUN (no_router_ospf
,
182 "Enable a routing process\n"
183 "Start OSPF configuration\n")
187 ospf
= ospf_lookup ();
190 vty_out (vty
, "There isn't active ospf instance%s", VTY_NEWLINE
);
199 DEFUN (ospf_router_id
,
201 "ospf router-id A.B.C.D",
202 "OSPF specific commands\n"
203 "router-id for the OSPF process\n"
204 "OSPF router-id in IP address format\n")
206 struct ospf
*ospf
= vty
->index
;
207 struct in_addr router_id
;
210 ret
= inet_aton (argv
[0], &router_id
);
213 vty_out (vty
, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE
);
217 ospf
->router_id_static
= router_id
;
219 ospf_router_id_update (ospf
);
224 ALIAS (ospf_router_id
,
227 "router-id for the OSPF process\n"
228 "OSPF router-id in IP address format\n")
230 DEFUN (no_ospf_router_id
,
231 no_ospf_router_id_cmd
,
234 "OSPF specific commands\n"
235 "router-id for the OSPF process\n")
237 struct ospf
*ospf
= vty
->index
;
239 ospf
->router_id_static
.s_addr
= 0;
241 ospf_router_id_update (ospf
);
246 ALIAS (no_ospf_router_id
,
247 no_router_ospf_id_cmd
,
250 "router-id for the OSPF process\n")
252 DEFUN (ospf_passive_interface
,
253 ospf_passive_interface_addr_cmd
,
254 "passive-interface IFNAME A.B.C.D",
255 "Suppress routing updates on an interface\n"
256 "Interface's name\n")
258 struct interface
*ifp
;
261 struct ospf_if_params
*params
;
262 struct route_node
*rn
;
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
;
291 /* XXX We should call ospf_if_set_multicast on exactly those
292 * interfaces for which the passive property changed. It is too much
293 * work to determine this set, so we do this for every interface.
294 * This is safe and reasonable because ospf_if_set_multicast uses a
295 * record of joined groups to avoid systems calls if the desired
296 * memberships match the current memership.
298 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
300 struct ospf_interface
*oi
= rn
->info
;
302 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_PASSIVE
))
303 ospf_if_set_multicast(oi
);
306 * XXX It is not clear what state transitions the interface needs to
307 * undergo when going from active to passive. Fixing this will
308 * require precise identification of interfaces having such a
315 ALIAS (ospf_passive_interface
,
316 ospf_passive_interface_cmd
,
317 "passive-interface IFNAME",
318 "Suppress routing updates on an interface\n"
319 "Interface's name\n")
321 DEFUN (no_ospf_passive_interface
,
322 no_ospf_passive_interface_addr_cmd
,
323 "no passive-interface IFNAME A.B.C.D",
325 "Allow routing updates on an interface\n"
326 "Interface's name\n")
328 struct interface
*ifp
;
330 struct ospf_if_params
*params
;
332 struct route_node
*rn
;
334 ifp
= if_lookup_by_name (argv
[0]);
338 vty_out (vty
, "Please specify an existing interface%s", VTY_NEWLINE
);
342 params
= IF_DEF_PARAMS (ifp
);
346 ret
= inet_aton(argv
[1], &addr
);
349 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
354 params
= ospf_lookup_if_params (ifp
, addr
);
359 UNSET_IF_PARAM (params
, passive_interface
);
360 params
->passive_interface
= OSPF_IF_ACTIVE
;
362 if (params
!= IF_DEF_PARAMS (ifp
))
364 ospf_free_if_params (ifp
, addr
);
365 ospf_if_update_params (ifp
, addr
);
368 /* XXX We should call ospf_if_set_multicast on exactly those
369 * interfaces for which the passive property changed. It is too much
370 * work to determine this set, so we do this for every interface.
371 * This is safe and reasonable because ospf_if_set_multicast uses a
372 * record of joined groups to avoid systems calls if the desired
373 * memberships match the current memership.
375 for (rn
= route_top(IF_OIFS(ifp
)); rn
; rn
= route_next (rn
))
377 struct ospf_interface
*oi
= rn
->info
;
379 if (oi
&& (OSPF_IF_PARAM(oi
, passive_interface
) == OSPF_IF_ACTIVE
))
380 ospf_if_set_multicast(oi
);
386 ALIAS (no_ospf_passive_interface
,
387 no_ospf_passive_interface_cmd
,
388 "no passive-interface IFNAME",
390 "Allow routing updates on an interface\n"
391 "Interface's name\n")
393 DEFUN (ospf_network_area
,
394 ospf_network_area_cmd
,
395 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
396 "Enable routing on an IP network\n"
397 "OSPF network prefix\n"
398 "Set the OSPF area ID\n"
399 "OSPF area ID in IP address format\n"
400 "OSPF area ID as a decimal value\n")
402 struct ospf
*ospf
= vty
->index
;
403 struct prefix_ipv4 p
;
404 struct in_addr area_id
;
407 /* Get network prefix and Area ID. */
408 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
409 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
411 ret
= ospf_network_set (ospf
, &p
, area_id
);
414 vty_out (vty
, "There is already same network statement.%s", VTY_NEWLINE
);
421 DEFUN (no_ospf_network_area
,
422 no_ospf_network_area_cmd
,
423 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
425 "Enable routing on an IP network\n"
426 "OSPF network prefix\n"
427 "Set the OSPF area ID\n"
428 "OSPF area ID in IP address format\n"
429 "OSPF area ID as a decimal value\n")
431 struct ospf
*ospf
= (struct ospf
*) vty
->index
;
432 struct prefix_ipv4 p
;
433 struct in_addr area_id
;
436 /* Get network prefix and Area ID. */
437 VTY_GET_IPV4_PREFIX ("network prefix", p
, argv
[0]);
438 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[1]);
440 ret
= ospf_network_unset (ospf
, &p
, area_id
);
443 vty_out (vty
, "Can't find specified network area configuration.%s",
452 DEFUN (ospf_area_range
,
454 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
455 "OSPF area parameters\n"
456 "OSPF area ID in IP address format\n"
457 "OSPF area ID as a decimal value\n"
458 "Summarize routes matching address/mask (border routers only)\n"
459 "Area range prefix\n")
461 struct ospf
*ospf
= vty
->index
;
462 struct prefix_ipv4 p
;
463 struct in_addr area_id
;
467 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
468 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
470 ospf_area_range_set (ospf
, area_id
, &p
, OSPF_AREA_RANGE_ADVERTISE
);
473 VTY_GET_INTEGER ("range cost", cost
, argv
[2]);
474 ospf_area_range_cost_set (ospf
, area_id
, &p
, cost
);
480 ALIAS (ospf_area_range
,
481 ospf_area_range_advertise_cmd
,
482 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
483 "OSPF area parameters\n"
484 "OSPF area ID in IP address format\n"
485 "OSPF area ID as a decimal value\n"
486 "OSPF area range for route advertise (default)\n"
487 "Area range prefix\n"
488 "Advertise this range (default)\n")
490 ALIAS (ospf_area_range
,
491 ospf_area_range_cost_cmd
,
492 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
493 "OSPF area parameters\n"
494 "OSPF area ID in IP address format\n"
495 "OSPF area ID as a decimal value\n"
496 "Summarize routes matching address/mask (border routers only)\n"
497 "Area range prefix\n"
498 "User specified metric for this range\n"
499 "Advertised metric for this range\n")
501 ALIAS (ospf_area_range
,
502 ospf_area_range_advertise_cost_cmd
,
503 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
504 "OSPF area parameters\n"
505 "OSPF area ID in IP address format\n"
506 "OSPF area ID as a decimal value\n"
507 "Summarize routes matching address/mask (border routers only)\n"
508 "Area range prefix\n"
509 "Advertise this range (default)\n"
510 "User specified metric for this range\n"
511 "Advertised metric for this range\n")
513 DEFUN (ospf_area_range_not_advertise
,
514 ospf_area_range_not_advertise_cmd
,
515 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
516 "OSPF area parameters\n"
517 "OSPF area ID in IP address format\n"
518 "OSPF area ID as a decimal value\n"
519 "Summarize routes matching address/mask (border routers only)\n"
520 "Area range prefix\n"
521 "DoNotAdvertise this range\n")
523 struct ospf
*ospf
= vty
->index
;
524 struct prefix_ipv4 p
;
525 struct in_addr area_id
;
528 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
529 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
531 ospf_area_range_set (ospf
, area_id
, &p
, 0);
536 DEFUN (no_ospf_area_range
,
537 no_ospf_area_range_cmd
,
538 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
540 "OSPF area parameters\n"
541 "OSPF area ID in IP address format\n"
542 "OSPF area ID as a decimal value\n"
543 "Summarize routes matching address/mask (border routers only)\n"
544 "Area range prefix\n")
546 struct ospf
*ospf
= vty
->index
;
547 struct prefix_ipv4 p
;
548 struct in_addr area_id
;
551 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
552 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
554 ospf_area_range_unset (ospf
, area_id
, &p
);
559 ALIAS (no_ospf_area_range
,
560 no_ospf_area_range_advertise_cmd
,
561 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
563 "OSPF area parameters\n"
564 "OSPF area ID in IP address format\n"
565 "OSPF area ID as a decimal value\n"
566 "Summarize routes matching address/mask (border routers only)\n"
567 "Area range prefix\n"
568 "Advertise this range (default)\n"
569 "DoNotAdvertise this range\n")
571 ALIAS (no_ospf_area_range
,
572 no_ospf_area_range_cost_cmd
,
573 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
575 "OSPF area parameters\n"
576 "OSPF area ID in IP address format\n"
577 "OSPF area ID as a decimal value\n"
578 "Summarize routes matching address/mask (border routers only)\n"
579 "Area range prefix\n"
580 "User specified metric for this range\n"
581 "Advertised metric for this range\n")
583 ALIAS (no_ospf_area_range
,
584 no_ospf_area_range_advertise_cost_cmd
,
585 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
587 "OSPF area parameters\n"
588 "OSPF area ID in IP address format\n"
589 "OSPF area ID as a decimal value\n"
590 "Summarize routes matching address/mask (border routers only)\n"
591 "Area range prefix\n"
592 "Advertise this range (default)\n"
593 "User specified metric for this range\n"
594 "Advertised metric for this range\n")
596 DEFUN (ospf_area_range_substitute
,
597 ospf_area_range_substitute_cmd
,
598 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
599 "OSPF area parameters\n"
600 "OSPF area ID in IP address format\n"
601 "OSPF area ID as a decimal value\n"
602 "Summarize routes matching address/mask (border routers only)\n"
603 "Area range prefix\n"
604 "Announce area range as another prefix\n"
605 "Network prefix to be announced instead of range\n")
607 struct ospf
*ospf
= vty
->index
;
608 struct prefix_ipv4 p
, s
;
609 struct in_addr area_id
;
612 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
613 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
614 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
616 ospf_area_range_substitute_set (ospf
, area_id
, &p
, &s
);
621 DEFUN (no_ospf_area_range_substitute
,
622 no_ospf_area_range_substitute_cmd
,
623 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
625 "OSPF area parameters\n"
626 "OSPF area ID in IP address format\n"
627 "OSPF area ID as a decimal value\n"
628 "Summarize routes matching address/mask (border routers only)\n"
629 "Area range prefix\n"
630 "Announce area range as another prefix\n"
631 "Network prefix to be announced instead of range\n")
633 struct ospf
*ospf
= vty
->index
;
634 struct prefix_ipv4 p
, s
;
635 struct in_addr area_id
;
638 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
639 VTY_GET_IPV4_PREFIX ("area range", p
, argv
[1]);
640 VTY_GET_IPV4_PREFIX ("substituted network prefix", s
, argv
[2]);
642 ospf_area_range_substitute_unset (ospf
, area_id
, &p
);
648 /* Command Handler Logic in VLink stuff is delicate!!
650 ALTER AT YOUR OWN RISK!!!!
652 Various dummy values are used to represent 'NoChange' state for
653 VLink configuration NOT being changed by a VLink command, and
654 special syntax is used within the command strings so that the
655 typed in command verbs can be seen in the configuration command
656 bacckend handler. This is to drastically reduce the verbeage
657 required to coe up with a reasonably compatible Cisco VLink command
659 - Matthew Grant <grantma@anathoth.gen.nz>
660 Wed, 21 Feb 2001 15:13:52 +1300
664 /* Configuration data for virtual links
666 struct ospf_vl_config_data
{
667 struct vty
*vty
; /* vty stuff */
668 struct in_addr area_id
; /* area ID from command line */
669 int format
; /* command line area ID format */
670 struct in_addr vl_peer
; /* command line vl_peer */
671 int auth_type
; /* Authehntication type, if given */
672 char *auth_key
; /* simple password if present */
673 int crypto_key_id
; /* Cryptographic key ID */
674 char *md5_key
; /* MD5 authentication key */
675 int hello_interval
; /* Obvious what these are... */
676 int retransmit_interval
;
682 ospf_vl_config_data_init (struct ospf_vl_config_data
*vl_config
,
685 memset (vl_config
, 0, sizeof (struct ospf_vl_config_data
));
686 vl_config
->auth_type
= OSPF_AUTH_CMD_NOTSEEN
;
687 vl_config
->vty
= vty
;
690 static struct ospf_vl_data
*
691 ospf_find_vl_data (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
693 struct ospf_area
*area
;
694 struct ospf_vl_data
*vl_data
;
696 struct in_addr area_id
;
698 vty
= vl_config
->vty
;
699 area_id
= vl_config
->area_id
;
701 if (area_id
.s_addr
== OSPF_AREA_BACKBONE
)
704 "Configuring VLs over the backbone is not allowed%s",
708 area
= ospf_area_get (ospf
, area_id
, vl_config
->format
);
710 if (area
->external_routing
!= OSPF_AREA_DEFAULT
)
712 if (vl_config
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
713 vty_out (vty
, "Area %s is %s%s",
715 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
718 vty_out (vty
, "Area %ld is %s%s",
719 (u_long
)ntohl (area_id
.s_addr
),
720 area
->external_routing
== OSPF_AREA_NSSA
?"nssa":"stub",
725 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
->vl_peer
)) == NULL
)
727 vl_data
= ospf_vl_data_new (area
, vl_config
->vl_peer
);
728 if (vl_data
->vl_oi
== NULL
)
730 vl_data
->vl_oi
= ospf_vl_new (ospf
, vl_data
);
731 ospf_vl_add (ospf
, vl_data
);
732 ospf_spf_calculate_schedule (ospf
);
740 ospf_vl_set_security (struct ospf_vl_data
*vl_data
,
741 struct ospf_vl_config_data
*vl_config
)
743 struct crypt_key
*ck
;
745 struct interface
*ifp
= vl_data
->vl_oi
->ifp
;
747 vty
= vl_config
->vty
;
749 if (vl_config
->auth_type
!= OSPF_AUTH_CMD_NOTSEEN
)
751 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), auth_type
);
752 IF_DEF_PARAMS (ifp
)->auth_type
= vl_config
->auth_type
;
755 if (vl_config
->auth_key
)
757 memset(IF_DEF_PARAMS (ifp
)->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+1);
758 strncpy ((char *) IF_DEF_PARAMS (ifp
)->auth_simple
, vl_config
->auth_key
,
759 OSPF_AUTH_SIMPLE_SIZE
);
761 else if (vl_config
->md5_key
)
763 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
)
766 vty_out (vty
, "OSPF: Key %d already exists%s",
767 vl_config
->crypto_key_id
, VTY_NEWLINE
);
770 ck
= ospf_crypt_key_new ();
771 ck
->key_id
= vl_config
->crypto_key_id
;
772 memset(ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
773 strncpy ((char *) ck
->auth_key
, vl_config
->md5_key
, OSPF_AUTH_MD5_SIZE
);
775 ospf_crypt_key_add (IF_DEF_PARAMS (ifp
)->auth_crypt
, ck
);
777 else if (vl_config
->crypto_key_id
!= 0)
781 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp
)->auth_crypt
,
782 vl_config
->crypto_key_id
) == NULL
)
784 vty_out (vty
, "OSPF: Key %d does not exist%s",
785 vl_config
->crypto_key_id
, VTY_NEWLINE
);
789 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp
)->auth_crypt
, vl_config
->crypto_key_id
);
797 ospf_vl_set_timers (struct ospf_vl_data
*vl_data
,
798 struct ospf_vl_config_data
*vl_config
)
800 struct interface
*ifp
= ifp
= vl_data
->vl_oi
->ifp
;
801 /* Virtual Link data initialised to defaults, so only set
803 if (vl_config
->hello_interval
)
805 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_hello
);
806 IF_DEF_PARAMS (ifp
)->v_hello
= vl_config
->hello_interval
;
809 if (vl_config
->dead_interval
)
811 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), v_wait
);
812 IF_DEF_PARAMS (ifp
)->v_wait
= vl_config
->dead_interval
;
815 if (vl_config
->retransmit_interval
)
817 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), retransmit_interval
);
818 IF_DEF_PARAMS (ifp
)->retransmit_interval
= vl_config
->retransmit_interval
;
821 if (vl_config
->transmit_delay
)
823 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), transmit_delay
);
824 IF_DEF_PARAMS (ifp
)->transmit_delay
= vl_config
->transmit_delay
;
832 /* The business end of all of the above */
834 ospf_vl_set (struct ospf
*ospf
, struct ospf_vl_config_data
*vl_config
)
836 struct ospf_vl_data
*vl_data
;
839 vl_data
= ospf_find_vl_data (ospf
, vl_config
);
843 /* Process this one first as it can have a fatal result, which can
844 only logically occur if the virtual link exists already
845 Thus a command error does not result in a change to the
846 running configuration such as unexpectedly altered timer
848 ret
= ospf_vl_set_security (vl_data
, vl_config
);
849 if (ret
!= CMD_SUCCESS
)
852 /* Set any time based parameters, these area already range checked */
854 ret
= ospf_vl_set_timers (vl_data
, vl_config
);
855 if (ret
!= CMD_SUCCESS
)
862 /* This stuff exists to make specifying all the alias commands A LOT simpler
864 #define VLINK_HELPSTR_IPADDR \
865 "OSPF area parameters\n" \
866 "OSPF area ID in IP address format\n" \
867 "OSPF area ID as a decimal value\n" \
868 "Configure a virtual link\n" \
869 "Router ID of the remote ABR\n"
871 #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
872 "Enable authentication on this virtual link\n" \
875 #define VLINK_HELPSTR_AUTHTYPE_ALL \
876 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
877 "Use null authentication\n" \
878 "Use message-digest authentication\n"
880 #define VLINK_HELPSTR_TIME_PARAM_NOSECS \
881 "Time between HELLO packets\n" \
882 "Time between retransmitting lost link state advertisements\n" \
883 "Link state transmit delay\n" \
884 "Interval after which a neighbor is declared dead\n"
886 #define VLINK_HELPSTR_TIME_PARAM \
887 VLINK_HELPSTR_TIME_PARAM_NOSECS \
890 #define VLINK_HELPSTR_AUTH_SIMPLE \
891 "Authentication password (key)\n" \
892 "The OSPF password (key)"
894 #define VLINK_HELPSTR_AUTH_MD5 \
895 "Message digest authentication password (key)\n" \
898 "Use MD5 algorithm\n" \
899 "The OSPF password (key)"
901 DEFUN (ospf_area_vlink
,
903 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
904 VLINK_HELPSTR_IPADDR
)
906 struct ospf
*ospf
= vty
->index
;
907 struct ospf_vl_config_data vl_config
;
908 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
909 char md5_key
[OSPF_AUTH_MD5_SIZE
+1];
913 ospf_vl_config_data_init(&vl_config
, vty
);
915 /* Read off first 2 parameters and check them */
916 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &vl_config
.format
);
919 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
923 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
926 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
933 /* Thats all folks! - BUGS B. strikes again!!!*/
935 return ospf_vl_set (ospf
, &vl_config
);
938 /* Deal with other parameters */
939 for (i
=2; i
< argc
; i
++)
942 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
948 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
950 /* authentication-key - this option can occur anywhere on
951 command line. At start of command line
952 must check for authentication option. */
953 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
954 strncpy (auth_key
, argv
[i
+1], OSPF_AUTH_SIMPLE_SIZE
);
955 vl_config
.auth_key
= auth_key
;
958 else if (strncmp (argv
[i
], "authentication", 14) == 0)
960 /* authentication - this option can only occur at start
962 vl_config
.auth_type
= OSPF_AUTH_SIMPLE
;
965 if (strncmp (argv
[i
+1], "n", 1) == 0)
967 /* "authentication null" */
968 vl_config
.auth_type
= OSPF_AUTH_NULL
;
971 else if (strncmp (argv
[i
+1], "m", 1) == 0
972 && strcmp (argv
[i
+1], "message-digest-") != 0)
974 /* "authentication message-digest" */
975 vl_config
.auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
983 /* message-digest-key */
985 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
986 if (vl_config
.crypto_key_id
< 0)
989 memset(md5_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
990 strncpy (md5_key
, argv
[i
], OSPF_AUTH_MD5_SIZE
);
991 vl_config
.md5_key
= md5_key
;
997 vl_config
.hello_interval
= strtol (argv
[i
], NULL
, 10);
998 if (vl_config
.hello_interval
< 0)
1003 /* Retransmit Interval */
1005 vl_config
.retransmit_interval
= strtol (argv
[i
], NULL
, 10);
1006 if (vl_config
.retransmit_interval
< 0)
1011 /* Transmit Delay */
1013 vl_config
.transmit_delay
= strtol (argv
[i
], NULL
, 10);
1014 if (vl_config
.transmit_delay
< 0)
1021 vl_config
.dead_interval
= strtol (argv
[i
], NULL
, 10);
1022 if (vl_config
.dead_interval
< 0)
1029 /* Action configuration */
1031 return ospf_vl_set (ospf
, &vl_config
);
1035 DEFUN (no_ospf_area_vlink
,
1036 no_ospf_area_vlink_cmd
,
1037 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1039 VLINK_HELPSTR_IPADDR
)
1041 struct ospf
*ospf
= vty
->index
;
1042 struct ospf_area
*area
;
1043 struct ospf_vl_config_data vl_config
;
1044 struct ospf_vl_data
*vl_data
= NULL
;
1045 char auth_key
[OSPF_AUTH_SIMPLE_SIZE
+1];
1049 ospf_vl_config_data_init(&vl_config
, vty
);
1051 ret
= ospf_str2area_id (argv
[0], &vl_config
.area_id
, &format
);
1054 vty_out (vty
, "OSPF area ID is invalid%s", VTY_NEWLINE
);
1058 area
= ospf_area_lookup_by_area_id (ospf
, vl_config
.area_id
);
1061 vty_out (vty
, "Area does not exist%s", VTY_NEWLINE
);
1065 ret
= inet_aton (argv
[1], &vl_config
.vl_peer
);
1068 vty_out (vty
, "Please specify valid Router ID as a.b.c.d%s",
1075 /* Basic VLink no command */
1076 /* Thats all folks! - BUGS B. strikes again!!!*/
1077 if ((vl_data
= ospf_vl_lookup (ospf
, area
, vl_config
.vl_peer
)))
1078 ospf_vl_delete (ospf
, vl_data
);
1080 ospf_area_check_free (ospf
, vl_config
.area_id
);
1085 /* If we are down here, we are reseting parameters */
1087 /* Deal with other parameters */
1088 for (i
=2; i
< argc
; i
++)
1090 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1096 if (i
> 2 || strncmp (argv
[i
], "authentication-", 15) == 0)
1098 /* authentication-key - this option can occur anywhere on
1099 command line. At start of command line
1100 must check for authentication option. */
1101 memset (auth_key
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
1102 vl_config
.auth_key
= auth_key
;
1104 else if (strncmp (argv
[i
], "authentication", 14) == 0)
1106 /* authentication - this option can only occur at start
1108 vl_config
.auth_type
= OSPF_AUTH_NOTSET
;
1113 /* message-digest-key */
1114 /* Delete one key */
1116 vl_config
.crypto_key_id
= strtol (argv
[i
], NULL
, 10);
1117 if (vl_config
.crypto_key_id
< 0)
1119 vl_config
.md5_key
= NULL
;
1123 /* Hello interval */
1124 vl_config
.hello_interval
= OSPF_HELLO_INTERVAL_DEFAULT
;
1128 /* Retransmit Interval */
1129 vl_config
.retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
1133 /* Transmit Delay */
1134 vl_config
.transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
1140 vl_config
.dead_interval
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
1146 /* Action configuration */
1148 return ospf_vl_set (ospf
, &vl_config
);
1151 ALIAS (ospf_area_vlink
,
1152 ospf_area_vlink_param1_cmd
,
1153 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1154 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1155 VLINK_HELPSTR_IPADDR
1156 VLINK_HELPSTR_TIME_PARAM
)
1158 ALIAS (no_ospf_area_vlink
,
1159 no_ospf_area_vlink_param1_cmd
,
1160 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1161 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1163 VLINK_HELPSTR_IPADDR
1164 VLINK_HELPSTR_TIME_PARAM
)
1166 ALIAS (ospf_area_vlink
,
1167 ospf_area_vlink_param2_cmd
,
1168 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1169 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1170 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1171 VLINK_HELPSTR_IPADDR
1172 VLINK_HELPSTR_TIME_PARAM
1173 VLINK_HELPSTR_TIME_PARAM
)
1175 ALIAS (no_ospf_area_vlink
,
1176 no_ospf_area_vlink_param2_cmd
,
1177 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1178 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1179 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1181 VLINK_HELPSTR_IPADDR
1182 VLINK_HELPSTR_TIME_PARAM
1183 VLINK_HELPSTR_TIME_PARAM
)
1185 ALIAS (ospf_area_vlink
,
1186 ospf_area_vlink_param3_cmd
,
1187 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1188 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1189 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1190 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1191 VLINK_HELPSTR_IPADDR
1192 VLINK_HELPSTR_TIME_PARAM
1193 VLINK_HELPSTR_TIME_PARAM
1194 VLINK_HELPSTR_TIME_PARAM
)
1196 ALIAS (no_ospf_area_vlink
,
1197 no_ospf_area_vlink_param3_cmd
,
1198 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1199 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1200 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1201 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1203 VLINK_HELPSTR_IPADDR
1204 VLINK_HELPSTR_TIME_PARAM
1205 VLINK_HELPSTR_TIME_PARAM
1206 VLINK_HELPSTR_TIME_PARAM
)
1208 ALIAS (ospf_area_vlink
,
1209 ospf_area_vlink_param4_cmd
,
1210 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1211 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1212 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1213 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1214 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1215 VLINK_HELPSTR_IPADDR
1216 VLINK_HELPSTR_TIME_PARAM
1217 VLINK_HELPSTR_TIME_PARAM
1218 VLINK_HELPSTR_TIME_PARAM
1219 VLINK_HELPSTR_TIME_PARAM
)
1221 ALIAS (no_ospf_area_vlink
,
1222 no_ospf_area_vlink_param4_cmd
,
1223 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1224 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1225 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1226 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1227 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1229 VLINK_HELPSTR_IPADDR
1230 VLINK_HELPSTR_TIME_PARAM
1231 VLINK_HELPSTR_TIME_PARAM
1232 VLINK_HELPSTR_TIME_PARAM
1233 VLINK_HELPSTR_TIME_PARAM
)
1235 ALIAS (ospf_area_vlink
,
1236 ospf_area_vlink_authtype_args_cmd
,
1237 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1238 "(authentication|) (message-digest|null)",
1239 VLINK_HELPSTR_IPADDR
1240 VLINK_HELPSTR_AUTHTYPE_ALL
)
1242 ALIAS (ospf_area_vlink
,
1243 ospf_area_vlink_authtype_cmd
,
1244 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1245 "(authentication|)",
1246 VLINK_HELPSTR_IPADDR
1247 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1249 ALIAS (no_ospf_area_vlink
,
1250 no_ospf_area_vlink_authtype_cmd
,
1251 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1252 "(authentication|)",
1254 VLINK_HELPSTR_IPADDR
1255 VLINK_HELPSTR_AUTHTYPE_SIMPLE
)
1257 ALIAS (ospf_area_vlink
,
1258 ospf_area_vlink_md5_cmd
,
1259 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1260 "(message-digest-key|) <1-255> md5 KEY",
1261 VLINK_HELPSTR_IPADDR
1262 VLINK_HELPSTR_AUTH_MD5
)
1264 ALIAS (no_ospf_area_vlink
,
1265 no_ospf_area_vlink_md5_cmd
,
1266 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1267 "(message-digest-key|) <1-255>",
1269 VLINK_HELPSTR_IPADDR
1270 VLINK_HELPSTR_AUTH_MD5
)
1272 ALIAS (ospf_area_vlink
,
1273 ospf_area_vlink_authkey_cmd
,
1274 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1275 "(authentication-key|) AUTH_KEY",
1276 VLINK_HELPSTR_IPADDR
1277 VLINK_HELPSTR_AUTH_SIMPLE
)
1279 ALIAS (no_ospf_area_vlink
,
1280 no_ospf_area_vlink_authkey_cmd
,
1281 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1282 "(authentication-key|)",
1284 VLINK_HELPSTR_IPADDR
1285 VLINK_HELPSTR_AUTH_SIMPLE
)
1287 ALIAS (ospf_area_vlink
,
1288 ospf_area_vlink_authtype_args_authkey_cmd
,
1289 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1290 "(authentication|) (message-digest|null) "
1291 "(authentication-key|) AUTH_KEY",
1292 VLINK_HELPSTR_IPADDR
1293 VLINK_HELPSTR_AUTHTYPE_ALL
1294 VLINK_HELPSTR_AUTH_SIMPLE
)
1296 ALIAS (ospf_area_vlink
,
1297 ospf_area_vlink_authtype_authkey_cmd
,
1298 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1299 "(authentication|) "
1300 "(authentication-key|) AUTH_KEY",
1301 VLINK_HELPSTR_IPADDR
1302 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1303 VLINK_HELPSTR_AUTH_SIMPLE
)
1305 ALIAS (no_ospf_area_vlink
,
1306 no_ospf_area_vlink_authtype_authkey_cmd
,
1307 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1308 "(authentication|) "
1309 "(authentication-key|)",
1311 VLINK_HELPSTR_IPADDR
1312 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1313 VLINK_HELPSTR_AUTH_SIMPLE
)
1315 ALIAS (ospf_area_vlink
,
1316 ospf_area_vlink_authtype_args_md5_cmd
,
1317 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1318 "(authentication|) (message-digest|null) "
1319 "(message-digest-key|) <1-255> md5 KEY",
1320 VLINK_HELPSTR_IPADDR
1321 VLINK_HELPSTR_AUTHTYPE_ALL
1322 VLINK_HELPSTR_AUTH_MD5
)
1324 ALIAS (ospf_area_vlink
,
1325 ospf_area_vlink_authtype_md5_cmd
,
1326 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1327 "(authentication|) "
1328 "(message-digest-key|) <1-255> md5 KEY",
1329 VLINK_HELPSTR_IPADDR
1330 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1331 VLINK_HELPSTR_AUTH_MD5
)
1333 ALIAS (no_ospf_area_vlink
,
1334 no_ospf_area_vlink_authtype_md5_cmd
,
1335 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1336 "(authentication|) "
1337 "(message-digest-key|)",
1339 VLINK_HELPSTR_IPADDR
1340 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1341 VLINK_HELPSTR_AUTH_MD5
)
1344 DEFUN (ospf_area_shortcut
,
1345 ospf_area_shortcut_cmd
,
1346 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1347 "OSPF area parameters\n"
1348 "OSPF area ID in IP address format\n"
1349 "OSPF area ID as a decimal value\n"
1350 "Configure the area's shortcutting mode\n"
1351 "Set default shortcutting behavior\n"
1352 "Enable shortcutting through the area\n"
1353 "Disable shortcutting through the area\n")
1355 struct ospf
*ospf
= vty
->index
;
1356 struct ospf_area
*area
;
1357 struct in_addr area_id
;
1361 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1363 area
= ospf_area_get (ospf
, area_id
, format
);
1365 if (strncmp (argv
[1], "de", 2) == 0)
1366 mode
= OSPF_SHORTCUT_DEFAULT
;
1367 else if (strncmp (argv
[1], "di", 2) == 0)
1368 mode
= OSPF_SHORTCUT_DISABLE
;
1369 else if (strncmp (argv
[1], "e", 1) == 0)
1370 mode
= OSPF_SHORTCUT_ENABLE
;
1374 ospf_area_shortcut_set (ospf
, area
, mode
);
1376 if (ospf
->abr_type
!= OSPF_ABR_SHORTCUT
)
1377 vty_out (vty
, "Shortcut area setting will take effect "
1378 "only when the router is configured as Shortcut ABR%s",
1384 DEFUN (no_ospf_area_shortcut
,
1385 no_ospf_area_shortcut_cmd
,
1386 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1388 "OSPF area parameters\n"
1389 "OSPF area ID in IP address format\n"
1390 "OSPF area ID as a decimal value\n"
1391 "Deconfigure the area's shortcutting mode\n"
1392 "Deconfigure enabled shortcutting through the area\n"
1393 "Deconfigure disabled shortcutting through the area\n")
1395 struct ospf
*ospf
= vty
->index
;
1396 struct ospf_area
*area
;
1397 struct in_addr area_id
;
1400 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id
, format
, argv
[0]);
1402 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1406 ospf_area_shortcut_unset (ospf
, area
);
1412 DEFUN (ospf_area_stub
,
1414 "area (A.B.C.D|<0-4294967295>) stub",
1415 "OSPF area parameters\n"
1416 "OSPF area ID in IP address format\n"
1417 "OSPF area ID as a decimal value\n"
1418 "Configure OSPF area as stub\n")
1420 struct ospf
*ospf
= vty
->index
;
1421 struct in_addr area_id
;
1424 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1426 ret
= ospf_area_stub_set (ospf
, area_id
);
1429 vty_out (vty
, "First deconfigure all virtual link through this area%s",
1434 ospf_area_no_summary_unset (ospf
, area_id
);
1439 DEFUN (ospf_area_stub_no_summary
,
1440 ospf_area_stub_no_summary_cmd
,
1441 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1442 "OSPF stub parameters\n"
1443 "OSPF area ID in IP address format\n"
1444 "OSPF area ID as a decimal value\n"
1445 "Configure OSPF area as stub\n"
1446 "Do not inject inter-area routes into stub\n")
1448 struct ospf
*ospf
= vty
->index
;
1449 struct in_addr area_id
;
1452 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1454 ret
= ospf_area_stub_set (ospf
, area_id
);
1457 vty_out (vty
, "%% Area cannot be stub as it contains a virtual link%s",
1462 ospf_area_no_summary_set (ospf
, area_id
);
1467 DEFUN (no_ospf_area_stub
,
1468 no_ospf_area_stub_cmd
,
1469 "no area (A.B.C.D|<0-4294967295>) stub",
1471 "OSPF area parameters\n"
1472 "OSPF area ID in IP address format\n"
1473 "OSPF area ID as a decimal value\n"
1474 "Configure OSPF area as stub\n")
1476 struct ospf
*ospf
= vty
->index
;
1477 struct in_addr area_id
;
1480 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1482 ospf_area_stub_unset (ospf
, area_id
);
1483 ospf_area_no_summary_unset (ospf
, area_id
);
1488 DEFUN (no_ospf_area_stub_no_summary
,
1489 no_ospf_area_stub_no_summary_cmd
,
1490 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1492 "OSPF area parameters\n"
1493 "OSPF area ID in IP address format\n"
1494 "OSPF area ID as a decimal value\n"
1495 "Configure OSPF area as stub\n"
1496 "Do not inject inter-area routes into area\n")
1498 struct ospf
*ospf
= vty
->index
;
1499 struct in_addr area_id
;
1502 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id
, format
, argv
[0]);
1503 ospf_area_no_summary_unset (ospf
, area_id
);
1509 ospf_area_nssa_cmd_handler (struct vty
*vty
, int argc
, const char *argv
[],
1512 struct ospf
*ospf
= vty
->index
;
1513 struct in_addr area_id
;
1516 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1518 ret
= ospf_area_nssa_set (ospf
, area_id
);
1521 vty_out (vty
, "%% Area cannot be nssa as it contains a virtual link%s",
1528 if (strncmp (argv
[1], "translate-c", 11) == 0)
1529 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1530 OSPF_NSSA_ROLE_CANDIDATE
);
1531 else if (strncmp (argv
[1], "translate-n", 11) == 0)
1532 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1533 OSPF_NSSA_ROLE_NEVER
);
1534 else if (strncmp (argv
[1], "translate-a", 11) == 0)
1535 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1536 OSPF_NSSA_ROLE_ALWAYS
);
1540 ospf_area_nssa_translator_role_set (ospf
, area_id
,
1541 OSPF_NSSA_ROLE_CANDIDATE
);
1545 ospf_area_no_summary_set (ospf
, area_id
);
1547 ospf_area_no_summary_unset (ospf
, area_id
);
1549 ospf_schedule_abr_task (ospf
);
1554 DEFUN (ospf_area_nssa_translate_no_summary
,
1555 ospf_area_nssa_translate_no_summary_cmd
,
1556 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
1557 "OSPF area parameters\n"
1558 "OSPF area ID in IP address format\n"
1559 "OSPF area ID as a decimal value\n"
1560 "Configure OSPF area as nssa\n"
1561 "Configure NSSA-ABR for translate election (default)\n"
1562 "Configure NSSA-ABR to never translate\n"
1563 "Configure NSSA-ABR to always translate\n"
1564 "Do not inject inter-area routes into nssa\n")
1566 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1569 DEFUN (ospf_area_nssa_translate
,
1570 ospf_area_nssa_translate_cmd
,
1571 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1572 "OSPF area parameters\n"
1573 "OSPF area ID in IP address format\n"
1574 "OSPF area ID as a decimal value\n"
1575 "Configure OSPF area as nssa\n"
1576 "Configure NSSA-ABR for translate election (default)\n"
1577 "Configure NSSA-ABR to never translate\n"
1578 "Configure NSSA-ABR to always translate\n")
1580 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1583 DEFUN (ospf_area_nssa
,
1585 "area (A.B.C.D|<0-4294967295>) nssa",
1586 "OSPF area parameters\n"
1587 "OSPF area ID in IP address format\n"
1588 "OSPF area ID as a decimal value\n"
1589 "Configure OSPF area as nssa\n")
1591 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 0);
1594 DEFUN (ospf_area_nssa_no_summary
,
1595 ospf_area_nssa_no_summary_cmd
,
1596 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1597 "OSPF area parameters\n"
1598 "OSPF area ID in IP address format\n"
1599 "OSPF area ID as a decimal value\n"
1600 "Configure OSPF area as nssa\n"
1601 "Do not inject inter-area routes into nssa\n")
1603 return ospf_area_nssa_cmd_handler (vty
, argc
, argv
, 1);
1606 DEFUN (no_ospf_area_nssa
,
1607 no_ospf_area_nssa_cmd
,
1608 "no area (A.B.C.D|<0-4294967295>) nssa",
1610 "OSPF area parameters\n"
1611 "OSPF area ID in IP address format\n"
1612 "OSPF area ID as a decimal value\n"
1613 "Configure OSPF area as nssa\n")
1615 struct ospf
*ospf
= vty
->index
;
1616 struct in_addr area_id
;
1619 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1621 ospf_area_nssa_unset (ospf
, area_id
);
1622 ospf_area_no_summary_unset (ospf
, area_id
);
1624 ospf_schedule_abr_task (ospf
);
1629 DEFUN (no_ospf_area_nssa_no_summary
,
1630 no_ospf_area_nssa_no_summary_cmd
,
1631 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1633 "OSPF area parameters\n"
1634 "OSPF area ID in IP address format\n"
1635 "OSPF area ID as a decimal value\n"
1636 "Configure OSPF area as nssa\n"
1637 "Do not inject inter-area routes into nssa\n")
1639 struct ospf
*ospf
= vty
->index
;
1640 struct in_addr area_id
;
1643 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id
, format
, argv
[0]);
1644 ospf_area_no_summary_unset (ospf
, area_id
);
1649 DEFUN (ospf_area_default_cost
,
1650 ospf_area_default_cost_cmd
,
1651 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1652 "OSPF area parameters\n"
1653 "OSPF area ID in IP address format\n"
1654 "OSPF area ID as a decimal value\n"
1655 "Set the summary-default cost of a NSSA or stub area\n"
1656 "Stub's advertised default summary cost\n")
1658 struct ospf
*ospf
= vty
->index
;
1659 struct ospf_area
*area
;
1660 struct in_addr area_id
;
1663 struct prefix_ipv4 p
;
1665 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1666 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1668 area
= ospf_area_get (ospf
, area_id
, format
);
1670 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1672 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1676 area
->default_cost
= cost
;
1679 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1681 if (IS_DEBUG_OSPF_EVENT
)
1682 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1683 "announcing 0.0.0.0/0 to area %s",
1684 inet_ntoa (area
->area_id
));
1685 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1690 DEFUN (no_ospf_area_default_cost
,
1691 no_ospf_area_default_cost_cmd
,
1692 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1694 "OSPF area parameters\n"
1695 "OSPF area ID in IP address format\n"
1696 "OSPF area ID as a decimal value\n"
1697 "Set the summary-default cost of a NSSA or stub area\n"
1698 "Stub's advertised default summary cost\n")
1700 struct ospf
*ospf
= vty
->index
;
1701 struct ospf_area
*area
;
1702 struct in_addr area_id
;
1705 struct prefix_ipv4 p
;
1707 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id
, format
, argv
[0]);
1708 VTY_GET_INTEGER_RANGE ("stub default cost", cost
, argv
[1], 0, 16777215);
1710 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1714 if (area
->external_routing
== OSPF_AREA_DEFAULT
)
1716 vty_out (vty
, "The area is neither stub, nor NSSA%s", VTY_NEWLINE
);
1720 area
->default_cost
= 1;
1723 p
.prefix
.s_addr
= OSPF_DEFAULT_DESTINATION
;
1725 if (IS_DEBUG_OSPF_EVENT
)
1726 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1727 "announcing 0.0.0.0/0 to area %s",
1728 inet_ntoa (area
->area_id
));
1729 ospf_abr_announce_network_to_area (&p
, area
->default_cost
, area
);
1732 ospf_area_check_free (ospf
, area_id
);
1737 DEFUN (ospf_area_export_list
,
1738 ospf_area_export_list_cmd
,
1739 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1740 "OSPF area parameters\n"
1741 "OSPF area ID in IP address format\n"
1742 "OSPF area ID as a decimal value\n"
1743 "Set the filter for networks announced to other areas\n"
1744 "Name of the access-list\n")
1746 struct ospf
*ospf
= vty
->index
;
1747 struct ospf_area
*area
;
1748 struct in_addr area_id
;
1751 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1753 area
= ospf_area_get (ospf
, area_id
, format
);
1754 ospf_area_export_list_set (ospf
, area
, argv
[1]);
1759 DEFUN (no_ospf_area_export_list
,
1760 no_ospf_area_export_list_cmd
,
1761 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1763 "OSPF area parameters\n"
1764 "OSPF area ID in IP address format\n"
1765 "OSPF area ID as a decimal value\n"
1766 "Unset the filter for networks announced to other areas\n"
1767 "Name of the access-list\n")
1769 struct ospf
*ospf
= vty
->index
;
1770 struct ospf_area
*area
;
1771 struct in_addr area_id
;
1774 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1776 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1780 ospf_area_export_list_unset (ospf
, area
);
1786 DEFUN (ospf_area_import_list
,
1787 ospf_area_import_list_cmd
,
1788 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1789 "OSPF area parameters\n"
1790 "OSPF area ID in IP address format\n"
1791 "OSPF area ID as a decimal value\n"
1792 "Set the filter for networks from other areas announced to the specified one\n"
1793 "Name of the access-list\n")
1795 struct ospf
*ospf
= vty
->index
;
1796 struct ospf_area
*area
;
1797 struct in_addr area_id
;
1800 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1802 area
= ospf_area_get (ospf
, area_id
, format
);
1803 ospf_area_import_list_set (ospf
, area
, argv
[1]);
1808 DEFUN (no_ospf_area_import_list
,
1809 no_ospf_area_import_list_cmd
,
1810 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1812 "OSPF area parameters\n"
1813 "OSPF area ID in IP address format\n"
1814 "OSPF area ID as a decimal value\n"
1815 "Unset the filter for networks announced to other areas\n"
1816 "Name of the access-list\n")
1818 struct ospf
*ospf
= vty
->index
;
1819 struct ospf_area
*area
;
1820 struct in_addr area_id
;
1823 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1825 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1829 ospf_area_import_list_unset (ospf
, area
);
1834 DEFUN (ospf_area_filter_list
,
1835 ospf_area_filter_list_cmd
,
1836 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1837 "OSPF area parameters\n"
1838 "OSPF area ID in IP address format\n"
1839 "OSPF area ID as a decimal value\n"
1840 "Filter networks between OSPF areas\n"
1841 "Filter prefixes between OSPF areas\n"
1842 "Name of an IP prefix-list\n"
1843 "Filter networks sent to this area\n"
1844 "Filter networks sent from this area\n")
1846 struct ospf
*ospf
= vty
->index
;
1847 struct ospf_area
*area
;
1848 struct in_addr area_id
;
1849 struct prefix_list
*plist
;
1852 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1854 area
= ospf_area_get (ospf
, area_id
, format
);
1855 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1856 if (strncmp (argv
[2], "in", 2) == 0)
1858 PREFIX_LIST_IN (area
) = plist
;
1859 if (PREFIX_NAME_IN (area
))
1860 free (PREFIX_NAME_IN (area
));
1862 PREFIX_NAME_IN (area
) = strdup (argv
[1]);
1863 ospf_schedule_abr_task (ospf
);
1867 PREFIX_LIST_OUT (area
) = plist
;
1868 if (PREFIX_NAME_OUT (area
))
1869 free (PREFIX_NAME_OUT (area
));
1871 PREFIX_NAME_OUT (area
) = strdup (argv
[1]);
1872 ospf_schedule_abr_task (ospf
);
1878 DEFUN (no_ospf_area_filter_list
,
1879 no_ospf_area_filter_list_cmd
,
1880 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1882 "OSPF area parameters\n"
1883 "OSPF area ID in IP address format\n"
1884 "OSPF area ID as a decimal value\n"
1885 "Filter networks between OSPF areas\n"
1886 "Filter prefixes between OSPF areas\n"
1887 "Name of an IP prefix-list\n"
1888 "Filter networks sent to this area\n"
1889 "Filter networks sent from this area\n")
1891 struct ospf
*ospf
= vty
->index
;
1892 struct ospf_area
*area
;
1893 struct in_addr area_id
;
1894 struct prefix_list
*plist
;
1897 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1899 if ((area
= ospf_area_lookup_by_area_id (ospf
, area_id
)) == NULL
)
1902 plist
= prefix_list_lookup (AFI_IP
, argv
[1]);
1903 if (strncmp (argv
[2], "in", 2) == 0)
1905 if (PREFIX_NAME_IN (area
))
1906 if (strcmp (PREFIX_NAME_IN (area
), argv
[1]) != 0)
1909 PREFIX_LIST_IN (area
) = NULL
;
1910 if (PREFIX_NAME_IN (area
))
1911 free (PREFIX_NAME_IN (area
));
1913 PREFIX_NAME_IN (area
) = NULL
;
1915 ospf_schedule_abr_task (ospf
);
1919 if (PREFIX_NAME_OUT (area
))
1920 if (strcmp (PREFIX_NAME_OUT (area
), argv
[1]) != 0)
1923 PREFIX_LIST_OUT (area
) = NULL
;
1924 if (PREFIX_NAME_OUT (area
))
1925 free (PREFIX_NAME_OUT (area
));
1927 PREFIX_NAME_OUT (area
) = NULL
;
1929 ospf_schedule_abr_task (ospf
);
1936 DEFUN (ospf_area_authentication_message_digest
,
1937 ospf_area_authentication_message_digest_cmd
,
1938 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1939 "OSPF area parameters\n"
1940 "Enable authentication\n"
1941 "Use message-digest authentication\n")
1943 struct ospf
*ospf
= vty
->index
;
1944 struct ospf_area
*area
;
1945 struct in_addr area_id
;
1948 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1950 area
= ospf_area_get (ospf
, area_id
, format
);
1951 area
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
1956 DEFUN (ospf_area_authentication
,
1957 ospf_area_authentication_cmd
,
1958 "area (A.B.C.D|<0-4294967295>) authentication",
1959 "OSPF area parameters\n"
1960 "OSPF area ID in IP address format\n"
1961 "OSPF area ID as a decimal value\n"
1962 "Enable authentication\n")
1964 struct ospf
*ospf
= vty
->index
;
1965 struct ospf_area
*area
;
1966 struct in_addr area_id
;
1969 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1971 area
= ospf_area_get (ospf
, area_id
, format
);
1972 area
->auth_type
= OSPF_AUTH_SIMPLE
;
1977 DEFUN (no_ospf_area_authentication
,
1978 no_ospf_area_authentication_cmd
,
1979 "no area (A.B.C.D|<0-4294967295>) authentication",
1981 "OSPF area parameters\n"
1982 "OSPF area ID in IP address format\n"
1983 "OSPF area ID as a decimal value\n"
1984 "Enable authentication\n")
1986 struct ospf
*ospf
= vty
->index
;
1987 struct ospf_area
*area
;
1988 struct in_addr area_id
;
1991 VTY_GET_OSPF_AREA_ID (area_id
, format
, argv
[0]);
1993 area
= ospf_area_lookup_by_area_id (ospf
, area_id
);
1997 area
->auth_type
= OSPF_AUTH_NULL
;
1999 ospf_area_check_free (ospf
, area_id
);
2005 DEFUN (ospf_abr_type
,
2007 "ospf abr-type (cisco|ibm|shortcut|standard)",
2008 "OSPF specific commands\n"
2009 "Set OSPF ABR type\n"
2010 "Alternative ABR, cisco implementation\n"
2011 "Alternative ABR, IBM implementation\n"
2013 "Standard behavior (RFC2328)\n")
2015 struct ospf
*ospf
= vty
->index
;
2016 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2018 if (strncmp (argv
[0], "c", 1) == 0)
2019 abr_type
= OSPF_ABR_CISCO
;
2020 else if (strncmp (argv
[0], "i", 1) == 0)
2021 abr_type
= OSPF_ABR_IBM
;
2022 else if (strncmp (argv
[0], "sh", 2) == 0)
2023 abr_type
= OSPF_ABR_SHORTCUT
;
2024 else if (strncmp (argv
[0], "st", 2) == 0)
2025 abr_type
= OSPF_ABR_STAND
;
2029 /* If ABR type value is changed, schedule ABR task. */
2030 if (ospf
->abr_type
!= abr_type
)
2032 ospf
->abr_type
= abr_type
;
2033 ospf_schedule_abr_task (ospf
);
2039 DEFUN (no_ospf_abr_type
,
2040 no_ospf_abr_type_cmd
,
2041 "no ospf abr-type (cisco|ibm|shortcut|standard)",
2043 "OSPF specific commands\n"
2044 "Set OSPF ABR type\n"
2045 "Alternative ABR, cisco implementation\n"
2046 "Alternative ABR, IBM implementation\n"
2049 struct ospf
*ospf
= vty
->index
;
2050 u_char abr_type
= OSPF_ABR_UNKNOWN
;
2052 if (strncmp (argv
[0], "c", 1) == 0)
2053 abr_type
= OSPF_ABR_CISCO
;
2054 else if (strncmp (argv
[0], "i", 1) == 0)
2055 abr_type
= OSPF_ABR_IBM
;
2056 else if (strncmp (argv
[0], "s", 1) == 0)
2057 abr_type
= OSPF_ABR_SHORTCUT
;
2061 /* If ABR type value is changed, schedule ABR task. */
2062 if (ospf
->abr_type
== abr_type
)
2064 ospf
->abr_type
= OSPF_ABR_DEFAULT
;
2065 ospf_schedule_abr_task (ospf
);
2071 DEFUN (ospf_compatible_rfc1583
,
2072 ospf_compatible_rfc1583_cmd
,
2073 "compatible rfc1583",
2074 "OSPF compatibility list\n"
2075 "compatible with RFC 1583\n")
2077 struct ospf
*ospf
= vty
->index
;
2079 if (!CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2081 SET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2082 ospf_spf_calculate_schedule (ospf
);
2087 DEFUN (no_ospf_compatible_rfc1583
,
2088 no_ospf_compatible_rfc1583_cmd
,
2089 "no compatible rfc1583",
2091 "OSPF compatibility list\n"
2092 "compatible with RFC 1583\n")
2094 struct ospf
*ospf
= vty
->index
;
2096 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
2098 UNSET_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
);
2099 ospf_spf_calculate_schedule (ospf
);
2104 ALIAS (ospf_compatible_rfc1583
,
2105 ospf_rfc1583_flag_cmd
,
2106 "ospf rfc1583compatibility",
2107 "OSPF specific commands\n"
2108 "Enable the RFC1583Compatibility flag\n")
2110 ALIAS (no_ospf_compatible_rfc1583
,
2111 no_ospf_rfc1583_flag_cmd
,
2112 "no ospf rfc1583compatibility",
2114 "OSPF specific commands\n"
2115 "Disable the RFC1583Compatibility flag\n")
2118 ospf_timers_spf_set (struct vty
*vty
, unsigned int delay
,
2122 struct ospf
*ospf
= vty
->index
;
2124 ospf
->spf_delay
= delay
;
2125 ospf
->spf_holdtime
= hold
;
2126 ospf
->spf_max_holdtime
= max
;
2131 DEFUN (ospf_timers_throttle_spf
,
2132 ospf_timers_throttle_spf_cmd
,
2133 "timers throttle spf <0-600000> <0-600000> <0-600000>",
2134 "Adjust routing timers\n"
2135 "Throttling adaptive timer\n"
2137 "Delay (msec) from first change received till SPF calculation\n"
2138 "Initial hold time (msec) between consecutive SPF calculations\n"
2139 "Maximum hold time (msec)\n")
2141 unsigned int delay
, hold
, max
;
2145 vty_out (vty
, "Insufficient arguments%s", VTY_NEWLINE
);
2149 VTY_GET_INTEGER_RANGE ("SPF delay timer", delay
, argv
[0], 0, 600000);
2150 VTY_GET_INTEGER_RANGE ("SPF hold timer", hold
, argv
[1], 0, 600000);
2151 VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max
, argv
[2], 0, 600000);
2153 return ospf_timers_spf_set (vty
, delay
, hold
, max
);
2156 DEFUN_DEPRECATED (ospf_timers_spf
,
2157 ospf_timers_spf_cmd
,
2158 "timers spf <0-4294967295> <0-4294967295>",
2159 "Adjust routing timers\n"
2161 "Delay (s) between receiving a change to SPF calculation\n"
2162 "Hold time (s) between consecutive SPF calculations\n")
2164 unsigned int delay
, hold
;
2168 vty_out (vty
, "Insufficient number of arguments%s", VTY_NEWLINE
);
2172 VTY_GET_INTEGER ("SPF delay timer", delay
, argv
[0]);
2173 VTY_GET_INTEGER ("SPF hold timer", hold
, argv
[1]);
2175 /* truncate down the second values if they're greater than 600000ms */
2176 if (delay
> (600000 / 1000))
2178 else if (delay
== 0)
2179 /* 0s delay was probably specified because of lack of ms resolution */
2180 delay
= OSPF_SPF_DELAY_DEFAULT
;
2181 if (hold
> (600000 / 1000))
2184 return ospf_timers_spf_set (vty
, delay
* 1000, hold
* 1000, hold
* 1000);
2187 DEFUN (no_ospf_timers_throttle_spf
,
2188 no_ospf_timers_throttle_spf_cmd
,
2189 "no timers throttle spf",
2191 "Adjust routing timers\n"
2192 "Throttling adaptive timer\n"
2193 "OSPF SPF timers\n")
2195 return ospf_timers_spf_set (vty
,
2196 OSPF_SPF_DELAY_DEFAULT
,
2197 OSPF_SPF_HOLDTIME_DEFAULT
,
2198 OSPF_SPF_MAX_HOLDTIME_DEFAULT
);
2201 ALIAS_DEPRECATED (no_ospf_timers_throttle_spf
,
2202 no_ospf_timers_spf_cmd
,
2205 "Adjust routing timers\n"
2206 "OSPF SPF timers\n")
2208 DEFUN (ospf_neighbor
,
2212 "Neighbor IP address\n")
2214 struct ospf
*ospf
= vty
->index
;
2215 struct in_addr nbr_addr
;
2216 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2217 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2219 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2222 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[1], 0, 255);
2225 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[2], 1, 65535);
2227 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2229 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2231 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, priority
);
2236 ALIAS (ospf_neighbor
,
2237 ospf_neighbor_priority_poll_interval_cmd
,
2238 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2240 "Neighbor IP address\n"
2241 "Neighbor Priority\n"
2243 "Dead Neighbor Polling interval\n"
2246 ALIAS (ospf_neighbor
,
2247 ospf_neighbor_priority_cmd
,
2248 "neighbor A.B.C.D priority <0-255>",
2250 "Neighbor IP address\n"
2251 "Neighbor Priority\n"
2254 DEFUN (ospf_neighbor_poll_interval
,
2255 ospf_neighbor_poll_interval_cmd
,
2256 "neighbor A.B.C.D poll-interval <1-65535>",
2258 "Neighbor IP address\n"
2259 "Dead Neighbor Polling interval\n"
2262 struct ospf
*ospf
= vty
->index
;
2263 struct in_addr nbr_addr
;
2264 unsigned int priority
= OSPF_NEIGHBOR_PRIORITY_DEFAULT
;
2265 unsigned int interval
= OSPF_POLL_INTERVAL_DEFAULT
;
2267 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2270 VTY_GET_INTEGER_RANGE ("poll interval", interval
, argv
[1], 1, 65535);
2273 VTY_GET_INTEGER_RANGE ("neighbor priority", priority
, argv
[2], 0, 255);
2275 ospf_nbr_nbma_set (ospf
, nbr_addr
);
2277 ospf_nbr_nbma_poll_interval_set (ospf
, nbr_addr
, interval
);
2279 ospf_nbr_nbma_priority_set (ospf
, nbr_addr
, priority
);
2284 ALIAS (ospf_neighbor_poll_interval
,
2285 ospf_neighbor_poll_interval_priority_cmd
,
2286 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2288 "Neighbor address\n"
2289 "OSPF dead-router polling interval\n"
2291 "OSPF priority of non-broadcast neighbor\n"
2294 DEFUN (no_ospf_neighbor
,
2295 no_ospf_neighbor_cmd
,
2296 "no neighbor A.B.C.D",
2299 "Neighbor IP address\n")
2301 struct ospf
*ospf
= vty
->index
;
2302 struct in_addr nbr_addr
;
2305 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr
, argv
[0]);
2307 ret
= ospf_nbr_nbma_unset (ospf
, nbr_addr
);
2312 ALIAS (no_ospf_neighbor
,
2313 no_ospf_neighbor_priority_cmd
,
2314 "no neighbor A.B.C.D priority <0-255>",
2317 "Neighbor IP address\n"
2318 "Neighbor Priority\n"
2321 ALIAS (no_ospf_neighbor
,
2322 no_ospf_neighbor_poll_interval_cmd
,
2323 "no neighbor A.B.C.D poll-interval <1-65535>",
2326 "Neighbor IP address\n"
2327 "Dead Neighbor Polling interval\n"
2330 ALIAS (no_ospf_neighbor
,
2331 no_ospf_neighbor_priority_pollinterval_cmd
,
2332 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2335 "Neighbor IP address\n"
2336 "Neighbor Priority\n"
2338 "Dead Neighbor Polling interval\n"
2342 DEFUN (ospf_refresh_timer
, ospf_refresh_timer_cmd
,
2343 "refresh timer <10-1800>",
2344 "Adjust refresh parameters\n"
2345 "Set refresh timer\n"
2346 "Timer value in seconds\n")
2348 struct ospf
*ospf
= vty
->index
;
2349 unsigned int interval
;
2351 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2352 interval
= (interval
/ 10) * 10;
2354 ospf_timers_refresh_set (ospf
, interval
);
2359 DEFUN (no_ospf_refresh_timer
, no_ospf_refresh_timer_val_cmd
,
2360 "no refresh timer <10-1800>",
2361 "Adjust refresh parameters\n"
2362 "Unset refresh timer\n"
2363 "Timer value in seconds\n")
2365 struct ospf
*ospf
= vty
->index
;
2366 unsigned int interval
;
2370 VTY_GET_INTEGER_RANGE ("refresh timer", interval
, argv
[0], 10, 1800);
2372 if (ospf
->lsa_refresh_interval
!= interval
||
2373 interval
== OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
2377 ospf_timers_refresh_unset (ospf
);
2382 ALIAS (no_ospf_refresh_timer
,
2383 no_ospf_refresh_timer_cmd
,
2385 "Adjust refresh parameters\n"
2386 "Unset refresh timer\n")
2388 DEFUN (ospf_auto_cost_reference_bandwidth
,
2389 ospf_auto_cost_reference_bandwidth_cmd
,
2390 "auto-cost reference-bandwidth <1-4294967>",
2391 "Calculate OSPF interface cost according to bandwidth\n"
2392 "Use reference bandwidth method to assign OSPF cost\n"
2393 "The reference bandwidth in terms of Mbits per second\n")
2395 struct ospf
*ospf
= vty
->index
;
2397 struct listnode
*node
;
2398 struct interface
*ifp
;
2400 refbw
= strtol (argv
[0], NULL
, 10);
2401 if (refbw
< 1 || refbw
> 4294967)
2403 vty_out (vty
, "reference-bandwidth value is invalid%s", VTY_NEWLINE
);
2407 /* If reference bandwidth is changed. */
2408 if ((refbw
* 1000) == ospf
->ref_bandwidth
)
2411 ospf
->ref_bandwidth
= refbw
* 1000;
2412 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
2413 ospf_if_recalculate_output_cost (ifp
);
2418 DEFUN (no_ospf_auto_cost_reference_bandwidth
,
2419 no_ospf_auto_cost_reference_bandwidth_cmd
,
2420 "no auto-cost reference-bandwidth",
2422 "Calculate OSPF interface cost according to bandwidth\n"
2423 "Use reference bandwidth method to assign OSPF cost\n")
2425 struct ospf
*ospf
= vty
->index
;
2426 struct listnode
*node
, *nnode
;
2427 struct interface
*ifp
;
2429 if (ospf
->ref_bandwidth
== OSPF_DEFAULT_REF_BANDWIDTH
)
2432 ospf
->ref_bandwidth
= OSPF_DEFAULT_REF_BANDWIDTH
;
2433 vty_out (vty
, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE
);
2434 vty_out (vty
, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE
);
2436 for (ALL_LIST_ELEMENTS (om
->iflist
, node
, nnode
, ifp
))
2437 ospf_if_recalculate_output_cost (ifp
);
2442 const char *ospf_abr_type_descr_str
[] =
2445 "Standard (RFC2328)",
2447 "Alternative Cisco",
2448 "Alternative Shortcut"
2451 const char *ospf_shortcut_mode_descr_str
[] =
2461 show_ip_ospf_area (struct vty
*vty
, struct ospf_area
*area
)
2464 vty_out (vty
, " Area ID: %s", inet_ntoa (area
->area_id
));
2466 /* Show Area type/mode. */
2467 if (OSPF_IS_AREA_BACKBONE (area
))
2468 vty_out (vty
, " (Backbone)%s", VTY_NEWLINE
);
2471 if (area
->external_routing
== OSPF_AREA_STUB
)
2472 vty_out (vty
, " (Stub%s%s)",
2473 area
->no_summary
? ", no summary" : "",
2474 area
->shortcut_configured
? "; " : "");
2476 else if (area
->external_routing
== OSPF_AREA_NSSA
)
2477 vty_out (vty
, " (NSSA%s%s)",
2478 area
->no_summary
? ", no summary" : "",
2479 area
->shortcut_configured
? "; " : "");
2481 vty_out (vty
, "%s", VTY_NEWLINE
);
2482 vty_out (vty
, " Shortcutting mode: %s",
2483 ospf_shortcut_mode_descr_str
[area
->shortcut_configured
]);
2484 vty_out (vty
, ", S-bit consensus: %s%s",
2485 area
->shortcut_capability
? "ok" : "no", VTY_NEWLINE
);
2488 /* Show number of interfaces. */
2489 vty_out (vty
, " Number of interfaces in this area: Total: %d, "
2490 "Active: %d%s", listcount (area
->oiflist
),
2491 area
->act_ints
, VTY_NEWLINE
);
2493 if (area
->external_routing
== OSPF_AREA_NSSA
)
2495 vty_out (vty
, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE
, VTY_NEWLINE
);
2496 if (! IS_OSPF_ABR (area
->ospf
))
2497 vty_out (vty
, " It is not ABR, therefore not Translator. %s",
2499 else if (area
->NSSATranslatorState
)
2501 vty_out (vty
, " We are an ABR and ");
2502 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2503 vty_out (vty
, "the NSSA Elected Translator. %s",
2505 else if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_ALWAYS
)
2506 vty_out (vty
, "always an NSSA Translator. %s",
2511 vty_out (vty
, " We are an ABR, but ");
2512 if (area
->NSSATranslatorRole
== OSPF_NSSA_ROLE_CANDIDATE
)
2513 vty_out (vty
, "not the NSSA Elected Translator. %s",
2516 vty_out (vty
, "never an NSSA Translator. %s",
2520 /* Stub-router state for this area */
2521 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
2523 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2524 vty_out (vty
, " Originating stub / maximum-distance Router-LSA%s",
2526 if (CHECK_FLAG(area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
2527 vty_out (vty
, " Administratively activated (indefinitely)%s",
2529 if (area
->t_stub_router
)
2530 vty_out (vty
, " Active from startup, %s remaining%s",
2531 ospf_timer_dump (area
->t_stub_router
, timebuf
,
2532 sizeof(timebuf
)), VTY_NEWLINE
);
2535 /* Show number of fully adjacent neighbors. */
2536 vty_out (vty
, " Number of fully adjacent neighbors in this area:"
2537 " %d%s", area
->full_nbrs
, VTY_NEWLINE
);
2539 /* Show authentication type. */
2540 vty_out (vty
, " Area has ");
2541 if (area
->auth_type
== OSPF_AUTH_NULL
)
2542 vty_out (vty
, "no authentication%s", VTY_NEWLINE
);
2543 else if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
2544 vty_out (vty
, "simple password authentication%s", VTY_NEWLINE
);
2545 else if (area
->auth_type
== OSPF_AUTH_CRYPTOGRAPHIC
)
2546 vty_out (vty
, "message digest authentication%s", VTY_NEWLINE
);
2548 if (!OSPF_IS_AREA_BACKBONE (area
))
2549 vty_out (vty
, " Number of full virtual adjacencies going through"
2550 " this area: %d%s", area
->full_vls
, VTY_NEWLINE
);
2552 /* Show SPF calculation times. */
2553 vty_out (vty
, " SPF algorithm executed %d times%s",
2554 area
->spf_calculation
, VTY_NEWLINE
);
2556 /* Show number of LSA. */
2557 vty_out (vty
, " Number of LSA %ld%s", area
->lsdb
->total
, VTY_NEWLINE
);
2558 vty_out (vty
, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
2559 ospf_lsdb_count (area
->lsdb
, OSPF_ROUTER_LSA
),
2560 ospf_lsdb_checksum (area
->lsdb
, OSPF_ROUTER_LSA
), VTY_NEWLINE
);
2561 vty_out (vty
, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
2562 ospf_lsdb_count (area
->lsdb
, OSPF_NETWORK_LSA
),
2563 ospf_lsdb_checksum (area
->lsdb
, OSPF_NETWORK_LSA
), VTY_NEWLINE
);
2564 vty_out (vty
, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
2565 ospf_lsdb_count (area
->lsdb
, OSPF_SUMMARY_LSA
),
2566 ospf_lsdb_checksum (area
->lsdb
, OSPF_SUMMARY_LSA
), VTY_NEWLINE
);
2567 vty_out (vty
, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
2568 ospf_lsdb_count (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
),
2569 ospf_lsdb_checksum (area
->lsdb
, OSPF_ASBR_SUMMARY_LSA
), VTY_NEWLINE
);
2570 vty_out (vty
, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
2571 ospf_lsdb_count (area
->lsdb
, OSPF_AS_NSSA_LSA
),
2572 ospf_lsdb_checksum (area
->lsdb
, OSPF_AS_NSSA_LSA
), VTY_NEWLINE
);
2573 #ifdef HAVE_OPAQUE_LSA
2574 vty_out (vty
, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
2575 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
),
2576 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_LINK_LSA
), VTY_NEWLINE
);
2577 vty_out (vty
, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
2578 ospf_lsdb_count (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
),
2579 ospf_lsdb_checksum (area
->lsdb
, OSPF_OPAQUE_AREA_LSA
), VTY_NEWLINE
);
2580 #endif /* HAVE_OPAQUE_LSA */
2581 vty_out (vty
, "%s", VTY_NEWLINE
);
2584 DEFUN (show_ip_ospf
,
2589 "OSPF information\n")
2591 struct listnode
*node
, *nnode
;
2592 struct ospf_area
* area
;
2594 struct timeval result
;
2595 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2597 /* Check OSPF is enable. */
2598 ospf
= ospf_lookup ();
2601 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2605 /* Show Router ID. */
2606 vty_out (vty
, " OSPF Routing Process, Router ID: %s%s",
2607 inet_ntoa (ospf
->router_id
),
2610 /* Graceful shutdown */
2611 if (ospf
->t_deferred_shutdown
)
2612 vty_out (vty
, " Deferred shutdown in progress, %s remaining%s",
2613 ospf_timer_dump (ospf
->t_deferred_shutdown
,
2614 timebuf
, sizeof (timebuf
)), VTY_NEWLINE
);
2615 /* Show capability. */
2616 vty_out (vty
, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE
);
2617 vty_out (vty
, " This implementation conforms to RFC2328%s", VTY_NEWLINE
);
2618 vty_out (vty
, " RFC1583Compatibility flag is %s%s",
2619 CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
) ?
2620 "enabled" : "disabled", VTY_NEWLINE
);
2621 #ifdef HAVE_OPAQUE_LSA
2622 vty_out (vty
, " OpaqueCapability flag is %s%s%s",
2623 CHECK_FLAG (ospf
->config
, OSPF_OPAQUE_CAPABLE
) ?
2624 "enabled" : "disabled",
2625 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf
->opaque
) ?
2626 " (origination blocked)" : "",
2628 #endif /* HAVE_OPAQUE_LSA */
2630 /* Show stub-router configuration */
2631 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
2632 || ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
2634 vty_out (vty
, " Stub router advertisement is configured%s",
2636 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
2637 vty_out (vty
, " Enabled for %us after start-up%s",
2638 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
2639 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
2640 vty_out (vty
, " Enabled for %us prior to full shutdown%s",
2641 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
2644 /* Show SPF timers. */
2645 vty_out (vty
, " Initial SPF scheduling delay %d millisec(s)%s"
2646 " Minimum hold time between consecutive SPFs %d millisec(s)%s"
2647 " Maximum hold time between consecutive SPFs %d millisec(s)%s"
2648 " Hold time multiplier is currently %d%s",
2649 ospf
->spf_delay
, VTY_NEWLINE
,
2650 ospf
->spf_holdtime
, VTY_NEWLINE
,
2651 ospf
->spf_max_holdtime
, VTY_NEWLINE
,
2652 ospf
->spf_hold_multiplier
, VTY_NEWLINE
);
2653 vty_out (vty
, " SPF algorithm ");
2654 if (ospf
->ts_spf
.tv_sec
|| ospf
->ts_spf
.tv_usec
)
2656 result
= tv_sub (recent_time
, ospf
->ts_spf
);
2657 vty_out (vty
, "last executed %s ago%s",
2658 ospf_timeval_dump (&result
, timebuf
, sizeof (timebuf
)),
2662 vty_out (vty
, "has not been run%s", VTY_NEWLINE
);
2663 vty_out (vty
, " SPF timer %s%s%s",
2664 (ospf
->t_spf_calc
? "due in " : "is "),
2665 ospf_timer_dump (ospf
->t_spf_calc
, timebuf
, sizeof (timebuf
)),
2668 /* Show refresh parameters. */
2669 vty_out (vty
, " Refresh timer %d secs%s",
2670 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
2672 /* Show ABR/ASBR flags. */
2673 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ABR
))
2674 vty_out (vty
, " This router is an ABR, ABR type is: %s%s",
2675 ospf_abr_type_descr_str
[ospf
->abr_type
], VTY_NEWLINE
);
2677 if (CHECK_FLAG (ospf
->flags
, OSPF_FLAG_ASBR
))
2678 vty_out (vty
, " This router is an ASBR "
2679 "(injecting external routing information)%s", VTY_NEWLINE
);
2681 /* Show Number of AS-external-LSAs. */
2682 vty_out (vty
, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
2683 ospf_lsdb_count (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
),
2684 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_AS_EXTERNAL_LSA
), VTY_NEWLINE
);
2685 #ifdef HAVE_OPAQUE_LSA
2686 vty_out (vty
, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
2687 ospf_lsdb_count (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
),
2688 ospf_lsdb_checksum (ospf
->lsdb
, OSPF_OPAQUE_AS_LSA
), VTY_NEWLINE
);
2689 #endif /* HAVE_OPAQUE_LSA */
2690 /* Show number of areas attached. */
2691 vty_out (vty
, " Number of areas attached to this router: %d%s%s",
2692 listcount (ospf
->areas
), VTY_NEWLINE
, VTY_NEWLINE
);
2694 /* Show each area status. */
2695 for (ALL_LIST_ELEMENTS (ospf
->areas
, node
, nnode
, area
))
2696 show_ip_ospf_area (vty
, area
);
2703 show_ip_ospf_interface_sub (struct vty
*vty
, struct ospf
*ospf
,
2704 struct interface
*ifp
)
2707 struct ospf_neighbor
*nbr
;
2708 struct route_node
*rn
;
2710 /* Is interface up? */
2711 vty_out (vty
, "%s is %s%s", ifp
->name
,
2712 ((is_up
= if_is_operative(ifp
)) ? "up" : "down"), VTY_NEWLINE
);
2713 vty_out (vty
, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s",
2714 ifp
->ifindex
, ifp
->mtu
, ifp
->bandwidth
, if_flag_dump(ifp
->flags
),
2717 /* Is interface OSPF enabled? */
2718 if (ospf_oi_count(ifp
) == 0)
2720 vty_out (vty
, " OSPF not enabled on this interface%s", VTY_NEWLINE
);
2725 vty_out (vty
, " OSPF is enabled, but not running on this interface%s",
2730 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
2732 struct ospf_interface
*oi
= rn
->info
;
2737 /* Show OSPF interface information. */
2738 vty_out (vty
, " Internet Address %s/%d,",
2739 inet_ntoa (oi
->address
->u
.prefix4
), oi
->address
->prefixlen
);
2741 if (oi
->connected
->destination
|| oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
2743 struct in_addr
*dest
;
2746 if ((ifp
->flags
& IFF_POINTOPOINT
)
2747 || oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
2752 /* For Vlinks, showing the peer address is probably more
2753 * informative than the local interface that is being used
2755 if (oi
->type
== OSPF_IFTYPE_VIRTUALLINK
)
2756 dest
= &oi
->vl_data
->peer_addr
;
2758 dest
= &oi
->connected
->destination
->u
.prefix4
;
2760 vty_out (vty
, " %s %s,", dstr
, inet_ntoa (*dest
));
2763 vty_out (vty
, " Area %s%s", ospf_area_desc_string (oi
->area
),
2766 vty_out (vty
, " MTU mismatch detection:%s%s",
2767 OSPF_IF_PARAM(oi
, mtu_ignore
) ? "disabled" : "enabled", VTY_NEWLINE
);
2769 vty_out (vty
, " Router ID %s, Network Type %s, Cost: %d%s",
2770 inet_ntoa (ospf
->router_id
), ospf_network_type_str
[oi
->type
],
2771 oi
->output_cost
, VTY_NEWLINE
);
2773 vty_out (vty
, " Transmit Delay is %d sec, State %s, Priority %d%s",
2774 OSPF_IF_PARAM (oi
,transmit_delay
), LOOKUP (ospf_ism_state_msg
, oi
->state
),
2775 PRIORITY (oi
), VTY_NEWLINE
);
2777 /* Show DR information. */
2778 if (DR (oi
).s_addr
== 0)
2779 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2782 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &DR (oi
));
2784 vty_out (vty
, " No designated router on this network%s", VTY_NEWLINE
);
2787 vty_out (vty
, " Designated Router (ID) %s,",
2788 inet_ntoa (nbr
->router_id
));
2789 vty_out (vty
, " Interface Address %s%s",
2790 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2794 /* Show BDR information. */
2795 if (BDR (oi
).s_addr
== 0)
2796 vty_out (vty
, " No backup designated router on this network%s",
2800 nbr
= ospf_nbr_lookup_by_addr (oi
->nbrs
, &BDR (oi
));
2802 vty_out (vty
, " No backup designated router on this network%s",
2806 vty_out (vty
, " Backup Designated Router (ID) %s,",
2807 inet_ntoa (nbr
->router_id
));
2808 vty_out (vty
, " Interface Address %s%s",
2809 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
2813 vty_out (vty
, " Multicast group memberships:");
2814 if (CHECK_FLAG(oi
->multicast_memberships
, MEMBER_ALLROUTERS
))
2815 vty_out (vty
, " OSPFAllRouters");
2816 if (CHECK_FLAG(oi
->multicast_memberships
, MEMBER_DROUTERS
))
2817 vty_out (vty
, " OSPFDesignatedRouters");
2818 if (!CHECK_FLAG(oi
->multicast_memberships
,
2819 MEMBER_ALLROUTERS
|MEMBER_DROUTERS
))
2820 vty_out (vty
, " <None>");
2821 vty_out (vty
, "%s", VTY_NEWLINE
);
2823 vty_out (vty
, " Timer intervals configured,");
2824 vty_out (vty
, " Hello ");
2825 if (OSPF_IF_PARAM (oi
, fast_hello
) == 0)
2826 vty_out (vty
, "%ds,", OSPF_IF_PARAM (oi
, v_hello
));
2828 vty_out (vty
, "%dms,", 1000 / OSPF_IF_PARAM (oi
, fast_hello
));
2829 vty_out (vty
, " Dead %ds, Wait %ds, Retransmit %d%s",
2830 OSPF_IF_PARAM (oi
, v_wait
),
2831 OSPF_IF_PARAM (oi
, v_wait
),
2832 OSPF_IF_PARAM (oi
, retransmit_interval
),
2835 if (OSPF_IF_PARAM (oi
, passive_interface
) == OSPF_IF_ACTIVE
)
2837 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2838 vty_out (vty
, " Hello due in %s%s",
2839 ospf_timer_dump (oi
->t_hello
, timebuf
, sizeof(timebuf
)),
2842 else /* OSPF_IF_PASSIVE is set */
2843 vty_out (vty
, " No Hellos (Passive interface)%s", VTY_NEWLINE
);
2845 vty_out (vty
, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
2846 ospf_nbr_count (oi
, 0), ospf_nbr_count (oi
, NSM_Full
),
2851 DEFUN (show_ip_ospf_interface
,
2852 show_ip_ospf_interface_cmd
,
2853 "show ip ospf interface [INTERFACE]",
2856 "OSPF information\n"
2857 "Interface information\n"
2860 struct interface
*ifp
;
2862 struct listnode
*node
;
2864 ospf
= ospf_lookup ();
2867 vty_out (vty
, "OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2871 /* Show All Interfaces. */
2873 for (ALL_LIST_ELEMENTS_RO (iflist
, node
, ifp
))
2874 show_ip_ospf_interface_sub (vty
, ospf
, ifp
);
2875 /* Interface name is specified. */
2878 if ((ifp
= if_lookup_by_name (argv
[0])) == NULL
)
2879 vty_out (vty
, "No such interface name%s", VTY_NEWLINE
);
2881 show_ip_ospf_interface_sub (vty
, ospf
, ifp
);
2888 show_ip_ospf_neighbour_header (struct vty
*vty
)
2890 vty_out (vty
, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
2892 "Neighbor ID", "Pri", "State", "Dead Time",
2893 "Address", "Interface", "RXmtL", "RqstL", "DBsmL",
2898 show_ip_ospf_neighbor_sub (struct vty
*vty
, struct ospf_interface
*oi
)
2900 struct route_node
*rn
;
2901 struct ospf_neighbor
*nbr
;
2903 char timebuf
[OSPF_TIME_DUMP_SIZE
];
2905 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
2906 if ((nbr
= rn
->info
))
2907 /* Do not show myself. */
2908 if (nbr
!= oi
->nbr_self
)
2909 /* Down state is not shown. */
2910 if (nbr
->state
!= NSM_Down
)
2912 ospf_nbr_state_message (nbr
, msgbuf
, 16);
2914 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
2915 vty_out (vty
, "%-15s %3d %-15s ",
2919 vty_out (vty
, "%-15s %3d %-15s ",
2920 inet_ntoa (nbr
->router_id
), nbr
->priority
,
2923 vty_out (vty
, "%9s ",
2924 ospf_timer_dump (nbr
->t_inactivity
, timebuf
,
2927 vty_out (vty
, "%-15s ", inet_ntoa (nbr
->src
));
2928 vty_out (vty
, "%-20s %5ld %5ld %5d%s",
2929 IF_NAME (oi
), ospf_ls_retransmit_count (nbr
),
2930 ospf_ls_request_count (nbr
), ospf_db_summary_count (nbr
),
2935 DEFUN (show_ip_ospf_neighbor
,
2936 show_ip_ospf_neighbor_cmd
,
2937 "show ip ospf neighbor",
2940 "OSPF information\n"
2944 struct ospf_interface
*oi
;
2945 struct listnode
*node
;
2947 ospf
= ospf_lookup ();
2950 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2954 show_ip_ospf_neighbour_header (vty
);
2956 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
2957 show_ip_ospf_neighbor_sub (vty
, oi
);
2962 DEFUN (show_ip_ospf_neighbor_all
,
2963 show_ip_ospf_neighbor_all_cmd
,
2964 "show ip ospf neighbor all",
2967 "OSPF information\n"
2969 "include down status neighbor\n")
2971 struct ospf
*ospf
= vty
->index
;
2972 struct listnode
*node
;
2973 struct ospf_interface
*oi
;
2977 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
2981 show_ip_ospf_neighbour_header (vty
);
2983 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
2985 struct listnode
*nbr_node
;
2986 struct ospf_nbr_nbma
*nbr_nbma
;
2988 show_ip_ospf_neighbor_sub (vty
, oi
);
2990 /* print Down neighbor status */
2991 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nbr_node
, nbr_nbma
))
2993 if (nbr_nbma
->nbr
== NULL
2994 || nbr_nbma
->nbr
->state
== NSM_Down
)
2996 vty_out (vty
, "%-15s %3d %-15s %9s ",
2997 "-", nbr_nbma
->priority
, "Down", "-");
2998 vty_out (vty
, "%-15s %-20s %5d %5d %5d%s",
2999 inet_ntoa (nbr_nbma
->addr
), IF_NAME (oi
),
3000 0, 0, 0, VTY_NEWLINE
);
3008 DEFUN (show_ip_ospf_neighbor_int
,
3009 show_ip_ospf_neighbor_int_cmd
,
3010 "show ip ospf neighbor IFNAME",
3013 "OSPF information\n"
3018 struct interface
*ifp
;
3019 struct route_node
*rn
;
3021 ifp
= if_lookup_by_name (argv
[0]);
3024 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
3028 ospf
= ospf_lookup ();
3031 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3035 show_ip_ospf_neighbour_header (vty
);
3037 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
3039 struct ospf_interface
*oi
= rn
->info
;
3044 show_ip_ospf_neighbor_sub (vty
, oi
);
3051 show_ip_ospf_nbr_nbma_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
3052 struct ospf_nbr_nbma
*nbr_nbma
)
3054 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3056 /* Show neighbor ID. */
3057 vty_out (vty
, " Neighbor %s,", "-");
3059 /* Show interface address. */
3060 vty_out (vty
, " interface address %s%s",
3061 inet_ntoa (nbr_nbma
->addr
), VTY_NEWLINE
);
3063 vty_out (vty
, " In the area %s via interface %s%s",
3064 ospf_area_desc_string (oi
->area
), IF_NAME (oi
), VTY_NEWLINE
);
3065 /* Show neighbor priority and state. */
3066 vty_out (vty
, " Neighbor priority is %d, State is %s,",
3067 nbr_nbma
->priority
, "Down");
3068 /* Show state changes. */
3069 vty_out (vty
, " %d state changes%s", nbr_nbma
->state_change
, VTY_NEWLINE
);
3071 /* Show PollInterval */
3072 vty_out (vty
, " Poll interval %d%s", nbr_nbma
->v_poll
, VTY_NEWLINE
);
3074 /* Show poll-interval timer. */
3075 vty_out (vty
, " Poll timer due in %s%s",
3076 ospf_timer_dump (nbr_nbma
->t_poll
, timebuf
, sizeof(timebuf
)),
3079 /* Show poll-interval timer thread. */
3080 vty_out (vty
, " Thread Poll Timer %s%s",
3081 nbr_nbma
->t_poll
!= NULL
? "on" : "off", VTY_NEWLINE
);
3085 show_ip_ospf_neighbor_detail_sub (struct vty
*vty
, struct ospf_interface
*oi
,
3086 struct ospf_neighbor
*nbr
)
3088 char timebuf
[OSPF_TIME_DUMP_SIZE
];
3090 /* Show neighbor ID. */
3091 if (nbr
->state
== NSM_Attempt
&& nbr
->router_id
.s_addr
== 0)
3092 vty_out (vty
, " Neighbor %s,", "-");
3094 vty_out (vty
, " Neighbor %s,", inet_ntoa (nbr
->router_id
));
3096 /* Show interface address. */
3097 vty_out (vty
, " interface address %s%s",
3098 inet_ntoa (nbr
->address
.u
.prefix4
), VTY_NEWLINE
);
3100 vty_out (vty
, " In the area %s via interface %s%s",
3101 ospf_area_desc_string (oi
->area
), oi
->ifp
->name
, VTY_NEWLINE
);
3102 /* Show neighbor priority and state. */
3103 vty_out (vty
, " Neighbor priority is %d, State is %s,",
3104 nbr
->priority
, LOOKUP (ospf_nsm_state_msg
, nbr
->state
));
3105 /* Show state changes. */
3106 vty_out (vty
, " %d state changes%s", nbr
->state_change
, VTY_NEWLINE
);
3108 /* Show Designated Rotuer ID. */
3109 vty_out (vty
, " DR is %s,", inet_ntoa (nbr
->d_router
));
3110 /* Show Backup Designated Rotuer ID. */
3111 vty_out (vty
, " BDR is %s%s", inet_ntoa (nbr
->bd_router
), VTY_NEWLINE
);
3113 vty_out (vty
, " Options %d %s%s", nbr
->options
,
3114 ospf_options_dump (nbr
->options
), VTY_NEWLINE
);
3115 /* Show Router Dead interval timer. */
3116 vty_out (vty
, " Dead timer due in %s%s",
3117 ospf_timer_dump (nbr
->t_inactivity
, timebuf
, sizeof (timebuf
)),
3119 /* Show Database Summary list. */
3120 vty_out (vty
, " Database Summary List %d%s",
3121 ospf_db_summary_count (nbr
), VTY_NEWLINE
);
3122 /* Show Link State Request list. */
3123 vty_out (vty
, " Link State Request List %ld%s",
3124 ospf_ls_request_count (nbr
), VTY_NEWLINE
);
3125 /* Show Link State Retransmission list. */
3126 vty_out (vty
, " Link State Retransmission List %ld%s",
3127 ospf_ls_retransmit_count (nbr
), VTY_NEWLINE
);
3128 /* Show inactivity timer thread. */
3129 vty_out (vty
, " Thread Inactivity Timer %s%s",
3130 nbr
->t_inactivity
!= NULL
? "on" : "off", VTY_NEWLINE
);
3131 /* Show Database Description retransmission thread. */
3132 vty_out (vty
, " Thread Database Description Retransmision %s%s",
3133 nbr
->t_db_desc
!= NULL
? "on" : "off", VTY_NEWLINE
);
3134 /* Show Link State Request Retransmission thread. */
3135 vty_out (vty
, " Thread Link State Request Retransmission %s%s",
3136 nbr
->t_ls_req
!= NULL
? "on" : "off", VTY_NEWLINE
);
3137 /* Show Link State Update Retransmission thread. */
3138 vty_out (vty
, " Thread Link State Update Retransmission %s%s%s",
3139 nbr
->t_ls_upd
!= NULL
? "on" : "off", VTY_NEWLINE
, VTY_NEWLINE
);
3142 DEFUN (show_ip_ospf_neighbor_id
,
3143 show_ip_ospf_neighbor_id_cmd
,
3144 "show ip ospf neighbor A.B.C.D",
3147 "OSPF information\n"
3152 struct listnode
*node
;
3153 struct ospf_neighbor
*nbr
;
3154 struct ospf_interface
*oi
;
3155 struct in_addr router_id
;
3158 ret
= inet_aton (argv
[0], &router_id
);
3161 vty_out (vty
, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE
);
3165 ospf
= ospf_lookup ();
3168 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3172 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3173 if ((nbr
= ospf_nbr_lookup_by_routerid (oi
->nbrs
, &router_id
)))
3175 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3179 /* Nothing to show. */
3183 DEFUN (show_ip_ospf_neighbor_detail
,
3184 show_ip_ospf_neighbor_detail_cmd
,
3185 "show ip ospf neighbor detail",
3188 "OSPF information\n"
3190 "detail of all neighbors\n")
3193 struct ospf_interface
*oi
;
3194 struct listnode
*node
;
3196 ospf
= ospf_lookup ();
3199 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3203 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3205 struct route_node
*rn
;
3206 struct ospf_neighbor
*nbr
;
3208 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3209 if ((nbr
= rn
->info
))
3210 if (nbr
!= oi
->nbr_self
)
3211 if (nbr
->state
!= NSM_Down
)
3212 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3218 DEFUN (show_ip_ospf_neighbor_detail_all
,
3219 show_ip_ospf_neighbor_detail_all_cmd
,
3220 "show ip ospf neighbor detail all",
3223 "OSPF information\n"
3225 "detail of all neighbors\n"
3226 "include down status neighbor\n")
3229 struct listnode
*node
;
3230 struct ospf_interface
*oi
;
3232 ospf
= ospf_lookup ();
3235 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3239 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
3241 struct route_node
*rn
;
3242 struct ospf_neighbor
*nbr
;
3243 struct ospf_nbr_nbma
*nbr_nbma
;
3245 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
3246 if ((nbr
= rn
->info
))
3247 if (nbr
!= oi
->nbr_self
)
3248 if (oi
->type
== OSPF_IFTYPE_NBMA
&& nbr
->state
!= NSM_Down
)
3249 show_ip_ospf_neighbor_detail_sub (vty
, oi
, rn
->info
);
3251 if (oi
->type
== OSPF_IFTYPE_NBMA
)
3253 struct listnode
*nd
;
3255 for (ALL_LIST_ELEMENTS_RO (oi
->nbr_nbma
, nd
, nbr_nbma
))
3256 if (nbr_nbma
->nbr
== NULL
3257 || nbr_nbma
->nbr
->state
== NSM_Down
)
3258 show_ip_ospf_nbr_nbma_detail_sub (vty
, oi
, nbr_nbma
);
3265 DEFUN (show_ip_ospf_neighbor_int_detail
,
3266 show_ip_ospf_neighbor_int_detail_cmd
,
3267 "show ip ospf neighbor IFNAME detail",
3270 "OSPF information\n"
3273 "detail of all neighbors")
3276 struct ospf_interface
*oi
;
3277 struct interface
*ifp
;
3278 struct route_node
*rn
, *nrn
;
3279 struct ospf_neighbor
*nbr
;
3281 ifp
= if_lookup_by_name (argv
[0]);
3284 vty_out (vty
, "No such interface.%s", VTY_NEWLINE
);
3288 ospf
= ospf_lookup ();
3291 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3296 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
3297 if ((oi
= rn
->info
))
3298 for (nrn
= route_top (oi
->nbrs
); nrn
; nrn
= route_next (nrn
))
3299 if ((nbr
= nrn
->info
))
3300 if (nbr
!= oi
->nbr_self
)
3301 if (nbr
->state
!= NSM_Down
)
3302 show_ip_ospf_neighbor_detail_sub (vty
, oi
, nbr
);
3308 /* Show functions */
3310 show_lsa_summary (struct vty
*vty
, struct ospf_lsa
*lsa
, int self
)
3312 struct router_lsa
*rl
;
3313 struct summary_lsa
*sl
;
3314 struct as_external_lsa
*asel
;
3315 struct prefix_ipv4 p
;
3318 /* If self option is set, check LSA self flag. */
3319 if (self
== 0 || IS_LSA_SELF (lsa
))
3321 /* LSA common part show. */
3322 vty_out (vty
, "%-15s ", inet_ntoa (lsa
->data
->id
));
3323 vty_out (vty
, "%-15s %4d 0x%08lx 0x%04x",
3324 inet_ntoa (lsa
->data
->adv_router
), LS_AGE (lsa
),
3325 (u_long
)ntohl (lsa
->data
->ls_seqnum
), ntohs (lsa
->data
->checksum
));
3326 /* LSA specific part show. */
3327 switch (lsa
->data
->type
)
3329 case OSPF_ROUTER_LSA
:
3330 rl
= (struct router_lsa
*) lsa
->data
;
3331 vty_out (vty
, " %-d", ntohs (rl
->links
));
3333 case OSPF_SUMMARY_LSA
:
3334 sl
= (struct summary_lsa
*) lsa
->data
;
3337 p
.prefix
= sl
->header
.id
;
3338 p
.prefixlen
= ip_masklen (sl
->mask
);
3339 apply_mask_ipv4 (&p
);
3341 vty_out (vty
, " %s/%d", inet_ntoa (p
.prefix
), p
.prefixlen
);
3343 case OSPF_AS_EXTERNAL_LSA
:
3344 case OSPF_AS_NSSA_LSA
:
3345 asel
= (struct as_external_lsa
*) lsa
->data
;
3348 p
.prefix
= asel
->header
.id
;
3349 p
.prefixlen
= ip_masklen (asel
->mask
);
3350 apply_mask_ipv4 (&p
);
3352 vty_out (vty
, " %s %s/%d [0x%lx]",
3353 IS_EXTERNAL_METRIC (asel
->e
[0].tos
) ? "E2" : "E1",
3354 inet_ntoa (p
.prefix
), p
.prefixlen
,
3355 (u_long
)ntohl (asel
->e
[0].route_tag
));
3357 case OSPF_NETWORK_LSA
:
3358 case OSPF_ASBR_SUMMARY_LSA
:
3359 #ifdef HAVE_OPAQUE_LSA
3360 case OSPF_OPAQUE_LINK_LSA
:
3361 case OSPF_OPAQUE_AREA_LSA
:
3362 case OSPF_OPAQUE_AS_LSA
:
3363 #endif /* HAVE_OPAQUE_LSA */
3367 vty_out (vty
, VTY_NEWLINE
);
3373 const char *show_database_desc
[] =
3376 "Router Link States",
3378 "Summary Link States",
3379 "ASBR-Summary Link States",
3380 "AS External Link States",
3381 "Group Membership LSA",
3382 "NSSA-external Link States",
3383 #ifdef HAVE_OPAQUE_LSA
3385 "Link-Local Opaque-LSA",
3386 "Area-Local Opaque-LSA",
3387 "AS-external Opaque-LSA",
3388 #endif /* HAVE_OPAQUE_LSA */
3391 #define SHOW_OSPF_COMMON_HEADER \
3392 "Link ID ADV Router Age Seq# CkSum"
3394 const char *show_database_header
[] =
3397 "Link ID ADV Router Age Seq# CkSum Link count",
3398 "Link ID ADV Router Age Seq# CkSum",
3399 "Link ID ADV Router Age Seq# CkSum Route",
3400 "Link ID ADV Router Age Seq# CkSum",
3401 "Link ID ADV Router Age Seq# CkSum Route",
3402 " --- header for Group Member ----",
3403 "Link ID ADV Router Age Seq# CkSum Route",
3404 #ifdef HAVE_OPAQUE_LSA
3406 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3407 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3408 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3409 #endif /* HAVE_OPAQUE_LSA */
3412 const char *show_lsa_flags
[] =
3423 show_ip_ospf_database_header (struct vty
*vty
, struct ospf_lsa
*lsa
)
3425 struct router_lsa
*rlsa
= (struct router_lsa
*) lsa
->data
;
3427 vty_out (vty
, " LS age: %d%s", LS_AGE (lsa
), VTY_NEWLINE
);
3428 vty_out (vty
, " Options: 0x%-2x : %s%s",
3430 ospf_options_dump(lsa
->data
->options
),
3432 vty_out (vty
, " LS Flags: 0x%-2x %s%s",
3434 ((lsa
->flags
& OSPF_LSA_LOCAL_XLT
) ? "(Translated from Type-7)" : ""),
3437 if (lsa
->data
->type
== OSPF_ROUTER_LSA
)
3439 vty_out (vty
, " Flags: 0x%x" , rlsa
->flags
);
3442 vty_out (vty
, " :%s%s%s%s",
3443 IS_ROUTER_LSA_BORDER (rlsa
) ? " ABR" : "",
3444 IS_ROUTER_LSA_EXTERNAL (rlsa
) ? " ASBR" : "",
3445 IS_ROUTER_LSA_VIRTUAL (rlsa
) ? " VL-endpoint" : "",
3446 IS_ROUTER_LSA_SHORTCUT (rlsa
) ? " Shortcut" : "");
3448 vty_out (vty
, "%s", VTY_NEWLINE
);
3450 vty_out (vty
, " LS Type: %s%s",
3451 LOOKUP (ospf_lsa_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3452 vty_out (vty
, " Link State ID: %s %s%s", inet_ntoa (lsa
->data
->id
),
3453 LOOKUP (ospf_link_state_id_type_msg
, lsa
->data
->type
), VTY_NEWLINE
);
3454 vty_out (vty
, " Advertising Router: %s%s",
3455 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3456 vty_out (vty
, " LS Seq Number: %08lx%s", (u_long
)ntohl (lsa
->data
->ls_seqnum
),
3458 vty_out (vty
, " Checksum: 0x%04x%s", ntohs (lsa
->data
->checksum
),
3460 vty_out (vty
, " Length: %d%s", ntohs (lsa
->data
->length
), VTY_NEWLINE
);
3463 const char *link_type_desc
[] =
3466 "another Router (point-to-point)",
3467 "a Transit Network",
3472 const char *link_id_desc
[] =
3475 "Neighboring Router ID",
3476 "Designated Router address",
3478 "Neighboring Router ID",
3481 const char *link_data_desc
[] =
3484 "Router Interface address",
3485 "Router Interface address",
3487 "Router Interface address",
3490 /* Show router-LSA each Link information. */
3492 show_ip_ospf_database_router_links (struct vty
*vty
,
3493 struct router_lsa
*rl
)
3497 len
= ntohs (rl
->header
.length
) - 4;
3498 for (i
= 0; i
< ntohs (rl
->links
) && len
> 0; len
-= 12, i
++)
3500 type
= rl
->link
[i
].type
;
3502 vty_out (vty
, " Link connected to: %s%s",
3503 link_type_desc
[type
], VTY_NEWLINE
);
3504 vty_out (vty
, " (Link ID) %s: %s%s", link_id_desc
[type
],
3505 inet_ntoa (rl
->link
[i
].link_id
), VTY_NEWLINE
);
3506 vty_out (vty
, " (Link Data) %s: %s%s", link_data_desc
[type
],
3507 inet_ntoa (rl
->link
[i
].link_data
), VTY_NEWLINE
);
3508 vty_out (vty
, " Number of TOS metrics: 0%s", VTY_NEWLINE
);
3509 vty_out (vty
, " TOS 0 Metric: %d%s",
3510 ntohs (rl
->link
[i
].metric
), VTY_NEWLINE
);
3511 vty_out (vty
, "%s", VTY_NEWLINE
);
3515 /* Show router-LSA detail information. */
3517 show_router_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3521 struct router_lsa
*rl
= (struct router_lsa
*) lsa
->data
;
3523 show_ip_ospf_database_header (vty
, lsa
);
3525 vty_out (vty
, " Number of Links: %d%s%s", ntohs (rl
->links
),
3526 VTY_NEWLINE
, VTY_NEWLINE
);
3528 show_ip_ospf_database_router_links (vty
, rl
);
3529 vty_out (vty
, "%s", VTY_NEWLINE
);
3535 /* Show network-LSA detail information. */
3537 show_network_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3543 struct network_lsa
*nl
= (struct network_lsa
*) lsa
->data
;
3545 show_ip_ospf_database_header (vty
, lsa
);
3547 vty_out (vty
, " Network Mask: /%d%s",
3548 ip_masklen (nl
->mask
), VTY_NEWLINE
);
3550 length
= ntohs (lsa
->data
->length
) - OSPF_LSA_HEADER_SIZE
- 4;
3552 for (i
= 0; length
> 0; i
++, length
-= 4)
3553 vty_out (vty
, " Attached Router: %s%s",
3554 inet_ntoa (nl
->routers
[i
]), VTY_NEWLINE
);
3556 vty_out (vty
, "%s", VTY_NEWLINE
);
3562 /* Show summary-LSA detail information. */
3564 show_summary_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3568 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3570 show_ip_ospf_database_header (vty
, lsa
);
3572 vty_out (vty
, " Network Mask: /%d%s", ip_masklen (sl
->mask
),
3574 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3576 vty_out (vty
, "%s", VTY_NEWLINE
);
3582 /* Show summary-ASBR-LSA detail information. */
3584 show_summary_asbr_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3588 struct summary_lsa
*sl
= (struct summary_lsa
*) lsa
->data
;
3590 show_ip_ospf_database_header (vty
, lsa
);
3592 vty_out (vty
, " Network Mask: /%d%s",
3593 ip_masklen (sl
->mask
), VTY_NEWLINE
);
3594 vty_out (vty
, " TOS: 0 Metric: %d%s", GET_METRIC (sl
->metric
),
3596 vty_out (vty
, "%s", VTY_NEWLINE
);
3602 /* Show AS-external-LSA detail information. */
3604 show_as_external_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3608 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3610 show_ip_ospf_database_header (vty
, lsa
);
3612 vty_out (vty
, " Network Mask: /%d%s",
3613 ip_masklen (al
->mask
), VTY_NEWLINE
);
3614 vty_out (vty
, " Metric Type: %s%s",
3615 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3616 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3617 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3618 vty_out (vty
, " Metric: %d%s",
3619 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3620 vty_out (vty
, " Forward Address: %s%s",
3621 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3623 vty_out (vty
, " External Route Tag: %lu%s%s",
3624 (u_long
)ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3630 /* N.B. This function currently seems to be unused. */
3632 show_as_external_lsa_stdvty (struct ospf_lsa
*lsa
)
3634 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3636 /* show_ip_ospf_database_header (vty, lsa); */
3638 zlog_debug( " Network Mask: /%d%s",
3639 ip_masklen (al
->mask
), "\n");
3640 zlog_debug( " Metric Type: %s%s",
3641 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3642 "2 (Larger than any link state path)" : "1", "\n");
3643 zlog_debug( " TOS: 0%s", "\n");
3644 zlog_debug( " Metric: %d%s",
3645 GET_METRIC (al
->e
[0].metric
), "\n");
3646 zlog_debug( " Forward Address: %s%s",
3647 inet_ntoa (al
->e
[0].fwd_addr
), "\n");
3649 zlog_debug( " External Route Tag: %u%s%s",
3650 ntohl (al
->e
[0].route_tag
), "\n", "\n");
3655 /* Show AS-NSSA-LSA detail information. */
3657 show_as_nssa_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3661 struct as_external_lsa
*al
= (struct as_external_lsa
*) lsa
->data
;
3663 show_ip_ospf_database_header (vty
, lsa
);
3665 vty_out (vty
, " Network Mask: /%d%s",
3666 ip_masklen (al
->mask
), VTY_NEWLINE
);
3667 vty_out (vty
, " Metric Type: %s%s",
3668 IS_EXTERNAL_METRIC (al
->e
[0].tos
) ?
3669 "2 (Larger than any link state path)" : "1", VTY_NEWLINE
);
3670 vty_out (vty
, " TOS: 0%s", VTY_NEWLINE
);
3671 vty_out (vty
, " Metric: %d%s",
3672 GET_METRIC (al
->e
[0].metric
), VTY_NEWLINE
);
3673 vty_out (vty
, " NSSA: Forward Address: %s%s",
3674 inet_ntoa (al
->e
[0].fwd_addr
), VTY_NEWLINE
);
3676 vty_out (vty
, " External Route Tag: %u%s%s",
3677 ntohl (al
->e
[0].route_tag
), VTY_NEWLINE
, VTY_NEWLINE
);
3684 show_func_dummy (struct vty
*vty
, struct ospf_lsa
*lsa
)
3689 #ifdef HAVE_OPAQUE_LSA
3691 show_opaque_lsa_detail (struct vty
*vty
, struct ospf_lsa
*lsa
)
3695 show_ip_ospf_database_header (vty
, lsa
);
3696 show_opaque_info_detail (vty
, lsa
);
3698 vty_out (vty
, "%s", VTY_NEWLINE
);
3702 #endif /* HAVE_OPAQUE_LSA */
3704 int (*show_function
[])(struct vty
*, struct ospf_lsa
*) =
3707 show_router_lsa_detail
,
3708 show_network_lsa_detail
,
3709 show_summary_lsa_detail
,
3710 show_summary_asbr_lsa_detail
,
3711 show_as_external_lsa_detail
,
3713 show_as_nssa_lsa_detail
, /* almost same as external */
3714 #ifdef HAVE_OPAQUE_LSA
3716 show_opaque_lsa_detail
,
3717 show_opaque_lsa_detail
,
3718 show_opaque_lsa_detail
,
3719 #endif /* HAVE_OPAQUE_LSA */
3723 show_lsa_prefix_set (struct vty
*vty
, struct prefix_ls
*lp
, struct in_addr
*id
,
3724 struct in_addr
*adv_router
)
3726 memset (lp
, 0, sizeof (struct prefix_ls
));
3730 else if (adv_router
== NULL
)
3739 lp
->adv_router
= *adv_router
;
3744 show_lsa_detail_proc (struct vty
*vty
, struct route_table
*rt
,
3745 struct in_addr
*id
, struct in_addr
*adv_router
)
3747 struct prefix_ls lp
;
3748 struct route_node
*rn
, *start
;
3749 struct ospf_lsa
*lsa
;
3751 show_lsa_prefix_set (vty
, &lp
, id
, adv_router
);
3752 start
= route_node_get (rt
, (struct prefix
*) &lp
);
3755 route_lock_node (start
);
3756 for (rn
= start
; rn
; rn
= route_next_until (rn
, start
))
3757 if ((lsa
= rn
->info
))
3759 if (show_function
[lsa
->data
->type
] != NULL
)
3760 show_function
[lsa
->data
->type
] (vty
, lsa
);
3762 route_unlock_node (start
);
3766 /* Show detail LSA information
3767 -- if id is NULL then show all LSAs. */
3769 show_lsa_detail (struct vty
*vty
, struct ospf
*ospf
, int type
,
3770 struct in_addr
*id
, struct in_addr
*adv_router
)
3772 struct listnode
*node
;
3773 struct ospf_area
*area
;
3777 case OSPF_AS_EXTERNAL_LSA
:
3778 #ifdef HAVE_OPAQUE_LSA
3779 case OSPF_OPAQUE_AS_LSA
:
3780 #endif /* HAVE_OPAQUE_LSA */
3781 vty_out (vty
, " %s %s%s",
3782 show_database_desc
[type
],
3783 VTY_NEWLINE
, VTY_NEWLINE
);
3784 show_lsa_detail_proc (vty
, AS_LSDB (ospf
, type
), id
, adv_router
);
3787 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
3789 vty_out (vty
, "%s %s (Area %s)%s%s",
3790 VTY_NEWLINE
, show_database_desc
[type
],
3791 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3792 show_lsa_detail_proc (vty
, AREA_LSDB (area
, type
), id
, adv_router
);
3799 show_lsa_detail_adv_router_proc (struct vty
*vty
, struct route_table
*rt
,
3800 struct in_addr
*adv_router
)
3802 struct route_node
*rn
;
3803 struct ospf_lsa
*lsa
;
3805 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
3806 if ((lsa
= rn
->info
))
3807 if (IPV4_ADDR_SAME (adv_router
, &lsa
->data
->adv_router
))
3809 if (CHECK_FLAG (lsa
->flags
, OSPF_LSA_LOCAL_XLT
))
3811 if (show_function
[lsa
->data
->type
] != NULL
)
3812 show_function
[lsa
->data
->type
] (vty
, lsa
);
3816 /* Show detail LSA information. */
3818 show_lsa_detail_adv_router (struct vty
*vty
, struct ospf
*ospf
, int type
,
3819 struct in_addr
*adv_router
)
3821 struct listnode
*node
;
3822 struct ospf_area
*area
;
3826 case OSPF_AS_EXTERNAL_LSA
:
3827 #ifdef HAVE_OPAQUE_LSA
3828 case OSPF_OPAQUE_AS_LSA
:
3829 #endif /* HAVE_OPAQUE_LSA */
3830 vty_out (vty
, " %s %s%s",
3831 show_database_desc
[type
],
3832 VTY_NEWLINE
, VTY_NEWLINE
);
3833 show_lsa_detail_adv_router_proc (vty
, AS_LSDB (ospf
, type
),
3837 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
3839 vty_out (vty
, "%s %s (Area %s)%s%s",
3840 VTY_NEWLINE
, show_database_desc
[type
],
3841 ospf_area_desc_string (area
), VTY_NEWLINE
, VTY_NEWLINE
);
3842 show_lsa_detail_adv_router_proc (vty
, AREA_LSDB (area
, type
),
3850 show_ip_ospf_database_summary (struct vty
*vty
, struct ospf
*ospf
, int self
)
3852 struct ospf_lsa
*lsa
;
3853 struct route_node
*rn
;
3854 struct ospf_area
*area
;
3855 struct listnode
*node
;
3858 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
3860 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3864 case OSPF_AS_EXTERNAL_LSA
:
3865 #ifdef HAVE_OPAQUE_LSA
3866 case OSPF_OPAQUE_AS_LSA
:
3867 #endif /* HAVE_OPAQUE_LSA */
3872 if (ospf_lsdb_count_self (area
->lsdb
, type
) > 0 ||
3873 (!self
&& ospf_lsdb_count (area
->lsdb
, type
) > 0))
3875 vty_out (vty
, " %s (Area %s)%s%s",
3876 show_database_desc
[type
],
3877 ospf_area_desc_string (area
),
3878 VTY_NEWLINE
, VTY_NEWLINE
);
3879 vty_out (vty
, "%s%s", show_database_header
[type
], VTY_NEWLINE
);
3881 LSDB_LOOP (AREA_LSDB (area
, type
), rn
, lsa
)
3882 show_lsa_summary (vty
, lsa
, self
);
3884 vty_out (vty
, "%s", VTY_NEWLINE
);
3889 for (type
= OSPF_MIN_LSA
; type
< OSPF_MAX_LSA
; type
++)
3893 case OSPF_AS_EXTERNAL_LSA
:
3894 #ifdef HAVE_OPAQUE_LSA
3895 case OSPF_OPAQUE_AS_LSA
:
3896 #endif /* HAVE_OPAQUE_LSA */
3901 if (ospf_lsdb_count_self (ospf
->lsdb
, type
) ||
3902 (!self
&& ospf_lsdb_count (ospf
->lsdb
, type
)))
3904 vty_out (vty
, " %s%s%s",
3905 show_database_desc
[type
],
3906 VTY_NEWLINE
, VTY_NEWLINE
);
3907 vty_out (vty
, "%s%s", show_database_header
[type
],
3910 LSDB_LOOP (AS_LSDB (ospf
, type
), rn
, lsa
)
3911 show_lsa_summary (vty
, lsa
, self
);
3913 vty_out (vty
, "%s", VTY_NEWLINE
);
3917 vty_out (vty
, "%s", VTY_NEWLINE
);
3921 show_ip_ospf_database_maxage (struct vty
*vty
, struct ospf
*ospf
)
3923 struct listnode
*node
;
3924 struct ospf_lsa
*lsa
;
3926 vty_out (vty
, "%s MaxAge Link States:%s%s",
3927 VTY_NEWLINE
, VTY_NEWLINE
, VTY_NEWLINE
);
3929 for (ALL_LIST_ELEMENTS_RO (ospf
->maxage_lsa
, node
, lsa
))
3931 vty_out (vty
, "Link type: %d%s", lsa
->data
->type
, VTY_NEWLINE
);
3932 vty_out (vty
, "Link State ID: %s%s",
3933 inet_ntoa (lsa
->data
->id
), VTY_NEWLINE
);
3934 vty_out (vty
, "Advertising Router: %s%s",
3935 inet_ntoa (lsa
->data
->adv_router
), VTY_NEWLINE
);
3936 vty_out (vty
, "LSA lock count: %d%s", lsa
->lock
, VTY_NEWLINE
);
3937 vty_out (vty
, "%s", VTY_NEWLINE
);
3941 #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3942 #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3944 #ifdef HAVE_OPAQUE_LSA
3945 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3946 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3947 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3948 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3949 #else /* HAVE_OPAQUE_LSA */
3950 #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3951 #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3952 #define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3953 #define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3954 #endif /* HAVE_OPAQUE_LSA */
3956 #define OSPF_LSA_TYPES_CMD_STR \
3957 "asbr-summary|external|network|router|summary" \
3958 OSPF_LSA_TYPE_NSSA_CMD_STR \
3959 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3961 #define OSPF_LSA_TYPES_DESC \
3962 "ASBR summary link states\n" \
3963 "External link states\n" \
3964 "Network link states\n" \
3965 "Router link states\n" \
3966 "Network summary link states\n" \
3967 OSPF_LSA_TYPE_NSSA_DESC \
3968 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3969 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3970 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3972 DEFUN (show_ip_ospf_database
,
3973 show_ip_ospf_database_cmd
,
3974 "show ip ospf database",
3977 "OSPF information\n"
3978 "Database summary\n")
3982 struct in_addr id
, adv_router
;
3984 ospf
= ospf_lookup ();
3987 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
3991 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
3992 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
3997 show_ip_ospf_database_summary (vty
, ospf
, 0);
4001 /* Set database type to show. */
4002 if (strncmp (argv
[0], "r", 1) == 0)
4003 type
= OSPF_ROUTER_LSA
;
4004 else if (strncmp (argv
[0], "ne", 2) == 0)
4005 type
= OSPF_NETWORK_LSA
;
4006 else if (strncmp (argv
[0], "ns", 2) == 0)
4007 type
= OSPF_AS_NSSA_LSA
;
4008 else if (strncmp (argv
[0], "su", 2) == 0)
4009 type
= OSPF_SUMMARY_LSA
;
4010 else if (strncmp (argv
[0], "a", 1) == 0)
4011 type
= OSPF_ASBR_SUMMARY_LSA
;
4012 else if (strncmp (argv
[0], "e", 1) == 0)
4013 type
= OSPF_AS_EXTERNAL_LSA
;
4014 else if (strncmp (argv
[0], "se", 2) == 0)
4016 show_ip_ospf_database_summary (vty
, ospf
, 1);
4019 else if (strncmp (argv
[0], "m", 1) == 0)
4021 show_ip_ospf_database_maxage (vty
, ospf
);
4024 #ifdef HAVE_OPAQUE_LSA
4025 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
4026 type
= OSPF_OPAQUE_LINK_LSA
;
4027 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
4028 type
= OSPF_OPAQUE_AREA_LSA
;
4029 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
4030 type
= OSPF_OPAQUE_AS_LSA
;
4031 #endif /* HAVE_OPAQUE_LSA */
4035 /* `show ip ospf database LSA'. */
4037 show_lsa_detail (vty
, ospf
, type
, NULL
, NULL
);
4040 ret
= inet_aton (argv
[1], &id
);
4044 /* `show ip ospf database LSA ID'. */
4046 show_lsa_detail (vty
, ospf
, type
, &id
, NULL
);
4047 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
4050 if (strncmp (argv
[2], "s", 1) == 0)
4051 adv_router
= ospf
->router_id
;
4054 ret
= inet_aton (argv
[2], &adv_router
);
4058 show_lsa_detail (vty
, ospf
, type
, &id
, &adv_router
);
4065 ALIAS (show_ip_ospf_database
,
4066 show_ip_ospf_database_type_cmd
,
4067 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
"|max-age|self-originate)",
4070 "OSPF information\n"
4071 "Database summary\n"
4073 "LSAs in MaxAge list\n"
4074 "Self-originated link states\n")
4076 ALIAS (show_ip_ospf_database
,
4077 show_ip_ospf_database_type_id_cmd
,
4078 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D",
4081 "OSPF information\n"
4082 "Database summary\n"
4084 "Link State ID (as an IP address)\n")
4086 ALIAS (show_ip_ospf_database
,
4087 show_ip_ospf_database_type_id_adv_router_cmd
,
4088 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D adv-router A.B.C.D",
4091 "OSPF information\n"
4092 "Database summary\n"
4094 "Link State ID (as an IP address)\n"
4095 "Advertising Router link states\n"
4096 "Advertising Router (as an IP address)\n")
4098 ALIAS (show_ip_ospf_database
,
4099 show_ip_ospf_database_type_id_self_cmd
,
4100 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") A.B.C.D (self-originate|)",
4103 "OSPF information\n"
4104 "Database summary\n"
4106 "Link State ID (as an IP address)\n"
4107 "Self-originated link states\n"
4110 DEFUN (show_ip_ospf_database_type_adv_router
,
4111 show_ip_ospf_database_type_adv_router_cmd
,
4112 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") adv-router A.B.C.D",
4115 "OSPF information\n"
4116 "Database summary\n"
4118 "Advertising Router link states\n"
4119 "Advertising Router (as an IP address)\n")
4123 struct in_addr adv_router
;
4125 ospf
= ospf_lookup ();
4128 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
4132 vty_out (vty
, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE
,
4133 inet_ntoa (ospf
->router_id
), VTY_NEWLINE
, VTY_NEWLINE
);
4138 /* Set database type to show. */
4139 if (strncmp (argv
[0], "r", 1) == 0)
4140 type
= OSPF_ROUTER_LSA
;
4141 else if (strncmp (argv
[0], "ne", 2) == 0)
4142 type
= OSPF_NETWORK_LSA
;
4143 else if (strncmp (argv
[0], "ns", 2) == 0)
4144 type
= OSPF_AS_NSSA_LSA
;
4145 else if (strncmp (argv
[0], "s", 1) == 0)
4146 type
= OSPF_SUMMARY_LSA
;
4147 else if (strncmp (argv
[0], "a", 1) == 0)
4148 type
= OSPF_ASBR_SUMMARY_LSA
;
4149 else if (strncmp (argv
[0], "e", 1) == 0)
4150 type
= OSPF_AS_EXTERNAL_LSA
;
4151 #ifdef HAVE_OPAQUE_LSA
4152 else if (strncmp (argv
[0], "opaque-l", 8) == 0)
4153 type
= OSPF_OPAQUE_LINK_LSA
;
4154 else if (strncmp (argv
[0], "opaque-ar", 9) == 0)
4155 type
= OSPF_OPAQUE_AREA_LSA
;
4156 else if (strncmp (argv
[0], "opaque-as", 9) == 0)
4157 type
= OSPF_OPAQUE_AS_LSA
;
4158 #endif /* HAVE_OPAQUE_LSA */
4162 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
4163 if (strncmp (argv
[1], "s", 1) == 0)
4164 adv_router
= ospf
->router_id
;
4167 ret
= inet_aton (argv
[1], &adv_router
);
4172 show_lsa_detail_adv_router (vty
, ospf
, type
, &adv_router
);
4177 ALIAS (show_ip_ospf_database_type_adv_router
,
4178 show_ip_ospf_database_type_self_cmd
,
4179 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR
") (self-originate|)",
4182 "OSPF information\n"
4183 "Database summary\n"
4185 "Self-originated link states\n")
4188 DEFUN (ip_ospf_authentication_args
,
4189 ip_ospf_authentication_args_addr_cmd
,
4190 "ip ospf authentication (null|message-digest) A.B.C.D",
4192 "OSPF interface commands\n"
4193 "Enable authentication on this interface\n"
4194 "Use null authentication\n"
4195 "Use message-digest authentication\n"
4196 "Address of interface")
4198 struct interface
*ifp
;
4199 struct in_addr addr
;
4201 struct ospf_if_params
*params
;
4204 params
= IF_DEF_PARAMS (ifp
);
4208 ret
= inet_aton(argv
[1], &addr
);
4211 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4216 params
= ospf_get_if_params (ifp
, addr
);
4217 ospf_if_update_params (ifp
, addr
);
4220 /* Handle null authentication */
4221 if ( argv
[0][0] == 'n' )
4223 SET_IF_PARAM (params
, auth_type
);
4224 params
->auth_type
= OSPF_AUTH_NULL
;
4228 /* Handle message-digest authentication */
4229 if ( argv
[0][0] == 'm' )
4231 SET_IF_PARAM (params
, auth_type
);
4232 params
->auth_type
= OSPF_AUTH_CRYPTOGRAPHIC
;
4236 vty_out (vty
, "You shouldn't get here!%s", VTY_NEWLINE
);
4240 ALIAS (ip_ospf_authentication_args
,
4241 ip_ospf_authentication_args_cmd
,
4242 "ip ospf authentication (null|message-digest)",
4244 "OSPF interface commands\n"
4245 "Enable authentication on this interface\n"
4246 "Use null authentication\n"
4247 "Use message-digest authentication\n")
4249 DEFUN (ip_ospf_authentication
,
4250 ip_ospf_authentication_addr_cmd
,
4251 "ip ospf authentication A.B.C.D",
4253 "OSPF interface commands\n"
4254 "Enable authentication on this interface\n"
4255 "Address of interface")
4257 struct interface
*ifp
;
4258 struct in_addr addr
;
4260 struct ospf_if_params
*params
;
4263 params
= IF_DEF_PARAMS (ifp
);
4267 ret
= inet_aton(argv
[1], &addr
);
4270 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4275 params
= ospf_get_if_params (ifp
, addr
);
4276 ospf_if_update_params (ifp
, addr
);
4279 SET_IF_PARAM (params
, auth_type
);
4280 params
->auth_type
= OSPF_AUTH_SIMPLE
;
4285 ALIAS (ip_ospf_authentication
,
4286 ip_ospf_authentication_cmd
,
4287 "ip ospf authentication",
4289 "OSPF interface commands\n"
4290 "Enable authentication on this interface\n")
4292 DEFUN (no_ip_ospf_authentication
,
4293 no_ip_ospf_authentication_addr_cmd
,
4294 "no ip ospf authentication A.B.C.D",
4297 "OSPF interface commands\n"
4298 "Enable authentication on this interface\n"
4299 "Address of interface")
4301 struct interface
*ifp
;
4302 struct in_addr addr
;
4304 struct ospf_if_params
*params
;
4307 params
= IF_DEF_PARAMS (ifp
);
4311 ret
= inet_aton(argv
[1], &addr
);
4314 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4319 params
= ospf_lookup_if_params (ifp
, addr
);
4324 params
->auth_type
= OSPF_AUTH_NOTSET
;
4325 UNSET_IF_PARAM (params
, auth_type
);
4327 if (params
!= IF_DEF_PARAMS (ifp
))
4329 ospf_free_if_params (ifp
, addr
);
4330 ospf_if_update_params (ifp
, addr
);
4336 ALIAS (no_ip_ospf_authentication
,
4337 no_ip_ospf_authentication_cmd
,
4338 "no ip ospf authentication",
4341 "OSPF interface commands\n"
4342 "Enable authentication on this interface\n")
4344 DEFUN (ip_ospf_authentication_key
,
4345 ip_ospf_authentication_key_addr_cmd
,
4346 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4348 "OSPF interface commands\n"
4349 "Authentication password (key)\n"
4350 "The OSPF password (key)\n"
4351 "Address of interface")
4353 struct interface
*ifp
;
4354 struct in_addr addr
;
4356 struct ospf_if_params
*params
;
4359 params
= IF_DEF_PARAMS (ifp
);
4363 ret
= inet_aton(argv
[1], &addr
);
4366 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4371 params
= ospf_get_if_params (ifp
, addr
);
4372 ospf_if_update_params (ifp
, addr
);
4376 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
+ 1);
4377 strncpy ((char *) params
->auth_simple
, argv
[0], OSPF_AUTH_SIMPLE_SIZE
);
4378 SET_IF_PARAM (params
, auth_simple
);
4383 ALIAS (ip_ospf_authentication_key
,
4384 ip_ospf_authentication_key_cmd
,
4385 "ip ospf authentication-key AUTH_KEY",
4387 "OSPF interface commands\n"
4388 "Authentication password (key)\n"
4389 "The OSPF password (key)")
4391 ALIAS (ip_ospf_authentication_key
,
4392 ospf_authentication_key_cmd
,
4393 "ospf authentication-key AUTH_KEY",
4394 "OSPF interface commands\n"
4395 "Authentication password (key)\n"
4396 "The OSPF password (key)")
4398 DEFUN (no_ip_ospf_authentication_key
,
4399 no_ip_ospf_authentication_key_addr_cmd
,
4400 "no ip ospf authentication-key A.B.C.D",
4403 "OSPF interface commands\n"
4404 "Authentication password (key)\n"
4405 "Address of interface")
4407 struct interface
*ifp
;
4408 struct in_addr addr
;
4410 struct ospf_if_params
*params
;
4413 params
= IF_DEF_PARAMS (ifp
);
4417 ret
= inet_aton(argv
[1], &addr
);
4420 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4425 params
= ospf_lookup_if_params (ifp
, addr
);
4430 memset (params
->auth_simple
, 0, OSPF_AUTH_SIMPLE_SIZE
);
4431 UNSET_IF_PARAM (params
, auth_simple
);
4433 if (params
!= IF_DEF_PARAMS (ifp
))
4435 ospf_free_if_params (ifp
, addr
);
4436 ospf_if_update_params (ifp
, addr
);
4442 ALIAS (no_ip_ospf_authentication_key
,
4443 no_ip_ospf_authentication_key_cmd
,
4444 "no ip ospf authentication-key",
4447 "OSPF interface commands\n"
4448 "Authentication password (key)\n")
4450 ALIAS (no_ip_ospf_authentication_key
,
4451 no_ospf_authentication_key_cmd
,
4452 "no ospf authentication-key",
4454 "OSPF interface commands\n"
4455 "Authentication password (key)\n")
4457 DEFUN (ip_ospf_message_digest_key
,
4458 ip_ospf_message_digest_key_addr_cmd
,
4459 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4461 "OSPF interface commands\n"
4462 "Message digest authentication password (key)\n"
4464 "Use MD5 algorithm\n"
4465 "The OSPF password (key)"
4466 "Address of interface")
4468 struct interface
*ifp
;
4469 struct crypt_key
*ck
;
4471 struct in_addr addr
;
4473 struct ospf_if_params
*params
;
4476 params
= IF_DEF_PARAMS (ifp
);
4480 ret
= inet_aton(argv
[2], &addr
);
4483 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4488 params
= ospf_get_if_params (ifp
, addr
);
4489 ospf_if_update_params (ifp
, addr
);
4492 key_id
= strtol (argv
[0], NULL
, 10);
4493 if (ospf_crypt_key_lookup (params
->auth_crypt
, key_id
) != NULL
)
4495 vty_out (vty
, "OSPF: Key %d already exists%s", key_id
, VTY_NEWLINE
);
4499 ck
= ospf_crypt_key_new ();
4500 ck
->key_id
= (u_char
) key_id
;
4501 memset (ck
->auth_key
, 0, OSPF_AUTH_MD5_SIZE
+1);
4502 strncpy ((char *) ck
->auth_key
, argv
[1], OSPF_AUTH_MD5_SIZE
);
4504 ospf_crypt_key_add (params
->auth_crypt
, ck
);
4505 SET_IF_PARAM (params
, auth_crypt
);
4510 ALIAS (ip_ospf_message_digest_key
,
4511 ip_ospf_message_digest_key_cmd
,
4512 "ip ospf message-digest-key <1-255> md5 KEY",
4514 "OSPF interface commands\n"
4515 "Message digest authentication password (key)\n"
4517 "Use MD5 algorithm\n"
4518 "The OSPF password (key)")
4520 ALIAS (ip_ospf_message_digest_key
,
4521 ospf_message_digest_key_cmd
,
4522 "ospf message-digest-key <1-255> md5 KEY",
4523 "OSPF interface commands\n"
4524 "Message digest authentication password (key)\n"
4526 "Use MD5 algorithm\n"
4527 "The OSPF password (key)")
4529 DEFUN (no_ip_ospf_message_digest_key
,
4530 no_ip_ospf_message_digest_key_addr_cmd
,
4531 "no ip ospf message-digest-key <1-255> A.B.C.D",
4534 "OSPF interface commands\n"
4535 "Message digest authentication password (key)\n"
4537 "Address of interface")
4539 struct interface
*ifp
;
4540 struct crypt_key
*ck
;
4542 struct in_addr addr
;
4544 struct ospf_if_params
*params
;
4547 params
= IF_DEF_PARAMS (ifp
);
4551 ret
= inet_aton(argv
[1], &addr
);
4554 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4559 params
= ospf_lookup_if_params (ifp
, addr
);
4564 key_id
= strtol (argv
[0], NULL
, 10);
4565 ck
= ospf_crypt_key_lookup (params
->auth_crypt
, key_id
);
4568 vty_out (vty
, "OSPF: Key %d does not exist%s", key_id
, VTY_NEWLINE
);
4572 ospf_crypt_key_delete (params
->auth_crypt
, key_id
);
4574 if (params
!= IF_DEF_PARAMS (ifp
))
4576 ospf_free_if_params (ifp
, addr
);
4577 ospf_if_update_params (ifp
, addr
);
4583 ALIAS (no_ip_ospf_message_digest_key
,
4584 no_ip_ospf_message_digest_key_cmd
,
4585 "no ip ospf message-digest-key <1-255>",
4588 "OSPF interface commands\n"
4589 "Message digest authentication password (key)\n"
4592 ALIAS (no_ip_ospf_message_digest_key
,
4593 no_ospf_message_digest_key_cmd
,
4594 "no ospf message-digest-key <1-255>",
4596 "OSPF interface commands\n"
4597 "Message digest authentication password (key)\n"
4600 DEFUN (ip_ospf_cost
,
4601 ip_ospf_cost_addr_cmd
,
4602 "ip ospf cost <1-65535> A.B.C.D",
4604 "OSPF interface commands\n"
4607 "Address of interface")
4609 struct interface
*ifp
= vty
->index
;
4611 struct in_addr addr
;
4613 struct ospf_if_params
*params
;
4615 params
= IF_DEF_PARAMS (ifp
);
4617 cost
= strtol (argv
[0], NULL
, 10);
4619 /* cost range is <1-65535>. */
4620 if (cost
< 1 || cost
> 65535)
4622 vty_out (vty
, "Interface output cost is invalid%s", VTY_NEWLINE
);
4628 ret
= inet_aton(argv
[1], &addr
);
4631 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4636 params
= ospf_get_if_params (ifp
, addr
);
4637 ospf_if_update_params (ifp
, addr
);
4640 SET_IF_PARAM (params
, output_cost_cmd
);
4641 params
->output_cost_cmd
= cost
;
4643 ospf_if_recalculate_output_cost (ifp
);
4648 ALIAS (ip_ospf_cost
,
4650 "ip ospf cost <1-65535>",
4652 "OSPF interface commands\n"
4656 ALIAS (ip_ospf_cost
,
4658 "ospf cost <1-65535>",
4659 "OSPF interface commands\n"
4663 DEFUN (no_ip_ospf_cost
,
4664 no_ip_ospf_cost_addr_cmd
,
4665 "no ip ospf cost A.B.C.D",
4668 "OSPF interface commands\n"
4670 "Address of interface")
4672 struct interface
*ifp
= vty
->index
;
4673 struct in_addr addr
;
4675 struct ospf_if_params
*params
;
4678 params
= IF_DEF_PARAMS (ifp
);
4682 ret
= inet_aton(argv
[0], &addr
);
4685 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4690 params
= ospf_lookup_if_params (ifp
, addr
);
4695 UNSET_IF_PARAM (params
, output_cost_cmd
);
4697 if (params
!= IF_DEF_PARAMS (ifp
))
4699 ospf_free_if_params (ifp
, addr
);
4700 ospf_if_update_params (ifp
, addr
);
4703 ospf_if_recalculate_output_cost (ifp
);
4708 ALIAS (no_ip_ospf_cost
,
4709 no_ip_ospf_cost_cmd
,
4713 "OSPF interface commands\n"
4716 ALIAS (no_ip_ospf_cost
,
4720 "OSPF interface commands\n"
4724 ospf_nbr_timer_update (struct ospf_interface
*oi
)
4726 struct route_node
*rn
;
4727 struct ospf_neighbor
*nbr
;
4729 for (rn
= route_top (oi
->nbrs
); rn
; rn
= route_next (rn
))
4730 if ((nbr
= rn
->info
))
4732 nbr
->v_inactivity
= OSPF_IF_PARAM (oi
, v_wait
);
4733 nbr
->v_db_desc
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4734 nbr
->v_ls_req
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4735 nbr
->v_ls_upd
= OSPF_IF_PARAM (oi
, retransmit_interval
);
4740 ospf_vty_dead_interval_set (struct vty
*vty
, const char *interval_str
,
4741 const char *nbr_str
,
4742 const char *fast_hello_str
)
4744 struct interface
*ifp
= vty
->index
;
4747 struct in_addr addr
;
4749 struct ospf_if_params
*params
;
4750 struct ospf_interface
*oi
;
4751 struct route_node
*rn
;
4753 params
= IF_DEF_PARAMS (ifp
);
4757 ret
= inet_aton(nbr_str
, &addr
);
4760 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4765 params
= ospf_get_if_params (ifp
, addr
);
4766 ospf_if_update_params (ifp
, addr
);
4771 VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds
, interval_str
,
4774 /* reset fast_hello too, just to be sure */
4775 UNSET_IF_PARAM (params
, fast_hello
);
4776 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
4778 else if (fast_hello_str
)
4780 VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult
, fast_hello_str
,
4782 /* 1s dead-interval with sub-second hellos desired */
4783 seconds
= OSPF_ROUTER_DEAD_INTERVAL_MINIMAL
;
4784 SET_IF_PARAM (params
, fast_hello
);
4785 params
->fast_hello
= hellomult
;
4789 vty_out (vty
, "Please specify dead-interval or hello-multiplier%s",
4794 SET_IF_PARAM (params
, v_wait
);
4795 params
->v_wait
= seconds
;
4797 /* Update timer values in neighbor structure. */
4801 if ((ospf
= ospf_lookup()))
4803 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
4805 ospf_nbr_timer_update (oi
);
4810 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4811 if ((oi
= rn
->info
))
4812 ospf_nbr_timer_update (oi
);
4819 DEFUN (ip_ospf_dead_interval
,
4820 ip_ospf_dead_interval_addr_cmd
,
4821 "ip ospf dead-interval <1-65535> A.B.C.D",
4823 "OSPF interface commands\n"
4824 "Interval after which a neighbor is declared dead\n"
4826 "Address of interface\n")
4829 return ospf_vty_dead_interval_set (vty
, argv
[0], argv
[1], NULL
);
4831 return ospf_vty_dead_interval_set (vty
, argv
[0], NULL
, NULL
);
4834 ALIAS (ip_ospf_dead_interval
,
4835 ip_ospf_dead_interval_cmd
,
4836 "ip ospf dead-interval <1-65535>",
4838 "OSPF interface commands\n"
4839 "Interval after which a neighbor is declared dead\n"
4842 ALIAS (ip_ospf_dead_interval
,
4843 ospf_dead_interval_cmd
,
4844 "ospf dead-interval <1-65535>",
4845 "OSPF interface commands\n"
4846 "Interval after which a neighbor is declared dead\n"
4849 DEFUN (ip_ospf_dead_interval_minimal
,
4850 ip_ospf_dead_interval_minimal_addr_cmd
,
4851 "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
4853 "OSPF interface commands\n"
4854 "Interval after which a neighbor is declared dead\n"
4855 "Minimal 1s dead-interval with fast sub-second hellos\n"
4856 "Hello multiplier factor\n"
4857 "Number of Hellos to send each second\n"
4858 "Address of interface\n")
4861 return ospf_vty_dead_interval_set (vty
, NULL
, argv
[1], argv
[0]);
4863 return ospf_vty_dead_interval_set (vty
, NULL
, NULL
, argv
[0]);
4866 ALIAS (ip_ospf_dead_interval_minimal
,
4867 ip_ospf_dead_interval_minimal_cmd
,
4868 "ip ospf dead-interval minimal hello-multiplier <1-10>",
4870 "OSPF interface commands\n"
4871 "Interval after which a neighbor is declared dead\n"
4872 "Minimal 1s dead-interval with fast sub-second hellos\n"
4873 "Hello multiplier factor\n"
4874 "Number of Hellos to send each second\n")
4876 DEFUN (no_ip_ospf_dead_interval
,
4877 no_ip_ospf_dead_interval_addr_cmd
,
4878 "no ip ospf dead-interval A.B.C.D",
4881 "OSPF interface commands\n"
4882 "Interval after which a neighbor is declared dead\n"
4883 "Address of interface")
4885 struct interface
*ifp
= vty
->index
;
4886 struct in_addr addr
;
4888 struct ospf_if_params
*params
;
4889 struct ospf_interface
*oi
;
4890 struct route_node
*rn
;
4893 params
= IF_DEF_PARAMS (ifp
);
4897 ret
= inet_aton(argv
[0], &addr
);
4900 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4905 params
= ospf_lookup_if_params (ifp
, addr
);
4910 UNSET_IF_PARAM (params
, v_wait
);
4911 params
->v_wait
= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
;
4913 UNSET_IF_PARAM (params
, fast_hello
);
4914 params
->fast_hello
= OSPF_FAST_HELLO_DEFAULT
;
4916 if (params
!= IF_DEF_PARAMS (ifp
))
4918 ospf_free_if_params (ifp
, addr
);
4919 ospf_if_update_params (ifp
, addr
);
4922 /* Update timer values in neighbor structure. */
4927 if ((ospf
= ospf_lookup()))
4929 oi
= ospf_if_lookup_by_local_addr (ospf
, ifp
, addr
);
4931 ospf_nbr_timer_update (oi
);
4936 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
4937 if ((oi
= rn
->info
))
4938 ospf_nbr_timer_update (oi
);
4944 ALIAS (no_ip_ospf_dead_interval
,
4945 no_ip_ospf_dead_interval_cmd
,
4946 "no ip ospf dead-interval",
4949 "OSPF interface commands\n"
4950 "Interval after which a neighbor is declared dead\n")
4952 ALIAS (no_ip_ospf_dead_interval
,
4953 no_ospf_dead_interval_cmd
,
4954 "no ospf dead-interval",
4956 "OSPF interface commands\n"
4957 "Interval after which a neighbor is declared dead\n")
4959 DEFUN (ip_ospf_hello_interval
,
4960 ip_ospf_hello_interval_addr_cmd
,
4961 "ip ospf hello-interval <1-65535> A.B.C.D",
4963 "OSPF interface commands\n"
4964 "Time between HELLO packets\n"
4966 "Address of interface")
4968 struct interface
*ifp
= vty
->index
;
4970 struct in_addr addr
;
4972 struct ospf_if_params
*params
;
4974 params
= IF_DEF_PARAMS (ifp
);
4976 seconds
= strtol (argv
[0], NULL
, 10);
4978 /* HelloInterval range is <1-65535>. */
4979 if (seconds
< 1 || seconds
> 65535)
4981 vty_out (vty
, "Hello Interval is invalid%s", VTY_NEWLINE
);
4987 ret
= inet_aton(argv
[1], &addr
);
4990 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
4995 params
= ospf_get_if_params (ifp
, addr
);
4996 ospf_if_update_params (ifp
, addr
);
4999 SET_IF_PARAM (params
, v_hello
);
5000 params
->v_hello
= seconds
;
5005 ALIAS (ip_ospf_hello_interval
,
5006 ip_ospf_hello_interval_cmd
,
5007 "ip ospf hello-interval <1-65535>",
5009 "OSPF interface commands\n"
5010 "Time between HELLO packets\n"
5013 ALIAS (ip_ospf_hello_interval
,
5014 ospf_hello_interval_cmd
,
5015 "ospf hello-interval <1-65535>",
5016 "OSPF interface commands\n"
5017 "Time between HELLO packets\n"
5020 DEFUN (no_ip_ospf_hello_interval
,
5021 no_ip_ospf_hello_interval_addr_cmd
,
5022 "no ip ospf hello-interval A.B.C.D",
5025 "OSPF interface commands\n"
5026 "Time between HELLO packets\n"
5027 "Address of interface")
5029 struct interface
*ifp
= vty
->index
;
5030 struct in_addr addr
;
5032 struct ospf_if_params
*params
;
5035 params
= IF_DEF_PARAMS (ifp
);
5039 ret
= inet_aton(argv
[0], &addr
);
5042 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5047 params
= ospf_lookup_if_params (ifp
, addr
);
5052 UNSET_IF_PARAM (params
, v_hello
);
5053 params
->v_hello
= OSPF_HELLO_INTERVAL_DEFAULT
;
5055 if (params
!= IF_DEF_PARAMS (ifp
))
5057 ospf_free_if_params (ifp
, addr
);
5058 ospf_if_update_params (ifp
, addr
);
5064 ALIAS (no_ip_ospf_hello_interval
,
5065 no_ip_ospf_hello_interval_cmd
,
5066 "no ip ospf hello-interval",
5069 "OSPF interface commands\n"
5070 "Time between HELLO packets\n")
5072 ALIAS (no_ip_ospf_hello_interval
,
5073 no_ospf_hello_interval_cmd
,
5074 "no ospf hello-interval",
5076 "OSPF interface commands\n"
5077 "Time between HELLO packets\n")
5079 DEFUN (ip_ospf_network
,
5080 ip_ospf_network_cmd
,
5081 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
5083 "OSPF interface commands\n"
5085 "Specify OSPF broadcast multi-access network\n"
5086 "Specify OSPF NBMA network\n"
5087 "Specify OSPF point-to-multipoint network\n"
5088 "Specify OSPF point-to-point network\n")
5090 struct interface
*ifp
= vty
->index
;
5091 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
5092 struct route_node
*rn
;
5094 if (strncmp (argv
[0], "b", 1) == 0)
5095 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_BROADCAST
;
5096 else if (strncmp (argv
[0], "n", 1) == 0)
5097 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_NBMA
;
5098 else if (strncmp (argv
[0], "point-to-m", 10) == 0)
5099 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOMULTIPOINT
;
5100 else if (strncmp (argv
[0], "point-to-p", 10) == 0)
5101 IF_DEF_PARAMS (ifp
)->type
= OSPF_IFTYPE_POINTOPOINT
;
5103 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
5106 SET_IF_PARAM (IF_DEF_PARAMS (ifp
), type
);
5108 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5110 struct ospf_interface
*oi
= rn
->info
;
5115 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
5117 if (oi
->state
> ISM_Down
)
5119 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
5120 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
5127 ALIAS (ip_ospf_network
,
5129 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
5130 "OSPF interface commands\n"
5132 "Specify OSPF broadcast multi-access network\n"
5133 "Specify OSPF NBMA network\n"
5134 "Specify OSPF point-to-multipoint network\n"
5135 "Specify OSPF point-to-point network\n")
5137 DEFUN (no_ip_ospf_network
,
5138 no_ip_ospf_network_cmd
,
5139 "no ip ospf network",
5142 "OSPF interface commands\n"
5145 struct interface
*ifp
= vty
->index
;
5146 int old_type
= IF_DEF_PARAMS (ifp
)->type
;
5147 struct route_node
*rn
;
5149 IF_DEF_PARAMS (ifp
)->type
= ospf_default_iftype(ifp
);
5151 if (IF_DEF_PARAMS (ifp
)->type
== old_type
)
5154 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5156 struct ospf_interface
*oi
= rn
->info
;
5161 oi
->type
= IF_DEF_PARAMS (ifp
)->type
;
5163 if (oi
->state
> ISM_Down
)
5165 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceDown
);
5166 OSPF_ISM_EVENT_EXECUTE (oi
, ISM_InterfaceUp
);
5173 ALIAS (no_ip_ospf_network
,
5174 no_ospf_network_cmd
,
5177 "OSPF interface commands\n"
5180 DEFUN (ip_ospf_priority
,
5181 ip_ospf_priority_addr_cmd
,
5182 "ip ospf priority <0-255> A.B.C.D",
5184 "OSPF interface commands\n"
5187 "Address of interface")
5189 struct interface
*ifp
= vty
->index
;
5191 struct route_node
*rn
;
5192 struct in_addr addr
;
5194 struct ospf_if_params
*params
;
5196 params
= IF_DEF_PARAMS (ifp
);
5198 priority
= strtol (argv
[0], NULL
, 10);
5200 /* Router Priority range is <0-255>. */
5201 if (priority
< 0 || priority
> 255)
5203 vty_out (vty
, "Router Priority is invalid%s", VTY_NEWLINE
);
5209 ret
= inet_aton(argv
[1], &addr
);
5212 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5217 params
= ospf_get_if_params (ifp
, addr
);
5218 ospf_if_update_params (ifp
, addr
);
5221 SET_IF_PARAM (params
, priority
);
5222 params
->priority
= priority
;
5224 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5226 struct ospf_interface
*oi
= rn
->info
;
5232 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
5234 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
5235 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
5242 ALIAS (ip_ospf_priority
,
5243 ip_ospf_priority_cmd
,
5244 "ip ospf priority <0-255>",
5246 "OSPF interface commands\n"
5250 ALIAS (ip_ospf_priority
,
5252 "ospf priority <0-255>",
5253 "OSPF interface commands\n"
5257 DEFUN (no_ip_ospf_priority
,
5258 no_ip_ospf_priority_addr_cmd
,
5259 "no ip ospf priority A.B.C.D",
5262 "OSPF interface commands\n"
5264 "Address of interface")
5266 struct interface
*ifp
= vty
->index
;
5267 struct route_node
*rn
;
5268 struct in_addr addr
;
5270 struct ospf_if_params
*params
;
5273 params
= IF_DEF_PARAMS (ifp
);
5277 ret
= inet_aton(argv
[0], &addr
);
5280 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5285 params
= ospf_lookup_if_params (ifp
, addr
);
5290 UNSET_IF_PARAM (params
, priority
);
5291 params
->priority
= OSPF_ROUTER_PRIORITY_DEFAULT
;
5293 if (params
!= IF_DEF_PARAMS (ifp
))
5295 ospf_free_if_params (ifp
, addr
);
5296 ospf_if_update_params (ifp
, addr
);
5299 for (rn
= route_top (IF_OIFS (ifp
)); rn
; rn
= route_next (rn
))
5301 struct ospf_interface
*oi
= rn
->info
;
5307 if (PRIORITY (oi
) != OSPF_IF_PARAM (oi
, priority
))
5309 PRIORITY (oi
) = OSPF_IF_PARAM (oi
, priority
);
5310 OSPF_ISM_EVENT_SCHEDULE (oi
, ISM_NeighborChange
);
5317 ALIAS (no_ip_ospf_priority
,
5318 no_ip_ospf_priority_cmd
,
5319 "no ip ospf priority",
5322 "OSPF interface commands\n"
5323 "Router priority\n")
5325 ALIAS (no_ip_ospf_priority
,
5326 no_ospf_priority_cmd
,
5329 "OSPF interface commands\n"
5330 "Router priority\n")
5332 DEFUN (ip_ospf_retransmit_interval
,
5333 ip_ospf_retransmit_interval_addr_cmd
,
5334 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5336 "OSPF interface commands\n"
5337 "Time between retransmitting lost link state advertisements\n"
5339 "Address of interface")
5341 struct interface
*ifp
= vty
->index
;
5343 struct in_addr addr
;
5345 struct ospf_if_params
*params
;
5347 params
= IF_DEF_PARAMS (ifp
);
5348 seconds
= strtol (argv
[0], NULL
, 10);
5350 /* Retransmit Interval range is <3-65535>. */
5351 if (seconds
< 3 || seconds
> 65535)
5353 vty_out (vty
, "Retransmit Interval is invalid%s", VTY_NEWLINE
);
5360 ret
= inet_aton(argv
[1], &addr
);
5363 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5368 params
= ospf_get_if_params (ifp
, addr
);
5369 ospf_if_update_params (ifp
, addr
);
5372 SET_IF_PARAM (params
, retransmit_interval
);
5373 params
->retransmit_interval
= seconds
;
5378 ALIAS (ip_ospf_retransmit_interval
,
5379 ip_ospf_retransmit_interval_cmd
,
5380 "ip ospf retransmit-interval <3-65535>",
5382 "OSPF interface commands\n"
5383 "Time between retransmitting lost link state advertisements\n"
5386 ALIAS (ip_ospf_retransmit_interval
,
5387 ospf_retransmit_interval_cmd
,
5388 "ospf retransmit-interval <3-65535>",
5389 "OSPF interface commands\n"
5390 "Time between retransmitting lost link state advertisements\n"
5393 DEFUN (no_ip_ospf_retransmit_interval
,
5394 no_ip_ospf_retransmit_interval_addr_cmd
,
5395 "no ip ospf retransmit-interval A.B.C.D",
5398 "OSPF interface commands\n"
5399 "Time between retransmitting lost link state advertisements\n"
5400 "Address of interface")
5402 struct interface
*ifp
= vty
->index
;
5403 struct in_addr addr
;
5405 struct ospf_if_params
*params
;
5408 params
= IF_DEF_PARAMS (ifp
);
5412 ret
= inet_aton(argv
[0], &addr
);
5415 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5420 params
= ospf_lookup_if_params (ifp
, addr
);
5425 UNSET_IF_PARAM (params
, retransmit_interval
);
5426 params
->retransmit_interval
= OSPF_RETRANSMIT_INTERVAL_DEFAULT
;
5428 if (params
!= IF_DEF_PARAMS (ifp
))
5430 ospf_free_if_params (ifp
, addr
);
5431 ospf_if_update_params (ifp
, addr
);
5437 ALIAS (no_ip_ospf_retransmit_interval
,
5438 no_ip_ospf_retransmit_interval_cmd
,
5439 "no ip ospf retransmit-interval",
5442 "OSPF interface commands\n"
5443 "Time between retransmitting lost link state advertisements\n")
5445 ALIAS (no_ip_ospf_retransmit_interval
,
5446 no_ospf_retransmit_interval_cmd
,
5447 "no ospf retransmit-interval",
5449 "OSPF interface commands\n"
5450 "Time between retransmitting lost link state advertisements\n")
5452 DEFUN (ip_ospf_transmit_delay
,
5453 ip_ospf_transmit_delay_addr_cmd
,
5454 "ip ospf transmit-delay <1-65535> A.B.C.D",
5456 "OSPF interface commands\n"
5457 "Link state transmit delay\n"
5459 "Address of interface")
5461 struct interface
*ifp
= vty
->index
;
5463 struct in_addr addr
;
5465 struct ospf_if_params
*params
;
5467 params
= IF_DEF_PARAMS (ifp
);
5468 seconds
= strtol (argv
[0], NULL
, 10);
5470 /* Transmit Delay range is <1-65535>. */
5471 if (seconds
< 1 || seconds
> 65535)
5473 vty_out (vty
, "Transmit Delay is invalid%s", VTY_NEWLINE
);
5479 ret
= inet_aton(argv
[1], &addr
);
5482 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5487 params
= ospf_get_if_params (ifp
, addr
);
5488 ospf_if_update_params (ifp
, addr
);
5491 SET_IF_PARAM (params
, transmit_delay
);
5492 params
->transmit_delay
= seconds
;
5497 ALIAS (ip_ospf_transmit_delay
,
5498 ip_ospf_transmit_delay_cmd
,
5499 "ip ospf transmit-delay <1-65535>",
5501 "OSPF interface commands\n"
5502 "Link state transmit delay\n"
5505 ALIAS (ip_ospf_transmit_delay
,
5506 ospf_transmit_delay_cmd
,
5507 "ospf transmit-delay <1-65535>",
5508 "OSPF interface commands\n"
5509 "Link state transmit delay\n"
5512 DEFUN (no_ip_ospf_transmit_delay
,
5513 no_ip_ospf_transmit_delay_addr_cmd
,
5514 "no ip ospf transmit-delay A.B.C.D",
5517 "OSPF interface commands\n"
5518 "Link state transmit delay\n"
5519 "Address of interface")
5521 struct interface
*ifp
= vty
->index
;
5522 struct in_addr addr
;
5524 struct ospf_if_params
*params
;
5527 params
= IF_DEF_PARAMS (ifp
);
5531 ret
= inet_aton(argv
[0], &addr
);
5534 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
5539 params
= ospf_lookup_if_params (ifp
, addr
);
5544 UNSET_IF_PARAM (params
, transmit_delay
);
5545 params
->transmit_delay
= OSPF_TRANSMIT_DELAY_DEFAULT
;
5547 if (params
!= IF_DEF_PARAMS (ifp
))
5549 ospf_free_if_params (ifp
, addr
);
5550 ospf_if_update_params (ifp
, addr
);
5556 ALIAS (no_ip_ospf_transmit_delay
,
5557 no_ip_ospf_transmit_delay_cmd
,
5558 "no ip ospf transmit-delay",
5561 "OSPF interface commands\n"
5562 "Link state transmit delay\n")
5564 ALIAS (no_ip_ospf_transmit_delay
,
5565 no_ospf_transmit_delay_cmd
,
5566 "no ospf transmit-delay",
5568 "OSPF interface commands\n"
5569 "Link state transmit delay\n")
5572 DEFUN (ospf_redistribute_source_metric_type
,
5573 ospf_redistribute_source_metric_type_routemap_cmd
,
5574 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5575 "Redistribute information from another routing protocol\n"
5579 "Routing Information Protocol (RIP)\n"
5580 "Border Gateway Protocol (BGP)\n"
5581 "Metric for redistributed routes\n"
5582 "OSPF default metric\n"
5583 "OSPF exterior metric type for redistributed routes\n"
5584 "Set OSPF External Type 1 metrics\n"
5585 "Set OSPF External Type 2 metrics\n"
5586 "Route map reference\n"
5587 "Pointer to route-map entries\n")
5589 struct ospf
*ospf
= vty
->index
;
5594 /* Get distribute source. */
5595 if (!str2distribute_source (argv
[0], &source
))
5598 /* Get metric value. */
5600 if (!str2metric (argv
[1], &metric
))
5603 /* Get metric type. */
5605 if (!str2metric_type (argv
[2], &type
))
5609 ospf_routemap_set (ospf
, source
, argv
[3]);
5611 ospf_routemap_unset (ospf
, source
);
5613 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5616 ALIAS (ospf_redistribute_source_metric_type
,
5617 ospf_redistribute_source_metric_type_cmd
,
5618 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5619 "Redistribute information from another routing protocol\n"
5623 "Routing Information Protocol (RIP)\n"
5624 "Border Gateway Protocol (BGP)\n"
5625 "Metric for redistributed routes\n"
5626 "OSPF default metric\n"
5627 "OSPF exterior metric type for redistributed routes\n"
5628 "Set OSPF External Type 1 metrics\n"
5629 "Set OSPF External Type 2 metrics\n")
5631 ALIAS (ospf_redistribute_source_metric_type
,
5632 ospf_redistribute_source_metric_cmd
,
5633 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5634 "Redistribute information from another routing protocol\n"
5638 "Routing Information Protocol (RIP)\n"
5639 "Border Gateway Protocol (BGP)\n"
5640 "Metric for redistributed routes\n"
5641 "OSPF default metric\n")
5643 DEFUN (ospf_redistribute_source_type_metric
,
5644 ospf_redistribute_source_type_metric_routemap_cmd
,
5645 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5646 "Redistribute information from another routing protocol\n"
5650 "Routing Information Protocol (RIP)\n"
5651 "Border Gateway Protocol (BGP)\n"
5652 "OSPF exterior metric type for redistributed routes\n"
5653 "Set OSPF External Type 1 metrics\n"
5654 "Set OSPF External Type 2 metrics\n"
5655 "Metric for redistributed routes\n"
5656 "OSPF default metric\n"
5657 "Route map reference\n"
5658 "Pointer to route-map entries\n")
5660 struct ospf
*ospf
= vty
->index
;
5665 /* Get distribute source. */
5666 if (!str2distribute_source (argv
[0], &source
))
5669 /* Get metric value. */
5671 if (!str2metric_type (argv
[1], &type
))
5674 /* Get metric type. */
5676 if (!str2metric (argv
[2], &metric
))
5680 ospf_routemap_set (ospf
, source
, argv
[3]);
5682 ospf_routemap_unset (ospf
, source
);
5684 return ospf_redistribute_set (ospf
, source
, type
, metric
);
5687 ALIAS (ospf_redistribute_source_type_metric
,
5688 ospf_redistribute_source_type_metric_cmd
,
5689 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5690 "Redistribute information from another routing protocol\n"
5694 "Routing Information Protocol (RIP)\n"
5695 "Border Gateway Protocol (BGP)\n"
5696 "OSPF exterior metric type for redistributed routes\n"
5697 "Set OSPF External Type 1 metrics\n"
5698 "Set OSPF External Type 2 metrics\n"
5699 "Metric for redistributed routes\n"
5700 "OSPF default metric\n")
5702 ALIAS (ospf_redistribute_source_type_metric
,
5703 ospf_redistribute_source_type_cmd
,
5704 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5705 "Redistribute information from another routing protocol\n"
5709 "Routing Information Protocol (RIP)\n"
5710 "Border Gateway Protocol (BGP)\n"
5711 "OSPF exterior metric type for redistributed routes\n"
5712 "Set OSPF External Type 1 metrics\n"
5713 "Set OSPF External Type 2 metrics\n")
5715 ALIAS (ospf_redistribute_source_type_metric
,
5716 ospf_redistribute_source_cmd
,
5717 "redistribute (kernel|connected|static|rip|bgp)",
5718 "Redistribute information from another routing protocol\n"
5722 "Routing Information Protocol (RIP)\n"
5723 "Border Gateway Protocol (BGP)\n")
5725 DEFUN (ospf_redistribute_source_metric_routemap
,
5726 ospf_redistribute_source_metric_routemap_cmd
,
5727 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5728 "Redistribute information from another routing protocol\n"
5732 "Routing Information Protocol (RIP)\n"
5733 "Border Gateway Protocol (BGP)\n"
5734 "Metric for redistributed routes\n"
5735 "OSPF default metric\n"
5736 "Route map reference\n"
5737 "Pointer to route-map entries\n")
5739 struct ospf
*ospf
= vty
->index
;
5743 /* Get distribute source. */
5744 if (!str2distribute_source (argv
[0], &source
))
5747 /* Get metric value. */
5749 if (!str2metric (argv
[1], &metric
))
5753 ospf_routemap_set (ospf
, source
, argv
[2]);
5755 ospf_routemap_unset (ospf
, source
);
5757 return ospf_redistribute_set (ospf
, source
, -1, metric
);
5760 DEFUN (ospf_redistribute_source_type_routemap
,
5761 ospf_redistribute_source_type_routemap_cmd
,
5762 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5763 "Redistribute information from another routing protocol\n"
5767 "Routing Information Protocol (RIP)\n"
5768 "Border Gateway Protocol (BGP)\n"
5769 "OSPF exterior metric type for redistributed routes\n"
5770 "Set OSPF External Type 1 metrics\n"
5771 "Set OSPF External Type 2 metrics\n"
5772 "Route map reference\n"
5773 "Pointer to route-map entries\n")
5775 struct ospf
*ospf
= vty
->index
;
5779 /* Get distribute source. */
5780 if (!str2distribute_source (argv
[0], &source
))
5783 /* Get metric value. */
5785 if (!str2metric_type (argv
[1], &type
))
5789 ospf_routemap_set (ospf
, source
, argv
[2]);
5791 ospf_routemap_unset (ospf
, source
);
5793 return ospf_redistribute_set (ospf
, source
, type
, -1);
5796 DEFUN (ospf_redistribute_source_routemap
,
5797 ospf_redistribute_source_routemap_cmd
,
5798 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5799 "Redistribute information from another routing protocol\n"
5803 "Routing Information Protocol (RIP)\n"
5804 "Border Gateway Protocol (BGP)\n"
5805 "Route map reference\n"
5806 "Pointer to route-map entries\n")
5808 struct ospf
*ospf
= vty
->index
;
5811 /* Get distribute source. */
5812 if (!str2distribute_source (argv
[0], &source
))
5816 ospf_routemap_set (ospf
, source
, argv
[1]);
5818 ospf_routemap_unset (ospf
, source
);
5820 return ospf_redistribute_set (ospf
, source
, -1, -1);
5823 DEFUN (no_ospf_redistribute_source
,
5824 no_ospf_redistribute_source_cmd
,
5825 "no redistribute (kernel|connected|static|rip|bgp)",
5827 "Redistribute information from another routing protocol\n"
5831 "Routing Information Protocol (RIP)\n"
5832 "Border Gateway Protocol (BGP)\n")
5834 struct ospf
*ospf
= vty
->index
;
5837 if (!str2distribute_source (argv
[0], &source
))
5840 ospf_routemap_unset (ospf
, source
);
5841 return ospf_redistribute_unset (ospf
, source
);
5844 DEFUN (ospf_distribute_list_out
,
5845 ospf_distribute_list_out_cmd
,
5846 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5847 "Filter networks in routing updates\n"
5848 "Access-list name\n"
5853 "Routing Information Protocol (RIP)\n"
5854 "Border Gateway Protocol (BGP)\n")
5856 struct ospf
*ospf
= vty
->index
;
5859 /* Get distribute source. */
5860 if (!str2distribute_source (argv
[1], &source
))
5863 return ospf_distribute_list_out_set (ospf
, source
, argv
[0]);
5866 DEFUN (no_ospf_distribute_list_out
,
5867 no_ospf_distribute_list_out_cmd
,
5868 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5870 "Filter networks in routing updates\n"
5871 "Access-list name\n"
5876 "Routing Information Protocol (RIP)\n"
5877 "Border Gateway Protocol (BGP)\n")
5879 struct ospf
*ospf
= vty
->index
;
5882 if (!str2distribute_source (argv
[1], &source
))
5885 return ospf_distribute_list_out_unset (ospf
, source
, argv
[0]);
5888 /* Default information originate. */
5889 DEFUN (ospf_default_information_originate_metric_type_routemap
,
5890 ospf_default_information_originate_metric_type_routemap_cmd
,
5891 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5892 "Control distribution of default information\n"
5893 "Distribute a default route\n"
5894 "OSPF default metric\n"
5896 "OSPF metric type for default routes\n"
5897 "Set OSPF External Type 1 metrics\n"
5898 "Set OSPF External Type 2 metrics\n"
5899 "Route map reference\n"
5900 "Pointer to route-map entries\n")
5902 struct ospf
*ospf
= vty
->index
;
5906 /* Get metric value. */
5908 if (!str2metric (argv
[0], &metric
))
5911 /* Get metric type. */
5913 if (!str2metric_type (argv
[1], &type
))
5917 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
5919 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5921 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5925 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5926 ospf_default_information_originate_metric_type_cmd
,
5927 "default-information originate metric <0-16777214> metric-type (1|2)",
5928 "Control distribution of default information\n"
5929 "Distribute a default route\n"
5930 "OSPF default metric\n"
5932 "OSPF metric type for default routes\n"
5933 "Set OSPF External Type 1 metrics\n"
5934 "Set OSPF External Type 2 metrics\n")
5936 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5937 ospf_default_information_originate_metric_cmd
,
5938 "default-information originate metric <0-16777214>",
5939 "Control distribution of default information\n"
5940 "Distribute a default route\n"
5941 "OSPF default metric\n"
5944 ALIAS (ospf_default_information_originate_metric_type_routemap
,
5945 ospf_default_information_originate_cmd
,
5946 "default-information originate",
5947 "Control distribution of default information\n"
5948 "Distribute a default route\n")
5950 /* Default information originate. */
5951 DEFUN (ospf_default_information_originate_metric_routemap
,
5952 ospf_default_information_originate_metric_routemap_cmd
,
5953 "default-information originate metric <0-16777214> route-map WORD",
5954 "Control distribution of default information\n"
5955 "Distribute a default route\n"
5956 "OSPF default metric\n"
5958 "Route map reference\n"
5959 "Pointer to route-map entries\n")
5961 struct ospf
*ospf
= vty
->index
;
5964 /* Get metric value. */
5966 if (!str2metric (argv
[0], &metric
))
5970 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
5972 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5974 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
5978 /* Default information originate. */
5979 DEFUN (ospf_default_information_originate_routemap
,
5980 ospf_default_information_originate_routemap_cmd
,
5981 "default-information originate route-map WORD",
5982 "Control distribution of default information\n"
5983 "Distribute a default route\n"
5984 "Route map reference\n"
5985 "Pointer to route-map entries\n")
5987 struct ospf
*ospf
= vty
->index
;
5990 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
5992 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
5994 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
, -1, -1);
5997 DEFUN (ospf_default_information_originate_type_metric_routemap
,
5998 ospf_default_information_originate_type_metric_routemap_cmd
,
5999 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
6000 "Control distribution of default information\n"
6001 "Distribute a default route\n"
6002 "OSPF metric type for default routes\n"
6003 "Set OSPF External Type 1 metrics\n"
6004 "Set OSPF External Type 2 metrics\n"
6005 "OSPF default metric\n"
6007 "Route map reference\n"
6008 "Pointer to route-map entries\n")
6010 struct ospf
*ospf
= vty
->index
;
6014 /* Get metric type. */
6016 if (!str2metric_type (argv
[0], &type
))
6019 /* Get metric value. */
6021 if (!str2metric (argv
[1], &metric
))
6025 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6027 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6029 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
6033 ALIAS (ospf_default_information_originate_type_metric_routemap
,
6034 ospf_default_information_originate_type_metric_cmd
,
6035 "default-information originate metric-type (1|2) metric <0-16777214>",
6036 "Control distribution of default information\n"
6037 "Distribute a default route\n"
6038 "OSPF metric type for default routes\n"
6039 "Set OSPF External Type 1 metrics\n"
6040 "Set OSPF External Type 2 metrics\n"
6041 "OSPF default metric\n"
6044 ALIAS (ospf_default_information_originate_type_metric_routemap
,
6045 ospf_default_information_originate_type_cmd
,
6046 "default-information originate metric-type (1|2)",
6047 "Control distribution of default information\n"
6048 "Distribute a default route\n"
6049 "OSPF metric type for default routes\n"
6050 "Set OSPF External Type 1 metrics\n"
6051 "Set OSPF External Type 2 metrics\n")
6053 DEFUN (ospf_default_information_originate_type_routemap
,
6054 ospf_default_information_originate_type_routemap_cmd
,
6055 "default-information originate metric-type (1|2) route-map WORD",
6056 "Control distribution of default information\n"
6057 "Distribute a default route\n"
6058 "OSPF metric type for default routes\n"
6059 "Set OSPF External Type 1 metrics\n"
6060 "Set OSPF External Type 2 metrics\n"
6061 "Route map reference\n"
6062 "Pointer to route-map entries\n")
6064 struct ospf
*ospf
= vty
->index
;
6067 /* Get metric type. */
6069 if (!str2metric_type (argv
[0], &type
))
6073 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6075 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6077 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ZEBRA
,
6081 DEFUN (ospf_default_information_originate_always_metric_type_routemap
,
6082 ospf_default_information_originate_always_metric_type_routemap_cmd
,
6083 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
6084 "Control distribution of default information\n"
6085 "Distribute a default route\n"
6086 "Always advertise default route\n"
6087 "OSPF default metric\n"
6089 "OSPF metric type for default routes\n"
6090 "Set OSPF External Type 1 metrics\n"
6091 "Set OSPF External Type 2 metrics\n"
6092 "Route map reference\n"
6093 "Pointer to route-map entries\n")
6095 struct ospf
*ospf
= vty
->index
;
6099 /* Get metric value. */
6101 if (!str2metric (argv
[0], &metric
))
6104 /* Get metric type. */
6106 if (!str2metric_type (argv
[1], &type
))
6110 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6112 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6114 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6118 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
6119 ospf_default_information_originate_always_metric_type_cmd
,
6120 "default-information originate always metric <0-16777214> metric-type (1|2)",
6121 "Control distribution of default information\n"
6122 "Distribute a default route\n"
6123 "Always advertise default route\n"
6124 "OSPF default metric\n"
6126 "OSPF metric type for default routes\n"
6127 "Set OSPF External Type 1 metrics\n"
6128 "Set OSPF External Type 2 metrics\n")
6130 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
6131 ospf_default_information_originate_always_metric_cmd
,
6132 "default-information originate always metric <0-16777214>",
6133 "Control distribution of default information\n"
6134 "Distribute a default route\n"
6135 "Always advertise default route\n"
6136 "OSPF default metric\n"
6138 "OSPF metric type for default routes\n")
6140 ALIAS (ospf_default_information_originate_always_metric_type_routemap
,
6141 ospf_default_information_originate_always_cmd
,
6142 "default-information originate always",
6143 "Control distribution of default information\n"
6144 "Distribute a default route\n"
6145 "Always advertise default route\n")
6147 DEFUN (ospf_default_information_originate_always_metric_routemap
,
6148 ospf_default_information_originate_always_metric_routemap_cmd
,
6149 "default-information originate always metric <0-16777214> route-map WORD",
6150 "Control distribution of default information\n"
6151 "Distribute a default route\n"
6152 "Always advertise default route\n"
6153 "OSPF default metric\n"
6155 "Route map reference\n"
6156 "Pointer to route-map entries\n")
6158 struct ospf
*ospf
= vty
->index
;
6161 /* Get metric value. */
6163 if (!str2metric (argv
[0], &metric
))
6167 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6169 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6171 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6175 DEFUN (ospf_default_information_originate_always_routemap
,
6176 ospf_default_information_originate_always_routemap_cmd
,
6177 "default-information originate always route-map WORD",
6178 "Control distribution of default information\n"
6179 "Distribute a default route\n"
6180 "Always advertise default route\n"
6181 "Route map reference\n"
6182 "Pointer to route-map entries\n")
6184 struct ospf
*ospf
= vty
->index
;
6187 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[0]);
6189 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6191 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
, -1, -1);
6194 DEFUN (ospf_default_information_originate_always_type_metric_routemap
,
6195 ospf_default_information_originate_always_type_metric_routemap_cmd
,
6196 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
6197 "Control distribution of default information\n"
6198 "Distribute a default route\n"
6199 "Always advertise default route\n"
6200 "OSPF metric type for default routes\n"
6201 "Set OSPF External Type 1 metrics\n"
6202 "Set OSPF External Type 2 metrics\n"
6203 "OSPF default metric\n"
6205 "Route map reference\n"
6206 "Pointer to route-map entries\n")
6208 struct ospf
*ospf
= vty
->index
;
6212 /* Get metric type. */
6214 if (!str2metric_type (argv
[0], &type
))
6217 /* Get metric value. */
6219 if (!str2metric (argv
[1], &metric
))
6223 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[2]);
6225 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6227 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6231 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
6232 ospf_default_information_originate_always_type_metric_cmd
,
6233 "default-information originate always metric-type (1|2) metric <0-16777214>",
6234 "Control distribution of default information\n"
6235 "Distribute a default route\n"
6236 "Always advertise default route\n"
6237 "OSPF metric type for default routes\n"
6238 "Set OSPF External Type 1 metrics\n"
6239 "Set OSPF External Type 2 metrics\n"
6240 "OSPF default metric\n"
6243 ALIAS (ospf_default_information_originate_always_type_metric_routemap
,
6244 ospf_default_information_originate_always_type_cmd
,
6245 "default-information originate always metric-type (1|2)",
6246 "Control distribution of default information\n"
6247 "Distribute a default route\n"
6248 "Always advertise default route\n"
6249 "OSPF metric type for default routes\n"
6250 "Set OSPF External Type 1 metrics\n"
6251 "Set OSPF External Type 2 metrics\n")
6253 DEFUN (ospf_default_information_originate_always_type_routemap
,
6254 ospf_default_information_originate_always_type_routemap_cmd
,
6255 "default-information originate always metric-type (1|2) route-map WORD",
6256 "Control distribution of default information\n"
6257 "Distribute a default route\n"
6258 "Always advertise default route\n"
6259 "OSPF metric type for default routes\n"
6260 "Set OSPF External Type 1 metrics\n"
6261 "Set OSPF External Type 2 metrics\n"
6262 "Route map reference\n"
6263 "Pointer to route-map entries\n")
6265 struct ospf
*ospf
= vty
->index
;
6268 /* Get metric type. */
6270 if (!str2metric_type (argv
[0], &type
))
6274 ospf_routemap_set (ospf
, DEFAULT_ROUTE
, argv
[1]);
6276 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6278 return ospf_redistribute_default_set (ospf
, DEFAULT_ORIGINATE_ALWAYS
,
6282 DEFUN (no_ospf_default_information_originate
,
6283 no_ospf_default_information_originate_cmd
,
6284 "no default-information originate",
6286 "Control distribution of default information\n"
6287 "Distribute a default route\n")
6289 struct ospf
*ospf
= vty
->index
;
6290 struct prefix_ipv4 p
;
6293 p
.prefix
.s_addr
= 0;
6296 ospf_external_lsa_flush (ospf
, DEFAULT_ROUTE
, &p
, 0);
6298 if (EXTERNAL_INFO (DEFAULT_ROUTE
)) {
6299 ospf_external_info_delete (DEFAULT_ROUTE
, p
);
6300 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE
));
6301 EXTERNAL_INFO (DEFAULT_ROUTE
) = NULL
;
6304 ospf_routemap_unset (ospf
, DEFAULT_ROUTE
);
6305 return ospf_redistribute_default_unset (ospf
);
6308 DEFUN (ospf_default_metric
,
6309 ospf_default_metric_cmd
,
6310 "default-metric <0-16777214>",
6311 "Set metric of redistributed routes\n"
6314 struct ospf
*ospf
= vty
->index
;
6317 if (!str2metric (argv
[0], &metric
))
6320 ospf
->default_metric
= metric
;
6325 DEFUN (no_ospf_default_metric
,
6326 no_ospf_default_metric_cmd
,
6327 "no default-metric",
6329 "Set metric of redistributed routes\n")
6331 struct ospf
*ospf
= vty
->index
;
6333 ospf
->default_metric
= -1;
6338 ALIAS (no_ospf_default_metric
,
6339 no_ospf_default_metric_val_cmd
,
6340 "no default-metric <0-16777214>",
6342 "Set metric of redistributed routes\n"
6345 DEFUN (ospf_distance
,
6348 "Define an administrative distance\n"
6349 "OSPF Administrative distance\n")
6351 struct ospf
*ospf
= vty
->index
;
6353 ospf
->distance_all
= atoi (argv
[0]);
6358 DEFUN (no_ospf_distance
,
6359 no_ospf_distance_cmd
,
6360 "no distance <1-255>",
6362 "Define an administrative distance\n"
6363 "OSPF Administrative distance\n")
6365 struct ospf
*ospf
= vty
->index
;
6367 ospf
->distance_all
= 0;
6372 DEFUN (no_ospf_distance_ospf
,
6373 no_ospf_distance_ospf_cmd
,
6376 "Define an administrative distance\n"
6377 "OSPF Administrative distance\n"
6380 struct ospf
*ospf
= vty
->index
;
6382 ospf
->distance_intra
= 0;
6383 ospf
->distance_inter
= 0;
6384 ospf
->distance_external
= 0;
6389 DEFUN (ospf_distance_ospf_intra
,
6390 ospf_distance_ospf_intra_cmd
,
6391 "distance ospf intra-area <1-255>",
6392 "Define an administrative distance\n"
6393 "OSPF Administrative distance\n"
6394 "Intra-area routes\n"
6395 "Distance for intra-area routes\n")
6397 struct ospf
*ospf
= vty
->index
;
6399 ospf
->distance_intra
= atoi (argv
[0]);
6404 DEFUN (ospf_distance_ospf_intra_inter
,
6405 ospf_distance_ospf_intra_inter_cmd
,
6406 "distance ospf intra-area <1-255> inter-area <1-255>",
6407 "Define an administrative distance\n"
6408 "OSPF Administrative distance\n"
6409 "Intra-area routes\n"
6410 "Distance for intra-area routes\n"
6411 "Inter-area routes\n"
6412 "Distance for inter-area routes\n")
6414 struct ospf
*ospf
= vty
->index
;
6416 ospf
->distance_intra
= atoi (argv
[0]);
6417 ospf
->distance_inter
= atoi (argv
[1]);
6422 DEFUN (ospf_distance_ospf_intra_external
,
6423 ospf_distance_ospf_intra_external_cmd
,
6424 "distance ospf intra-area <1-255> external <1-255>",
6425 "Define an administrative distance\n"
6426 "OSPF Administrative distance\n"
6427 "Intra-area routes\n"
6428 "Distance for intra-area routes\n"
6430 "Distance for external routes\n")
6432 struct ospf
*ospf
= vty
->index
;
6434 ospf
->distance_intra
= atoi (argv
[0]);
6435 ospf
->distance_external
= atoi (argv
[1]);
6440 DEFUN (ospf_distance_ospf_intra_inter_external
,
6441 ospf_distance_ospf_intra_inter_external_cmd
,
6442 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6443 "Define an administrative distance\n"
6444 "OSPF Administrative distance\n"
6445 "Intra-area routes\n"
6446 "Distance for intra-area routes\n"
6447 "Inter-area routes\n"
6448 "Distance for inter-area routes\n"
6450 "Distance for external routes\n")
6452 struct ospf
*ospf
= vty
->index
;
6454 ospf
->distance_intra
= atoi (argv
[0]);
6455 ospf
->distance_inter
= atoi (argv
[1]);
6456 ospf
->distance_external
= atoi (argv
[2]);
6461 DEFUN (ospf_distance_ospf_intra_external_inter
,
6462 ospf_distance_ospf_intra_external_inter_cmd
,
6463 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6464 "Define an administrative distance\n"
6465 "OSPF Administrative distance\n"
6466 "Intra-area routes\n"
6467 "Distance for intra-area routes\n"
6469 "Distance for external routes\n"
6470 "Inter-area routes\n"
6471 "Distance for inter-area routes\n")
6473 struct ospf
*ospf
= vty
->index
;
6475 ospf
->distance_intra
= atoi (argv
[0]);
6476 ospf
->distance_external
= atoi (argv
[1]);
6477 ospf
->distance_inter
= atoi (argv
[2]);
6482 DEFUN (ospf_distance_ospf_inter
,
6483 ospf_distance_ospf_inter_cmd
,
6484 "distance ospf inter-area <1-255>",
6485 "Define an administrative distance\n"
6486 "OSPF Administrative distance\n"
6487 "Inter-area routes\n"
6488 "Distance for inter-area routes\n")
6490 struct ospf
*ospf
= vty
->index
;
6492 ospf
->distance_inter
= atoi (argv
[0]);
6497 DEFUN (ospf_distance_ospf_inter_intra
,
6498 ospf_distance_ospf_inter_intra_cmd
,
6499 "distance ospf inter-area <1-255> intra-area <1-255>",
6500 "Define an administrative distance\n"
6501 "OSPF Administrative distance\n"
6502 "Inter-area routes\n"
6503 "Distance for inter-area routes\n"
6504 "Intra-area routes\n"
6505 "Distance for intra-area routes\n")
6507 struct ospf
*ospf
= vty
->index
;
6509 ospf
->distance_inter
= atoi (argv
[0]);
6510 ospf
->distance_intra
= atoi (argv
[1]);
6515 DEFUN (ospf_distance_ospf_inter_external
,
6516 ospf_distance_ospf_inter_external_cmd
,
6517 "distance ospf inter-area <1-255> external <1-255>",
6518 "Define an administrative distance\n"
6519 "OSPF Administrative distance\n"
6520 "Inter-area routes\n"
6521 "Distance for inter-area routes\n"
6523 "Distance for external routes\n")
6525 struct ospf
*ospf
= vty
->index
;
6527 ospf
->distance_inter
= atoi (argv
[0]);
6528 ospf
->distance_external
= atoi (argv
[1]);
6533 DEFUN (ospf_distance_ospf_inter_intra_external
,
6534 ospf_distance_ospf_inter_intra_external_cmd
,
6535 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6536 "Define an administrative distance\n"
6537 "OSPF Administrative distance\n"
6538 "Inter-area routes\n"
6539 "Distance for inter-area routes\n"
6540 "Intra-area routes\n"
6541 "Distance for intra-area routes\n"
6543 "Distance for external routes\n")
6545 struct ospf
*ospf
= vty
->index
;
6547 ospf
->distance_inter
= atoi (argv
[0]);
6548 ospf
->distance_intra
= atoi (argv
[1]);
6549 ospf
->distance_external
= atoi (argv
[2]);
6554 DEFUN (ospf_distance_ospf_inter_external_intra
,
6555 ospf_distance_ospf_inter_external_intra_cmd
,
6556 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6557 "Define an administrative distance\n"
6558 "OSPF Administrative distance\n"
6559 "Inter-area routes\n"
6560 "Distance for inter-area routes\n"
6562 "Distance for external routes\n"
6563 "Intra-area routes\n"
6564 "Distance for intra-area routes\n")
6566 struct ospf
*ospf
= vty
->index
;
6568 ospf
->distance_inter
= atoi (argv
[0]);
6569 ospf
->distance_external
= atoi (argv
[1]);
6570 ospf
->distance_intra
= atoi (argv
[2]);
6575 DEFUN (ospf_distance_ospf_external
,
6576 ospf_distance_ospf_external_cmd
,
6577 "distance ospf external <1-255>",
6578 "Define an administrative distance\n"
6579 "OSPF Administrative distance\n"
6581 "Distance for external routes\n")
6583 struct ospf
*ospf
= vty
->index
;
6585 ospf
->distance_external
= atoi (argv
[0]);
6590 DEFUN (ospf_distance_ospf_external_intra
,
6591 ospf_distance_ospf_external_intra_cmd
,
6592 "distance ospf external <1-255> intra-area <1-255>",
6593 "Define an administrative distance\n"
6594 "OSPF Administrative distance\n"
6596 "Distance for external routes\n"
6597 "Intra-area routes\n"
6598 "Distance for intra-area routes\n")
6600 struct ospf
*ospf
= vty
->index
;
6602 ospf
->distance_external
= atoi (argv
[0]);
6603 ospf
->distance_intra
= atoi (argv
[1]);
6608 DEFUN (ospf_distance_ospf_external_inter
,
6609 ospf_distance_ospf_external_inter_cmd
,
6610 "distance ospf external <1-255> inter-area <1-255>",
6611 "Define an administrative distance\n"
6612 "OSPF Administrative distance\n"
6614 "Distance for external routes\n"
6615 "Inter-area routes\n"
6616 "Distance for inter-area routes\n")
6618 struct ospf
*ospf
= vty
->index
;
6620 ospf
->distance_external
= atoi (argv
[0]);
6621 ospf
->distance_inter
= atoi (argv
[1]);
6626 DEFUN (ospf_distance_ospf_external_intra_inter
,
6627 ospf_distance_ospf_external_intra_inter_cmd
,
6628 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6629 "Define an administrative distance\n"
6630 "OSPF Administrative distance\n"
6632 "Distance for external routes\n"
6633 "Intra-area routes\n"
6634 "Distance for intra-area routes\n"
6635 "Inter-area routes\n"
6636 "Distance for inter-area routes\n")
6638 struct ospf
*ospf
= vty
->index
;
6640 ospf
->distance_external
= atoi (argv
[0]);
6641 ospf
->distance_intra
= atoi (argv
[1]);
6642 ospf
->distance_inter
= atoi (argv
[2]);
6647 DEFUN (ospf_distance_ospf_external_inter_intra
,
6648 ospf_distance_ospf_external_inter_intra_cmd
,
6649 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6650 "Define an administrative distance\n"
6651 "OSPF Administrative distance\n"
6653 "Distance for external routes\n"
6654 "Inter-area routes\n"
6655 "Distance for inter-area routes\n"
6656 "Intra-area routes\n"
6657 "Distance for intra-area routes\n")
6659 struct ospf
*ospf
= vty
->index
;
6661 ospf
->distance_external
= atoi (argv
[0]);
6662 ospf
->distance_inter
= atoi (argv
[1]);
6663 ospf
->distance_intra
= atoi (argv
[2]);
6668 DEFUN (ospf_distance_source
,
6669 ospf_distance_source_cmd
,
6670 "distance <1-255> A.B.C.D/M",
6671 "Administrative distance\n"
6673 "IP source prefix\n")
6675 struct ospf
*ospf
= vty
->index
;
6677 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], NULL
);
6682 DEFUN (no_ospf_distance_source
,
6683 no_ospf_distance_source_cmd
,
6684 "no distance <1-255> A.B.C.D/M",
6686 "Administrative distance\n"
6688 "IP source prefix\n")
6690 struct ospf
*ospf
= vty
->index
;
6692 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], NULL
);
6697 DEFUN (ospf_distance_source_access_list
,
6698 ospf_distance_source_access_list_cmd
,
6699 "distance <1-255> A.B.C.D/M WORD",
6700 "Administrative distance\n"
6702 "IP source prefix\n"
6703 "Access list name\n")
6705 struct ospf
*ospf
= vty
->index
;
6707 ospf_distance_set (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6712 DEFUN (no_ospf_distance_source_access_list
,
6713 no_ospf_distance_source_access_list_cmd
,
6714 "no distance <1-255> A.B.C.D/M WORD",
6716 "Administrative distance\n"
6718 "IP source prefix\n"
6719 "Access list name\n")
6721 struct ospf
*ospf
= vty
->index
;
6723 ospf_distance_unset (vty
, ospf
, argv
[0], argv
[1], argv
[2]);
6728 DEFUN (ip_ospf_mtu_ignore
,
6729 ip_ospf_mtu_ignore_addr_cmd
,
6730 "ip ospf mtu-ignore A.B.C.D",
6732 "OSPF interface commands\n"
6733 "Disable mtu mismatch detection\n"
6734 "Address of interface")
6736 struct interface
*ifp
= vty
->index
;
6737 struct in_addr addr
;
6740 struct ospf_if_params
*params
;
6741 params
= IF_DEF_PARAMS (ifp
);
6745 ret
= inet_aton(argv
[0], &addr
);
6748 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6752 params
= ospf_get_if_params (ifp
, addr
);
6753 ospf_if_update_params (ifp
, addr
);
6755 params
->mtu_ignore
= 1;
6756 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
6757 SET_IF_PARAM (params
, mtu_ignore
);
6760 UNSET_IF_PARAM (params
, mtu_ignore
);
6761 if (params
!= IF_DEF_PARAMS (ifp
))
6763 ospf_free_if_params (ifp
, addr
);
6764 ospf_if_update_params (ifp
, addr
);
6770 ALIAS (ip_ospf_mtu_ignore
,
6771 ip_ospf_mtu_ignore_cmd
,
6772 "ip ospf mtu-ignore",
6774 "OSPF interface commands\n"
6775 "Disable mtu mismatch detection\n")
6778 DEFUN (no_ip_ospf_mtu_ignore
,
6779 no_ip_ospf_mtu_ignore_addr_cmd
,
6780 "no ip ospf mtu-ignore A.B.C.D",
6782 "OSPF interface commands\n"
6783 "Disable mtu mismatch detection\n"
6784 "Address of interface")
6786 struct interface
*ifp
= vty
->index
;
6787 struct in_addr addr
;
6790 struct ospf_if_params
*params
;
6791 params
= IF_DEF_PARAMS (ifp
);
6795 ret
= inet_aton(argv
[0], &addr
);
6798 vty_out (vty
, "Please specify interface address by A.B.C.D%s",
6802 params
= ospf_get_if_params (ifp
, addr
);
6803 ospf_if_update_params (ifp
, addr
);
6805 params
->mtu_ignore
= 0;
6806 if (params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
6807 SET_IF_PARAM (params
, mtu_ignore
);
6810 UNSET_IF_PARAM (params
, mtu_ignore
);
6811 if (params
!= IF_DEF_PARAMS (ifp
))
6813 ospf_free_if_params (ifp
, addr
);
6814 ospf_if_update_params (ifp
, addr
);
6820 ALIAS (no_ip_ospf_mtu_ignore
,
6821 no_ip_ospf_mtu_ignore_cmd
,
6822 "no ip ospf mtu-ignore",
6824 "OSPF interface commands\n"
6825 "Disable mtu mismatch detection\n")
6827 DEFUN (ospf_max_metric_router_lsa_admin
,
6828 ospf_max_metric_router_lsa_admin_cmd
,
6829 "max-metric router-lsa administrative",
6830 "OSPF maximum / infinite-distance metric\n"
6831 "Advertise own Router-LSA with infinite distance (stub router)\n"
6832 "Administratively applied, for an indefinite period\n")
6834 struct listnode
*ln
;
6835 struct ospf_area
*area
;
6836 struct ospf
*ospf
= vty
->index
;
6838 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
6840 SET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
6842 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
))
6843 ospf_router_lsa_timer_add (area
);
6848 DEFUN (no_ospf_max_metric_router_lsa_admin
,
6849 no_ospf_max_metric_router_lsa_admin_cmd
,
6850 "no max-metric router-lsa administrative",
6852 "OSPF maximum / infinite-distance metric\n"
6853 "Advertise own Router-LSA with infinite distance (stub router)\n"
6854 "Administratively applied, for an indefinite period\n")
6856 struct listnode
*ln
;
6857 struct ospf_area
*area
;
6858 struct ospf
*ospf
= vty
->index
;
6860 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
6862 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
);
6864 /* Don't trample on the start-up stub timer */
6865 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
)
6866 && !area
->t_stub_router
)
6868 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
6869 ospf_router_lsa_timer_add (area
);
6875 DEFUN (ospf_max_metric_router_lsa_startup
,
6876 ospf_max_metric_router_lsa_startup_cmd
,
6877 "max-metric router-lsa on-startup <5-86400>",
6878 "OSPF maximum / infinite-distance metric\n"
6879 "Advertise own Router-LSA with infinite distance (stub router)\n"
6880 "Automatically advertise stub Router-LSA on startup of OSPF\n"
6881 "Time (seconds) to advertise self as stub-router\n")
6883 unsigned int seconds
;
6884 struct ospf
*ospf
= vty
->index
;
6888 vty_out (vty
, "%% Must supply stub-router period");
6892 VTY_GET_INTEGER ("stub-router startup period", seconds
, argv
[0]);
6894 ospf
->stub_router_startup_time
= seconds
;
6899 DEFUN (no_ospf_max_metric_router_lsa_startup
,
6900 no_ospf_max_metric_router_lsa_startup_cmd
,
6901 "no max-metric router-lsa on-startup",
6903 "OSPF maximum / infinite-distance metric\n"
6904 "Advertise own Router-LSA with infinite distance (stub router)\n"
6905 "Automatically advertise stub Router-LSA on startup of OSPF\n")
6907 struct listnode
*ln
;
6908 struct ospf_area
*area
;
6909 struct ospf
*ospf
= vty
->index
;
6911 ospf
->stub_router_startup_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
6913 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
6915 SET_FLAG (area
->stub_router_state
, OSPF_AREA_WAS_START_STUB_ROUTED
);
6916 OSPF_TIMER_OFF (area
->t_stub_router
);
6918 /* Don't trample on admin stub routed */
6919 if (!CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
6921 UNSET_FLAG (area
->stub_router_state
, OSPF_AREA_IS_STUB_ROUTED
);
6922 ospf_router_lsa_timer_add (area
);
6928 DEFUN (ospf_max_metric_router_lsa_shutdown
,
6929 ospf_max_metric_router_lsa_shutdown_cmd
,
6930 "max-metric router-lsa on-shutdown <5-86400>",
6931 "OSPF maximum / infinite-distance metric\n"
6932 "Advertise own Router-LSA with infinite distance (stub router)\n"
6933 "Advertise stub-router prior to full shutdown of OSPF\n"
6934 "Time (seconds) to wait till full shutdown\n")
6936 unsigned int seconds
;
6937 struct ospf
*ospf
= vty
->index
;
6941 vty_out (vty
, "%% Must supply stub-router shutdown period");
6945 VTY_GET_INTEGER ("stub-router shutdown wait period", seconds
, argv
[0]);
6947 ospf
->stub_router_shutdown_time
= seconds
;
6952 DEFUN (no_ospf_max_metric_router_lsa_shutdown
,
6953 no_ospf_max_metric_router_lsa_shutdown_cmd
,
6954 "no max-metric router-lsa on-shutdown",
6956 "OSPF maximum / infinite-distance metric\n"
6957 "Advertise own Router-LSA with infinite distance (stub router)\n"
6958 "Advertise stub-router prior to full shutdown of OSPF\n")
6960 struct ospf
*ospf
= vty
->index
;
6962 ospf
->stub_router_shutdown_time
= OSPF_STUB_ROUTER_UNCONFIGURED
;
6968 config_write_stub_router (struct vty
*vty
, struct ospf
*ospf
)
6970 struct listnode
*ln
;
6971 struct ospf_area
*area
;
6973 if (ospf
->stub_router_startup_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
6974 vty_out (vty
, " max-metric router-lsa on-startup %u%s",
6975 ospf
->stub_router_startup_time
, VTY_NEWLINE
);
6976 if (ospf
->stub_router_shutdown_time
!= OSPF_STUB_ROUTER_UNCONFIGURED
)
6977 vty_out (vty
, " max-metric router-lsa on-shutdown %u%s",
6978 ospf
->stub_router_shutdown_time
, VTY_NEWLINE
);
6979 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, ln
, area
))
6981 if (CHECK_FLAG (area
->stub_router_state
, OSPF_AREA_ADMIN_STUB_ROUTED
))
6983 vty_out (vty
, " max-metric router-lsa administrative%s",
6992 show_ip_ospf_route_network (struct vty
*vty
, struct route_table
*rt
)
6994 struct route_node
*rn
;
6995 struct ospf_route
*or;
6996 struct listnode
*pnode
, *pnnode
;
6997 struct ospf_path
*path
;
6999 vty_out (vty
, "============ OSPF network routing table ============%s",
7002 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
7003 if ((or = rn
->info
) != NULL
)
7006 snprintf (buf1
, 19, "%s/%d",
7007 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
7009 switch (or->path_type
)
7011 case OSPF_PATH_INTER_AREA
:
7012 if (or->type
== OSPF_DESTINATION_NETWORK
)
7013 vty_out (vty
, "N IA %-18s [%d] area: %s%s", buf1
, or->cost
,
7014 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
7015 else if (or->type
== OSPF_DESTINATION_DISCARD
)
7016 vty_out (vty
, "D IA %-18s Discard entry%s", buf1
, VTY_NEWLINE
);
7018 case OSPF_PATH_INTRA_AREA
:
7019 vty_out (vty
, "N %-18s [%d] area: %s%s", buf1
, or->cost
,
7020 inet_ntoa (or->u
.std
.area_id
), VTY_NEWLINE
);
7026 if (or->type
== OSPF_DESTINATION_NETWORK
)
7027 for (ALL_LIST_ELEMENTS (or->paths
, pnode
, pnnode
, path
))
7029 if (path
->oi
!= NULL
&& ospf_if_exists(path
->oi
))
7031 if (path
->nexthop
.s_addr
== 0)
7032 vty_out (vty
, "%24s directly attached to %s%s",
7033 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
7035 vty_out (vty
, "%24s via %s, %s%s", "",
7036 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
7041 vty_out (vty
, "%s", VTY_NEWLINE
);
7045 show_ip_ospf_route_router (struct vty
*vty
, struct route_table
*rtrs
)
7047 struct route_node
*rn
;
7048 struct ospf_route
*or;
7049 struct listnode
*pnode
;
7050 struct listnode
*node
;
7051 struct ospf_path
*path
;
7053 vty_out (vty
, "============ OSPF router routing table =============%s",
7055 for (rn
= route_top (rtrs
); rn
; rn
= route_next (rn
))
7060 vty_out (vty
, "R %-15s ", inet_ntoa (rn
->p
.u
.prefix4
));
7062 for (ALL_LIST_ELEMENTS_RO ((struct list
*)rn
->info
, node
, or))
7065 vty_out (vty
, "%24s", "");
7068 vty_out (vty
, "%s [%d] area: %s",
7069 (or->path_type
== OSPF_PATH_INTER_AREA
? "IA" : " "),
7070 or->cost
, inet_ntoa (or->u
.std
.area_id
));
7072 vty_out (vty
, "%s%s%s",
7073 (or->u
.std
.flags
& ROUTER_LSA_BORDER
? ", ABR" : ""),
7074 (or->u
.std
.flags
& ROUTER_LSA_EXTERNAL
? ", ASBR" : ""),
7077 for (ALL_LIST_ELEMENTS_RO (or->paths
, pnode
, path
))
7079 if (path
->oi
!= NULL
&& ospf_if_exists(path
->oi
))
7081 if (path
->nexthop
.s_addr
== 0)
7082 vty_out (vty
, "%24s directly attached to %s%s",
7083 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
7085 vty_out (vty
, "%24s via %s, %s%s", "",
7086 inet_ntoa (path
->nexthop
),
7087 path
->oi
->ifp
->name
, VTY_NEWLINE
);
7092 vty_out (vty
, "%s", VTY_NEWLINE
);
7096 show_ip_ospf_route_external (struct vty
*vty
, struct route_table
*rt
)
7098 struct route_node
*rn
;
7099 struct ospf_route
*er
;
7100 struct listnode
*pnode
, *pnnode
;
7101 struct ospf_path
*path
;
7103 vty_out (vty
, "============ OSPF external routing table ===========%s",
7105 for (rn
= route_top (rt
); rn
; rn
= route_next (rn
))
7106 if ((er
= rn
->info
) != NULL
)
7109 snprintf (buf1
, 19, "%s/%d",
7110 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
);
7112 switch (er
->path_type
)
7114 case OSPF_PATH_TYPE1_EXTERNAL
:
7115 vty_out (vty
, "N E1 %-18s [%d] tag: %u%s", buf1
,
7116 er
->cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
7118 case OSPF_PATH_TYPE2_EXTERNAL
:
7119 vty_out (vty
, "N E2 %-18s [%d/%d] tag: %u%s", buf1
, er
->cost
,
7120 er
->u
.ext
.type2_cost
, er
->u
.ext
.tag
, VTY_NEWLINE
);
7124 for (ALL_LIST_ELEMENTS (er
->paths
, pnode
, pnnode
, path
))
7126 if (path
->oi
!= NULL
&& ospf_if_exists(path
->oi
))
7128 if (path
->nexthop
.s_addr
== 0)
7129 vty_out (vty
, "%24s directly attached to %s%s",
7130 "", path
->oi
->ifp
->name
, VTY_NEWLINE
);
7132 vty_out (vty
, "%24s via %s, %s%s", "",
7133 inet_ntoa (path
->nexthop
), path
->oi
->ifp
->name
,
7138 vty_out (vty
, "%s", VTY_NEWLINE
);
7141 DEFUN (show_ip_ospf_border_routers
,
7142 show_ip_ospf_border_routers_cmd
,
7143 "show ip ospf border-routers",
7146 "show all the ABR's and ASBR's\n"
7151 if ((ospf
= ospf_lookup ()) == NULL
)
7153 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
7157 if (ospf
->new_table
== NULL
)
7159 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
7163 /* Show Network routes.
7164 show_ip_ospf_route_network (vty, ospf->new_table); */
7166 /* Show Router routes. */
7167 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
7172 DEFUN (show_ip_ospf_route
,
7173 show_ip_ospf_route_cmd
,
7174 "show ip ospf route",
7177 "OSPF information\n"
7178 "OSPF routing table\n")
7182 if ((ospf
= ospf_lookup ()) == NULL
)
7184 vty_out (vty
, " OSPF Routing Process not enabled%s", VTY_NEWLINE
);
7188 if (ospf
->new_table
== NULL
)
7190 vty_out (vty
, "No OSPF routing information exist%s", VTY_NEWLINE
);
7194 /* Show Network routes. */
7195 show_ip_ospf_route_network (vty
, ospf
->new_table
);
7197 /* Show Router routes. */
7198 show_ip_ospf_route_router (vty
, ospf
->new_rtrs
);
7200 /* Show AS External routes. */
7201 show_ip_ospf_route_external (vty
, ospf
->old_external_route
);
7207 const char *ospf_abr_type_str
[] =
7216 const char *ospf_shortcut_mode_str
[] =
7225 area_id2str (char *buf
, int length
, struct ospf_area
*area
)
7227 memset (buf
, 0, length
);
7229 if (area
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7230 strncpy (buf
, inet_ntoa (area
->area_id
), length
);
7232 sprintf (buf
, "%lu", (unsigned long) ntohl (area
->area_id
.s_addr
));
7236 const char *ospf_int_type_str
[] =
7238 "unknown", /* should never be used. */
7242 "point-to-multipoint",
7243 "virtual-link", /* should never be used. */
7247 /* Configuration write function for ospfd. */
7249 config_write_interface (struct vty
*vty
)
7251 struct listnode
*n1
, *n2
;
7252 struct interface
*ifp
;
7253 struct crypt_key
*ck
;
7255 struct route_node
*rn
= NULL
;
7256 struct ospf_if_params
*params
;
7258 for (ALL_LIST_ELEMENTS_RO (iflist
, n1
, ifp
))
7260 if (memcmp (ifp
->name
, "VLINK", 5) == 0)
7263 vty_out (vty
, "!%s", VTY_NEWLINE
);
7264 vty_out (vty
, "interface %s%s", ifp
->name
,
7267 vty_out (vty
, " description %s%s", ifp
->desc
,
7272 params
= IF_DEF_PARAMS (ifp
);
7275 /* Interface Network print. */
7276 if (OSPF_IF_PARAM_CONFIGURED (params
, type
) &&
7277 params
->type
!= OSPF_IFTYPE_LOOPBACK
)
7279 if (params
->type
!= ospf_default_iftype(ifp
))
7281 vty_out (vty
, " ip ospf network %s",
7282 ospf_int_type_str
[params
->type
]);
7283 if (params
!= IF_DEF_PARAMS (ifp
))
7284 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7285 vty_out (vty
, "%s", VTY_NEWLINE
);
7289 /* OSPF interface authentication print */
7290 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_type
) &&
7291 params
->auth_type
!= OSPF_AUTH_NOTSET
)
7293 const char *auth_str
;
7295 /* Translation tables are not that much help here due to syntax
7296 of the simple option */
7297 switch (params
->auth_type
)
7300 case OSPF_AUTH_NULL
:
7304 case OSPF_AUTH_SIMPLE
:
7308 case OSPF_AUTH_CRYPTOGRAPHIC
:
7309 auth_str
= " message-digest";
7317 vty_out (vty
, " ip ospf authentication%s", auth_str
);
7318 if (params
!= IF_DEF_PARAMS (ifp
))
7319 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7320 vty_out (vty
, "%s", VTY_NEWLINE
);
7323 /* Simple Authentication Password print. */
7324 if (OSPF_IF_PARAM_CONFIGURED (params
, auth_simple
) &&
7325 params
->auth_simple
[0] != '\0')
7327 vty_out (vty
, " ip ospf authentication-key %s",
7328 params
->auth_simple
);
7329 if (params
!= IF_DEF_PARAMS (ifp
))
7330 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7331 vty_out (vty
, "%s", VTY_NEWLINE
);
7334 /* Cryptographic Authentication Key print. */
7335 for (ALL_LIST_ELEMENTS_RO (params
->auth_crypt
, n2
, ck
))
7337 vty_out (vty
, " ip ospf message-digest-key %d md5 %s",
7338 ck
->key_id
, ck
->auth_key
);
7339 if (params
!= IF_DEF_PARAMS (ifp
))
7340 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7341 vty_out (vty
, "%s", VTY_NEWLINE
);
7344 /* Interface Output Cost print. */
7345 if (OSPF_IF_PARAM_CONFIGURED (params
, output_cost_cmd
))
7347 vty_out (vty
, " ip ospf cost %u", params
->output_cost_cmd
);
7348 if (params
!= IF_DEF_PARAMS (ifp
))
7349 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7350 vty_out (vty
, "%s", VTY_NEWLINE
);
7353 /* Hello Interval print. */
7354 if (OSPF_IF_PARAM_CONFIGURED (params
, v_hello
) &&
7355 params
->v_hello
!= OSPF_HELLO_INTERVAL_DEFAULT
)
7357 vty_out (vty
, " ip ospf hello-interval %u", params
->v_hello
);
7358 if (params
!= IF_DEF_PARAMS (ifp
))
7359 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7360 vty_out (vty
, "%s", VTY_NEWLINE
);
7364 /* Router Dead Interval print. */
7365 if (OSPF_IF_PARAM_CONFIGURED (params
, v_wait
) &&
7366 params
->v_wait
!= OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
)
7368 vty_out (vty
, " ip ospf dead-interval ");
7371 if (OSPF_IF_PARAM_CONFIGURED (params
, fast_hello
))
7372 vty_out (vty
, "minimal hello-multiplier %d",
7373 params
->fast_hello
);
7375 vty_out (vty
, "%u", params
->v_wait
);
7377 if (params
!= IF_DEF_PARAMS (ifp
))
7378 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7379 vty_out (vty
, "%s", VTY_NEWLINE
);
7382 /* Router Priority print. */
7383 if (OSPF_IF_PARAM_CONFIGURED (params
, priority
) &&
7384 params
->priority
!= OSPF_ROUTER_PRIORITY_DEFAULT
)
7386 vty_out (vty
, " ip ospf priority %u", params
->priority
);
7387 if (params
!= IF_DEF_PARAMS (ifp
))
7388 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7389 vty_out (vty
, "%s", VTY_NEWLINE
);
7392 /* Retransmit Interval print. */
7393 if (OSPF_IF_PARAM_CONFIGURED (params
, retransmit_interval
) &&
7394 params
->retransmit_interval
!= OSPF_RETRANSMIT_INTERVAL_DEFAULT
)
7396 vty_out (vty
, " ip ospf retransmit-interval %u",
7397 params
->retransmit_interval
);
7398 if (params
!= IF_DEF_PARAMS (ifp
))
7399 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7400 vty_out (vty
, "%s", VTY_NEWLINE
);
7403 /* Transmit Delay print. */
7404 if (OSPF_IF_PARAM_CONFIGURED (params
, transmit_delay
) &&
7405 params
->transmit_delay
!= OSPF_TRANSMIT_DELAY_DEFAULT
)
7407 vty_out (vty
, " ip ospf transmit-delay %u", params
->transmit_delay
);
7408 if (params
!= IF_DEF_PARAMS (ifp
))
7409 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7410 vty_out (vty
, "%s", VTY_NEWLINE
);
7413 /* MTU ignore print. */
7414 if (OSPF_IF_PARAM_CONFIGURED (params
, mtu_ignore
) &&
7415 params
->mtu_ignore
!= OSPF_MTU_IGNORE_DEFAULT
)
7417 if (params
->mtu_ignore
== 0)
7418 vty_out (vty
, " no ip ospf mtu-ignore");
7420 vty_out (vty
, " ip ospf mtu-ignore");
7421 if (params
!= IF_DEF_PARAMS (ifp
))
7422 vty_out (vty
, " %s", inet_ntoa (rn
->p
.u
.prefix4
));
7423 vty_out (vty
, "%s", VTY_NEWLINE
);
7430 rn
= route_top (IF_OIFS_PARAMS (ifp
));
7432 rn
= route_next (rn
);
7442 #ifdef HAVE_OPAQUE_LSA
7443 ospf_opaque_config_write_if (vty
, ifp
);
7444 #endif /* HAVE_OPAQUE_LSA */
7451 config_write_network_area (struct vty
*vty
, struct ospf
*ospf
)
7453 struct route_node
*rn
;
7454 u_char buf
[INET_ADDRSTRLEN
];
7456 /* `network area' print. */
7457 for (rn
= route_top (ospf
->networks
); rn
; rn
= route_next (rn
))
7460 struct ospf_network
*n
= rn
->info
;
7462 memset (buf
, 0, INET_ADDRSTRLEN
);
7464 /* Create Area ID string by specified Area ID format. */
7465 if (n
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7466 strncpy ((char *) buf
, inet_ntoa (n
->area_id
), INET_ADDRSTRLEN
);
7468 sprintf ((char *) buf
, "%lu",
7469 (unsigned long int) ntohl (n
->area_id
.s_addr
));
7471 /* Network print. */
7472 vty_out (vty
, " network %s/%d area %s%s",
7473 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7481 config_write_ospf_area (struct vty
*vty
, struct ospf
*ospf
)
7483 struct listnode
*node
;
7484 struct ospf_area
*area
;
7485 u_char buf
[INET_ADDRSTRLEN
];
7487 /* Area configuration print. */
7488 for (ALL_LIST_ELEMENTS_RO (ospf
->areas
, node
, area
))
7490 struct route_node
*rn1
;
7492 area_id2str ((char *) buf
, INET_ADDRSTRLEN
, area
);
7494 if (area
->auth_type
!= OSPF_AUTH_NULL
)
7496 if (area
->auth_type
== OSPF_AUTH_SIMPLE
)
7497 vty_out (vty
, " area %s authentication%s", buf
, VTY_NEWLINE
);
7499 vty_out (vty
, " area %s authentication message-digest%s",
7503 if (area
->shortcut_configured
!= OSPF_SHORTCUT_DEFAULT
)
7504 vty_out (vty
, " area %s shortcut %s%s", buf
,
7505 ospf_shortcut_mode_str
[area
->shortcut_configured
],
7508 if ((area
->external_routing
== OSPF_AREA_STUB
)
7509 || (area
->external_routing
== OSPF_AREA_NSSA
)
7512 if (area
->external_routing
== OSPF_AREA_STUB
)
7513 vty_out (vty
, " area %s stub", buf
);
7514 else if (area
->external_routing
== OSPF_AREA_NSSA
)
7516 vty_out (vty
, " area %s nssa", buf
);
7517 switch (area
->NSSATranslatorRole
)
7519 case OSPF_NSSA_ROLE_NEVER
:
7520 vty_out (vty
, " translate-never");
7522 case OSPF_NSSA_ROLE_ALWAYS
:
7523 vty_out (vty
, " translate-always");
7525 case OSPF_NSSA_ROLE_CANDIDATE
:
7527 vty_out (vty
, " translate-candidate");
7531 if (area
->no_summary
)
7532 vty_out (vty
, " no-summary");
7534 vty_out (vty
, "%s", VTY_NEWLINE
);
7536 if (area
->default_cost
!= 1)
7537 vty_out (vty
, " area %s default-cost %d%s", buf
,
7538 area
->default_cost
, VTY_NEWLINE
);
7541 for (rn1
= route_top (area
->ranges
); rn1
; rn1
= route_next (rn1
))
7544 struct ospf_area_range
*range
= rn1
->info
;
7546 vty_out (vty
, " area %s range %s/%d", buf
,
7547 inet_ntoa (rn1
->p
.u
.prefix4
), rn1
->p
.prefixlen
);
7549 if (range
->cost_config
!= OSPF_AREA_RANGE_COST_UNSPEC
)
7550 vty_out (vty
, " cost %d", range
->cost_config
);
7552 if (!CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_ADVERTISE
))
7553 vty_out (vty
, " not-advertise");
7555 if (CHECK_FLAG (range
->flags
, OSPF_AREA_RANGE_SUBSTITUTE
))
7556 vty_out (vty
, " substitute %s/%d",
7557 inet_ntoa (range
->subst_addr
), range
->subst_masklen
);
7559 vty_out (vty
, "%s", VTY_NEWLINE
);
7562 if (EXPORT_NAME (area
))
7563 vty_out (vty
, " area %s export-list %s%s", buf
,
7564 EXPORT_NAME (area
), VTY_NEWLINE
);
7566 if (IMPORT_NAME (area
))
7567 vty_out (vty
, " area %s import-list %s%s", buf
,
7568 IMPORT_NAME (area
), VTY_NEWLINE
);
7570 if (PREFIX_NAME_IN (area
))
7571 vty_out (vty
, " area %s filter-list prefix %s in%s", buf
,
7572 PREFIX_NAME_IN (area
), VTY_NEWLINE
);
7574 if (PREFIX_NAME_OUT (area
))
7575 vty_out (vty
, " area %s filter-list prefix %s out%s", buf
,
7576 PREFIX_NAME_OUT (area
), VTY_NEWLINE
);
7583 config_write_ospf_nbr_nbma (struct vty
*vty
, struct ospf
*ospf
)
7585 struct ospf_nbr_nbma
*nbr_nbma
;
7586 struct route_node
*rn
;
7588 /* Static Neighbor configuration print. */
7589 for (rn
= route_top (ospf
->nbr_nbma
); rn
; rn
= route_next (rn
))
7590 if ((nbr_nbma
= rn
->info
))
7592 vty_out (vty
, " neighbor %s", inet_ntoa (nbr_nbma
->addr
));
7594 if (nbr_nbma
->priority
!= OSPF_NEIGHBOR_PRIORITY_DEFAULT
)
7595 vty_out (vty
, " priority %d", nbr_nbma
->priority
);
7597 if (nbr_nbma
->v_poll
!= OSPF_POLL_INTERVAL_DEFAULT
)
7598 vty_out (vty
, " poll-interval %d", nbr_nbma
->v_poll
);
7600 vty_out (vty
, "%s", VTY_NEWLINE
);
7607 config_write_virtual_link (struct vty
*vty
, struct ospf
*ospf
)
7609 struct listnode
*node
;
7610 struct ospf_vl_data
*vl_data
;
7611 u_char buf
[INET_ADDRSTRLEN
];
7613 /* Virtual-Link print */
7614 for (ALL_LIST_ELEMENTS_RO (ospf
->vlinks
, node
, vl_data
))
7616 struct listnode
*n2
;
7617 struct crypt_key
*ck
;
7618 struct ospf_interface
*oi
;
7620 if (vl_data
!= NULL
)
7622 memset (buf
, 0, INET_ADDRSTRLEN
);
7624 if (vl_data
->format
== OSPF_AREA_ID_FORMAT_ADDRESS
)
7625 strncpy ((char *) buf
, inet_ntoa (vl_data
->vl_area_id
), INET_ADDRSTRLEN
);
7627 sprintf ((char *) buf
, "%lu",
7628 (unsigned long int) ntohl (vl_data
->vl_area_id
.s_addr
));
7629 oi
= vl_data
->vl_oi
;
7632 if (OSPF_IF_PARAM (oi
, v_hello
) != OSPF_HELLO_INTERVAL_DEFAULT
||
7633 OSPF_IF_PARAM (oi
, v_wait
) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT
||
7634 OSPF_IF_PARAM (oi
, retransmit_interval
) != OSPF_RETRANSMIT_INTERVAL_DEFAULT
||
7635 OSPF_IF_PARAM (oi
, transmit_delay
) != OSPF_TRANSMIT_DELAY_DEFAULT
)
7636 vty_out (vty
, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7638 inet_ntoa (vl_data
->vl_peer
),
7639 OSPF_IF_PARAM (oi
, v_hello
),
7640 OSPF_IF_PARAM (oi
, retransmit_interval
),
7641 OSPF_IF_PARAM (oi
, transmit_delay
),
7642 OSPF_IF_PARAM (oi
, v_wait
),
7645 vty_out (vty
, " area %s virtual-link %s%s", buf
,
7646 inet_ntoa (vl_data
->vl_peer
), VTY_NEWLINE
);
7648 if (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
[0] != '\0')
7649 vty_out (vty
, " area %s virtual-link %s authentication-key %s%s",
7651 inet_ntoa (vl_data
->vl_peer
),
7652 IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_simple
,
7655 for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data
->vl_oi
->ifp
)->auth_crypt
,
7657 vty_out (vty
, " area %s virtual-link %s"
7658 " message-digest-key %d md5 %s%s",
7660 inet_ntoa (vl_data
->vl_peer
),
7661 ck
->key_id
, ck
->auth_key
, VTY_NEWLINE
);
7671 config_write_ospf_redistribute (struct vty
*vty
, struct ospf
*ospf
)
7675 /* redistribute print. */
7676 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7677 if (type
!= zclient
->redist_default
&& zclient
->redist
[type
])
7679 vty_out (vty
, " redistribute %s", zebra_route_string(type
));
7680 if (ospf
->dmetric
[type
].value
>= 0)
7681 vty_out (vty
, " metric %d", ospf
->dmetric
[type
].value
);
7683 if (ospf
->dmetric
[type
].type
== EXTERNAL_METRIC_TYPE_1
)
7684 vty_out (vty
, " metric-type 1");
7686 if (ROUTEMAP_NAME (ospf
, type
))
7687 vty_out (vty
, " route-map %s", ROUTEMAP_NAME (ospf
, type
));
7689 vty_out (vty
, "%s", VTY_NEWLINE
);
7696 config_write_ospf_default_metric (struct vty
*vty
, struct ospf
*ospf
)
7698 if (ospf
->default_metric
!= -1)
7699 vty_out (vty
, " default-metric %d%s", ospf
->default_metric
,
7705 config_write_ospf_distribute (struct vty
*vty
, struct ospf
*ospf
)
7711 /* distribute-list print. */
7712 for (type
= 0; type
< ZEBRA_ROUTE_MAX
; type
++)
7713 if (ospf
->dlist
[type
].name
)
7714 vty_out (vty
, " distribute-list %s out %s%s",
7715 ospf
->dlist
[type
].name
,
7716 zebra_route_string(type
), VTY_NEWLINE
);
7718 /* default-information print. */
7719 if (ospf
->default_originate
!= DEFAULT_ORIGINATE_NONE
)
7721 vty_out (vty
, " default-information originate");
7722 if (ospf
->default_originate
== DEFAULT_ORIGINATE_ALWAYS
)
7723 vty_out (vty
, " always");
7725 if (ospf
->dmetric
[DEFAULT_ROUTE
].value
>= 0)
7726 vty_out (vty
, " metric %d",
7727 ospf
->dmetric
[DEFAULT_ROUTE
].value
);
7728 if (ospf
->dmetric
[DEFAULT_ROUTE
].type
== EXTERNAL_METRIC_TYPE_1
)
7729 vty_out (vty
, " metric-type 1");
7731 if (ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
))
7732 vty_out (vty
, " route-map %s",
7733 ROUTEMAP_NAME (ospf
, DEFAULT_ROUTE
));
7735 vty_out (vty
, "%s", VTY_NEWLINE
);
7744 config_write_ospf_distance (struct vty
*vty
, struct ospf
*ospf
)
7746 struct route_node
*rn
;
7747 struct ospf_distance
*odistance
;
7749 if (ospf
->distance_all
)
7750 vty_out (vty
, " distance %d%s", ospf
->distance_all
, VTY_NEWLINE
);
7752 if (ospf
->distance_intra
7753 || ospf
->distance_inter
7754 || ospf
->distance_external
)
7756 vty_out (vty
, " distance ospf");
7758 if (ospf
->distance_intra
)
7759 vty_out (vty
, " intra-area %d", ospf
->distance_intra
);
7760 if (ospf
->distance_inter
)
7761 vty_out (vty
, " inter-area %d", ospf
->distance_inter
);
7762 if (ospf
->distance_external
)
7763 vty_out (vty
, " external %d", ospf
->distance_external
);
7765 vty_out (vty
, "%s", VTY_NEWLINE
);
7768 for (rn
= route_top (ospf
->distance_table
); rn
; rn
= route_next (rn
))
7769 if ((odistance
= rn
->info
) != NULL
)
7771 vty_out (vty
, " distance %d %s/%d %s%s", odistance
->distance
,
7772 inet_ntoa (rn
->p
.u
.prefix4
), rn
->p
.prefixlen
,
7773 odistance
->access_list
? odistance
->access_list
: "",
7779 /* OSPF configuration write function. */
7781 ospf_config_write (struct vty
*vty
)
7784 struct interface
*ifp
;
7785 struct ospf_interface
*oi
;
7786 struct listnode
*node
;
7789 ospf
= ospf_lookup ();
7792 /* `router ospf' print. */
7793 vty_out (vty
, "router ospf%s", VTY_NEWLINE
);
7797 if (!ospf
->networks
)
7800 /* Router ID print. */
7801 if (ospf
->router_id_static
.s_addr
!= 0)
7802 vty_out (vty
, " ospf router-id %s%s",
7803 inet_ntoa (ospf
->router_id_static
), VTY_NEWLINE
);
7805 /* ABR type print. */
7806 if (ospf
->abr_type
!= OSPF_ABR_DEFAULT
)
7807 vty_out (vty
, " ospf abr-type %s%s",
7808 ospf_abr_type_str
[ospf
->abr_type
], VTY_NEWLINE
);
7810 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
7811 if (CHECK_FLAG (ospf
->config
, OSPF_RFC1583_COMPATIBLE
))
7812 vty_out (vty
, " compatible rfc1583%s", VTY_NEWLINE
);
7814 /* auto-cost reference-bandwidth configuration. */
7815 if (ospf
->ref_bandwidth
!= OSPF_DEFAULT_REF_BANDWIDTH
)
7817 vty_out (vty
, "! Important: ensure reference bandwidth "
7818 "is consistent across all routers%s", VTY_NEWLINE
);
7819 vty_out (vty
, " auto-cost reference-bandwidth %d%s",
7820 ospf
->ref_bandwidth
/ 1000, VTY_NEWLINE
);
7823 /* SPF timers print. */
7824 if (ospf
->spf_delay
!= OSPF_SPF_DELAY_DEFAULT
||
7825 ospf
->spf_holdtime
!= OSPF_SPF_HOLDTIME_DEFAULT
||
7826 ospf
->spf_max_holdtime
!= OSPF_SPF_MAX_HOLDTIME_DEFAULT
)
7827 vty_out (vty
, " timers throttle spf %d %d %d%s",
7828 ospf
->spf_delay
, ospf
->spf_holdtime
,
7829 ospf
->spf_max_holdtime
, VTY_NEWLINE
);
7831 /* Max-metric router-lsa print */
7832 config_write_stub_router (vty
, ospf
);
7834 /* SPF refresh parameters print. */
7835 if (ospf
->lsa_refresh_interval
!= OSPF_LSA_REFRESH_INTERVAL_DEFAULT
)
7836 vty_out (vty
, " refresh timer %d%s",
7837 ospf
->lsa_refresh_interval
, VTY_NEWLINE
);
7839 /* Redistribute information print. */
7840 config_write_ospf_redistribute (vty
, ospf
);
7842 /* passive-interface print. */
7843 for (ALL_LIST_ELEMENTS_RO (om
->iflist
, node
, ifp
))
7844 if (IF_DEF_PARAMS (ifp
)->passive_interface
== OSPF_IF_PASSIVE
)
7845 vty_out (vty
, " passive-interface %s%s",
7846 ifp
->name
, VTY_NEWLINE
);
7848 for (ALL_LIST_ELEMENTS_RO (ospf
->oiflist
, node
, oi
))
7849 if (OSPF_IF_PARAM_CONFIGURED (oi
->params
, passive_interface
) &&
7850 oi
->params
->passive_interface
== OSPF_IF_PASSIVE
)
7851 vty_out (vty
, " passive-interface %s %s%s",
7853 inet_ntoa (oi
->address
->u
.prefix4
), VTY_NEWLINE
);
7855 /* Network area print. */
7856 config_write_network_area (vty
, ospf
);
7858 /* Area config print. */
7859 config_write_ospf_area (vty
, ospf
);
7861 /* static neighbor print. */
7862 config_write_ospf_nbr_nbma (vty
, ospf
);
7864 /* Virtual-Link print. */
7865 config_write_virtual_link (vty
, ospf
);
7867 /* Default metric configuration. */
7868 config_write_ospf_default_metric (vty
, ospf
);
7870 /* Distribute-list and default-information print. */
7871 config_write_ospf_distribute (vty
, ospf
);
7873 /* Distance configuration. */
7874 config_write_ospf_distance (vty
, ospf
);
7876 #ifdef HAVE_OPAQUE_LSA
7877 ospf_opaque_config_write_router (vty
, ospf
);
7878 #endif /* HAVE_OPAQUE_LSA */
7885 ospf_vty_show_init (void)
7887 /* "show ip ospf" commands. */
7888 install_element (VIEW_NODE
, &show_ip_ospf_cmd
);
7889 install_element (ENABLE_NODE
, &show_ip_ospf_cmd
);
7891 /* "show ip ospf database" commands. */
7892 install_element (VIEW_NODE
, &show_ip_ospf_database_type_cmd
);
7893 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_cmd
);
7894 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7895 install_element (VIEW_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7896 install_element (VIEW_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7897 install_element (VIEW_NODE
, &show_ip_ospf_database_type_self_cmd
);
7898 install_element (VIEW_NODE
, &show_ip_ospf_database_cmd
);
7899 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_cmd
);
7900 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_cmd
);
7901 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_adv_router_cmd
);
7902 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_adv_router_cmd
);
7903 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_id_self_cmd
);
7904 install_element (ENABLE_NODE
, &show_ip_ospf_database_type_self_cmd
);
7905 install_element (ENABLE_NODE
, &show_ip_ospf_database_cmd
);
7907 /* "show ip ospf interface" commands. */
7908 install_element (VIEW_NODE
, &show_ip_ospf_interface_cmd
);
7909 install_element (ENABLE_NODE
, &show_ip_ospf_interface_cmd
);
7911 /* "show ip ospf neighbor" commands. */
7912 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7913 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7914 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7915 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7916 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7917 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_cmd
);
7918 install_element (VIEW_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7919 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_detail_cmd
);
7920 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_int_cmd
);
7921 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_id_cmd
);
7922 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_all_cmd
);
7923 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_detail_cmd
);
7924 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_cmd
);
7925 install_element (ENABLE_NODE
, &show_ip_ospf_neighbor_all_cmd
);
7927 /* "show ip ospf route" commands. */
7928 install_element (VIEW_NODE
, &show_ip_ospf_route_cmd
);
7929 install_element (ENABLE_NODE
, &show_ip_ospf_route_cmd
);
7930 install_element (VIEW_NODE
, &show_ip_ospf_border_routers_cmd
);
7931 install_element (ENABLE_NODE
, &show_ip_ospf_border_routers_cmd
);
7935 /* ospfd's interface node. */
7936 struct cmd_node interface_node
=
7943 /* Initialization of OSPF interface. */
7945 ospf_vty_if_init (void)
7947 /* Install interface node. */
7948 install_node (&interface_node
, config_write_interface
);
7950 install_element (CONFIG_NODE
, &interface_cmd
);
7951 install_element (CONFIG_NODE
, &no_interface_cmd
);
7952 install_default (INTERFACE_NODE
);
7954 /* "description" commands. */
7955 install_element (INTERFACE_NODE
, &interface_desc_cmd
);
7956 install_element (INTERFACE_NODE
, &no_interface_desc_cmd
);
7958 /* "ip ospf authentication" commands. */
7959 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_addr_cmd
);
7960 install_element (INTERFACE_NODE
, &ip_ospf_authentication_args_cmd
);
7961 install_element (INTERFACE_NODE
, &ip_ospf_authentication_addr_cmd
);
7962 install_element (INTERFACE_NODE
, &ip_ospf_authentication_cmd
);
7963 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_addr_cmd
);
7964 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_cmd
);
7965 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_addr_cmd
);
7966 install_element (INTERFACE_NODE
, &ip_ospf_authentication_key_cmd
);
7967 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_addr_cmd
);
7968 install_element (INTERFACE_NODE
, &no_ip_ospf_authentication_key_cmd
);
7970 /* "ip ospf message-digest-key" commands. */
7971 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_addr_cmd
);
7972 install_element (INTERFACE_NODE
, &ip_ospf_message_digest_key_cmd
);
7973 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_addr_cmd
);
7974 install_element (INTERFACE_NODE
, &no_ip_ospf_message_digest_key_cmd
);
7976 /* "ip ospf cost" commands. */
7977 install_element (INTERFACE_NODE
, &ip_ospf_cost_addr_cmd
);
7978 install_element (INTERFACE_NODE
, &ip_ospf_cost_cmd
);
7979 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_addr_cmd
);
7980 install_element (INTERFACE_NODE
, &no_ip_ospf_cost_cmd
);
7982 /* "ip ospf mtu-ignore" commands. */
7983 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_addr_cmd
);
7984 install_element (INTERFACE_NODE
, &ip_ospf_mtu_ignore_cmd
);
7985 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_addr_cmd
);
7986 install_element (INTERFACE_NODE
, &no_ip_ospf_mtu_ignore_cmd
);
7988 /* "ip ospf dead-interval" commands. */
7989 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_addr_cmd
);
7990 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_cmd
);
7991 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_addr_cmd
);
7992 install_element (INTERFACE_NODE
, &ip_ospf_dead_interval_minimal_cmd
);
7993 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_addr_cmd
);
7994 install_element (INTERFACE_NODE
, &no_ip_ospf_dead_interval_cmd
);
7996 /* "ip ospf hello-interval" commands. */
7997 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_addr_cmd
);
7998 install_element (INTERFACE_NODE
, &ip_ospf_hello_interval_cmd
);
7999 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_addr_cmd
);
8000 install_element (INTERFACE_NODE
, &no_ip_ospf_hello_interval_cmd
);
8002 /* "ip ospf network" commands. */
8003 install_element (INTERFACE_NODE
, &ip_ospf_network_cmd
);
8004 install_element (INTERFACE_NODE
, &no_ip_ospf_network_cmd
);
8006 /* "ip ospf priority" commands. */
8007 install_element (INTERFACE_NODE
, &ip_ospf_priority_addr_cmd
);
8008 install_element (INTERFACE_NODE
, &ip_ospf_priority_cmd
);
8009 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_addr_cmd
);
8010 install_element (INTERFACE_NODE
, &no_ip_ospf_priority_cmd
);
8012 /* "ip ospf retransmit-interval" commands. */
8013 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_addr_cmd
);
8014 install_element (INTERFACE_NODE
, &ip_ospf_retransmit_interval_cmd
);
8015 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_addr_cmd
);
8016 install_element (INTERFACE_NODE
, &no_ip_ospf_retransmit_interval_cmd
);
8018 /* "ip ospf transmit-delay" commands. */
8019 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_addr_cmd
);
8020 install_element (INTERFACE_NODE
, &ip_ospf_transmit_delay_cmd
);
8021 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_addr_cmd
);
8022 install_element (INTERFACE_NODE
, &no_ip_ospf_transmit_delay_cmd
);
8024 /* These commands are compatibitliy for previous version. */
8025 install_element (INTERFACE_NODE
, &ospf_authentication_key_cmd
);
8026 install_element (INTERFACE_NODE
, &no_ospf_authentication_key_cmd
);
8027 install_element (INTERFACE_NODE
, &ospf_message_digest_key_cmd
);
8028 install_element (INTERFACE_NODE
, &no_ospf_message_digest_key_cmd
);
8029 install_element (INTERFACE_NODE
, &ospf_cost_cmd
);
8030 install_element (INTERFACE_NODE
, &no_ospf_cost_cmd
);
8031 install_element (INTERFACE_NODE
, &ospf_dead_interval_cmd
);
8032 install_element (INTERFACE_NODE
, &no_ospf_dead_interval_cmd
);
8033 install_element (INTERFACE_NODE
, &ospf_hello_interval_cmd
);
8034 install_element (INTERFACE_NODE
, &no_ospf_hello_interval_cmd
);
8035 install_element (INTERFACE_NODE
, &ospf_network_cmd
);
8036 install_element (INTERFACE_NODE
, &no_ospf_network_cmd
);
8037 install_element (INTERFACE_NODE
, &ospf_priority_cmd
);
8038 install_element (INTERFACE_NODE
, &no_ospf_priority_cmd
);
8039 install_element (INTERFACE_NODE
, &ospf_retransmit_interval_cmd
);
8040 install_element (INTERFACE_NODE
, &no_ospf_retransmit_interval_cmd
);
8041 install_element (INTERFACE_NODE
, &ospf_transmit_delay_cmd
);
8042 install_element (INTERFACE_NODE
, &no_ospf_transmit_delay_cmd
);
8045 /* Zebra node structure. */
8046 struct cmd_node zebra_node
=
8049 "%s(config-router)#",
8053 ospf_vty_zebra_init (void)
8055 install_element (OSPF_NODE
, &ospf_redistribute_source_type_metric_cmd
);
8056 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_type_cmd
);
8057 install_element (OSPF_NODE
, &ospf_redistribute_source_type_cmd
);
8058 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_cmd
);
8059 install_element (OSPF_NODE
, &ospf_redistribute_source_cmd
);
8060 install_element (OSPF_NODE
,
8061 &ospf_redistribute_source_metric_type_routemap_cmd
);
8062 install_element (OSPF_NODE
,
8063 &ospf_redistribute_source_type_metric_routemap_cmd
);
8064 install_element (OSPF_NODE
, &ospf_redistribute_source_metric_routemap_cmd
);
8065 install_element (OSPF_NODE
, &ospf_redistribute_source_type_routemap_cmd
);
8066 install_element (OSPF_NODE
, &ospf_redistribute_source_routemap_cmd
);
8068 install_element (OSPF_NODE
, &no_ospf_redistribute_source_cmd
);
8070 install_element (OSPF_NODE
, &ospf_distribute_list_out_cmd
);
8071 install_element (OSPF_NODE
, &no_ospf_distribute_list_out_cmd
);
8073 install_element (OSPF_NODE
,
8074 &ospf_default_information_originate_metric_type_cmd
);
8075 install_element (OSPF_NODE
, &ospf_default_information_originate_metric_cmd
);
8076 install_element (OSPF_NODE
,
8077 &ospf_default_information_originate_type_metric_cmd
);
8078 install_element (OSPF_NODE
, &ospf_default_information_originate_type_cmd
);
8079 install_element (OSPF_NODE
, &ospf_default_information_originate_cmd
);
8080 install_element (OSPF_NODE
,
8081 &ospf_default_information_originate_always_metric_type_cmd
);
8082 install_element (OSPF_NODE
,
8083 &ospf_default_information_originate_always_metric_cmd
);
8084 install_element (OSPF_NODE
,
8085 &ospf_default_information_originate_always_cmd
);
8086 install_element (OSPF_NODE
,
8087 &ospf_default_information_originate_always_type_metric_cmd
);
8088 install_element (OSPF_NODE
,
8089 &ospf_default_information_originate_always_type_cmd
);
8091 install_element (OSPF_NODE
,
8092 &ospf_default_information_originate_metric_type_routemap_cmd
);
8093 install_element (OSPF_NODE
,
8094 &ospf_default_information_originate_metric_routemap_cmd
);
8095 install_element (OSPF_NODE
,
8096 &ospf_default_information_originate_routemap_cmd
);
8097 install_element (OSPF_NODE
,
8098 &ospf_default_information_originate_type_metric_routemap_cmd
);
8099 install_element (OSPF_NODE
,
8100 &ospf_default_information_originate_type_routemap_cmd
);
8101 install_element (OSPF_NODE
,
8102 &ospf_default_information_originate_always_metric_type_routemap_cmd
);
8103 install_element (OSPF_NODE
,
8104 &ospf_default_information_originate_always_metric_routemap_cmd
);
8105 install_element (OSPF_NODE
,
8106 &ospf_default_information_originate_always_routemap_cmd
);
8107 install_element (OSPF_NODE
,
8108 &ospf_default_information_originate_always_type_metric_routemap_cmd
);
8109 install_element (OSPF_NODE
,
8110 &ospf_default_information_originate_always_type_routemap_cmd
);
8112 install_element (OSPF_NODE
, &no_ospf_default_information_originate_cmd
);
8114 install_element (OSPF_NODE
, &ospf_default_metric_cmd
);
8115 install_element (OSPF_NODE
, &no_ospf_default_metric_cmd
);
8116 install_element (OSPF_NODE
, &no_ospf_default_metric_val_cmd
);
8118 install_element (OSPF_NODE
, &ospf_distance_cmd
);
8119 install_element (OSPF_NODE
, &no_ospf_distance_cmd
);
8120 install_element (OSPF_NODE
, &no_ospf_distance_ospf_cmd
);
8121 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_cmd
);
8122 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_cmd
);
8123 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_cmd
);
8124 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_inter_external_cmd
);
8125 install_element (OSPF_NODE
, &ospf_distance_ospf_intra_external_inter_cmd
);
8126 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_cmd
);
8127 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_cmd
);
8128 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_cmd
);
8129 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_intra_external_cmd
);
8130 install_element (OSPF_NODE
, &ospf_distance_ospf_inter_external_intra_cmd
);
8131 install_element (OSPF_NODE
, &ospf_distance_ospf_external_cmd
);
8132 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_cmd
);
8133 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_cmd
);
8134 install_element (OSPF_NODE
, &ospf_distance_ospf_external_intra_inter_cmd
);
8135 install_element (OSPF_NODE
, &ospf_distance_ospf_external_inter_intra_cmd
);
8137 install_element (OSPF_NODE
, &ospf_distance_source_cmd
);
8138 install_element (OSPF_NODE
, &no_ospf_distance_source_cmd
);
8139 install_element (OSPF_NODE
, &ospf_distance_source_access_list_cmd
);
8140 install_element (OSPF_NODE
, &no_ospf_distance_source_access_list_cmd
);
8144 struct cmd_node ospf_node
=
8147 "%s(config-router)# ",
8152 /* Install OSPF related vty commands. */
8154 ospf_vty_init (void)
8156 /* Install ospf top node. */
8157 install_node (&ospf_node
, ospf_config_write
);
8159 /* "router ospf" commands. */
8160 install_element (CONFIG_NODE
, &router_ospf_cmd
);
8161 install_element (CONFIG_NODE
, &no_router_ospf_cmd
);
8163 install_default (OSPF_NODE
);
8165 /* "ospf router-id" commands. */
8166 install_element (OSPF_NODE
, &ospf_router_id_cmd
);
8167 install_element (OSPF_NODE
, &no_ospf_router_id_cmd
);
8168 install_element (OSPF_NODE
, &router_ospf_id_cmd
);
8169 install_element (OSPF_NODE
, &no_router_ospf_id_cmd
);
8171 /* "passive-interface" commands. */
8172 install_element (OSPF_NODE
, &ospf_passive_interface_addr_cmd
);
8173 install_element (OSPF_NODE
, &ospf_passive_interface_cmd
);
8174 install_element (OSPF_NODE
, &no_ospf_passive_interface_addr_cmd
);
8175 install_element (OSPF_NODE
, &no_ospf_passive_interface_cmd
);
8177 /* "ospf abr-type" commands. */
8178 install_element (OSPF_NODE
, &ospf_abr_type_cmd
);
8179 install_element (OSPF_NODE
, &no_ospf_abr_type_cmd
);
8181 /* "ospf rfc1583-compatible" commands. */
8182 install_element (OSPF_NODE
, &ospf_rfc1583_flag_cmd
);
8183 install_element (OSPF_NODE
, &no_ospf_rfc1583_flag_cmd
);
8184 install_element (OSPF_NODE
, &ospf_compatible_rfc1583_cmd
);
8185 install_element (OSPF_NODE
, &no_ospf_compatible_rfc1583_cmd
);
8187 /* "network area" commands. */
8188 install_element (OSPF_NODE
, &ospf_network_area_cmd
);
8189 install_element (OSPF_NODE
, &no_ospf_network_area_cmd
);
8191 /* "area authentication" commands. */
8192 install_element (OSPF_NODE
, &ospf_area_authentication_message_digest_cmd
);
8193 install_element (OSPF_NODE
, &ospf_area_authentication_cmd
);
8194 install_element (OSPF_NODE
, &no_ospf_area_authentication_cmd
);
8196 /* "area range" commands. */
8197 install_element (OSPF_NODE
, &ospf_area_range_cmd
);
8198 install_element (OSPF_NODE
, &ospf_area_range_advertise_cmd
);
8199 install_element (OSPF_NODE
, &ospf_area_range_cost_cmd
);
8200 install_element (OSPF_NODE
, &ospf_area_range_advertise_cost_cmd
);
8201 install_element (OSPF_NODE
, &ospf_area_range_not_advertise_cmd
);
8202 install_element (OSPF_NODE
, &no_ospf_area_range_cmd
);
8203 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cmd
);
8204 install_element (OSPF_NODE
, &no_ospf_area_range_cost_cmd
);
8205 install_element (OSPF_NODE
, &no_ospf_area_range_advertise_cost_cmd
);
8206 install_element (OSPF_NODE
, &ospf_area_range_substitute_cmd
);
8207 install_element (OSPF_NODE
, &no_ospf_area_range_substitute_cmd
);
8209 /* "area virtual-link" commands. */
8210 install_element (OSPF_NODE
, &ospf_area_vlink_cmd
);
8211 install_element (OSPF_NODE
, &no_ospf_area_vlink_cmd
);
8213 install_element (OSPF_NODE
, &ospf_area_vlink_param1_cmd
);
8214 install_element (OSPF_NODE
, &no_ospf_area_vlink_param1_cmd
);
8216 install_element (OSPF_NODE
, &ospf_area_vlink_param2_cmd
);
8217 install_element (OSPF_NODE
, &no_ospf_area_vlink_param2_cmd
);
8219 install_element (OSPF_NODE
, &ospf_area_vlink_param3_cmd
);
8220 install_element (OSPF_NODE
, &no_ospf_area_vlink_param3_cmd
);
8222 install_element (OSPF_NODE
, &ospf_area_vlink_param4_cmd
);
8223 install_element (OSPF_NODE
, &no_ospf_area_vlink_param4_cmd
);
8225 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_cmd
);
8226 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_cmd
);
8227 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_cmd
);
8229 install_element (OSPF_NODE
, &ospf_area_vlink_md5_cmd
);
8230 install_element (OSPF_NODE
, &no_ospf_area_vlink_md5_cmd
);
8232 install_element (OSPF_NODE
, &ospf_area_vlink_authkey_cmd
);
8233 install_element (OSPF_NODE
, &no_ospf_area_vlink_authkey_cmd
);
8235 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_authkey_cmd
);
8236 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_authkey_cmd
);
8237 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_authkey_cmd
);
8239 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_args_md5_cmd
);
8240 install_element (OSPF_NODE
, &ospf_area_vlink_authtype_md5_cmd
);
8241 install_element (OSPF_NODE
, &no_ospf_area_vlink_authtype_md5_cmd
);
8243 /* "area stub" commands. */
8244 install_element (OSPF_NODE
, &ospf_area_stub_no_summary_cmd
);
8245 install_element (OSPF_NODE
, &ospf_area_stub_cmd
);
8246 install_element (OSPF_NODE
, &no_ospf_area_stub_no_summary_cmd
);
8247 install_element (OSPF_NODE
, &no_ospf_area_stub_cmd
);
8249 /* "area nssa" commands. */
8250 install_element (OSPF_NODE
, &ospf_area_nssa_cmd
);
8251 install_element (OSPF_NODE
, &ospf_area_nssa_translate_no_summary_cmd
);
8252 install_element (OSPF_NODE
, &ospf_area_nssa_translate_cmd
);
8253 install_element (OSPF_NODE
, &ospf_area_nssa_no_summary_cmd
);
8254 install_element (OSPF_NODE
, &no_ospf_area_nssa_cmd
);
8255 install_element (OSPF_NODE
, &no_ospf_area_nssa_no_summary_cmd
);
8257 install_element (OSPF_NODE
, &ospf_area_default_cost_cmd
);
8258 install_element (OSPF_NODE
, &no_ospf_area_default_cost_cmd
);
8260 install_element (OSPF_NODE
, &ospf_area_shortcut_cmd
);
8261 install_element (OSPF_NODE
, &no_ospf_area_shortcut_cmd
);
8263 install_element (OSPF_NODE
, &ospf_area_export_list_cmd
);
8264 install_element (OSPF_NODE
, &no_ospf_area_export_list_cmd
);
8266 install_element (OSPF_NODE
, &ospf_area_filter_list_cmd
);
8267 install_element (OSPF_NODE
, &no_ospf_area_filter_list_cmd
);
8269 install_element (OSPF_NODE
, &ospf_area_import_list_cmd
);
8270 install_element (OSPF_NODE
, &no_ospf_area_import_list_cmd
);
8272 /* SPF timer commands */
8273 install_element (OSPF_NODE
, &ospf_timers_spf_cmd
);
8274 install_element (OSPF_NODE
, &no_ospf_timers_spf_cmd
);
8275 install_element (OSPF_NODE
, &ospf_timers_throttle_spf_cmd
);
8276 install_element (OSPF_NODE
, &no_ospf_timers_throttle_spf_cmd
);
8278 /* refresh timer commands */
8279 install_element (OSPF_NODE
, &ospf_refresh_timer_cmd
);
8280 install_element (OSPF_NODE
, &no_ospf_refresh_timer_val_cmd
);
8281 install_element (OSPF_NODE
, &no_ospf_refresh_timer_cmd
);
8283 /* max-metric commands */
8284 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_admin_cmd
);
8285 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_admin_cmd
);
8286 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_startup_cmd
);
8287 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_startup_cmd
);
8288 install_element (OSPF_NODE
, &ospf_max_metric_router_lsa_shutdown_cmd
);
8289 install_element (OSPF_NODE
, &no_ospf_max_metric_router_lsa_shutdown_cmd
);
8291 /* reference bandwidth commands */
8292 install_element (OSPF_NODE
, &ospf_auto_cost_reference_bandwidth_cmd
);
8293 install_element (OSPF_NODE
, &no_ospf_auto_cost_reference_bandwidth_cmd
);
8295 /* "neighbor" commands. */
8296 install_element (OSPF_NODE
, &ospf_neighbor_cmd
);
8297 install_element (OSPF_NODE
, &ospf_neighbor_priority_poll_interval_cmd
);
8298 install_element (OSPF_NODE
, &ospf_neighbor_priority_cmd
);
8299 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_cmd
);
8300 install_element (OSPF_NODE
, &ospf_neighbor_poll_interval_priority_cmd
);
8301 install_element (OSPF_NODE
, &no_ospf_neighbor_cmd
);
8302 install_element (OSPF_NODE
, &no_ospf_neighbor_priority_cmd
);
8303 install_element (OSPF_NODE
, &no_ospf_neighbor_poll_interval_cmd
);
8305 /* Init interface related vty commands. */
8306 ospf_vty_if_init ();
8308 /* Init zebra related vty commands. */
8309 ospf_vty_zebra_init ();