blob: fff6f65961ade6302adefa792946925966d43d72 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* OSPF VTY interface.
2 * Copyright (C) 2000 Toshiaki Takada
3 *
4 * This file is part of GNU Zebra.
5 *
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
9 * later version.
10 *
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
15 *
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the Free
18 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
19 * 02111-1307, USA.
20 */
21
22#include <zebra.h>
23
24#include "memory.h"
25#include "thread.h"
26#include "prefix.h"
27#include "table.h"
28#include "vty.h"
29#include "command.h"
30#include "plist.h"
31#include "log.h"
32#include "zclient.h"
33
34#include "ospfd/ospfd.h"
35#include "ospfd/ospf_asbr.h"
36#include "ospfd/ospf_lsa.h"
37#include "ospfd/ospf_lsdb.h"
38#include "ospfd/ospf_ism.h"
39#include "ospfd/ospf_interface.h"
40#include "ospfd/ospf_nsm.h"
41#include "ospfd/ospf_neighbor.h"
42#include "ospfd/ospf_flood.h"
43#include "ospfd/ospf_abr.h"
44#include "ospfd/ospf_spf.h"
45#include "ospfd/ospf_route.h"
46#include "ospfd/ospf_zebra.h"
47/*#include "ospfd/ospf_routemap.h" */
48#include "ospfd/ospf_vty.h"
49#include "ospfd/ospf_dump.h"
50
51
52static char *ospf_network_type_str[] =
53{
54 "Null",
55 "POINTOPOINT",
56 "BROADCAST",
57 "NBMA",
58 "POINTOMULTIPOINT",
59 "VIRTUALLINK",
60 "LOOPBACK"
61};
62
63
64/* Utility functions. */
65int
66ospf_str2area_id (char *str, struct in_addr *area_id, int *format)
67{
68 char *endptr = NULL;
69 unsigned long ret;
70
71 /* match "A.B.C.D". */
72 if (strchr (str, '.') != NULL)
73 {
74 ret = inet_aton (str, area_id);
75 if (!ret)
76 return -1;
77 *format = OSPF_AREA_ID_FORMAT_ADDRESS;
78 }
79 /* match "<0-4294967295>". */
80 else
81 {
82 ret = strtoul (str, &endptr, 10);
83 if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE))
84 return -1;
85
86 area_id->s_addr = htonl (ret);
87 *format = OSPF_AREA_ID_FORMAT_DECIMAL;
88 }
89
90 return 0;
91}
92
93
94int
95str2distribute_source (char *str, int *source)
96{
97 /* Sanity check. */
98 if (str == NULL)
99 return 0;
100
101 if (strncmp (str, "k", 1) == 0)
102 *source = ZEBRA_ROUTE_KERNEL;
103 else if (strncmp (str, "c", 1) == 0)
104 *source = ZEBRA_ROUTE_CONNECT;
105 else if (strncmp (str, "s", 1) == 0)
106 *source = ZEBRA_ROUTE_STATIC;
107 else if (strncmp (str, "r", 1) == 0)
108 *source = ZEBRA_ROUTE_RIP;
109 else if (strncmp (str, "b", 1) == 0)
110 *source = ZEBRA_ROUTE_BGP;
111 else
112 return 0;
113
114 return 1;
115}
116
117int
118str2metric (char *str, int *metric)
119{
120 /* Sanity check. */
121 if (str == NULL)
122 return 0;
123
124 *metric = strtol (str, NULL, 10);
125 if (*metric < 0 && *metric > 16777214)
126 {
127 /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
128 return 0;
129 }
130
131 return 1;
132}
133
134int
135str2metric_type (char *str, int *metric_type)
136{
137 /* Sanity check. */
138 if (str == NULL)
139 return 0;
140
141 if (strncmp (str, "1", 1) == 0)
142 *metric_type = EXTERNAL_METRIC_TYPE_1;
143 else if (strncmp (str, "2", 1) == 0)
144 *metric_type = EXTERNAL_METRIC_TYPE_2;
145 else
146 return 0;
147
148 return 1;
149}
150
151int
152ospf_oi_count (struct interface *ifp)
153{
154 struct route_node *rn;
155 int i = 0;
156
157 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
158 if (rn->info)
159 i++;
160
161 return i;
162}
163
164
165DEFUN (router_ospf,
166 router_ospf_cmd,
167 "router ospf",
168 "Enable a routing process\n"
169 "Start OSPF configuration\n")
170{
171 vty->node = OSPF_NODE;
172 vty->index = ospf_get ();
173
174 return CMD_SUCCESS;
175}
176
177DEFUN (no_router_ospf,
178 no_router_ospf_cmd,
179 "no router ospf",
180 NO_STR
181 "Enable a routing process\n"
182 "Start OSPF configuration\n")
183{
184 if (ospf_top == NULL)
185 {
186 vty_out (vty, "There isn't active ospf instance.%s", VTY_NEWLINE);
187 return CMD_WARNING;
188 }
189
190 ospf_finish (ospf_top);
191
192 return CMD_SUCCESS;
193}
194
195DEFUN (ospf_router_id,
196 ospf_router_id_cmd,
197 "ospf router-id A.B.C.D",
198 "OSPF specific commands\n"
199 "router-id for the OSPF process\n"
200 "OSPF router-id in IP address format\n")
201{
paul68980082003-03-25 05:07:42 +0000202 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000203 struct in_addr router_id;
paul68980082003-03-25 05:07:42 +0000204 int ret;
paul718e3742002-12-13 20:15:29 +0000205
206 ret = inet_aton (argv[0], &router_id);
207 if (!ret)
208 {
209 vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
210 return CMD_WARNING;
211 }
212
paul68980082003-03-25 05:07:42 +0000213 ospf->router_id_static = router_id;
paul718e3742002-12-13 20:15:29 +0000214
paul68980082003-03-25 05:07:42 +0000215 if (ospf->t_router_id_update == NULL)
216 ospf->t_router_id_update =
paul718e3742002-12-13 20:15:29 +0000217 thread_add_timer (master, ospf_router_id_update_timer, NULL,
218 OSPF_ROUTER_ID_UPDATE_DELAY);
219
220 return CMD_SUCCESS;
221}
222
223ALIAS (ospf_router_id,
224 router_id_cmd,
225 "router-id A.B.C.D",
226 "router-id for the OSPF process\n"
227 "OSPF router-id in IP address format\n")
228
229DEFUN (no_ospf_router_id,
230 no_ospf_router_id_cmd,
231 "no ospf router-id",
232 NO_STR
233 "OSPF specific commands\n"
234 "router-id for the OSPF process\n")
235{
paul68980082003-03-25 05:07:42 +0000236 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000237
paul68980082003-03-25 05:07:42 +0000238 ospf->router_id_static.s_addr = 0;
239
240 ospf_router_id_update (ospf);
paul718e3742002-12-13 20:15:29 +0000241
242 return CMD_SUCCESS;
243}
244
245ALIAS (no_ospf_router_id,
246 no_router_id_cmd,
247 "no router-id",
248 NO_STR
249 "router-id for the OSPF process\n")
250
251DEFUN (passive_interface,
252 passive_interface_addr_cmd,
253 "passive-interface IFNAME A.B.C.D",
254 "Suppress routing updates on an interface\n"
255 "Interface's name\n")
256{
257 struct interface *ifp;
258 struct in_addr addr;
259 int ret;
260 struct ospf_if_params *params;
261
262 ifp = if_lookup_by_name (argv[0]);
263
264 if (ifp == NULL)
265 {
266 vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE);
267 return CMD_WARNING;
268 }
269
270 params = IF_DEF_PARAMS (ifp);
271
272 if (argc == 2)
273 {
274 ret = inet_aton(argv[1], &addr);
275 if (!ret)
276 {
277 vty_out (vty, "Please specify interface address by A.B.C.D%s",
278 VTY_NEWLINE);
279 return CMD_WARNING;
280 }
281
282 params = ospf_get_if_params (ifp, addr);
283 ospf_if_update_params (ifp, addr);
284 }
285
286 SET_IF_PARAM (params, passive_interface);
287 params->passive_interface = OSPF_IF_PASSIVE;
288
289 return CMD_SUCCESS;
290}
291
292ALIAS (passive_interface,
293 passive_interface_cmd,
294 "passive-interface IFNAME",
295 "Suppress routing updates on an interface\n"
296 "Interface's name\n")
297
298DEFUN (no_passive_interface,
299 no_passive_interface_addr_cmd,
300 "no passive-interface IFNAME A.B.C.D",
301 NO_STR
302 "Allow routing updates on an interface\n"
303 "Interface's name\n")
304{
305 struct interface *ifp;
306 struct in_addr addr;
307 struct ospf_if_params *params;
308 int ret;
309
310 ifp = if_lookup_by_name (argv[0]);
311
312 if (ifp == NULL)
313 {
314 vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE);
315 return CMD_WARNING;
316 }
317
318 params = IF_DEF_PARAMS (ifp);
319
320 if (argc == 2)
321 {
322 ret = inet_aton(argv[1], &addr);
323 if (!ret)
324 {
325 vty_out (vty, "Please specify interface address by A.B.C.D%s",
326 VTY_NEWLINE);
327 return CMD_WARNING;
328 }
329
330 params = ospf_lookup_if_params (ifp, addr);
331 if (params == NULL)
332 return CMD_SUCCESS;
333 }
334
335 UNSET_IF_PARAM (params, passive_interface);
336 params->passive_interface = OSPF_IF_ACTIVE;
337
338 if (params != IF_DEF_PARAMS (ifp))
339 {
340 ospf_free_if_params (ifp, addr);
341 ospf_if_update_params (ifp, addr);
342 }
343
344 return CMD_SUCCESS;
345}
346
347ALIAS (no_passive_interface,
348 no_passive_interface_cmd,
349 "no passive-interface IFNAME",
350 NO_STR
351 "Allow routing updates on an interface\n"
352 "Interface's name\n")
353
354DEFUN (network_area,
355 network_area_cmd,
356 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
357 "Enable routing on an IP network\n"
358 "OSPF network prefix\n"
359 "Set the OSPF area ID\n"
360 "OSPF area ID in IP address format\n"
361 "OSPF area ID as a decimal value\n")
362{
363 struct ospf *ospf= vty->index;
364 struct prefix_ipv4 p;
365 struct in_addr area_id;
366 int ret, format;
367
368 /* Get network prefix and Area ID. */
369 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
370 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
371
372 ret = ospf_network_set (ospf, &p, area_id);
373 if (ret == 0)
374 {
375 vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
376 return CMD_WARNING;
377 }
378
379 return CMD_SUCCESS;
380}
381
382DEFUN (no_network_area,
383 no_network_area_cmd,
384 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
385 NO_STR
386 "Enable routing on an IP network\n"
387 "OSPF network prefix\n"
388 "Set the OSPF area ID\n"
389 "OSPF area ID in IP address format\n"
390 "OSPF area ID as a decimal value\n")
391{
392 struct ospf *ospf = (struct ospf *) vty->index;
393 struct prefix_ipv4 p;
394 struct in_addr area_id;
395 int ret, format;
396
397 /* Get network prefix and Area ID. */
398 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
399 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
400
401 ret = ospf_network_unset (ospf, &p, area_id);
402 if (ret == 0)
403 {
404 vty_out (vty, "Can't find specified network area configuration.%s",
405 VTY_NEWLINE);
406 return CMD_WARNING;
407 }
408
409 return CMD_SUCCESS;
410}
411
412
413DEFUN (area_range,
414 area_range_cmd,
415 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
416 "OSPF area parameters\n"
417 "OSPF area ID in IP address format\n"
418 "OSPF area ID as a decimal value\n"
419 "Summarize routes matching address/mask (border routers only)\n"
420 "Area range prefix\n")
421{
422 struct ospf *ospf = vty->index;
423 struct prefix_ipv4 p;
424 struct in_addr area_id;
425 int format;
426 u_int32_t cost;
427
428 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
429 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
430
431 ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
432 if (argc > 2)
433 {
434 VTY_GET_UINT32 ("range cost", cost, argv[2]);
435 ospf_area_range_cost_set (ospf, area_id, &p, cost);
436 }
437
438 return CMD_SUCCESS;
439}
440
441ALIAS (area_range,
442 area_range_advertise_cmd,
443 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
444 "OSPF area parameters\n"
445 "OSPF area ID in IP address format\n"
446 "OSPF area ID as a decimal value\n"
447 "OSPF area range for route advertise (default)\n"
448 "Area range prefix\n"
449 "Advertise this range (default)\n")
450
451ALIAS (area_range,
452 area_range_cost_cmd,
453 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
454 "OSPF area parameters\n"
455 "OSPF area ID in IP address format\n"
456 "OSPF area ID as a decimal value\n"
457 "Summarize routes matching address/mask (border routers only)\n"
458 "Area range prefix\n"
459 "User specified metric for this range\n"
460 "Advertised metric for this range\n")
461
462ALIAS (area_range,
463 area_range_advertise_cost_cmd,
464 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
465 "OSPF area parameters\n"
466 "OSPF area ID in IP address format\n"
467 "OSPF area ID as a decimal value\n"
468 "Summarize routes matching address/mask (border routers only)\n"
469 "Area range prefix\n"
470 "Advertise this range (default)\n"
471 "User specified metric for this range\n"
472 "Advertised metric for this range\n")
473
474DEFUN (area_range_not_advertise,
475 area_range_not_advertise_cmd,
476 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
477 "OSPF area parameters\n"
478 "OSPF area ID in IP address format\n"
479 "OSPF area ID as a decimal value\n"
480 "Summarize routes matching address/mask (border routers only)\n"
481 "Area range prefix\n"
482 "DoNotAdvertise this range\n")
483{
484 struct ospf *ospf = vty->index;
485 struct prefix_ipv4 p;
486 struct in_addr area_id;
487 int format;
488
489 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
490 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
491
492 ospf_area_range_set (ospf, area_id, &p, 0);
493
494 return CMD_SUCCESS;
495}
496
497DEFUN (no_area_range,
498 no_area_range_cmd,
499 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
500 NO_STR
501 "OSPF area parameters\n"
502 "OSPF area ID in IP address format\n"
503 "OSPF area ID as a decimal value\n"
504 "Summarize routes matching address/mask (border routers only)\n"
505 "Area range prefix\n")
506{
507 struct ospf *ospf = vty->index;
508 struct prefix_ipv4 p;
509 struct in_addr area_id;
510 int format;
511
512 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
513 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
514
515 ospf_area_range_unset (ospf, area_id, &p);
516
517 return CMD_SUCCESS;
518}
519
520ALIAS (no_area_range,
521 no_area_range_advertise_cmd,
522 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
523 NO_STR
524 "OSPF area parameters\n"
525 "OSPF area ID in IP address format\n"
526 "OSPF area ID as a decimal value\n"
527 "Summarize routes matching address/mask (border routers only)\n"
528 "Area range prefix\n"
529 "Advertise this range (default)\n"
530 "DoNotAdvertise this range\n")
531
532ALIAS (no_area_range,
533 no_area_range_cost_cmd,
534 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
535 NO_STR
536 "OSPF area parameters\n"
537 "OSPF area ID in IP address format\n"
538 "OSPF area ID as a decimal value\n"
539 "Summarize routes matching address/mask (border routers only)\n"
540 "Area range prefix\n"
541 "User specified metric for this range\n"
542 "Advertised metric for this range\n")
543
544ALIAS (no_area_range,
545 no_area_range_advertise_cost_cmd,
546 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
547 NO_STR
548 "OSPF area parameters\n"
549 "OSPF area ID in IP address format\n"
550 "OSPF area ID as a decimal value\n"
551 "Summarize routes matching address/mask (border routers only)\n"
552 "Area range prefix\n"
553 "Advertise this range (default)\n"
554 "User specified metric for this range\n"
555 "Advertised metric for this range\n")
556
557DEFUN (area_range_substitute,
558 area_range_substitute_cmd,
559 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
560 "OSPF area parameters\n"
561 "OSPF area ID in IP address format\n"
562 "OSPF area ID as a decimal value\n"
563 "Summarize routes matching address/mask (border routers only)\n"
564 "Area range prefix\n"
565 "Announce area range as another prefix\n"
566 "Network prefix to be announced instead of range\n")
567{
568 struct ospf *ospf = vty->index;
569 struct prefix_ipv4 p, s;
570 struct in_addr area_id;
571 int format;
572
573 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
574 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
575 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
576
577 ospf_area_range_substitute_set (ospf, area_id, &p, &s);
578
579 return CMD_SUCCESS;
580}
581
582DEFUN (no_area_range_substitute,
583 no_area_range_substitute_cmd,
584 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
585 NO_STR
586 "OSPF area parameters\n"
587 "OSPF area ID in IP address format\n"
588 "OSPF area ID as a decimal value\n"
589 "Summarize routes matching address/mask (border routers only)\n"
590 "Area range prefix\n"
591 "Announce area range as another prefix\n"
592 "Network prefix to be announced instead of range\n")
593{
594 struct ospf *ospf = vty->index;
595 struct prefix_ipv4 p, s;
596 struct in_addr area_id;
597 int format;
598
599 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
600 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
601 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
602
603 ospf_area_range_substitute_unset (ospf, area_id, &p);
604
605 return CMD_SUCCESS;
606}
607
608
609/* Command Handler Logic in VLink stuff is delicate!!
610
611 ALTER AT YOUR OWN RISK!!!!
612
613 Various dummy values are used to represent 'NoChange' state for
614 VLink configuration NOT being changed by a VLink command, and
615 special syntax is used within the command strings so that the
616 typed in command verbs can be seen in the configuration command
617 bacckend handler. This is to drastically reduce the verbeage
618 required to coe up with a reasonably compatible Cisco VLink command
619
620 - Matthew Grant <grantma@anathoth.gen.nz>
621 Wed, 21 Feb 2001 15:13:52 +1300
622 */
623
624
625/* Configuration data for virtual links
626 */
627struct ospf_vl_config_data {
628 struct vty *vty; /* vty stuff */
629 struct in_addr area_id; /* area ID from command line */
630 int format; /* command line area ID format */
631 struct in_addr vl_peer; /* command line vl_peer */
632 int auth_type; /* Authehntication type, if given */
633 char *auth_key; /* simple password if present */
634 int crypto_key_id; /* Cryptographic key ID */
635 char *md5_key; /* MD5 authentication key */
636 int hello_interval; /* Obvious what these are... */
637 int retransmit_interval;
638 int transmit_delay;
639 int dead_interval;
640};
641
642void
643ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config,
644 struct vty *vty)
645{
646 memset (vl_config, 0, sizeof (struct ospf_vl_config_data));
647 vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN;
648 vl_config->vty = vty;
649}
650
651struct ospf_vl_data *
paul68980082003-03-25 05:07:42 +0000652ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000653{
654 struct ospf_area *area;
655 struct ospf_vl_data *vl_data;
656 struct vty *vty;
657 struct in_addr area_id;
658
659 vty = vl_config->vty;
660 area_id = vl_config->area_id;
661
662 if (area_id.s_addr == OSPF_AREA_BACKBONE)
663 {
664 vty_out (vty,
665 "Configuring VLs over the backbone is not allowed%s",
666 VTY_NEWLINE);
667 return NULL;
668 }
paul68980082003-03-25 05:07:42 +0000669 area = ospf_area_get (ospf, area_id, vl_config->format);
paul718e3742002-12-13 20:15:29 +0000670
671 if (area->external_routing != OSPF_AREA_DEFAULT)
672 {
673 if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS)
674 vty_out (vty, "Area %s is %s%s",
675 inet_ntoa (area_id),
676#ifdef HAVE_NSSA
677 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
678#else
679 "stub",
680#endif /* HAVE_NSSA */
681 VTY_NEWLINE);
682 else
683 vty_out (vty, "Area %ld is %s%s",
684 (u_long)ntohl (area_id.s_addr),
685#ifdef HAVE_NSSA
686 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
687#else
688 "stub",
689#endif /* HAVE_NSSA */
690 VTY_NEWLINE);
691 return NULL;
692 }
693
694 if ((vl_data = ospf_vl_lookup (area, vl_config->vl_peer)) == NULL)
695 {
696 vl_data = ospf_vl_data_new (area, vl_config->vl_peer);
697 if (vl_data->vl_oi == NULL)
698 {
paul68980082003-03-25 05:07:42 +0000699 vl_data->vl_oi = ospf_vl_new (ospf, vl_data);
700 ospf_vl_add (ospf, vl_data);
701 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +0000702 }
703 }
704 return vl_data;
705}
706
707
708int
709ospf_vl_set_security (struct ospf_vl_data *vl_data,
710 struct ospf_vl_config_data *vl_config)
711{
712 struct crypt_key *ck;
713 struct vty *vty;
714 struct interface *ifp = vl_data->vl_oi->ifp;
715
716 vty = vl_config->vty;
717
718 if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN)
719 {
720 SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type);
721 IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type;
722 }
723
724 if (vl_config->auth_key)
725 {
726 memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1);
727 strncpy (IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key,
728 OSPF_AUTH_SIMPLE_SIZE);
729 }
730 else if (vl_config->md5_key)
731 {
732 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id)
733 != NULL)
734 {
735 vty_out (vty, "OSPF: Key %d already exists%s",
736 vl_config->crypto_key_id, VTY_NEWLINE);
737 return CMD_WARNING;
738 }
739 ck = ospf_crypt_key_new ();
740 ck->key_id = vl_config->crypto_key_id;
741 memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
742 strncpy (ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE);
743
744 ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck);
745 }
746 else if (vl_config->crypto_key_id != 0)
747 {
748 /* Delete a key */
749
750 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt,
751 vl_config->crypto_key_id) == NULL)
752 {
753 vty_out (vty, "OSPF: Key %d does not exist%s",
754 vl_config->crypto_key_id, VTY_NEWLINE);
755 return CMD_WARNING;
756 }
757
758 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id);
759
760 }
761
762 return CMD_SUCCESS;
763}
764
765
766
767int
768ospf_vl_set_timers (struct ospf_vl_data *vl_data,
769 struct ospf_vl_config_data *vl_config)
770{
771 struct interface *ifp = ifp = vl_data->vl_oi->ifp;
772 /* Virtual Link data initialised to defaults, so only set
773 if a value given */
774 if (vl_config->hello_interval)
775 {
776 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello);
777 IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval;
778 }
779
780 if (vl_config->dead_interval)
781 {
782 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait);
783 IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval;
784 }
785
786 if (vl_config->retransmit_interval)
787 {
788 SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval);
789 IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval;
790 }
791
792 if (vl_config->transmit_delay)
793 {
794 SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay);
795 IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay;
796 }
797
798 return CMD_SUCCESS;
799}
800
801
802
803/* The business end of all of the above */
804int
paul68980082003-03-25 05:07:42 +0000805ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000806{
807 struct ospf_vl_data *vl_data;
808 int ret;
809
paul68980082003-03-25 05:07:42 +0000810 vl_data = ospf_find_vl_data (ospf, vl_config);
paul718e3742002-12-13 20:15:29 +0000811 if (!vl_data)
812 return CMD_WARNING;
813
814 /* Process this one first as it can have a fatal result, which can
815 only logically occur if the virtual link exists already
816 Thus a command error does not result in a change to the
817 running configuration such as unexpectedly altered timer
818 values etc.*/
819 ret = ospf_vl_set_security (vl_data, vl_config);
820 if (ret != CMD_SUCCESS)
821 return ret;
822
823 /* Set any time based parameters, these area already range checked */
824
825 ret = ospf_vl_set_timers (vl_data, vl_config);
826 if (ret != CMD_SUCCESS)
827 return ret;
828
829 return CMD_SUCCESS;
830
831}
832
833/* This stuff exists to make specifying all the alias commands A LOT simpler
834 */
835#define VLINK_HELPSTR_IPADDR \
836 "OSPF area parameters\n" \
837 "OSPF area ID in IP address format\n" \
838 "OSPF area ID as a decimal value\n" \
839 "Configure a virtual link\n" \
840 "Router ID of the remote ABR\n"
841
842#define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
843 "Enable authentication on this virtual link\n" \
844 "dummy string \n"
845
846#define VLINK_HELPSTR_AUTHTYPE_ALL \
847 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
848 "Use null authentication\n" \
849 "Use message-digest authentication\n"
850
851#define VLINK_HELPSTR_TIME_PARAM_NOSECS \
852 "Time between HELLO packets\n" \
853 "Time between retransmitting lost link state advertisements\n" \
854 "Link state transmit delay\n" \
855 "Interval after which a neighbor is declared dead\n"
856
857#define VLINK_HELPSTR_TIME_PARAM \
858 VLINK_HELPSTR_TIME_PARAM_NOSECS \
859 "Seconds\n"
860
861#define VLINK_HELPSTR_AUTH_SIMPLE \
862 "Authentication password (key)\n" \
863 "The OSPF password (key)"
864
865#define VLINK_HELPSTR_AUTH_MD5 \
866 "Message digest authentication password (key)\n" \
867 "dummy string \n" \
868 "Key ID\n" \
869 "Use MD5 algorithm\n" \
870 "The OSPF password (key)"
871
872DEFUN (area_vlink,
873 area_vlink_cmd,
874 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
875 VLINK_HELPSTR_IPADDR)
876{
paul68980082003-03-25 05:07:42 +0000877 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000878 struct ospf_vl_config_data vl_config;
879 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
880 char md5_key[OSPF_AUTH_MD5_SIZE+1];
881 int i;
882 int ret;
883
884 ospf_vl_config_data_init(&vl_config, vty);
885
886 /* Read off first 2 parameters and check them */
887 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format);
888 if (ret < 0)
889 {
890 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
891 return CMD_WARNING;
892 }
893
894 ret = inet_aton (argv[1], &vl_config.vl_peer);
895 if (! ret)
896 {
897 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
898 VTY_NEWLINE);
899 return CMD_WARNING;
900 }
901
902 if (argc <=2)
903 {
904 /* Thats all folks! - BUGS B. strikes again!!!*/
905
paul68980082003-03-25 05:07:42 +0000906 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +0000907 }
908
909 /* Deal with other parameters */
910 for (i=2; i < argc; i++)
911 {
912
913 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
914
915 switch (argv[i][0])
916 {
917
918 case 'a':
919 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
920 {
921 /* authentication-key - this option can occur anywhere on
922 command line. At start of command line
923 must check for authentication option. */
924 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
925 strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE);
926 vl_config.auth_key = auth_key;
927 i++;
928 }
929 else if (strncmp (argv[i], "authentication", 14) == 0)
930 {
931 /* authentication - this option can only occur at start
932 of command line */
933 vl_config.auth_type = OSPF_AUTH_SIMPLE;
934 if ((i+1) < argc)
935 {
936 if (strncmp (argv[i+1], "n", 1) == 0)
937 {
938 /* "authentication null" */
939 vl_config.auth_type = OSPF_AUTH_NULL;
940 i++;
941 }
942 else if (strncmp (argv[i+1], "m", 1) == 0
943 && strcmp (argv[i+1], "message-digest-") != 0)
944 {
945 /* "authentication message-digest" */
946 vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
947 i++;
948 }
949 }
950 }
951 break;
952
953 case 'm':
954 /* message-digest-key */
955 i++;
956 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
957 if (vl_config.crypto_key_id < 0)
958 return CMD_WARNING;
959 i++;
960 memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1);
961 strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE);
962 vl_config.md5_key = md5_key;
963 break;
964
965 case 'h':
966 /* Hello interval */
967 i++;
968 vl_config.hello_interval = strtol (argv[i], NULL, 10);
969 if (vl_config.hello_interval < 0)
970 return CMD_WARNING;
971 break;
972
973 case 'r':
974 /* Retransmit Interval */
975 i++;
976 vl_config.retransmit_interval = strtol (argv[i], NULL, 10);
977 if (vl_config.retransmit_interval < 0)
978 return CMD_WARNING;
979 break;
980
981 case 't':
982 /* Transmit Delay */
983 i++;
984 vl_config.transmit_delay = strtol (argv[i], NULL, 10);
985 if (vl_config.transmit_delay < 0)
986 return CMD_WARNING;
987 break;
988
989 case 'd':
990 /* Dead Interval */
991 i++;
992 vl_config.dead_interval = strtol (argv[i], NULL, 10);
993 if (vl_config.dead_interval < 0)
994 return CMD_WARNING;
995 break;
996 }
997 }
998
999
1000 /* Action configuration */
1001
paul68980082003-03-25 05:07:42 +00001002 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001003
1004}
1005
1006DEFUN (no_area_vlink,
1007 no_area_vlink_cmd,
1008 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1009 NO_STR
1010 VLINK_HELPSTR_IPADDR)
1011{
paul68980082003-03-25 05:07:42 +00001012 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001013 struct ospf_area *area;
1014 struct ospf_vl_config_data vl_config;
1015 struct ospf_vl_data *vl_data = NULL;
1016 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
1017 int i;
1018 int ret, format;
1019
1020 ospf_vl_config_data_init(&vl_config, vty);
1021
1022 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format);
1023 if (ret < 0)
1024 {
1025 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
1026 return CMD_WARNING;
1027 }
1028
paul68980082003-03-25 05:07:42 +00001029 area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001030 if (!area)
1031 {
1032 vty_out (vty, "Area does not exist%s", VTY_NEWLINE);
1033 return CMD_WARNING;
1034 }
1035
1036 ret = inet_aton (argv[1], &vl_config.vl_peer);
1037 if (! ret)
1038 {
1039 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
1040 VTY_NEWLINE);
1041 return CMD_WARNING;
1042 }
1043
1044 if (argc <=2)
1045 {
1046 /* Basic VLink no command */
1047 /* Thats all folks! - BUGS B. strikes again!!!*/
1048 if ((vl_data = ospf_vl_lookup (area, vl_config.vl_peer)))
paul68980082003-03-25 05:07:42 +00001049 ospf_vl_delete (ospf, vl_data);
paul718e3742002-12-13 20:15:29 +00001050
paul68980082003-03-25 05:07:42 +00001051 ospf_area_check_free (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001052
1053 return CMD_SUCCESS;
1054 }
1055
1056 /* If we are down here, we are reseting parameters */
1057
1058 /* Deal with other parameters */
1059 for (i=2; i < argc; i++)
1060 {
paul718e3742002-12-13 20:15:29 +00001061 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1062
1063 switch (argv[i][0])
1064 {
1065
1066 case 'a':
1067 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
1068 {
1069 /* authentication-key - this option can occur anywhere on
1070 command line. At start of command line
1071 must check for authentication option. */
1072 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
1073 vl_config.auth_key = auth_key;
1074 }
1075 else if (strncmp (argv[i], "authentication", 14) == 0)
1076 {
1077 /* authentication - this option can only occur at start
1078 of command line */
1079 vl_config.auth_type = OSPF_AUTH_NOTSET;
1080 }
1081 break;
1082
1083 case 'm':
1084 /* message-digest-key */
1085 /* Delete one key */
1086 i++;
1087 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
1088 if (vl_config.crypto_key_id < 0)
1089 return CMD_WARNING;
1090 vl_config.md5_key = NULL;
1091 break;
1092
1093 case 'h':
1094 /* Hello interval */
1095 vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
1096 break;
1097
1098 case 'r':
1099 /* Retransmit Interval */
1100 vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
1101 break;
1102
1103 case 't':
1104 /* Transmit Delay */
1105 vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
1106 break;
1107
1108 case 'd':
1109 /* Dead Interval */
1110 i++;
1111 vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
1112 break;
1113 }
1114 }
1115
1116
1117 /* Action configuration */
1118
paul68980082003-03-25 05:07:42 +00001119 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001120}
1121
1122ALIAS (area_vlink,
1123 area_vlink_param1_cmd,
1124 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1125 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1126 VLINK_HELPSTR_IPADDR
1127 VLINK_HELPSTR_TIME_PARAM)
1128
1129ALIAS (no_area_vlink,
1130 no_area_vlink_param1_cmd,
1131 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1132 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1133 NO_STR
1134 VLINK_HELPSTR_IPADDR
1135 VLINK_HELPSTR_TIME_PARAM)
1136
1137ALIAS (area_vlink,
1138 area_vlink_param2_cmd,
1139 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1140 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1141 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1142 VLINK_HELPSTR_IPADDR
1143 VLINK_HELPSTR_TIME_PARAM
1144 VLINK_HELPSTR_TIME_PARAM)
1145
1146ALIAS (no_area_vlink,
1147 no_area_vlink_param2_cmd,
1148 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1149 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1150 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1151 NO_STR
1152 VLINK_HELPSTR_IPADDR
1153 VLINK_HELPSTR_TIME_PARAM
1154 VLINK_HELPSTR_TIME_PARAM)
1155
1156ALIAS (area_vlink,
1157 area_vlink_param3_cmd,
1158 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1159 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1160 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1161 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1162 VLINK_HELPSTR_IPADDR
1163 VLINK_HELPSTR_TIME_PARAM
1164 VLINK_HELPSTR_TIME_PARAM
1165 VLINK_HELPSTR_TIME_PARAM)
1166
1167ALIAS (no_area_vlink,
1168 no_area_vlink_param3_cmd,
1169 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1170 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1171 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1172 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1173 NO_STR
1174 VLINK_HELPSTR_IPADDR
1175 VLINK_HELPSTR_TIME_PARAM
1176 VLINK_HELPSTR_TIME_PARAM
1177 VLINK_HELPSTR_TIME_PARAM)
1178
1179ALIAS (area_vlink,
1180 area_vlink_param4_cmd,
1181 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1182 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1183 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1184 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1185 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1186 VLINK_HELPSTR_IPADDR
1187 VLINK_HELPSTR_TIME_PARAM
1188 VLINK_HELPSTR_TIME_PARAM
1189 VLINK_HELPSTR_TIME_PARAM
1190 VLINK_HELPSTR_TIME_PARAM)
1191
1192ALIAS (no_area_vlink,
1193 no_area_vlink_param4_cmd,
1194 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1195 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1196 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1197 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1198 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1199 NO_STR
1200 VLINK_HELPSTR_IPADDR
1201 VLINK_HELPSTR_TIME_PARAM
1202 VLINK_HELPSTR_TIME_PARAM
1203 VLINK_HELPSTR_TIME_PARAM
1204 VLINK_HELPSTR_TIME_PARAM)
1205
1206ALIAS (area_vlink,
1207 area_vlink_authtype_args_cmd,
1208 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1209 "(authentication|) (message-digest|null)",
1210 VLINK_HELPSTR_IPADDR
1211 VLINK_HELPSTR_AUTHTYPE_ALL)
1212
1213ALIAS (area_vlink,
1214 area_vlink_authtype_cmd,
1215 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1216 "(authentication|)",
1217 VLINK_HELPSTR_IPADDR
1218 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1219
1220ALIAS (no_area_vlink,
1221 no_area_vlink_authtype_cmd,
1222 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1223 "(authentication|)",
1224 NO_STR
1225 VLINK_HELPSTR_IPADDR
1226 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1227
1228ALIAS (area_vlink,
1229 area_vlink_md5_cmd,
1230 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1231 "(message-digest-key|) <1-255> md5 KEY",
1232 VLINK_HELPSTR_IPADDR
1233 VLINK_HELPSTR_AUTH_MD5)
1234
1235ALIAS (no_area_vlink,
1236 no_area_vlink_md5_cmd,
1237 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1238 "(message-digest-key|) <1-255>",
1239 NO_STR
1240 VLINK_HELPSTR_IPADDR
1241 VLINK_HELPSTR_AUTH_MD5)
1242
1243ALIAS (area_vlink,
1244 area_vlink_authkey_cmd,
1245 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1246 "(authentication-key|) AUTH_KEY",
1247 VLINK_HELPSTR_IPADDR
1248 VLINK_HELPSTR_AUTH_SIMPLE)
1249
1250ALIAS (no_area_vlink,
1251 no_area_vlink_authkey_cmd,
1252 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1253 "(authentication-key|)",
1254 NO_STR
1255 VLINK_HELPSTR_IPADDR
1256 VLINK_HELPSTR_AUTH_SIMPLE)
1257
1258ALIAS (area_vlink,
1259 area_vlink_authtype_args_authkey_cmd,
1260 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1261 "(authentication|) (message-digest|null) "
1262 "(authentication-key|) AUTH_KEY",
1263 VLINK_HELPSTR_IPADDR
1264 VLINK_HELPSTR_AUTHTYPE_ALL
1265 VLINK_HELPSTR_AUTH_SIMPLE)
1266
1267ALIAS (area_vlink,
1268 area_vlink_authtype_authkey_cmd,
1269 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1270 "(authentication|) "
1271 "(authentication-key|) AUTH_KEY",
1272 VLINK_HELPSTR_IPADDR
1273 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1274 VLINK_HELPSTR_AUTH_SIMPLE)
1275
1276ALIAS (no_area_vlink,
1277 no_area_vlink_authtype_authkey_cmd,
1278 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1279 "(authentication|) "
1280 "(authentication-key|)",
1281 NO_STR
1282 VLINK_HELPSTR_IPADDR
1283 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1284 VLINK_HELPSTR_AUTH_SIMPLE)
1285
1286ALIAS (area_vlink,
1287 area_vlink_authtype_args_md5_cmd,
1288 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1289 "(authentication|) (message-digest|null) "
1290 "(message-digest-key|) <1-255> md5 KEY",
1291 VLINK_HELPSTR_IPADDR
1292 VLINK_HELPSTR_AUTHTYPE_ALL
1293 VLINK_HELPSTR_AUTH_MD5)
1294
1295ALIAS (area_vlink,
1296 area_vlink_authtype_md5_cmd,
1297 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1298 "(authentication|) "
1299 "(message-digest-key|) <1-255> md5 KEY",
1300 VLINK_HELPSTR_IPADDR
1301 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1302 VLINK_HELPSTR_AUTH_MD5)
1303
1304ALIAS (no_area_vlink,
1305 no_area_vlink_authtype_md5_cmd,
1306 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1307 "(authentication|) "
1308 "(message-digest-key|)",
1309 NO_STR
1310 VLINK_HELPSTR_IPADDR
1311 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1312 VLINK_HELPSTR_AUTH_MD5)
1313
1314
1315DEFUN (area_shortcut,
1316 area_shortcut_cmd,
1317 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1318 "OSPF area parameters\n"
1319 "OSPF area ID in IP address format\n"
1320 "OSPF area ID as a decimal value\n"
1321 "Configure the area's shortcutting mode\n"
1322 "Set default shortcutting behavior\n"
1323 "Enable shortcutting through the area\n"
1324 "Disable shortcutting through the area\n")
1325{
paul68980082003-03-25 05:07:42 +00001326 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001327 struct ospf_area *area;
1328 struct in_addr area_id;
1329 int mode;
1330 int format;
1331
1332 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1333
paul68980082003-03-25 05:07:42 +00001334 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001335
1336 if (strncmp (argv[1], "de", 2) == 0)
1337 mode = OSPF_SHORTCUT_DEFAULT;
1338 else if (strncmp (argv[1], "di", 2) == 0)
1339 mode = OSPF_SHORTCUT_DISABLE;
1340 else if (strncmp (argv[1], "e", 1) == 0)
1341 mode = OSPF_SHORTCUT_ENABLE;
1342 else
1343 return CMD_WARNING;
1344
paul68980082003-03-25 05:07:42 +00001345 ospf_area_shortcut_set (ospf, area, mode);
paul718e3742002-12-13 20:15:29 +00001346
paul68980082003-03-25 05:07:42 +00001347 if (ospf->abr_type != OSPF_ABR_SHORTCUT)
paul718e3742002-12-13 20:15:29 +00001348 vty_out (vty, "Shortcut area setting will take effect "
1349 "only when the router is configured as Shortcut ABR%s",
1350 VTY_NEWLINE);
1351
1352 return CMD_SUCCESS;
1353}
1354
1355DEFUN (no_area_shortcut,
1356 no_area_shortcut_cmd,
1357 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1358 NO_STR
1359 "OSPF area parameters\n"
1360 "OSPF area ID in IP address format\n"
1361 "OSPF area ID as a decimal value\n"
1362 "Deconfigure the area's shortcutting mode\n"
1363 "Deconfigure enabled shortcutting through the area\n"
1364 "Deconfigure disabled shortcutting through the area\n")
1365{
paul68980082003-03-25 05:07:42 +00001366 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001367 struct ospf_area *area;
1368 struct in_addr area_id;
1369 int format;
1370
1371 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1372
paul68980082003-03-25 05:07:42 +00001373 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001374 if (!area)
1375 return CMD_SUCCESS;
1376
paul68980082003-03-25 05:07:42 +00001377 ospf_area_shortcut_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001378
1379 return CMD_SUCCESS;
1380}
1381
1382
1383DEFUN (area_stub,
1384 area_stub_cmd,
1385 "area (A.B.C.D|<0-4294967295>) stub",
1386 "OSPF area parameters\n"
1387 "OSPF area ID in IP address format\n"
1388 "OSPF area ID as a decimal value\n"
1389 "Configure OSPF area as stub\n")
1390{
1391 struct ospf *ospf = vty->index;
1392 struct in_addr area_id;
1393 int ret, format;
1394
1395 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1396
1397 ret = ospf_area_stub_set (ospf, area_id);
1398 if (ret == 0)
1399 {
1400 vty_out (vty, "First deconfigure all virtual link through this area%s",
1401 VTY_NEWLINE);
1402 return CMD_WARNING;
1403 }
1404
1405 ospf_area_no_summary_unset (ospf, area_id);
1406
1407 return CMD_SUCCESS;
1408}
1409
1410DEFUN (area_stub_no_summary,
1411 area_stub_no_summary_cmd,
1412 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1413 "OSPF stub parameters\n"
1414 "OSPF area ID in IP address format\n"
1415 "OSPF area ID as a decimal value\n"
1416 "Configure OSPF area as stub\n"
1417 "Do not inject inter-area routes into stub\n")
1418{
1419 struct ospf *ospf = vty->index;
1420 struct in_addr area_id;
1421 int ret, format;
1422
1423 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1424
1425 ret = ospf_area_stub_set (ospf, area_id);
1426 if (ret == 0)
1427 {
1428 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1429 VTY_NEWLINE);
1430 return CMD_WARNING;
1431 }
1432
1433 ospf_area_no_summary_set (ospf, area_id);
1434
1435 return CMD_SUCCESS;
1436}
1437
1438DEFUN (no_area_stub,
1439 no_area_stub_cmd,
1440 "no area (A.B.C.D|<0-4294967295>) stub",
1441 NO_STR
1442 "OSPF area 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{
1447 struct ospf *ospf = vty->index;
1448 struct in_addr area_id;
1449 int format;
1450
1451 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1452
1453 ospf_area_stub_unset (ospf, area_id);
1454 ospf_area_no_summary_unset (ospf, area_id);
1455
1456 return CMD_SUCCESS;
1457}
1458
1459DEFUN (no_area_stub_no_summary,
1460 no_area_stub_no_summary_cmd,
1461 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1462 NO_STR
1463 "OSPF area parameters\n"
1464 "OSPF area ID in IP address format\n"
1465 "OSPF area ID as a decimal value\n"
1466 "Configure OSPF area as stub\n"
1467 "Do not inject inter-area routes into area\n")
1468{
1469 struct ospf *ospf = vty->index;
1470 struct in_addr area_id;
1471 int format;
1472
1473 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1474 ospf_area_no_summary_unset (ospf, area_id);
1475
1476 return CMD_SUCCESS;
1477}
1478
1479#ifdef HAVE_NSSA
1480DEFUN (area_nssa,
1481 area_nssa_cmd,
1482 "area (A.B.C.D|<0-4294967295>) nssa",
1483 "OSPF area parameters\n"
1484 "OSPF area ID in IP address format\n"
1485 "OSPF area ID as a decimal value\n"
1486 "Configure OSPF area as nssa\n")
1487{
1488 struct ospf *ospf = vty->index;
1489 struct in_addr area_id;
1490 int ret, format;
1491
1492 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1493
1494 ret = ospf_area_nssa_set (ospf, area_id);
1495 if (ret == 0)
1496 {
1497 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1498 VTY_NEWLINE);
1499 return CMD_WARNING;
1500 }
1501
1502 if (argc > 1)
1503 {
1504 if (strncmp (argv[1], "translate-c", 11) == 0)
1505 ospf_area_nssa_translator_role_set (ospf, area_id,
1506 OSPF_NSSA_ROLE_CANDIDATE);
1507 else if (strncmp (argv[1], "translate-n", 11) == 0)
1508 ospf_area_nssa_translator_role_set (ospf, area_id,
1509 OSPF_NSSA_ROLE_NEVER);
1510 else if (strncmp (argv[1], "translate-a", 11) == 0)
1511 ospf_area_nssa_translator_role_set (ospf, area_id,
1512 OSPF_NSSA_ROLE_ALWAYS);
1513 }
1514
1515 if (argc > 2)
1516 ospf_area_no_summary_set (ospf, area_id);
1517
1518 return CMD_SUCCESS;
1519}
1520
1521ALIAS (area_nssa,
1522 area_nssa_translate_no_summary_cmd,
1523 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) (no-summary|)",
1524 "OSPF area parameters\n"
1525 "OSPF area ID in IP address format\n"
1526 "OSPF area ID as a decimal value\n"
1527 "Configure OSPF area as nssa\n"
1528 "Configure NSSA-ABR for translate election (default)\n"
1529 "Configure NSSA-ABR to never translate\n"
1530 "Configure NSSA-ABR to always translate\n"
1531 "Do not inject inter-area routes into nssa\n"
1532 "dummy\n")
1533
1534ALIAS (area_nssa,
1535 area_nssa_translate_cmd,
1536 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1537 "OSPF area parameters\n"
1538 "OSPF area ID in IP address format\n"
1539 "OSPF area ID as a decimal value\n"
1540 "Configure OSPF area as nssa\n"
1541 "Configure NSSA-ABR for translate election (default)\n"
1542 "Configure NSSA-ABR to never translate\n"
1543 "Configure NSSA-ABR to always translate\n")
1544
1545DEFUN (area_nssa_no_summary,
1546 area_nssa_no_summary_cmd,
1547 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1548 "OSPF area parameters\n"
1549 "OSPF area ID in IP address format\n"
1550 "OSPF area ID as a decimal value\n"
1551 "Configure OSPF area as nssa\n"
1552 "Do not inject inter-area routes into nssa\n")
1553{
1554 struct ospf *ospf = vty->index;
1555 struct in_addr area_id;
1556 int ret, format;
1557
1558 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1559
1560 ret = ospf_area_nssa_set (ospf, area_id);
1561 if (ret == 0)
1562 {
1563 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1564 VTY_NEWLINE);
1565 return CMD_WARNING;
1566 }
1567
1568 ospf_area_no_summary_set (ospf, area_id);
1569
1570 return CMD_SUCCESS;
1571}
1572
1573DEFUN (no_area_nssa,
1574 no_area_nssa_cmd,
1575 "no area (A.B.C.D|<0-4294967295>) nssa",
1576 NO_STR
1577 "OSPF area parameters\n"
1578 "OSPF area ID in IP address format\n"
1579 "OSPF area ID as a decimal value\n"
1580 "Configure OSPF area as nssa\n")
1581{
1582 struct ospf *ospf = vty->index;
1583 struct in_addr area_id;
1584 int format;
1585
1586 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1587
1588 ospf_area_nssa_unset (ospf, area_id);
1589 ospf_area_no_summary_unset (ospf, area_id);
1590
1591 return CMD_SUCCESS;
1592}
1593
1594DEFUN (no_area_nssa_no_summary,
1595 no_area_nssa_no_summary_cmd,
1596 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1597 NO_STR
1598 "OSPF area parameters\n"
1599 "OSPF area ID in IP address format\n"
1600 "OSPF area ID as a decimal value\n"
1601 "Configure OSPF area as nssa\n"
1602 "Do not inject inter-area routes into nssa\n")
1603{
1604 struct ospf *ospf = vty->index;
1605 struct in_addr area_id;
1606 int format;
1607
1608 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1609 ospf_area_no_summary_unset (ospf, area_id);
1610
1611 return CMD_SUCCESS;
1612}
1613
1614#endif /* HAVE_NSSA */
1615
1616DEFUN (area_default_cost,
1617 area_default_cost_cmd,
1618 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1619 "OSPF area parameters\n"
1620 "OSPF area ID in IP address format\n"
1621 "OSPF area ID as a decimal value\n"
1622 "Set the summary-default cost of a NSSA or stub area\n"
1623 "Stub's advertised default summary cost\n")
1624{
paul68980082003-03-25 05:07:42 +00001625 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001626 struct ospf_area *area;
1627 struct in_addr area_id;
1628 u_int32_t cost;
1629 int format;
1630
1631 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1632 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1633
paul68980082003-03-25 05:07:42 +00001634 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001635
1636 if (area->external_routing == OSPF_AREA_DEFAULT)
1637 {
1638 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1639 return CMD_WARNING;
1640 }
1641
1642 area->default_cost = cost;
1643
1644 return CMD_SUCCESS;
1645}
1646
1647DEFUN (no_area_default_cost,
1648 no_area_default_cost_cmd,
1649 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1650 NO_STR
1651 "OSPF area parameters\n"
1652 "OSPF area ID in IP address format\n"
1653 "OSPF area ID as a decimal value\n"
1654 "Set the summary-default cost of a NSSA or stub area\n"
1655 "Stub's advertised default summary cost\n")
1656{
paul68980082003-03-25 05:07:42 +00001657 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001658 struct ospf_area *area;
1659 struct in_addr area_id;
1660 u_int32_t cost;
1661 int format;
1662
1663 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1664 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1665
paul68980082003-03-25 05:07:42 +00001666 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001667 if (area == NULL)
1668 return CMD_SUCCESS;
1669
1670 if (area->external_routing == OSPF_AREA_DEFAULT)
1671 {
1672 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1673 return CMD_WARNING;
1674 }
1675
1676 area->default_cost = 1;
1677
paul68980082003-03-25 05:07:42 +00001678 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001679
1680 return CMD_SUCCESS;
1681}
1682
1683DEFUN (area_export_list,
1684 area_export_list_cmd,
1685 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1686 "OSPF area parameters\n"
1687 "OSPF area ID in IP address format\n"
1688 "OSPF area ID as a decimal value\n"
1689 "Set the filter for networks announced to other areas\n"
1690 "Name of the access-list\n")
1691{
paul68980082003-03-25 05:07:42 +00001692 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001693 struct ospf_area *area;
1694 struct in_addr area_id;
1695 int format;
1696
1697 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id, format, argv[0]);
1698
paul68980082003-03-25 05:07:42 +00001699 area = ospf_area_get (ospf, area_id, format);
1700 ospf_area_export_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001701
1702 return CMD_SUCCESS;
1703}
1704
1705DEFUN (no_area_export_list,
1706 no_area_export_list_cmd,
1707 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1708 NO_STR
1709 "OSPF area parameters\n"
1710 "OSPF area ID in IP address format\n"
1711 "OSPF area ID as a decimal value\n"
1712 "Unset the filter for networks announced to other areas\n"
1713 "Name of the access-list\n")
1714{
paul68980082003-03-25 05:07:42 +00001715 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001716 struct ospf_area *area;
1717 struct in_addr area_id;
1718 int format;
1719
1720 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id, format, argv[0]);
1721
paul68980082003-03-25 05:07:42 +00001722 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001723 if (area == NULL)
1724 return CMD_SUCCESS;
1725
paul68980082003-03-25 05:07:42 +00001726 ospf_area_export_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001727
1728 return CMD_SUCCESS;
1729}
1730
1731
1732DEFUN (area_import_list,
1733 area_import_list_cmd,
1734 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1735 "OSPF area parameters\n"
1736 "OSPF area ID in IP address format\n"
1737 "OSPF area ID as a decimal value\n"
1738 "Set the filter for networks from other areas announced to the specified one\n"
1739 "Name of the access-list\n")
1740{
paul68980082003-03-25 05:07:42 +00001741 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001742 struct ospf_area *area;
1743 struct in_addr area_id;
1744 int format;
1745
1746 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id, format, argv[0]);
1747
paul68980082003-03-25 05:07:42 +00001748 area = ospf_area_get (ospf, area_id, format);
1749 ospf_area_import_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001750
1751 return CMD_SUCCESS;
1752}
1753
1754DEFUN (no_area_import_list,
1755 no_area_import_list_cmd,
1756 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1757 NO_STR
1758 "OSPF area parameters\n"
1759 "OSPF area ID in IP address format\n"
1760 "OSPF area ID as a decimal value\n"
1761 "Unset the filter for networks announced to other areas\n"
1762 "Name of the access-list\n")
1763{
paul68980082003-03-25 05:07:42 +00001764 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001765 struct ospf_area *area;
1766 struct in_addr area_id;
1767 int format;
1768
1769 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id, format, argv[0]);
paul68980082003-03-25 05:07:42 +00001770 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001771 if (area == NULL)
1772 return CMD_SUCCESS;
1773
paul68980082003-03-25 05:07:42 +00001774 ospf_area_import_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001775
1776 return CMD_SUCCESS;
1777}
1778
1779DEFUN (area_filter_list,
1780 area_filter_list_cmd,
1781 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1782 "OSPF area parameters\n"
1783 "OSPF area ID in IP address format\n"
1784 "OSPF area ID as a decimal value\n"
1785 "Filter networks between OSPF areas\n"
1786 "Filter prefixes between OSPF areas\n"
1787 "Name of an IP prefix-list\n"
1788 "Filter networks sent to this area\n"
1789 "Filter networks sent from this area\n")
1790{
paul68980082003-03-25 05:07:42 +00001791 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001792 struct ospf_area *area;
1793 struct in_addr area_id;
1794 struct prefix_list *plist;
1795 int format;
1796
1797 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1798
paul68980082003-03-25 05:07:42 +00001799 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001800 plist = prefix_list_lookup (AFI_IP, argv[1]);
1801 if (strncmp (argv[2], "in", 2) == 0)
1802 {
1803 PREFIX_LIST_IN (area) = plist;
1804 if (PREFIX_NAME_IN (area))
1805 free (PREFIX_NAME_IN (area));
1806
1807 PREFIX_NAME_IN (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001808 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001809 }
1810 else
1811 {
1812 PREFIX_LIST_OUT (area) = plist;
1813 if (PREFIX_NAME_OUT (area))
1814 free (PREFIX_NAME_OUT (area));
1815
1816 PREFIX_NAME_OUT (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001817 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001818 }
1819
1820 return CMD_SUCCESS;
1821}
1822
1823DEFUN (no_area_filter_list,
1824 no_area_filter_list_cmd,
1825 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1826 NO_STR
1827 "OSPF area parameters\n"
1828 "OSPF area ID in IP address format\n"
1829 "OSPF area ID as a decimal value\n"
1830 "Filter networks between OSPF areas\n"
1831 "Filter prefixes between OSPF areas\n"
1832 "Name of an IP prefix-list\n"
1833 "Filter networks sent to this area\n"
1834 "Filter networks sent from this area\n")
1835{
paul68980082003-03-25 05:07:42 +00001836 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001837 struct ospf_area *area;
1838 struct in_addr area_id;
1839 struct prefix_list *plist;
1840 int format;
1841
1842 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1843
paul68980082003-03-25 05:07:42 +00001844 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001845 plist = prefix_list_lookup (AFI_IP, argv[1]);
1846 if (strncmp (argv[2], "in", 2) == 0)
1847 {
1848 if (PREFIX_NAME_IN (area))
1849 if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0)
1850 return CMD_SUCCESS;
1851
1852 PREFIX_LIST_IN (area) = NULL;
1853 if (PREFIX_NAME_IN (area))
1854 free (PREFIX_NAME_IN (area));
1855
1856 PREFIX_NAME_IN (area) = NULL;
1857
paul68980082003-03-25 05:07:42 +00001858 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001859 }
1860 else
1861 {
1862 if (PREFIX_NAME_OUT (area))
1863 if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0)
1864 return CMD_SUCCESS;
1865
1866 PREFIX_LIST_OUT (area) = NULL;
1867 if (PREFIX_NAME_OUT (area))
1868 free (PREFIX_NAME_OUT (area));
1869
1870 PREFIX_NAME_OUT (area) = NULL;
1871
paul68980082003-03-25 05:07:42 +00001872 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001873 }
1874
1875 return CMD_SUCCESS;
1876}
1877
1878
1879DEFUN (area_authentication_message_digest,
1880 area_authentication_message_digest_cmd,
1881 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1882 "OSPF area parameters\n"
1883 "Enable authentication\n"
1884 "Use message-digest authentication\n")
1885{
paul68980082003-03-25 05:07:42 +00001886 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001887 struct ospf_area *area;
1888 struct in_addr area_id;
1889 int format;
1890
1891 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1892
paul68980082003-03-25 05:07:42 +00001893 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001894 area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
1895
1896 return CMD_SUCCESS;
1897}
1898
1899DEFUN (area_authentication,
1900 area_authentication_cmd,
1901 "area (A.B.C.D|<0-4294967295>) authentication",
1902 "OSPF area parameters\n"
1903 "OSPF area ID in IP address format\n"
1904 "OSPF area ID as a decimal value\n"
1905 "Enable authentication\n")
1906{
paul68980082003-03-25 05:07:42 +00001907 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001908 struct ospf_area *area;
1909 struct in_addr area_id;
1910 int format;
1911
1912 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1913
paul68980082003-03-25 05:07:42 +00001914 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001915 area->auth_type = OSPF_AUTH_SIMPLE;
1916
1917 return CMD_SUCCESS;
1918}
1919
1920DEFUN (no_area_authentication,
1921 no_area_authentication_cmd,
1922 "no area (A.B.C.D|<0-4294967295>) authentication",
1923 NO_STR
1924 "OSPF area parameters\n"
1925 "OSPF area ID in IP address format\n"
1926 "OSPF area ID as a decimal value\n"
1927 "Enable authentication\n")
1928{
paul68980082003-03-25 05:07:42 +00001929 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001930 struct ospf_area *area;
1931 struct in_addr area_id;
1932 int format;
1933
1934 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1935
paul68980082003-03-25 05:07:42 +00001936 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001937 if (area == NULL)
1938 return CMD_SUCCESS;
1939
1940 area->auth_type = OSPF_AUTH_NULL;
1941
paul68980082003-03-25 05:07:42 +00001942 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001943
1944 return CMD_SUCCESS;
1945}
1946
1947
1948DEFUN (ospf_abr_type,
1949 ospf_abr_type_cmd,
1950 "ospf abr-type (cisco|ibm|shortcut|standard)",
1951 "OSPF specific commands\n"
1952 "Set OSPF ABR type\n"
1953 "Alternative ABR, cisco implementation\n"
1954 "Alternative ABR, IBM implementation\n"
1955 "Shortcut ABR\n"
1956 "Standard behavior (RFC2328)\n")
1957{
paul68980082003-03-25 05:07:42 +00001958 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001959 u_char abr_type = OSPF_ABR_UNKNOWN;
1960
1961 if (strncmp (argv[0], "c", 1) == 0)
1962 abr_type = OSPF_ABR_CISCO;
1963 else if (strncmp (argv[0], "i", 1) == 0)
1964 abr_type = OSPF_ABR_IBM;
1965 else if (strncmp (argv[0], "sh", 2) == 0)
1966 abr_type = OSPF_ABR_SHORTCUT;
1967 else if (strncmp (argv[0], "st", 2) == 0)
1968 abr_type = OSPF_ABR_STAND;
1969 else
1970 return CMD_WARNING;
1971
1972 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00001973 if (ospf->abr_type != abr_type)
paul718e3742002-12-13 20:15:29 +00001974 {
paul68980082003-03-25 05:07:42 +00001975 ospf->abr_type = abr_type;
1976 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001977 }
1978
1979 return CMD_SUCCESS;
1980}
1981
1982DEFUN (no_ospf_abr_type,
1983 no_ospf_abr_type_cmd,
1984 "no ospf abr-type (cisco|ibm|shortcut)",
1985 NO_STR
1986 "OSPF specific commands\n"
1987 "Set OSPF ABR type\n"
1988 "Alternative ABR, cisco implementation\n"
1989 "Alternative ABR, IBM implementation\n"
1990 "Shortcut ABR\n")
1991{
paul68980082003-03-25 05:07:42 +00001992 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001993 u_char abr_type = OSPF_ABR_UNKNOWN;
1994
1995 if (strncmp (argv[0], "c", 1) == 0)
1996 abr_type = OSPF_ABR_CISCO;
1997 else if (strncmp (argv[0], "i", 1) == 0)
1998 abr_type = OSPF_ABR_IBM;
1999 else if (strncmp (argv[0], "s", 1) == 0)
2000 abr_type = OSPF_ABR_SHORTCUT;
2001 else
2002 return CMD_WARNING;
2003
2004 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00002005 if (ospf->abr_type == abr_type)
paul718e3742002-12-13 20:15:29 +00002006 {
paul68980082003-03-25 05:07:42 +00002007 ospf->abr_type = OSPF_ABR_STAND;
2008 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00002009 }
2010
2011 return CMD_SUCCESS;
2012}
2013
2014DEFUN (ospf_compatible_rfc1583,
2015 ospf_compatible_rfc1583_cmd,
2016 "compatible rfc1583",
2017 "OSPF compatibility list\n"
2018 "compatible with RFC 1583\n")
2019{
2020 struct ospf *ospf = vty->index;
2021
2022 if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2023 {
2024 SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002025 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002026 }
2027 return CMD_SUCCESS;
2028}
2029
2030DEFUN (no_ospf_compatible_rfc1583,
2031 no_ospf_compatible_rfc1583_cmd,
2032 "no compatible rfc1583",
2033 NO_STR
2034 "OSPF compatibility list\n"
2035 "compatible with RFC 1583\n")
2036{
2037 struct ospf *ospf = vty->index;
2038
2039 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2040 {
2041 UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002042 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002043 }
2044 return CMD_SUCCESS;
2045}
2046
2047ALIAS (ospf_compatible_rfc1583,
2048 ospf_rfc1583_flag_cmd,
2049 "ospf rfc1583compatibility",
2050 "OSPF specific commands\n"
2051 "Enable the RFC1583Compatibility flag\n")
2052
2053ALIAS (no_ospf_compatible_rfc1583,
2054 no_ospf_rfc1583_flag_cmd,
2055 "no ospf rfc1583compatibility",
2056 NO_STR
2057 "OSPF specific commands\n"
2058 "Disable the RFC1583Compatibility flag\n")
2059
2060DEFUN (timers_spf,
2061 timers_spf_cmd,
2062 "timers spf <0-4294967295> <0-4294967295>",
2063 "Adjust routing timers\n"
2064 "OSPF SPF timers\n"
2065 "Delay between receiving a change to SPF calculation\n"
2066 "Hold time between consecutive SPF calculations\n")
2067{
2068 struct ospf *ospf = vty->index;
2069 u_int32_t delay, hold;
2070
2071 VTY_GET_UINT32 ("SPF delay timer", delay, argv[0]);
2072 VTY_GET_UINT32 ("SPF hold timer", hold, argv[1]);
2073
2074 ospf_timers_spf_set (ospf, delay, hold);
2075
2076 return CMD_SUCCESS;
2077}
2078
2079DEFUN (no_timers_spf,
2080 no_timers_spf_cmd,
2081 "no timers spf",
2082 NO_STR
2083 "Adjust routing timers\n"
2084 "OSPF SPF timers\n")
2085{
paul68980082003-03-25 05:07:42 +00002086 struct ospf *ospf = vty->index;
2087
2088 ospf->spf_delay = OSPF_SPF_DELAY_DEFAULT;
2089 ospf->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002090
2091 return CMD_SUCCESS;
2092}
2093
2094
2095DEFUN (neighbor,
2096 neighbor_cmd,
2097 "neighbor A.B.C.D",
2098 NEIGHBOR_STR
2099 "Neighbor IP address\n")
2100{
2101 struct ospf *ospf = vty->index;
2102 struct in_addr nbr_addr;
2103 int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2104 int interval = OSPF_POLL_INTERVAL_DEFAULT;
2105
2106 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2107
2108 if (argc > 1)
2109 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255);
2110
2111 if (argc > 2)
2112 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535);
2113
2114 ospf_nbr_nbma_set (ospf, nbr_addr);
2115 if (argc > 1)
2116 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2117 if (argc > 2)
2118 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority);
2119
2120 return CMD_SUCCESS;
2121}
2122
2123ALIAS (neighbor,
2124 neighbor_priority_poll_interval_cmd,
2125 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2126 NEIGHBOR_STR
2127 "Neighbor IP address\n"
2128 "Neighbor Priority\n"
2129 "Priority\n"
2130 "Dead Neighbor Polling interval\n"
2131 "Seconds\n")
2132
2133ALIAS (neighbor,
2134 neighbor_priority_cmd,
2135 "neighbor A.B.C.D priority <0-255>",
2136 NEIGHBOR_STR
2137 "Neighbor IP address\n"
2138 "Neighbor Priority\n"
2139 "Seconds\n")
2140
2141DEFUN (neighbor_poll_interval,
2142 neighbor_poll_interval_cmd,
2143 "neighbor A.B.C.D poll-interval <1-65535>",
2144 NEIGHBOR_STR
2145 "Neighbor IP address\n"
2146 "Dead Neighbor Polling interval\n"
2147 "Seconds\n")
2148{
2149 struct ospf *ospf = vty->index;
2150 struct in_addr nbr_addr;
2151 int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2152 int interval = OSPF_POLL_INTERVAL_DEFAULT;
2153
2154 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2155
2156 if (argc > 1)
2157 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535);
2158
2159 if (argc > 2)
2160 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255);
2161
2162 ospf_nbr_nbma_set (ospf, nbr_addr);
2163 if (argc > 1)
2164 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
2165 if (argc > 2)
2166 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2167
2168 return CMD_SUCCESS;
2169}
2170
2171ALIAS (neighbor_poll_interval,
2172 neighbor_poll_interval_priority_cmd,
2173 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2174 NEIGHBOR_STR
2175 "Neighbor address\n"
2176 "OSPF dead-router polling interval\n"
2177 "Seconds\n"
2178 "OSPF priority of non-broadcast neighbor\n"
2179 "Priority\n")
2180
2181DEFUN (no_neighbor,
2182 no_neighbor_cmd,
2183 "no neighbor A.B.C.D",
2184 NO_STR
2185 NEIGHBOR_STR
2186 "Neighbor IP address\n")
2187{
2188 struct ospf *ospf = vty->index;
2189 struct in_addr nbr_addr;
2190 int ret;
2191
2192 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2193
2194 ret = ospf_nbr_nbma_unset (ospf, nbr_addr);
2195
2196 return CMD_SUCCESS;
2197}
2198
2199ALIAS (no_neighbor,
2200 no_neighbor_priority_cmd,
2201 "no neighbor A.B.C.D priority <0-255>",
2202 NO_STR
2203 NEIGHBOR_STR
2204 "Neighbor IP address\n"
2205 "Neighbor Priority\n"
2206 "Priority\n")
2207
2208ALIAS (no_neighbor,
2209 no_neighbor_poll_interval_cmd,
2210 "no neighbor A.B.C.D poll-interval <1-65535>",
2211 NO_STR
2212 NEIGHBOR_STR
2213 "Neighbor IP address\n"
2214 "Dead Neighbor Polling interval\n"
2215 "Seconds\n")
2216
2217ALIAS (no_neighbor,
2218 no_neighbor_priority_pollinterval_cmd,
2219 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2220 NO_STR
2221 NEIGHBOR_STR
2222 "Neighbor IP address\n"
2223 "Neighbor Priority\n"
2224 "Priority\n"
2225 "Dead Neighbor Polling interval\n"
2226 "Seconds\n")
2227
2228
2229DEFUN (refresh_timer, refresh_timer_cmd,
2230 "refresh timer <10-1800>",
2231 "Adjust refresh parameters\n"
2232 "Set refresh timer\n"
2233 "Timer value in seconds\n")
2234{
2235 struct ospf *ospf = vty->index;
2236 int interval;
2237
2238 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2239 interval = (interval / 10) * 10;
2240
2241 ospf_timers_refresh_set (ospf, interval);
2242
2243 return CMD_SUCCESS;
2244}
2245
2246DEFUN (no_refresh_timer, no_refresh_timer_val_cmd,
2247 "no refresh timer <10-1800>",
2248 "Adjust refresh parameters\n"
2249 "Unset refresh timer\n"
2250 "Timer value in seconds\n")
2251{
2252 struct ospf *ospf = vty->index;
2253 int interval;
2254
2255 if (argc == 1)
2256 {
2257 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2258
2259 if (ospf->lsa_refresh_interval != interval ||
2260 interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
2261 return CMD_SUCCESS;
2262 }
2263
2264 ospf_timers_refresh_unset (ospf);
2265
2266 return CMD_SUCCESS;
2267}
2268
2269ALIAS (no_refresh_timer,
2270 no_refresh_timer_cmd,
2271 "no refresh timer",
2272 "Adjust refresh parameters\n"
2273 "Unset refresh timer\n")
2274
2275DEFUN (auto_cost_reference_bandwidth,
2276 auto_cost_reference_bandwidth_cmd,
2277 "auto-cost reference-bandwidth <1-4294967>",
2278 "Calculate OSPF interface cost according to bandwidth\n"
2279 "Use reference bandwidth method to assign OSPF cost\n"
2280 "The reference bandwidth in terms of Mbits per second\n")
2281{
paul68980082003-03-25 05:07:42 +00002282 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002283 u_int32_t refbw;
2284 listnode node;
2285
2286 refbw = strtol (argv[0], NULL, 10);
2287 if (refbw < 1 || refbw > 4294967)
2288 {
2289 vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
2290 return CMD_WARNING;
2291 }
2292
2293 /* If reference bandwidth is changed. */
paul68980082003-03-25 05:07:42 +00002294 if ((refbw * 1000) == ospf->ref_bandwidth)
paul718e3742002-12-13 20:15:29 +00002295 return CMD_SUCCESS;
2296
paul68980082003-03-25 05:07:42 +00002297 ospf->ref_bandwidth = refbw * 1000;
paul718e3742002-12-13 20:15:29 +00002298 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2299 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2300
paul68980082003-03-25 05:07:42 +00002301 for (node = listhead (ospf->iflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002302 ospf_if_recalculate_output_cost (getdata (node));
2303
2304 return CMD_SUCCESS;
2305}
2306
2307DEFUN (no_auto_cost_reference_bandwidth,
2308 no_auto_cost_reference_bandwidth_cmd,
2309 "no auto-cost reference-bandwidth",
2310 NO_STR
2311 "Calculate OSPF interface cost according to bandwidth\n"
2312 "Use reference bandwidth method to assign OSPF cost\n")
2313{
paul68980082003-03-25 05:07:42 +00002314 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002315 listnode node;
2316
paul68980082003-03-25 05:07:42 +00002317 if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00002318 return CMD_SUCCESS;
2319
paul68980082003-03-25 05:07:42 +00002320 ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;
paul718e3742002-12-13 20:15:29 +00002321 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2322 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2323
paul68980082003-03-25 05:07:42 +00002324 for (node = listhead (ospf->iflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002325 ospf_if_recalculate_output_cost (getdata (node));
2326
2327 return CMD_SUCCESS;
2328}
2329
paul718e3742002-12-13 20:15:29 +00002330char *ospf_abr_type_descr_str[] =
2331{
2332 "Unknown",
2333 "Standard (RFC2328)",
2334 "Alternative IBM",
2335 "Alternative Cisco",
2336 "Alternative Shortcut"
2337};
2338
2339char *ospf_shortcut_mode_descr_str[] =
2340{
2341 "Default",
2342 "Enabled",
2343 "Disabled"
2344};
2345
2346
2347
2348void
2349show_ip_ospf_area (struct vty *vty, struct ospf_area *area)
2350{
2351 /* Show Area ID. */
2352 vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id));
2353
2354 /* Show Area type/mode. */
2355 if (OSPF_IS_AREA_BACKBONE (area))
2356 vty_out (vty, " (Backbone)%s", VTY_NEWLINE);
2357 else
2358 {
2359 if (area->external_routing == OSPF_AREA_STUB)
2360 vty_out (vty, " (Stub%s%s)",
2361 area->no_summary ? ", no summary" : "",
2362 area->shortcut_configured ? "; " : "");
2363
2364#ifdef HAVE_NSSA
2365
2366 else
2367 if (area->external_routing == OSPF_AREA_NSSA)
2368 vty_out (vty, " (NSSA%s%s)",
2369 area->no_summary ? ", no summary" : "",
2370 area->shortcut_configured ? "; " : "");
2371#endif /* HAVE_NSSA */
2372
2373 vty_out (vty, "%s", VTY_NEWLINE);
2374 vty_out (vty, " Shortcutting mode: %s",
2375 ospf_shortcut_mode_descr_str[area->shortcut_configured]);
2376 vty_out (vty, ", S-bit consensus: %s%s",
2377 area->shortcut_capability ? "ok" : "no", VTY_NEWLINE);
2378 }
2379
2380 /* Show number of interfaces. */
2381 vty_out (vty, " Number of interfaces in this area: Total: %d, "
2382 "Active: %d%s", listcount (area->oiflist),
2383 area->act_ints, VTY_NEWLINE);
2384
2385#ifdef HAVE_NSSA
2386 if (area->external_routing == OSPF_AREA_NSSA)
2387 {
2388 vty_out (vty, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE, VTY_NEWLINE);
2389 if (! OSPF_IS_ABR)
2390 vty_out (vty, " It is not ABR, therefore not Translator. %s",
2391 VTY_NEWLINE);
2392 else
2393 {
2394 if (area->NSSATranslator)
2395 vty_out (vty, " We are an ABR and the NSSA Elected Translator. %s", VTY_NEWLINE);
2396 else
2397 vty_out (vty, " We are an ABR, but not the NSSA Elected Translator. %s", VTY_NEWLINE);
2398 }
2399 }
2400#endif /* HAVE_NSSA */
2401
2402 /* Show number of fully adjacent neighbors. */
2403 vty_out (vty, " Number of fully adjacent neighbors in this area:"
2404 " %d%s", area->full_nbrs, VTY_NEWLINE);
2405
2406 /* Show authentication type. */
2407 vty_out (vty, " Area has ");
2408 if (area->auth_type == OSPF_AUTH_NULL)
2409 vty_out (vty, "no authentication%s", VTY_NEWLINE);
2410 else if (area->auth_type == OSPF_AUTH_SIMPLE)
2411 vty_out (vty, "simple password authentication%s", VTY_NEWLINE);
2412 else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC)
2413 vty_out (vty, "message digest authentication%s", VTY_NEWLINE);
2414
2415 if (!OSPF_IS_AREA_BACKBONE (area))
2416 vty_out (vty, " Number of full virtual adjacencies going through"
2417 " this area: %d%s", area->full_vls, VTY_NEWLINE);
2418
2419 /* Show SPF calculation times. */
2420 vty_out (vty, " SPF algorithm executed %d times%s",
2421 area->spf_calculation, VTY_NEWLINE);
2422
2423 /* Show number of LSA. */
2424 vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE);
2425
2426 vty_out (vty, "%s", VTY_NEWLINE);
2427}
2428
2429DEFUN (show_ip_ospf,
2430 show_ip_ospf_cmd,
2431 "show ip ospf",
2432 SHOW_STR
2433 IP_STR
2434 "OSPF information\n")
2435{
2436 listnode node;
2437 struct ospf_area * area;
paul68980082003-03-25 05:07:42 +00002438 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002439
2440 /* Check OSPF is enable. */
paul68980082003-03-25 05:07:42 +00002441 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002442 {
2443 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2444 return CMD_SUCCESS;
2445 }
2446
2447 /* Show Router ID. */
2448 vty_out (vty, " OSPF Routing Process, Router ID: %s%s",
paul68980082003-03-25 05:07:42 +00002449 inet_ntoa (ospf->router_id),
paul718e3742002-12-13 20:15:29 +00002450 VTY_NEWLINE);
2451
2452 /* Show capability. */
2453 vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE);
2454 vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE);
2455 vty_out (vty, " RFC1583Compatibility flag is %s%s",
paul68980082003-03-25 05:07:42 +00002456 CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?
paul718e3742002-12-13 20:15:29 +00002457 "enabled" : "disabled", VTY_NEWLINE);
2458#ifdef HAVE_OPAQUE_LSA
2459 vty_out (vty, " OpaqueCapability flag is %s%s%s",
paul68980082003-03-25 05:07:42 +00002460 CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ?
paul718e3742002-12-13 20:15:29 +00002461 "enabled" : "disabled",
paul68980082003-03-25 05:07:42 +00002462 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ?
paul718e3742002-12-13 20:15:29 +00002463 " (origination blocked)" : "",
2464 VTY_NEWLINE);
2465#endif /* HAVE_OPAQUE_LSA */
2466
2467 /* Show SPF timers. */
2468 vty_out (vty, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s",
paul68980082003-03-25 05:07:42 +00002469 ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002470
2471 /* Show refresh parameters. */
2472 vty_out (vty, " Refresh timer %d secs%s",
paul68980082003-03-25 05:07:42 +00002473 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002474
2475 /* Show ABR/ASBR flags. */
paul68980082003-03-25 05:07:42 +00002476 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR))
paul718e3742002-12-13 20:15:29 +00002477 vty_out (vty, " This router is an ABR, ABR type is: %s%s",
paul68980082003-03-25 05:07:42 +00002478 ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002479
paul68980082003-03-25 05:07:42 +00002480 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR))
paul718e3742002-12-13 20:15:29 +00002481 vty_out (vty, " This router is an ASBR "
2482 "(injecting external routing information)%s", VTY_NEWLINE);
2483
2484 /* Show Number of AS-external-LSAs. */
2485 vty_out (vty, " Number of external LSA %ld%s",
paul68980082003-03-25 05:07:42 +00002486 ospf_lsdb_count_all (ospf->lsdb), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002487
2488 /* Show number of areas attached. */
2489 vty_out (vty, " Number of areas attached to this router: %d%s%s",
paul68980082003-03-25 05:07:42 +00002490 listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002491
2492 /* Show each area status. */
paul68980082003-03-25 05:07:42 +00002493 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002494 if ((area = getdata (node)) != NULL)
2495 show_ip_ospf_area (vty, area);
2496
2497 return CMD_SUCCESS;
2498}
2499
2500
2501void
paul68980082003-03-25 05:07:42 +00002502show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
2503 struct interface *ifp)
paul718e3742002-12-13 20:15:29 +00002504{
2505 struct ospf_neighbor *nbr;
2506 int oi_count;
2507 struct route_node *rn;
2508 char buf[9];
2509
2510 oi_count = ospf_oi_count (ifp);
2511
2512 /* Is interface up? */
paul2e3b2e42002-12-13 21:03:13 +00002513 if (if_is_operative (ifp)) {
2514 vty_out (vty, "%s is up%s", ifp->name, VTY_NEWLINE);
2515 } else
2516 {
2517 vty_out (vty, "%s is down%s", ifp->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002518
2519
2520 if (oi_count == 0)
2521 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
2522 else
2523 vty_out (vty, " OSPF is enabled, but not running on this interface%s",
2524 VTY_NEWLINE);
2525 return;
2526 }
2527
2528 /* Is interface OSPF enabled? */
2529 if (oi_count == 0)
2530 {
2531 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
2532 return;
2533 }
2534
2535 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
2536 {
2537 struct ospf_interface *oi = rn->info;
2538
2539 if (oi == NULL)
2540 continue;
2541
2542 /* Show OSPF interface information. */
2543 vty_out (vty, " Internet Address %s/%d,",
2544 inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
2545
2546 vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
2547 VTY_NEWLINE);
2548
2549 vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s",
paul68980082003-03-25 05:07:42 +00002550 inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
paul718e3742002-12-13 20:15:29 +00002551 oi->output_cost, VTY_NEWLINE);
2552
2553 vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s",
2554 OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state),
2555 PRIORITY (oi), VTY_NEWLINE);
2556
2557 /* Show DR information. */
2558 if (DR (oi).s_addr == 0)
2559 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2560 else
2561 {
2562 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi));
2563 if (nbr == NULL)
2564 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2565 else
2566 {
2567 vty_out (vty, " Designated Router (ID) %s,",
2568 inet_ntoa (nbr->router_id));
2569 vty_out (vty, " Interface Address %s%s",
2570 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2571 }
2572 }
2573
2574 /* Show BDR information. */
2575 if (BDR (oi).s_addr == 0)
2576 vty_out (vty, " No backup designated router on this network%s",
2577 VTY_NEWLINE);
2578 else
2579 {
2580 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi));
2581 if (nbr == NULL)
2582 vty_out (vty, " No backup designated router on this network%s",
2583 VTY_NEWLINE);
2584 else
2585 {
2586 vty_out (vty, " Backup Designated Router (ID) %s,",
2587 inet_ntoa (nbr->router_id));
2588 vty_out (vty, " Interface Address %s%s",
2589 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2590 }
2591 }
2592 vty_out (vty, " Timer intervals configured,");
2593 vty_out (vty, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2594 OSPF_IF_PARAM (oi, v_hello), OSPF_IF_PARAM (oi, v_wait),
2595 OSPF_IF_PARAM (oi, v_wait),
2596 OSPF_IF_PARAM (oi, retransmit_interval),
2597 VTY_NEWLINE);
2598
2599 if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE)
2600 vty_out (vty, " Hello due in %s%s",
2601 ospf_timer_dump (oi->t_hello, buf, 9), VTY_NEWLINE);
2602 else /* OSPF_IF_PASSIVE is set */
2603 vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
2604
2605 vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
paul68980082003-03-25 05:07:42 +00002606 ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full),
paul718e3742002-12-13 20:15:29 +00002607 VTY_NEWLINE);
2608 }
2609}
2610
2611DEFUN (show_ip_ospf_interface,
2612 show_ip_ospf_interface_cmd,
2613 "show ip ospf interface [INTERFACE]",
2614 SHOW_STR
2615 IP_STR
2616 "OSPF information\n"
2617 "Interface information\n"
2618 "Interface name\n")
2619{
2620 struct interface *ifp;
paul68980082003-03-25 05:07:42 +00002621 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002622 listnode node;
2623
2624 /* Show All Interfaces. */
2625 if (argc == 0)
2626 for (node = listhead (iflist); node; nextnode (node))
paul68980082003-03-25 05:07:42 +00002627 show_ip_ospf_interface_sub (vty, ospf, node->data);
paul718e3742002-12-13 20:15:29 +00002628 /* Interface name is specified. */
2629 else
2630 {
2631 if ((ifp = if_lookup_by_name (argv[0])) == NULL)
2632 vty_out (vty, "No such interface name%s", VTY_NEWLINE);
2633 else
paul68980082003-03-25 05:07:42 +00002634 show_ip_ospf_interface_sub (vty, ospf, ifp);
paul718e3742002-12-13 20:15:29 +00002635 }
2636
2637 return CMD_SUCCESS;
2638}
2639
2640void
2641show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi)
2642{
2643 struct route_node *rn;
2644 struct ospf_neighbor *nbr;
2645 char msgbuf[16];
2646 char timebuf[9];
2647
2648 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2649 if ((nbr = rn->info))
2650 /* Do not show myself. */
2651 if (nbr != oi->nbr_self)
2652 /* Down state is not shown. */
2653 if (nbr->state != NSM_Down)
2654 {
2655 ospf_nbr_state_message (nbr, msgbuf, 16);
2656
2657 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
2658 vty_out (vty, "%-15s %3d %-15s %8s ",
2659 "-", nbr->priority,
2660 msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9));
2661 else
2662 vty_out (vty, "%-15s %3d %-15s %8s ",
2663 inet_ntoa (nbr->router_id), nbr->priority,
2664 msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9));
2665 vty_out (vty, "%-15s ", inet_ntoa (nbr->src));
2666 vty_out (vty, "%-15s %5ld %5ld %5d%s",
2667 IF_NAME (oi), ospf_ls_retransmit_count (nbr),
2668 ospf_ls_request_count (nbr), ospf_db_summary_count (nbr),
2669 VTY_NEWLINE);
2670 }
2671}
2672
2673DEFUN (show_ip_ospf_neighbor,
2674 show_ip_ospf_neighbor_cmd,
2675 "show ip ospf neighbor",
2676 SHOW_STR
2677 IP_STR
2678 "OSPF information\n"
2679 "Neighbor list\n")
2680{
paul68980082003-03-25 05:07:42 +00002681 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002682 listnode node;
2683
paul68980082003-03-25 05:07:42 +00002684 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002685 {
2686 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2687 return CMD_SUCCESS;
2688 }
2689
2690 /* Show All neighbors. */
2691 vty_out (vty, "%sNeighbor ID Pri State Dead "
2692 "Time Address Interface RXmtL "
2693 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2694
paul68980082003-03-25 05:07:42 +00002695 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002696 show_ip_ospf_neighbor_sub (vty, getdata (node));
2697
2698 return CMD_SUCCESS;
2699}
2700
2701DEFUN (show_ip_ospf_neighbor_all,
2702 show_ip_ospf_neighbor_all_cmd,
2703 "show ip ospf neighbor all",
2704 SHOW_STR
2705 IP_STR
2706 "OSPF information\n"
2707 "Neighbor list\n"
2708 "include down status neighbor\n")
2709{
paul68980082003-03-25 05:07:42 +00002710 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002711 listnode node;
2712
paul68980082003-03-25 05:07:42 +00002713 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002714 {
2715 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2716 return CMD_SUCCESS;
2717 }
2718
2719 /* Show All neighbors. */
2720 vty_out (vty, "%sNeighbor ID Pri State Dead "
2721 "Time Address Interface RXmtL "
2722 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2723
paul68980082003-03-25 05:07:42 +00002724 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002725 {
2726 struct ospf_interface *oi = getdata (node);
2727 listnode nbr_node;
2728
2729 show_ip_ospf_neighbor_sub (vty, oi);
2730
2731 /* print Down neighbor status */
2732 for (nbr_node = listhead (oi->nbr_nbma); nbr_node; nextnode (nbr_node))
2733 {
2734 struct ospf_nbr_nbma *nbr_nbma;
2735
2736 nbr_nbma = getdata (nbr_node);
2737
2738 if (nbr_nbma->nbr == NULL
2739 || nbr_nbma->nbr->state == NSM_Down)
2740 {
2741 vty_out (vty, "%-15s %3d %-15s %8s ",
2742 "-", nbr_nbma->priority, "Down", "-");
2743 vty_out (vty, "%-15s %-15s %5d %5d %5d%s",
2744 inet_ntoa (nbr_nbma->addr), IF_NAME (oi),
2745 0, 0, 0, VTY_NEWLINE);
2746 }
2747 }
2748 }
2749
2750 return CMD_SUCCESS;
2751}
2752
2753DEFUN (show_ip_ospf_neighbor_int,
2754 show_ip_ospf_neighbor_int_cmd,
2755 "show ip ospf neighbor A.B.C.D",
2756 SHOW_STR
2757 IP_STR
2758 "OSPF information\n"
2759 "Neighbor list\n"
2760 "Interface name\n")
2761{
paul68980082003-03-25 05:07:42 +00002762 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002763 struct ospf_interface *oi;
2764 struct in_addr addr;
2765 int ret;
2766
paul68980082003-03-25 05:07:42 +00002767 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002768 {
2769 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2770 return CMD_SUCCESS;
2771 }
2772
2773 ret = inet_aton (argv[0], &addr);
2774 if (!ret)
2775 {
2776 vty_out (vty, "Please specify interface address by A.B.C.D%s",
2777 VTY_NEWLINE);
2778 return CMD_WARNING;
2779 }
2780
paul68980082003-03-25 05:07:42 +00002781 if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL)
paul718e3742002-12-13 20:15:29 +00002782 vty_out (vty, "No such interface address%s", VTY_NEWLINE);
2783 else
2784 {
2785 vty_out (vty, "%sNeighbor ID Pri State Dead "
2786 "Time Address Interface RXmtL "
2787 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2788 show_ip_ospf_neighbor_sub (vty, oi);
2789 }
2790
2791 return CMD_SUCCESS;
2792}
2793
2794void
2795show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi,
2796 struct ospf_nbr_nbma *nbr_nbma)
2797{
2798 char timebuf[9];
2799
2800 /* Show neighbor ID. */
2801 vty_out (vty, " Neighbor %s,", "-");
2802
2803 /* Show interface address. */
2804 vty_out (vty, " interface address %s%s",
2805 inet_ntoa (nbr_nbma->addr), VTY_NEWLINE);
2806 /* Show Area ID. */
2807 vty_out (vty, " In the area %s via interface %s%s",
2808 ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE);
2809 /* Show neighbor priority and state. */
2810 vty_out (vty, " Neighbor priority is %d, State is %s,",
2811 nbr_nbma->priority, "Down");
2812 /* Show state changes. */
2813 vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE);
2814
2815 /* Show PollInterval */
2816 vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE);
2817
2818 /* Show poll-interval timer. */
2819 vty_out (vty, " Poll timer due in %s%s",
2820 ospf_timer_dump (nbr_nbma->t_poll, timebuf, 9), VTY_NEWLINE);
2821
2822 /* Show poll-interval timer thread. */
2823 vty_out (vty, " Thread Poll Timer %s%s",
2824 nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE);
2825}
2826
2827void
2828show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
2829 struct ospf_neighbor *nbr)
2830{
2831 char timebuf[9];
2832
2833 /* Show neighbor ID. */
2834 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
2835 vty_out (vty, " Neighbor %s,", "-");
2836 else
2837 vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id));
2838
2839 /* Show interface address. */
2840 vty_out (vty, " interface address %s%s",
2841 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2842 /* Show Area ID. */
2843 vty_out (vty, " In the area %s via interface %s%s",
2844 ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE);
2845 /* Show neighbor priority and state. */
2846 vty_out (vty, " Neighbor priority is %d, State is %s,",
2847 nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state));
2848 /* Show state changes. */
2849 vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
2850
2851 /* Show Designated Rotuer ID. */
2852 vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router));
2853 /* Show Backup Designated Rotuer ID. */
2854 vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE);
2855 /* Show options. */
2856 vty_out (vty, " Options %d %s%s", nbr->options,
2857 ospf_options_dump (nbr->options), VTY_NEWLINE);
2858 /* Show Router Dead interval timer. */
2859 vty_out (vty, " Dead timer due in %s%s",
2860 ospf_timer_dump (nbr->t_inactivity, timebuf, 9), VTY_NEWLINE);
2861 /* Show Database Summary list. */
2862 vty_out (vty, " Database Summary List %d%s",
2863 ospf_db_summary_count (nbr), VTY_NEWLINE);
2864 /* Show Link State Request list. */
2865 vty_out (vty, " Link State Request List %ld%s",
2866 ospf_ls_request_count (nbr), VTY_NEWLINE);
2867 /* Show Link State Retransmission list. */
2868 vty_out (vty, " Link State Retransmission List %ld%s",
2869 ospf_ls_retransmit_count (nbr), VTY_NEWLINE);
2870 /* Show inactivity timer thread. */
2871 vty_out (vty, " Thread Inactivity Timer %s%s",
2872 nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE);
2873 /* Show Database Description retransmission thread. */
2874 vty_out (vty, " Thread Database Description Retransmision %s%s",
2875 nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE);
2876 /* Show Link State Request Retransmission thread. */
2877 vty_out (vty, " Thread Link State Request Retransmission %s%s",
2878 nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE);
2879 /* Show Link State Update Retransmission thread. */
2880 vty_out (vty, " Thread Link State Update Retransmission %s%s%s",
2881 nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE);
2882}
2883
2884DEFUN (show_ip_ospf_neighbor_id,
2885 show_ip_ospf_neighbor_id_cmd,
2886 "show ip ospf neighbor A.B.C.D",
2887 SHOW_STR
2888 IP_STR
2889 "OSPF information\n"
2890 "Neighbor list\n"
2891 "Neighbor ID\n")
2892{
paul68980082003-03-25 05:07:42 +00002893 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002894 listnode node;
2895 struct ospf_neighbor *nbr;
2896 struct in_addr router_id;
2897 int ret;
2898
2899 ret = inet_aton (argv[0], &router_id);
2900 if (!ret)
2901 {
2902 vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE);
2903 return CMD_WARNING;
2904 }
2905
paul68980082003-03-25 05:07:42 +00002906 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002907 {
2908 struct ospf_interface *oi = getdata (node);
2909
2910 if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id)))
2911 {
2912 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
2913 return CMD_SUCCESS;
2914 }
2915 }
2916
2917 /* Nothing to show. */
2918 return CMD_SUCCESS;
2919}
2920
2921DEFUN (show_ip_ospf_neighbor_detail,
2922 show_ip_ospf_neighbor_detail_cmd,
2923 "show ip ospf neighbor detail",
2924 SHOW_STR
2925 IP_STR
2926 "OSPF information\n"
2927 "Neighbor list\n"
2928 "detail of all neighbors\n")
2929{
paul68980082003-03-25 05:07:42 +00002930 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002931 listnode node;
2932
paul68980082003-03-25 05:07:42 +00002933 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002934 return CMD_SUCCESS;
2935
paul68980082003-03-25 05:07:42 +00002936 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002937 {
2938 struct ospf_interface *oi = getdata (node);
2939 struct route_node *rn;
2940 struct ospf_neighbor *nbr;
2941
2942 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2943 if ((nbr = rn->info))
2944 if (nbr != oi->nbr_self)
2945 if (nbr->state != NSM_Down)
2946 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
2947 }
2948
2949 return CMD_SUCCESS;
2950}
2951
2952DEFUN (show_ip_ospf_neighbor_detail_all,
2953 show_ip_ospf_neighbor_detail_all_cmd,
2954 "show ip ospf neighbor detail all",
2955 SHOW_STR
2956 IP_STR
2957 "OSPF information\n"
2958 "Neighbor list\n"
2959 "detail of all neighbors\n"
2960 "include down status neighbor\n")
2961{
paul68980082003-03-25 05:07:42 +00002962 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00002963 listnode node;
2964
paul68980082003-03-25 05:07:42 +00002965 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002966 return CMD_SUCCESS;
2967
paul68980082003-03-25 05:07:42 +00002968 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002969 {
2970 struct ospf_interface *oi = getdata (node);
2971 struct route_node *rn;
2972 struct ospf_neighbor *nbr;
2973
2974 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2975 if ((nbr = rn->info))
2976 if (nbr != oi->nbr_self)
2977 if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down)
2978 show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info);
2979
2980 if (oi->type == OSPF_IFTYPE_NBMA)
2981 {
2982 listnode nd;
2983
2984 for (nd = listhead (oi->nbr_nbma); nd; nextnode (nd))
2985 {
2986 struct ospf_nbr_nbma *nbr_nbma = getdata (nd);
2987 if (nbr_nbma->nbr == NULL
2988 || nbr_nbma->nbr->state == NSM_Down)
2989 show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma);
2990 }
2991 }
2992 }
2993
2994 return CMD_SUCCESS;
2995}
2996
2997DEFUN (show_ip_ospf_neighbor_int_detail,
2998 show_ip_ospf_neighbor_int_detail_cmd,
2999 "show ip ospf neighbor A.B.C.D detail",
3000 SHOW_STR
3001 IP_STR
3002 "OSPF information\n"
3003 "Neighbor list\n"
3004 "Interface address\n"
3005 "detail of all neighbors")
3006{
3007 struct ospf_interface *oi;
3008 struct in_addr addr;
3009 int ret;
3010
3011 ret = inet_aton (argv[0], &addr);
3012 if (!ret)
3013 {
3014 vty_out (vty, "Please specify interface address by A.B.C.D%s",
3015 VTY_NEWLINE);
3016 return CMD_WARNING;
3017 }
3018
paul68980082003-03-25 05:07:42 +00003019 if (ospf_top == NULL)
3020 return CMD_WARNING;
3021
3022 if ((oi = ospf_if_is_configured (ospf_top, &addr)) == NULL)
paul718e3742002-12-13 20:15:29 +00003023 vty_out (vty, "No such interface address%s", VTY_NEWLINE);
3024 else
3025 {
3026 struct route_node *rn;
3027 struct ospf_neighbor *nbr;
3028
3029 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3030 if ((nbr = rn->info))
3031 if (nbr != oi->nbr_self)
3032 if (nbr->state != NSM_Down)
3033 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
3034 }
3035
3036 return CMD_SUCCESS;
3037}
3038
3039
3040/* Show functions */
3041int
3042show_lsa_summary (struct ospf_lsa *lsa, void *v, int self)
3043{
3044 struct vty *vty = (struct vty *) v;
3045 struct router_lsa *rl;
3046 struct summary_lsa *sl;
3047 struct as_external_lsa *asel;
3048 struct prefix_ipv4 p;
3049
3050 if (lsa != NULL)
3051 /* If self option is set, check LSA self flag. */
3052 if (self == 0 || IS_LSA_SELF (lsa))
3053 {
3054 /* LSA common part show. */
3055 vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id));
3056 vty_out (vty, "%-15s %4d 0x%08lx 0x%04x",
3057 inet_ntoa (lsa->data->adv_router), LS_AGE (lsa),
3058 (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum));
3059 /* LSA specific part show. */
3060 switch (lsa->data->type)
3061 {
3062 case OSPF_ROUTER_LSA:
3063 rl = (struct router_lsa *) lsa->data;
3064 vty_out (vty, " %-d", ntohs (rl->links));
3065 break;
3066 case OSPF_SUMMARY_LSA:
3067 sl = (struct summary_lsa *) lsa->data;
3068
3069 p.family = AF_INET;
3070 p.prefix = sl->header.id;
3071 p.prefixlen = ip_masklen (sl->mask);
3072 apply_mask_ipv4 (&p);
3073
3074 vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen);
3075 break;
3076 case OSPF_AS_EXTERNAL_LSA:
3077 asel = (struct as_external_lsa *) lsa->data;
3078
3079 p.family = AF_INET;
3080 p.prefix = asel->header.id;
3081 p.prefixlen = ip_masklen (asel->mask);
3082 apply_mask_ipv4 (&p);
3083
3084 vty_out (vty, " %s %s/%d [0x%lx]",
3085 IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1",
3086 inet_ntoa (p.prefix), p.prefixlen,
3087 (u_long)ntohl (asel->e[0].route_tag));
3088 break;
3089 case OSPF_NETWORK_LSA:
3090 case OSPF_ASBR_SUMMARY_LSA:
3091#ifdef HAVE_OPAQUE_LSA
3092 case OSPF_OPAQUE_LINK_LSA:
3093 case OSPF_OPAQUE_AREA_LSA:
3094 case OSPF_OPAQUE_AS_LSA:
3095#endif /* HAVE_OPAQUE_LSA */
3096 default:
3097 break;
3098 }
3099 vty_out (vty, VTY_NEWLINE);
3100 }
3101
3102 return 0;
3103}
3104
3105char *show_database_desc[] =
3106{
3107 "unknown",
3108 "Router Link States",
3109 "Net Link States",
3110 "Summary Link States",
3111 "ASBR-Summary Link States",
3112 "AS External Link States",
3113#if defined (HAVE_NSSA) || defined (HAVE_OPAQUE_LSA)
3114 "Group Membership LSA",
3115 "NSSA-external Link States",
3116#endif /* HAVE_NSSA */
3117#ifdef HAVE_OPAQUE_LSA
3118 "Type-8 LSA",
3119 "Link-Local Opaque-LSA",
3120 "Area-Local Opaque-LSA",
3121 "AS-external Opaque-LSA",
3122#endif /* HAVE_OPAQUE_LSA */
3123};
3124
3125#define SHOW_OSPF_COMMON_HEADER \
3126 "Link ID ADV Router Age Seq# CkSum"
3127
3128char *show_database_header[] =
3129{
3130 "",
3131 "Link ID ADV Router Age Seq# CkSum Link count",
3132 "Link ID ADV Router Age Seq# CkSum",
3133 "Link ID ADV Router Age Seq# CkSum Route",
3134 "Link ID ADV Router Age Seq# CkSum",
3135 "Link ID ADV Router Age Seq# CkSum Route",
3136#ifdef HAVE_NSSA
3137 " --- header for Group Member ----",
3138 "Link ID ADV Router Age Seq# CkSum Route",
3139#endif /* HAVE_NSSA */
3140#ifdef HAVE_OPAQUE_LSA
3141#ifndef HAVE_NSSA
3142 " --- type-6 ---",
3143 " --- type-7 ---",
3144#endif /* HAVE_NSSA */
3145 " --- type-8 ---",
3146 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3147 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3148 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3149#endif /* HAVE_OPAQUE_LSA */
3150};
3151
3152void
3153show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa)
3154{
3155 struct router_lsa *rlsa = (struct router_lsa*) lsa->data;
3156
3157 vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE);
3158 vty_out (vty, " Options: %d%s", lsa->data->options, VTY_NEWLINE);
3159
3160 if (lsa->data->type == OSPF_ROUTER_LSA)
3161 {
3162 vty_out (vty, " Flags: 0x%x" , rlsa->flags);
3163
3164 if (rlsa->flags)
3165 vty_out (vty, " :%s%s%s%s",
3166 IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "",
3167 IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "",
3168 IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "",
3169 IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : "");
3170
3171 vty_out (vty, "%s", VTY_NEWLINE);
3172 }
3173 vty_out (vty, " LS Type: %s%s",
3174 LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE);
3175 vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id),
3176 LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE);
3177 vty_out (vty, " Advertising Router: %s%s",
3178 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3179 vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum),
3180 VTY_NEWLINE);
3181 vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum),
3182 VTY_NEWLINE);
3183 vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE);
3184}
3185
3186char *link_type_desc[] =
3187{
3188 "(null)",
3189 "another Router (point-to-point)",
3190 "a Transit Network",
3191 "Stub Network",
3192 "a Virtual Link",
3193};
3194
3195char *link_id_desc[] =
3196{
3197 "(null)",
3198 "Neighboring Router ID",
3199 "Designated Router address",
paul68980082003-03-25 05:07:42 +00003200 "Net",
paul718e3742002-12-13 20:15:29 +00003201 "Neighboring Router ID",
3202};
3203
3204char *link_data_desc[] =
3205{
3206 "(null)",
3207 "Router Interface address",
3208 "Router Interface address",
3209 "Network Mask",
3210 "Router Interface address",
3211};
3212
3213/* Show router-LSA each Link information. */
3214void
3215show_ip_ospf_database_router_links (struct vty *vty,
3216 struct router_lsa *rl)
3217{
3218 int len, i, type;
3219
3220 len = ntohs (rl->header.length) - 4;
3221 for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++)
3222 {
3223 type = rl->link[i].type;
3224
3225 vty_out (vty, " Link connected to: %s%s",
3226 link_type_desc[type], VTY_NEWLINE);
3227 vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type],
3228 inet_ntoa (rl->link[i].link_id), VTY_NEWLINE);
3229 vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type],
3230 inet_ntoa (rl->link[i].link_data), VTY_NEWLINE);
3231 vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE);
3232 vty_out (vty, " TOS 0 Metric: %d%s",
3233 ntohs (rl->link[i].metric), VTY_NEWLINE);
3234 vty_out (vty, "%s", VTY_NEWLINE);
3235 }
3236}
3237
3238/* Show router-LSA detail information. */
3239int
3240show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3241{
3242 if (lsa != NULL)
3243 {
3244 struct router_lsa *rl = (struct router_lsa *) lsa->data;
3245
3246 show_ip_ospf_database_header (vty, lsa);
3247
3248 vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links),
3249 VTY_NEWLINE, VTY_NEWLINE);
3250
3251 show_ip_ospf_database_router_links (vty, rl);
3252 }
3253
3254 return 0;
3255}
3256
3257/* Show network-LSA detail information. */
3258int
3259show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3260{
3261 int length, i;
3262
3263 if (lsa != NULL)
3264 {
3265 struct network_lsa *nl = (struct network_lsa *) lsa->data;
3266
3267 show_ip_ospf_database_header (vty, lsa);
3268
3269 vty_out (vty, " Network Mask: /%d%s",
3270 ip_masklen (nl->mask), VTY_NEWLINE);
3271
3272 length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4;
3273
3274 for (i = 0; length > 0; i++, length -= 4)
3275 vty_out (vty, " Attached Router: %s%s",
3276 inet_ntoa (nl->routers[i]), VTY_NEWLINE);
3277
3278 vty_out (vty, "%s", VTY_NEWLINE);
3279 }
3280
3281 return 0;
3282}
3283
3284/* Show summary-LSA detail information. */
3285int
3286show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3287{
3288 if (lsa != NULL)
3289 {
3290 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3291
3292 show_ip_ospf_database_header (vty, lsa);
3293
3294 vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask),
3295 VTY_NEWLINE);
3296 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3297 VTY_NEWLINE);
3298 }
3299
3300 return 0;
3301}
3302
3303/* Show summary-ASBR-LSA detail information. */
3304int
3305show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3306{
3307 if (lsa != NULL)
3308 {
3309 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3310
3311 show_ip_ospf_database_header (vty, lsa);
3312
3313 vty_out (vty, " Network Mask: /%d%s",
3314 ip_masklen (sl->mask), VTY_NEWLINE);
3315 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3316 VTY_NEWLINE);
3317 }
3318
3319 return 0;
3320}
3321
3322/* Show AS-external-LSA detail information. */
3323int
3324show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3325{
3326 if (lsa != NULL)
3327 {
3328 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3329
3330 show_ip_ospf_database_header (vty, lsa);
3331
3332 vty_out (vty, " Network Mask: /%d%s",
3333 ip_masklen (al->mask), VTY_NEWLINE);
3334 vty_out (vty, " Metric Type: %s%s",
3335 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3336 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3337 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3338 vty_out (vty, " Metric: %d%s",
3339 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3340 vty_out (vty, " Forward Address: %s%s",
3341 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3342
3343 vty_out (vty, " External Route Tag: %lu%s%s",
3344 (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3345 }
3346
3347 return 0;
3348}
3349
3350#ifdef HAVE_NSSA
3351int
3352show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
3353{
3354 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3355
3356 /* show_ip_ospf_database_header (vty, lsa); */
3357
3358 zlog_info( " Network Mask: /%d%s",
3359 ip_masklen (al->mask), "\n");
3360 zlog_info( " Metric Type: %s%s",
3361 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3362 "2 (Larger than any link state path)" : "1", "\n");
3363 zlog_info( " TOS: 0%s", "\n");
3364 zlog_info( " Metric: %d%s",
3365 GET_METRIC (al->e[0].metric), "\n");
3366 zlog_info( " Forward Address: %s%s",
3367 inet_ntoa (al->e[0].fwd_addr), "\n");
3368
3369 zlog_info( " External Route Tag: %u%s%s",
3370 ntohl (al->e[0].route_tag), "\n", "\n");
3371
3372 return 0;
3373}
3374
3375/* Show AS-NSSA-LSA detail information. */
3376int
3377show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3378{
3379 if (lsa != NULL)
3380 {
3381 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3382
3383 show_ip_ospf_database_header (vty, lsa);
3384
3385 vty_out (vty, " Network Mask: /%d%s",
3386 ip_masklen (al->mask), VTY_NEWLINE);
3387 vty_out (vty, " Metric Type: %s%s",
3388 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3389 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3390 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3391 vty_out (vty, " Metric: %d%s",
3392 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3393 vty_out (vty, " NSSA: Forward Address: %s%s",
3394 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3395
3396 vty_out (vty, " External Route Tag: %u%s%s",
3397 ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3398 }
3399
3400 return 0;
3401}
3402
3403#endif /* HAVE_NSSA */
3404
3405int
3406show_func_dummy (struct vty *vty, struct ospf_lsa *lsa)
3407{
3408 return 0;
3409}
3410
3411#ifdef HAVE_OPAQUE_LSA
3412int
3413show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3414{
3415 if (lsa != NULL)
3416 {
3417 show_ip_ospf_database_header (vty, lsa);
3418 show_opaque_info_detail (vty, lsa);
3419
3420 vty_out (vty, "%s", VTY_NEWLINE);
3421 }
3422 return 0;
3423}
3424#endif /* HAVE_OPAQUE_LSA */
3425
3426int (*show_function[])(struct vty *, struct ospf_lsa *) =
3427{
3428 NULL,
3429 show_router_lsa_detail,
3430 show_network_lsa_detail,
3431 show_summary_lsa_detail,
3432 show_summary_asbr_lsa_detail,
3433 show_as_external_lsa_detail,
3434#ifdef HAVE_NSSA
3435 show_func_dummy,
3436 show_as_nssa_lsa_detail, /* almost same as external */
3437#endif /* HAVE_NSSA */
3438#ifdef HAVE_OPAQUE_LSA
3439#ifndef HAVE_NSSA
3440 show_func_dummy,
3441 show_func_dummy,
3442#endif /* HAVE_NSSA */
3443 NULL, /* type-8 */
3444 show_opaque_lsa_detail,
3445 show_opaque_lsa_detail,
3446 show_opaque_lsa_detail,
3447#endif /* HAVE_OPAQUE_LSA */
3448};
3449
3450void
3451show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id,
3452 struct in_addr *adv_router)
3453{
3454 memset (lp, 0, sizeof (struct prefix_ls));
3455 lp->family = 0;
3456 if (id == NULL)
3457 lp->prefixlen = 0;
3458 else if (adv_router == NULL)
3459 {
3460 lp->prefixlen = 32;
3461 lp->id = *id;
3462 }
3463 else
3464 {
3465 lp->prefixlen = 64;
3466 lp->id = *id;
3467 lp->adv_router = *adv_router;
3468 }
3469}
3470
3471void
3472show_lsa_detail_proc (struct vty *vty, struct route_table *rt,
3473 struct in_addr *id, struct in_addr *adv_router)
3474{
3475 struct prefix_ls lp;
3476 struct route_node *rn, *start;
3477 struct ospf_lsa *lsa;
3478
3479 show_lsa_prefix_set (vty, &lp, id, adv_router);
3480 start = route_node_get (rt, (struct prefix *) &lp);
3481 if (start)
3482 {
3483 route_lock_node (start);
3484 for (rn = start; rn; rn = route_next_until (rn, start))
3485 if ((lsa = rn->info))
3486 {
3487#ifdef HAVE_NSSA
3488 /* Stay away from any Local Translated Type-7 LSAs */
3489 if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
3490 continue;
3491#endif /* HAVE_NSSA */
3492
3493 if (show_function[lsa->data->type] != NULL)
3494 show_function[lsa->data->type] (vty, lsa);
3495 }
3496 route_unlock_node (start);
3497 }
3498}
3499
3500/* Show detail LSA information
3501 -- if id is NULL then show all LSAs. */
3502void
3503show_lsa_detail (struct vty *vty, int type,
3504 struct in_addr *id, struct in_addr *adv_router)
3505{
paul68980082003-03-25 05:07:42 +00003506 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00003507 listnode node;
3508
3509 switch (type)
3510 {
3511 case OSPF_AS_EXTERNAL_LSA:
3512#ifdef HAVE_OPAQUE_LSA
3513 case OSPF_OPAQUE_AS_LSA:
3514#endif /* HAVE_OPAQUE_LSA */
3515 vty_out (vty, " %s %s%s",
3516 show_database_desc[type],
3517 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003518 show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router);
paul718e3742002-12-13 20:15:29 +00003519 break;
3520 default:
paul68980082003-03-25 05:07:42 +00003521 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003522 {
3523 struct ospf_area *area = node->data;
3524 vty_out (vty, "%s %s (Area %s)%s%s",
3525 VTY_NEWLINE, show_database_desc[type],
3526 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3527 show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router);
3528 }
3529 break;
3530 }
3531}
3532
3533void
3534show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt,
3535 struct in_addr *adv_router)
3536{
3537 struct route_node *rn;
3538 struct ospf_lsa *lsa;
3539
3540 for (rn = route_top (rt); rn; rn = route_next (rn))
3541 if ((lsa = rn->info))
3542 if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router))
3543 {
3544#ifdef HAVE_NSSA
3545 if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
3546 continue;
3547#endif /* HAVE_NSSA */
3548 if (show_function[lsa->data->type] != NULL)
3549 show_function[lsa->data->type] (vty, lsa);
3550 }
3551}
3552
3553/* Show detail LSA information. */
3554void
3555show_lsa_detail_adv_router (struct vty *vty, int type,
3556 struct in_addr *adv_router)
3557{
paul68980082003-03-25 05:07:42 +00003558 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00003559 listnode node;
3560
3561 switch (type)
3562 {
3563 case OSPF_AS_EXTERNAL_LSA:
3564#ifdef HAVE_OPAQUE_LSA
3565 case OSPF_OPAQUE_AS_LSA:
3566#endif /* HAVE_OPAQUE_LSA */
3567 vty_out (vty, " %s %s%s",
3568 show_database_desc[type],
3569 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003570 show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type),
paul718e3742002-12-13 20:15:29 +00003571 adv_router);
3572 break;
3573 default:
paul68980082003-03-25 05:07:42 +00003574 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003575 {
3576 struct ospf_area *area = node->data;
3577 vty_out (vty, "%s %s (Area %s)%s%s",
3578 VTY_NEWLINE, show_database_desc[type],
3579 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3580 show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type),
3581 adv_router);
3582 }
3583 break;
3584 }
3585}
3586
3587void
3588show_ip_ospf_database_summary (struct vty *vty, int self)
3589{
paul68980082003-03-25 05:07:42 +00003590 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00003591 listnode node;
3592 int type;
3593
paul68980082003-03-25 05:07:42 +00003594 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003595 {
3596 struct ospf_area *area = node->data;
3597 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3598 {
3599 switch (type)
3600 {
3601 case OSPF_AS_EXTERNAL_LSA:
3602#ifdef HAVE_OPAQUE_LSA
3603 case OSPF_OPAQUE_AS_LSA:
3604#endif /* HAVE_OPAQUE_LSA */
3605 continue;
3606 default:
3607 break;
3608 }
3609 if (ospf_lsdb_count_self (area->lsdb, type) > 0 ||
3610 (!self && ospf_lsdb_count (area->lsdb, type) > 0))
3611 {
3612 vty_out (vty, " %s (Area %s)%s%s",
3613 show_database_desc[type],
3614 ospf_area_desc_string (area),
3615 VTY_NEWLINE, VTY_NEWLINE);
3616 vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE);
3617
3618 foreach_lsa (AREA_LSDB (area, type), vty, self, show_lsa_summary);
3619
3620 vty_out (vty, "%s", VTY_NEWLINE);
3621 }
3622 }
3623 }
3624
3625 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3626 {
3627 switch (type)
3628 {
3629 case OSPF_AS_EXTERNAL_LSA:
3630#ifdef HAVE_OPAQUE_LSA
3631 case OSPF_OPAQUE_AS_LSA:
3632#endif /* HAVE_OPAQUE_LSA */
3633 break;;
3634 default:
3635 continue;
3636 }
paul68980082003-03-25 05:07:42 +00003637 if (ospf_lsdb_count_self (ospf->lsdb, type) ||
3638 (!self && ospf_lsdb_count (ospf->lsdb, type)))
paul718e3742002-12-13 20:15:29 +00003639 {
3640 vty_out (vty, " %s%s%s",
3641 show_database_desc[type],
3642 VTY_NEWLINE, VTY_NEWLINE);
3643 vty_out (vty, "%s%s", show_database_header[type],
3644 VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003645 foreach_lsa (AS_LSDB (ospf, type), vty, self, show_lsa_summary);
paul718e3742002-12-13 20:15:29 +00003646 vty_out (vty, "%s", VTY_NEWLINE);
3647 }
3648 }
3649
3650 vty_out (vty, "%s", VTY_NEWLINE);
3651}
3652
3653void
3654show_ip_ospf_database_maxage (struct vty *vty)
3655{
paul68980082003-03-25 05:07:42 +00003656 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00003657 listnode node;
3658 struct ospf_lsa *lsa;
3659
3660 vty_out (vty, "%s MaxAge Link States:%s%s",
3661 VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
3662
paul68980082003-03-25 05:07:42 +00003663 for (node = listhead (ospf->maxage_lsa); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003664 if ((lsa = node->data) != NULL)
3665 {
3666 vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);
3667 vty_out (vty, "Link State ID: %s%s",
3668 inet_ntoa (lsa->data->id), VTY_NEWLINE);
3669 vty_out (vty, "Advertising Router: %s%s",
3670 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3671 vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);
3672 vty_out (vty, "%s", VTY_NEWLINE);
3673 }
3674}
3675
3676#ifdef HAVE_NSSA
3677#define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3678#define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3679#else /* HAVE_NSSA */
3680#define OSPF_LSA_TYPE_NSSA_DESC ""
3681#define OSPF_LSA_TYPE_NSSA_CMD_STR ""
3682#endif /* HAVE_NSSA */
3683
3684#ifdef HAVE_OPAQUE_LSA
3685#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3686#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3687#define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3688#define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3689#else /* HAVE_OPAQUE_LSA */
3690#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3691#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3692#define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3693#define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3694#endif /* HAVE_OPAQUE_LSA */
3695
3696#define OSPF_LSA_TYPES_CMD_STR \
3697 "asbr-summary|external|network|router|summary" \
3698 OSPF_LSA_TYPE_NSSA_CMD_STR \
3699 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3700
3701#define OSPF_LSA_TYPES_DESC \
3702 "ASBR summary link states\n" \
3703 "External link states\n" \
3704 "Network link states\n" \
3705 "Router link states\n" \
3706 "Network summary link states\n" \
3707 OSPF_LSA_TYPE_NSSA_DESC \
3708 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3709 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3710 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3711
3712DEFUN (show_ip_ospf_database,
3713 show_ip_ospf_database_cmd,
3714 "show ip ospf database",
3715 SHOW_STR
3716 IP_STR
3717 "OSPF information\n"
3718 "Database summary\n")
3719{
paul68980082003-03-25 05:07:42 +00003720 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00003721 int type, ret;
3722 struct in_addr id, adv_router;
3723
paul68980082003-03-25 05:07:42 +00003724 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003725 return CMD_SUCCESS;
3726
3727 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00003728 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003729
3730 /* Show all LSA. */
3731 if (argc == 0)
3732 {
3733 show_ip_ospf_database_summary (vty, 0);
3734 return CMD_SUCCESS;
3735 }
3736
3737 /* Set database type to show. */
3738 if (strncmp (argv[0], "r", 1) == 0)
3739 type = OSPF_ROUTER_LSA;
3740 else if (strncmp (argv[0], "ne", 2) == 0)
3741 type = OSPF_NETWORK_LSA;
3742#ifdef HAVE_NSSA
3743 else if (strncmp (argv[0], "ns", 2) == 0)
3744 type = OSPF_AS_NSSA_LSA;
3745#endif /* HAVE_NSSA */
3746 else if (strncmp (argv[0], "su", 2) == 0)
3747 type = OSPF_SUMMARY_LSA;
3748 else if (strncmp (argv[0], "a", 1) == 0)
3749 type = OSPF_ASBR_SUMMARY_LSA;
3750 else if (strncmp (argv[0], "e", 1) == 0)
3751 type = OSPF_AS_EXTERNAL_LSA;
3752 else if (strncmp (argv[0], "se", 2) == 0)
3753 {
3754 show_ip_ospf_database_summary (vty, 1);
3755 return CMD_SUCCESS;
3756 }
3757 else if (strncmp (argv[0], "m", 1) == 0)
3758 {
3759 show_ip_ospf_database_maxage (vty);
3760 return CMD_SUCCESS;
3761 }
3762#ifdef HAVE_OPAQUE_LSA
3763 else if (strncmp (argv[0], "opaque-l", 8) == 0)
3764 type = OSPF_OPAQUE_LINK_LSA;
3765 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
3766 type = OSPF_OPAQUE_AREA_LSA;
3767 else if (strncmp (argv[0], "opaque-as", 9) == 0)
3768 type = OSPF_OPAQUE_AS_LSA;
3769#endif /* HAVE_OPAQUE_LSA */
3770 else
3771 return CMD_WARNING;
3772
3773 /* `show ip ospf database LSA'. */
3774 if (argc == 1)
3775 show_lsa_detail (vty, type, NULL, NULL);
3776 else if (argc >= 2)
3777 {
3778 ret = inet_aton (argv[1], &id);
3779 if (!ret)
3780 return CMD_WARNING;
3781
3782 /* `show ip ospf database LSA ID'. */
3783 if (argc == 2)
3784 show_lsa_detail (vty, type, &id, NULL);
3785 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3786 else if (argc == 3)
3787 {
3788 if (strncmp (argv[2], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00003789 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00003790 else
3791 {
3792 ret = inet_aton (argv[2], &adv_router);
3793 if (!ret)
3794 return CMD_WARNING;
3795 }
3796 show_lsa_detail (vty, type, &id, &adv_router);
3797 }
3798 }
3799
3800 return CMD_SUCCESS;
3801}
3802
3803ALIAS (show_ip_ospf_database,
3804 show_ip_ospf_database_type_cmd,
3805 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)",
3806 SHOW_STR
3807 IP_STR
3808 "OSPF information\n"
3809 "Database summary\n"
3810 OSPF_LSA_TYPES_DESC
3811 "LSAs in MaxAge list\n"
3812 "Self-originated link states\n")
3813
3814ALIAS (show_ip_ospf_database,
3815 show_ip_ospf_database_type_id_cmd,
3816 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D",
3817 SHOW_STR
3818 IP_STR
3819 "OSPF information\n"
3820 "Database summary\n"
3821 OSPF_LSA_TYPES_DESC
3822 "Link State ID (as an IP address)\n")
3823
3824ALIAS (show_ip_ospf_database,
3825 show_ip_ospf_database_type_id_adv_router_cmd,
3826 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D",
3827 SHOW_STR
3828 IP_STR
3829 "OSPF information\n"
3830 "Database summary\n"
3831 OSPF_LSA_TYPES_DESC
3832 "Link State ID (as an IP address)\n"
3833 "Advertising Router link states\n"
3834 "Advertising Router (as an IP address)\n")
3835
3836ALIAS (show_ip_ospf_database,
3837 show_ip_ospf_database_type_id_self_cmd,
3838 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
3839 SHOW_STR
3840 IP_STR
3841 "OSPF information\n"
3842 "Database summary\n"
3843 OSPF_LSA_TYPES_DESC
3844 "Link State ID (as an IP address)\n"
3845 "Self-originated link states\n"
3846 "\n")
3847
3848DEFUN (show_ip_ospf_database_type_adv_router,
3849 show_ip_ospf_database_type_adv_router_cmd,
3850 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D",
3851 SHOW_STR
3852 IP_STR
3853 "OSPF information\n"
3854 "Database summary\n"
3855 OSPF_LSA_TYPES_DESC
3856 "Advertising Router link states\n"
3857 "Advertising Router (as an IP address)\n")
3858{
paul68980082003-03-25 05:07:42 +00003859 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00003860 int type, ret;
3861 struct in_addr adv_router;
3862
paul68980082003-03-25 05:07:42 +00003863 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003864 return CMD_SUCCESS;
3865
3866 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00003867 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003868
3869 if (argc != 2)
3870 return CMD_WARNING;
3871
3872 /* Set database type to show. */
3873 if (strncmp (argv[0], "r", 1) == 0)
3874 type = OSPF_ROUTER_LSA;
3875 else if (strncmp (argv[0], "ne", 2) == 0)
3876 type = OSPF_NETWORK_LSA;
3877#ifdef HAVE_NSSA
3878 else if (strncmp (argv[0], "ns", 2) == 0)
3879 type = OSPF_AS_NSSA_LSA;
3880#endif /* HAVE_NSSA */
3881 else if (strncmp (argv[0], "s", 1) == 0)
3882 type = OSPF_SUMMARY_LSA;
3883 else if (strncmp (argv[0], "a", 1) == 0)
3884 type = OSPF_ASBR_SUMMARY_LSA;
3885 else if (strncmp (argv[0], "e", 1) == 0)
3886 type = OSPF_AS_EXTERNAL_LSA;
3887#ifdef HAVE_OPAQUE_LSA
3888 else if (strncmp (argv[0], "opaque-l", 8) == 0)
3889 type = OSPF_OPAQUE_LINK_LSA;
3890 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
3891 type = OSPF_OPAQUE_AREA_LSA;
3892 else if (strncmp (argv[0], "opaque-as", 9) == 0)
3893 type = OSPF_OPAQUE_AS_LSA;
3894#endif /* HAVE_OPAQUE_LSA */
3895 else
3896 return CMD_WARNING;
3897
3898 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3899 if (strncmp (argv[1], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00003900 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00003901 else
3902 {
3903 ret = inet_aton (argv[1], &adv_router);
3904 if (!ret)
3905 return CMD_WARNING;
3906 }
3907
3908 show_lsa_detail_adv_router (vty, type, &adv_router);
3909
3910 return CMD_SUCCESS;
3911}
3912
3913ALIAS (show_ip_ospf_database_type_adv_router,
3914 show_ip_ospf_database_type_self_cmd,
3915 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
3916 SHOW_STR
3917 IP_STR
3918 "OSPF information\n"
3919 "Database summary\n"
3920 OSPF_LSA_TYPES_DESC
3921 "Self-originated link states\n")
3922
3923
3924DEFUN (ip_ospf_authentication_args,
3925 ip_ospf_authentication_args_addr_cmd,
3926 "ip ospf authentication (null|message-digest) A.B.C.D",
3927 "IP Information\n"
3928 "OSPF interface commands\n"
3929 "Enable authentication on this interface\n"
3930 "Use null authentication\n"
3931 "Use message-digest authentication\n"
3932 "Address of interface")
3933{
3934 struct interface *ifp;
3935 struct in_addr addr;
3936 int ret;
3937 struct ospf_if_params *params;
3938
3939 ifp = vty->index;
3940 params = IF_DEF_PARAMS (ifp);
3941
3942 if (argc == 2)
3943 {
3944 ret = inet_aton(argv[1], &addr);
3945 if (!ret)
3946 {
3947 vty_out (vty, "Please specify interface address by A.B.C.D%s",
3948 VTY_NEWLINE);
3949 return CMD_WARNING;
3950 }
3951
3952 params = ospf_get_if_params (ifp, addr);
3953 ospf_if_update_params (ifp, addr);
3954 }
3955
3956 /* Handle null authentication */
3957 if ( argv[0][0] == 'n' )
3958 {
3959 SET_IF_PARAM (params, auth_type);
3960 params->auth_type = OSPF_AUTH_NULL;
3961 return CMD_SUCCESS;
3962 }
3963
3964 /* Handle message-digest authentication */
3965 if ( argv[0][0] == 'm' )
3966 {
3967 SET_IF_PARAM (params, auth_type);
3968 params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
3969 return CMD_SUCCESS;
3970 }
3971
3972 vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE);
3973 return CMD_WARNING;
3974}
3975
3976ALIAS (ip_ospf_authentication_args,
3977 ip_ospf_authentication_args_cmd,
3978 "ip ospf authentication (null|message-digest)",
3979 "IP Information\n"
3980 "OSPF interface commands\n"
3981 "Enable authentication on this interface\n"
3982 "Use null authentication\n"
3983 "Use message-digest authentication\n")
3984
3985DEFUN (ip_ospf_authentication,
3986 ip_ospf_authentication_addr_cmd,
3987 "ip ospf authentication A.B.C.D",
3988 "IP Information\n"
3989 "OSPF interface commands\n"
3990 "Enable authentication on this interface\n"
3991 "Address of interface")
3992{
3993 struct interface *ifp;
3994 struct in_addr addr;
3995 int ret;
3996 struct ospf_if_params *params;
3997
3998 ifp = vty->index;
3999 params = IF_DEF_PARAMS (ifp);
4000
4001 if (argc == 1)
4002 {
4003 ret = inet_aton(argv[1], &addr);
4004 if (!ret)
4005 {
4006 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4007 VTY_NEWLINE);
4008 return CMD_WARNING;
4009 }
4010
4011 params = ospf_get_if_params (ifp, addr);
4012 ospf_if_update_params (ifp, addr);
4013 }
4014
4015 SET_IF_PARAM (params, auth_type);
4016 params->auth_type = OSPF_AUTH_SIMPLE;
4017
4018 return CMD_SUCCESS;
4019}
4020
4021ALIAS (ip_ospf_authentication,
4022 ip_ospf_authentication_cmd,
4023 "ip ospf authentication",
4024 "IP Information\n"
4025 "OSPF interface commands\n"
4026 "Enable authentication on this interface\n")
4027
4028DEFUN (no_ip_ospf_authentication,
4029 no_ip_ospf_authentication_addr_cmd,
4030 "no ip ospf authentication A.B.C.D",
4031 NO_STR
4032 "IP Information\n"
4033 "OSPF interface commands\n"
4034 "Enable authentication on this interface\n"
4035 "Address of interface")
4036{
4037 struct interface *ifp;
4038 struct in_addr addr;
4039 int ret;
4040 struct ospf_if_params *params;
4041
4042 ifp = vty->index;
4043 params = IF_DEF_PARAMS (ifp);
4044
4045 if (argc == 1)
4046 {
4047 ret = inet_aton(argv[1], &addr);
4048 if (!ret)
4049 {
4050 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4051 VTY_NEWLINE);
4052 return CMD_WARNING;
4053 }
4054
4055 params = ospf_lookup_if_params (ifp, addr);
4056 if (params == NULL)
4057 return CMD_SUCCESS;
4058 }
4059
4060 params->auth_type = OSPF_AUTH_NOTSET;
4061 UNSET_IF_PARAM (params, auth_type);
4062
4063 if (params != IF_DEF_PARAMS (ifp))
4064 {
4065 ospf_free_if_params (ifp, addr);
4066 ospf_if_update_params (ifp, addr);
4067 }
4068
4069 return CMD_SUCCESS;
4070}
4071
4072ALIAS (no_ip_ospf_authentication,
4073 no_ip_ospf_authentication_cmd,
4074 "no ip ospf authentication",
4075 NO_STR
4076 "IP Information\n"
4077 "OSPF interface commands\n"
4078 "Enable authentication on this interface\n")
4079
4080DEFUN (ip_ospf_authentication_key,
4081 ip_ospf_authentication_key_addr_cmd,
4082 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4083 "IP Information\n"
4084 "OSPF interface commands\n"
4085 "Authentication password (key)\n"
4086 "The OSPF password (key)\n"
4087 "Address of interface")
4088{
4089 struct interface *ifp;
4090 struct in_addr addr;
4091 int ret;
4092 struct ospf_if_params *params;
4093
4094 ifp = vty->index;
4095 params = IF_DEF_PARAMS (ifp);
4096
4097 if (argc == 2)
4098 {
4099 ret = inet_aton(argv[1], &addr);
4100 if (!ret)
4101 {
4102 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4103 VTY_NEWLINE);
4104 return CMD_WARNING;
4105 }
4106
4107 params = ospf_get_if_params (ifp, addr);
4108 ospf_if_update_params (ifp, addr);
4109 }
4110
4111
4112 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
4113 strncpy (params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE);
4114 SET_IF_PARAM (params, auth_simple);
4115
4116 return CMD_SUCCESS;
4117}
4118
4119ALIAS (ip_ospf_authentication_key,
4120 ip_ospf_authentication_key_cmd,
4121 "ip ospf authentication-key AUTH_KEY",
4122 "IP Information\n"
4123 "OSPF interface commands\n"
4124 "Authentication password (key)\n"
4125 "The OSPF password (key)")
4126
4127ALIAS (ip_ospf_authentication_key,
4128 ospf_authentication_key_cmd,
4129 "ospf authentication-key AUTH_KEY",
4130 "OSPF interface commands\n"
4131 "Authentication password (key)\n"
4132 "The OSPF password (key)")
4133
4134DEFUN (no_ip_ospf_authentication_key,
4135 no_ip_ospf_authentication_key_addr_cmd,
4136 "no ip ospf authentication-key A.B.C.D",
4137 NO_STR
4138 "IP Information\n"
4139 "OSPF interface commands\n"
4140 "Authentication password (key)\n"
4141 "Address of interface")
4142{
4143 struct interface *ifp;
4144 struct in_addr addr;
4145 int ret;
4146 struct ospf_if_params *params;
4147
4148 ifp = vty->index;
4149 params = IF_DEF_PARAMS (ifp);
4150
4151 if (argc == 2)
4152 {
4153 ret = inet_aton(argv[1], &addr);
4154 if (!ret)
4155 {
4156 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4157 VTY_NEWLINE);
4158 return CMD_WARNING;
4159 }
4160
4161 params = ospf_lookup_if_params (ifp, addr);
4162 if (params == NULL)
4163 return CMD_SUCCESS;
4164 }
4165
4166 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
4167 UNSET_IF_PARAM (params, auth_simple);
4168
4169 if (params != IF_DEF_PARAMS (ifp))
4170 {
4171 ospf_free_if_params (ifp, addr);
4172 ospf_if_update_params (ifp, addr);
4173 }
4174
4175 return CMD_SUCCESS;
4176}
4177
4178ALIAS (no_ip_ospf_authentication_key,
4179 no_ip_ospf_authentication_key_cmd,
4180 "no ip ospf authentication-key",
4181 NO_STR
4182 "IP Information\n"
4183 "OSPF interface commands\n"
4184 "Authentication password (key)\n")
4185
4186ALIAS (no_ip_ospf_authentication_key,
4187 no_ospf_authentication_key_cmd,
4188 "no ospf authentication-key",
4189 NO_STR
4190 "OSPF interface commands\n"
4191 "Authentication password (key)\n")
4192
4193DEFUN (ip_ospf_message_digest_key,
4194 ip_ospf_message_digest_key_addr_cmd,
4195 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4196 "IP Information\n"
4197 "OSPF interface commands\n"
4198 "Message digest authentication password (key)\n"
4199 "Key ID\n"
4200 "Use MD5 algorithm\n"
4201 "The OSPF password (key)"
4202 "Address of interface")
4203{
4204 struct interface *ifp;
4205 struct crypt_key *ck;
4206 u_char key_id;
4207 struct in_addr addr;
4208 int ret;
4209 struct ospf_if_params *params;
4210
4211 ifp = vty->index;
4212 params = IF_DEF_PARAMS (ifp);
4213
4214 if (argc == 3)
4215 {
4216 ret = inet_aton(argv[2], &addr);
4217 if (!ret)
4218 {
4219 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4220 VTY_NEWLINE);
4221 return CMD_WARNING;
4222 }
4223
4224 params = ospf_get_if_params (ifp, addr);
4225 ospf_if_update_params (ifp, addr);
4226 }
4227
4228 key_id = strtol (argv[0], NULL, 10);
4229 if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
4230 {
4231 vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
4232 return CMD_WARNING;
4233 }
4234
4235 ck = ospf_crypt_key_new ();
4236 ck->key_id = (u_char) key_id;
4237 memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
4238 strncpy (ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE);
4239
4240 ospf_crypt_key_add (params->auth_crypt, ck);
4241 SET_IF_PARAM (params, auth_crypt);
4242
4243 return CMD_SUCCESS;
4244}
4245
4246ALIAS (ip_ospf_message_digest_key,
4247 ip_ospf_message_digest_key_cmd,
4248 "ip ospf message-digest-key <1-255> md5 KEY",
4249 "IP Information\n"
4250 "OSPF interface commands\n"
4251 "Message digest authentication password (key)\n"
4252 "Key ID\n"
4253 "Use MD5 algorithm\n"
4254 "The OSPF password (key)")
4255
4256ALIAS (ip_ospf_message_digest_key,
4257 ospf_message_digest_key_cmd,
4258 "ospf message-digest-key <1-255> md5 KEY",
4259 "OSPF interface commands\n"
4260 "Message digest authentication password (key)\n"
4261 "Key ID\n"
4262 "Use MD5 algorithm\n"
4263 "The OSPF password (key)")
4264
4265DEFUN (no_ip_ospf_message_digest_key,
4266 no_ip_ospf_message_digest_key_addr_cmd,
4267 "no ip ospf message-digest-key <1-255> A.B.C.D",
4268 NO_STR
4269 "IP Information\n"
4270 "OSPF interface commands\n"
4271 "Message digest authentication password (key)\n"
4272 "Key ID\n"
4273 "Address of interface")
4274{
4275 struct interface *ifp;
4276 struct crypt_key *ck;
4277 int key_id;
4278 struct in_addr addr;
4279 int ret;
4280 struct ospf_if_params *params;
4281
4282 ifp = vty->index;
4283 params = IF_DEF_PARAMS (ifp);
4284
4285 if (argc == 2)
4286 {
4287 ret = inet_aton(argv[1], &addr);
4288 if (!ret)
4289 {
4290 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4291 VTY_NEWLINE);
4292 return CMD_WARNING;
4293 }
4294
4295 params = ospf_lookup_if_params (ifp, addr);
4296 if (params == NULL)
4297 return CMD_SUCCESS;
4298 }
4299
4300 key_id = strtol (argv[0], NULL, 10);
4301 ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
4302 if (ck == NULL)
4303 {
4304 vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
4305 return CMD_WARNING;
4306 }
4307
4308 ospf_crypt_key_delete (params->auth_crypt, key_id);
4309
4310 if (params != IF_DEF_PARAMS (ifp))
4311 {
4312 ospf_free_if_params (ifp, addr);
4313 ospf_if_update_params (ifp, addr);
4314 }
4315
4316 return CMD_SUCCESS;
4317}
4318
4319ALIAS (no_ip_ospf_message_digest_key,
4320 no_ip_ospf_message_digest_key_cmd,
4321 "no ip ospf message-digest-key <1-255>",
4322 NO_STR
4323 "IP Information\n"
4324 "OSPF interface commands\n"
4325 "Message digest authentication password (key)\n"
4326 "Key ID\n")
4327
4328ALIAS (no_ip_ospf_message_digest_key,
4329 no_ospf_message_digest_key_cmd,
4330 "no ospf message-digest-key <1-255>",
4331 NO_STR
4332 "OSPF interface commands\n"
4333 "Message digest authentication password (key)\n"
4334 "Key ID\n")
4335
4336DEFUN (ip_ospf_cost,
4337 ip_ospf_cost_addr_cmd,
4338 "ip ospf cost <1-65535> A.B.C.D",
4339 "IP Information\n"
4340 "OSPF interface commands\n"
4341 "Interface cost\n"
4342 "Cost\n"
4343 "Address of interface")
4344{
4345 struct interface *ifp = vty->index;
4346 u_int32_t cost;
4347 struct in_addr addr;
4348 int ret;
4349 struct ospf_if_params *params;
4350
4351 params = IF_DEF_PARAMS (ifp);
4352
4353 cost = strtol (argv[0], NULL, 10);
4354
4355 /* cost range is <1-65535>. */
4356 if (cost < 1 || cost > 65535)
4357 {
4358 vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
4359 return CMD_WARNING;
4360 }
4361
4362 if (argc == 2)
4363 {
4364 ret = inet_aton(argv[1], &addr);
4365 if (!ret)
4366 {
4367 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4368 VTY_NEWLINE);
4369 return CMD_WARNING;
4370 }
4371
4372 params = ospf_get_if_params (ifp, addr);
4373 ospf_if_update_params (ifp, addr);
4374 }
4375
4376 SET_IF_PARAM (params, output_cost_cmd);
4377 params->output_cost_cmd = cost;
4378
4379 ospf_if_recalculate_output_cost (ifp);
4380
4381 return CMD_SUCCESS;
4382}
4383
4384ALIAS (ip_ospf_cost,
4385 ip_ospf_cost_cmd,
4386 "ip ospf cost <1-65535>",
4387 "IP Information\n"
4388 "OSPF interface commands\n"
4389 "Interface cost\n"
4390 "Cost")
4391
4392ALIAS (ip_ospf_cost,
4393 ospf_cost_cmd,
4394 "ospf cost <1-65535>",
4395 "OSPF interface commands\n"
4396 "Interface cost\n"
4397 "Cost")
4398
4399DEFUN (no_ip_ospf_cost,
4400 no_ip_ospf_cost_addr_cmd,
4401 "no ip ospf cost A.B.C.D",
4402 NO_STR
4403 "IP Information\n"
4404 "OSPF interface commands\n"
4405 "Interface cost\n"
4406 "Address of interface")
4407{
4408 struct interface *ifp = vty->index;
4409 struct in_addr addr;
4410 int ret;
4411 struct ospf_if_params *params;
4412
4413 ifp = vty->index;
4414 params = IF_DEF_PARAMS (ifp);
4415
4416 if (argc == 1)
4417 {
4418 ret = inet_aton(argv[0], &addr);
4419 if (!ret)
4420 {
4421 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4422 VTY_NEWLINE);
4423 return CMD_WARNING;
4424 }
4425
4426 params = ospf_lookup_if_params (ifp, addr);
4427 if (params == NULL)
4428 return CMD_SUCCESS;
4429 }
4430
4431 UNSET_IF_PARAM (params, output_cost_cmd);
4432
4433 if (params != IF_DEF_PARAMS (ifp))
4434 {
4435 ospf_free_if_params (ifp, addr);
4436 ospf_if_update_params (ifp, addr);
4437 }
4438
4439 ospf_if_recalculate_output_cost (ifp);
4440
4441 return CMD_SUCCESS;
4442}
4443
4444ALIAS (no_ip_ospf_cost,
4445 no_ip_ospf_cost_cmd,
4446 "no ip ospf cost",
4447 NO_STR
4448 "IP Information\n"
4449 "OSPF interface commands\n"
4450 "Interface cost\n")
4451
4452ALIAS (no_ip_ospf_cost,
4453 no_ospf_cost_cmd,
4454 "no ospf cost",
4455 NO_STR
4456 "OSPF interface commands\n"
4457 "Interface cost\n")
4458
4459void
4460ospf_nbr_timer_update (struct ospf_interface *oi)
4461{
4462 struct route_node *rn;
4463 struct ospf_neighbor *nbr;
4464
4465 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
4466 if ((nbr = rn->info))
4467 {
4468 nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait);
4469 nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval);
4470 nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval);
4471 nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval);
4472 }
4473}
4474
4475DEFUN (ip_ospf_dead_interval,
4476 ip_ospf_dead_interval_addr_cmd,
4477 "ip ospf dead-interval <1-65535> A.B.C.D",
4478 "IP Information\n"
4479 "OSPF interface commands\n"
4480 "Interval after which a neighbor is declared dead\n"
4481 "Seconds\n"
4482 "Address of interface")
4483{
4484 struct interface *ifp = vty->index;
4485 u_int32_t seconds;
4486 struct in_addr addr;
4487 int ret;
4488 struct ospf_if_params *params;
4489 struct ospf_interface *oi;
4490 struct route_node *rn;
paul68980082003-03-25 05:07:42 +00004491 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00004492
4493 params = IF_DEF_PARAMS (ifp);
4494
4495 seconds = strtol (argv[0], NULL, 10);
4496
4497 /* dead_interval range is <1-65535>. */
4498 if (seconds < 1 || seconds > 65535)
4499 {
4500 vty_out (vty, "Router Dead Interval is invalid%s", VTY_NEWLINE);
4501 return CMD_WARNING;
4502 }
4503
4504 if (argc == 2)
4505 {
4506 ret = inet_aton(argv[1], &addr);
4507 if (!ret)
4508 {
4509 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4510 VTY_NEWLINE);
4511 return CMD_WARNING;
4512 }
4513
4514 params = ospf_get_if_params (ifp, addr);
4515 ospf_if_update_params (ifp, addr);
4516 }
4517
4518 SET_IF_PARAM (params, v_wait);
4519 params->v_wait = seconds;
4520
4521 /* Update timer values in neighbor structure. */
4522 if (argc == 2)
4523 {
paul68980082003-03-25 05:07:42 +00004524 if (ospf)
4525 {
4526 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
4527 if (oi)
4528 ospf_nbr_timer_update (oi);
4529 }
paul718e3742002-12-13 20:15:29 +00004530 }
4531 else
4532 {
4533 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4534 if ((oi = rn->info))
4535 ospf_nbr_timer_update (oi);
4536 }
4537
4538 return CMD_SUCCESS;
4539}
4540
4541ALIAS (ip_ospf_dead_interval,
4542 ip_ospf_dead_interval_cmd,
4543 "ip ospf dead-interval <1-65535>",
4544 "IP Information\n"
4545 "OSPF interface commands\n"
4546 "Interval after which a neighbor is declared dead\n"
4547 "Seconds\n")
4548
4549ALIAS (ip_ospf_dead_interval,
4550 ospf_dead_interval_cmd,
4551 "ospf dead-interval <1-65535>",
4552 "OSPF interface commands\n"
4553 "Interval after which a neighbor is declared dead\n"
4554 "Seconds\n")
4555
4556DEFUN (no_ip_ospf_dead_interval,
4557 no_ip_ospf_dead_interval_addr_cmd,
4558 "no ip ospf dead-interval A.B.C.D",
4559 NO_STR
4560 "IP Information\n"
4561 "OSPF interface commands\n"
4562 "Interval after which a neighbor is declared dead\n"
4563 "Address of interface")
4564{
4565 struct interface *ifp = vty->index;
4566 struct in_addr addr;
4567 int ret;
4568 struct ospf_if_params *params;
4569 struct ospf_interface *oi;
4570 struct route_node *rn;
paul68980082003-03-25 05:07:42 +00004571 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00004572
4573 ifp = vty->index;
4574 params = IF_DEF_PARAMS (ifp);
4575
4576 if (argc == 1)
4577 {
4578 ret = inet_aton(argv[0], &addr);
4579 if (!ret)
4580 {
4581 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4582 VTY_NEWLINE);
4583 return CMD_WARNING;
4584 }
4585
4586 params = ospf_lookup_if_params (ifp, addr);
4587 if (params == NULL)
4588 return CMD_SUCCESS;
4589 }
4590
4591 UNSET_IF_PARAM (params, v_wait);
4592 params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
4593
4594 if (params != IF_DEF_PARAMS (ifp))
4595 {
4596 ospf_free_if_params (ifp, addr);
4597 ospf_if_update_params (ifp, addr);
4598 }
4599
4600 /* Update timer values in neighbor structure. */
4601 if (argc == 1)
4602 {
paul68980082003-03-25 05:07:42 +00004603 if (ospf)
4604 {
4605 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
4606 if (oi)
4607 ospf_nbr_timer_update (oi);
4608 }
paul718e3742002-12-13 20:15:29 +00004609 }
4610 else
4611 {
4612 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4613 if ((oi = rn->info))
4614 ospf_nbr_timer_update (oi);
4615 }
4616
4617 return CMD_SUCCESS;
4618}
4619
4620ALIAS (no_ip_ospf_dead_interval,
4621 no_ip_ospf_dead_interval_cmd,
4622 "no ip ospf dead-interval",
4623 NO_STR
4624 "IP Information\n"
4625 "OSPF interface commands\n"
4626 "Interval after which a neighbor is declared dead\n")
4627
4628ALIAS (no_ip_ospf_dead_interval,
4629 no_ospf_dead_interval_cmd,
4630 "no ospf dead-interval",
4631 NO_STR
4632 "OSPF interface commands\n"
4633 "Interval after which a neighbor is declared dead\n")
4634
4635DEFUN (ip_ospf_hello_interval,
4636 ip_ospf_hello_interval_addr_cmd,
4637 "ip ospf hello-interval <1-65535> A.B.C.D",
4638 "IP Information\n"
4639 "OSPF interface commands\n"
4640 "Time between HELLO packets\n"
4641 "Seconds\n"
4642 "Address of interface")
4643{
4644 struct interface *ifp = vty->index;
4645 u_int32_t seconds;
4646 struct in_addr addr;
4647 int ret;
4648 struct ospf_if_params *params;
4649
4650 params = IF_DEF_PARAMS (ifp);
4651
4652 seconds = strtol (argv[0], NULL, 10);
4653
4654 /* HelloInterval range is <1-65535>. */
4655 if (seconds < 1 || seconds > 65535)
4656 {
4657 vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
4658 return CMD_WARNING;
4659 }
4660
4661 if (argc == 2)
4662 {
4663 ret = inet_aton(argv[1], &addr);
4664 if (!ret)
4665 {
4666 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4667 VTY_NEWLINE);
4668 return CMD_WARNING;
4669 }
4670
4671 params = ospf_get_if_params (ifp, addr);
4672 ospf_if_update_params (ifp, addr);
4673 }
4674
4675 SET_IF_PARAM (params, v_hello);
4676 params->v_hello = seconds;
4677
4678 return CMD_SUCCESS;
4679}
4680
4681ALIAS (ip_ospf_hello_interval,
4682 ip_ospf_hello_interval_cmd,
4683 "ip ospf hello-interval <1-65535>",
4684 "IP Information\n"
4685 "OSPF interface commands\n"
4686 "Time between HELLO packets\n"
4687 "Seconds\n")
4688
4689ALIAS (ip_ospf_hello_interval,
4690 ospf_hello_interval_cmd,
4691 "ospf hello-interval <1-65535>",
4692 "OSPF interface commands\n"
4693 "Time between HELLO packets\n"
4694 "Seconds\n")
4695
4696DEFUN (no_ip_ospf_hello_interval,
4697 no_ip_ospf_hello_interval_addr_cmd,
4698 "no ip ospf hello-interval A.B.C.D",
4699 NO_STR
4700 "IP Information\n"
4701 "OSPF interface commands\n"
4702 "Time between HELLO packets\n"
4703 "Address of interface")
4704{
4705 struct interface *ifp = vty->index;
4706 struct in_addr addr;
4707 int ret;
4708 struct ospf_if_params *params;
4709
4710 ifp = vty->index;
4711 params = IF_DEF_PARAMS (ifp);
4712
4713 if (argc == 1)
4714 {
4715 ret = inet_aton(argv[0], &addr);
4716 if (!ret)
4717 {
4718 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4719 VTY_NEWLINE);
4720 return CMD_WARNING;
4721 }
4722
4723 params = ospf_lookup_if_params (ifp, addr);
4724 if (params == NULL)
4725 return CMD_SUCCESS;
4726 }
4727
4728 UNSET_IF_PARAM (params, v_hello);
4729 params->v_hello = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
4730
4731 if (params != IF_DEF_PARAMS (ifp))
4732 {
4733 ospf_free_if_params (ifp, addr);
4734 ospf_if_update_params (ifp, addr);
4735 }
4736
4737 return CMD_SUCCESS;
4738}
4739
4740ALIAS (no_ip_ospf_hello_interval,
4741 no_ip_ospf_hello_interval_cmd,
4742 "no ip ospf hello-interval",
4743 NO_STR
4744 "IP Information\n"
4745 "OSPF interface commands\n"
4746 "Time between HELLO packets\n")
4747
4748ALIAS (no_ip_ospf_hello_interval,
4749 no_ospf_hello_interval_cmd,
4750 "no ospf hello-interval",
4751 NO_STR
4752 "OSPF interface commands\n"
4753 "Time between HELLO packets\n")
4754
4755DEFUN (ip_ospf_network,
4756 ip_ospf_network_cmd,
4757 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4758 "IP Information\n"
4759 "OSPF interface commands\n"
4760 "Network type\n"
4761 "Specify OSPF broadcast multi-access network\n"
4762 "Specify OSPF NBMA network\n"
4763 "Specify OSPF point-to-multipoint network\n"
4764 "Specify OSPF point-to-point network\n")
4765{
4766 struct interface *ifp = vty->index;
4767 int old_type = IF_DEF_PARAMS (ifp)->type;
4768 struct route_node *rn;
4769
4770 if (strncmp (argv[0], "b", 1) == 0)
4771 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
4772 else if (strncmp (argv[0], "n", 1) == 0)
4773 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
4774 else if (strncmp (argv[0], "point-to-m", 10) == 0)
4775 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
4776 else if (strncmp (argv[0], "point-to-p", 10) == 0)
4777 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
4778
4779 if (IF_DEF_PARAMS (ifp)->type == old_type)
4780 return CMD_SUCCESS;
4781
4782 SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
4783
4784 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4785 {
4786 struct ospf_interface *oi = rn->info;
4787
4788 if (!oi)
4789 continue;
4790
4791 oi->type = IF_DEF_PARAMS (ifp)->type;
4792
4793 if (oi->state > ISM_Down)
4794 {
4795 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
4796 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
4797 }
4798 }
4799
4800 return CMD_SUCCESS;
4801}
4802
4803ALIAS (ip_ospf_network,
4804 ospf_network_cmd,
4805 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4806 "OSPF interface commands\n"
4807 "Network type\n"
4808 "Specify OSPF broadcast multi-access network\n"
4809 "Specify OSPF NBMA network\n"
4810 "Specify OSPF point-to-multipoint network\n"
4811 "Specify OSPF point-to-point network\n")
4812
4813DEFUN (no_ip_ospf_network,
4814 no_ip_ospf_network_cmd,
4815 "no ip ospf network",
4816 NO_STR
4817 "IP Information\n"
4818 "OSPF interface commands\n"
4819 "Network type\n")
4820{
4821 struct interface *ifp = vty->index;
4822 int old_type = IF_DEF_PARAMS (ifp)->type;
4823 struct route_node *rn;
4824
4825 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
4826
4827 if (IF_DEF_PARAMS (ifp)->type == old_type)
4828 return CMD_SUCCESS;
4829
4830 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4831 {
4832 struct ospf_interface *oi = rn->info;
4833
4834 if (!oi)
4835 continue;
4836
4837 oi->type = IF_DEF_PARAMS (ifp)->type;
4838
4839 if (oi->state > ISM_Down)
4840 {
4841 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
4842 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
4843 }
4844 }
4845
4846 return CMD_SUCCESS;
4847}
4848
4849ALIAS (no_ip_ospf_network,
4850 no_ospf_network_cmd,
4851 "no ospf network",
4852 NO_STR
4853 "OSPF interface commands\n"
4854 "Network type\n")
4855
4856DEFUN (ip_ospf_priority,
4857 ip_ospf_priority_addr_cmd,
4858 "ip ospf priority <0-255> A.B.C.D",
4859 "IP Information\n"
4860 "OSPF interface commands\n"
4861 "Router priority\n"
4862 "Priority\n"
4863 "Address of interface")
4864{
4865 struct interface *ifp = vty->index;
4866 u_int32_t priority;
4867 struct route_node *rn;
4868 struct in_addr addr;
4869 int ret;
4870 struct ospf_if_params *params;
4871
4872 params = IF_DEF_PARAMS (ifp);
4873
4874 priority = strtol (argv[0], NULL, 10);
4875
4876 /* Router Priority range is <0-255>. */
4877 if (priority < 0 || priority > 255)
4878 {
4879 vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
4880 return CMD_WARNING;
4881 }
4882
4883 if (argc == 2)
4884 {
4885 ret = inet_aton(argv[1], &addr);
4886 if (!ret)
4887 {
4888 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4889 VTY_NEWLINE);
4890 return CMD_WARNING;
4891 }
4892
4893 params = ospf_get_if_params (ifp, addr);
4894 ospf_if_update_params (ifp, addr);
4895 }
4896
4897 SET_IF_PARAM (params, priority);
4898 params->priority = priority;
4899
4900 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4901 {
4902 struct ospf_interface *oi = rn->info;
4903
4904 if (!oi)
4905 continue;
4906
4907
4908 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
4909 {
4910 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
4911 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
4912 }
4913 }
4914
4915 return CMD_SUCCESS;
4916}
4917
4918ALIAS (ip_ospf_priority,
4919 ip_ospf_priority_cmd,
4920 "ip ospf priority <0-255>",
4921 "IP Information\n"
4922 "OSPF interface commands\n"
4923 "Router priority\n"
4924 "Priority\n")
4925
4926ALIAS (ip_ospf_priority,
4927 ospf_priority_cmd,
4928 "ospf priority <0-255>",
4929 "OSPF interface commands\n"
4930 "Router priority\n"
4931 "Priority\n")
4932
4933DEFUN (no_ip_ospf_priority,
4934 no_ip_ospf_priority_addr_cmd,
4935 "no ip ospf priority A.B.C.D",
4936 NO_STR
4937 "IP Information\n"
4938 "OSPF interface commands\n"
4939 "Router priority\n"
4940 "Address of interface")
4941{
4942 struct interface *ifp = vty->index;
4943 struct route_node *rn;
4944 struct in_addr addr;
4945 int ret;
4946 struct ospf_if_params *params;
4947
4948 ifp = vty->index;
4949 params = IF_DEF_PARAMS (ifp);
4950
4951 if (argc == 1)
4952 {
4953 ret = inet_aton(argv[0], &addr);
4954 if (!ret)
4955 {
4956 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4957 VTY_NEWLINE);
4958 return CMD_WARNING;
4959 }
4960
4961 params = ospf_lookup_if_params (ifp, addr);
4962 if (params == NULL)
4963 return CMD_SUCCESS;
4964 }
4965
4966 UNSET_IF_PARAM (params, priority);
4967 params->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
4968
4969 if (params != IF_DEF_PARAMS (ifp))
4970 {
4971 ospf_free_if_params (ifp, addr);
4972 ospf_if_update_params (ifp, addr);
4973 }
4974
4975 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4976 {
4977 struct ospf_interface *oi = rn->info;
4978
4979 if (!oi)
4980 continue;
4981
4982
4983 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
4984 {
4985 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
4986 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
4987 }
4988 }
4989
4990 return CMD_SUCCESS;
4991}
4992
4993ALIAS (no_ip_ospf_priority,
4994 no_ip_ospf_priority_cmd,
4995 "no ip ospf priority",
4996 NO_STR
4997 "IP Information\n"
4998 "OSPF interface commands\n"
4999 "Router priority\n")
5000
5001ALIAS (no_ip_ospf_priority,
5002 no_ospf_priority_cmd,
5003 "no ospf priority",
5004 NO_STR
5005 "OSPF interface commands\n"
5006 "Router priority\n")
5007
5008DEFUN (ip_ospf_retransmit_interval,
5009 ip_ospf_retransmit_interval_addr_cmd,
5010 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5011 "IP Information\n"
5012 "OSPF interface commands\n"
5013 "Time between retransmitting lost link state advertisements\n"
5014 "Seconds\n"
5015 "Address of interface")
5016{
5017 struct interface *ifp = vty->index;
5018 u_int32_t seconds;
5019 struct in_addr addr;
5020 int ret;
5021 struct ospf_if_params *params;
5022
5023 params = IF_DEF_PARAMS (ifp);
5024 seconds = strtol (argv[0], NULL, 10);
5025
5026 /* Retransmit Interval range is <3-65535>. */
5027 if (seconds < 3 || seconds > 65535)
5028 {
5029 vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
5030 return CMD_WARNING;
5031 }
5032
5033
5034 if (argc == 2)
5035 {
5036 ret = inet_aton(argv[1], &addr);
5037 if (!ret)
5038 {
5039 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5040 VTY_NEWLINE);
5041 return CMD_WARNING;
5042 }
5043
5044 params = ospf_get_if_params (ifp, addr);
5045 ospf_if_update_params (ifp, addr);
5046 }
5047
5048 SET_IF_PARAM (params, retransmit_interval);
5049 params->retransmit_interval = seconds;
5050
5051 return CMD_SUCCESS;
5052}
5053
5054ALIAS (ip_ospf_retransmit_interval,
5055 ip_ospf_retransmit_interval_cmd,
5056 "ip ospf retransmit-interval <3-65535>",
5057 "IP Information\n"
5058 "OSPF interface commands\n"
5059 "Time between retransmitting lost link state advertisements\n"
5060 "Seconds\n")
5061
5062ALIAS (ip_ospf_retransmit_interval,
5063 ospf_retransmit_interval_cmd,
5064 "ospf retransmit-interval <3-65535>",
5065 "OSPF interface commands\n"
5066 "Time between retransmitting lost link state advertisements\n"
5067 "Seconds\n")
5068
5069DEFUN (no_ip_ospf_retransmit_interval,
5070 no_ip_ospf_retransmit_interval_addr_cmd,
5071 "no ip ospf retransmit-interval A.B.C.D",
5072 NO_STR
5073 "IP Information\n"
5074 "OSPF interface commands\n"
5075 "Time between retransmitting lost link state advertisements\n"
5076 "Address of interface")
5077{
5078 struct interface *ifp = vty->index;
5079 struct in_addr addr;
5080 int ret;
5081 struct ospf_if_params *params;
5082
5083 ifp = vty->index;
5084 params = IF_DEF_PARAMS (ifp);
5085
5086 if (argc == 1)
5087 {
5088 ret = inet_aton(argv[0], &addr);
5089 if (!ret)
5090 {
5091 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5092 VTY_NEWLINE);
5093 return CMD_WARNING;
5094 }
5095
5096 params = ospf_lookup_if_params (ifp, addr);
5097 if (params == NULL)
5098 return CMD_SUCCESS;
5099 }
5100
5101 UNSET_IF_PARAM (params, retransmit_interval);
5102 params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
5103
5104 if (params != IF_DEF_PARAMS (ifp))
5105 {
5106 ospf_free_if_params (ifp, addr);
5107 ospf_if_update_params (ifp, addr);
5108 }
5109
5110 return CMD_SUCCESS;
5111}
5112
5113ALIAS (no_ip_ospf_retransmit_interval,
5114 no_ip_ospf_retransmit_interval_cmd,
5115 "no ip ospf retransmit-interval",
5116 NO_STR
5117 "IP Information\n"
5118 "OSPF interface commands\n"
5119 "Time between retransmitting lost link state advertisements\n")
5120
5121ALIAS (no_ip_ospf_retransmit_interval,
5122 no_ospf_retransmit_interval_cmd,
5123 "no ospf retransmit-interval",
5124 NO_STR
5125 "OSPF interface commands\n"
5126 "Time between retransmitting lost link state advertisements\n")
5127
5128DEFUN (ip_ospf_transmit_delay,
5129 ip_ospf_transmit_delay_addr_cmd,
5130 "ip ospf transmit-delay <1-65535> A.B.C.D",
5131 "IP Information\n"
5132 "OSPF interface commands\n"
5133 "Link state transmit delay\n"
5134 "Seconds\n"
5135 "Address of interface")
5136{
5137 struct interface *ifp = vty->index;
5138 u_int32_t seconds;
5139 struct in_addr addr;
5140 int ret;
5141 struct ospf_if_params *params;
5142
5143 params = IF_DEF_PARAMS (ifp);
5144 seconds = strtol (argv[0], NULL, 10);
5145
5146 /* Transmit Delay range is <1-65535>. */
5147 if (seconds < 1 || seconds > 65535)
5148 {
5149 vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
5150 return CMD_WARNING;
5151 }
5152
5153 if (argc == 2)
5154 {
5155 ret = inet_aton(argv[1], &addr);
5156 if (!ret)
5157 {
5158 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5159 VTY_NEWLINE);
5160 return CMD_WARNING;
5161 }
5162
5163 params = ospf_get_if_params (ifp, addr);
5164 ospf_if_update_params (ifp, addr);
5165 }
5166
5167 SET_IF_PARAM (params, transmit_delay);
5168 params->transmit_delay = seconds;
5169
5170 return CMD_SUCCESS;
5171}
5172
5173ALIAS (ip_ospf_transmit_delay,
5174 ip_ospf_transmit_delay_cmd,
5175 "ip ospf transmit-delay <1-65535>",
5176 "IP Information\n"
5177 "OSPF interface commands\n"
5178 "Link state transmit delay\n"
5179 "Seconds\n")
5180
5181ALIAS (ip_ospf_transmit_delay,
5182 ospf_transmit_delay_cmd,
5183 "ospf transmit-delay <1-65535>",
5184 "OSPF interface commands\n"
5185 "Link state transmit delay\n"
5186 "Seconds\n")
5187
5188DEFUN (no_ip_ospf_transmit_delay,
5189 no_ip_ospf_transmit_delay_addr_cmd,
5190 "no ip ospf transmit-delay A.B.C.D",
5191 NO_STR
5192 "IP Information\n"
5193 "OSPF interface commands\n"
5194 "Link state transmit delay\n"
5195 "Address of interface")
5196{
5197 struct interface *ifp = vty->index;
5198 struct in_addr addr;
5199 int ret;
5200 struct ospf_if_params *params;
5201
5202 ifp = vty->index;
5203 params = IF_DEF_PARAMS (ifp);
5204
5205 if (argc == 1)
5206 {
5207 ret = inet_aton(argv[0], &addr);
5208 if (!ret)
5209 {
5210 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5211 VTY_NEWLINE);
5212 return CMD_WARNING;
5213 }
5214
5215 params = ospf_lookup_if_params (ifp, addr);
5216 if (params == NULL)
5217 return CMD_SUCCESS;
5218 }
5219
5220 UNSET_IF_PARAM (params, transmit_delay);
5221 params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
5222
5223 if (params != IF_DEF_PARAMS (ifp))
5224 {
5225 ospf_free_if_params (ifp, addr);
5226 ospf_if_update_params (ifp, addr);
5227 }
5228
5229 return CMD_SUCCESS;
5230}
5231
5232ALIAS (no_ip_ospf_transmit_delay,
5233 no_ip_ospf_transmit_delay_cmd,
5234 "no ip ospf transmit-delay",
5235 NO_STR
5236 "IP Information\n"
5237 "OSPF interface commands\n"
5238 "Link state transmit delay\n")
5239
5240ALIAS (no_ip_ospf_transmit_delay,
5241 no_ospf_transmit_delay_cmd,
5242 "no ospf transmit-delay",
5243 NO_STR
5244 "OSPF interface commands\n"
5245 "Link state transmit delay\n")
5246
5247
5248DEFUN (ospf_redistribute_source_metric_type,
5249 ospf_redistribute_source_metric_type_routemap_cmd,
5250 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5251 "Redistribute information from another routing protocol\n"
5252 "Kernel routes\n"
5253 "Connected\n"
5254 "Static routes\n"
5255 "Routing Information Protocol (RIP)\n"
5256 "Border Gateway Protocol (BGP)\n"
5257 "Metric for redistributed routes\n"
5258 "OSPF default metric\n"
5259 "OSPF exterior metric type for redistributed routes\n"
5260 "Set OSPF External Type 1 metrics\n"
5261 "Set OSPF External Type 2 metrics\n"
5262 "Route map reference\n"
5263 "Pointer to route-map entries\n")
5264{
5265 int source;
5266 int type = -1;
5267 int metric = -1;
5268
5269 /* Get distribute source. */
5270 if (!str2distribute_source (argv[0], &source))
5271 return CMD_WARNING;
5272
5273 /* Get metric value. */
5274 if (argc >= 2)
5275 if (!str2metric (argv[1], &metric))
5276 return CMD_WARNING;
5277
5278 /* Get metric type. */
5279 if (argc >= 3)
5280 if (!str2metric_type (argv[2], &type))
5281 return CMD_WARNING;
5282
5283 if (argc == 4)
5284 ospf_routemap_set (source, argv[3]);
5285 else
5286 ospf_routemap_unset (source);
5287
5288 return ospf_redistribute_set (source, type, metric);
5289}
5290
5291ALIAS (ospf_redistribute_source_metric_type,
5292 ospf_redistribute_source_metric_type_cmd,
5293 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5294 "Redistribute information from another routing protocol\n"
5295 "Kernel routes\n"
5296 "Connected\n"
5297 "Static routes\n"
5298 "Routing Information Protocol (RIP)\n"
5299 "Border Gateway Protocol (BGP)\n"
5300 "Metric for redistributed routes\n"
5301 "OSPF default metric\n"
5302 "OSPF exterior metric type for redistributed routes\n"
5303 "Set OSPF External Type 1 metrics\n"
5304 "Set OSPF External Type 2 metrics\n")
5305
5306ALIAS (ospf_redistribute_source_metric_type,
5307 ospf_redistribute_source_metric_cmd,
5308 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5309 "Redistribute information from another routing protocol\n"
5310 "Kernel routes\n"
5311 "Connected\n"
5312 "Static routes\n"
5313 "Routing Information Protocol (RIP)\n"
5314 "Border Gateway Protocol (BGP)\n"
5315 "Metric for redistributed routes\n"
5316 "OSPF default metric\n")
5317
5318DEFUN (ospf_redistribute_source_type_metric,
5319 ospf_redistribute_source_type_metric_routemap_cmd,
5320 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5321 "Redistribute information from another routing protocol\n"
5322 "Kernel routes\n"
5323 "Connected\n"
5324 "Static routes\n"
5325 "Routing Information Protocol (RIP)\n"
5326 "Border Gateway Protocol (BGP)\n"
5327 "OSPF exterior metric type for redistributed routes\n"
5328 "Set OSPF External Type 1 metrics\n"
5329 "Set OSPF External Type 2 metrics\n"
5330 "Metric for redistributed routes\n"
5331 "OSPF default metric\n"
5332 "Route map reference\n"
5333 "Pointer to route-map entries\n")
5334{
5335 int source;
5336 int type = -1;
5337 int metric = -1;
5338
5339 /* Get distribute source. */
5340 if (!str2distribute_source (argv[0], &source))
5341 return CMD_WARNING;
5342
5343 /* Get metric value. */
5344 if (argc >= 2)
5345 if (!str2metric_type (argv[1], &type))
5346 return CMD_WARNING;
5347
5348 /* Get metric type. */
5349 if (argc >= 3)
5350 if (!str2metric (argv[2], &metric))
5351 return CMD_WARNING;
5352
5353 if (argc == 4)
5354 ospf_routemap_set (source, argv[3]);
5355 else
5356 ospf_routemap_unset (source);
5357
5358 return ospf_redistribute_set (source, type, metric);
5359}
5360
5361ALIAS (ospf_redistribute_source_type_metric,
5362 ospf_redistribute_source_type_metric_cmd,
5363 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5364 "Redistribute information from another routing protocol\n"
5365 "Kernel routes\n"
5366 "Connected\n"
5367 "Static routes\n"
5368 "Routing Information Protocol (RIP)\n"
5369 "Border Gateway Protocol (BGP)\n"
5370 "OSPF exterior metric type for redistributed routes\n"
5371 "Set OSPF External Type 1 metrics\n"
5372 "Set OSPF External Type 2 metrics\n"
5373 "Metric for redistributed routes\n"
5374 "OSPF default metric\n")
5375
5376ALIAS (ospf_redistribute_source_type_metric,
5377 ospf_redistribute_source_type_cmd,
5378 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5379 "Redistribute information from another routing protocol\n"
5380 "Kernel routes\n"
5381 "Connected\n"
5382 "Static routes\n"
5383 "Routing Information Protocol (RIP)\n"
5384 "Border Gateway Protocol (BGP)\n"
5385 "OSPF exterior metric type for redistributed routes\n"
5386 "Set OSPF External Type 1 metrics\n"
5387 "Set OSPF External Type 2 metrics\n")
5388
5389ALIAS (ospf_redistribute_source_type_metric,
5390 ospf_redistribute_source_cmd,
5391 "redistribute (kernel|connected|static|rip|bgp)",
5392 "Redistribute information from another routing protocol\n"
5393 "Kernel routes\n"
5394 "Connected\n"
5395 "Static routes\n"
5396 "Routing Information Protocol (RIP)\n"
5397 "Border Gateway Protocol (BGP)\n")
5398
5399DEFUN (ospf_redistribute_source_metric_routemap,
5400 ospf_redistribute_source_metric_routemap_cmd,
5401 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5402 "Redistribute information from another routing protocol\n"
5403 "Kernel routes\n"
5404 "Connected\n"
5405 "Static routes\n"
5406 "Routing Information Protocol (RIP)\n"
5407 "Border Gateway Protocol (BGP)\n"
5408 "Metric for redistributed routes\n"
5409 "OSPF default metric\n"
5410 "Route map reference\n"
5411 "Pointer to route-map entries\n")
5412{
5413 int source;
5414 int metric = -1;
5415
5416 /* Get distribute source. */
5417 if (!str2distribute_source (argv[0], &source))
5418 return CMD_WARNING;
5419
5420 /* Get metric value. */
5421 if (argc >= 2)
5422 if (!str2metric (argv[1], &metric))
5423 return CMD_WARNING;
5424
5425 if (argc == 3)
5426 ospf_routemap_set (source, argv[2]);
5427 else
5428 ospf_routemap_unset (source);
5429
5430 return ospf_redistribute_set (source, -1, metric);
5431}
5432
5433DEFUN (ospf_redistribute_source_type_routemap,
5434 ospf_redistribute_source_type_routemap_cmd,
5435 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5436 "Redistribute information from another routing protocol\n"
5437 "Kernel routes\n"
5438 "Connected\n"
5439 "Static routes\n"
5440 "Routing Information Protocol (RIP)\n"
5441 "Border Gateway Protocol (BGP)\n"
5442 "OSPF exterior metric type for redistributed routes\n"
5443 "Set OSPF External Type 1 metrics\n"
5444 "Set OSPF External Type 2 metrics\n"
5445 "Route map reference\n"
5446 "Pointer to route-map entries\n")
5447{
5448 int source;
5449 int type = -1;
5450
5451 /* Get distribute source. */
5452 if (!str2distribute_source (argv[0], &source))
5453 return CMD_WARNING;
5454
5455 /* Get metric value. */
5456 if (argc >= 2)
5457 if (!str2metric_type (argv[1], &type))
5458 return CMD_WARNING;
5459
5460 if (argc == 3)
5461 ospf_routemap_set (source, argv[2]);
5462 else
5463 ospf_routemap_unset (source);
5464
5465 return ospf_redistribute_set (source, type, -1);
5466}
5467
5468DEFUN (ospf_redistribute_source_routemap,
5469 ospf_redistribute_source_routemap_cmd,
5470 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5471 "Redistribute information from another routing protocol\n"
5472 "Kernel routes\n"
5473 "Connected\n"
5474 "Static routes\n"
5475 "Routing Information Protocol (RIP)\n"
5476 "Border Gateway Protocol (BGP)\n"
5477 "Route map reference\n"
5478 "Pointer to route-map entries\n")
5479{
5480 int source;
5481
5482 /* Get distribute source. */
5483 if (!str2distribute_source (argv[0], &source))
5484 return CMD_WARNING;
5485
5486 if (argc == 2)
5487 ospf_routemap_set (source, argv[1]);
5488 else
5489 ospf_routemap_unset (source);
5490
5491 return ospf_redistribute_set (source, -1, -1);
5492}
5493
5494DEFUN (no_ospf_redistribute_source,
5495 no_ospf_redistribute_source_cmd,
5496 "no redistribute (kernel|connected|static|rip|bgp)",
5497 NO_STR
5498 "Redistribute information from another routing protocol\n"
5499 "Kernel routes\n"
5500 "Connected\n"
5501 "Static routes\n"
5502 "Routing Information Protocol (RIP)\n"
5503 "Border Gateway Protocol (BGP)\n")
5504{
5505 int source;
5506
5507 if (!str2distribute_source (argv[0], &source))
5508 return CMD_WARNING;
5509
5510 ospf_routemap_unset (source);
5511 return ospf_redistribute_unset (source);
5512}
5513
5514DEFUN (ospf_distribute_list_out,
5515 ospf_distribute_list_out_cmd,
5516 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5517 "Filter networks in routing updates\n"
5518 "Access-list name\n"
5519 OUT_STR
5520 "Kernel routes\n"
5521 "Connected\n"
5522 "Static routes\n"
5523 "Routing Information Protocol (RIP)\n"
5524 "Border Gateway Protocol (BGP)\n")
5525{
paul68980082003-03-25 05:07:42 +00005526 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005527 int source;
5528
5529 /* Get distribute source. */
5530 if (!str2distribute_source (argv[1], &source))
5531 return CMD_WARNING;
5532
paul68980082003-03-25 05:07:42 +00005533 return ospf_distribute_list_out_set (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00005534}
5535
5536DEFUN (no_ospf_distribute_list_out,
5537 no_ospf_distribute_list_out_cmd,
5538 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5539 NO_STR
5540 "Filter networks in routing updates\n"
5541 "Access-list name\n"
5542 OUT_STR
5543 "Kernel routes\n"
5544 "Connected\n"
5545 "Static routes\n"
5546 "Routing Information Protocol (RIP)\n"
5547 "Border Gateway Protocol (BGP)\n")
5548{
paul68980082003-03-25 05:07:42 +00005549 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005550 int source;
5551
5552 if (!str2distribute_source (argv[1], &source))
5553 return CMD_WARNING;
5554
paul68980082003-03-25 05:07:42 +00005555 return ospf_distribute_list_out_unset (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00005556}
5557
5558/* Default information originate. */
5559DEFUN (ospf_default_information_originate_metric_type_routemap,
5560 ospf_default_information_originate_metric_type_routemap_cmd,
5561 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5562 "Control distribution of default information\n"
5563 "Distribute a default route\n"
5564 "OSPF default metric\n"
5565 "OSPF metric\n"
5566 "OSPF metric type for default routes\n"
5567 "Set OSPF External Type 1 metrics\n"
5568 "Set OSPF External Type 2 metrics\n"
5569 "Route map reference\n"
5570 "Pointer to route-map entries\n")
5571{
5572 int type = -1;
5573 int metric = -1;
5574
5575 /* Get metric value. */
5576 if (argc >= 1)
5577 if (!str2metric (argv[0], &metric))
5578 return CMD_WARNING;
5579
5580 /* Get metric type. */
5581 if (argc >= 2)
5582 if (!str2metric_type (argv[1], &type))
5583 return CMD_WARNING;
5584
5585 if (argc == 3)
5586 ospf_routemap_set (DEFAULT_ROUTE, argv[2]);
5587 else
5588 ospf_routemap_unset (DEFAULT_ROUTE);
5589
5590 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, type, metric);
5591}
5592
5593ALIAS (ospf_default_information_originate_metric_type_routemap,
5594 ospf_default_information_originate_metric_type_cmd,
5595 "default-information originate metric <0-16777214> metric-type (1|2)",
5596 "Control distribution of default information\n"
5597 "Distribute a default route\n"
5598 "OSPF default metric\n"
5599 "OSPF metric\n"
5600 "OSPF metric type for default routes\n"
5601 "Set OSPF External Type 1 metrics\n"
5602 "Set OSPF External Type 2 metrics\n")
5603
5604ALIAS (ospf_default_information_originate_metric_type_routemap,
5605 ospf_default_information_originate_metric_cmd,
5606 "default-information originate metric <0-16777214>",
5607 "Control distribution of default information\n"
5608 "Distribute a default route\n"
5609 "OSPF default metric\n"
5610 "OSPF metric\n")
5611
5612ALIAS (ospf_default_information_originate_metric_type_routemap,
5613 ospf_default_information_originate_cmd,
5614 "default-information originate",
5615 "Control distribution of default information\n"
5616 "Distribute a default route\n")
5617
5618/* Default information originate. */
5619DEFUN (ospf_default_information_originate_metric_routemap,
5620 ospf_default_information_originate_metric_routemap_cmd,
5621 "default-information originate metric <0-16777214> route-map WORD",
5622 "Control distribution of default information\n"
5623 "Distribute a default route\n"
5624 "OSPF default metric\n"
5625 "OSPF metric\n"
5626 "Route map reference\n"
5627 "Pointer to route-map entries\n")
5628{
5629 int metric = -1;
5630
5631 /* Get metric value. */
5632 if (argc >= 1)
5633 if (!str2metric (argv[0], &metric))
5634 return CMD_WARNING;
5635
5636 if (argc == 2)
5637 ospf_routemap_set (DEFAULT_ROUTE, argv[1]);
5638 else
5639 ospf_routemap_unset (DEFAULT_ROUTE);
5640
5641 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, -1, metric);
5642}
5643
5644/* Default information originate. */
5645DEFUN (ospf_default_information_originate_routemap,
5646 ospf_default_information_originate_routemap_cmd,
5647 "default-information originate route-map WORD",
5648 "Control distribution of default information\n"
5649 "Distribute a default route\n"
5650 "Route map reference\n"
5651 "Pointer to route-map entries\n")
5652{
5653 if (argc == 1)
5654 ospf_routemap_set (DEFAULT_ROUTE, argv[0]);
5655 else
5656 ospf_routemap_unset (DEFAULT_ROUTE);
5657
5658 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, -1, -1);
5659}
5660
5661DEFUN (ospf_default_information_originate_type_metric_routemap,
5662 ospf_default_information_originate_type_metric_routemap_cmd,
5663 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
5664 "Control distribution of default information\n"
5665 "Distribute a default route\n"
5666 "OSPF metric type for default routes\n"
5667 "Set OSPF External Type 1 metrics\n"
5668 "Set OSPF External Type 2 metrics\n"
5669 "OSPF default metric\n"
5670 "OSPF metric\n"
5671 "Route map reference\n"
5672 "Pointer to route-map entries\n")
5673{
5674 int type = -1;
5675 int metric = -1;
5676
5677 /* Get metric type. */
5678 if (argc >= 1)
5679 if (!str2metric_type (argv[0], &type))
5680 return CMD_WARNING;
5681
5682 /* Get metric value. */
5683 if (argc >= 2)
5684 if (!str2metric (argv[1], &metric))
5685 return CMD_WARNING;
5686
5687 if (argc == 3)
5688 ospf_routemap_set (DEFAULT_ROUTE, argv[2]);
5689 else
5690 ospf_routemap_unset (DEFAULT_ROUTE);
5691
5692 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, type, metric);
5693}
5694
5695ALIAS (ospf_default_information_originate_type_metric_routemap,
5696 ospf_default_information_originate_type_metric_cmd,
5697 "default-information originate metric-type (1|2) metric <0-16777214>",
5698 "Control distribution of default information\n"
5699 "Distribute a default route\n"
5700 "OSPF metric type for default routes\n"
5701 "Set OSPF External Type 1 metrics\n"
5702 "Set OSPF External Type 2 metrics\n"
5703 "OSPF default metric\n"
5704 "OSPF metric\n")
5705
5706ALIAS (ospf_default_information_originate_type_metric_routemap,
5707 ospf_default_information_originate_type_cmd,
5708 "default-information originate metric-type (1|2)",
5709 "Control distribution of default information\n"
5710 "Distribute a default route\n"
5711 "OSPF metric type for default routes\n"
5712 "Set OSPF External Type 1 metrics\n"
5713 "Set OSPF External Type 2 metrics\n")
5714
5715DEFUN (ospf_default_information_originate_type_routemap,
5716 ospf_default_information_originate_type_routemap_cmd,
5717 "default-information originate metric-type (1|2) route-map WORD",
5718 "Control distribution of default information\n"
5719 "Distribute a default route\n"
5720 "OSPF metric type for default routes\n"
5721 "Set OSPF External Type 1 metrics\n"
5722 "Set OSPF External Type 2 metrics\n"
5723 "Route map reference\n"
5724 "Pointer to route-map entries\n")
5725{
5726 int type = -1;
5727
5728 /* Get metric type. */
5729 if (argc >= 1)
5730 if (!str2metric_type (argv[0], &type))
5731 return CMD_WARNING;
5732
5733 if (argc == 2)
5734 ospf_routemap_set (DEFAULT_ROUTE, argv[1]);
5735 else
5736 ospf_routemap_unset (DEFAULT_ROUTE);
5737
5738 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ZEBRA, type, -1);
5739}
5740
5741DEFUN (ospf_default_information_originate_always_metric_type_routemap,
5742 ospf_default_information_originate_always_metric_type_routemap_cmd,
5743 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5744 "Control distribution of default information\n"
5745 "Distribute a default route\n"
5746 "Always advertise default route\n"
5747 "OSPF default metric\n"
5748 "OSPF metric\n"
5749 "OSPF metric type for default routes\n"
5750 "Set OSPF External Type 1 metrics\n"
5751 "Set OSPF External Type 2 metrics\n"
5752 "Route map reference\n"
5753 "Pointer to route-map entries\n")
5754{
5755 int type = -1;
5756 int metric = -1;
5757
5758 /* Get metric value. */
5759 if (argc >= 1)
5760 if (!str2metric (argv[0], &metric))
5761 return CMD_WARNING;
5762
5763 /* Get metric type. */
5764 if (argc >= 2)
5765 if (!str2metric_type (argv[1], &type))
5766 return CMD_WARNING;
5767
5768 if (argc == 3)
5769 ospf_routemap_set (DEFAULT_ROUTE, argv[2]);
5770 else
5771 ospf_routemap_unset (DEFAULT_ROUTE);
5772
5773 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS,
5774 type, metric);
5775}
5776
5777ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5778 ospf_default_information_originate_always_metric_type_cmd,
5779 "default-information originate always metric <0-16777214> metric-type (1|2)",
5780 "Control distribution of default information\n"
5781 "Distribute a default route\n"
5782 "Always advertise default route\n"
5783 "OSPF default metric\n"
5784 "OSPF metric\n"
5785 "OSPF metric type for default routes\n"
5786 "Set OSPF External Type 1 metrics\n"
5787 "Set OSPF External Type 2 metrics\n")
5788
5789ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5790 ospf_default_information_originate_always_metric_cmd,
5791 "default-information originate always metric <0-16777214>",
5792 "Control distribution of default information\n"
5793 "Distribute a default route\n"
5794 "Always advertise default route\n"
5795 "OSPF default metric\n"
5796 "OSPF metric\n"
5797 "OSPF metric type for default routes\n")
5798
5799ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5800 ospf_default_information_originate_always_cmd,
5801 "default-information originate always",
5802 "Control distribution of default information\n"
5803 "Distribute a default route\n"
5804 "Always advertise default route\n")
5805
5806DEFUN (ospf_default_information_originate_always_metric_routemap,
5807 ospf_default_information_originate_always_metric_routemap_cmd,
5808 "default-information originate always metric <0-16777214> route-map WORD",
5809 "Control distribution of default information\n"
5810 "Distribute a default route\n"
5811 "Always advertise default route\n"
5812 "OSPF default metric\n"
5813 "OSPF metric\n"
5814 "Route map reference\n"
5815 "Pointer to route-map entries\n")
5816{
5817 int metric = -1;
5818
5819 /* Get metric value. */
5820 if (argc >= 1)
5821 if (!str2metric (argv[0], &metric))
5822 return CMD_WARNING;
5823
5824 if (argc == 2)
5825 ospf_routemap_set (DEFAULT_ROUTE, argv[1]);
5826 else
5827 ospf_routemap_unset (DEFAULT_ROUTE);
5828
5829 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, -1, metric);
5830}
5831
5832DEFUN (ospf_default_information_originate_always_routemap,
5833 ospf_default_information_originate_always_routemap_cmd,
5834 "default-information originate always route-map WORD",
5835 "Control distribution of default information\n"
5836 "Distribute a default route\n"
5837 "Always advertise default route\n"
5838 "Route map reference\n"
5839 "Pointer to route-map entries\n")
5840{
5841 if (argc == 1)
5842 ospf_routemap_set (DEFAULT_ROUTE, argv[0]);
5843 else
5844 ospf_routemap_unset (DEFAULT_ROUTE);
5845
5846 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS, -1, -1);
5847}
5848
5849DEFUN (ospf_default_information_originate_always_type_metric_routemap,
5850 ospf_default_information_originate_always_type_metric_routemap_cmd,
5851 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
5852 "Control distribution of default information\n"
5853 "Distribute a default route\n"
5854 "Always advertise default route\n"
5855 "OSPF metric type for default routes\n"
5856 "Set OSPF External Type 1 metrics\n"
5857 "Set OSPF External Type 2 metrics\n"
5858 "OSPF default metric\n"
5859 "OSPF metric\n"
5860 "Route map reference\n"
5861 "Pointer to route-map entries\n")
5862{
5863 int type = -1;
5864 int metric = -1;
5865
5866 /* Get metric type. */
5867 if (argc >= 1)
5868 if (!str2metric_type (argv[0], &type))
5869 return CMD_WARNING;
5870
5871 /* Get metric value. */
5872 if (argc >= 2)
5873 if (!str2metric (argv[1], &metric))
5874 return CMD_WARNING;
5875
5876 if (argc == 3)
5877 ospf_routemap_set (DEFAULT_ROUTE, argv[2]);
5878 else
5879 ospf_routemap_unset (DEFAULT_ROUTE);
5880
5881 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS,
5882 type, metric);
5883}
5884
5885ALIAS (ospf_default_information_originate_always_type_metric_routemap,
5886 ospf_default_information_originate_always_type_metric_cmd,
5887 "default-information originate always metric-type (1|2) metric <0-16777214>",
5888 "Control distribution of default information\n"
5889 "Distribute a default route\n"
5890 "Always advertise default route\n"
5891 "OSPF metric type for default routes\n"
5892 "Set OSPF External Type 1 metrics\n"
5893 "Set OSPF External Type 2 metrics\n"
5894 "OSPF default metric\n"
5895 "OSPF metric\n")
5896
5897ALIAS (ospf_default_information_originate_always_type_metric_routemap,
5898 ospf_default_information_originate_always_type_cmd,
5899 "default-information originate always metric-type (1|2)",
5900 "Control distribution of default information\n"
5901 "Distribute a default route\n"
5902 "Always advertise default route\n"
5903 "OSPF metric type for default routes\n"
5904 "Set OSPF External Type 1 metrics\n"
5905 "Set OSPF External Type 2 metrics\n")
5906
5907DEFUN (ospf_default_information_originate_always_type_routemap,
5908 ospf_default_information_originate_always_type_routemap_cmd,
5909 "default-information originate always metric-type (1|2) route-map WORD",
5910 "Control distribution of default information\n"
5911 "Distribute a default route\n"
5912 "Always advertise default route\n"
5913 "OSPF metric type for default routes\n"
5914 "Set OSPF External Type 1 metrics\n"
5915 "Set OSPF External Type 2 metrics\n"
5916 "Route map reference\n"
5917 "Pointer to route-map entries\n")
5918{
5919 int type = -1;
5920
5921 /* Get metric type. */
5922 if (argc >= 1)
5923 if (!str2metric_type (argv[0], &type))
5924 return CMD_WARNING;
5925
5926 if (argc == 2)
5927 ospf_routemap_set (DEFAULT_ROUTE, argv[1]);
5928 else
5929 ospf_routemap_unset (DEFAULT_ROUTE);
5930
5931 return ospf_redistribute_default_set (DEFAULT_ORIGINATE_ALWAYS,
5932 type, -1);
5933}
5934
5935DEFUN (no_ospf_default_information_originate,
5936 no_ospf_default_information_originate_cmd,
5937 "no default-information originate",
5938 NO_STR
5939 "Control distribution of default information\n"
5940 "Distribute a default route\n")
5941{
paul68980082003-03-25 05:07:42 +00005942 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005943 struct prefix_ipv4 p;
5944 struct in_addr nexthop;
5945
5946 p.family = AF_INET;
5947 p.prefix.s_addr = 0;
5948 p.prefixlen = 0;
5949
paul68980082003-03-25 05:07:42 +00005950 ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0, nexthop);
paul718e3742002-12-13 20:15:29 +00005951
5952 if (EXTERNAL_INFO (DEFAULT_ROUTE)) {
5953 ospf_external_info_delete (DEFAULT_ROUTE, p);
5954 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE));
5955 EXTERNAL_INFO (DEFAULT_ROUTE) = NULL;
5956 }
5957
5958 ospf_routemap_unset (DEFAULT_ROUTE);
5959 return ospf_redistribute_default_unset ();
5960}
5961
5962DEFUN (ospf_default_metric,
5963 ospf_default_metric_cmd,
5964 "default-metric <0-16777214>",
5965 "Set metric of redistributed routes\n"
5966 "Default metric\n")
5967{
paul68980082003-03-25 05:07:42 +00005968 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005969 int metric = -1;
5970
5971 if (!str2metric (argv[0], &metric))
5972 return CMD_WARNING;
5973
paul68980082003-03-25 05:07:42 +00005974 ospf->default_metric = metric;
paul718e3742002-12-13 20:15:29 +00005975
5976 return CMD_SUCCESS;
5977}
5978
5979DEFUN (no_ospf_default_metric,
5980 no_ospf_default_metric_cmd,
5981 "no default-metric",
5982 NO_STR
5983 "Set metric of redistributed routes\n")
5984{
paul68980082003-03-25 05:07:42 +00005985 struct ospf *ospf = vty->index;
5986
5987 ospf->default_metric = -1;
5988
paul718e3742002-12-13 20:15:29 +00005989 return CMD_SUCCESS;
5990}
5991
5992ALIAS (no_ospf_default_metric,
5993 no_ospf_default_metric_val_cmd,
5994 "no default-metric <0-16777214>",
5995 NO_STR
5996 "Set metric of redistributed routes\n"
5997 "Default metric\n")
5998
5999DEFUN (ospf_distance,
6000 ospf_distance_cmd,
6001 "distance <1-255>",
6002 "Define an administrative distance\n"
6003 "OSPF Administrative distance\n")
6004{
paul68980082003-03-25 05:07:42 +00006005 struct ospf *ospf = vty->index;
6006
6007 ospf->distance_all = atoi (argv[0]);
6008
paul718e3742002-12-13 20:15:29 +00006009 return CMD_SUCCESS;
6010}
6011
6012DEFUN (no_ospf_distance,
6013 no_ospf_distance_cmd,
6014 "no distance <1-255>",
6015 NO_STR
6016 "Define an administrative distance\n"
6017 "OSPF Administrative distance\n")
6018{
paul68980082003-03-25 05:07:42 +00006019 struct ospf *ospf = vty->index;
6020
6021 ospf->distance_all = 0;
6022
paul718e3742002-12-13 20:15:29 +00006023 return CMD_SUCCESS;
6024}
6025
6026DEFUN (no_ospf_distance_ospf,
6027 no_ospf_distance_ospf_cmd,
6028 "no distance ospf",
6029 NO_STR
6030 "Define an administrative distance\n"
6031 "OSPF Administrative distance\n"
6032 "OSPF Distance\n")
6033{
paul68980082003-03-25 05:07:42 +00006034 struct ospf *ospf = vty->index;
6035
6036 ospf->distance_intra = 0;
6037 ospf->distance_inter = 0;
6038 ospf->distance_external = 0;
6039
paul718e3742002-12-13 20:15:29 +00006040 return CMD_SUCCESS;
6041}
6042
6043DEFUN (ospf_distance_ospf_intra,
6044 ospf_distance_ospf_intra_cmd,
6045 "distance ospf intra-area <1-255>",
6046 "Define an administrative distance\n"
6047 "OSPF Administrative distance\n"
6048 "Intra-area routes\n"
6049 "Distance for intra-area routes\n")
6050{
paul68980082003-03-25 05:07:42 +00006051 struct ospf *ospf = vty->index;
6052
6053 ospf->distance_intra = atoi (argv[0]);
6054
paul718e3742002-12-13 20:15:29 +00006055 return CMD_SUCCESS;
6056}
6057
6058DEFUN (ospf_distance_ospf_intra_inter,
6059 ospf_distance_ospf_intra_inter_cmd,
6060 "distance ospf intra-area <1-255> inter-area <1-255>",
6061 "Define an administrative distance\n"
6062 "OSPF Administrative distance\n"
6063 "Intra-area routes\n"
6064 "Distance for intra-area routes\n"
6065 "Inter-area routes\n"
6066 "Distance for inter-area routes\n")
6067{
paul68980082003-03-25 05:07:42 +00006068 struct ospf *ospf = vty->index;
6069
6070 ospf->distance_intra = atoi (argv[0]);
6071 ospf->distance_inter = atoi (argv[1]);
6072
paul718e3742002-12-13 20:15:29 +00006073 return CMD_SUCCESS;
6074}
6075
6076DEFUN (ospf_distance_ospf_intra_external,
6077 ospf_distance_ospf_intra_external_cmd,
6078 "distance ospf intra-area <1-255> external <1-255>",
6079 "Define an administrative distance\n"
6080 "OSPF Administrative distance\n"
6081 "Intra-area routes\n"
6082 "Distance for intra-area routes\n"
6083 "External routes\n"
6084 "Distance for external routes\n")
6085{
paul68980082003-03-25 05:07:42 +00006086 struct ospf *ospf = vty->index;
6087
6088 ospf->distance_intra = atoi (argv[0]);
6089 ospf->distance_external = atoi (argv[1]);
6090
paul718e3742002-12-13 20:15:29 +00006091 return CMD_SUCCESS;
6092}
6093
6094DEFUN (ospf_distance_ospf_intra_inter_external,
6095 ospf_distance_ospf_intra_inter_external_cmd,
6096 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6097 "Define an administrative distance\n"
6098 "OSPF Administrative distance\n"
6099 "Intra-area routes\n"
6100 "Distance for intra-area routes\n"
6101 "Inter-area routes\n"
6102 "Distance for inter-area routes\n"
6103 "External routes\n"
6104 "Distance for external routes\n")
6105{
paul68980082003-03-25 05:07:42 +00006106 struct ospf *ospf = vty->index;
6107
6108 ospf->distance_intra = atoi (argv[0]);
6109 ospf->distance_inter = atoi (argv[1]);
6110 ospf->distance_external = atoi (argv[2]);
6111
paul718e3742002-12-13 20:15:29 +00006112 return CMD_SUCCESS;
6113}
6114
6115DEFUN (ospf_distance_ospf_intra_external_inter,
6116 ospf_distance_ospf_intra_external_inter_cmd,
6117 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6118 "Define an administrative distance\n"
6119 "OSPF Administrative distance\n"
6120 "Intra-area routes\n"
6121 "Distance for intra-area routes\n"
6122 "External routes\n"
6123 "Distance for external routes\n"
6124 "Inter-area routes\n"
6125 "Distance for inter-area routes\n")
6126{
paul68980082003-03-25 05:07:42 +00006127 struct ospf *ospf = vty->index;
6128
6129 ospf->distance_intra = atoi (argv[0]);
6130 ospf->distance_external = atoi (argv[1]);
6131 ospf->distance_inter = atoi (argv[2]);
6132
paul718e3742002-12-13 20:15:29 +00006133 return CMD_SUCCESS;
6134}
6135
6136DEFUN (ospf_distance_ospf_inter,
6137 ospf_distance_ospf_inter_cmd,
6138 "distance ospf inter-area <1-255>",
6139 "Define an administrative distance\n"
6140 "OSPF Administrative distance\n"
6141 "Inter-area routes\n"
6142 "Distance for inter-area routes\n")
6143{
paul68980082003-03-25 05:07:42 +00006144 struct ospf *ospf = vty->index;
6145
6146 ospf->distance_inter = atoi (argv[0]);
6147
paul718e3742002-12-13 20:15:29 +00006148 return CMD_SUCCESS;
6149}
6150
6151DEFUN (ospf_distance_ospf_inter_intra,
6152 ospf_distance_ospf_inter_intra_cmd,
6153 "distance ospf inter-area <1-255> intra-area <1-255>",
6154 "Define an administrative distance\n"
6155 "OSPF Administrative distance\n"
6156 "Inter-area routes\n"
6157 "Distance for inter-area routes\n"
6158 "Intra-area routes\n"
6159 "Distance for intra-area routes\n")
6160{
paul68980082003-03-25 05:07:42 +00006161 struct ospf *ospf = vty->index;
6162
6163 ospf->distance_inter = atoi (argv[0]);
6164 ospf->distance_intra = atoi (argv[1]);
6165
paul718e3742002-12-13 20:15:29 +00006166 return CMD_SUCCESS;
6167}
6168
6169DEFUN (ospf_distance_ospf_inter_external,
6170 ospf_distance_ospf_inter_external_cmd,
6171 "distance ospf inter-area <1-255> external <1-255>",
6172 "Define an administrative distance\n"
6173 "OSPF Administrative distance\n"
6174 "Inter-area routes\n"
6175 "Distance for inter-area routes\n"
6176 "External routes\n"
6177 "Distance for external routes\n")
6178{
paul68980082003-03-25 05:07:42 +00006179 struct ospf *ospf = vty->index;
6180
6181 ospf->distance_inter = atoi (argv[0]);
6182 ospf->distance_external = atoi (argv[1]);
6183
paul718e3742002-12-13 20:15:29 +00006184 return CMD_SUCCESS;
6185}
6186
6187DEFUN (ospf_distance_ospf_inter_intra_external,
6188 ospf_distance_ospf_inter_intra_external_cmd,
6189 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6190 "Define an administrative distance\n"
6191 "OSPF Administrative distance\n"
6192 "Inter-area routes\n"
6193 "Distance for inter-area routes\n"
6194 "Intra-area routes\n"
6195 "Distance for intra-area routes\n"
6196 "External routes\n"
6197 "Distance for external routes\n")
6198{
paul68980082003-03-25 05:07:42 +00006199 struct ospf *ospf = vty->index;
6200
6201 ospf->distance_inter = atoi (argv[0]);
6202 ospf->distance_intra = atoi (argv[1]);
6203 ospf->distance_external = atoi (argv[2]);
6204
paul718e3742002-12-13 20:15:29 +00006205 return CMD_SUCCESS;
6206}
6207
6208DEFUN (ospf_distance_ospf_inter_external_intra,
6209 ospf_distance_ospf_inter_external_intra_cmd,
6210 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6211 "Define an administrative distance\n"
6212 "OSPF Administrative distance\n"
6213 "Inter-area routes\n"
6214 "Distance for inter-area routes\n"
6215 "External routes\n"
6216 "Distance for external routes\n"
6217 "Intra-area routes\n"
6218 "Distance for intra-area routes\n")
6219{
paul68980082003-03-25 05:07:42 +00006220 struct ospf *ospf = vty->index;
6221
6222 ospf->distance_inter = atoi (argv[0]);
6223 ospf->distance_external = atoi (argv[1]);
6224 ospf->distance_intra = atoi (argv[2]);
6225
paul718e3742002-12-13 20:15:29 +00006226 return CMD_SUCCESS;
6227}
6228
6229DEFUN (ospf_distance_ospf_external,
6230 ospf_distance_ospf_external_cmd,
6231 "distance ospf external <1-255>",
6232 "Define an administrative distance\n"
6233 "OSPF Administrative distance\n"
6234 "External routes\n"
6235 "Distance for external routes\n")
6236{
paul68980082003-03-25 05:07:42 +00006237 struct ospf *ospf = vty->index;
6238
6239 ospf->distance_external = atoi (argv[0]);
6240
paul718e3742002-12-13 20:15:29 +00006241 return CMD_SUCCESS;
6242}
6243
6244DEFUN (ospf_distance_ospf_external_intra,
6245 ospf_distance_ospf_external_intra_cmd,
6246 "distance ospf external <1-255> intra-area <1-255>",
6247 "Define an administrative distance\n"
6248 "OSPF Administrative distance\n"
6249 "External routes\n"
6250 "Distance for external routes\n"
6251 "Intra-area routes\n"
6252 "Distance for intra-area routes\n")
6253{
paul68980082003-03-25 05:07:42 +00006254 struct ospf *ospf = vty->index;
6255
6256 ospf->distance_external = atoi (argv[0]);
6257 ospf->distance_intra = atoi (argv[1]);
6258
paul718e3742002-12-13 20:15:29 +00006259 return CMD_SUCCESS;
6260}
6261
6262DEFUN (ospf_distance_ospf_external_inter,
6263 ospf_distance_ospf_external_inter_cmd,
6264 "distance ospf external <1-255> inter-area <1-255>",
6265 "Define an administrative distance\n"
6266 "OSPF Administrative distance\n"
6267 "External routes\n"
6268 "Distance for external routes\n"
6269 "Inter-area routes\n"
6270 "Distance for inter-area routes\n")
6271{
paul68980082003-03-25 05:07:42 +00006272 struct ospf *ospf = vty->index;
6273
6274 ospf->distance_external = atoi (argv[0]);
6275 ospf->distance_inter = atoi (argv[1]);
6276
paul718e3742002-12-13 20:15:29 +00006277 return CMD_SUCCESS;
6278}
6279
6280DEFUN (ospf_distance_ospf_external_intra_inter,
6281 ospf_distance_ospf_external_intra_inter_cmd,
6282 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6283 "Define an administrative distance\n"
6284 "OSPF Administrative distance\n"
6285 "External routes\n"
6286 "Distance for external routes\n"
6287 "Intra-area routes\n"
6288 "Distance for intra-area routes\n"
6289 "Inter-area routes\n"
6290 "Distance for inter-area routes\n")
6291{
paul68980082003-03-25 05:07:42 +00006292 struct ospf *ospf = vty->index;
6293
6294 ospf->distance_external = atoi (argv[0]);
6295 ospf->distance_intra = atoi (argv[1]);
6296 ospf->distance_inter = atoi (argv[2]);
6297
paul718e3742002-12-13 20:15:29 +00006298 return CMD_SUCCESS;
6299}
6300
6301DEFUN (ospf_distance_ospf_external_inter_intra,
6302 ospf_distance_ospf_external_inter_intra_cmd,
6303 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6304 "Define an administrative distance\n"
6305 "OSPF Administrative distance\n"
6306 "External routes\n"
6307 "Distance for external routes\n"
6308 "Inter-area routes\n"
6309 "Distance for inter-area routes\n"
6310 "Intra-area routes\n"
6311 "Distance for intra-area routes\n")
6312{
paul68980082003-03-25 05:07:42 +00006313 struct ospf *ospf = vty->index;
6314
6315 ospf->distance_external = atoi (argv[0]);
6316 ospf->distance_inter = atoi (argv[1]);
6317 ospf->distance_intra = atoi (argv[2]);
6318
paul718e3742002-12-13 20:15:29 +00006319 return CMD_SUCCESS;
6320}
6321
6322DEFUN (ospf_distance_source,
6323 ospf_distance_source_cmd,
6324 "distance <1-255> A.B.C.D/M",
6325 "Administrative distance\n"
6326 "Distance value\n"
6327 "IP source prefix\n")
6328{
6329 ospf_distance_set (vty, argv[0], argv[1], NULL);
paul68980082003-03-25 05:07:42 +00006330
paul718e3742002-12-13 20:15:29 +00006331 return CMD_SUCCESS;
6332}
6333
6334DEFUN (no_ospf_distance_source,
6335 no_ospf_distance_source_cmd,
6336 "no distance <1-255> A.B.C.D/M",
6337 NO_STR
6338 "Administrative distance\n"
6339 "Distance value\n"
6340 "IP source prefix\n")
6341{
6342 ospf_distance_unset (vty, argv[0], argv[1], NULL);
6343 return CMD_SUCCESS;
6344}
6345
6346DEFUN (ospf_distance_source_access_list,
6347 ospf_distance_source_access_list_cmd,
6348 "distance <1-255> A.B.C.D/M WORD",
6349 "Administrative distance\n"
6350 "Distance value\n"
6351 "IP source prefix\n"
6352 "Access list name\n")
6353{
6354 ospf_distance_set (vty, argv[0], argv[1], argv[2]);
6355 return CMD_SUCCESS;
6356}
6357
6358DEFUN (no_ospf_distance_source_access_list,
6359 no_ospf_distance_source_access_list_cmd,
6360 "no distance <1-255> A.B.C.D/M WORD",
6361 NO_STR
6362 "Administrative distance\n"
6363 "Distance value\n"
6364 "IP source prefix\n"
6365 "Access list name\n")
6366{
6367 ospf_distance_unset (vty, argv[0], argv[1], argv[2]);
6368 return CMD_SUCCESS;
6369}
6370
6371void
6372show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
6373{
6374 struct route_node *rn;
6375 struct ospf_route *or;
6376 listnode pnode;
6377 struct ospf_path *path;
6378
6379 vty_out (vty, "============ OSPF network routing table ============%s",
6380 VTY_NEWLINE);
6381
6382 for (rn = route_top (rt); rn; rn = route_next (rn))
6383 if ((or = rn->info) != NULL)
6384 {
6385 char buf1[19];
6386 snprintf (buf1, 19, "%s/%d",
6387 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
6388
6389 switch (or->path_type)
6390 {
6391 case OSPF_PATH_INTER_AREA:
6392 if (or->type == OSPF_DESTINATION_NETWORK)
6393 vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost,
6394 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
6395 else if (or->type == OSPF_DESTINATION_DISCARD)
6396 vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE);
6397 break;
6398 case OSPF_PATH_INTRA_AREA:
6399 vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost,
6400 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
6401 break;
6402 default:
6403 break;
6404 }
6405
6406 if (or->type == OSPF_DESTINATION_NETWORK)
6407 for (pnode = listhead (or->path); pnode; nextnode (pnode))
6408 {
6409 path = getdata (pnode);
6410 if (path->oi != NULL)
6411 {
6412 if (path->nexthop.s_addr == 0)
6413 vty_out (vty, "%24s directly attached to %s%s",
6414 "", path->oi->ifp->name, VTY_NEWLINE);
6415 else
6416 vty_out (vty, "%24s via %s, %s%s", "",
6417 inet_ntoa (path->nexthop), path->oi->ifp->name,
6418 VTY_NEWLINE);
6419 }
6420 }
6421 }
6422 vty_out (vty, "%s", VTY_NEWLINE);
6423}
6424
6425void
6426show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs)
6427{
6428 struct route_node *rn;
6429 struct ospf_route *or;
6430 listnode pn, nn;
6431 struct ospf_path *path;
6432
6433 vty_out (vty, "============ OSPF router routing table =============%s",
6434 VTY_NEWLINE);
6435 for (rn = route_top (rtrs); rn; rn = route_next (rn))
6436 if (rn->info)
6437 {
6438 int flag = 0;
6439
6440 vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4));
6441
6442 for (nn = listhead ((list) rn->info); nn; nextnode (nn))
6443 if ((or = getdata (nn)) != NULL)
6444 {
6445 if (flag++)
6446 vty_out(vty," " );
6447
6448 /* Show path. */
6449 vty_out (vty, "%s [%d] area: %s",
6450 (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "),
6451 or->cost, inet_ntoa (or->u.std.area_id));
6452 /* Show flags. */
6453 vty_out (vty, "%s%s%s",
6454 (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""),
6455 (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""),
6456 VTY_NEWLINE);
6457
6458 for (pn = listhead (or->path); pn; nextnode (pn))
6459 {
6460 path = getdata (pn);
6461 if (path->nexthop.s_addr == 0)
6462 vty_out (vty, "%24s directly attached to %s%s",
6463 "", path->oi->ifp->name, VTY_NEWLINE);
6464 else
6465 vty_out (vty, "%24s via %s, %s%s", "",
6466 inet_ntoa (path->nexthop), path->oi->ifp->name,
6467 VTY_NEWLINE);
6468 }
6469 }
6470 }
6471 vty_out (vty, "%s", VTY_NEWLINE);
6472}
6473
6474void
6475show_ip_ospf_route_external (struct vty *vty, struct route_table *rt)
6476{
6477 struct route_node *rn;
6478 struct ospf_route *er;
6479 listnode pnode;
6480 struct ospf_path *path;
6481
6482 vty_out (vty, "============ OSPF external routing table ===========%s",
6483 VTY_NEWLINE);
6484 for (rn = route_top (rt); rn; rn = route_next (rn))
6485 if ((er = rn->info) != NULL)
6486 {
6487 char buf1[19];
6488 snprintf (buf1, 19, "%s/%d",
6489 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
6490
6491 switch (er->path_type)
6492 {
6493 case OSPF_PATH_TYPE1_EXTERNAL:
6494 vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
6495 er->cost, er->u.ext.tag, VTY_NEWLINE);
6496 break;
6497 case OSPF_PATH_TYPE2_EXTERNAL:
6498 vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
6499 er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
6500 break;
6501 }
6502
6503 for (pnode = listhead (er->path); pnode; nextnode (pnode))
6504 {
6505 path = getdata (pnode);
6506 if (path->oi != NULL)
6507 {
6508 if (path->nexthop.s_addr == 0)
6509 vty_out (vty, "%24s directly attached to %s%s",
6510 "", path->oi->ifp->name, VTY_NEWLINE);
6511 else
6512 vty_out (vty, "%24s via %s, %s%s", "",
6513 inet_ntoa (path->nexthop), path->oi->ifp->name,
6514 VTY_NEWLINE);
6515 }
6516 }
6517 }
6518 vty_out (vty, "%s", VTY_NEWLINE);
6519}
6520
6521#ifdef HAVE_NSSA
6522DEFUN (show_ip_ospf_border_routers,
6523 show_ip_ospf_border_routers_cmd,
6524 "show ip ospf border-routers",
6525 SHOW_STR
6526 IP_STR
6527 "show all the ABR's and ASBR's\n"
6528 "for this area\n")
6529{
paul68980082003-03-25 05:07:42 +00006530 struct ospf *ospf = ospf_top;
6531
6532 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00006533 {
6534 vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
6535 return CMD_SUCCESS;
6536 }
6537
paul68980082003-03-25 05:07:42 +00006538 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00006539 {
6540 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
6541 return CMD_SUCCESS;
6542 }
6543
6544 /* Show Network routes.
6545 show_ip_ospf_route_network (vty, ospf_top->new_table); */
6546
6547 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00006548 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00006549
6550 return CMD_SUCCESS;
6551}
6552#endif /* HAVE_NSSA */
6553
6554DEFUN (show_ip_ospf_route,
6555 show_ip_ospf_route_cmd,
6556 "show ip ospf route",
6557 SHOW_STR
6558 IP_STR
6559 "OSPF information\n"
6560 "OSPF routing table\n")
6561{
paul68980082003-03-25 05:07:42 +00006562 struct ospf *ospf = ospf_top;
6563
6564 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00006565 {
6566 vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
6567 return CMD_SUCCESS;
6568 }
6569
paul68980082003-03-25 05:07:42 +00006570 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00006571 {
6572 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
6573 return CMD_SUCCESS;
6574 }
6575
6576 /* Show Network routes. */
paul68980082003-03-25 05:07:42 +00006577 show_ip_ospf_route_network (vty, ospf->new_table);
paul718e3742002-12-13 20:15:29 +00006578
6579 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00006580 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00006581
6582 /* Show AS External routes. */
paul68980082003-03-25 05:07:42 +00006583 show_ip_ospf_route_external (vty, ospf->old_external_route);
paul718e3742002-12-13 20:15:29 +00006584
6585 return CMD_SUCCESS;
6586}
6587
6588
6589char *ospf_abr_type_str[] =
6590{
6591 "unknown",
6592 "standard",
6593 "ibm",
6594 "cisco",
6595 "shortcut"
6596};
6597
6598char *ospf_shortcut_mode_str[] =
6599{
6600 "default",
6601 "enable",
6602 "disable"
6603};
6604
6605
6606void
6607area_id2str (char *buf, int length, struct ospf_area *area)
6608{
6609 memset (buf, 0, length);
6610
6611 if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS)
6612 strncpy (buf, inet_ntoa (area->area_id), length);
6613 else
6614 sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));
6615}
6616
6617
6618char *ospf_int_type_str[] =
6619{
6620 "unknown", /* should never be used. */
6621 "point-to-point",
6622 "broadcast",
6623 "non-broadcast",
6624 "point-to-multipoint",
6625 "virtual-link", /* should never be used. */
6626 "loopback"
6627};
6628
6629/* Configuration write function for ospfd. */
6630int
6631config_write_interface (struct vty *vty)
6632{
6633 listnode n1, n2;
6634 struct interface *ifp;
6635 struct crypt_key *ck;
6636 int write = 0;
6637 struct route_node *rn = NULL;
6638 struct ospf_if_params *params;
6639
6640 for (n1 = listhead (iflist); n1; nextnode (n1))
6641 {
6642 ifp = getdata (n1);
6643
6644 if (memcmp (ifp->name, "VLINK", 5) == 0)
6645 continue;
6646
6647 vty_out (vty, "!%s", VTY_NEWLINE);
6648 vty_out (vty, "interface %s%s", ifp->name,
6649 VTY_NEWLINE);
6650 if (ifp->desc)
6651 vty_out (vty, " description %s%s", ifp->desc,
6652 VTY_NEWLINE);
6653
6654 write++;
6655
6656 params = IF_DEF_PARAMS (ifp);
6657
6658 do {
6659 /* Interface Network print. */
6660 if (OSPF_IF_PARAM_CONFIGURED (params, type) &&
6661 params->type != OSPF_IFTYPE_BROADCAST &&
6662 params->type != OSPF_IFTYPE_LOOPBACK)
6663 {
6664 vty_out (vty, " ip ospf network %s",
6665 ospf_int_type_str[params->type]);
6666 if (params != IF_DEF_PARAMS (ifp))
6667 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6668 vty_out (vty, "%s", VTY_NEWLINE);
6669 }
6670
6671 /* OSPF interface authentication print */
6672 if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) &&
6673 params->auth_type != OSPF_AUTH_NOTSET)
6674 {
6675 char *auth_str;
6676
6677 /* Translation tables are not that much help here due to syntax
6678 of the simple option */
6679 switch (params->auth_type)
6680 {
6681
6682 case OSPF_AUTH_NULL:
6683 auth_str = " null";
6684 break;
6685
6686 case OSPF_AUTH_SIMPLE:
6687 auth_str = "";
6688 break;
6689
6690 case OSPF_AUTH_CRYPTOGRAPHIC:
6691 auth_str = " message-digest";
6692 break;
6693
6694 default:
6695 auth_str = "";
6696 break;
6697 }
6698
6699 vty_out (vty, " ip ospf authentication%s", auth_str);
6700 if (params != IF_DEF_PARAMS (ifp))
6701 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6702 vty_out (vty, "%s", VTY_NEWLINE);
6703 }
6704
6705 /* Simple Authentication Password print. */
6706 if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) &&
6707 params->auth_simple[0] != '\0')
6708 {
6709 vty_out (vty, " ip ospf authentication-key %s",
6710 params->auth_simple);
6711 if (params != IF_DEF_PARAMS (ifp))
6712 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6713 vty_out (vty, "%s", VTY_NEWLINE);
6714 }
6715
6716 /* Cryptographic Authentication Key print. */
6717 for (n2 = listhead (params->auth_crypt); n2; nextnode (n2))
6718 {
6719 ck = getdata (n2);
6720 vty_out (vty, " ip ospf message-digest-key %d md5 %s",
6721 ck->key_id, ck->auth_key);
6722 if (params != IF_DEF_PARAMS (ifp))
6723 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6724 vty_out (vty, "%s", VTY_NEWLINE);
6725 }
6726
6727 /* Interface Output Cost print. */
6728 if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd))
6729 {
6730 vty_out (vty, " ip ospf cost %u", params->output_cost_cmd);
6731 if (params != IF_DEF_PARAMS (ifp))
6732 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6733 vty_out (vty, "%s", VTY_NEWLINE);
6734 }
6735
6736 /* Hello Interval print. */
6737 if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) &&
6738 params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT)
6739 {
6740 vty_out (vty, " ip ospf hello-interval %u", params->v_hello);
6741 if (params != IF_DEF_PARAMS (ifp))
6742 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6743 vty_out (vty, "%s", VTY_NEWLINE);
6744 }
6745
6746
6747 /* Router Dead Interval print. */
6748 if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
6749 params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
6750 {
6751 vty_out (vty, " ip ospf dead-interval %u", params->v_wait);
6752 if (params != IF_DEF_PARAMS (ifp))
6753 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6754 vty_out (vty, "%s", VTY_NEWLINE);
6755 }
6756
6757 /* Router Priority print. */
6758 if (OSPF_IF_PARAM_CONFIGURED (params, priority) &&
6759 params->priority != OSPF_ROUTER_PRIORITY_DEFAULT)
6760 {
6761 vty_out (vty, " ip ospf priority %u", params->priority);
6762 if (params != IF_DEF_PARAMS (ifp))
6763 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6764 vty_out (vty, "%s", VTY_NEWLINE);
6765 }
6766
6767 /* Retransmit Interval print. */
6768 if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) &&
6769 params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT)
6770 {
6771 vty_out (vty, " ip ospf retransmit-interval %u",
6772 params->retransmit_interval);
6773 if (params != IF_DEF_PARAMS (ifp))
6774 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6775 vty_out (vty, "%s", VTY_NEWLINE);
6776 }
6777
6778 /* Transmit Delay print. */
6779 if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) &&
6780 params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT)
6781 {
6782 vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay);
6783 if (params != IF_DEF_PARAMS (ifp))
6784 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6785 vty_out (vty, "%s", VTY_NEWLINE);
6786 }
6787
6788 while (1)
6789 {
6790 if (rn == NULL)
6791 rn = route_top (IF_OIFS_PARAMS (ifp));
6792 else
6793 rn = route_next (rn);
6794
6795 if (rn == NULL)
6796 break;
6797 params = rn->info;
6798 if (params != NULL)
6799 break;
6800 }
6801 } while (rn);
6802
6803#ifdef HAVE_OPAQUE_LSA
6804 ospf_opaque_config_write_if (vty, ifp);
6805#endif /* HAVE_OPAQUE_LSA */
6806 }
6807
6808 return write;
6809}
6810
6811int
paul68980082003-03-25 05:07:42 +00006812config_write_network_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006813{
6814 struct route_node *rn;
6815 u_char buf[INET_ADDRSTRLEN];
6816
6817 /* `network area' print. */
paul68980082003-03-25 05:07:42 +00006818 for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00006819 if (rn->info)
6820 {
6821 struct ospf_network *n = rn->info;
6822
6823 memset (buf, 0, INET_ADDRSTRLEN);
6824
6825 /* Create Area ID string by specified Area ID format. */
6826 if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS)
6827 strncpy (buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN);
6828 else
6829 sprintf (buf, "%lu",
6830 (unsigned long int) ntohl (n->area_id.s_addr));
6831
6832 /* Network print. */
6833 vty_out (vty, " network %s/%d area %s%s",
6834 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
6835 buf, VTY_NEWLINE);
6836 }
6837
6838 return 0;
6839}
6840
6841int
paul68980082003-03-25 05:07:42 +00006842config_write_ospf_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006843{
6844 listnode node;
6845 u_char buf[INET_ADDRSTRLEN];
6846
6847 /* Area configuration print. */
paul68980082003-03-25 05:07:42 +00006848 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00006849 {
6850 struct ospf_area *area = getdata (node);
6851 struct route_node *rn1;
6852
6853 area_id2str (buf, INET_ADDRSTRLEN, area);
6854
6855 if (area->auth_type != OSPF_AUTH_NULL)
6856 {
6857 if (area->auth_type == OSPF_AUTH_SIMPLE)
6858 vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE);
6859 else
6860 vty_out (vty, " area %s authentication message-digest%s",
6861 buf, VTY_NEWLINE);
6862 }
6863
6864 if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT)
6865 vty_out (vty, " area %s shortcut %s%s", buf,
6866 ospf_shortcut_mode_str[area->shortcut_configured],
6867 VTY_NEWLINE);
6868
6869 if ((area->external_routing == OSPF_AREA_STUB)
6870#ifdef HAVE_NSSA
6871 || (area->external_routing == OSPF_AREA_NSSA)
6872#endif /* HAVE_NSSA */
6873 )
6874 {
6875#ifdef HAVE_NSSA
6876 if (area->external_routing == OSPF_AREA_NSSA)
6877 vty_out (vty, " area %s nssa", buf);
6878 else
6879#endif /* HAVE_NSSA */
6880 vty_out (vty, " area %s stub", buf);
6881
6882 if (area->no_summary)
6883 vty_out (vty, " no-summary");
6884
6885 vty_out (vty, "%s", VTY_NEWLINE);
6886
6887 if (area->default_cost != 1)
6888 vty_out (vty, " area %s default-cost %d%s", buf,
6889 area->default_cost, VTY_NEWLINE);
6890 }
6891
6892 for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1))
6893 if (rn1->info)
6894 {
6895 struct ospf_area_range *range = rn1->info;
6896
6897 vty_out (vty, " area %s range %s/%d", buf,
6898 inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen);
6899
6900 if (range->cost_config != -1)
6901 vty_out (vty, " cost %d", range->cost_config);
6902
6903 if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
6904 vty_out (vty, " not-advertise");
6905
6906 if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE))
6907 vty_out (vty, " substitute %s/%d",
6908 inet_ntoa (range->subst_addr), range->subst_masklen);
6909
6910 vty_out (vty, "%s", VTY_NEWLINE);
6911 }
6912
6913 if (EXPORT_NAME (area))
6914 vty_out (vty, " area %s export-list %s%s", buf,
6915 EXPORT_NAME (area), VTY_NEWLINE);
6916
6917 if (IMPORT_NAME (area))
6918 vty_out (vty, " area %s import-list %s%s", buf,
6919 IMPORT_NAME (area), VTY_NEWLINE);
6920
6921 if (PREFIX_NAME_IN (area))
6922 vty_out (vty, " area %s filter-list prefix %s in%s", buf,
6923 PREFIX_NAME_IN (area), VTY_NEWLINE);
6924
6925 if (PREFIX_NAME_OUT (area))
6926 vty_out (vty, " area %s filter-list prefix %s out%s", buf,
6927 PREFIX_NAME_OUT (area), VTY_NEWLINE);
6928 }
6929
6930 return 0;
6931}
6932
6933int
paul68980082003-03-25 05:07:42 +00006934config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006935{
6936 struct ospf_nbr_nbma *nbr_nbma;
6937 struct route_node *rn;
6938
6939 /* Static Neighbor configuration print. */
paul68980082003-03-25 05:07:42 +00006940 for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00006941 if ((nbr_nbma = rn->info))
6942 {
6943 vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr));
6944
6945 if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT)
6946 vty_out (vty, " priority %d", nbr_nbma->priority);
6947
6948 if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
6949 vty_out (vty, " poll-interval %d", nbr_nbma->v_poll);
6950
6951 vty_out (vty, "%s", VTY_NEWLINE);
6952 }
6953
6954 return 0;
6955}
6956
6957int
paul68980082003-03-25 05:07:42 +00006958config_write_virtual_link (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006959{
6960 listnode node;
6961 u_char buf[INET_ADDRSTRLEN];
6962
6963 /* Virtual-Link print */
paul68980082003-03-25 05:07:42 +00006964 for (node = listhead (ospf->vlinks); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00006965 {
6966 listnode n2;
6967 struct crypt_key *ck;
6968 struct ospf_vl_data *vl_data = getdata (node);
6969 struct ospf_interface *oi;
6970
6971 if (vl_data != NULL)
6972 {
6973 memset (buf, 0, INET_ADDRSTRLEN);
6974
6975 if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS)
6976 strncpy (buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN);
6977 else
6978 sprintf (buf, "%lu",
6979 (unsigned long int) ntohl (vl_data->vl_area_id.s_addr));
6980 oi = vl_data->vl_oi;
6981
6982 /* timers */
6983 if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT ||
6984 OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT ||
6985 OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT ||
6986 OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT)
6987 vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
6988 buf,
6989 inet_ntoa (vl_data->vl_peer),
6990 OSPF_IF_PARAM (oi, v_hello),
6991 OSPF_IF_PARAM (oi, retransmit_interval),
6992 OSPF_IF_PARAM (oi, transmit_delay),
6993 OSPF_IF_PARAM (oi, v_wait),
6994 VTY_NEWLINE);
6995 else
6996 vty_out (vty, " area %s virtual-link %s%s", buf,
6997 inet_ntoa (vl_data->vl_peer), VTY_NEWLINE);
6998 /* Auth key */
6999 if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0')
7000 vty_out (vty, " area %s virtual-link %s authentication-key %s%s",
7001 buf,
7002 inet_ntoa (vl_data->vl_peer),
7003 IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple,
7004 VTY_NEWLINE);
7005 /* md5 keys */
7006 for (n2 = listhead (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt); n2; nextnode (n2))
7007 {
7008 ck = getdata (n2);
7009 vty_out (vty, " area %s virtual-link %s message-digest-key %d md5 %s%s",
7010 buf,
7011 inet_ntoa (vl_data->vl_peer),
7012 ck->key_id, ck->auth_key, VTY_NEWLINE);
7013 }
7014
7015 }
7016 }
7017
7018 return 0;
7019}
7020
7021
7022char *distribute_str[] = { "system", "kernel", "connected", "static", "rip",
7023 "ripng", "ospf", "ospf6", "bgp"};
7024int
paul68980082003-03-25 05:07:42 +00007025config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007026{
7027 int type;
7028
7029 /* redistribute print. */
7030 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
7031 if (type != zclient->redist_default && zclient->redist[type])
7032 {
7033 vty_out (vty, " redistribute %s", distribute_str[type]);
paul68980082003-03-25 05:07:42 +00007034 if (ospf->dmetric[type].value >= 0)
paul718e3742002-12-13 20:15:29 +00007035 vty_out (vty, " metric %d", ospf_top->dmetric[type].value);
7036
paul68980082003-03-25 05:07:42 +00007037 if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007038 vty_out (vty, " metric-type 1");
7039
7040 if (ROUTEMAP_NAME (type))
7041 vty_out (vty, " route-map %s", ROUTEMAP_NAME (type));
7042
7043 vty_out (vty, "%s", VTY_NEWLINE);
7044 }
7045
7046 return 0;
7047}
7048
7049int
paul68980082003-03-25 05:07:42 +00007050config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007051{
paul68980082003-03-25 05:07:42 +00007052 if (ospf->default_metric != -1)
7053 vty_out (vty, " default-metric %d%s", ospf->default_metric,
paul718e3742002-12-13 20:15:29 +00007054 VTY_NEWLINE);
7055 return 0;
7056}
7057
7058int
paul68980082003-03-25 05:07:42 +00007059config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007060{
7061 int type;
7062
paul68980082003-03-25 05:07:42 +00007063 if (ospf)
paul718e3742002-12-13 20:15:29 +00007064 {
7065 /* distribute-list print. */
7066 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
paul68980082003-03-25 05:07:42 +00007067 if (ospf->dlist[type].name)
paul718e3742002-12-13 20:15:29 +00007068 vty_out (vty, " distribute-list %s out %s%s",
paul68980082003-03-25 05:07:42 +00007069 ospf->dlist[type].name,
paul718e3742002-12-13 20:15:29 +00007070 distribute_str[type], VTY_NEWLINE);
7071
7072 /* default-information print. */
paul68980082003-03-25 05:07:42 +00007073 if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
paul718e3742002-12-13 20:15:29 +00007074 {
paul68980082003-03-25 05:07:42 +00007075 if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA)
paul718e3742002-12-13 20:15:29 +00007076 vty_out (vty, " default-information originate");
7077 else
7078 vty_out (vty, " default-information originate always");
7079
paul68980082003-03-25 05:07:42 +00007080 if (ospf->dmetric[DEFAULT_ROUTE].value >= 0)
paul718e3742002-12-13 20:15:29 +00007081 vty_out (vty, " metric %d",
paul68980082003-03-25 05:07:42 +00007082 ospf->dmetric[DEFAULT_ROUTE].value);
7083 if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007084 vty_out (vty, " metric-type 1");
7085
7086 if (ROUTEMAP_NAME (DEFAULT_ROUTE))
7087 vty_out (vty, " route-map %s", ROUTEMAP_NAME (DEFAULT_ROUTE));
7088
7089 vty_out (vty, "%s", VTY_NEWLINE);
7090 }
7091
7092 }
7093
7094 return 0;
7095}
7096
7097int
paul68980082003-03-25 05:07:42 +00007098config_write_ospf_distance (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007099{
7100 struct route_node *rn;
7101 struct ospf_distance *odistance;
7102
paul68980082003-03-25 05:07:42 +00007103 if (ospf->distance_all)
7104 vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007105
paul68980082003-03-25 05:07:42 +00007106 if (ospf->distance_intra
7107 || ospf->distance_inter
7108 || ospf->distance_external)
paul718e3742002-12-13 20:15:29 +00007109 {
7110 vty_out (vty, " distance ospf");
7111
paul68980082003-03-25 05:07:42 +00007112 if (ospf->distance_intra)
7113 vty_out (vty, " intra-area %d", ospf->distance_intra);
7114 if (ospf->distance_inter)
7115 vty_out (vty, " inter-area %d", ospf->distance_inter);
7116 if (ospf->distance_external)
7117 vty_out (vty, " external %d", ospf->distance_external);
paul718e3742002-12-13 20:15:29 +00007118
7119 vty_out (vty, "%s", VTY_NEWLINE);
7120 }
7121
paul68980082003-03-25 05:07:42 +00007122 for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007123 if ((odistance = rn->info) != NULL)
7124 {
7125 vty_out (vty, " distance %d %s/%d %s%s", odistance->distance,
7126 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
7127 odistance->access_list ? odistance->access_list : "",
7128 VTY_NEWLINE);
7129 }
7130 return 0;
7131}
7132
7133/* OSPF configuration write function. */
7134int
7135ospf_config_write (struct vty *vty)
7136{
paul68980082003-03-25 05:07:42 +00007137 struct ospf *ospf = ospf_top;
paul718e3742002-12-13 20:15:29 +00007138 listnode node;
7139 int write = 0;
7140
paul68980082003-03-25 05:07:42 +00007141 if (ospf != NULL)
paul718e3742002-12-13 20:15:29 +00007142 {
7143 /* `router ospf' print. */
7144 vty_out (vty, "router ospf%s", VTY_NEWLINE);
7145
7146 write++;
7147
paul68980082003-03-25 05:07:42 +00007148 if (!ospf->networks)
paul718e3742002-12-13 20:15:29 +00007149 return write;
7150
7151 /* Router ID print. */
paul68980082003-03-25 05:07:42 +00007152 if (ospf->router_id_static.s_addr != 0)
paul718e3742002-12-13 20:15:29 +00007153 vty_out (vty, " ospf router-id %s%s",
paul68980082003-03-25 05:07:42 +00007154 inet_ntoa (ospf->router_id_static), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007155
7156 /* ABR type print. */
paul68980082003-03-25 05:07:42 +00007157 if (ospf->abr_type != OSPF_ABR_STAND)
paul718e3742002-12-13 20:15:29 +00007158 vty_out (vty, " ospf abr-type %s%s",
paul68980082003-03-25 05:07:42 +00007159 ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007160
7161 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
paul68980082003-03-25 05:07:42 +00007162 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
paul718e3742002-12-13 20:15:29 +00007163 vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE);
7164
7165 /* auto-cost reference-bandwidth configuration. */
paul68980082003-03-25 05:07:42 +00007166 if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00007167 vty_out (vty, " auto-cost reference-bandwidth %d%s",
paul68980082003-03-25 05:07:42 +00007168 ospf->ref_bandwidth / 1000, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007169
7170 /* SPF timers print. */
paul68980082003-03-25 05:07:42 +00007171 if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
7172 ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007173 vty_out (vty, " timers spf %d %d%s",
paul68980082003-03-25 05:07:42 +00007174 ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007175
7176 /* SPF refresh parameters print. */
paul68980082003-03-25 05:07:42 +00007177 if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007178 vty_out (vty, " refresh timer %d%s",
paul68980082003-03-25 05:07:42 +00007179 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007180
7181 /* Redistribute information print. */
paul68980082003-03-25 05:07:42 +00007182 config_write_ospf_redistribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007183
7184 /* passive-interface print. */
paul68980082003-03-25 05:07:42 +00007185 for (node = listhead (ospf->iflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00007186 {
7187 struct interface *ifp = getdata (node);
7188
7189 if (!ifp)
7190 continue;
7191 if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE)
7192 vty_out (vty, " passive-interface %s%s",
7193 ifp->name, VTY_NEWLINE);
7194 }
7195
paul68980082003-03-25 05:07:42 +00007196 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00007197 {
7198 struct ospf_interface *oi = getdata (node);
7199
7200 if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) &&
7201 oi->params->passive_interface == OSPF_IF_PASSIVE)
7202 vty_out (vty, " passive-interface %s%s",
7203 inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
7204 }
7205
7206
7207 /* Network area print. */
paul68980082003-03-25 05:07:42 +00007208 config_write_network_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007209
7210 /* Area config print. */
paul68980082003-03-25 05:07:42 +00007211 config_write_ospf_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007212
7213 /* static neighbor print. */
paul68980082003-03-25 05:07:42 +00007214 config_write_ospf_nbr_nbma (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007215
7216 /* Virtual-Link print. */
paul68980082003-03-25 05:07:42 +00007217 config_write_virtual_link (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007218
7219 /* Default metric configuration. */
paul68980082003-03-25 05:07:42 +00007220 config_write_ospf_default_metric (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007221
7222 /* Distribute-list and default-information print. */
paul68980082003-03-25 05:07:42 +00007223 config_write_ospf_distribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007224
7225 /* Distance configuration. */
paul68980082003-03-25 05:07:42 +00007226 config_write_ospf_distance (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007227
7228#ifdef HAVE_OPAQUE_LSA
paul68980082003-03-25 05:07:42 +00007229 ospf_opaque_config_write_router (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007230#endif /* HAVE_OPAQUE_LSA */
7231 }
7232
7233 return write;
7234}
7235
7236void
7237ospf_vty_show_init ()
7238{
7239 /* "show ip ospf" commands. */
7240 install_element (VIEW_NODE, &show_ip_ospf_cmd);
7241 install_element (ENABLE_NODE, &show_ip_ospf_cmd);
7242
7243 /* "show ip ospf database" commands. */
7244 install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd);
7245 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd);
7246 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
7247 install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
7248 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd);
7249 install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd);
7250 install_element (VIEW_NODE, &show_ip_ospf_database_cmd);
7251 install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd);
7252 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd);
7253 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
7254 install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd);
7255 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd);
7256 install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd);
7257 install_element (ENABLE_NODE, &show_ip_ospf_database_cmd);
7258
7259 /* "show ip ospf interface" commands. */
7260 install_element (VIEW_NODE, &show_ip_ospf_interface_cmd);
7261 install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd);
7262
7263 /* "show ip ospf neighbor" commands. */
7264 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
7265 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd);
7266 install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd);
7267 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
7268 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd);
7269 install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd);
7270 install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd);
7271 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
7272 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd);
7273 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd);
7274 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
7275 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd);
7276 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd);
7277 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd);
7278
7279 /* "show ip ospf route" commands. */
7280 install_element (VIEW_NODE, &show_ip_ospf_route_cmd);
7281 install_element (ENABLE_NODE, &show_ip_ospf_route_cmd);
7282#ifdef HAVE_NSSA
7283 install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd);
7284 install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
7285#endif /* HAVE_NSSA */
7286}
7287
7288
7289/* ospfd's interface node. */
7290struct cmd_node interface_node =
7291{
7292 INTERFACE_NODE,
7293 "%s(config-if)# ",
7294 1
7295};
7296
7297/* Initialization of OSPF interface. */
7298void
7299ospf_vty_if_init ()
7300{
7301 /* Install interface node. */
7302 install_node (&interface_node, config_write_interface);
7303
7304 install_element (CONFIG_NODE, &interface_cmd);
7305 install_default (INTERFACE_NODE);
7306
7307 /* "description" commands. */
7308 install_element (INTERFACE_NODE, &interface_desc_cmd);
7309 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
7310
7311 /* "ip ospf authentication" commands. */
7312 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
7313 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd);
7314 install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd);
7315 install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd);
7316 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd);
7317 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd);
7318 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd);
7319 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd);
7320 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd);
7321 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd);
7322
7323 /* "ip ospf message-digest-key" commands. */
7324 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
7325 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
7326 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
7327 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
7328
7329 /* "ip ospf cost" commands. */
7330 install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd);
7331 install_element (INTERFACE_NODE, &ip_ospf_cost_cmd);
7332 install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd);
7333 install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
7334
7335 /* "ip ospf dead-interval" commands. */
7336 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
7337 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
7338 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
7339 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
7340
7341 /* "ip ospf hello-interval" commands. */
7342 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
7343 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
7344 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
7345 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
7346
7347 /* "ip ospf network" commands. */
7348 install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
7349 install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
7350
7351 /* "ip ospf priority" commands. */
7352 install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
7353 install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
7354 install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
7355 install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
7356
7357 /* "ip ospf retransmit-interval" commands. */
7358 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
7359 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd);
7360 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
7361 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd);
7362
7363 /* "ip ospf transmit-delay" commands. */
7364 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
7365 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd);
7366 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
7367 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd);
7368
7369 /* These commands are compatibitliy for previous version. */
7370 install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
7371 install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);
7372 install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
7373 install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
7374 install_element (INTERFACE_NODE, &ospf_cost_cmd);
7375 install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
7376 install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
7377 install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
7378 install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
7379 install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
7380 install_element (INTERFACE_NODE, &ospf_network_cmd);
7381 install_element (INTERFACE_NODE, &no_ospf_network_cmd);
7382 install_element (INTERFACE_NODE, &ospf_priority_cmd);
7383 install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
7384 install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
7385 install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
7386 install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
7387 install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
7388}
7389
7390/* Zebra node structure. */
7391struct cmd_node zebra_node =
7392{
7393 ZEBRA_NODE,
7394 "%s(config-router)#",
7395};
7396
7397void
7398ospf_vty_zebra_init ()
7399{
7400 install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd);
7401 install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd);
7402 install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd);
7403 install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd);
7404 install_element (OSPF_NODE, &ospf_redistribute_source_cmd);
7405 install_element (OSPF_NODE,
7406 &ospf_redistribute_source_metric_type_routemap_cmd);
7407 install_element (OSPF_NODE,
7408 &ospf_redistribute_source_type_metric_routemap_cmd);
7409 install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd);
7410 install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd);
7411 install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd);
7412
7413 install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);
7414
7415 install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);
7416 install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);
7417
7418 install_element (OSPF_NODE,
7419 &ospf_default_information_originate_metric_type_cmd);
7420 install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd);
7421 install_element (OSPF_NODE,
7422 &ospf_default_information_originate_type_metric_cmd);
7423 install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd);
7424 install_element (OSPF_NODE, &ospf_default_information_originate_cmd);
7425 install_element (OSPF_NODE,
7426 &ospf_default_information_originate_always_metric_type_cmd);
7427 install_element (OSPF_NODE,
7428 &ospf_default_information_originate_always_metric_cmd);
7429 install_element (OSPF_NODE,
7430 &ospf_default_information_originate_always_cmd);
7431 install_element (OSPF_NODE,
7432 &ospf_default_information_originate_always_type_metric_cmd);
7433 install_element (OSPF_NODE,
7434 &ospf_default_information_originate_always_type_cmd);
7435
7436 install_element (OSPF_NODE,
7437 &ospf_default_information_originate_metric_type_routemap_cmd);
7438 install_element (OSPF_NODE,
7439 &ospf_default_information_originate_metric_routemap_cmd);
7440 install_element (OSPF_NODE,
7441 &ospf_default_information_originate_routemap_cmd);
7442 install_element (OSPF_NODE,
7443 &ospf_default_information_originate_type_metric_routemap_cmd);
7444 install_element (OSPF_NODE,
7445 &ospf_default_information_originate_type_routemap_cmd);
7446 install_element (OSPF_NODE,
7447 &ospf_default_information_originate_always_metric_type_routemap_cmd);
7448 install_element (OSPF_NODE,
7449 &ospf_default_information_originate_always_metric_routemap_cmd);
7450 install_element (OSPF_NODE,
7451 &ospf_default_information_originate_always_routemap_cmd);
7452 install_element (OSPF_NODE,
7453 &ospf_default_information_originate_always_type_metric_routemap_cmd);
7454 install_element (OSPF_NODE,
7455 &ospf_default_information_originate_always_type_routemap_cmd);
7456
7457 install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);
7458
7459 install_element (OSPF_NODE, &ospf_default_metric_cmd);
7460 install_element (OSPF_NODE, &no_ospf_default_metric_cmd);
7461 install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd);
7462
7463 install_element (OSPF_NODE, &ospf_distance_cmd);
7464 install_element (OSPF_NODE, &no_ospf_distance_cmd);
7465 install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);
7466 install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd);
7467 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd);
7468 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd);
7469 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd);
7470 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd);
7471 install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd);
7472 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd);
7473 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd);
7474 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd);
7475 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd);
7476 install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd);
7477 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd);
7478 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd);
7479 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd);
7480 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd);
7481#if 0
7482 install_element (OSPF_NODE, &ospf_distance_source_cmd);
7483 install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
7484 install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd);
7485 install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd);
7486#endif /* 0 */
7487}
7488
7489struct cmd_node ospf_node =
7490{
7491 OSPF_NODE,
7492 "%s(config-router)# ",
7493 1
7494};
7495
7496
7497/* Install OSPF related vty commands. */
7498void
7499ospf_vty_init ()
7500{
7501 /* Install ospf top node. */
7502 install_node (&ospf_node, ospf_config_write);
7503
7504 /* "router ospf" commands. */
7505 install_element (CONFIG_NODE, &router_ospf_cmd);
7506 install_element (CONFIG_NODE, &no_router_ospf_cmd);
7507
7508 install_default (OSPF_NODE);
7509
7510 /* "ospf router-id" commands. */
7511 install_element (OSPF_NODE, &ospf_router_id_cmd);
7512 install_element (OSPF_NODE, &no_ospf_router_id_cmd);
7513 install_element (OSPF_NODE, &router_id_cmd);
7514 install_element (OSPF_NODE, &no_router_id_cmd);
7515
7516 /* "passive-interface" commands. */
7517 install_element (OSPF_NODE, &passive_interface_addr_cmd);
7518 install_element (OSPF_NODE, &passive_interface_cmd);
7519 install_element (OSPF_NODE, &no_passive_interface_addr_cmd);
7520 install_element (OSPF_NODE, &no_passive_interface_cmd);
7521
7522 /* "ospf abr-type" commands. */
7523 install_element (OSPF_NODE, &ospf_abr_type_cmd);
7524 install_element (OSPF_NODE, &no_ospf_abr_type_cmd);
7525
7526 /* "ospf rfc1583-compatible" commands. */
7527 install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd);
7528 install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd);
7529 install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd);
7530 install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd);
7531
7532 /* "network area" commands. */
7533 install_element (OSPF_NODE, &network_area_cmd);
7534 install_element (OSPF_NODE, &no_network_area_cmd);
7535
7536 /* "area authentication" commands. */
7537 install_element (OSPF_NODE, &area_authentication_message_digest_cmd);
7538 install_element (OSPF_NODE, &area_authentication_cmd);
7539 install_element (OSPF_NODE, &no_area_authentication_cmd);
7540
7541 /* "area range" commands. */
7542 install_element (OSPF_NODE, &area_range_cmd);
7543 install_element (OSPF_NODE, &area_range_advertise_cmd);
7544 install_element (OSPF_NODE, &area_range_cost_cmd);
7545 install_element (OSPF_NODE, &area_range_advertise_cost_cmd);
7546 install_element (OSPF_NODE, &area_range_not_advertise_cmd);
7547 install_element (OSPF_NODE, &no_area_range_cmd);
7548 install_element (OSPF_NODE, &no_area_range_advertise_cmd);
7549 install_element (OSPF_NODE, &no_area_range_cost_cmd);
7550 install_element (OSPF_NODE, &no_area_range_advertise_cost_cmd);
7551 install_element (OSPF_NODE, &area_range_substitute_cmd);
7552 install_element (OSPF_NODE, &no_area_range_substitute_cmd);
7553
7554 /* "area virtual-link" commands. */
7555 install_element (OSPF_NODE, &area_vlink_cmd);
7556 install_element (OSPF_NODE, &no_area_vlink_cmd);
7557
7558 install_element (OSPF_NODE, &area_vlink_param1_cmd);
7559 install_element (OSPF_NODE, &no_area_vlink_param1_cmd);
7560
7561 install_element (OSPF_NODE, &area_vlink_param2_cmd);
7562 install_element (OSPF_NODE, &no_area_vlink_param2_cmd);
7563
7564 install_element (OSPF_NODE, &area_vlink_param3_cmd);
7565 install_element (OSPF_NODE, &no_area_vlink_param3_cmd);
7566
7567 install_element (OSPF_NODE, &area_vlink_param4_cmd);
7568 install_element (OSPF_NODE, &no_area_vlink_param4_cmd);
7569
7570 install_element (OSPF_NODE, &area_vlink_authtype_args_cmd);
7571 install_element (OSPF_NODE, &area_vlink_authtype_cmd);
7572 install_element (OSPF_NODE, &no_area_vlink_authtype_cmd);
7573
7574 install_element (OSPF_NODE, &area_vlink_md5_cmd);
7575 install_element (OSPF_NODE, &no_area_vlink_md5_cmd);
7576
7577 install_element (OSPF_NODE, &area_vlink_authkey_cmd);
7578 install_element (OSPF_NODE, &no_area_vlink_authkey_cmd);
7579
7580 install_element (OSPF_NODE, &area_vlink_authtype_args_authkey_cmd);
7581 install_element (OSPF_NODE, &area_vlink_authtype_authkey_cmd);
7582 install_element (OSPF_NODE, &no_area_vlink_authtype_authkey_cmd);
7583
7584 install_element (OSPF_NODE, &area_vlink_authtype_args_md5_cmd);
7585 install_element (OSPF_NODE, &area_vlink_authtype_md5_cmd);
7586 install_element (OSPF_NODE, &no_area_vlink_authtype_md5_cmd);
7587
7588 /* "area stub" commands. */
7589 install_element (OSPF_NODE, &area_stub_no_summary_cmd);
7590 install_element (OSPF_NODE, &area_stub_cmd);
7591 install_element (OSPF_NODE, &no_area_stub_no_summary_cmd);
7592 install_element (OSPF_NODE, &no_area_stub_cmd);
7593
7594#ifdef HAVE_NSSA
7595 /* "area nssa" commands. */
7596 install_element (OSPF_NODE, &area_nssa_cmd);
7597 install_element (OSPF_NODE, &area_nssa_translate_no_summary_cmd);
7598 install_element (OSPF_NODE, &area_nssa_translate_cmd);
7599 install_element (OSPF_NODE, &area_nssa_no_summary_cmd);
7600 install_element (OSPF_NODE, &no_area_nssa_cmd);
7601 install_element (OSPF_NODE, &no_area_nssa_no_summary_cmd);
7602#endif /* HAVE_NSSA */
7603
7604 install_element (OSPF_NODE, &area_default_cost_cmd);
7605 install_element (OSPF_NODE, &no_area_default_cost_cmd);
7606
7607 install_element (OSPF_NODE, &area_shortcut_cmd);
7608 install_element (OSPF_NODE, &no_area_shortcut_cmd);
7609
7610 install_element (OSPF_NODE, &area_export_list_cmd);
7611 install_element (OSPF_NODE, &no_area_export_list_cmd);
7612
7613 install_element (OSPF_NODE, &area_filter_list_cmd);
7614 install_element (OSPF_NODE, &no_area_filter_list_cmd);
7615
7616 install_element (OSPF_NODE, &area_import_list_cmd);
7617 install_element (OSPF_NODE, &no_area_import_list_cmd);
7618
7619 install_element (OSPF_NODE, &timers_spf_cmd);
7620 install_element (OSPF_NODE, &no_timers_spf_cmd);
7621
7622 install_element (OSPF_NODE, &refresh_timer_cmd);
7623 install_element (OSPF_NODE, &no_refresh_timer_val_cmd);
7624 install_element (OSPF_NODE, &no_refresh_timer_cmd);
7625
7626 install_element (OSPF_NODE, &auto_cost_reference_bandwidth_cmd);
7627 install_element (OSPF_NODE, &no_auto_cost_reference_bandwidth_cmd);
7628
7629 /* "neighbor" commands. */
7630 install_element (OSPF_NODE, &neighbor_cmd);
7631 install_element (OSPF_NODE, &neighbor_priority_poll_interval_cmd);
7632 install_element (OSPF_NODE, &neighbor_priority_cmd);
7633 install_element (OSPF_NODE, &neighbor_poll_interval_cmd);
7634 install_element (OSPF_NODE, &neighbor_poll_interval_priority_cmd);
7635 install_element (OSPF_NODE, &no_neighbor_cmd);
7636 install_element (OSPF_NODE, &no_neighbor_priority_cmd);
7637 install_element (OSPF_NODE, &no_neighbor_poll_interval_cmd);
7638
7639 /* Init interface related vty commands. */
7640 ospf_vty_if_init ();
7641
7642 /* Init zebra related vty commands. */
7643 ospf_vty_zebra_init ();
7644}
7645
paul68980082003-03-25 05:07:42 +00007646