blob: 482ef6fcd2604c7c2c98585257849357a732bcb3 [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{
paul020709f2003-04-04 02:44:16 +0000184 struct ospf *ospf;
185
186 ospf = ospf_lookup ();
187 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +0000188 {
paul020709f2003-04-04 02:44:16 +0000189 vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000190 return CMD_WARNING;
191 }
192
paul020709f2003-04-04 02:44:16 +0000193 ospf_finish (ospf);
paul718e3742002-12-13 20:15:29 +0000194
195 return CMD_SUCCESS;
196}
197
198DEFUN (ospf_router_id,
199 ospf_router_id_cmd,
200 "ospf router-id A.B.C.D",
201 "OSPF specific commands\n"
202 "router-id for the OSPF process\n"
203 "OSPF router-id in IP address format\n")
204{
paul68980082003-03-25 05:07:42 +0000205 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000206 struct in_addr router_id;
paul68980082003-03-25 05:07:42 +0000207 int ret;
paul718e3742002-12-13 20:15:29 +0000208
209 ret = inet_aton (argv[0], &router_id);
210 if (!ret)
211 {
212 vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
213 return CMD_WARNING;
214 }
215
paul68980082003-03-25 05:07:42 +0000216 ospf->router_id_static = router_id;
paul718e3742002-12-13 20:15:29 +0000217
paul68980082003-03-25 05:07:42 +0000218 if (ospf->t_router_id_update == NULL)
paul020709f2003-04-04 02:44:16 +0000219 OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer,
220 OSPF_ROUTER_ID_UPDATE_DELAY);
paul718e3742002-12-13 20:15:29 +0000221
222 return CMD_SUCCESS;
223}
224
225ALIAS (ospf_router_id,
paula2c62832003-04-23 17:01:31 +0000226 router_ospf_id_cmd,
paul718e3742002-12-13 20:15:29 +0000227 "router-id A.B.C.D",
228 "router-id for the OSPF process\n"
229 "OSPF router-id in IP address format\n")
230
231DEFUN (no_ospf_router_id,
232 no_ospf_router_id_cmd,
233 "no ospf router-id",
234 NO_STR
235 "OSPF specific commands\n"
236 "router-id for the OSPF process\n")
237{
paul68980082003-03-25 05:07:42 +0000238 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000239
paul68980082003-03-25 05:07:42 +0000240 ospf->router_id_static.s_addr = 0;
241
242 ospf_router_id_update (ospf);
paul718e3742002-12-13 20:15:29 +0000243
244 return CMD_SUCCESS;
245}
246
247ALIAS (no_ospf_router_id,
paula2c62832003-04-23 17:01:31 +0000248 no_router_ospf_id_cmd,
paul718e3742002-12-13 20:15:29 +0000249 "no router-id",
250 NO_STR
251 "router-id for the OSPF process\n")
252
paula2c62832003-04-23 17:01:31 +0000253DEFUN (ospf_passive_interface,
254 ospf_passive_interface_addr_cmd,
paul718e3742002-12-13 20:15:29 +0000255 "passive-interface IFNAME A.B.C.D",
256 "Suppress routing updates on an interface\n"
257 "Interface's name\n")
258{
259 struct interface *ifp;
260 struct in_addr addr;
261 int ret;
262 struct ospf_if_params *params;
263
264 ifp = if_lookup_by_name (argv[0]);
265
266 if (ifp == NULL)
267 {
268 vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE);
269 return CMD_WARNING;
270 }
271
272 params = IF_DEF_PARAMS (ifp);
273
274 if (argc == 2)
275 {
276 ret = inet_aton(argv[1], &addr);
277 if (!ret)
278 {
279 vty_out (vty, "Please specify interface address by A.B.C.D%s",
280 VTY_NEWLINE);
281 return CMD_WARNING;
282 }
283
284 params = ospf_get_if_params (ifp, addr);
285 ospf_if_update_params (ifp, addr);
286 }
287
288 SET_IF_PARAM (params, passive_interface);
289 params->passive_interface = OSPF_IF_PASSIVE;
290
291 return CMD_SUCCESS;
292}
293
paula2c62832003-04-23 17:01:31 +0000294ALIAS (ospf_passive_interface,
295 ospf_passive_interface_cmd,
paul718e3742002-12-13 20:15:29 +0000296 "passive-interface IFNAME",
297 "Suppress routing updates on an interface\n"
298 "Interface's name\n")
299
paula2c62832003-04-23 17:01:31 +0000300DEFUN (no_ospf_passive_interface,
301 no_ospf_passive_interface_addr_cmd,
paul718e3742002-12-13 20:15:29 +0000302 "no passive-interface IFNAME A.B.C.D",
303 NO_STR
304 "Allow routing updates on an interface\n"
305 "Interface's name\n")
306{
307 struct interface *ifp;
308 struct in_addr addr;
309 struct ospf_if_params *params;
310 int ret;
311
312 ifp = if_lookup_by_name (argv[0]);
313
314 if (ifp == NULL)
315 {
316 vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE);
317 return CMD_WARNING;
318 }
319
320 params = IF_DEF_PARAMS (ifp);
321
322 if (argc == 2)
323 {
324 ret = inet_aton(argv[1], &addr);
325 if (!ret)
326 {
327 vty_out (vty, "Please specify interface address by A.B.C.D%s",
328 VTY_NEWLINE);
329 return CMD_WARNING;
330 }
331
332 params = ospf_lookup_if_params (ifp, addr);
333 if (params == NULL)
334 return CMD_SUCCESS;
335 }
336
337 UNSET_IF_PARAM (params, passive_interface);
338 params->passive_interface = OSPF_IF_ACTIVE;
339
340 if (params != IF_DEF_PARAMS (ifp))
341 {
342 ospf_free_if_params (ifp, addr);
343 ospf_if_update_params (ifp, addr);
344 }
345
346 return CMD_SUCCESS;
347}
348
paula2c62832003-04-23 17:01:31 +0000349ALIAS (no_ospf_passive_interface,
350 no_ospf_passive_interface_cmd,
paul718e3742002-12-13 20:15:29 +0000351 "no passive-interface IFNAME",
352 NO_STR
353 "Allow routing updates on an interface\n"
354 "Interface's name\n")
355
paula2c62832003-04-23 17:01:31 +0000356DEFUN (ospf_network_area,
357 ospf_network_area_cmd,
paul718e3742002-12-13 20:15:29 +0000358 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
359 "Enable routing on an IP network\n"
360 "OSPF network prefix\n"
361 "Set the OSPF area ID\n"
362 "OSPF area ID in IP address format\n"
363 "OSPF area ID as a decimal value\n")
364{
365 struct ospf *ospf= vty->index;
366 struct prefix_ipv4 p;
367 struct in_addr area_id;
368 int ret, format;
369
370 /* Get network prefix and Area ID. */
371 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
372 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
373
374 ret = ospf_network_set (ospf, &p, area_id);
375 if (ret == 0)
376 {
377 vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
378 return CMD_WARNING;
379 }
380
381 return CMD_SUCCESS;
382}
383
paula2c62832003-04-23 17:01:31 +0000384DEFUN (no_ospf_network_area,
385 no_ospf_network_area_cmd,
paul718e3742002-12-13 20:15:29 +0000386 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
387 NO_STR
388 "Enable routing on an IP network\n"
389 "OSPF network prefix\n"
390 "Set the OSPF area ID\n"
391 "OSPF area ID in IP address format\n"
392 "OSPF area ID as a decimal value\n")
393{
394 struct ospf *ospf = (struct ospf *) vty->index;
395 struct prefix_ipv4 p;
396 struct in_addr area_id;
397 int ret, format;
398
399 /* Get network prefix and Area ID. */
400 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
401 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
402
403 ret = ospf_network_unset (ospf, &p, area_id);
404 if (ret == 0)
405 {
406 vty_out (vty, "Can't find specified network area configuration.%s",
407 VTY_NEWLINE);
408 return CMD_WARNING;
409 }
410
411 return CMD_SUCCESS;
412}
413
414
paula2c62832003-04-23 17:01:31 +0000415DEFUN (ospf_area_range,
416 ospf_area_range_cmd,
paul718e3742002-12-13 20:15:29 +0000417 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
418 "OSPF area parameters\n"
419 "OSPF area ID in IP address format\n"
420 "OSPF area ID as a decimal value\n"
421 "Summarize routes matching address/mask (border routers only)\n"
422 "Area range prefix\n")
423{
424 struct ospf *ospf = vty->index;
425 struct prefix_ipv4 p;
426 struct in_addr area_id;
427 int format;
428 u_int32_t cost;
429
430 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
431 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
432
433 ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
434 if (argc > 2)
435 {
436 VTY_GET_UINT32 ("range cost", cost, argv[2]);
437 ospf_area_range_cost_set (ospf, area_id, &p, cost);
438 }
439
440 return CMD_SUCCESS;
441}
442
paula2c62832003-04-23 17:01:31 +0000443ALIAS (ospf_area_range,
444 ospf_area_range_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000445 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
446 "OSPF area parameters\n"
447 "OSPF area ID in IP address format\n"
448 "OSPF area ID as a decimal value\n"
449 "OSPF area range for route advertise (default)\n"
450 "Area range prefix\n"
451 "Advertise this range (default)\n")
452
paula2c62832003-04-23 17:01:31 +0000453ALIAS (ospf_area_range,
454 ospf_area_range_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000455 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
456 "OSPF area parameters\n"
457 "OSPF area ID in IP address format\n"
458 "OSPF area ID as a decimal value\n"
459 "Summarize routes matching address/mask (border routers only)\n"
460 "Area range prefix\n"
461 "User specified metric for this range\n"
462 "Advertised metric for this range\n")
463
paula2c62832003-04-23 17:01:31 +0000464ALIAS (ospf_area_range,
465 ospf_area_range_advertise_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000466 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
467 "OSPF area parameters\n"
468 "OSPF area ID in IP address format\n"
469 "OSPF area ID as a decimal value\n"
470 "Summarize routes matching address/mask (border routers only)\n"
471 "Area range prefix\n"
472 "Advertise this range (default)\n"
473 "User specified metric for this range\n"
474 "Advertised metric for this range\n")
475
paula2c62832003-04-23 17:01:31 +0000476DEFUN (ospf_area_range_not_advertise,
477 ospf_area_range_not_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000478 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
479 "OSPF area parameters\n"
480 "OSPF area ID in IP address format\n"
481 "OSPF area ID as a decimal value\n"
482 "Summarize routes matching address/mask (border routers only)\n"
483 "Area range prefix\n"
484 "DoNotAdvertise this range\n")
485{
486 struct ospf *ospf = vty->index;
487 struct prefix_ipv4 p;
488 struct in_addr area_id;
489 int format;
490
491 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
492 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
493
494 ospf_area_range_set (ospf, area_id, &p, 0);
495
496 return CMD_SUCCESS;
497}
498
paula2c62832003-04-23 17:01:31 +0000499DEFUN (no_ospf_area_range,
500 no_ospf_area_range_cmd,
paul718e3742002-12-13 20:15:29 +0000501 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
502 NO_STR
503 "OSPF area parameters\n"
504 "OSPF area ID in IP address format\n"
505 "OSPF area ID as a decimal value\n"
506 "Summarize routes matching address/mask (border routers only)\n"
507 "Area range prefix\n")
508{
509 struct ospf *ospf = vty->index;
510 struct prefix_ipv4 p;
511 struct in_addr area_id;
512 int format;
513
514 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
515 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
516
517 ospf_area_range_unset (ospf, area_id, &p);
518
519 return CMD_SUCCESS;
520}
521
paula2c62832003-04-23 17:01:31 +0000522ALIAS (no_ospf_area_range,
523 no_ospf_area_range_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000524 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
525 NO_STR
526 "OSPF area parameters\n"
527 "OSPF area ID in IP address format\n"
528 "OSPF area ID as a decimal value\n"
529 "Summarize routes matching address/mask (border routers only)\n"
530 "Area range prefix\n"
531 "Advertise this range (default)\n"
532 "DoNotAdvertise this range\n")
533
paula2c62832003-04-23 17:01:31 +0000534ALIAS (no_ospf_area_range,
535 no_ospf_area_range_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000536 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
537 NO_STR
538 "OSPF area parameters\n"
539 "OSPF area ID in IP address format\n"
540 "OSPF area ID as a decimal value\n"
541 "Summarize routes matching address/mask (border routers only)\n"
542 "Area range prefix\n"
543 "User specified metric for this range\n"
544 "Advertised metric for this range\n")
545
paula2c62832003-04-23 17:01:31 +0000546ALIAS (no_ospf_area_range,
547 no_ospf_area_range_advertise_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000548 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
549 NO_STR
550 "OSPF area parameters\n"
551 "OSPF area ID in IP address format\n"
552 "OSPF area ID as a decimal value\n"
553 "Summarize routes matching address/mask (border routers only)\n"
554 "Area range prefix\n"
555 "Advertise this range (default)\n"
556 "User specified metric for this range\n"
557 "Advertised metric for this range\n")
558
paula2c62832003-04-23 17:01:31 +0000559DEFUN (ospf_area_range_substitute,
560 ospf_area_range_substitute_cmd,
paul718e3742002-12-13 20:15:29 +0000561 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
562 "OSPF area parameters\n"
563 "OSPF area ID in IP address format\n"
564 "OSPF area ID as a decimal value\n"
565 "Summarize routes matching address/mask (border routers only)\n"
566 "Area range prefix\n"
567 "Announce area range as another prefix\n"
568 "Network prefix to be announced instead of range\n")
569{
570 struct ospf *ospf = vty->index;
571 struct prefix_ipv4 p, s;
572 struct in_addr area_id;
573 int format;
574
575 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
576 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
577 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
578
579 ospf_area_range_substitute_set (ospf, area_id, &p, &s);
580
581 return CMD_SUCCESS;
582}
583
paula2c62832003-04-23 17:01:31 +0000584DEFUN (no_ospf_area_range_substitute,
585 no_ospf_area_range_substitute_cmd,
paul718e3742002-12-13 20:15:29 +0000586 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
587 NO_STR
588 "OSPF area parameters\n"
589 "OSPF area ID in IP address format\n"
590 "OSPF area ID as a decimal value\n"
591 "Summarize routes matching address/mask (border routers only)\n"
592 "Area range prefix\n"
593 "Announce area range as another prefix\n"
594 "Network prefix to be announced instead of range\n")
595{
596 struct ospf *ospf = vty->index;
597 struct prefix_ipv4 p, s;
598 struct in_addr area_id;
599 int format;
600
601 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
602 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
603 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
604
605 ospf_area_range_substitute_unset (ospf, area_id, &p);
606
607 return CMD_SUCCESS;
608}
609
610
611/* Command Handler Logic in VLink stuff is delicate!!
612
613 ALTER AT YOUR OWN RISK!!!!
614
615 Various dummy values are used to represent 'NoChange' state for
616 VLink configuration NOT being changed by a VLink command, and
617 special syntax is used within the command strings so that the
618 typed in command verbs can be seen in the configuration command
619 bacckend handler. This is to drastically reduce the verbeage
620 required to coe up with a reasonably compatible Cisco VLink command
621
622 - Matthew Grant <grantma@anathoth.gen.nz>
623 Wed, 21 Feb 2001 15:13:52 +1300
624 */
625
626
627/* Configuration data for virtual links
628 */
629struct ospf_vl_config_data {
630 struct vty *vty; /* vty stuff */
631 struct in_addr area_id; /* area ID from command line */
632 int format; /* command line area ID format */
633 struct in_addr vl_peer; /* command line vl_peer */
634 int auth_type; /* Authehntication type, if given */
635 char *auth_key; /* simple password if present */
636 int crypto_key_id; /* Cryptographic key ID */
637 char *md5_key; /* MD5 authentication key */
638 int hello_interval; /* Obvious what these are... */
639 int retransmit_interval;
640 int transmit_delay;
641 int dead_interval;
642};
643
644void
645ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config,
646 struct vty *vty)
647{
648 memset (vl_config, 0, sizeof (struct ospf_vl_config_data));
649 vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN;
650 vl_config->vty = vty;
651}
652
653struct ospf_vl_data *
paul68980082003-03-25 05:07:42 +0000654ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000655{
656 struct ospf_area *area;
657 struct ospf_vl_data *vl_data;
658 struct vty *vty;
659 struct in_addr area_id;
660
661 vty = vl_config->vty;
662 area_id = vl_config->area_id;
663
664 if (area_id.s_addr == OSPF_AREA_BACKBONE)
665 {
666 vty_out (vty,
667 "Configuring VLs over the backbone is not allowed%s",
668 VTY_NEWLINE);
669 return NULL;
670 }
paul68980082003-03-25 05:07:42 +0000671 area = ospf_area_get (ospf, area_id, vl_config->format);
paul718e3742002-12-13 20:15:29 +0000672
673 if (area->external_routing != OSPF_AREA_DEFAULT)
674 {
675 if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS)
676 vty_out (vty, "Area %s is %s%s",
677 inet_ntoa (area_id),
678#ifdef HAVE_NSSA
679 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
680#else
681 "stub",
682#endif /* HAVE_NSSA */
683 VTY_NEWLINE);
684 else
685 vty_out (vty, "Area %ld is %s%s",
686 (u_long)ntohl (area_id.s_addr),
687#ifdef HAVE_NSSA
688 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
689#else
690 "stub",
691#endif /* HAVE_NSSA */
692 VTY_NEWLINE);
693 return NULL;
694 }
695
696 if ((vl_data = ospf_vl_lookup (area, vl_config->vl_peer)) == NULL)
697 {
698 vl_data = ospf_vl_data_new (area, vl_config->vl_peer);
699 if (vl_data->vl_oi == NULL)
700 {
paul68980082003-03-25 05:07:42 +0000701 vl_data->vl_oi = ospf_vl_new (ospf, vl_data);
702 ospf_vl_add (ospf, vl_data);
703 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +0000704 }
705 }
706 return vl_data;
707}
708
709
710int
711ospf_vl_set_security (struct ospf_vl_data *vl_data,
712 struct ospf_vl_config_data *vl_config)
713{
714 struct crypt_key *ck;
715 struct vty *vty;
716 struct interface *ifp = vl_data->vl_oi->ifp;
717
718 vty = vl_config->vty;
719
720 if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN)
721 {
722 SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type);
723 IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type;
724 }
725
726 if (vl_config->auth_key)
727 {
728 memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1);
729 strncpy (IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key,
730 OSPF_AUTH_SIMPLE_SIZE);
731 }
732 else if (vl_config->md5_key)
733 {
734 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id)
735 != NULL)
736 {
737 vty_out (vty, "OSPF: Key %d already exists%s",
738 vl_config->crypto_key_id, VTY_NEWLINE);
739 return CMD_WARNING;
740 }
741 ck = ospf_crypt_key_new ();
742 ck->key_id = vl_config->crypto_key_id;
743 memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
744 strncpy (ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE);
745
746 ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck);
747 }
748 else if (vl_config->crypto_key_id != 0)
749 {
750 /* Delete a key */
751
752 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt,
753 vl_config->crypto_key_id) == NULL)
754 {
755 vty_out (vty, "OSPF: Key %d does not exist%s",
756 vl_config->crypto_key_id, VTY_NEWLINE);
757 return CMD_WARNING;
758 }
759
760 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id);
761
762 }
763
764 return CMD_SUCCESS;
765}
766
767
768
769int
770ospf_vl_set_timers (struct ospf_vl_data *vl_data,
771 struct ospf_vl_config_data *vl_config)
772{
773 struct interface *ifp = ifp = vl_data->vl_oi->ifp;
774 /* Virtual Link data initialised to defaults, so only set
775 if a value given */
776 if (vl_config->hello_interval)
777 {
778 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello);
779 IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval;
780 }
781
782 if (vl_config->dead_interval)
783 {
784 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait);
785 IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval;
786 }
787
788 if (vl_config->retransmit_interval)
789 {
790 SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval);
791 IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval;
792 }
793
794 if (vl_config->transmit_delay)
795 {
796 SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay);
797 IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay;
798 }
799
800 return CMD_SUCCESS;
801}
802
803
804
805/* The business end of all of the above */
806int
paul68980082003-03-25 05:07:42 +0000807ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000808{
809 struct ospf_vl_data *vl_data;
810 int ret;
811
paul68980082003-03-25 05:07:42 +0000812 vl_data = ospf_find_vl_data (ospf, vl_config);
paul718e3742002-12-13 20:15:29 +0000813 if (!vl_data)
814 return CMD_WARNING;
815
816 /* Process this one first as it can have a fatal result, which can
817 only logically occur if the virtual link exists already
818 Thus a command error does not result in a change to the
819 running configuration such as unexpectedly altered timer
820 values etc.*/
821 ret = ospf_vl_set_security (vl_data, vl_config);
822 if (ret != CMD_SUCCESS)
823 return ret;
824
825 /* Set any time based parameters, these area already range checked */
826
827 ret = ospf_vl_set_timers (vl_data, vl_config);
828 if (ret != CMD_SUCCESS)
829 return ret;
830
831 return CMD_SUCCESS;
832
833}
834
835/* This stuff exists to make specifying all the alias commands A LOT simpler
836 */
837#define VLINK_HELPSTR_IPADDR \
838 "OSPF area parameters\n" \
839 "OSPF area ID in IP address format\n" \
840 "OSPF area ID as a decimal value\n" \
841 "Configure a virtual link\n" \
842 "Router ID of the remote ABR\n"
843
844#define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
845 "Enable authentication on this virtual link\n" \
846 "dummy string \n"
847
848#define VLINK_HELPSTR_AUTHTYPE_ALL \
849 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
850 "Use null authentication\n" \
851 "Use message-digest authentication\n"
852
853#define VLINK_HELPSTR_TIME_PARAM_NOSECS \
854 "Time between HELLO packets\n" \
855 "Time between retransmitting lost link state advertisements\n" \
856 "Link state transmit delay\n" \
857 "Interval after which a neighbor is declared dead\n"
858
859#define VLINK_HELPSTR_TIME_PARAM \
860 VLINK_HELPSTR_TIME_PARAM_NOSECS \
861 "Seconds\n"
862
863#define VLINK_HELPSTR_AUTH_SIMPLE \
864 "Authentication password (key)\n" \
865 "The OSPF password (key)"
866
867#define VLINK_HELPSTR_AUTH_MD5 \
868 "Message digest authentication password (key)\n" \
869 "dummy string \n" \
870 "Key ID\n" \
871 "Use MD5 algorithm\n" \
872 "The OSPF password (key)"
873
paula2c62832003-04-23 17:01:31 +0000874DEFUN (ospf_area_vlink,
875 ospf_area_vlink_cmd,
paul718e3742002-12-13 20:15:29 +0000876 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
877 VLINK_HELPSTR_IPADDR)
878{
paul68980082003-03-25 05:07:42 +0000879 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000880 struct ospf_vl_config_data vl_config;
881 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
882 char md5_key[OSPF_AUTH_MD5_SIZE+1];
883 int i;
884 int ret;
885
886 ospf_vl_config_data_init(&vl_config, vty);
887
888 /* Read off first 2 parameters and check them */
889 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format);
890 if (ret < 0)
891 {
892 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
893 return CMD_WARNING;
894 }
895
896 ret = inet_aton (argv[1], &vl_config.vl_peer);
897 if (! ret)
898 {
899 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
900 VTY_NEWLINE);
901 return CMD_WARNING;
902 }
903
904 if (argc <=2)
905 {
906 /* Thats all folks! - BUGS B. strikes again!!!*/
907
paul68980082003-03-25 05:07:42 +0000908 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +0000909 }
910
911 /* Deal with other parameters */
912 for (i=2; i < argc; i++)
913 {
914
915 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
916
917 switch (argv[i][0])
918 {
919
920 case 'a':
921 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
922 {
923 /* authentication-key - this option can occur anywhere on
924 command line. At start of command line
925 must check for authentication option. */
926 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
927 strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE);
928 vl_config.auth_key = auth_key;
929 i++;
930 }
931 else if (strncmp (argv[i], "authentication", 14) == 0)
932 {
933 /* authentication - this option can only occur at start
934 of command line */
935 vl_config.auth_type = OSPF_AUTH_SIMPLE;
936 if ((i+1) < argc)
937 {
938 if (strncmp (argv[i+1], "n", 1) == 0)
939 {
940 /* "authentication null" */
941 vl_config.auth_type = OSPF_AUTH_NULL;
942 i++;
943 }
944 else if (strncmp (argv[i+1], "m", 1) == 0
945 && strcmp (argv[i+1], "message-digest-") != 0)
946 {
947 /* "authentication message-digest" */
948 vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
949 i++;
950 }
951 }
952 }
953 break;
954
955 case 'm':
956 /* message-digest-key */
957 i++;
958 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
959 if (vl_config.crypto_key_id < 0)
960 return CMD_WARNING;
961 i++;
962 memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1);
963 strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE);
964 vl_config.md5_key = md5_key;
965 break;
966
967 case 'h':
968 /* Hello interval */
969 i++;
970 vl_config.hello_interval = strtol (argv[i], NULL, 10);
971 if (vl_config.hello_interval < 0)
972 return CMD_WARNING;
973 break;
974
975 case 'r':
976 /* Retransmit Interval */
977 i++;
978 vl_config.retransmit_interval = strtol (argv[i], NULL, 10);
979 if (vl_config.retransmit_interval < 0)
980 return CMD_WARNING;
981 break;
982
983 case 't':
984 /* Transmit Delay */
985 i++;
986 vl_config.transmit_delay = strtol (argv[i], NULL, 10);
987 if (vl_config.transmit_delay < 0)
988 return CMD_WARNING;
989 break;
990
991 case 'd':
992 /* Dead Interval */
993 i++;
994 vl_config.dead_interval = strtol (argv[i], NULL, 10);
995 if (vl_config.dead_interval < 0)
996 return CMD_WARNING;
997 break;
998 }
999 }
1000
1001
1002 /* Action configuration */
1003
paul68980082003-03-25 05:07:42 +00001004 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001005
1006}
1007
paula2c62832003-04-23 17:01:31 +00001008DEFUN (no_ospf_area_vlink,
1009 no_ospf_area_vlink_cmd,
paul718e3742002-12-13 20:15:29 +00001010 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1011 NO_STR
1012 VLINK_HELPSTR_IPADDR)
1013{
paul68980082003-03-25 05:07:42 +00001014 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001015 struct ospf_area *area;
1016 struct ospf_vl_config_data vl_config;
1017 struct ospf_vl_data *vl_data = NULL;
1018 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
1019 int i;
1020 int ret, format;
1021
1022 ospf_vl_config_data_init(&vl_config, vty);
1023
1024 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format);
1025 if (ret < 0)
1026 {
1027 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
1028 return CMD_WARNING;
1029 }
1030
paul68980082003-03-25 05:07:42 +00001031 area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001032 if (!area)
1033 {
1034 vty_out (vty, "Area does not exist%s", VTY_NEWLINE);
1035 return CMD_WARNING;
1036 }
1037
1038 ret = inet_aton (argv[1], &vl_config.vl_peer);
1039 if (! ret)
1040 {
1041 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
1042 VTY_NEWLINE);
1043 return CMD_WARNING;
1044 }
1045
1046 if (argc <=2)
1047 {
1048 /* Basic VLink no command */
1049 /* Thats all folks! - BUGS B. strikes again!!!*/
1050 if ((vl_data = ospf_vl_lookup (area, vl_config.vl_peer)))
paul68980082003-03-25 05:07:42 +00001051 ospf_vl_delete (ospf, vl_data);
paul718e3742002-12-13 20:15:29 +00001052
paul68980082003-03-25 05:07:42 +00001053 ospf_area_check_free (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001054
1055 return CMD_SUCCESS;
1056 }
1057
1058 /* If we are down here, we are reseting parameters */
1059
1060 /* Deal with other parameters */
1061 for (i=2; i < argc; i++)
1062 {
paul718e3742002-12-13 20:15:29 +00001063 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1064
1065 switch (argv[i][0])
1066 {
1067
1068 case 'a':
1069 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
1070 {
1071 /* authentication-key - this option can occur anywhere on
1072 command line. At start of command line
1073 must check for authentication option. */
1074 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
1075 vl_config.auth_key = auth_key;
1076 }
1077 else if (strncmp (argv[i], "authentication", 14) == 0)
1078 {
1079 /* authentication - this option can only occur at start
1080 of command line */
1081 vl_config.auth_type = OSPF_AUTH_NOTSET;
1082 }
1083 break;
1084
1085 case 'm':
1086 /* message-digest-key */
1087 /* Delete one key */
1088 i++;
1089 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
1090 if (vl_config.crypto_key_id < 0)
1091 return CMD_WARNING;
1092 vl_config.md5_key = NULL;
1093 break;
1094
1095 case 'h':
1096 /* Hello interval */
1097 vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
1098 break;
1099
1100 case 'r':
1101 /* Retransmit Interval */
1102 vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
1103 break;
1104
1105 case 't':
1106 /* Transmit Delay */
1107 vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
1108 break;
1109
1110 case 'd':
1111 /* Dead Interval */
1112 i++;
1113 vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
1114 break;
1115 }
1116 }
1117
1118
1119 /* Action configuration */
1120
paul68980082003-03-25 05:07:42 +00001121 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001122}
1123
paula2c62832003-04-23 17:01:31 +00001124ALIAS (ospf_area_vlink,
1125 ospf_area_vlink_param1_cmd,
paul718e3742002-12-13 20:15:29 +00001126 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1127 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1128 VLINK_HELPSTR_IPADDR
1129 VLINK_HELPSTR_TIME_PARAM)
1130
paula2c62832003-04-23 17:01:31 +00001131ALIAS (no_ospf_area_vlink,
1132 no_ospf_area_vlink_param1_cmd,
paul718e3742002-12-13 20:15:29 +00001133 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1134 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1135 NO_STR
1136 VLINK_HELPSTR_IPADDR
1137 VLINK_HELPSTR_TIME_PARAM)
1138
paula2c62832003-04-23 17:01:31 +00001139ALIAS (ospf_area_vlink,
1140 ospf_area_vlink_param2_cmd,
paul718e3742002-12-13 20:15:29 +00001141 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1142 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1143 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1144 VLINK_HELPSTR_IPADDR
1145 VLINK_HELPSTR_TIME_PARAM
1146 VLINK_HELPSTR_TIME_PARAM)
1147
paula2c62832003-04-23 17:01:31 +00001148ALIAS (no_ospf_area_vlink,
1149 no_ospf_area_vlink_param2_cmd,
paul718e3742002-12-13 20:15:29 +00001150 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1151 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1152 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1153 NO_STR
1154 VLINK_HELPSTR_IPADDR
1155 VLINK_HELPSTR_TIME_PARAM
1156 VLINK_HELPSTR_TIME_PARAM)
1157
paula2c62832003-04-23 17:01:31 +00001158ALIAS (ospf_area_vlink,
1159 ospf_area_vlink_param3_cmd,
paul718e3742002-12-13 20:15:29 +00001160 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1161 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1162 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1163 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1164 VLINK_HELPSTR_IPADDR
1165 VLINK_HELPSTR_TIME_PARAM
1166 VLINK_HELPSTR_TIME_PARAM
1167 VLINK_HELPSTR_TIME_PARAM)
1168
paula2c62832003-04-23 17:01:31 +00001169ALIAS (no_ospf_area_vlink,
1170 no_ospf_area_vlink_param3_cmd,
paul718e3742002-12-13 20:15:29 +00001171 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1172 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1173 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1174 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1175 NO_STR
1176 VLINK_HELPSTR_IPADDR
1177 VLINK_HELPSTR_TIME_PARAM
1178 VLINK_HELPSTR_TIME_PARAM
1179 VLINK_HELPSTR_TIME_PARAM)
1180
paula2c62832003-04-23 17:01:31 +00001181ALIAS (ospf_area_vlink,
1182 ospf_area_vlink_param4_cmd,
paul718e3742002-12-13 20:15:29 +00001183 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1184 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1185 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1186 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1187 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1188 VLINK_HELPSTR_IPADDR
1189 VLINK_HELPSTR_TIME_PARAM
1190 VLINK_HELPSTR_TIME_PARAM
1191 VLINK_HELPSTR_TIME_PARAM
1192 VLINK_HELPSTR_TIME_PARAM)
1193
paula2c62832003-04-23 17:01:31 +00001194ALIAS (no_ospf_area_vlink,
1195 no_ospf_area_vlink_param4_cmd,
paul718e3742002-12-13 20:15:29 +00001196 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1197 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1198 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1199 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1200 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1201 NO_STR
1202 VLINK_HELPSTR_IPADDR
1203 VLINK_HELPSTR_TIME_PARAM
1204 VLINK_HELPSTR_TIME_PARAM
1205 VLINK_HELPSTR_TIME_PARAM
1206 VLINK_HELPSTR_TIME_PARAM)
1207
paula2c62832003-04-23 17:01:31 +00001208ALIAS (ospf_area_vlink,
1209 ospf_area_vlink_authtype_args_cmd,
paul718e3742002-12-13 20:15:29 +00001210 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1211 "(authentication|) (message-digest|null)",
1212 VLINK_HELPSTR_IPADDR
1213 VLINK_HELPSTR_AUTHTYPE_ALL)
1214
paula2c62832003-04-23 17:01:31 +00001215ALIAS (ospf_area_vlink,
1216 ospf_area_vlink_authtype_cmd,
paul718e3742002-12-13 20:15:29 +00001217 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1218 "(authentication|)",
1219 VLINK_HELPSTR_IPADDR
1220 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1221
paula2c62832003-04-23 17:01:31 +00001222ALIAS (no_ospf_area_vlink,
1223 no_ospf_area_vlink_authtype_cmd,
paul718e3742002-12-13 20:15:29 +00001224 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1225 "(authentication|)",
1226 NO_STR
1227 VLINK_HELPSTR_IPADDR
1228 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1229
paula2c62832003-04-23 17:01:31 +00001230ALIAS (ospf_area_vlink,
1231 ospf_area_vlink_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001232 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1233 "(message-digest-key|) <1-255> md5 KEY",
1234 VLINK_HELPSTR_IPADDR
1235 VLINK_HELPSTR_AUTH_MD5)
1236
paula2c62832003-04-23 17:01:31 +00001237ALIAS (no_ospf_area_vlink,
1238 no_ospf_area_vlink_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001239 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1240 "(message-digest-key|) <1-255>",
1241 NO_STR
1242 VLINK_HELPSTR_IPADDR
1243 VLINK_HELPSTR_AUTH_MD5)
1244
paula2c62832003-04-23 17:01:31 +00001245ALIAS (ospf_area_vlink,
1246 ospf_area_vlink_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001247 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1248 "(authentication-key|) AUTH_KEY",
1249 VLINK_HELPSTR_IPADDR
1250 VLINK_HELPSTR_AUTH_SIMPLE)
1251
paula2c62832003-04-23 17:01:31 +00001252ALIAS (no_ospf_area_vlink,
1253 no_ospf_area_vlink_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001254 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1255 "(authentication-key|)",
1256 NO_STR
1257 VLINK_HELPSTR_IPADDR
1258 VLINK_HELPSTR_AUTH_SIMPLE)
1259
paula2c62832003-04-23 17:01:31 +00001260ALIAS (ospf_area_vlink,
1261 ospf_area_vlink_authtype_args_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001262 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1263 "(authentication|) (message-digest|null) "
1264 "(authentication-key|) AUTH_KEY",
1265 VLINK_HELPSTR_IPADDR
1266 VLINK_HELPSTR_AUTHTYPE_ALL
1267 VLINK_HELPSTR_AUTH_SIMPLE)
1268
paula2c62832003-04-23 17:01:31 +00001269ALIAS (ospf_area_vlink,
1270 ospf_area_vlink_authtype_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001271 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1272 "(authentication|) "
1273 "(authentication-key|) AUTH_KEY",
1274 VLINK_HELPSTR_IPADDR
1275 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1276 VLINK_HELPSTR_AUTH_SIMPLE)
1277
paula2c62832003-04-23 17:01:31 +00001278ALIAS (no_ospf_area_vlink,
1279 no_ospf_area_vlink_authtype_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001280 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1281 "(authentication|) "
1282 "(authentication-key|)",
1283 NO_STR
1284 VLINK_HELPSTR_IPADDR
1285 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1286 VLINK_HELPSTR_AUTH_SIMPLE)
1287
paula2c62832003-04-23 17:01:31 +00001288ALIAS (ospf_area_vlink,
1289 ospf_area_vlink_authtype_args_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001290 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1291 "(authentication|) (message-digest|null) "
1292 "(message-digest-key|) <1-255> md5 KEY",
1293 VLINK_HELPSTR_IPADDR
1294 VLINK_HELPSTR_AUTHTYPE_ALL
1295 VLINK_HELPSTR_AUTH_MD5)
1296
paula2c62832003-04-23 17:01:31 +00001297ALIAS (ospf_area_vlink,
1298 ospf_area_vlink_authtype_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001299 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1300 "(authentication|) "
1301 "(message-digest-key|) <1-255> md5 KEY",
1302 VLINK_HELPSTR_IPADDR
1303 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1304 VLINK_HELPSTR_AUTH_MD5)
1305
paula2c62832003-04-23 17:01:31 +00001306ALIAS (no_ospf_area_vlink,
1307 no_ospf_area_vlink_authtype_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001308 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1309 "(authentication|) "
1310 "(message-digest-key|)",
1311 NO_STR
1312 VLINK_HELPSTR_IPADDR
1313 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1314 VLINK_HELPSTR_AUTH_MD5)
1315
1316
paula2c62832003-04-23 17:01:31 +00001317DEFUN (ospf_area_shortcut,
1318 ospf_area_shortcut_cmd,
paul718e3742002-12-13 20:15:29 +00001319 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1320 "OSPF area parameters\n"
1321 "OSPF area ID in IP address format\n"
1322 "OSPF area ID as a decimal value\n"
1323 "Configure the area's shortcutting mode\n"
1324 "Set default shortcutting behavior\n"
1325 "Enable shortcutting through the area\n"
1326 "Disable shortcutting through the area\n")
1327{
paul68980082003-03-25 05:07:42 +00001328 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001329 struct ospf_area *area;
1330 struct in_addr area_id;
1331 int mode;
1332 int format;
1333
1334 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1335
paul68980082003-03-25 05:07:42 +00001336 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001337
1338 if (strncmp (argv[1], "de", 2) == 0)
1339 mode = OSPF_SHORTCUT_DEFAULT;
1340 else if (strncmp (argv[1], "di", 2) == 0)
1341 mode = OSPF_SHORTCUT_DISABLE;
1342 else if (strncmp (argv[1], "e", 1) == 0)
1343 mode = OSPF_SHORTCUT_ENABLE;
1344 else
1345 return CMD_WARNING;
1346
paul68980082003-03-25 05:07:42 +00001347 ospf_area_shortcut_set (ospf, area, mode);
paul718e3742002-12-13 20:15:29 +00001348
paul68980082003-03-25 05:07:42 +00001349 if (ospf->abr_type != OSPF_ABR_SHORTCUT)
paul718e3742002-12-13 20:15:29 +00001350 vty_out (vty, "Shortcut area setting will take effect "
1351 "only when the router is configured as Shortcut ABR%s",
1352 VTY_NEWLINE);
1353
1354 return CMD_SUCCESS;
1355}
1356
paula2c62832003-04-23 17:01:31 +00001357DEFUN (no_ospf_area_shortcut,
1358 no_ospf_area_shortcut_cmd,
paul718e3742002-12-13 20:15:29 +00001359 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1360 NO_STR
1361 "OSPF area parameters\n"
1362 "OSPF area ID in IP address format\n"
1363 "OSPF area ID as a decimal value\n"
1364 "Deconfigure the area's shortcutting mode\n"
1365 "Deconfigure enabled shortcutting through the area\n"
1366 "Deconfigure disabled shortcutting through the area\n")
1367{
paul68980082003-03-25 05:07:42 +00001368 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001369 struct ospf_area *area;
1370 struct in_addr area_id;
1371 int format;
1372
1373 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1374
paul68980082003-03-25 05:07:42 +00001375 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001376 if (!area)
1377 return CMD_SUCCESS;
1378
paul68980082003-03-25 05:07:42 +00001379 ospf_area_shortcut_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001380
1381 return CMD_SUCCESS;
1382}
1383
1384
paula2c62832003-04-23 17:01:31 +00001385DEFUN (ospf_area_stub,
1386 ospf_area_stub_cmd,
paul718e3742002-12-13 20:15:29 +00001387 "area (A.B.C.D|<0-4294967295>) stub",
1388 "OSPF area parameters\n"
1389 "OSPF area ID in IP address format\n"
1390 "OSPF area ID as a decimal value\n"
1391 "Configure OSPF area as stub\n")
1392{
1393 struct ospf *ospf = vty->index;
1394 struct in_addr area_id;
1395 int ret, format;
1396
1397 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1398
1399 ret = ospf_area_stub_set (ospf, area_id);
1400 if (ret == 0)
1401 {
1402 vty_out (vty, "First deconfigure all virtual link through this area%s",
1403 VTY_NEWLINE);
1404 return CMD_WARNING;
1405 }
1406
1407 ospf_area_no_summary_unset (ospf, area_id);
1408
1409 return CMD_SUCCESS;
1410}
1411
paula2c62832003-04-23 17:01:31 +00001412DEFUN (ospf_area_stub_no_summary,
1413 ospf_area_stub_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001414 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1415 "OSPF stub parameters\n"
1416 "OSPF area ID in IP address format\n"
1417 "OSPF area ID as a decimal value\n"
1418 "Configure OSPF area as stub\n"
1419 "Do not inject inter-area routes into stub\n")
1420{
1421 struct ospf *ospf = vty->index;
1422 struct in_addr area_id;
1423 int ret, format;
1424
1425 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1426
1427 ret = ospf_area_stub_set (ospf, area_id);
1428 if (ret == 0)
1429 {
1430 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1431 VTY_NEWLINE);
1432 return CMD_WARNING;
1433 }
1434
1435 ospf_area_no_summary_set (ospf, area_id);
1436
1437 return CMD_SUCCESS;
1438}
1439
paula2c62832003-04-23 17:01:31 +00001440DEFUN (no_ospf_area_stub,
1441 no_ospf_area_stub_cmd,
paul718e3742002-12-13 20:15:29 +00001442 "no area (A.B.C.D|<0-4294967295>) stub",
1443 NO_STR
1444 "OSPF area parameters\n"
1445 "OSPF area ID in IP address format\n"
1446 "OSPF area ID as a decimal value\n"
1447 "Configure OSPF area as stub\n")
1448{
1449 struct ospf *ospf = vty->index;
1450 struct in_addr area_id;
1451 int format;
1452
1453 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1454
1455 ospf_area_stub_unset (ospf, area_id);
1456 ospf_area_no_summary_unset (ospf, area_id);
1457
1458 return CMD_SUCCESS;
1459}
1460
paula2c62832003-04-23 17:01:31 +00001461DEFUN (no_ospf_area_stub_no_summary,
1462 no_ospf_area_stub_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001463 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1464 NO_STR
1465 "OSPF area parameters\n"
1466 "OSPF area ID in IP address format\n"
1467 "OSPF area ID as a decimal value\n"
1468 "Configure OSPF area as stub\n"
1469 "Do not inject inter-area routes into area\n")
1470{
1471 struct ospf *ospf = vty->index;
1472 struct in_addr area_id;
1473 int format;
1474
1475 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1476 ospf_area_no_summary_unset (ospf, area_id);
1477
1478 return CMD_SUCCESS;
1479}
1480
1481#ifdef HAVE_NSSA
paula2c62832003-04-23 17:01:31 +00001482DEFUN (ospf_area_nssa,
1483 ospf_area_nssa_cmd,
paul718e3742002-12-13 20:15:29 +00001484 "area (A.B.C.D|<0-4294967295>) nssa",
1485 "OSPF area parameters\n"
1486 "OSPF area ID in IP address format\n"
1487 "OSPF area ID as a decimal value\n"
1488 "Configure OSPF area as nssa\n")
1489{
1490 struct ospf *ospf = vty->index;
1491 struct in_addr area_id;
1492 int ret, format;
1493
1494 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1495
1496 ret = ospf_area_nssa_set (ospf, area_id);
1497 if (ret == 0)
1498 {
1499 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1500 VTY_NEWLINE);
1501 return CMD_WARNING;
1502 }
1503
1504 if (argc > 1)
1505 {
1506 if (strncmp (argv[1], "translate-c", 11) == 0)
1507 ospf_area_nssa_translator_role_set (ospf, area_id,
1508 OSPF_NSSA_ROLE_CANDIDATE);
1509 else if (strncmp (argv[1], "translate-n", 11) == 0)
1510 ospf_area_nssa_translator_role_set (ospf, area_id,
1511 OSPF_NSSA_ROLE_NEVER);
1512 else if (strncmp (argv[1], "translate-a", 11) == 0)
1513 ospf_area_nssa_translator_role_set (ospf, area_id,
1514 OSPF_NSSA_ROLE_ALWAYS);
1515 }
1516
1517 if (argc > 2)
1518 ospf_area_no_summary_set (ospf, area_id);
1519
1520 return CMD_SUCCESS;
1521}
1522
paula2c62832003-04-23 17:01:31 +00001523ALIAS (ospf_area_nssa,
1524 ospf_area_nssa_translate_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001525 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) (no-summary|)",
1526 "OSPF area parameters\n"
1527 "OSPF area ID in IP address format\n"
1528 "OSPF area ID as a decimal value\n"
1529 "Configure OSPF area as nssa\n"
1530 "Configure NSSA-ABR for translate election (default)\n"
1531 "Configure NSSA-ABR to never translate\n"
1532 "Configure NSSA-ABR to always translate\n"
1533 "Do not inject inter-area routes into nssa\n"
1534 "dummy\n")
1535
paula2c62832003-04-23 17:01:31 +00001536ALIAS (ospf_area_nssa,
1537 ospf_area_nssa_translate_cmd,
paul718e3742002-12-13 20:15:29 +00001538 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1539 "OSPF area parameters\n"
1540 "OSPF area ID in IP address format\n"
1541 "OSPF area ID as a decimal value\n"
1542 "Configure OSPF area as nssa\n"
1543 "Configure NSSA-ABR for translate election (default)\n"
1544 "Configure NSSA-ABR to never translate\n"
1545 "Configure NSSA-ABR to always translate\n")
1546
paula2c62832003-04-23 17:01:31 +00001547DEFUN (ospf_area_nssa_no_summary,
1548 ospf_area_nssa_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001549 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1550 "OSPF area parameters\n"
1551 "OSPF area ID in IP address format\n"
1552 "OSPF area ID as a decimal value\n"
1553 "Configure OSPF area as nssa\n"
1554 "Do not inject inter-area routes into nssa\n")
1555{
1556 struct ospf *ospf = vty->index;
1557 struct in_addr area_id;
1558 int ret, format;
1559
1560 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1561
1562 ret = ospf_area_nssa_set (ospf, area_id);
1563 if (ret == 0)
1564 {
1565 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1566 VTY_NEWLINE);
1567 return CMD_WARNING;
1568 }
1569
1570 ospf_area_no_summary_set (ospf, area_id);
1571
1572 return CMD_SUCCESS;
1573}
1574
paula2c62832003-04-23 17:01:31 +00001575DEFUN (no_ospf_area_nssa,
1576 no_ospf_area_nssa_cmd,
paul718e3742002-12-13 20:15:29 +00001577 "no area (A.B.C.D|<0-4294967295>) nssa",
1578 NO_STR
1579 "OSPF area parameters\n"
1580 "OSPF area ID in IP address format\n"
1581 "OSPF area ID as a decimal value\n"
1582 "Configure OSPF area as nssa\n")
1583{
1584 struct ospf *ospf = vty->index;
1585 struct in_addr area_id;
1586 int format;
1587
1588 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1589
1590 ospf_area_nssa_unset (ospf, area_id);
1591 ospf_area_no_summary_unset (ospf, area_id);
1592
1593 return CMD_SUCCESS;
1594}
1595
paula2c62832003-04-23 17:01:31 +00001596DEFUN (no_ospf_area_nssa_no_summary,
1597 no_ospf_area_nssa_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001598 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1599 NO_STR
1600 "OSPF area parameters\n"
1601 "OSPF area ID in IP address format\n"
1602 "OSPF area ID as a decimal value\n"
1603 "Configure OSPF area as nssa\n"
1604 "Do not inject inter-area routes into nssa\n")
1605{
1606 struct ospf *ospf = vty->index;
1607 struct in_addr area_id;
1608 int format;
1609
1610 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1611 ospf_area_no_summary_unset (ospf, area_id);
1612
1613 return CMD_SUCCESS;
1614}
1615
1616#endif /* HAVE_NSSA */
1617
paula2c62832003-04-23 17:01:31 +00001618DEFUN (ospf_area_default_cost,
1619 ospf_area_default_cost_cmd,
paul718e3742002-12-13 20:15:29 +00001620 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1621 "OSPF area parameters\n"
1622 "OSPF area ID in IP address format\n"
1623 "OSPF area ID as a decimal value\n"
1624 "Set the summary-default cost of a NSSA or stub area\n"
1625 "Stub's advertised default summary cost\n")
1626{
paul68980082003-03-25 05:07:42 +00001627 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001628 struct ospf_area *area;
1629 struct in_addr area_id;
1630 u_int32_t cost;
1631 int format;
1632
1633 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1634 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1635
paul68980082003-03-25 05:07:42 +00001636 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001637
1638 if (area->external_routing == OSPF_AREA_DEFAULT)
1639 {
1640 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1641 return CMD_WARNING;
1642 }
1643
1644 area->default_cost = cost;
1645
1646 return CMD_SUCCESS;
1647}
1648
paula2c62832003-04-23 17:01:31 +00001649DEFUN (no_ospf_area_default_cost,
1650 no_ospf_area_default_cost_cmd,
paul718e3742002-12-13 20:15:29 +00001651 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1652 NO_STR
1653 "OSPF area parameters\n"
1654 "OSPF area ID in IP address format\n"
1655 "OSPF area ID as a decimal value\n"
1656 "Set the summary-default cost of a NSSA or stub area\n"
1657 "Stub's advertised default summary cost\n")
1658{
paul68980082003-03-25 05:07:42 +00001659 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001660 struct ospf_area *area;
1661 struct in_addr area_id;
1662 u_int32_t cost;
1663 int format;
1664
1665 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1666 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1667
paul68980082003-03-25 05:07:42 +00001668 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001669 if (area == NULL)
1670 return CMD_SUCCESS;
1671
1672 if (area->external_routing == OSPF_AREA_DEFAULT)
1673 {
1674 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1675 return CMD_WARNING;
1676 }
1677
1678 area->default_cost = 1;
1679
paul68980082003-03-25 05:07:42 +00001680 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001681
1682 return CMD_SUCCESS;
1683}
1684
paula2c62832003-04-23 17:01:31 +00001685DEFUN (ospf_area_export_list,
1686 ospf_area_export_list_cmd,
paul718e3742002-12-13 20:15:29 +00001687 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1688 "OSPF area parameters\n"
1689 "OSPF area ID in IP address format\n"
1690 "OSPF area ID as a decimal value\n"
1691 "Set the filter for networks announced to other areas\n"
1692 "Name of the access-list\n")
1693{
paul68980082003-03-25 05:07:42 +00001694 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001695 struct ospf_area *area;
1696 struct in_addr area_id;
1697 int format;
1698
1699 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id, format, argv[0]);
1700
paul68980082003-03-25 05:07:42 +00001701 area = ospf_area_get (ospf, area_id, format);
1702 ospf_area_export_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001703
1704 return CMD_SUCCESS;
1705}
1706
paula2c62832003-04-23 17:01:31 +00001707DEFUN (no_ospf_area_export_list,
1708 no_ospf_area_export_list_cmd,
paul718e3742002-12-13 20:15:29 +00001709 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1710 NO_STR
1711 "OSPF area parameters\n"
1712 "OSPF area ID in IP address format\n"
1713 "OSPF area ID as a decimal value\n"
1714 "Unset the filter for networks announced to other areas\n"
1715 "Name of the access-list\n")
1716{
paul68980082003-03-25 05:07:42 +00001717 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001718 struct ospf_area *area;
1719 struct in_addr area_id;
1720 int format;
1721
1722 VTY_GET_OSPF_AREA_ID_NO_BB ("export-list", area_id, format, argv[0]);
1723
paul68980082003-03-25 05:07:42 +00001724 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001725 if (area == NULL)
1726 return CMD_SUCCESS;
1727
paul68980082003-03-25 05:07:42 +00001728 ospf_area_export_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001729
1730 return CMD_SUCCESS;
1731}
1732
1733
paula2c62832003-04-23 17:01:31 +00001734DEFUN (ospf_area_import_list,
1735 ospf_area_import_list_cmd,
paul718e3742002-12-13 20:15:29 +00001736 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1737 "OSPF area parameters\n"
1738 "OSPF area ID in IP address format\n"
1739 "OSPF area ID as a decimal value\n"
1740 "Set the filter for networks from other areas announced to the specified one\n"
1741 "Name of the access-list\n")
1742{
paul68980082003-03-25 05:07:42 +00001743 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001744 struct ospf_area *area;
1745 struct in_addr area_id;
1746 int format;
1747
1748 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id, format, argv[0]);
1749
paul68980082003-03-25 05:07:42 +00001750 area = ospf_area_get (ospf, area_id, format);
1751 ospf_area_import_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001752
1753 return CMD_SUCCESS;
1754}
1755
paula2c62832003-04-23 17:01:31 +00001756DEFUN (no_ospf_area_import_list,
1757 no_ospf_area_import_list_cmd,
paul718e3742002-12-13 20:15:29 +00001758 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1759 NO_STR
1760 "OSPF area parameters\n"
1761 "OSPF area ID in IP address format\n"
1762 "OSPF area ID as a decimal value\n"
1763 "Unset the filter for networks announced to other areas\n"
1764 "Name of the access-list\n")
1765{
paul68980082003-03-25 05:07:42 +00001766 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001767 struct ospf_area *area;
1768 struct in_addr area_id;
1769 int format;
1770
1771 VTY_GET_OSPF_AREA_ID_NO_BB ("import-list", area_id, format, argv[0]);
paul68980082003-03-25 05:07:42 +00001772 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001773 if (area == NULL)
1774 return CMD_SUCCESS;
1775
paul68980082003-03-25 05:07:42 +00001776 ospf_area_import_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001777
1778 return CMD_SUCCESS;
1779}
1780
paula2c62832003-04-23 17:01:31 +00001781DEFUN (ospf_area_filter_list,
1782 ospf_area_filter_list_cmd,
paul718e3742002-12-13 20:15:29 +00001783 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1784 "OSPF area parameters\n"
1785 "OSPF area ID in IP address format\n"
1786 "OSPF area ID as a decimal value\n"
1787 "Filter networks between OSPF areas\n"
1788 "Filter prefixes between OSPF areas\n"
1789 "Name of an IP prefix-list\n"
1790 "Filter networks sent to this area\n"
1791 "Filter networks sent from this area\n")
1792{
paul68980082003-03-25 05:07:42 +00001793 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001794 struct ospf_area *area;
1795 struct in_addr area_id;
1796 struct prefix_list *plist;
1797 int format;
1798
1799 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1800
paul68980082003-03-25 05:07:42 +00001801 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001802 plist = prefix_list_lookup (AFI_IP, argv[1]);
1803 if (strncmp (argv[2], "in", 2) == 0)
1804 {
1805 PREFIX_LIST_IN (area) = plist;
1806 if (PREFIX_NAME_IN (area))
1807 free (PREFIX_NAME_IN (area));
1808
1809 PREFIX_NAME_IN (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001810 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001811 }
1812 else
1813 {
1814 PREFIX_LIST_OUT (area) = plist;
1815 if (PREFIX_NAME_OUT (area))
1816 free (PREFIX_NAME_OUT (area));
1817
1818 PREFIX_NAME_OUT (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001819 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001820 }
1821
1822 return CMD_SUCCESS;
1823}
1824
paula2c62832003-04-23 17:01:31 +00001825DEFUN (no_ospf_area_filter_list,
1826 no_ospf_area_filter_list_cmd,
paul718e3742002-12-13 20:15:29 +00001827 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1828 NO_STR
1829 "OSPF area parameters\n"
1830 "OSPF area ID in IP address format\n"
1831 "OSPF area ID as a decimal value\n"
1832 "Filter networks between OSPF areas\n"
1833 "Filter prefixes between OSPF areas\n"
1834 "Name of an IP prefix-list\n"
1835 "Filter networks sent to this area\n"
1836 "Filter networks sent from this area\n")
1837{
paul68980082003-03-25 05:07:42 +00001838 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001839 struct ospf_area *area;
1840 struct in_addr area_id;
1841 struct prefix_list *plist;
1842 int format;
1843
1844 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1845
paul68980082003-03-25 05:07:42 +00001846 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001847 plist = prefix_list_lookup (AFI_IP, argv[1]);
1848 if (strncmp (argv[2], "in", 2) == 0)
1849 {
1850 if (PREFIX_NAME_IN (area))
1851 if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0)
1852 return CMD_SUCCESS;
1853
1854 PREFIX_LIST_IN (area) = NULL;
1855 if (PREFIX_NAME_IN (area))
1856 free (PREFIX_NAME_IN (area));
1857
1858 PREFIX_NAME_IN (area) = NULL;
1859
paul68980082003-03-25 05:07:42 +00001860 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001861 }
1862 else
1863 {
1864 if (PREFIX_NAME_OUT (area))
1865 if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0)
1866 return CMD_SUCCESS;
1867
1868 PREFIX_LIST_OUT (area) = NULL;
1869 if (PREFIX_NAME_OUT (area))
1870 free (PREFIX_NAME_OUT (area));
1871
1872 PREFIX_NAME_OUT (area) = NULL;
1873
paul68980082003-03-25 05:07:42 +00001874 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001875 }
1876
1877 return CMD_SUCCESS;
1878}
1879
1880
paula2c62832003-04-23 17:01:31 +00001881DEFUN (ospf_area_authentication_message_digest,
1882 ospf_area_authentication_message_digest_cmd,
paul718e3742002-12-13 20:15:29 +00001883 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1884 "OSPF area parameters\n"
1885 "Enable authentication\n"
1886 "Use message-digest authentication\n")
1887{
paul68980082003-03-25 05:07:42 +00001888 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001889 struct ospf_area *area;
1890 struct in_addr area_id;
1891 int format;
1892
1893 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1894
paul68980082003-03-25 05:07:42 +00001895 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001896 area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
1897
1898 return CMD_SUCCESS;
1899}
1900
paula2c62832003-04-23 17:01:31 +00001901DEFUN (ospf_area_authentication,
1902 ospf_area_authentication_cmd,
paul718e3742002-12-13 20:15:29 +00001903 "area (A.B.C.D|<0-4294967295>) authentication",
1904 "OSPF area parameters\n"
1905 "OSPF area ID in IP address format\n"
1906 "OSPF area ID as a decimal value\n"
1907 "Enable authentication\n")
1908{
paul68980082003-03-25 05:07:42 +00001909 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001910 struct ospf_area *area;
1911 struct in_addr area_id;
1912 int format;
1913
1914 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1915
paul68980082003-03-25 05:07:42 +00001916 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001917 area->auth_type = OSPF_AUTH_SIMPLE;
1918
1919 return CMD_SUCCESS;
1920}
1921
paula2c62832003-04-23 17:01:31 +00001922DEFUN (no_ospf_area_authentication,
1923 no_ospf_area_authentication_cmd,
paul718e3742002-12-13 20:15:29 +00001924 "no area (A.B.C.D|<0-4294967295>) authentication",
1925 NO_STR
1926 "OSPF area parameters\n"
1927 "OSPF area ID in IP address format\n"
1928 "OSPF area ID as a decimal value\n"
1929 "Enable authentication\n")
1930{
paul68980082003-03-25 05:07:42 +00001931 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001932 struct ospf_area *area;
1933 struct in_addr area_id;
1934 int format;
1935
1936 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1937
paul68980082003-03-25 05:07:42 +00001938 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001939 if (area == NULL)
1940 return CMD_SUCCESS;
1941
1942 area->auth_type = OSPF_AUTH_NULL;
1943
paul68980082003-03-25 05:07:42 +00001944 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001945
1946 return CMD_SUCCESS;
1947}
1948
1949
1950DEFUN (ospf_abr_type,
1951 ospf_abr_type_cmd,
1952 "ospf abr-type (cisco|ibm|shortcut|standard)",
1953 "OSPF specific commands\n"
1954 "Set OSPF ABR type\n"
1955 "Alternative ABR, cisco implementation\n"
1956 "Alternative ABR, IBM implementation\n"
1957 "Shortcut ABR\n"
1958 "Standard behavior (RFC2328)\n")
1959{
paul68980082003-03-25 05:07:42 +00001960 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001961 u_char abr_type = OSPF_ABR_UNKNOWN;
1962
1963 if (strncmp (argv[0], "c", 1) == 0)
1964 abr_type = OSPF_ABR_CISCO;
1965 else if (strncmp (argv[0], "i", 1) == 0)
1966 abr_type = OSPF_ABR_IBM;
1967 else if (strncmp (argv[0], "sh", 2) == 0)
1968 abr_type = OSPF_ABR_SHORTCUT;
1969 else if (strncmp (argv[0], "st", 2) == 0)
1970 abr_type = OSPF_ABR_STAND;
1971 else
1972 return CMD_WARNING;
1973
1974 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00001975 if (ospf->abr_type != abr_type)
paul718e3742002-12-13 20:15:29 +00001976 {
paul68980082003-03-25 05:07:42 +00001977 ospf->abr_type = abr_type;
1978 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001979 }
1980
1981 return CMD_SUCCESS;
1982}
1983
1984DEFUN (no_ospf_abr_type,
1985 no_ospf_abr_type_cmd,
1986 "no ospf abr-type (cisco|ibm|shortcut)",
1987 NO_STR
1988 "OSPF specific commands\n"
1989 "Set OSPF ABR type\n"
1990 "Alternative ABR, cisco implementation\n"
1991 "Alternative ABR, IBM implementation\n"
1992 "Shortcut ABR\n")
1993{
paul68980082003-03-25 05:07:42 +00001994 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001995 u_char abr_type = OSPF_ABR_UNKNOWN;
1996
1997 if (strncmp (argv[0], "c", 1) == 0)
1998 abr_type = OSPF_ABR_CISCO;
1999 else if (strncmp (argv[0], "i", 1) == 0)
2000 abr_type = OSPF_ABR_IBM;
2001 else if (strncmp (argv[0], "s", 1) == 0)
2002 abr_type = OSPF_ABR_SHORTCUT;
2003 else
2004 return CMD_WARNING;
2005
2006 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00002007 if (ospf->abr_type == abr_type)
paul718e3742002-12-13 20:15:29 +00002008 {
paul68980082003-03-25 05:07:42 +00002009 ospf->abr_type = OSPF_ABR_STAND;
2010 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00002011 }
2012
2013 return CMD_SUCCESS;
2014}
2015
2016DEFUN (ospf_compatible_rfc1583,
2017 ospf_compatible_rfc1583_cmd,
2018 "compatible rfc1583",
2019 "OSPF compatibility list\n"
2020 "compatible with RFC 1583\n")
2021{
2022 struct ospf *ospf = vty->index;
2023
2024 if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2025 {
2026 SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002027 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002028 }
2029 return CMD_SUCCESS;
2030}
2031
2032DEFUN (no_ospf_compatible_rfc1583,
2033 no_ospf_compatible_rfc1583_cmd,
2034 "no compatible rfc1583",
2035 NO_STR
2036 "OSPF compatibility list\n"
2037 "compatible with RFC 1583\n")
2038{
2039 struct ospf *ospf = vty->index;
2040
2041 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2042 {
2043 UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002044 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002045 }
2046 return CMD_SUCCESS;
2047}
2048
2049ALIAS (ospf_compatible_rfc1583,
2050 ospf_rfc1583_flag_cmd,
2051 "ospf rfc1583compatibility",
2052 "OSPF specific commands\n"
2053 "Enable the RFC1583Compatibility flag\n")
2054
2055ALIAS (no_ospf_compatible_rfc1583,
2056 no_ospf_rfc1583_flag_cmd,
2057 "no ospf rfc1583compatibility",
2058 NO_STR
2059 "OSPF specific commands\n"
2060 "Disable the RFC1583Compatibility flag\n")
2061
paula2c62832003-04-23 17:01:31 +00002062DEFUN (ospf_timers_spf,
2063 ospf_timers_spf_cmd,
paul718e3742002-12-13 20:15:29 +00002064 "timers spf <0-4294967295> <0-4294967295>",
2065 "Adjust routing timers\n"
2066 "OSPF SPF timers\n"
2067 "Delay between receiving a change to SPF calculation\n"
2068 "Hold time between consecutive SPF calculations\n")
2069{
2070 struct ospf *ospf = vty->index;
2071 u_int32_t delay, hold;
2072
2073 VTY_GET_UINT32 ("SPF delay timer", delay, argv[0]);
2074 VTY_GET_UINT32 ("SPF hold timer", hold, argv[1]);
2075
2076 ospf_timers_spf_set (ospf, delay, hold);
2077
2078 return CMD_SUCCESS;
2079}
2080
paula2c62832003-04-23 17:01:31 +00002081DEFUN (no_ospf_timers_spf,
2082 no_ospf_timers_spf_cmd,
paul718e3742002-12-13 20:15:29 +00002083 "no timers spf",
2084 NO_STR
2085 "Adjust routing timers\n"
2086 "OSPF SPF timers\n")
2087{
paul68980082003-03-25 05:07:42 +00002088 struct ospf *ospf = vty->index;
2089
2090 ospf->spf_delay = OSPF_SPF_DELAY_DEFAULT;
2091 ospf->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002092
2093 return CMD_SUCCESS;
2094}
2095
2096
paula2c62832003-04-23 17:01:31 +00002097DEFUN (ospf_neighbor,
2098 ospf_neighbor_cmd,
paul718e3742002-12-13 20:15:29 +00002099 "neighbor A.B.C.D",
2100 NEIGHBOR_STR
2101 "Neighbor IP address\n")
2102{
2103 struct ospf *ospf = vty->index;
2104 struct in_addr nbr_addr;
2105 int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2106 int interval = OSPF_POLL_INTERVAL_DEFAULT;
2107
2108 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2109
2110 if (argc > 1)
2111 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255);
2112
2113 if (argc > 2)
2114 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535);
2115
2116 ospf_nbr_nbma_set (ospf, nbr_addr);
2117 if (argc > 1)
2118 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2119 if (argc > 2)
2120 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority);
2121
2122 return CMD_SUCCESS;
2123}
2124
paula2c62832003-04-23 17:01:31 +00002125ALIAS (ospf_neighbor,
2126 ospf_neighbor_priority_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002127 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2128 NEIGHBOR_STR
2129 "Neighbor IP address\n"
2130 "Neighbor Priority\n"
2131 "Priority\n"
2132 "Dead Neighbor Polling interval\n"
2133 "Seconds\n")
2134
paula2c62832003-04-23 17:01:31 +00002135ALIAS (ospf_neighbor,
2136 ospf_neighbor_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002137 "neighbor A.B.C.D priority <0-255>",
2138 NEIGHBOR_STR
2139 "Neighbor IP address\n"
2140 "Neighbor Priority\n"
2141 "Seconds\n")
2142
paula2c62832003-04-23 17:01:31 +00002143DEFUN (ospf_neighbor_poll_interval,
2144 ospf_neighbor_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002145 "neighbor A.B.C.D poll-interval <1-65535>",
2146 NEIGHBOR_STR
2147 "Neighbor IP address\n"
2148 "Dead Neighbor Polling interval\n"
2149 "Seconds\n")
2150{
2151 struct ospf *ospf = vty->index;
2152 struct in_addr nbr_addr;
2153 int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2154 int interval = OSPF_POLL_INTERVAL_DEFAULT;
2155
2156 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2157
2158 if (argc > 1)
2159 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535);
2160
2161 if (argc > 2)
2162 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255);
2163
2164 ospf_nbr_nbma_set (ospf, nbr_addr);
2165 if (argc > 1)
2166 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
2167 if (argc > 2)
2168 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2169
2170 return CMD_SUCCESS;
2171}
2172
paula2c62832003-04-23 17:01:31 +00002173ALIAS (ospf_neighbor_poll_interval,
2174 ospf_neighbor_poll_interval_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002175 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2176 NEIGHBOR_STR
2177 "Neighbor address\n"
2178 "OSPF dead-router polling interval\n"
2179 "Seconds\n"
2180 "OSPF priority of non-broadcast neighbor\n"
2181 "Priority\n")
2182
paula2c62832003-04-23 17:01:31 +00002183DEFUN (no_ospf_neighbor,
2184 no_ospf_neighbor_cmd,
paul718e3742002-12-13 20:15:29 +00002185 "no neighbor A.B.C.D",
2186 NO_STR
2187 NEIGHBOR_STR
2188 "Neighbor IP address\n")
2189{
2190 struct ospf *ospf = vty->index;
2191 struct in_addr nbr_addr;
2192 int ret;
2193
2194 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2195
2196 ret = ospf_nbr_nbma_unset (ospf, nbr_addr);
2197
2198 return CMD_SUCCESS;
2199}
2200
paula2c62832003-04-23 17:01:31 +00002201ALIAS (no_ospf_neighbor,
2202 no_ospf_neighbor_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002203 "no neighbor A.B.C.D priority <0-255>",
2204 NO_STR
2205 NEIGHBOR_STR
2206 "Neighbor IP address\n"
2207 "Neighbor Priority\n"
2208 "Priority\n")
2209
paula2c62832003-04-23 17:01:31 +00002210ALIAS (no_ospf_neighbor,
2211 no_ospf_neighbor_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002212 "no neighbor A.B.C.D poll-interval <1-65535>",
2213 NO_STR
2214 NEIGHBOR_STR
2215 "Neighbor IP address\n"
2216 "Dead Neighbor Polling interval\n"
2217 "Seconds\n")
2218
paula2c62832003-04-23 17:01:31 +00002219ALIAS (no_ospf_neighbor,
2220 no_ospf_neighbor_priority_pollinterval_cmd,
paul718e3742002-12-13 20:15:29 +00002221 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2222 NO_STR
2223 NEIGHBOR_STR
2224 "Neighbor IP address\n"
2225 "Neighbor Priority\n"
2226 "Priority\n"
2227 "Dead Neighbor Polling interval\n"
2228 "Seconds\n")
2229
2230
paula2c62832003-04-23 17:01:31 +00002231DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd,
paul718e3742002-12-13 20:15:29 +00002232 "refresh timer <10-1800>",
2233 "Adjust refresh parameters\n"
2234 "Set refresh timer\n"
2235 "Timer value in seconds\n")
2236{
2237 struct ospf *ospf = vty->index;
2238 int interval;
2239
2240 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2241 interval = (interval / 10) * 10;
2242
2243 ospf_timers_refresh_set (ospf, interval);
2244
2245 return CMD_SUCCESS;
2246}
2247
paula2c62832003-04-23 17:01:31 +00002248DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd,
paul718e3742002-12-13 20:15:29 +00002249 "no refresh timer <10-1800>",
2250 "Adjust refresh parameters\n"
2251 "Unset refresh timer\n"
2252 "Timer value in seconds\n")
2253{
2254 struct ospf *ospf = vty->index;
2255 int interval;
2256
2257 if (argc == 1)
2258 {
2259 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2260
2261 if (ospf->lsa_refresh_interval != interval ||
2262 interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
2263 return CMD_SUCCESS;
2264 }
2265
2266 ospf_timers_refresh_unset (ospf);
2267
2268 return CMD_SUCCESS;
2269}
2270
paula2c62832003-04-23 17:01:31 +00002271ALIAS (no_ospf_refresh_timer,
2272 no_ospf_refresh_timer_cmd,
paul718e3742002-12-13 20:15:29 +00002273 "no refresh timer",
2274 "Adjust refresh parameters\n"
2275 "Unset refresh timer\n")
2276
paula2c62832003-04-23 17:01:31 +00002277DEFUN (ospf_auto_cost_reference_bandwidth,
2278 ospf_auto_cost_reference_bandwidth_cmd,
paul718e3742002-12-13 20:15:29 +00002279 "auto-cost reference-bandwidth <1-4294967>",
2280 "Calculate OSPF interface cost according to bandwidth\n"
2281 "Use reference bandwidth method to assign OSPF cost\n"
2282 "The reference bandwidth in terms of Mbits per second\n")
2283{
paul68980082003-03-25 05:07:42 +00002284 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002285 u_int32_t refbw;
2286 listnode node;
2287
2288 refbw = strtol (argv[0], NULL, 10);
2289 if (refbw < 1 || refbw > 4294967)
2290 {
2291 vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
2292 return CMD_WARNING;
2293 }
2294
2295 /* If reference bandwidth is changed. */
paul68980082003-03-25 05:07:42 +00002296 if ((refbw * 1000) == ospf->ref_bandwidth)
paul718e3742002-12-13 20:15:29 +00002297 return CMD_SUCCESS;
2298
paul68980082003-03-25 05:07:42 +00002299 ospf->ref_bandwidth = refbw * 1000;
paul718e3742002-12-13 20:15:29 +00002300 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2301 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2302
paul020709f2003-04-04 02:44:16 +00002303 for (node = listhead (om->iflist); node; nextnode (node))
2304 ospf_if_recalculate_output_cost (getdata (node));
paul718e3742002-12-13 20:15:29 +00002305
2306 return CMD_SUCCESS;
2307}
2308
paula2c62832003-04-23 17:01:31 +00002309DEFUN (no_ospf_auto_cost_reference_bandwidth,
2310 no_ospf_auto_cost_reference_bandwidth_cmd,
paul718e3742002-12-13 20:15:29 +00002311 "no auto-cost reference-bandwidth",
2312 NO_STR
2313 "Calculate OSPF interface cost according to bandwidth\n"
2314 "Use reference bandwidth method to assign OSPF cost\n")
2315{
paul68980082003-03-25 05:07:42 +00002316 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002317 listnode node;
2318
paul68980082003-03-25 05:07:42 +00002319 if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00002320 return CMD_SUCCESS;
2321
paul68980082003-03-25 05:07:42 +00002322 ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;
paul718e3742002-12-13 20:15:29 +00002323 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2324 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2325
paul020709f2003-04-04 02:44:16 +00002326 for (node = listhead (om->iflist); node; nextnode (node))
2327 ospf_if_recalculate_output_cost (getdata (node));
paul718e3742002-12-13 20:15:29 +00002328
2329 return CMD_SUCCESS;
2330}
2331
paul718e3742002-12-13 20:15:29 +00002332char *ospf_abr_type_descr_str[] =
2333{
2334 "Unknown",
2335 "Standard (RFC2328)",
2336 "Alternative IBM",
2337 "Alternative Cisco",
2338 "Alternative Shortcut"
2339};
2340
2341char *ospf_shortcut_mode_descr_str[] =
2342{
2343 "Default",
2344 "Enabled",
2345 "Disabled"
2346};
2347
2348
2349
2350void
2351show_ip_ospf_area (struct vty *vty, struct ospf_area *area)
2352{
2353 /* Show Area ID. */
2354 vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id));
2355
2356 /* Show Area type/mode. */
2357 if (OSPF_IS_AREA_BACKBONE (area))
2358 vty_out (vty, " (Backbone)%s", VTY_NEWLINE);
2359 else
2360 {
2361 if (area->external_routing == OSPF_AREA_STUB)
2362 vty_out (vty, " (Stub%s%s)",
2363 area->no_summary ? ", no summary" : "",
2364 area->shortcut_configured ? "; " : "");
2365
2366#ifdef HAVE_NSSA
2367
2368 else
2369 if (area->external_routing == OSPF_AREA_NSSA)
2370 vty_out (vty, " (NSSA%s%s)",
2371 area->no_summary ? ", no summary" : "",
2372 area->shortcut_configured ? "; " : "");
2373#endif /* HAVE_NSSA */
2374
2375 vty_out (vty, "%s", VTY_NEWLINE);
2376 vty_out (vty, " Shortcutting mode: %s",
2377 ospf_shortcut_mode_descr_str[area->shortcut_configured]);
2378 vty_out (vty, ", S-bit consensus: %s%s",
2379 area->shortcut_capability ? "ok" : "no", VTY_NEWLINE);
2380 }
2381
2382 /* Show number of interfaces. */
2383 vty_out (vty, " Number of interfaces in this area: Total: %d, "
2384 "Active: %d%s", listcount (area->oiflist),
2385 area->act_ints, VTY_NEWLINE);
2386
2387#ifdef HAVE_NSSA
2388 if (area->external_routing == OSPF_AREA_NSSA)
2389 {
2390 vty_out (vty, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE, VTY_NEWLINE);
paul020709f2003-04-04 02:44:16 +00002391 if (! IS_OSPF_ABR (area->ospf))
paul718e3742002-12-13 20:15:29 +00002392 vty_out (vty, " It is not ABR, therefore not Translator. %s",
2393 VTY_NEWLINE);
2394 else
2395 {
2396 if (area->NSSATranslator)
2397 vty_out (vty, " We are an ABR and the NSSA Elected Translator. %s", VTY_NEWLINE);
2398 else
2399 vty_out (vty, " We are an ABR, but not the NSSA Elected Translator. %s", VTY_NEWLINE);
2400 }
2401 }
2402#endif /* HAVE_NSSA */
2403
2404 /* Show number of fully adjacent neighbors. */
2405 vty_out (vty, " Number of fully adjacent neighbors in this area:"
2406 " %d%s", area->full_nbrs, VTY_NEWLINE);
2407
2408 /* Show authentication type. */
2409 vty_out (vty, " Area has ");
2410 if (area->auth_type == OSPF_AUTH_NULL)
2411 vty_out (vty, "no authentication%s", VTY_NEWLINE);
2412 else if (area->auth_type == OSPF_AUTH_SIMPLE)
2413 vty_out (vty, "simple password authentication%s", VTY_NEWLINE);
2414 else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC)
2415 vty_out (vty, "message digest authentication%s", VTY_NEWLINE);
2416
2417 if (!OSPF_IS_AREA_BACKBONE (area))
2418 vty_out (vty, " Number of full virtual adjacencies going through"
2419 " this area: %d%s", area->full_vls, VTY_NEWLINE);
2420
2421 /* Show SPF calculation times. */
2422 vty_out (vty, " SPF algorithm executed %d times%s",
2423 area->spf_calculation, VTY_NEWLINE);
2424
2425 /* Show number of LSA. */
2426 vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE);
2427
2428 vty_out (vty, "%s", VTY_NEWLINE);
2429}
2430
2431DEFUN (show_ip_ospf,
2432 show_ip_ospf_cmd,
2433 "show ip ospf",
2434 SHOW_STR
2435 IP_STR
2436 "OSPF information\n")
2437{
2438 listnode node;
2439 struct ospf_area * area;
paul020709f2003-04-04 02:44:16 +00002440 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002441
2442 /* Check OSPF is enable. */
paul020709f2003-04-04 02:44:16 +00002443 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002444 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002445 {
2446 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2447 return CMD_SUCCESS;
2448 }
2449
2450 /* Show Router ID. */
2451 vty_out (vty, " OSPF Routing Process, Router ID: %s%s",
paul68980082003-03-25 05:07:42 +00002452 inet_ntoa (ospf->router_id),
paul718e3742002-12-13 20:15:29 +00002453 VTY_NEWLINE);
2454
2455 /* Show capability. */
2456 vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE);
2457 vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE);
2458 vty_out (vty, " RFC1583Compatibility flag is %s%s",
paul68980082003-03-25 05:07:42 +00002459 CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?
paul718e3742002-12-13 20:15:29 +00002460 "enabled" : "disabled", VTY_NEWLINE);
2461#ifdef HAVE_OPAQUE_LSA
2462 vty_out (vty, " OpaqueCapability flag is %s%s%s",
paul68980082003-03-25 05:07:42 +00002463 CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ?
paul718e3742002-12-13 20:15:29 +00002464 "enabled" : "disabled",
paul68980082003-03-25 05:07:42 +00002465 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ?
paul718e3742002-12-13 20:15:29 +00002466 " (origination blocked)" : "",
2467 VTY_NEWLINE);
2468#endif /* HAVE_OPAQUE_LSA */
2469
2470 /* Show SPF timers. */
2471 vty_out (vty, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s",
paul68980082003-03-25 05:07:42 +00002472 ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002473
2474 /* Show refresh parameters. */
2475 vty_out (vty, " Refresh timer %d secs%s",
paul68980082003-03-25 05:07:42 +00002476 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002477
2478 /* Show ABR/ASBR flags. */
paul68980082003-03-25 05:07:42 +00002479 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR))
paul718e3742002-12-13 20:15:29 +00002480 vty_out (vty, " This router is an ABR, ABR type is: %s%s",
paul68980082003-03-25 05:07:42 +00002481 ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002482
paul68980082003-03-25 05:07:42 +00002483 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR))
paul718e3742002-12-13 20:15:29 +00002484 vty_out (vty, " This router is an ASBR "
2485 "(injecting external routing information)%s", VTY_NEWLINE);
2486
2487 /* Show Number of AS-external-LSAs. */
2488 vty_out (vty, " Number of external LSA %ld%s",
paul68980082003-03-25 05:07:42 +00002489 ospf_lsdb_count_all (ospf->lsdb), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002490
2491 /* Show number of areas attached. */
2492 vty_out (vty, " Number of areas attached to this router: %d%s%s",
paul68980082003-03-25 05:07:42 +00002493 listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002494
2495 /* Show each area status. */
paul68980082003-03-25 05:07:42 +00002496 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002497 if ((area = getdata (node)) != NULL)
2498 show_ip_ospf_area (vty, area);
2499
2500 return CMD_SUCCESS;
2501}
2502
2503
2504void
paul68980082003-03-25 05:07:42 +00002505show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
2506 struct interface *ifp)
paul718e3742002-12-13 20:15:29 +00002507{
2508 struct ospf_neighbor *nbr;
2509 int oi_count;
2510 struct route_node *rn;
2511 char buf[9];
2512
2513 oi_count = ospf_oi_count (ifp);
2514
2515 /* Is interface up? */
paul2e3b2e42002-12-13 21:03:13 +00002516 if (if_is_operative (ifp)) {
2517 vty_out (vty, "%s is up%s", ifp->name, VTY_NEWLINE);
2518 } else
2519 {
2520 vty_out (vty, "%s is down%s", ifp->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002521
2522
2523 if (oi_count == 0)
2524 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
2525 else
2526 vty_out (vty, " OSPF is enabled, but not running on this interface%s",
2527 VTY_NEWLINE);
2528 return;
2529 }
2530
2531 /* Is interface OSPF enabled? */
2532 if (oi_count == 0)
2533 {
2534 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
2535 return;
2536 }
2537
2538 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
2539 {
2540 struct ospf_interface *oi = rn->info;
2541
2542 if (oi == NULL)
2543 continue;
2544
2545 /* Show OSPF interface information. */
2546 vty_out (vty, " Internet Address %s/%d,",
2547 inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
2548
2549 vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
2550 VTY_NEWLINE);
2551
2552 vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s",
paul68980082003-03-25 05:07:42 +00002553 inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
paul718e3742002-12-13 20:15:29 +00002554 oi->output_cost, VTY_NEWLINE);
2555
2556 vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s",
2557 OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state),
2558 PRIORITY (oi), VTY_NEWLINE);
2559
2560 /* Show DR information. */
2561 if (DR (oi).s_addr == 0)
2562 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2563 else
2564 {
2565 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi));
2566 if (nbr == NULL)
2567 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2568 else
2569 {
2570 vty_out (vty, " Designated Router (ID) %s,",
2571 inet_ntoa (nbr->router_id));
2572 vty_out (vty, " Interface Address %s%s",
2573 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2574 }
2575 }
2576
2577 /* Show BDR information. */
2578 if (BDR (oi).s_addr == 0)
2579 vty_out (vty, " No backup designated router on this network%s",
2580 VTY_NEWLINE);
2581 else
2582 {
2583 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi));
2584 if (nbr == NULL)
2585 vty_out (vty, " No backup designated router on this network%s",
2586 VTY_NEWLINE);
2587 else
2588 {
2589 vty_out (vty, " Backup Designated Router (ID) %s,",
2590 inet_ntoa (nbr->router_id));
2591 vty_out (vty, " Interface Address %s%s",
2592 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2593 }
2594 }
2595 vty_out (vty, " Timer intervals configured,");
2596 vty_out (vty, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2597 OSPF_IF_PARAM (oi, v_hello), OSPF_IF_PARAM (oi, v_wait),
2598 OSPF_IF_PARAM (oi, v_wait),
2599 OSPF_IF_PARAM (oi, retransmit_interval),
2600 VTY_NEWLINE);
2601
2602 if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE)
2603 vty_out (vty, " Hello due in %s%s",
2604 ospf_timer_dump (oi->t_hello, buf, 9), VTY_NEWLINE);
2605 else /* OSPF_IF_PASSIVE is set */
2606 vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
2607
2608 vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
paul68980082003-03-25 05:07:42 +00002609 ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full),
paul718e3742002-12-13 20:15:29 +00002610 VTY_NEWLINE);
2611 }
2612}
2613
2614DEFUN (show_ip_ospf_interface,
2615 show_ip_ospf_interface_cmd,
2616 "show ip ospf interface [INTERFACE]",
2617 SHOW_STR
2618 IP_STR
2619 "OSPF information\n"
2620 "Interface information\n"
2621 "Interface name\n")
2622{
2623 struct interface *ifp;
paul020709f2003-04-04 02:44:16 +00002624 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002625 listnode node;
2626
paul020709f2003-04-04 02:44:16 +00002627 ospf = ospf_lookup ();
2628
paul718e3742002-12-13 20:15:29 +00002629 /* Show All Interfaces. */
2630 if (argc == 0)
2631 for (node = listhead (iflist); node; nextnode (node))
paul68980082003-03-25 05:07:42 +00002632 show_ip_ospf_interface_sub (vty, ospf, node->data);
paul718e3742002-12-13 20:15:29 +00002633 /* Interface name is specified. */
2634 else
2635 {
2636 if ((ifp = if_lookup_by_name (argv[0])) == NULL)
2637 vty_out (vty, "No such interface name%s", VTY_NEWLINE);
2638 else
paul68980082003-03-25 05:07:42 +00002639 show_ip_ospf_interface_sub (vty, ospf, ifp);
paul718e3742002-12-13 20:15:29 +00002640 }
2641
2642 return CMD_SUCCESS;
2643}
2644
2645void
2646show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi)
2647{
2648 struct route_node *rn;
2649 struct ospf_neighbor *nbr;
2650 char msgbuf[16];
2651 char timebuf[9];
2652
2653 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2654 if ((nbr = rn->info))
2655 /* Do not show myself. */
2656 if (nbr != oi->nbr_self)
2657 /* Down state is not shown. */
2658 if (nbr->state != NSM_Down)
2659 {
2660 ospf_nbr_state_message (nbr, msgbuf, 16);
2661
2662 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
2663 vty_out (vty, "%-15s %3d %-15s %8s ",
2664 "-", nbr->priority,
2665 msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9));
2666 else
2667 vty_out (vty, "%-15s %3d %-15s %8s ",
2668 inet_ntoa (nbr->router_id), nbr->priority,
2669 msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9));
2670 vty_out (vty, "%-15s ", inet_ntoa (nbr->src));
2671 vty_out (vty, "%-15s %5ld %5ld %5d%s",
2672 IF_NAME (oi), ospf_ls_retransmit_count (nbr),
2673 ospf_ls_request_count (nbr), ospf_db_summary_count (nbr),
2674 VTY_NEWLINE);
2675 }
2676}
2677
2678DEFUN (show_ip_ospf_neighbor,
2679 show_ip_ospf_neighbor_cmd,
2680 "show ip ospf neighbor",
2681 SHOW_STR
2682 IP_STR
2683 "OSPF information\n"
2684 "Neighbor list\n")
2685{
paul020709f2003-04-04 02:44:16 +00002686 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002687 listnode node;
2688
paul020709f2003-04-04 02:44:16 +00002689 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002690 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002691 {
2692 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2693 return CMD_SUCCESS;
2694 }
2695
2696 /* Show All neighbors. */
2697 vty_out (vty, "%sNeighbor ID Pri State Dead "
2698 "Time Address Interface RXmtL "
2699 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2700
paul68980082003-03-25 05:07:42 +00002701 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul020709f2003-04-04 02:44:16 +00002702 show_ip_ospf_neighbor_sub (vty, getdata (node));
paul718e3742002-12-13 20:15:29 +00002703
2704 return CMD_SUCCESS;
2705}
2706
2707DEFUN (show_ip_ospf_neighbor_all,
2708 show_ip_ospf_neighbor_all_cmd,
2709 "show ip ospf neighbor all",
2710 SHOW_STR
2711 IP_STR
2712 "OSPF information\n"
2713 "Neighbor list\n"
2714 "include down status neighbor\n")
2715{
paul68980082003-03-25 05:07:42 +00002716 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002717 listnode node;
2718
paul68980082003-03-25 05:07:42 +00002719 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002720 {
2721 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2722 return CMD_SUCCESS;
2723 }
2724
2725 /* Show All neighbors. */
2726 vty_out (vty, "%sNeighbor ID Pri State Dead "
2727 "Time Address Interface RXmtL "
2728 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2729
paul68980082003-03-25 05:07:42 +00002730 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002731 {
2732 struct ospf_interface *oi = getdata (node);
2733 listnode nbr_node;
2734
2735 show_ip_ospf_neighbor_sub (vty, oi);
2736
2737 /* print Down neighbor status */
2738 for (nbr_node = listhead (oi->nbr_nbma); nbr_node; nextnode (nbr_node))
2739 {
2740 struct ospf_nbr_nbma *nbr_nbma;
2741
2742 nbr_nbma = getdata (nbr_node);
2743
2744 if (nbr_nbma->nbr == NULL
2745 || nbr_nbma->nbr->state == NSM_Down)
2746 {
2747 vty_out (vty, "%-15s %3d %-15s %8s ",
2748 "-", nbr_nbma->priority, "Down", "-");
2749 vty_out (vty, "%-15s %-15s %5d %5d %5d%s",
2750 inet_ntoa (nbr_nbma->addr), IF_NAME (oi),
2751 0, 0, 0, VTY_NEWLINE);
2752 }
2753 }
2754 }
2755
2756 return CMD_SUCCESS;
2757}
2758
2759DEFUN (show_ip_ospf_neighbor_int,
2760 show_ip_ospf_neighbor_int_cmd,
2761 "show ip ospf neighbor A.B.C.D",
2762 SHOW_STR
2763 IP_STR
2764 "OSPF information\n"
2765 "Neighbor list\n"
2766 "Interface name\n")
2767{
paul020709f2003-04-04 02:44:16 +00002768 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002769 struct ospf_interface *oi;
2770 struct in_addr addr;
2771 int ret;
2772
paul718e3742002-12-13 20:15:29 +00002773 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
paul020709f2003-04-04 02:44:16 +00002781 ospf = ospf_lookup ();
2782 if (ospf == NULL)
2783 {
2784 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2785 return CMD_SUCCESS;
2786 }
2787
paul68980082003-03-25 05:07:42 +00002788 if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL)
paul718e3742002-12-13 20:15:29 +00002789 vty_out (vty, "No such interface address%s", VTY_NEWLINE);
2790 else
2791 {
2792 vty_out (vty, "%sNeighbor ID Pri State Dead "
2793 "Time Address Interface RXmtL "
2794 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2795 show_ip_ospf_neighbor_sub (vty, oi);
2796 }
2797
2798 return CMD_SUCCESS;
2799}
2800
2801void
2802show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi,
2803 struct ospf_nbr_nbma *nbr_nbma)
2804{
2805 char timebuf[9];
2806
2807 /* Show neighbor ID. */
2808 vty_out (vty, " Neighbor %s,", "-");
2809
2810 /* Show interface address. */
2811 vty_out (vty, " interface address %s%s",
2812 inet_ntoa (nbr_nbma->addr), VTY_NEWLINE);
2813 /* Show Area ID. */
2814 vty_out (vty, " In the area %s via interface %s%s",
2815 ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE);
2816 /* Show neighbor priority and state. */
2817 vty_out (vty, " Neighbor priority is %d, State is %s,",
2818 nbr_nbma->priority, "Down");
2819 /* Show state changes. */
2820 vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE);
2821
2822 /* Show PollInterval */
2823 vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE);
2824
2825 /* Show poll-interval timer. */
2826 vty_out (vty, " Poll timer due in %s%s",
2827 ospf_timer_dump (nbr_nbma->t_poll, timebuf, 9), VTY_NEWLINE);
2828
2829 /* Show poll-interval timer thread. */
2830 vty_out (vty, " Thread Poll Timer %s%s",
2831 nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE);
2832}
2833
2834void
2835show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
2836 struct ospf_neighbor *nbr)
2837{
2838 char timebuf[9];
2839
2840 /* Show neighbor ID. */
2841 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
2842 vty_out (vty, " Neighbor %s,", "-");
2843 else
2844 vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id));
2845
2846 /* Show interface address. */
2847 vty_out (vty, " interface address %s%s",
2848 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2849 /* Show Area ID. */
2850 vty_out (vty, " In the area %s via interface %s%s",
2851 ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE);
2852 /* Show neighbor priority and state. */
2853 vty_out (vty, " Neighbor priority is %d, State is %s,",
2854 nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state));
2855 /* Show state changes. */
2856 vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
2857
2858 /* Show Designated Rotuer ID. */
2859 vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router));
2860 /* Show Backup Designated Rotuer ID. */
2861 vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE);
2862 /* Show options. */
2863 vty_out (vty, " Options %d %s%s", nbr->options,
2864 ospf_options_dump (nbr->options), VTY_NEWLINE);
2865 /* Show Router Dead interval timer. */
2866 vty_out (vty, " Dead timer due in %s%s",
2867 ospf_timer_dump (nbr->t_inactivity, timebuf, 9), VTY_NEWLINE);
2868 /* Show Database Summary list. */
2869 vty_out (vty, " Database Summary List %d%s",
2870 ospf_db_summary_count (nbr), VTY_NEWLINE);
2871 /* Show Link State Request list. */
2872 vty_out (vty, " Link State Request List %ld%s",
2873 ospf_ls_request_count (nbr), VTY_NEWLINE);
2874 /* Show Link State Retransmission list. */
2875 vty_out (vty, " Link State Retransmission List %ld%s",
2876 ospf_ls_retransmit_count (nbr), VTY_NEWLINE);
2877 /* Show inactivity timer thread. */
2878 vty_out (vty, " Thread Inactivity Timer %s%s",
2879 nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE);
2880 /* Show Database Description retransmission thread. */
2881 vty_out (vty, " Thread Database Description Retransmision %s%s",
2882 nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE);
2883 /* Show Link State Request Retransmission thread. */
2884 vty_out (vty, " Thread Link State Request Retransmission %s%s",
2885 nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE);
2886 /* Show Link State Update Retransmission thread. */
2887 vty_out (vty, " Thread Link State Update Retransmission %s%s%s",
2888 nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE);
2889}
2890
2891DEFUN (show_ip_ospf_neighbor_id,
2892 show_ip_ospf_neighbor_id_cmd,
2893 "show ip ospf neighbor A.B.C.D",
2894 SHOW_STR
2895 IP_STR
2896 "OSPF information\n"
2897 "Neighbor list\n"
2898 "Neighbor ID\n")
2899{
paul020709f2003-04-04 02:44:16 +00002900 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002901 listnode node;
2902 struct ospf_neighbor *nbr;
2903 struct in_addr router_id;
2904 int ret;
2905
2906 ret = inet_aton (argv[0], &router_id);
2907 if (!ret)
2908 {
2909 vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE);
2910 return CMD_WARNING;
2911 }
2912
paul020709f2003-04-04 02:44:16 +00002913 ospf = ospf_lookup ();
2914 if (ospf == NULL)
2915 {
2916 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2917 return CMD_SUCCESS;
2918 }
2919
paul68980082003-03-25 05:07:42 +00002920 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002921 {
2922 struct ospf_interface *oi = getdata (node);
2923
2924 if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id)))
2925 {
2926 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
2927 return CMD_SUCCESS;
2928 }
2929 }
2930
2931 /* Nothing to show. */
2932 return CMD_SUCCESS;
2933}
2934
2935DEFUN (show_ip_ospf_neighbor_detail,
2936 show_ip_ospf_neighbor_detail_cmd,
2937 "show ip ospf neighbor detail",
2938 SHOW_STR
2939 IP_STR
2940 "OSPF information\n"
2941 "Neighbor list\n"
2942 "detail of all neighbors\n")
2943{
paul020709f2003-04-04 02:44:16 +00002944 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002945 listnode node;
2946
paul020709f2003-04-04 02:44:16 +00002947 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002948 if (ospf == NULL)
paul020709f2003-04-04 02:44:16 +00002949 {
2950 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2951 return CMD_SUCCESS;
2952 }
paul718e3742002-12-13 20:15:29 +00002953
paul68980082003-03-25 05:07:42 +00002954 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002955 {
2956 struct ospf_interface *oi = getdata (node);
2957 struct route_node *rn;
2958 struct ospf_neighbor *nbr;
2959
2960 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2961 if ((nbr = rn->info))
2962 if (nbr != oi->nbr_self)
2963 if (nbr->state != NSM_Down)
2964 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
2965 }
2966
2967 return CMD_SUCCESS;
2968}
2969
2970DEFUN (show_ip_ospf_neighbor_detail_all,
2971 show_ip_ospf_neighbor_detail_all_cmd,
2972 "show ip ospf neighbor detail all",
2973 SHOW_STR
2974 IP_STR
2975 "OSPF information\n"
2976 "Neighbor list\n"
2977 "detail of all neighbors\n"
2978 "include down status neighbor\n")
2979{
paul020709f2003-04-04 02:44:16 +00002980 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002981 listnode node;
2982
paul020709f2003-04-04 02:44:16 +00002983 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002984 if (ospf == NULL)
paul020709f2003-04-04 02:44:16 +00002985 {
2986 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2987 return CMD_SUCCESS;
2988 }
paul718e3742002-12-13 20:15:29 +00002989
paul68980082003-03-25 05:07:42 +00002990 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00002991 {
2992 struct ospf_interface *oi = getdata (node);
2993 struct route_node *rn;
2994 struct ospf_neighbor *nbr;
2995
2996 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2997 if ((nbr = rn->info))
2998 if (nbr != oi->nbr_self)
2999 if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down)
3000 show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info);
3001
3002 if (oi->type == OSPF_IFTYPE_NBMA)
3003 {
3004 listnode nd;
3005
3006 for (nd = listhead (oi->nbr_nbma); nd; nextnode (nd))
3007 {
3008 struct ospf_nbr_nbma *nbr_nbma = getdata (nd);
3009 if (nbr_nbma->nbr == NULL
3010 || nbr_nbma->nbr->state == NSM_Down)
3011 show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma);
3012 }
3013 }
3014 }
3015
3016 return CMD_SUCCESS;
3017}
3018
3019DEFUN (show_ip_ospf_neighbor_int_detail,
3020 show_ip_ospf_neighbor_int_detail_cmd,
3021 "show ip ospf neighbor A.B.C.D detail",
3022 SHOW_STR
3023 IP_STR
3024 "OSPF information\n"
3025 "Neighbor list\n"
3026 "Interface address\n"
3027 "detail of all neighbors")
3028{
paul020709f2003-04-04 02:44:16 +00003029 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003030 struct ospf_interface *oi;
3031 struct in_addr addr;
3032 int ret;
3033
3034 ret = inet_aton (argv[0], &addr);
3035 if (!ret)
3036 {
3037 vty_out (vty, "Please specify interface address by A.B.C.D%s",
3038 VTY_NEWLINE);
3039 return CMD_WARNING;
3040 }
3041
paul020709f2003-04-04 02:44:16 +00003042 ospf = ospf_lookup ();
3043 if (ospf == NULL)
3044 {
3045 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3046 return CMD_SUCCESS;
3047 }
paul68980082003-03-25 05:07:42 +00003048
paul020709f2003-04-04 02:44:16 +00003049 if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL)
paul718e3742002-12-13 20:15:29 +00003050 vty_out (vty, "No such interface address%s", VTY_NEWLINE);
3051 else
3052 {
3053 struct route_node *rn;
3054 struct ospf_neighbor *nbr;
3055
3056 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3057 if ((nbr = rn->info))
3058 if (nbr != oi->nbr_self)
3059 if (nbr->state != NSM_Down)
3060 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
3061 }
3062
3063 return CMD_SUCCESS;
3064}
3065
3066
3067/* Show functions */
3068int
paul020709f2003-04-04 02:44:16 +00003069show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)
paul718e3742002-12-13 20:15:29 +00003070{
paul718e3742002-12-13 20:15:29 +00003071 struct router_lsa *rl;
3072 struct summary_lsa *sl;
3073 struct as_external_lsa *asel;
3074 struct prefix_ipv4 p;
3075
3076 if (lsa != NULL)
3077 /* If self option is set, check LSA self flag. */
3078 if (self == 0 || IS_LSA_SELF (lsa))
3079 {
3080 /* LSA common part show. */
3081 vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id));
3082 vty_out (vty, "%-15s %4d 0x%08lx 0x%04x",
3083 inet_ntoa (lsa->data->adv_router), LS_AGE (lsa),
3084 (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum));
3085 /* LSA specific part show. */
3086 switch (lsa->data->type)
3087 {
3088 case OSPF_ROUTER_LSA:
3089 rl = (struct router_lsa *) lsa->data;
3090 vty_out (vty, " %-d", ntohs (rl->links));
3091 break;
3092 case OSPF_SUMMARY_LSA:
3093 sl = (struct summary_lsa *) lsa->data;
3094
3095 p.family = AF_INET;
3096 p.prefix = sl->header.id;
3097 p.prefixlen = ip_masklen (sl->mask);
3098 apply_mask_ipv4 (&p);
3099
3100 vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen);
3101 break;
3102 case OSPF_AS_EXTERNAL_LSA:
paul551a8972003-05-18 15:22:55 +00003103#ifdef HAVE_NSSA
3104 case OSPF_AS_NSSA_LSA:
3105#endif /* HAVE_NSSA */
paul718e3742002-12-13 20:15:29 +00003106 asel = (struct as_external_lsa *) lsa->data;
3107
3108 p.family = AF_INET;
3109 p.prefix = asel->header.id;
3110 p.prefixlen = ip_masklen (asel->mask);
3111 apply_mask_ipv4 (&p);
3112
3113 vty_out (vty, " %s %s/%d [0x%lx]",
3114 IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1",
3115 inet_ntoa (p.prefix), p.prefixlen,
3116 (u_long)ntohl (asel->e[0].route_tag));
3117 break;
3118 case OSPF_NETWORK_LSA:
3119 case OSPF_ASBR_SUMMARY_LSA:
3120#ifdef HAVE_OPAQUE_LSA
3121 case OSPF_OPAQUE_LINK_LSA:
3122 case OSPF_OPAQUE_AREA_LSA:
3123 case OSPF_OPAQUE_AS_LSA:
3124#endif /* HAVE_OPAQUE_LSA */
3125 default:
3126 break;
3127 }
3128 vty_out (vty, VTY_NEWLINE);
3129 }
3130
3131 return 0;
3132}
3133
3134char *show_database_desc[] =
3135{
3136 "unknown",
3137 "Router Link States",
3138 "Net Link States",
3139 "Summary Link States",
3140 "ASBR-Summary Link States",
3141 "AS External Link States",
3142#if defined (HAVE_NSSA) || defined (HAVE_OPAQUE_LSA)
3143 "Group Membership LSA",
3144 "NSSA-external Link States",
3145#endif /* HAVE_NSSA */
3146#ifdef HAVE_OPAQUE_LSA
3147 "Type-8 LSA",
3148 "Link-Local Opaque-LSA",
3149 "Area-Local Opaque-LSA",
3150 "AS-external Opaque-LSA",
3151#endif /* HAVE_OPAQUE_LSA */
3152};
3153
3154#define SHOW_OSPF_COMMON_HEADER \
3155 "Link ID ADV Router Age Seq# CkSum"
3156
3157char *show_database_header[] =
3158{
3159 "",
3160 "Link ID ADV Router Age Seq# CkSum Link count",
3161 "Link ID ADV Router Age Seq# CkSum",
3162 "Link ID ADV Router Age Seq# CkSum Route",
3163 "Link ID ADV Router Age Seq# CkSum",
3164 "Link ID ADV Router Age Seq# CkSum Route",
3165#ifdef HAVE_NSSA
3166 " --- header for Group Member ----",
3167 "Link ID ADV Router Age Seq# CkSum Route",
3168#endif /* HAVE_NSSA */
3169#ifdef HAVE_OPAQUE_LSA
3170#ifndef HAVE_NSSA
3171 " --- type-6 ---",
3172 " --- type-7 ---",
3173#endif /* HAVE_NSSA */
3174 " --- type-8 ---",
3175 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3176 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3177 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3178#endif /* HAVE_OPAQUE_LSA */
3179};
3180
3181void
3182show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa)
3183{
3184 struct router_lsa *rlsa = (struct router_lsa*) lsa->data;
3185
3186 vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE);
3187 vty_out (vty, " Options: %d%s", lsa->data->options, VTY_NEWLINE);
3188
3189 if (lsa->data->type == OSPF_ROUTER_LSA)
3190 {
3191 vty_out (vty, " Flags: 0x%x" , rlsa->flags);
3192
3193 if (rlsa->flags)
3194 vty_out (vty, " :%s%s%s%s",
3195 IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "",
3196 IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "",
3197 IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "",
3198 IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : "");
3199
3200 vty_out (vty, "%s", VTY_NEWLINE);
3201 }
3202 vty_out (vty, " LS Type: %s%s",
3203 LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE);
3204 vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id),
3205 LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE);
3206 vty_out (vty, " Advertising Router: %s%s",
3207 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3208 vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum),
3209 VTY_NEWLINE);
3210 vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum),
3211 VTY_NEWLINE);
3212 vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE);
3213}
3214
3215char *link_type_desc[] =
3216{
3217 "(null)",
3218 "another Router (point-to-point)",
3219 "a Transit Network",
3220 "Stub Network",
3221 "a Virtual Link",
3222};
3223
3224char *link_id_desc[] =
3225{
3226 "(null)",
3227 "Neighboring Router ID",
3228 "Designated Router address",
paul68980082003-03-25 05:07:42 +00003229 "Net",
paul718e3742002-12-13 20:15:29 +00003230 "Neighboring Router ID",
3231};
3232
3233char *link_data_desc[] =
3234{
3235 "(null)",
3236 "Router Interface address",
3237 "Router Interface address",
3238 "Network Mask",
3239 "Router Interface address",
3240};
3241
3242/* Show router-LSA each Link information. */
3243void
3244show_ip_ospf_database_router_links (struct vty *vty,
3245 struct router_lsa *rl)
3246{
3247 int len, i, type;
3248
3249 len = ntohs (rl->header.length) - 4;
3250 for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++)
3251 {
3252 type = rl->link[i].type;
3253
3254 vty_out (vty, " Link connected to: %s%s",
3255 link_type_desc[type], VTY_NEWLINE);
3256 vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type],
3257 inet_ntoa (rl->link[i].link_id), VTY_NEWLINE);
3258 vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type],
3259 inet_ntoa (rl->link[i].link_data), VTY_NEWLINE);
3260 vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE);
3261 vty_out (vty, " TOS 0 Metric: %d%s",
3262 ntohs (rl->link[i].metric), VTY_NEWLINE);
3263 vty_out (vty, "%s", VTY_NEWLINE);
3264 }
3265}
3266
3267/* Show router-LSA detail information. */
3268int
3269show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3270{
3271 if (lsa != NULL)
3272 {
3273 struct router_lsa *rl = (struct router_lsa *) lsa->data;
3274
3275 show_ip_ospf_database_header (vty, lsa);
3276
3277 vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links),
3278 VTY_NEWLINE, VTY_NEWLINE);
3279
3280 show_ip_ospf_database_router_links (vty, rl);
3281 }
3282
3283 return 0;
3284}
3285
3286/* Show network-LSA detail information. */
3287int
3288show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3289{
3290 int length, i;
3291
3292 if (lsa != NULL)
3293 {
3294 struct network_lsa *nl = (struct network_lsa *) lsa->data;
3295
3296 show_ip_ospf_database_header (vty, lsa);
3297
3298 vty_out (vty, " Network Mask: /%d%s",
3299 ip_masklen (nl->mask), VTY_NEWLINE);
3300
3301 length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4;
3302
3303 for (i = 0; length > 0; i++, length -= 4)
3304 vty_out (vty, " Attached Router: %s%s",
3305 inet_ntoa (nl->routers[i]), VTY_NEWLINE);
3306
3307 vty_out (vty, "%s", VTY_NEWLINE);
3308 }
3309
3310 return 0;
3311}
3312
3313/* Show summary-LSA detail information. */
3314int
3315show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3316{
3317 if (lsa != NULL)
3318 {
3319 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3320
3321 show_ip_ospf_database_header (vty, lsa);
3322
3323 vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask),
3324 VTY_NEWLINE);
3325 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3326 VTY_NEWLINE);
3327 }
3328
3329 return 0;
3330}
3331
3332/* Show summary-ASBR-LSA detail information. */
3333int
3334show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3335{
3336 if (lsa != NULL)
3337 {
3338 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3339
3340 show_ip_ospf_database_header (vty, lsa);
3341
3342 vty_out (vty, " Network Mask: /%d%s",
3343 ip_masklen (sl->mask), VTY_NEWLINE);
3344 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3345 VTY_NEWLINE);
3346 }
3347
3348 return 0;
3349}
3350
3351/* Show AS-external-LSA detail information. */
3352int
3353show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3354{
3355 if (lsa != NULL)
3356 {
3357 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3358
3359 show_ip_ospf_database_header (vty, lsa);
3360
3361 vty_out (vty, " Network Mask: /%d%s",
3362 ip_masklen (al->mask), VTY_NEWLINE);
3363 vty_out (vty, " Metric Type: %s%s",
3364 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3365 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3366 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3367 vty_out (vty, " Metric: %d%s",
3368 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3369 vty_out (vty, " Forward Address: %s%s",
3370 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3371
3372 vty_out (vty, " External Route Tag: %lu%s%s",
3373 (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3374 }
3375
3376 return 0;
3377}
3378
3379#ifdef HAVE_NSSA
3380int
3381show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
3382{
3383 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3384
3385 /* show_ip_ospf_database_header (vty, lsa); */
3386
3387 zlog_info( " Network Mask: /%d%s",
3388 ip_masklen (al->mask), "\n");
3389 zlog_info( " Metric Type: %s%s",
3390 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3391 "2 (Larger than any link state path)" : "1", "\n");
3392 zlog_info( " TOS: 0%s", "\n");
3393 zlog_info( " Metric: %d%s",
3394 GET_METRIC (al->e[0].metric), "\n");
3395 zlog_info( " Forward Address: %s%s",
3396 inet_ntoa (al->e[0].fwd_addr), "\n");
3397
3398 zlog_info( " External Route Tag: %u%s%s",
3399 ntohl (al->e[0].route_tag), "\n", "\n");
3400
3401 return 0;
3402}
3403
3404/* Show AS-NSSA-LSA detail information. */
3405int
3406show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3407{
3408 if (lsa != NULL)
3409 {
3410 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3411
3412 show_ip_ospf_database_header (vty, lsa);
3413
3414 vty_out (vty, " Network Mask: /%d%s",
3415 ip_masklen (al->mask), VTY_NEWLINE);
3416 vty_out (vty, " Metric Type: %s%s",
3417 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3418 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3419 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3420 vty_out (vty, " Metric: %d%s",
3421 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3422 vty_out (vty, " NSSA: Forward Address: %s%s",
3423 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3424
3425 vty_out (vty, " External Route Tag: %u%s%s",
3426 ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3427 }
3428
3429 return 0;
3430}
3431
3432#endif /* HAVE_NSSA */
3433
3434int
3435show_func_dummy (struct vty *vty, struct ospf_lsa *lsa)
3436{
3437 return 0;
3438}
3439
3440#ifdef HAVE_OPAQUE_LSA
3441int
3442show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3443{
3444 if (lsa != NULL)
3445 {
3446 show_ip_ospf_database_header (vty, lsa);
3447 show_opaque_info_detail (vty, lsa);
3448
3449 vty_out (vty, "%s", VTY_NEWLINE);
3450 }
3451 return 0;
3452}
3453#endif /* HAVE_OPAQUE_LSA */
3454
3455int (*show_function[])(struct vty *, struct ospf_lsa *) =
3456{
3457 NULL,
3458 show_router_lsa_detail,
3459 show_network_lsa_detail,
3460 show_summary_lsa_detail,
3461 show_summary_asbr_lsa_detail,
3462 show_as_external_lsa_detail,
3463#ifdef HAVE_NSSA
3464 show_func_dummy,
3465 show_as_nssa_lsa_detail, /* almost same as external */
3466#endif /* HAVE_NSSA */
3467#ifdef HAVE_OPAQUE_LSA
3468#ifndef HAVE_NSSA
3469 show_func_dummy,
3470 show_func_dummy,
3471#endif /* HAVE_NSSA */
3472 NULL, /* type-8 */
3473 show_opaque_lsa_detail,
3474 show_opaque_lsa_detail,
3475 show_opaque_lsa_detail,
3476#endif /* HAVE_OPAQUE_LSA */
3477};
3478
3479void
3480show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id,
3481 struct in_addr *adv_router)
3482{
3483 memset (lp, 0, sizeof (struct prefix_ls));
3484 lp->family = 0;
3485 if (id == NULL)
3486 lp->prefixlen = 0;
3487 else if (adv_router == NULL)
3488 {
3489 lp->prefixlen = 32;
3490 lp->id = *id;
3491 }
3492 else
3493 {
3494 lp->prefixlen = 64;
3495 lp->id = *id;
3496 lp->adv_router = *adv_router;
3497 }
3498}
3499
3500void
3501show_lsa_detail_proc (struct vty *vty, struct route_table *rt,
3502 struct in_addr *id, struct in_addr *adv_router)
3503{
3504 struct prefix_ls lp;
3505 struct route_node *rn, *start;
3506 struct ospf_lsa *lsa;
3507
3508 show_lsa_prefix_set (vty, &lp, id, adv_router);
3509 start = route_node_get (rt, (struct prefix *) &lp);
3510 if (start)
3511 {
3512 route_lock_node (start);
3513 for (rn = start; rn; rn = route_next_until (rn, start))
3514 if ((lsa = rn->info))
3515 {
3516#ifdef HAVE_NSSA
3517 /* Stay away from any Local Translated Type-7 LSAs */
3518 if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
3519 continue;
3520#endif /* HAVE_NSSA */
3521
3522 if (show_function[lsa->data->type] != NULL)
3523 show_function[lsa->data->type] (vty, lsa);
3524 }
3525 route_unlock_node (start);
3526 }
3527}
3528
3529/* Show detail LSA information
3530 -- if id is NULL then show all LSAs. */
3531void
paul020709f2003-04-04 02:44:16 +00003532show_lsa_detail (struct vty *vty, struct ospf *ospf, int type,
paul718e3742002-12-13 20:15:29 +00003533 struct in_addr *id, struct in_addr *adv_router)
3534{
3535 listnode node;
3536
3537 switch (type)
3538 {
3539 case OSPF_AS_EXTERNAL_LSA:
3540#ifdef HAVE_OPAQUE_LSA
3541 case OSPF_OPAQUE_AS_LSA:
3542#endif /* HAVE_OPAQUE_LSA */
3543 vty_out (vty, " %s %s%s",
3544 show_database_desc[type],
3545 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003546 show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router);
paul718e3742002-12-13 20:15:29 +00003547 break;
3548 default:
paul68980082003-03-25 05:07:42 +00003549 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003550 {
3551 struct ospf_area *area = node->data;
3552 vty_out (vty, "%s %s (Area %s)%s%s",
3553 VTY_NEWLINE, show_database_desc[type],
3554 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3555 show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router);
3556 }
3557 break;
3558 }
3559}
3560
3561void
3562show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt,
3563 struct in_addr *adv_router)
3564{
3565 struct route_node *rn;
3566 struct ospf_lsa *lsa;
3567
3568 for (rn = route_top (rt); rn; rn = route_next (rn))
3569 if ((lsa = rn->info))
3570 if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router))
3571 {
3572#ifdef HAVE_NSSA
3573 if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
3574 continue;
3575#endif /* HAVE_NSSA */
3576 if (show_function[lsa->data->type] != NULL)
3577 show_function[lsa->data->type] (vty, lsa);
3578 }
3579}
3580
3581/* Show detail LSA information. */
3582void
paul020709f2003-04-04 02:44:16 +00003583show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type,
paul718e3742002-12-13 20:15:29 +00003584 struct in_addr *adv_router)
3585{
3586 listnode node;
3587
3588 switch (type)
3589 {
3590 case OSPF_AS_EXTERNAL_LSA:
3591#ifdef HAVE_OPAQUE_LSA
3592 case OSPF_OPAQUE_AS_LSA:
3593#endif /* HAVE_OPAQUE_LSA */
3594 vty_out (vty, " %s %s%s",
3595 show_database_desc[type],
3596 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003597 show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type),
paul718e3742002-12-13 20:15:29 +00003598 adv_router);
3599 break;
3600 default:
paul68980082003-03-25 05:07:42 +00003601 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003602 {
3603 struct ospf_area *area = node->data;
3604 vty_out (vty, "%s %s (Area %s)%s%s",
3605 VTY_NEWLINE, show_database_desc[type],
3606 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3607 show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type),
3608 adv_router);
3609 }
3610 break;
3611 }
3612}
3613
3614void
paul020709f2003-04-04 02:44:16 +00003615show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self)
paul718e3742002-12-13 20:15:29 +00003616{
paul020709f2003-04-04 02:44:16 +00003617 struct ospf_lsa *lsa;
3618 struct route_node *rn;
paul718e3742002-12-13 20:15:29 +00003619 listnode node;
3620 int type;
3621
paul68980082003-03-25 05:07:42 +00003622 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003623 {
3624 struct ospf_area *area = node->data;
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 continue;
3634 default:
3635 break;
3636 }
3637 if (ospf_lsdb_count_self (area->lsdb, type) > 0 ||
3638 (!self && ospf_lsdb_count (area->lsdb, type) > 0))
3639 {
3640 vty_out (vty, " %s (Area %s)%s%s",
3641 show_database_desc[type],
3642 ospf_area_desc_string (area),
3643 VTY_NEWLINE, VTY_NEWLINE);
3644 vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE);
3645
paul020709f2003-04-04 02:44:16 +00003646 LSDB_LOOP (AREA_LSDB (area, type), rn, lsa)
3647 show_lsa_summary (vty, lsa, self);
paul718e3742002-12-13 20:15:29 +00003648
3649 vty_out (vty, "%s", VTY_NEWLINE);
3650 }
3651 }
3652 }
3653
3654 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3655 {
3656 switch (type)
3657 {
3658 case OSPF_AS_EXTERNAL_LSA:
3659#ifdef HAVE_OPAQUE_LSA
3660 case OSPF_OPAQUE_AS_LSA:
3661#endif /* HAVE_OPAQUE_LSA */
3662 break;;
3663 default:
3664 continue;
3665 }
paul68980082003-03-25 05:07:42 +00003666 if (ospf_lsdb_count_self (ospf->lsdb, type) ||
3667 (!self && ospf_lsdb_count (ospf->lsdb, type)))
paul718e3742002-12-13 20:15:29 +00003668 {
3669 vty_out (vty, " %s%s%s",
3670 show_database_desc[type],
3671 VTY_NEWLINE, VTY_NEWLINE);
3672 vty_out (vty, "%s%s", show_database_header[type],
3673 VTY_NEWLINE);
paul020709f2003-04-04 02:44:16 +00003674
3675 LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa)
3676 show_lsa_summary (vty, lsa, self);
3677
paul718e3742002-12-13 20:15:29 +00003678 vty_out (vty, "%s", VTY_NEWLINE);
3679 }
3680 }
3681
3682 vty_out (vty, "%s", VTY_NEWLINE);
3683}
3684
3685void
paul020709f2003-04-04 02:44:16 +00003686show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00003687{
3688 listnode node;
3689 struct ospf_lsa *lsa;
3690
3691 vty_out (vty, "%s MaxAge Link States:%s%s",
3692 VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
3693
paul68980082003-03-25 05:07:42 +00003694 for (node = listhead (ospf->maxage_lsa); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00003695 if ((lsa = node->data) != NULL)
3696 {
3697 vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);
3698 vty_out (vty, "Link State ID: %s%s",
3699 inet_ntoa (lsa->data->id), VTY_NEWLINE);
3700 vty_out (vty, "Advertising Router: %s%s",
3701 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3702 vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);
3703 vty_out (vty, "%s", VTY_NEWLINE);
3704 }
3705}
3706
3707#ifdef HAVE_NSSA
3708#define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3709#define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
3710#else /* HAVE_NSSA */
3711#define OSPF_LSA_TYPE_NSSA_DESC ""
3712#define OSPF_LSA_TYPE_NSSA_CMD_STR ""
3713#endif /* HAVE_NSSA */
3714
3715#ifdef HAVE_OPAQUE_LSA
3716#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3717#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3718#define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3719#define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3720#else /* HAVE_OPAQUE_LSA */
3721#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3722#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3723#define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3724#define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3725#endif /* HAVE_OPAQUE_LSA */
3726
3727#define OSPF_LSA_TYPES_CMD_STR \
3728 "asbr-summary|external|network|router|summary" \
3729 OSPF_LSA_TYPE_NSSA_CMD_STR \
3730 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3731
3732#define OSPF_LSA_TYPES_DESC \
3733 "ASBR summary link states\n" \
3734 "External link states\n" \
3735 "Network link states\n" \
3736 "Router link states\n" \
3737 "Network summary link states\n" \
3738 OSPF_LSA_TYPE_NSSA_DESC \
3739 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3740 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3741 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3742
3743DEFUN (show_ip_ospf_database,
3744 show_ip_ospf_database_cmd,
3745 "show ip ospf database",
3746 SHOW_STR
3747 IP_STR
3748 "OSPF information\n"
3749 "Database summary\n")
3750{
paul020709f2003-04-04 02:44:16 +00003751 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003752 int type, ret;
3753 struct in_addr id, adv_router;
3754
paul020709f2003-04-04 02:44:16 +00003755 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003756 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003757 return CMD_SUCCESS;
3758
3759 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00003760 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003761
3762 /* Show all LSA. */
3763 if (argc == 0)
3764 {
paul020709f2003-04-04 02:44:16 +00003765 show_ip_ospf_database_summary (vty, ospf, 0);
paul718e3742002-12-13 20:15:29 +00003766 return CMD_SUCCESS;
3767 }
3768
3769 /* Set database type to show. */
3770 if (strncmp (argv[0], "r", 1) == 0)
3771 type = OSPF_ROUTER_LSA;
3772 else if (strncmp (argv[0], "ne", 2) == 0)
3773 type = OSPF_NETWORK_LSA;
3774#ifdef HAVE_NSSA
3775 else if (strncmp (argv[0], "ns", 2) == 0)
3776 type = OSPF_AS_NSSA_LSA;
3777#endif /* HAVE_NSSA */
3778 else if (strncmp (argv[0], "su", 2) == 0)
3779 type = OSPF_SUMMARY_LSA;
3780 else if (strncmp (argv[0], "a", 1) == 0)
3781 type = OSPF_ASBR_SUMMARY_LSA;
3782 else if (strncmp (argv[0], "e", 1) == 0)
3783 type = OSPF_AS_EXTERNAL_LSA;
3784 else if (strncmp (argv[0], "se", 2) == 0)
3785 {
paul020709f2003-04-04 02:44:16 +00003786 show_ip_ospf_database_summary (vty, ospf, 1);
paul718e3742002-12-13 20:15:29 +00003787 return CMD_SUCCESS;
3788 }
3789 else if (strncmp (argv[0], "m", 1) == 0)
3790 {
paul020709f2003-04-04 02:44:16 +00003791 show_ip_ospf_database_maxage (vty, ospf);
paul718e3742002-12-13 20:15:29 +00003792 return CMD_SUCCESS;
3793 }
3794#ifdef HAVE_OPAQUE_LSA
3795 else if (strncmp (argv[0], "opaque-l", 8) == 0)
3796 type = OSPF_OPAQUE_LINK_LSA;
3797 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
3798 type = OSPF_OPAQUE_AREA_LSA;
3799 else if (strncmp (argv[0], "opaque-as", 9) == 0)
3800 type = OSPF_OPAQUE_AS_LSA;
3801#endif /* HAVE_OPAQUE_LSA */
3802 else
3803 return CMD_WARNING;
3804
3805 /* `show ip ospf database LSA'. */
3806 if (argc == 1)
paul020709f2003-04-04 02:44:16 +00003807 show_lsa_detail (vty, ospf, type, NULL, NULL);
paul718e3742002-12-13 20:15:29 +00003808 else if (argc >= 2)
3809 {
3810 ret = inet_aton (argv[1], &id);
3811 if (!ret)
3812 return CMD_WARNING;
3813
3814 /* `show ip ospf database LSA ID'. */
3815 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00003816 show_lsa_detail (vty, ospf, type, &id, NULL);
paul718e3742002-12-13 20:15:29 +00003817 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3818 else if (argc == 3)
3819 {
3820 if (strncmp (argv[2], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00003821 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00003822 else
3823 {
3824 ret = inet_aton (argv[2], &adv_router);
3825 if (!ret)
3826 return CMD_WARNING;
3827 }
paul020709f2003-04-04 02:44:16 +00003828 show_lsa_detail (vty, ospf, type, &id, &adv_router);
paul718e3742002-12-13 20:15:29 +00003829 }
3830 }
3831
3832 return CMD_SUCCESS;
3833}
3834
3835ALIAS (show_ip_ospf_database,
3836 show_ip_ospf_database_type_cmd,
3837 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)",
3838 SHOW_STR
3839 IP_STR
3840 "OSPF information\n"
3841 "Database summary\n"
3842 OSPF_LSA_TYPES_DESC
3843 "LSAs in MaxAge list\n"
3844 "Self-originated link states\n")
3845
3846ALIAS (show_ip_ospf_database,
3847 show_ip_ospf_database_type_id_cmd,
3848 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D",
3849 SHOW_STR
3850 IP_STR
3851 "OSPF information\n"
3852 "Database summary\n"
3853 OSPF_LSA_TYPES_DESC
3854 "Link State ID (as an IP address)\n")
3855
3856ALIAS (show_ip_ospf_database,
3857 show_ip_ospf_database_type_id_adv_router_cmd,
3858 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D",
3859 SHOW_STR
3860 IP_STR
3861 "OSPF information\n"
3862 "Database summary\n"
3863 OSPF_LSA_TYPES_DESC
3864 "Link State ID (as an IP address)\n"
3865 "Advertising Router link states\n"
3866 "Advertising Router (as an IP address)\n")
3867
3868ALIAS (show_ip_ospf_database,
3869 show_ip_ospf_database_type_id_self_cmd,
3870 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
3871 SHOW_STR
3872 IP_STR
3873 "OSPF information\n"
3874 "Database summary\n"
3875 OSPF_LSA_TYPES_DESC
3876 "Link State ID (as an IP address)\n"
3877 "Self-originated link states\n"
3878 "\n")
3879
3880DEFUN (show_ip_ospf_database_type_adv_router,
3881 show_ip_ospf_database_type_adv_router_cmd,
3882 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D",
3883 SHOW_STR
3884 IP_STR
3885 "OSPF information\n"
3886 "Database summary\n"
3887 OSPF_LSA_TYPES_DESC
3888 "Advertising Router link states\n"
3889 "Advertising Router (as an IP address)\n")
3890{
paul020709f2003-04-04 02:44:16 +00003891 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003892 int type, ret;
3893 struct in_addr adv_router;
3894
paul020709f2003-04-04 02:44:16 +00003895 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003896 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003897 return CMD_SUCCESS;
3898
3899 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00003900 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003901
3902 if (argc != 2)
3903 return CMD_WARNING;
3904
3905 /* Set database type to show. */
3906 if (strncmp (argv[0], "r", 1) == 0)
3907 type = OSPF_ROUTER_LSA;
3908 else if (strncmp (argv[0], "ne", 2) == 0)
3909 type = OSPF_NETWORK_LSA;
3910#ifdef HAVE_NSSA
3911 else if (strncmp (argv[0], "ns", 2) == 0)
3912 type = OSPF_AS_NSSA_LSA;
3913#endif /* HAVE_NSSA */
3914 else if (strncmp (argv[0], "s", 1) == 0)
3915 type = OSPF_SUMMARY_LSA;
3916 else if (strncmp (argv[0], "a", 1) == 0)
3917 type = OSPF_ASBR_SUMMARY_LSA;
3918 else if (strncmp (argv[0], "e", 1) == 0)
3919 type = OSPF_AS_EXTERNAL_LSA;
3920#ifdef HAVE_OPAQUE_LSA
3921 else if (strncmp (argv[0], "opaque-l", 8) == 0)
3922 type = OSPF_OPAQUE_LINK_LSA;
3923 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
3924 type = OSPF_OPAQUE_AREA_LSA;
3925 else if (strncmp (argv[0], "opaque-as", 9) == 0)
3926 type = OSPF_OPAQUE_AS_LSA;
3927#endif /* HAVE_OPAQUE_LSA */
3928 else
3929 return CMD_WARNING;
3930
3931 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3932 if (strncmp (argv[1], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00003933 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00003934 else
3935 {
3936 ret = inet_aton (argv[1], &adv_router);
3937 if (!ret)
3938 return CMD_WARNING;
3939 }
3940
paul020709f2003-04-04 02:44:16 +00003941 show_lsa_detail_adv_router (vty, ospf, type, &adv_router);
paul718e3742002-12-13 20:15:29 +00003942
3943 return CMD_SUCCESS;
3944}
3945
3946ALIAS (show_ip_ospf_database_type_adv_router,
3947 show_ip_ospf_database_type_self_cmd,
3948 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
3949 SHOW_STR
3950 IP_STR
3951 "OSPF information\n"
3952 "Database summary\n"
3953 OSPF_LSA_TYPES_DESC
3954 "Self-originated link states\n")
3955
3956
3957DEFUN (ip_ospf_authentication_args,
3958 ip_ospf_authentication_args_addr_cmd,
3959 "ip ospf authentication (null|message-digest) A.B.C.D",
3960 "IP Information\n"
3961 "OSPF interface commands\n"
3962 "Enable authentication on this interface\n"
3963 "Use null authentication\n"
3964 "Use message-digest authentication\n"
3965 "Address of interface")
3966{
3967 struct interface *ifp;
3968 struct in_addr addr;
3969 int ret;
3970 struct ospf_if_params *params;
3971
3972 ifp = vty->index;
3973 params = IF_DEF_PARAMS (ifp);
3974
3975 if (argc == 2)
3976 {
3977 ret = inet_aton(argv[1], &addr);
3978 if (!ret)
3979 {
3980 vty_out (vty, "Please specify interface address by A.B.C.D%s",
3981 VTY_NEWLINE);
3982 return CMD_WARNING;
3983 }
3984
3985 params = ospf_get_if_params (ifp, addr);
3986 ospf_if_update_params (ifp, addr);
3987 }
3988
3989 /* Handle null authentication */
3990 if ( argv[0][0] == 'n' )
3991 {
3992 SET_IF_PARAM (params, auth_type);
3993 params->auth_type = OSPF_AUTH_NULL;
3994 return CMD_SUCCESS;
3995 }
3996
3997 /* Handle message-digest authentication */
3998 if ( argv[0][0] == 'm' )
3999 {
4000 SET_IF_PARAM (params, auth_type);
4001 params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
4002 return CMD_SUCCESS;
4003 }
4004
4005 vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE);
4006 return CMD_WARNING;
4007}
4008
4009ALIAS (ip_ospf_authentication_args,
4010 ip_ospf_authentication_args_cmd,
4011 "ip ospf authentication (null|message-digest)",
4012 "IP Information\n"
4013 "OSPF interface commands\n"
4014 "Enable authentication on this interface\n"
4015 "Use null authentication\n"
4016 "Use message-digest authentication\n")
4017
4018DEFUN (ip_ospf_authentication,
4019 ip_ospf_authentication_addr_cmd,
4020 "ip ospf authentication A.B.C.D",
4021 "IP Information\n"
4022 "OSPF interface commands\n"
4023 "Enable authentication on this interface\n"
4024 "Address of interface")
4025{
4026 struct interface *ifp;
4027 struct in_addr addr;
4028 int ret;
4029 struct ospf_if_params *params;
4030
4031 ifp = vty->index;
4032 params = IF_DEF_PARAMS (ifp);
4033
4034 if (argc == 1)
4035 {
4036 ret = inet_aton(argv[1], &addr);
4037 if (!ret)
4038 {
4039 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4040 VTY_NEWLINE);
4041 return CMD_WARNING;
4042 }
4043
4044 params = ospf_get_if_params (ifp, addr);
4045 ospf_if_update_params (ifp, addr);
4046 }
4047
4048 SET_IF_PARAM (params, auth_type);
4049 params->auth_type = OSPF_AUTH_SIMPLE;
4050
4051 return CMD_SUCCESS;
4052}
4053
4054ALIAS (ip_ospf_authentication,
4055 ip_ospf_authentication_cmd,
4056 "ip ospf authentication",
4057 "IP Information\n"
4058 "OSPF interface commands\n"
4059 "Enable authentication on this interface\n")
4060
4061DEFUN (no_ip_ospf_authentication,
4062 no_ip_ospf_authentication_addr_cmd,
4063 "no ip ospf authentication A.B.C.D",
4064 NO_STR
4065 "IP Information\n"
4066 "OSPF interface commands\n"
4067 "Enable authentication on this interface\n"
4068 "Address of interface")
4069{
4070 struct interface *ifp;
4071 struct in_addr addr;
4072 int ret;
4073 struct ospf_if_params *params;
4074
4075 ifp = vty->index;
4076 params = IF_DEF_PARAMS (ifp);
4077
4078 if (argc == 1)
4079 {
4080 ret = inet_aton(argv[1], &addr);
4081 if (!ret)
4082 {
4083 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4084 VTY_NEWLINE);
4085 return CMD_WARNING;
4086 }
4087
4088 params = ospf_lookup_if_params (ifp, addr);
4089 if (params == NULL)
4090 return CMD_SUCCESS;
4091 }
4092
4093 params->auth_type = OSPF_AUTH_NOTSET;
4094 UNSET_IF_PARAM (params, auth_type);
4095
4096 if (params != IF_DEF_PARAMS (ifp))
4097 {
4098 ospf_free_if_params (ifp, addr);
4099 ospf_if_update_params (ifp, addr);
4100 }
4101
4102 return CMD_SUCCESS;
4103}
4104
4105ALIAS (no_ip_ospf_authentication,
4106 no_ip_ospf_authentication_cmd,
4107 "no ip ospf authentication",
4108 NO_STR
4109 "IP Information\n"
4110 "OSPF interface commands\n"
4111 "Enable authentication on this interface\n")
4112
4113DEFUN (ip_ospf_authentication_key,
4114 ip_ospf_authentication_key_addr_cmd,
4115 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4116 "IP Information\n"
4117 "OSPF interface commands\n"
4118 "Authentication password (key)\n"
4119 "The OSPF password (key)\n"
4120 "Address of interface")
4121{
4122 struct interface *ifp;
4123 struct in_addr addr;
4124 int ret;
4125 struct ospf_if_params *params;
4126
4127 ifp = vty->index;
4128 params = IF_DEF_PARAMS (ifp);
4129
4130 if (argc == 2)
4131 {
4132 ret = inet_aton(argv[1], &addr);
4133 if (!ret)
4134 {
4135 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4136 VTY_NEWLINE);
4137 return CMD_WARNING;
4138 }
4139
4140 params = ospf_get_if_params (ifp, addr);
4141 ospf_if_update_params (ifp, addr);
4142 }
4143
4144
4145 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
4146 strncpy (params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE);
4147 SET_IF_PARAM (params, auth_simple);
4148
4149 return CMD_SUCCESS;
4150}
4151
4152ALIAS (ip_ospf_authentication_key,
4153 ip_ospf_authentication_key_cmd,
4154 "ip ospf authentication-key AUTH_KEY",
4155 "IP Information\n"
4156 "OSPF interface commands\n"
4157 "Authentication password (key)\n"
4158 "The OSPF password (key)")
4159
4160ALIAS (ip_ospf_authentication_key,
4161 ospf_authentication_key_cmd,
4162 "ospf authentication-key AUTH_KEY",
4163 "OSPF interface commands\n"
4164 "Authentication password (key)\n"
4165 "The OSPF password (key)")
4166
4167DEFUN (no_ip_ospf_authentication_key,
4168 no_ip_ospf_authentication_key_addr_cmd,
4169 "no ip ospf authentication-key A.B.C.D",
4170 NO_STR
4171 "IP Information\n"
4172 "OSPF interface commands\n"
4173 "Authentication password (key)\n"
4174 "Address of interface")
4175{
4176 struct interface *ifp;
4177 struct in_addr addr;
4178 int ret;
4179 struct ospf_if_params *params;
4180
4181 ifp = vty->index;
4182 params = IF_DEF_PARAMS (ifp);
4183
4184 if (argc == 2)
4185 {
4186 ret = inet_aton(argv[1], &addr);
4187 if (!ret)
4188 {
4189 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4190 VTY_NEWLINE);
4191 return CMD_WARNING;
4192 }
4193
4194 params = ospf_lookup_if_params (ifp, addr);
4195 if (params == NULL)
4196 return CMD_SUCCESS;
4197 }
4198
4199 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
4200 UNSET_IF_PARAM (params, auth_simple);
4201
4202 if (params != IF_DEF_PARAMS (ifp))
4203 {
4204 ospf_free_if_params (ifp, addr);
4205 ospf_if_update_params (ifp, addr);
4206 }
4207
4208 return CMD_SUCCESS;
4209}
4210
4211ALIAS (no_ip_ospf_authentication_key,
4212 no_ip_ospf_authentication_key_cmd,
4213 "no ip ospf authentication-key",
4214 NO_STR
4215 "IP Information\n"
4216 "OSPF interface commands\n"
4217 "Authentication password (key)\n")
4218
4219ALIAS (no_ip_ospf_authentication_key,
4220 no_ospf_authentication_key_cmd,
4221 "no ospf authentication-key",
4222 NO_STR
4223 "OSPF interface commands\n"
4224 "Authentication password (key)\n")
4225
4226DEFUN (ip_ospf_message_digest_key,
4227 ip_ospf_message_digest_key_addr_cmd,
4228 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4229 "IP Information\n"
4230 "OSPF interface commands\n"
4231 "Message digest authentication password (key)\n"
4232 "Key ID\n"
4233 "Use MD5 algorithm\n"
4234 "The OSPF password (key)"
4235 "Address of interface")
4236{
4237 struct interface *ifp;
4238 struct crypt_key *ck;
4239 u_char key_id;
4240 struct in_addr addr;
4241 int ret;
4242 struct ospf_if_params *params;
4243
4244 ifp = vty->index;
4245 params = IF_DEF_PARAMS (ifp);
4246
4247 if (argc == 3)
4248 {
4249 ret = inet_aton(argv[2], &addr);
4250 if (!ret)
4251 {
4252 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4253 VTY_NEWLINE);
4254 return CMD_WARNING;
4255 }
4256
4257 params = ospf_get_if_params (ifp, addr);
4258 ospf_if_update_params (ifp, addr);
4259 }
4260
4261 key_id = strtol (argv[0], NULL, 10);
4262 if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
4263 {
4264 vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
4265 return CMD_WARNING;
4266 }
4267
4268 ck = ospf_crypt_key_new ();
4269 ck->key_id = (u_char) key_id;
4270 memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
4271 strncpy (ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE);
4272
4273 ospf_crypt_key_add (params->auth_crypt, ck);
4274 SET_IF_PARAM (params, auth_crypt);
4275
4276 return CMD_SUCCESS;
4277}
4278
4279ALIAS (ip_ospf_message_digest_key,
4280 ip_ospf_message_digest_key_cmd,
4281 "ip ospf message-digest-key <1-255> md5 KEY",
4282 "IP Information\n"
4283 "OSPF interface commands\n"
4284 "Message digest authentication password (key)\n"
4285 "Key ID\n"
4286 "Use MD5 algorithm\n"
4287 "The OSPF password (key)")
4288
4289ALIAS (ip_ospf_message_digest_key,
4290 ospf_message_digest_key_cmd,
4291 "ospf message-digest-key <1-255> md5 KEY",
4292 "OSPF interface commands\n"
4293 "Message digest authentication password (key)\n"
4294 "Key ID\n"
4295 "Use MD5 algorithm\n"
4296 "The OSPF password (key)")
4297
4298DEFUN (no_ip_ospf_message_digest_key,
4299 no_ip_ospf_message_digest_key_addr_cmd,
4300 "no ip ospf message-digest-key <1-255> A.B.C.D",
4301 NO_STR
4302 "IP Information\n"
4303 "OSPF interface commands\n"
4304 "Message digest authentication password (key)\n"
4305 "Key ID\n"
4306 "Address of interface")
4307{
4308 struct interface *ifp;
4309 struct crypt_key *ck;
4310 int key_id;
4311 struct in_addr addr;
4312 int ret;
4313 struct ospf_if_params *params;
4314
4315 ifp = vty->index;
4316 params = IF_DEF_PARAMS (ifp);
4317
4318 if (argc == 2)
4319 {
4320 ret = inet_aton(argv[1], &addr);
4321 if (!ret)
4322 {
4323 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4324 VTY_NEWLINE);
4325 return CMD_WARNING;
4326 }
4327
4328 params = ospf_lookup_if_params (ifp, addr);
4329 if (params == NULL)
4330 return CMD_SUCCESS;
4331 }
4332
4333 key_id = strtol (argv[0], NULL, 10);
4334 ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
4335 if (ck == NULL)
4336 {
4337 vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
4338 return CMD_WARNING;
4339 }
4340
4341 ospf_crypt_key_delete (params->auth_crypt, key_id);
4342
4343 if (params != IF_DEF_PARAMS (ifp))
4344 {
4345 ospf_free_if_params (ifp, addr);
4346 ospf_if_update_params (ifp, addr);
4347 }
4348
4349 return CMD_SUCCESS;
4350}
4351
4352ALIAS (no_ip_ospf_message_digest_key,
4353 no_ip_ospf_message_digest_key_cmd,
4354 "no ip ospf message-digest-key <1-255>",
4355 NO_STR
4356 "IP Information\n"
4357 "OSPF interface commands\n"
4358 "Message digest authentication password (key)\n"
4359 "Key ID\n")
4360
4361ALIAS (no_ip_ospf_message_digest_key,
4362 no_ospf_message_digest_key_cmd,
4363 "no ospf message-digest-key <1-255>",
4364 NO_STR
4365 "OSPF interface commands\n"
4366 "Message digest authentication password (key)\n"
4367 "Key ID\n")
4368
4369DEFUN (ip_ospf_cost,
4370 ip_ospf_cost_addr_cmd,
4371 "ip ospf cost <1-65535> A.B.C.D",
4372 "IP Information\n"
4373 "OSPF interface commands\n"
4374 "Interface cost\n"
4375 "Cost\n"
4376 "Address of interface")
4377{
4378 struct interface *ifp = vty->index;
4379 u_int32_t cost;
4380 struct in_addr addr;
4381 int ret;
4382 struct ospf_if_params *params;
4383
4384 params = IF_DEF_PARAMS (ifp);
4385
4386 cost = strtol (argv[0], NULL, 10);
4387
4388 /* cost range is <1-65535>. */
4389 if (cost < 1 || cost > 65535)
4390 {
4391 vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
4392 return CMD_WARNING;
4393 }
4394
4395 if (argc == 2)
4396 {
4397 ret = inet_aton(argv[1], &addr);
4398 if (!ret)
4399 {
4400 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4401 VTY_NEWLINE);
4402 return CMD_WARNING;
4403 }
4404
4405 params = ospf_get_if_params (ifp, addr);
4406 ospf_if_update_params (ifp, addr);
4407 }
4408
4409 SET_IF_PARAM (params, output_cost_cmd);
4410 params->output_cost_cmd = cost;
4411
4412 ospf_if_recalculate_output_cost (ifp);
4413
4414 return CMD_SUCCESS;
4415}
4416
4417ALIAS (ip_ospf_cost,
4418 ip_ospf_cost_cmd,
4419 "ip ospf cost <1-65535>",
4420 "IP Information\n"
4421 "OSPF interface commands\n"
4422 "Interface cost\n"
4423 "Cost")
4424
4425ALIAS (ip_ospf_cost,
4426 ospf_cost_cmd,
4427 "ospf cost <1-65535>",
4428 "OSPF interface commands\n"
4429 "Interface cost\n"
4430 "Cost")
4431
4432DEFUN (no_ip_ospf_cost,
4433 no_ip_ospf_cost_addr_cmd,
4434 "no ip ospf cost A.B.C.D",
4435 NO_STR
4436 "IP Information\n"
4437 "OSPF interface commands\n"
4438 "Interface cost\n"
4439 "Address of interface")
4440{
4441 struct interface *ifp = vty->index;
4442 struct in_addr addr;
4443 int ret;
4444 struct ospf_if_params *params;
4445
4446 ifp = vty->index;
4447 params = IF_DEF_PARAMS (ifp);
4448
4449 if (argc == 1)
4450 {
4451 ret = inet_aton(argv[0], &addr);
4452 if (!ret)
4453 {
4454 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4455 VTY_NEWLINE);
4456 return CMD_WARNING;
4457 }
4458
4459 params = ospf_lookup_if_params (ifp, addr);
4460 if (params == NULL)
4461 return CMD_SUCCESS;
4462 }
4463
4464 UNSET_IF_PARAM (params, output_cost_cmd);
4465
4466 if (params != IF_DEF_PARAMS (ifp))
4467 {
4468 ospf_free_if_params (ifp, addr);
4469 ospf_if_update_params (ifp, addr);
4470 }
4471
4472 ospf_if_recalculate_output_cost (ifp);
4473
4474 return CMD_SUCCESS;
4475}
4476
4477ALIAS (no_ip_ospf_cost,
4478 no_ip_ospf_cost_cmd,
4479 "no ip ospf cost",
4480 NO_STR
4481 "IP Information\n"
4482 "OSPF interface commands\n"
4483 "Interface cost\n")
4484
4485ALIAS (no_ip_ospf_cost,
4486 no_ospf_cost_cmd,
4487 "no ospf cost",
4488 NO_STR
4489 "OSPF interface commands\n"
4490 "Interface cost\n")
4491
4492void
4493ospf_nbr_timer_update (struct ospf_interface *oi)
4494{
4495 struct route_node *rn;
4496 struct ospf_neighbor *nbr;
4497
4498 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
4499 if ((nbr = rn->info))
4500 {
4501 nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait);
4502 nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval);
4503 nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval);
4504 nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval);
4505 }
4506}
4507
4508DEFUN (ip_ospf_dead_interval,
4509 ip_ospf_dead_interval_addr_cmd,
4510 "ip ospf dead-interval <1-65535> A.B.C.D",
4511 "IP Information\n"
4512 "OSPF interface commands\n"
4513 "Interval after which a neighbor is declared dead\n"
4514 "Seconds\n"
4515 "Address of interface")
4516{
4517 struct interface *ifp = vty->index;
4518 u_int32_t seconds;
4519 struct in_addr addr;
4520 int ret;
4521 struct ospf_if_params *params;
4522 struct ospf_interface *oi;
4523 struct route_node *rn;
paul020709f2003-04-04 02:44:16 +00004524 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00004525
paul020709f2003-04-04 02:44:16 +00004526 ospf = ospf_lookup ();
4527
paul718e3742002-12-13 20:15:29 +00004528 params = IF_DEF_PARAMS (ifp);
4529
4530 seconds = strtol (argv[0], NULL, 10);
4531
4532 /* dead_interval range is <1-65535>. */
4533 if (seconds < 1 || seconds > 65535)
4534 {
4535 vty_out (vty, "Router Dead Interval is invalid%s", VTY_NEWLINE);
4536 return CMD_WARNING;
4537 }
4538
4539 if (argc == 2)
4540 {
4541 ret = inet_aton(argv[1], &addr);
4542 if (!ret)
4543 {
4544 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4545 VTY_NEWLINE);
4546 return CMD_WARNING;
4547 }
4548
4549 params = ospf_get_if_params (ifp, addr);
4550 ospf_if_update_params (ifp, addr);
4551 }
4552
4553 SET_IF_PARAM (params, v_wait);
4554 params->v_wait = seconds;
4555
4556 /* Update timer values in neighbor structure. */
4557 if (argc == 2)
4558 {
paul68980082003-03-25 05:07:42 +00004559 if (ospf)
4560 {
4561 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
4562 if (oi)
4563 ospf_nbr_timer_update (oi);
4564 }
paul718e3742002-12-13 20:15:29 +00004565 }
4566 else
4567 {
4568 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4569 if ((oi = rn->info))
4570 ospf_nbr_timer_update (oi);
4571 }
4572
4573 return CMD_SUCCESS;
4574}
4575
4576ALIAS (ip_ospf_dead_interval,
4577 ip_ospf_dead_interval_cmd,
4578 "ip ospf dead-interval <1-65535>",
4579 "IP Information\n"
4580 "OSPF interface commands\n"
4581 "Interval after which a neighbor is declared dead\n"
4582 "Seconds\n")
4583
4584ALIAS (ip_ospf_dead_interval,
4585 ospf_dead_interval_cmd,
4586 "ospf dead-interval <1-65535>",
4587 "OSPF interface commands\n"
4588 "Interval after which a neighbor is declared dead\n"
4589 "Seconds\n")
4590
4591DEFUN (no_ip_ospf_dead_interval,
4592 no_ip_ospf_dead_interval_addr_cmd,
4593 "no ip ospf dead-interval A.B.C.D",
4594 NO_STR
4595 "IP Information\n"
4596 "OSPF interface commands\n"
4597 "Interval after which a neighbor is declared dead\n"
4598 "Address of interface")
4599{
4600 struct interface *ifp = vty->index;
4601 struct in_addr addr;
4602 int ret;
4603 struct ospf_if_params *params;
4604 struct ospf_interface *oi;
4605 struct route_node *rn;
paul020709f2003-04-04 02:44:16 +00004606 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00004607
paul020709f2003-04-04 02:44:16 +00004608 ospf = ospf_lookup ();
4609
paul718e3742002-12-13 20:15:29 +00004610 ifp = vty->index;
4611 params = IF_DEF_PARAMS (ifp);
4612
4613 if (argc == 1)
4614 {
4615 ret = inet_aton(argv[0], &addr);
4616 if (!ret)
4617 {
4618 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4619 VTY_NEWLINE);
4620 return CMD_WARNING;
4621 }
4622
4623 params = ospf_lookup_if_params (ifp, addr);
4624 if (params == NULL)
4625 return CMD_SUCCESS;
4626 }
4627
4628 UNSET_IF_PARAM (params, v_wait);
4629 params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
4630
4631 if (params != IF_DEF_PARAMS (ifp))
4632 {
4633 ospf_free_if_params (ifp, addr);
4634 ospf_if_update_params (ifp, addr);
4635 }
4636
4637 /* Update timer values in neighbor structure. */
4638 if (argc == 1)
4639 {
paul68980082003-03-25 05:07:42 +00004640 if (ospf)
4641 {
4642 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
4643 if (oi)
4644 ospf_nbr_timer_update (oi);
4645 }
paul718e3742002-12-13 20:15:29 +00004646 }
4647 else
4648 {
4649 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4650 if ((oi = rn->info))
4651 ospf_nbr_timer_update (oi);
4652 }
4653
4654 return CMD_SUCCESS;
4655}
4656
4657ALIAS (no_ip_ospf_dead_interval,
4658 no_ip_ospf_dead_interval_cmd,
4659 "no ip ospf dead-interval",
4660 NO_STR
4661 "IP Information\n"
4662 "OSPF interface commands\n"
4663 "Interval after which a neighbor is declared dead\n")
4664
4665ALIAS (no_ip_ospf_dead_interval,
4666 no_ospf_dead_interval_cmd,
4667 "no ospf dead-interval",
4668 NO_STR
4669 "OSPF interface commands\n"
4670 "Interval after which a neighbor is declared dead\n")
4671
4672DEFUN (ip_ospf_hello_interval,
4673 ip_ospf_hello_interval_addr_cmd,
4674 "ip ospf hello-interval <1-65535> A.B.C.D",
4675 "IP Information\n"
4676 "OSPF interface commands\n"
4677 "Time between HELLO packets\n"
4678 "Seconds\n"
4679 "Address of interface")
4680{
4681 struct interface *ifp = vty->index;
4682 u_int32_t seconds;
4683 struct in_addr addr;
4684 int ret;
4685 struct ospf_if_params *params;
4686
4687 params = IF_DEF_PARAMS (ifp);
4688
4689 seconds = strtol (argv[0], NULL, 10);
4690
4691 /* HelloInterval range is <1-65535>. */
4692 if (seconds < 1 || seconds > 65535)
4693 {
4694 vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
4695 return CMD_WARNING;
4696 }
4697
4698 if (argc == 2)
4699 {
4700 ret = inet_aton(argv[1], &addr);
4701 if (!ret)
4702 {
4703 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4704 VTY_NEWLINE);
4705 return CMD_WARNING;
4706 }
4707
4708 params = ospf_get_if_params (ifp, addr);
4709 ospf_if_update_params (ifp, addr);
4710 }
4711
4712 SET_IF_PARAM (params, v_hello);
4713 params->v_hello = seconds;
4714
4715 return CMD_SUCCESS;
4716}
4717
4718ALIAS (ip_ospf_hello_interval,
4719 ip_ospf_hello_interval_cmd,
4720 "ip ospf hello-interval <1-65535>",
4721 "IP Information\n"
4722 "OSPF interface commands\n"
4723 "Time between HELLO packets\n"
4724 "Seconds\n")
4725
4726ALIAS (ip_ospf_hello_interval,
4727 ospf_hello_interval_cmd,
4728 "ospf hello-interval <1-65535>",
4729 "OSPF interface commands\n"
4730 "Time between HELLO packets\n"
4731 "Seconds\n")
4732
4733DEFUN (no_ip_ospf_hello_interval,
4734 no_ip_ospf_hello_interval_addr_cmd,
4735 "no ip ospf hello-interval A.B.C.D",
4736 NO_STR
4737 "IP Information\n"
4738 "OSPF interface commands\n"
4739 "Time between HELLO packets\n"
4740 "Address of interface")
4741{
4742 struct interface *ifp = vty->index;
4743 struct in_addr addr;
4744 int ret;
4745 struct ospf_if_params *params;
4746
4747 ifp = vty->index;
4748 params = IF_DEF_PARAMS (ifp);
4749
4750 if (argc == 1)
4751 {
4752 ret = inet_aton(argv[0], &addr);
4753 if (!ret)
4754 {
4755 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4756 VTY_NEWLINE);
4757 return CMD_WARNING;
4758 }
4759
4760 params = ospf_lookup_if_params (ifp, addr);
4761 if (params == NULL)
4762 return CMD_SUCCESS;
4763 }
4764
4765 UNSET_IF_PARAM (params, v_hello);
4766 params->v_hello = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
4767
4768 if (params != IF_DEF_PARAMS (ifp))
4769 {
4770 ospf_free_if_params (ifp, addr);
4771 ospf_if_update_params (ifp, addr);
4772 }
4773
4774 return CMD_SUCCESS;
4775}
4776
4777ALIAS (no_ip_ospf_hello_interval,
4778 no_ip_ospf_hello_interval_cmd,
4779 "no ip ospf hello-interval",
4780 NO_STR
4781 "IP Information\n"
4782 "OSPF interface commands\n"
4783 "Time between HELLO packets\n")
4784
4785ALIAS (no_ip_ospf_hello_interval,
4786 no_ospf_hello_interval_cmd,
4787 "no ospf hello-interval",
4788 NO_STR
4789 "OSPF interface commands\n"
4790 "Time between HELLO packets\n")
4791
4792DEFUN (ip_ospf_network,
4793 ip_ospf_network_cmd,
4794 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4795 "IP Information\n"
4796 "OSPF interface commands\n"
4797 "Network type\n"
4798 "Specify OSPF broadcast multi-access network\n"
4799 "Specify OSPF NBMA network\n"
4800 "Specify OSPF point-to-multipoint network\n"
4801 "Specify OSPF point-to-point network\n")
4802{
4803 struct interface *ifp = vty->index;
4804 int old_type = IF_DEF_PARAMS (ifp)->type;
4805 struct route_node *rn;
4806
4807 if (strncmp (argv[0], "b", 1) == 0)
4808 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
4809 else if (strncmp (argv[0], "n", 1) == 0)
4810 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
4811 else if (strncmp (argv[0], "point-to-m", 10) == 0)
4812 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
4813 else if (strncmp (argv[0], "point-to-p", 10) == 0)
4814 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
4815
4816 if (IF_DEF_PARAMS (ifp)->type == old_type)
4817 return CMD_SUCCESS;
4818
4819 SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
4820
4821 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4822 {
4823 struct ospf_interface *oi = rn->info;
4824
4825 if (!oi)
4826 continue;
4827
4828 oi->type = IF_DEF_PARAMS (ifp)->type;
4829
4830 if (oi->state > ISM_Down)
4831 {
4832 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
4833 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
4834 }
4835 }
4836
4837 return CMD_SUCCESS;
4838}
4839
4840ALIAS (ip_ospf_network,
4841 ospf_network_cmd,
4842 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4843 "OSPF interface commands\n"
4844 "Network type\n"
4845 "Specify OSPF broadcast multi-access network\n"
4846 "Specify OSPF NBMA network\n"
4847 "Specify OSPF point-to-multipoint network\n"
4848 "Specify OSPF point-to-point network\n")
4849
4850DEFUN (no_ip_ospf_network,
4851 no_ip_ospf_network_cmd,
4852 "no ip ospf network",
4853 NO_STR
4854 "IP Information\n"
4855 "OSPF interface commands\n"
4856 "Network type\n")
4857{
4858 struct interface *ifp = vty->index;
4859 int old_type = IF_DEF_PARAMS (ifp)->type;
4860 struct route_node *rn;
4861
4862 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
4863
4864 if (IF_DEF_PARAMS (ifp)->type == old_type)
4865 return CMD_SUCCESS;
4866
4867 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4868 {
4869 struct ospf_interface *oi = rn->info;
4870
4871 if (!oi)
4872 continue;
4873
4874 oi->type = IF_DEF_PARAMS (ifp)->type;
4875
4876 if (oi->state > ISM_Down)
4877 {
4878 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
4879 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
4880 }
4881 }
4882
4883 return CMD_SUCCESS;
4884}
4885
4886ALIAS (no_ip_ospf_network,
4887 no_ospf_network_cmd,
4888 "no ospf network",
4889 NO_STR
4890 "OSPF interface commands\n"
4891 "Network type\n")
4892
4893DEFUN (ip_ospf_priority,
4894 ip_ospf_priority_addr_cmd,
4895 "ip ospf priority <0-255> A.B.C.D",
4896 "IP Information\n"
4897 "OSPF interface commands\n"
4898 "Router priority\n"
4899 "Priority\n"
4900 "Address of interface")
4901{
4902 struct interface *ifp = vty->index;
4903 u_int32_t priority;
4904 struct route_node *rn;
4905 struct in_addr addr;
4906 int ret;
4907 struct ospf_if_params *params;
4908
4909 params = IF_DEF_PARAMS (ifp);
4910
4911 priority = strtol (argv[0], NULL, 10);
4912
4913 /* Router Priority range is <0-255>. */
4914 if (priority < 0 || priority > 255)
4915 {
4916 vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
4917 return CMD_WARNING;
4918 }
4919
4920 if (argc == 2)
4921 {
4922 ret = inet_aton(argv[1], &addr);
4923 if (!ret)
4924 {
4925 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4926 VTY_NEWLINE);
4927 return CMD_WARNING;
4928 }
4929
4930 params = ospf_get_if_params (ifp, addr);
4931 ospf_if_update_params (ifp, addr);
4932 }
4933
4934 SET_IF_PARAM (params, priority);
4935 params->priority = priority;
4936
4937 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4938 {
4939 struct ospf_interface *oi = rn->info;
4940
4941 if (!oi)
4942 continue;
4943
4944
4945 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
4946 {
4947 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
4948 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
4949 }
4950 }
4951
4952 return CMD_SUCCESS;
4953}
4954
4955ALIAS (ip_ospf_priority,
4956 ip_ospf_priority_cmd,
4957 "ip ospf priority <0-255>",
4958 "IP Information\n"
4959 "OSPF interface commands\n"
4960 "Router priority\n"
4961 "Priority\n")
4962
4963ALIAS (ip_ospf_priority,
4964 ospf_priority_cmd,
4965 "ospf priority <0-255>",
4966 "OSPF interface commands\n"
4967 "Router priority\n"
4968 "Priority\n")
4969
4970DEFUN (no_ip_ospf_priority,
4971 no_ip_ospf_priority_addr_cmd,
4972 "no ip ospf priority A.B.C.D",
4973 NO_STR
4974 "IP Information\n"
4975 "OSPF interface commands\n"
4976 "Router priority\n"
4977 "Address of interface")
4978{
4979 struct interface *ifp = vty->index;
4980 struct route_node *rn;
4981 struct in_addr addr;
4982 int ret;
4983 struct ospf_if_params *params;
4984
4985 ifp = vty->index;
4986 params = IF_DEF_PARAMS (ifp);
4987
4988 if (argc == 1)
4989 {
4990 ret = inet_aton(argv[0], &addr);
4991 if (!ret)
4992 {
4993 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4994 VTY_NEWLINE);
4995 return CMD_WARNING;
4996 }
4997
4998 params = ospf_lookup_if_params (ifp, addr);
4999 if (params == NULL)
5000 return CMD_SUCCESS;
5001 }
5002
5003 UNSET_IF_PARAM (params, priority);
5004 params->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
5005
5006 if (params != IF_DEF_PARAMS (ifp))
5007 {
5008 ospf_free_if_params (ifp, addr);
5009 ospf_if_update_params (ifp, addr);
5010 }
5011
5012 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5013 {
5014 struct ospf_interface *oi = rn->info;
5015
5016 if (!oi)
5017 continue;
5018
5019
5020 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
5021 {
5022 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
5023 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
5024 }
5025 }
5026
5027 return CMD_SUCCESS;
5028}
5029
5030ALIAS (no_ip_ospf_priority,
5031 no_ip_ospf_priority_cmd,
5032 "no ip ospf priority",
5033 NO_STR
5034 "IP Information\n"
5035 "OSPF interface commands\n"
5036 "Router priority\n")
5037
5038ALIAS (no_ip_ospf_priority,
5039 no_ospf_priority_cmd,
5040 "no ospf priority",
5041 NO_STR
5042 "OSPF interface commands\n"
5043 "Router priority\n")
5044
5045DEFUN (ip_ospf_retransmit_interval,
5046 ip_ospf_retransmit_interval_addr_cmd,
5047 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5048 "IP Information\n"
5049 "OSPF interface commands\n"
5050 "Time between retransmitting lost link state advertisements\n"
5051 "Seconds\n"
5052 "Address of interface")
5053{
5054 struct interface *ifp = vty->index;
5055 u_int32_t seconds;
5056 struct in_addr addr;
5057 int ret;
5058 struct ospf_if_params *params;
5059
5060 params = IF_DEF_PARAMS (ifp);
5061 seconds = strtol (argv[0], NULL, 10);
5062
5063 /* Retransmit Interval range is <3-65535>. */
5064 if (seconds < 3 || seconds > 65535)
5065 {
5066 vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
5067 return CMD_WARNING;
5068 }
5069
5070
5071 if (argc == 2)
5072 {
5073 ret = inet_aton(argv[1], &addr);
5074 if (!ret)
5075 {
5076 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5077 VTY_NEWLINE);
5078 return CMD_WARNING;
5079 }
5080
5081 params = ospf_get_if_params (ifp, addr);
5082 ospf_if_update_params (ifp, addr);
5083 }
5084
5085 SET_IF_PARAM (params, retransmit_interval);
5086 params->retransmit_interval = seconds;
5087
5088 return CMD_SUCCESS;
5089}
5090
5091ALIAS (ip_ospf_retransmit_interval,
5092 ip_ospf_retransmit_interval_cmd,
5093 "ip ospf retransmit-interval <3-65535>",
5094 "IP Information\n"
5095 "OSPF interface commands\n"
5096 "Time between retransmitting lost link state advertisements\n"
5097 "Seconds\n")
5098
5099ALIAS (ip_ospf_retransmit_interval,
5100 ospf_retransmit_interval_cmd,
5101 "ospf retransmit-interval <3-65535>",
5102 "OSPF interface commands\n"
5103 "Time between retransmitting lost link state advertisements\n"
5104 "Seconds\n")
5105
5106DEFUN (no_ip_ospf_retransmit_interval,
5107 no_ip_ospf_retransmit_interval_addr_cmd,
5108 "no ip ospf retransmit-interval A.B.C.D",
5109 NO_STR
5110 "IP Information\n"
5111 "OSPF interface commands\n"
5112 "Time between retransmitting lost link state advertisements\n"
5113 "Address of interface")
5114{
5115 struct interface *ifp = vty->index;
5116 struct in_addr addr;
5117 int ret;
5118 struct ospf_if_params *params;
5119
5120 ifp = vty->index;
5121 params = IF_DEF_PARAMS (ifp);
5122
5123 if (argc == 1)
5124 {
5125 ret = inet_aton(argv[0], &addr);
5126 if (!ret)
5127 {
5128 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5129 VTY_NEWLINE);
5130 return CMD_WARNING;
5131 }
5132
5133 params = ospf_lookup_if_params (ifp, addr);
5134 if (params == NULL)
5135 return CMD_SUCCESS;
5136 }
5137
5138 UNSET_IF_PARAM (params, retransmit_interval);
5139 params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
5140
5141 if (params != IF_DEF_PARAMS (ifp))
5142 {
5143 ospf_free_if_params (ifp, addr);
5144 ospf_if_update_params (ifp, addr);
5145 }
5146
5147 return CMD_SUCCESS;
5148}
5149
5150ALIAS (no_ip_ospf_retransmit_interval,
5151 no_ip_ospf_retransmit_interval_cmd,
5152 "no ip ospf retransmit-interval",
5153 NO_STR
5154 "IP Information\n"
5155 "OSPF interface commands\n"
5156 "Time between retransmitting lost link state advertisements\n")
5157
5158ALIAS (no_ip_ospf_retransmit_interval,
5159 no_ospf_retransmit_interval_cmd,
5160 "no ospf retransmit-interval",
5161 NO_STR
5162 "OSPF interface commands\n"
5163 "Time between retransmitting lost link state advertisements\n")
5164
5165DEFUN (ip_ospf_transmit_delay,
5166 ip_ospf_transmit_delay_addr_cmd,
5167 "ip ospf transmit-delay <1-65535> A.B.C.D",
5168 "IP Information\n"
5169 "OSPF interface commands\n"
5170 "Link state transmit delay\n"
5171 "Seconds\n"
5172 "Address of interface")
5173{
5174 struct interface *ifp = vty->index;
5175 u_int32_t seconds;
5176 struct in_addr addr;
5177 int ret;
5178 struct ospf_if_params *params;
5179
5180 params = IF_DEF_PARAMS (ifp);
5181 seconds = strtol (argv[0], NULL, 10);
5182
5183 /* Transmit Delay range is <1-65535>. */
5184 if (seconds < 1 || seconds > 65535)
5185 {
5186 vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
5187 return CMD_WARNING;
5188 }
5189
5190 if (argc == 2)
5191 {
5192 ret = inet_aton(argv[1], &addr);
5193 if (!ret)
5194 {
5195 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5196 VTY_NEWLINE);
5197 return CMD_WARNING;
5198 }
5199
5200 params = ospf_get_if_params (ifp, addr);
5201 ospf_if_update_params (ifp, addr);
5202 }
5203
5204 SET_IF_PARAM (params, transmit_delay);
5205 params->transmit_delay = seconds;
5206
5207 return CMD_SUCCESS;
5208}
5209
5210ALIAS (ip_ospf_transmit_delay,
5211 ip_ospf_transmit_delay_cmd,
5212 "ip ospf transmit-delay <1-65535>",
5213 "IP Information\n"
5214 "OSPF interface commands\n"
5215 "Link state transmit delay\n"
5216 "Seconds\n")
5217
5218ALIAS (ip_ospf_transmit_delay,
5219 ospf_transmit_delay_cmd,
5220 "ospf transmit-delay <1-65535>",
5221 "OSPF interface commands\n"
5222 "Link state transmit delay\n"
5223 "Seconds\n")
5224
5225DEFUN (no_ip_ospf_transmit_delay,
5226 no_ip_ospf_transmit_delay_addr_cmd,
5227 "no ip ospf transmit-delay A.B.C.D",
5228 NO_STR
5229 "IP Information\n"
5230 "OSPF interface commands\n"
5231 "Link state transmit delay\n"
5232 "Address of interface")
5233{
5234 struct interface *ifp = vty->index;
5235 struct in_addr addr;
5236 int ret;
5237 struct ospf_if_params *params;
5238
5239 ifp = vty->index;
5240 params = IF_DEF_PARAMS (ifp);
5241
5242 if (argc == 1)
5243 {
5244 ret = inet_aton(argv[0], &addr);
5245 if (!ret)
5246 {
5247 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5248 VTY_NEWLINE);
5249 return CMD_WARNING;
5250 }
5251
5252 params = ospf_lookup_if_params (ifp, addr);
5253 if (params == NULL)
5254 return CMD_SUCCESS;
5255 }
5256
5257 UNSET_IF_PARAM (params, transmit_delay);
5258 params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
5259
5260 if (params != IF_DEF_PARAMS (ifp))
5261 {
5262 ospf_free_if_params (ifp, addr);
5263 ospf_if_update_params (ifp, addr);
5264 }
5265
5266 return CMD_SUCCESS;
5267}
5268
5269ALIAS (no_ip_ospf_transmit_delay,
5270 no_ip_ospf_transmit_delay_cmd,
5271 "no ip ospf transmit-delay",
5272 NO_STR
5273 "IP Information\n"
5274 "OSPF interface commands\n"
5275 "Link state transmit delay\n")
5276
5277ALIAS (no_ip_ospf_transmit_delay,
5278 no_ospf_transmit_delay_cmd,
5279 "no ospf transmit-delay",
5280 NO_STR
5281 "OSPF interface commands\n"
5282 "Link state transmit delay\n")
5283
5284
5285DEFUN (ospf_redistribute_source_metric_type,
5286 ospf_redistribute_source_metric_type_routemap_cmd,
5287 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5288 "Redistribute information from another routing protocol\n"
5289 "Kernel routes\n"
5290 "Connected\n"
5291 "Static routes\n"
5292 "Routing Information Protocol (RIP)\n"
5293 "Border Gateway Protocol (BGP)\n"
5294 "Metric for redistributed routes\n"
5295 "OSPF default metric\n"
5296 "OSPF exterior metric type for redistributed routes\n"
5297 "Set OSPF External Type 1 metrics\n"
5298 "Set OSPF External Type 2 metrics\n"
5299 "Route map reference\n"
5300 "Pointer to route-map entries\n")
5301{
paul020709f2003-04-04 02:44:16 +00005302 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005303 int source;
5304 int type = -1;
5305 int metric = -1;
5306
5307 /* Get distribute source. */
5308 if (!str2distribute_source (argv[0], &source))
5309 return CMD_WARNING;
5310
5311 /* Get metric value. */
5312 if (argc >= 2)
5313 if (!str2metric (argv[1], &metric))
5314 return CMD_WARNING;
5315
5316 /* Get metric type. */
5317 if (argc >= 3)
5318 if (!str2metric_type (argv[2], &type))
5319 return CMD_WARNING;
5320
5321 if (argc == 4)
paul020709f2003-04-04 02:44:16 +00005322 ospf_routemap_set (ospf, source, argv[3]);
paul718e3742002-12-13 20:15:29 +00005323 else
paul020709f2003-04-04 02:44:16 +00005324 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005325
paul020709f2003-04-04 02:44:16 +00005326 return ospf_redistribute_set (ospf, source, type, metric);
paul718e3742002-12-13 20:15:29 +00005327}
5328
5329ALIAS (ospf_redistribute_source_metric_type,
5330 ospf_redistribute_source_metric_type_cmd,
5331 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5332 "Redistribute information from another routing protocol\n"
5333 "Kernel routes\n"
5334 "Connected\n"
5335 "Static routes\n"
5336 "Routing Information Protocol (RIP)\n"
5337 "Border Gateway Protocol (BGP)\n"
5338 "Metric for redistributed routes\n"
5339 "OSPF default metric\n"
5340 "OSPF exterior metric type for redistributed routes\n"
5341 "Set OSPF External Type 1 metrics\n"
5342 "Set OSPF External Type 2 metrics\n")
5343
5344ALIAS (ospf_redistribute_source_metric_type,
5345 ospf_redistribute_source_metric_cmd,
5346 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>",
5347 "Redistribute information from another routing protocol\n"
5348 "Kernel routes\n"
5349 "Connected\n"
5350 "Static routes\n"
5351 "Routing Information Protocol (RIP)\n"
5352 "Border Gateway Protocol (BGP)\n"
5353 "Metric for redistributed routes\n"
5354 "OSPF default metric\n")
5355
5356DEFUN (ospf_redistribute_source_type_metric,
5357 ospf_redistribute_source_type_metric_routemap_cmd,
5358 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5359 "Redistribute information from another routing protocol\n"
5360 "Kernel routes\n"
5361 "Connected\n"
5362 "Static routes\n"
5363 "Routing Information Protocol (RIP)\n"
5364 "Border Gateway Protocol (BGP)\n"
5365 "OSPF exterior metric type for redistributed routes\n"
5366 "Set OSPF External Type 1 metrics\n"
5367 "Set OSPF External Type 2 metrics\n"
5368 "Metric for redistributed routes\n"
5369 "OSPF default metric\n"
5370 "Route map reference\n"
5371 "Pointer to route-map entries\n")
5372{
paul020709f2003-04-04 02:44:16 +00005373 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005374 int source;
5375 int type = -1;
5376 int metric = -1;
5377
5378 /* Get distribute source. */
5379 if (!str2distribute_source (argv[0], &source))
5380 return CMD_WARNING;
5381
5382 /* Get metric value. */
5383 if (argc >= 2)
5384 if (!str2metric_type (argv[1], &type))
5385 return CMD_WARNING;
5386
5387 /* Get metric type. */
5388 if (argc >= 3)
5389 if (!str2metric (argv[2], &metric))
5390 return CMD_WARNING;
5391
5392 if (argc == 4)
paul020709f2003-04-04 02:44:16 +00005393 ospf_routemap_set (ospf, source, argv[3]);
paul718e3742002-12-13 20:15:29 +00005394 else
paul020709f2003-04-04 02:44:16 +00005395 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005396
paul020709f2003-04-04 02:44:16 +00005397 return ospf_redistribute_set (ospf, source, type, metric);
paul718e3742002-12-13 20:15:29 +00005398}
5399
5400ALIAS (ospf_redistribute_source_type_metric,
5401 ospf_redistribute_source_type_metric_cmd,
5402 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5403 "Redistribute information from another routing protocol\n"
5404 "Kernel routes\n"
5405 "Connected\n"
5406 "Static routes\n"
5407 "Routing Information Protocol (RIP)\n"
5408 "Border Gateway Protocol (BGP)\n"
5409 "OSPF exterior metric type for redistributed routes\n"
5410 "Set OSPF External Type 1 metrics\n"
5411 "Set OSPF External Type 2 metrics\n"
5412 "Metric for redistributed routes\n"
5413 "OSPF default metric\n")
5414
5415ALIAS (ospf_redistribute_source_type_metric,
5416 ospf_redistribute_source_type_cmd,
5417 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5418 "Redistribute information from another routing protocol\n"
5419 "Kernel routes\n"
5420 "Connected\n"
5421 "Static routes\n"
5422 "Routing Information Protocol (RIP)\n"
5423 "Border Gateway Protocol (BGP)\n"
5424 "OSPF exterior metric type for redistributed routes\n"
5425 "Set OSPF External Type 1 metrics\n"
5426 "Set OSPF External Type 2 metrics\n")
5427
5428ALIAS (ospf_redistribute_source_type_metric,
5429 ospf_redistribute_source_cmd,
5430 "redistribute (kernel|connected|static|rip|bgp)",
5431 "Redistribute information from another routing protocol\n"
5432 "Kernel routes\n"
5433 "Connected\n"
5434 "Static routes\n"
5435 "Routing Information Protocol (RIP)\n"
5436 "Border Gateway Protocol (BGP)\n")
5437
5438DEFUN (ospf_redistribute_source_metric_routemap,
5439 ospf_redistribute_source_metric_routemap_cmd,
5440 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5441 "Redistribute information from another routing protocol\n"
5442 "Kernel routes\n"
5443 "Connected\n"
5444 "Static routes\n"
5445 "Routing Information Protocol (RIP)\n"
5446 "Border Gateway Protocol (BGP)\n"
5447 "Metric for redistributed routes\n"
5448 "OSPF default metric\n"
5449 "Route map reference\n"
5450 "Pointer to route-map entries\n")
5451{
paul020709f2003-04-04 02:44:16 +00005452 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005453 int source;
5454 int metric = -1;
5455
5456 /* Get distribute source. */
5457 if (!str2distribute_source (argv[0], &source))
5458 return CMD_WARNING;
5459
5460 /* Get metric value. */
5461 if (argc >= 2)
5462 if (!str2metric (argv[1], &metric))
5463 return CMD_WARNING;
5464
5465 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005466 ospf_routemap_set (ospf, source, argv[2]);
paul718e3742002-12-13 20:15:29 +00005467 else
paul020709f2003-04-04 02:44:16 +00005468 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005469
paul020709f2003-04-04 02:44:16 +00005470 return ospf_redistribute_set (ospf, source, -1, metric);
paul718e3742002-12-13 20:15:29 +00005471}
5472
5473DEFUN (ospf_redistribute_source_type_routemap,
5474 ospf_redistribute_source_type_routemap_cmd,
5475 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5476 "Redistribute information from another routing protocol\n"
5477 "Kernel routes\n"
5478 "Connected\n"
5479 "Static routes\n"
5480 "Routing Information Protocol (RIP)\n"
5481 "Border Gateway Protocol (BGP)\n"
5482 "OSPF exterior metric type for redistributed routes\n"
5483 "Set OSPF External Type 1 metrics\n"
5484 "Set OSPF External Type 2 metrics\n"
5485 "Route map reference\n"
5486 "Pointer to route-map entries\n")
5487{
paul020709f2003-04-04 02:44:16 +00005488 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005489 int source;
5490 int type = -1;
5491
5492 /* Get distribute source. */
5493 if (!str2distribute_source (argv[0], &source))
5494 return CMD_WARNING;
5495
5496 /* Get metric value. */
5497 if (argc >= 2)
5498 if (!str2metric_type (argv[1], &type))
5499 return CMD_WARNING;
5500
5501 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005502 ospf_routemap_set (ospf, source, argv[2]);
paul718e3742002-12-13 20:15:29 +00005503 else
paul020709f2003-04-04 02:44:16 +00005504 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005505
paul020709f2003-04-04 02:44:16 +00005506 return ospf_redistribute_set (ospf, source, type, -1);
paul718e3742002-12-13 20:15:29 +00005507}
5508
5509DEFUN (ospf_redistribute_source_routemap,
5510 ospf_redistribute_source_routemap_cmd,
5511 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5512 "Redistribute information from another routing protocol\n"
5513 "Kernel routes\n"
5514 "Connected\n"
5515 "Static routes\n"
5516 "Routing Information Protocol (RIP)\n"
5517 "Border Gateway Protocol (BGP)\n"
5518 "Route map reference\n"
5519 "Pointer to route-map entries\n")
5520{
paul020709f2003-04-04 02:44:16 +00005521 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005522 int source;
5523
5524 /* Get distribute source. */
5525 if (!str2distribute_source (argv[0], &source))
5526 return CMD_WARNING;
5527
5528 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005529 ospf_routemap_set (ospf, source, argv[1]);
paul718e3742002-12-13 20:15:29 +00005530 else
paul020709f2003-04-04 02:44:16 +00005531 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005532
paul020709f2003-04-04 02:44:16 +00005533 return ospf_redistribute_set (ospf, source, -1, -1);
paul718e3742002-12-13 20:15:29 +00005534}
5535
5536DEFUN (no_ospf_redistribute_source,
5537 no_ospf_redistribute_source_cmd,
5538 "no redistribute (kernel|connected|static|rip|bgp)",
5539 NO_STR
5540 "Redistribute information from another routing protocol\n"
5541 "Kernel routes\n"
5542 "Connected\n"
5543 "Static routes\n"
5544 "Routing Information Protocol (RIP)\n"
5545 "Border Gateway Protocol (BGP)\n")
5546{
paul020709f2003-04-04 02:44:16 +00005547 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005548 int source;
5549
5550 if (!str2distribute_source (argv[0], &source))
5551 return CMD_WARNING;
5552
paul020709f2003-04-04 02:44:16 +00005553 ospf_routemap_unset (ospf, source);
5554 return ospf_redistribute_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005555}
5556
5557DEFUN (ospf_distribute_list_out,
5558 ospf_distribute_list_out_cmd,
5559 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5560 "Filter networks in routing updates\n"
5561 "Access-list name\n"
5562 OUT_STR
5563 "Kernel routes\n"
5564 "Connected\n"
5565 "Static routes\n"
5566 "Routing Information Protocol (RIP)\n"
5567 "Border Gateway Protocol (BGP)\n")
5568{
paul68980082003-03-25 05:07:42 +00005569 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005570 int source;
5571
5572 /* Get distribute source. */
5573 if (!str2distribute_source (argv[1], &source))
5574 return CMD_WARNING;
5575
paul68980082003-03-25 05:07:42 +00005576 return ospf_distribute_list_out_set (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00005577}
5578
5579DEFUN (no_ospf_distribute_list_out,
5580 no_ospf_distribute_list_out_cmd,
5581 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5582 NO_STR
5583 "Filter networks in routing updates\n"
5584 "Access-list name\n"
5585 OUT_STR
5586 "Kernel routes\n"
5587 "Connected\n"
5588 "Static routes\n"
5589 "Routing Information Protocol (RIP)\n"
5590 "Border Gateway Protocol (BGP)\n")
5591{
paul68980082003-03-25 05:07:42 +00005592 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005593 int source;
5594
5595 if (!str2distribute_source (argv[1], &source))
5596 return CMD_WARNING;
5597
paul68980082003-03-25 05:07:42 +00005598 return ospf_distribute_list_out_unset (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00005599}
5600
5601/* Default information originate. */
5602DEFUN (ospf_default_information_originate_metric_type_routemap,
5603 ospf_default_information_originate_metric_type_routemap_cmd,
5604 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5605 "Control distribution of default information\n"
5606 "Distribute a default route\n"
5607 "OSPF default metric\n"
5608 "OSPF metric\n"
5609 "OSPF metric type for default routes\n"
5610 "Set OSPF External Type 1 metrics\n"
5611 "Set OSPF External Type 2 metrics\n"
5612 "Route map reference\n"
5613 "Pointer to route-map entries\n")
5614{
paul020709f2003-04-04 02:44:16 +00005615 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005616 int type = -1;
5617 int metric = -1;
5618
5619 /* Get metric value. */
5620 if (argc >= 1)
5621 if (!str2metric (argv[0], &metric))
5622 return CMD_WARNING;
5623
5624 /* Get metric type. */
5625 if (argc >= 2)
5626 if (!str2metric_type (argv[1], &type))
5627 return CMD_WARNING;
5628
5629 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005630 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005631 else
paul020709f2003-04-04 02:44:16 +00005632 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005633
paul020709f2003-04-04 02:44:16 +00005634 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5635 type, metric);
paul718e3742002-12-13 20:15:29 +00005636}
5637
5638ALIAS (ospf_default_information_originate_metric_type_routemap,
5639 ospf_default_information_originate_metric_type_cmd,
5640 "default-information originate metric <0-16777214> metric-type (1|2)",
5641 "Control distribution of default information\n"
5642 "Distribute a default route\n"
5643 "OSPF default metric\n"
5644 "OSPF metric\n"
5645 "OSPF metric type for default routes\n"
5646 "Set OSPF External Type 1 metrics\n"
5647 "Set OSPF External Type 2 metrics\n")
5648
5649ALIAS (ospf_default_information_originate_metric_type_routemap,
5650 ospf_default_information_originate_metric_cmd,
5651 "default-information originate metric <0-16777214>",
5652 "Control distribution of default information\n"
5653 "Distribute a default route\n"
5654 "OSPF default metric\n"
5655 "OSPF metric\n")
5656
5657ALIAS (ospf_default_information_originate_metric_type_routemap,
5658 ospf_default_information_originate_cmd,
5659 "default-information originate",
5660 "Control distribution of default information\n"
5661 "Distribute a default route\n")
5662
5663/* Default information originate. */
5664DEFUN (ospf_default_information_originate_metric_routemap,
5665 ospf_default_information_originate_metric_routemap_cmd,
5666 "default-information originate metric <0-16777214> route-map WORD",
5667 "Control distribution of default information\n"
5668 "Distribute a default route\n"
5669 "OSPF default metric\n"
5670 "OSPF metric\n"
5671 "Route map reference\n"
5672 "Pointer to route-map entries\n")
5673{
paul020709f2003-04-04 02:44:16 +00005674 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005675 int metric = -1;
5676
5677 /* Get metric value. */
5678 if (argc >= 1)
5679 if (!str2metric (argv[0], &metric))
5680 return CMD_WARNING;
5681
5682 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005683 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00005684 else
paul020709f2003-04-04 02:44:16 +00005685 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005686
paul020709f2003-04-04 02:44:16 +00005687 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5688 -1, metric);
paul718e3742002-12-13 20:15:29 +00005689}
5690
5691/* Default information originate. */
5692DEFUN (ospf_default_information_originate_routemap,
5693 ospf_default_information_originate_routemap_cmd,
5694 "default-information originate route-map WORD",
5695 "Control distribution of default information\n"
5696 "Distribute a default route\n"
5697 "Route map reference\n"
5698 "Pointer to route-map entries\n")
5699{
paul020709f2003-04-04 02:44:16 +00005700 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005701
paul020709f2003-04-04 02:44:16 +00005702 if (argc == 1)
5703 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
5704 else
5705 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
5706
5707 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1);
paul718e3742002-12-13 20:15:29 +00005708}
5709
5710DEFUN (ospf_default_information_originate_type_metric_routemap,
5711 ospf_default_information_originate_type_metric_routemap_cmd,
5712 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
5713 "Control distribution of default information\n"
5714 "Distribute a default route\n"
5715 "OSPF metric type for default routes\n"
5716 "Set OSPF External Type 1 metrics\n"
5717 "Set OSPF External Type 2 metrics\n"
5718 "OSPF default metric\n"
5719 "OSPF metric\n"
5720 "Route map reference\n"
5721 "Pointer to route-map entries\n")
5722{
paul020709f2003-04-04 02:44:16 +00005723 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005724 int type = -1;
5725 int metric = -1;
5726
5727 /* Get metric type. */
5728 if (argc >= 1)
5729 if (!str2metric_type (argv[0], &type))
5730 return CMD_WARNING;
5731
5732 /* Get metric value. */
5733 if (argc >= 2)
5734 if (!str2metric (argv[1], &metric))
5735 return CMD_WARNING;
5736
5737 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005738 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005739 else
paul020709f2003-04-04 02:44:16 +00005740 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005741
paul020709f2003-04-04 02:44:16 +00005742 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5743 type, metric);
paul718e3742002-12-13 20:15:29 +00005744}
5745
5746ALIAS (ospf_default_information_originate_type_metric_routemap,
5747 ospf_default_information_originate_type_metric_cmd,
5748 "default-information originate metric-type (1|2) metric <0-16777214>",
5749 "Control distribution of default information\n"
5750 "Distribute a default route\n"
5751 "OSPF metric type for default routes\n"
5752 "Set OSPF External Type 1 metrics\n"
5753 "Set OSPF External Type 2 metrics\n"
5754 "OSPF default metric\n"
5755 "OSPF metric\n")
5756
5757ALIAS (ospf_default_information_originate_type_metric_routemap,
5758 ospf_default_information_originate_type_cmd,
5759 "default-information originate metric-type (1|2)",
5760 "Control distribution of default information\n"
5761 "Distribute a default route\n"
5762 "OSPF metric type for default routes\n"
5763 "Set OSPF External Type 1 metrics\n"
5764 "Set OSPF External Type 2 metrics\n")
5765
5766DEFUN (ospf_default_information_originate_type_routemap,
5767 ospf_default_information_originate_type_routemap_cmd,
5768 "default-information originate metric-type (1|2) route-map WORD",
5769 "Control distribution of default information\n"
5770 "Distribute a default route\n"
5771 "OSPF metric type for default routes\n"
5772 "Set OSPF External Type 1 metrics\n"
5773 "Set OSPF External Type 2 metrics\n"
5774 "Route map reference\n"
5775 "Pointer to route-map entries\n")
5776{
paul020709f2003-04-04 02:44:16 +00005777 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005778 int type = -1;
5779
5780 /* Get metric type. */
5781 if (argc >= 1)
5782 if (!str2metric_type (argv[0], &type))
5783 return CMD_WARNING;
5784
5785 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005786 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00005787 else
paul020709f2003-04-04 02:44:16 +00005788 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005789
paul020709f2003-04-04 02:44:16 +00005790 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5791 type, -1);
paul718e3742002-12-13 20:15:29 +00005792}
5793
5794DEFUN (ospf_default_information_originate_always_metric_type_routemap,
5795 ospf_default_information_originate_always_metric_type_routemap_cmd,
5796 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5797 "Control distribution of default information\n"
5798 "Distribute a default route\n"
5799 "Always advertise default route\n"
5800 "OSPF default metric\n"
5801 "OSPF metric\n"
5802 "OSPF metric type for default routes\n"
5803 "Set OSPF External Type 1 metrics\n"
5804 "Set OSPF External Type 2 metrics\n"
5805 "Route map reference\n"
5806 "Pointer to route-map entries\n")
5807{
paul020709f2003-04-04 02:44:16 +00005808 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005809 int type = -1;
5810 int metric = -1;
5811
5812 /* Get metric value. */
5813 if (argc >= 1)
5814 if (!str2metric (argv[0], &metric))
5815 return CMD_WARNING;
5816
5817 /* Get metric type. */
5818 if (argc >= 2)
5819 if (!str2metric_type (argv[1], &type))
5820 return CMD_WARNING;
5821
5822 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005823 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005824 else
paul020709f2003-04-04 02:44:16 +00005825 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005826
paul020709f2003-04-04 02:44:16 +00005827 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00005828 type, metric);
5829}
5830
5831ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5832 ospf_default_information_originate_always_metric_type_cmd,
5833 "default-information originate always metric <0-16777214> metric-type (1|2)",
5834 "Control distribution of default information\n"
5835 "Distribute a default route\n"
5836 "Always advertise default route\n"
5837 "OSPF default metric\n"
5838 "OSPF metric\n"
5839 "OSPF metric type for default routes\n"
5840 "Set OSPF External Type 1 metrics\n"
5841 "Set OSPF External Type 2 metrics\n")
5842
5843ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5844 ospf_default_information_originate_always_metric_cmd,
5845 "default-information originate always metric <0-16777214>",
5846 "Control distribution of default information\n"
5847 "Distribute a default route\n"
5848 "Always advertise default route\n"
5849 "OSPF default metric\n"
5850 "OSPF metric\n"
5851 "OSPF metric type for default routes\n")
5852
5853ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5854 ospf_default_information_originate_always_cmd,
5855 "default-information originate always",
5856 "Control distribution of default information\n"
5857 "Distribute a default route\n"
5858 "Always advertise default route\n")
5859
5860DEFUN (ospf_default_information_originate_always_metric_routemap,
5861 ospf_default_information_originate_always_metric_routemap_cmd,
5862 "default-information originate always metric <0-16777214> route-map WORD",
5863 "Control distribution of default information\n"
5864 "Distribute a default route\n"
5865 "Always advertise default route\n"
5866 "OSPF default metric\n"
5867 "OSPF metric\n"
5868 "Route map reference\n"
5869 "Pointer to route-map entries\n")
5870{
paul020709f2003-04-04 02:44:16 +00005871 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005872 int metric = -1;
5873
5874 /* Get metric value. */
5875 if (argc >= 1)
5876 if (!str2metric (argv[0], &metric))
5877 return CMD_WARNING;
5878
5879 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005880 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00005881 else
paul020709f2003-04-04 02:44:16 +00005882 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005883
paul020709f2003-04-04 02:44:16 +00005884 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
5885 -1, metric);
paul718e3742002-12-13 20:15:29 +00005886}
5887
5888DEFUN (ospf_default_information_originate_always_routemap,
5889 ospf_default_information_originate_always_routemap_cmd,
5890 "default-information originate always route-map WORD",
5891 "Control distribution of default information\n"
5892 "Distribute a default route\n"
5893 "Always advertise default route\n"
5894 "Route map reference\n"
5895 "Pointer to route-map entries\n")
5896{
paul020709f2003-04-04 02:44:16 +00005897 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005898
paul020709f2003-04-04 02:44:16 +00005899 if (argc == 1)
5900 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
5901 else
5902 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
5903
5904 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1);
paul718e3742002-12-13 20:15:29 +00005905}
5906
5907DEFUN (ospf_default_information_originate_always_type_metric_routemap,
5908 ospf_default_information_originate_always_type_metric_routemap_cmd,
5909 "default-information originate always metric-type (1|2) metric <0-16777214> 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 "OSPF default metric\n"
5917 "OSPF metric\n"
5918 "Route map reference\n"
5919 "Pointer to route-map entries\n")
5920{
paul020709f2003-04-04 02:44:16 +00005921 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005922 int type = -1;
5923 int metric = -1;
5924
5925 /* Get metric type. */
5926 if (argc >= 1)
5927 if (!str2metric_type (argv[0], &type))
5928 return CMD_WARNING;
5929
5930 /* Get metric value. */
5931 if (argc >= 2)
5932 if (!str2metric (argv[1], &metric))
5933 return CMD_WARNING;
5934
5935 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005936 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005937 else
paul020709f2003-04-04 02:44:16 +00005938 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005939
paul020709f2003-04-04 02:44:16 +00005940 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00005941 type, metric);
5942}
5943
5944ALIAS (ospf_default_information_originate_always_type_metric_routemap,
5945 ospf_default_information_originate_always_type_metric_cmd,
5946 "default-information originate always metric-type (1|2) metric <0-16777214>",
5947 "Control distribution of default information\n"
5948 "Distribute a default route\n"
5949 "Always advertise default route\n"
5950 "OSPF metric type for default routes\n"
5951 "Set OSPF External Type 1 metrics\n"
5952 "Set OSPF External Type 2 metrics\n"
5953 "OSPF default metric\n"
5954 "OSPF metric\n")
5955
5956ALIAS (ospf_default_information_originate_always_type_metric_routemap,
5957 ospf_default_information_originate_always_type_cmd,
5958 "default-information originate always metric-type (1|2)",
5959 "Control distribution of default information\n"
5960 "Distribute a default route\n"
5961 "Always advertise default route\n"
5962 "OSPF metric type for default routes\n"
5963 "Set OSPF External Type 1 metrics\n"
5964 "Set OSPF External Type 2 metrics\n")
5965
5966DEFUN (ospf_default_information_originate_always_type_routemap,
5967 ospf_default_information_originate_always_type_routemap_cmd,
5968 "default-information originate always metric-type (1|2) route-map WORD",
5969 "Control distribution of default information\n"
5970 "Distribute a default route\n"
5971 "Always advertise default route\n"
5972 "OSPF metric type for default routes\n"
5973 "Set OSPF External Type 1 metrics\n"
5974 "Set OSPF External Type 2 metrics\n"
5975 "Route map reference\n"
5976 "Pointer to route-map entries\n")
5977{
paul020709f2003-04-04 02:44:16 +00005978 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005979 int type = -1;
5980
5981 /* Get metric type. */
5982 if (argc >= 1)
5983 if (!str2metric_type (argv[0], &type))
5984 return CMD_WARNING;
5985
5986 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005987 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00005988 else
paul020709f2003-04-04 02:44:16 +00005989 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005990
paul020709f2003-04-04 02:44:16 +00005991 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00005992 type, -1);
5993}
5994
5995DEFUN (no_ospf_default_information_originate,
5996 no_ospf_default_information_originate_cmd,
5997 "no default-information originate",
5998 NO_STR
5999 "Control distribution of default information\n"
6000 "Distribute a default route\n")
6001{
paul68980082003-03-25 05:07:42 +00006002 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006003 struct prefix_ipv4 p;
6004 struct in_addr nexthop;
6005
6006 p.family = AF_INET;
6007 p.prefix.s_addr = 0;
6008 p.prefixlen = 0;
6009
paul68980082003-03-25 05:07:42 +00006010 ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0, nexthop);
paul718e3742002-12-13 20:15:29 +00006011
6012 if (EXTERNAL_INFO (DEFAULT_ROUTE)) {
6013 ospf_external_info_delete (DEFAULT_ROUTE, p);
6014 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE));
6015 EXTERNAL_INFO (DEFAULT_ROUTE) = NULL;
6016 }
6017
paul020709f2003-04-04 02:44:16 +00006018 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
6019 return ospf_redistribute_default_unset (ospf);
paul718e3742002-12-13 20:15:29 +00006020}
6021
6022DEFUN (ospf_default_metric,
6023 ospf_default_metric_cmd,
6024 "default-metric <0-16777214>",
6025 "Set metric of redistributed routes\n"
6026 "Default metric\n")
6027{
paul68980082003-03-25 05:07:42 +00006028 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006029 int metric = -1;
6030
6031 if (!str2metric (argv[0], &metric))
6032 return CMD_WARNING;
6033
paul68980082003-03-25 05:07:42 +00006034 ospf->default_metric = metric;
paul718e3742002-12-13 20:15:29 +00006035
6036 return CMD_SUCCESS;
6037}
6038
6039DEFUN (no_ospf_default_metric,
6040 no_ospf_default_metric_cmd,
6041 "no default-metric",
6042 NO_STR
6043 "Set metric of redistributed routes\n")
6044{
paul68980082003-03-25 05:07:42 +00006045 struct ospf *ospf = vty->index;
6046
6047 ospf->default_metric = -1;
6048
paul718e3742002-12-13 20:15:29 +00006049 return CMD_SUCCESS;
6050}
6051
6052ALIAS (no_ospf_default_metric,
6053 no_ospf_default_metric_val_cmd,
6054 "no default-metric <0-16777214>",
6055 NO_STR
6056 "Set metric of redistributed routes\n"
6057 "Default metric\n")
6058
6059DEFUN (ospf_distance,
6060 ospf_distance_cmd,
6061 "distance <1-255>",
6062 "Define an administrative distance\n"
6063 "OSPF Administrative distance\n")
6064{
paul68980082003-03-25 05:07:42 +00006065 struct ospf *ospf = vty->index;
6066
6067 ospf->distance_all = atoi (argv[0]);
6068
paul718e3742002-12-13 20:15:29 +00006069 return CMD_SUCCESS;
6070}
6071
6072DEFUN (no_ospf_distance,
6073 no_ospf_distance_cmd,
6074 "no distance <1-255>",
6075 NO_STR
6076 "Define an administrative distance\n"
6077 "OSPF Administrative distance\n")
6078{
paul68980082003-03-25 05:07:42 +00006079 struct ospf *ospf = vty->index;
6080
6081 ospf->distance_all = 0;
6082
paul718e3742002-12-13 20:15:29 +00006083 return CMD_SUCCESS;
6084}
6085
6086DEFUN (no_ospf_distance_ospf,
6087 no_ospf_distance_ospf_cmd,
6088 "no distance ospf",
6089 NO_STR
6090 "Define an administrative distance\n"
6091 "OSPF Administrative distance\n"
6092 "OSPF Distance\n")
6093{
paul68980082003-03-25 05:07:42 +00006094 struct ospf *ospf = vty->index;
6095
6096 ospf->distance_intra = 0;
6097 ospf->distance_inter = 0;
6098 ospf->distance_external = 0;
6099
paul718e3742002-12-13 20:15:29 +00006100 return CMD_SUCCESS;
6101}
6102
6103DEFUN (ospf_distance_ospf_intra,
6104 ospf_distance_ospf_intra_cmd,
6105 "distance ospf intra-area <1-255>",
6106 "Define an administrative distance\n"
6107 "OSPF Administrative distance\n"
6108 "Intra-area routes\n"
6109 "Distance for intra-area routes\n")
6110{
paul68980082003-03-25 05:07:42 +00006111 struct ospf *ospf = vty->index;
6112
6113 ospf->distance_intra = atoi (argv[0]);
6114
paul718e3742002-12-13 20:15:29 +00006115 return CMD_SUCCESS;
6116}
6117
6118DEFUN (ospf_distance_ospf_intra_inter,
6119 ospf_distance_ospf_intra_inter_cmd,
6120 "distance ospf intra-area <1-255> inter-area <1-255>",
6121 "Define an administrative distance\n"
6122 "OSPF Administrative distance\n"
6123 "Intra-area routes\n"
6124 "Distance for intra-area routes\n"
6125 "Inter-area routes\n"
6126 "Distance for inter-area routes\n")
6127{
paul68980082003-03-25 05:07:42 +00006128 struct ospf *ospf = vty->index;
6129
6130 ospf->distance_intra = atoi (argv[0]);
6131 ospf->distance_inter = atoi (argv[1]);
6132
paul718e3742002-12-13 20:15:29 +00006133 return CMD_SUCCESS;
6134}
6135
6136DEFUN (ospf_distance_ospf_intra_external,
6137 ospf_distance_ospf_intra_external_cmd,
6138 "distance ospf intra-area <1-255> external <1-255>",
6139 "Define an administrative distance\n"
6140 "OSPF Administrative distance\n"
6141 "Intra-area routes\n"
6142 "Distance for intra-area routes\n"
6143 "External routes\n"
6144 "Distance for external routes\n")
6145{
paul68980082003-03-25 05:07:42 +00006146 struct ospf *ospf = vty->index;
6147
6148 ospf->distance_intra = atoi (argv[0]);
6149 ospf->distance_external = atoi (argv[1]);
6150
paul718e3742002-12-13 20:15:29 +00006151 return CMD_SUCCESS;
6152}
6153
6154DEFUN (ospf_distance_ospf_intra_inter_external,
6155 ospf_distance_ospf_intra_inter_external_cmd,
6156 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6157 "Define an administrative distance\n"
6158 "OSPF Administrative distance\n"
6159 "Intra-area routes\n"
6160 "Distance for intra-area routes\n"
6161 "Inter-area routes\n"
6162 "Distance for inter-area routes\n"
6163 "External routes\n"
6164 "Distance for external routes\n")
6165{
paul68980082003-03-25 05:07:42 +00006166 struct ospf *ospf = vty->index;
6167
6168 ospf->distance_intra = atoi (argv[0]);
6169 ospf->distance_inter = atoi (argv[1]);
6170 ospf->distance_external = atoi (argv[2]);
6171
paul718e3742002-12-13 20:15:29 +00006172 return CMD_SUCCESS;
6173}
6174
6175DEFUN (ospf_distance_ospf_intra_external_inter,
6176 ospf_distance_ospf_intra_external_inter_cmd,
6177 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6178 "Define an administrative distance\n"
6179 "OSPF Administrative distance\n"
6180 "Intra-area routes\n"
6181 "Distance for intra-area routes\n"
6182 "External routes\n"
6183 "Distance for external routes\n"
6184 "Inter-area routes\n"
6185 "Distance for inter-area routes\n")
6186{
paul68980082003-03-25 05:07:42 +00006187 struct ospf *ospf = vty->index;
6188
6189 ospf->distance_intra = atoi (argv[0]);
6190 ospf->distance_external = atoi (argv[1]);
6191 ospf->distance_inter = atoi (argv[2]);
6192
paul718e3742002-12-13 20:15:29 +00006193 return CMD_SUCCESS;
6194}
6195
6196DEFUN (ospf_distance_ospf_inter,
6197 ospf_distance_ospf_inter_cmd,
6198 "distance ospf inter-area <1-255>",
6199 "Define an administrative distance\n"
6200 "OSPF Administrative distance\n"
6201 "Inter-area routes\n"
6202 "Distance for inter-area routes\n")
6203{
paul68980082003-03-25 05:07:42 +00006204 struct ospf *ospf = vty->index;
6205
6206 ospf->distance_inter = atoi (argv[0]);
6207
paul718e3742002-12-13 20:15:29 +00006208 return CMD_SUCCESS;
6209}
6210
6211DEFUN (ospf_distance_ospf_inter_intra,
6212 ospf_distance_ospf_inter_intra_cmd,
6213 "distance ospf inter-area <1-255> intra-area <1-255>",
6214 "Define an administrative distance\n"
6215 "OSPF Administrative distance\n"
6216 "Inter-area routes\n"
6217 "Distance for inter-area routes\n"
6218 "Intra-area routes\n"
6219 "Distance for intra-area routes\n")
6220{
paul68980082003-03-25 05:07:42 +00006221 struct ospf *ospf = vty->index;
6222
6223 ospf->distance_inter = atoi (argv[0]);
6224 ospf->distance_intra = atoi (argv[1]);
6225
paul718e3742002-12-13 20:15:29 +00006226 return CMD_SUCCESS;
6227}
6228
6229DEFUN (ospf_distance_ospf_inter_external,
6230 ospf_distance_ospf_inter_external_cmd,
6231 "distance ospf inter-area <1-255> external <1-255>",
6232 "Define an administrative distance\n"
6233 "OSPF Administrative distance\n"
6234 "Inter-area routes\n"
6235 "Distance for inter-area routes\n"
6236 "External routes\n"
6237 "Distance for external routes\n")
6238{
paul68980082003-03-25 05:07:42 +00006239 struct ospf *ospf = vty->index;
6240
6241 ospf->distance_inter = atoi (argv[0]);
6242 ospf->distance_external = atoi (argv[1]);
6243
paul718e3742002-12-13 20:15:29 +00006244 return CMD_SUCCESS;
6245}
6246
6247DEFUN (ospf_distance_ospf_inter_intra_external,
6248 ospf_distance_ospf_inter_intra_external_cmd,
6249 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6250 "Define an administrative distance\n"
6251 "OSPF Administrative distance\n"
6252 "Inter-area routes\n"
6253 "Distance for inter-area routes\n"
6254 "Intra-area routes\n"
6255 "Distance for intra-area routes\n"
6256 "External routes\n"
6257 "Distance for external routes\n")
6258{
paul68980082003-03-25 05:07:42 +00006259 struct ospf *ospf = vty->index;
6260
6261 ospf->distance_inter = atoi (argv[0]);
6262 ospf->distance_intra = atoi (argv[1]);
6263 ospf->distance_external = atoi (argv[2]);
6264
paul718e3742002-12-13 20:15:29 +00006265 return CMD_SUCCESS;
6266}
6267
6268DEFUN (ospf_distance_ospf_inter_external_intra,
6269 ospf_distance_ospf_inter_external_intra_cmd,
6270 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6271 "Define an administrative distance\n"
6272 "OSPF Administrative distance\n"
6273 "Inter-area routes\n"
6274 "Distance for inter-area routes\n"
6275 "External routes\n"
6276 "Distance for external routes\n"
6277 "Intra-area routes\n"
6278 "Distance for intra-area routes\n")
6279{
paul68980082003-03-25 05:07:42 +00006280 struct ospf *ospf = vty->index;
6281
6282 ospf->distance_inter = atoi (argv[0]);
6283 ospf->distance_external = atoi (argv[1]);
6284 ospf->distance_intra = atoi (argv[2]);
6285
paul718e3742002-12-13 20:15:29 +00006286 return CMD_SUCCESS;
6287}
6288
6289DEFUN (ospf_distance_ospf_external,
6290 ospf_distance_ospf_external_cmd,
6291 "distance ospf external <1-255>",
6292 "Define an administrative distance\n"
6293 "OSPF Administrative distance\n"
6294 "External routes\n"
6295 "Distance for external routes\n")
6296{
paul68980082003-03-25 05:07:42 +00006297 struct ospf *ospf = vty->index;
6298
6299 ospf->distance_external = atoi (argv[0]);
6300
paul718e3742002-12-13 20:15:29 +00006301 return CMD_SUCCESS;
6302}
6303
6304DEFUN (ospf_distance_ospf_external_intra,
6305 ospf_distance_ospf_external_intra_cmd,
6306 "distance ospf external <1-255> intra-area <1-255>",
6307 "Define an administrative distance\n"
6308 "OSPF Administrative distance\n"
6309 "External routes\n"
6310 "Distance for external routes\n"
6311 "Intra-area routes\n"
6312 "Distance for intra-area routes\n")
6313{
paul68980082003-03-25 05:07:42 +00006314 struct ospf *ospf = vty->index;
6315
6316 ospf->distance_external = atoi (argv[0]);
6317 ospf->distance_intra = atoi (argv[1]);
6318
paul718e3742002-12-13 20:15:29 +00006319 return CMD_SUCCESS;
6320}
6321
6322DEFUN (ospf_distance_ospf_external_inter,
6323 ospf_distance_ospf_external_inter_cmd,
6324 "distance ospf external <1-255> inter-area <1-255>",
6325 "Define an administrative distance\n"
6326 "OSPF Administrative distance\n"
6327 "External routes\n"
6328 "Distance for external routes\n"
6329 "Inter-area routes\n"
6330 "Distance for inter-area routes\n")
6331{
paul68980082003-03-25 05:07:42 +00006332 struct ospf *ospf = vty->index;
6333
6334 ospf->distance_external = atoi (argv[0]);
6335 ospf->distance_inter = atoi (argv[1]);
6336
paul718e3742002-12-13 20:15:29 +00006337 return CMD_SUCCESS;
6338}
6339
6340DEFUN (ospf_distance_ospf_external_intra_inter,
6341 ospf_distance_ospf_external_intra_inter_cmd,
6342 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6343 "Define an administrative distance\n"
6344 "OSPF Administrative distance\n"
6345 "External routes\n"
6346 "Distance for external routes\n"
6347 "Intra-area routes\n"
6348 "Distance for intra-area routes\n"
6349 "Inter-area routes\n"
6350 "Distance for inter-area routes\n")
6351{
paul68980082003-03-25 05:07:42 +00006352 struct ospf *ospf = vty->index;
6353
6354 ospf->distance_external = atoi (argv[0]);
6355 ospf->distance_intra = atoi (argv[1]);
6356 ospf->distance_inter = atoi (argv[2]);
6357
paul718e3742002-12-13 20:15:29 +00006358 return CMD_SUCCESS;
6359}
6360
6361DEFUN (ospf_distance_ospf_external_inter_intra,
6362 ospf_distance_ospf_external_inter_intra_cmd,
6363 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6364 "Define an administrative distance\n"
6365 "OSPF Administrative distance\n"
6366 "External routes\n"
6367 "Distance for external routes\n"
6368 "Inter-area routes\n"
6369 "Distance for inter-area routes\n"
6370 "Intra-area routes\n"
6371 "Distance for intra-area routes\n")
6372{
paul68980082003-03-25 05:07:42 +00006373 struct ospf *ospf = vty->index;
6374
6375 ospf->distance_external = atoi (argv[0]);
6376 ospf->distance_inter = atoi (argv[1]);
6377 ospf->distance_intra = atoi (argv[2]);
6378
paul718e3742002-12-13 20:15:29 +00006379 return CMD_SUCCESS;
6380}
6381
6382DEFUN (ospf_distance_source,
6383 ospf_distance_source_cmd,
6384 "distance <1-255> A.B.C.D/M",
6385 "Administrative distance\n"
6386 "Distance value\n"
6387 "IP source prefix\n")
6388{
paul020709f2003-04-04 02:44:16 +00006389 struct ospf *ospf = vty->index;
6390
6391 ospf_distance_set (vty, ospf, argv[0], argv[1], NULL);
paul68980082003-03-25 05:07:42 +00006392
paul718e3742002-12-13 20:15:29 +00006393 return CMD_SUCCESS;
6394}
6395
6396DEFUN (no_ospf_distance_source,
6397 no_ospf_distance_source_cmd,
6398 "no distance <1-255> A.B.C.D/M",
6399 NO_STR
6400 "Administrative distance\n"
6401 "Distance value\n"
6402 "IP source prefix\n")
6403{
paul020709f2003-04-04 02:44:16 +00006404 struct ospf *ospf = vty->index;
6405
6406 ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL);
6407
paul718e3742002-12-13 20:15:29 +00006408 return CMD_SUCCESS;
6409}
6410
6411DEFUN (ospf_distance_source_access_list,
6412 ospf_distance_source_access_list_cmd,
6413 "distance <1-255> A.B.C.D/M WORD",
6414 "Administrative distance\n"
6415 "Distance value\n"
6416 "IP source prefix\n"
6417 "Access list name\n")
6418{
paul020709f2003-04-04 02:44:16 +00006419 struct ospf *ospf = vty->index;
6420
6421 ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]);
6422
paul718e3742002-12-13 20:15:29 +00006423 return CMD_SUCCESS;
6424}
6425
6426DEFUN (no_ospf_distance_source_access_list,
6427 no_ospf_distance_source_access_list_cmd,
6428 "no distance <1-255> A.B.C.D/M WORD",
6429 NO_STR
6430 "Administrative distance\n"
6431 "Distance value\n"
6432 "IP source prefix\n"
6433 "Access list name\n")
6434{
paul020709f2003-04-04 02:44:16 +00006435 struct ospf *ospf = vty->index;
6436
6437 ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]);
6438
paul718e3742002-12-13 20:15:29 +00006439 return CMD_SUCCESS;
6440}
6441
6442void
6443show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
6444{
6445 struct route_node *rn;
6446 struct ospf_route *or;
6447 listnode pnode;
6448 struct ospf_path *path;
6449
6450 vty_out (vty, "============ OSPF network routing table ============%s",
6451 VTY_NEWLINE);
6452
6453 for (rn = route_top (rt); rn; rn = route_next (rn))
6454 if ((or = rn->info) != NULL)
6455 {
6456 char buf1[19];
6457 snprintf (buf1, 19, "%s/%d",
6458 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
6459
6460 switch (or->path_type)
6461 {
6462 case OSPF_PATH_INTER_AREA:
6463 if (or->type == OSPF_DESTINATION_NETWORK)
6464 vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost,
6465 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
6466 else if (or->type == OSPF_DESTINATION_DISCARD)
6467 vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE);
6468 break;
6469 case OSPF_PATH_INTRA_AREA:
6470 vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost,
6471 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
6472 break;
6473 default:
6474 break;
6475 }
6476
6477 if (or->type == OSPF_DESTINATION_NETWORK)
6478 for (pnode = listhead (or->path); pnode; nextnode (pnode))
6479 {
6480 path = getdata (pnode);
6481 if (path->oi != NULL)
6482 {
6483 if (path->nexthop.s_addr == 0)
6484 vty_out (vty, "%24s directly attached to %s%s",
6485 "", path->oi->ifp->name, VTY_NEWLINE);
6486 else
6487 vty_out (vty, "%24s via %s, %s%s", "",
6488 inet_ntoa (path->nexthop), path->oi->ifp->name,
6489 VTY_NEWLINE);
6490 }
6491 }
6492 }
6493 vty_out (vty, "%s", VTY_NEWLINE);
6494}
6495
6496void
6497show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs)
6498{
6499 struct route_node *rn;
6500 struct ospf_route *or;
6501 listnode pn, nn;
6502 struct ospf_path *path;
6503
6504 vty_out (vty, "============ OSPF router routing table =============%s",
6505 VTY_NEWLINE);
6506 for (rn = route_top (rtrs); rn; rn = route_next (rn))
6507 if (rn->info)
6508 {
6509 int flag = 0;
6510
6511 vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4));
6512
6513 for (nn = listhead ((list) rn->info); nn; nextnode (nn))
6514 if ((or = getdata (nn)) != NULL)
6515 {
6516 if (flag++)
6517 vty_out(vty," " );
6518
6519 /* Show path. */
6520 vty_out (vty, "%s [%d] area: %s",
6521 (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "),
6522 or->cost, inet_ntoa (or->u.std.area_id));
6523 /* Show flags. */
6524 vty_out (vty, "%s%s%s",
6525 (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""),
6526 (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""),
6527 VTY_NEWLINE);
6528
6529 for (pn = listhead (or->path); pn; nextnode (pn))
6530 {
6531 path = getdata (pn);
6532 if (path->nexthop.s_addr == 0)
6533 vty_out (vty, "%24s directly attached to %s%s",
6534 "", path->oi->ifp->name, VTY_NEWLINE);
6535 else
6536 vty_out (vty, "%24s via %s, %s%s", "",
6537 inet_ntoa (path->nexthop), path->oi->ifp->name,
6538 VTY_NEWLINE);
6539 }
6540 }
6541 }
6542 vty_out (vty, "%s", VTY_NEWLINE);
6543}
6544
6545void
6546show_ip_ospf_route_external (struct vty *vty, struct route_table *rt)
6547{
6548 struct route_node *rn;
6549 struct ospf_route *er;
6550 listnode pnode;
6551 struct ospf_path *path;
6552
6553 vty_out (vty, "============ OSPF external routing table ===========%s",
6554 VTY_NEWLINE);
6555 for (rn = route_top (rt); rn; rn = route_next (rn))
6556 if ((er = rn->info) != NULL)
6557 {
6558 char buf1[19];
6559 snprintf (buf1, 19, "%s/%d",
6560 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
6561
6562 switch (er->path_type)
6563 {
6564 case OSPF_PATH_TYPE1_EXTERNAL:
6565 vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
6566 er->cost, er->u.ext.tag, VTY_NEWLINE);
6567 break;
6568 case OSPF_PATH_TYPE2_EXTERNAL:
6569 vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
6570 er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
6571 break;
6572 }
6573
6574 for (pnode = listhead (er->path); pnode; nextnode (pnode))
6575 {
6576 path = getdata (pnode);
6577 if (path->oi != NULL)
6578 {
6579 if (path->nexthop.s_addr == 0)
6580 vty_out (vty, "%24s directly attached to %s%s",
6581 "", path->oi->ifp->name, VTY_NEWLINE);
6582 else
6583 vty_out (vty, "%24s via %s, %s%s", "",
6584 inet_ntoa (path->nexthop), path->oi->ifp->name,
6585 VTY_NEWLINE);
6586 }
6587 }
6588 }
6589 vty_out (vty, "%s", VTY_NEWLINE);
6590}
6591
6592#ifdef HAVE_NSSA
6593DEFUN (show_ip_ospf_border_routers,
6594 show_ip_ospf_border_routers_cmd,
6595 "show ip ospf border-routers",
6596 SHOW_STR
6597 IP_STR
6598 "show all the ABR's and ASBR's\n"
6599 "for this area\n")
6600{
paul020709f2003-04-04 02:44:16 +00006601 struct ospf *ospf;
paul68980082003-03-25 05:07:42 +00006602
paul020709f2003-04-04 02:44:16 +00006603 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00006604 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00006605 {
6606 vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
6607 return CMD_SUCCESS;
6608 }
6609
paul68980082003-03-25 05:07:42 +00006610 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00006611 {
6612 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
6613 return CMD_SUCCESS;
6614 }
6615
6616 /* Show Network routes.
paul020709f2003-04-04 02:44:16 +00006617 show_ip_ospf_route_network (vty, ospf->new_table); */
paul718e3742002-12-13 20:15:29 +00006618
6619 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00006620 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00006621
6622 return CMD_SUCCESS;
6623}
6624#endif /* HAVE_NSSA */
6625
6626DEFUN (show_ip_ospf_route,
6627 show_ip_ospf_route_cmd,
6628 "show ip ospf route",
6629 SHOW_STR
6630 IP_STR
6631 "OSPF information\n"
6632 "OSPF routing table\n")
6633{
paul020709f2003-04-04 02:44:16 +00006634 struct ospf *ospf;
paul68980082003-03-25 05:07:42 +00006635
paul020709f2003-04-04 02:44:16 +00006636 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00006637 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00006638 {
6639 vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
6640 return CMD_SUCCESS;
6641 }
6642
paul68980082003-03-25 05:07:42 +00006643 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00006644 {
6645 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
6646 return CMD_SUCCESS;
6647 }
6648
6649 /* Show Network routes. */
paul68980082003-03-25 05:07:42 +00006650 show_ip_ospf_route_network (vty, ospf->new_table);
paul718e3742002-12-13 20:15:29 +00006651
6652 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00006653 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00006654
6655 /* Show AS External routes. */
paul68980082003-03-25 05:07:42 +00006656 show_ip_ospf_route_external (vty, ospf->old_external_route);
paul718e3742002-12-13 20:15:29 +00006657
6658 return CMD_SUCCESS;
6659}
6660
6661
6662char *ospf_abr_type_str[] =
6663{
6664 "unknown",
6665 "standard",
6666 "ibm",
6667 "cisco",
6668 "shortcut"
6669};
6670
6671char *ospf_shortcut_mode_str[] =
6672{
6673 "default",
6674 "enable",
6675 "disable"
6676};
6677
6678
6679void
6680area_id2str (char *buf, int length, struct ospf_area *area)
6681{
6682 memset (buf, 0, length);
6683
6684 if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS)
6685 strncpy (buf, inet_ntoa (area->area_id), length);
6686 else
6687 sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));
6688}
6689
6690
6691char *ospf_int_type_str[] =
6692{
6693 "unknown", /* should never be used. */
6694 "point-to-point",
6695 "broadcast",
6696 "non-broadcast",
6697 "point-to-multipoint",
6698 "virtual-link", /* should never be used. */
6699 "loopback"
6700};
6701
6702/* Configuration write function for ospfd. */
6703int
6704config_write_interface (struct vty *vty)
6705{
6706 listnode n1, n2;
6707 struct interface *ifp;
6708 struct crypt_key *ck;
6709 int write = 0;
6710 struct route_node *rn = NULL;
6711 struct ospf_if_params *params;
6712
6713 for (n1 = listhead (iflist); n1; nextnode (n1))
6714 {
6715 ifp = getdata (n1);
6716
6717 if (memcmp (ifp->name, "VLINK", 5) == 0)
6718 continue;
6719
6720 vty_out (vty, "!%s", VTY_NEWLINE);
6721 vty_out (vty, "interface %s%s", ifp->name,
6722 VTY_NEWLINE);
6723 if (ifp->desc)
6724 vty_out (vty, " description %s%s", ifp->desc,
6725 VTY_NEWLINE);
6726
6727 write++;
6728
6729 params = IF_DEF_PARAMS (ifp);
6730
6731 do {
6732 /* Interface Network print. */
6733 if (OSPF_IF_PARAM_CONFIGURED (params, type) &&
6734 params->type != OSPF_IFTYPE_BROADCAST &&
6735 params->type != OSPF_IFTYPE_LOOPBACK)
6736 {
6737 vty_out (vty, " ip ospf network %s",
6738 ospf_int_type_str[params->type]);
6739 if (params != IF_DEF_PARAMS (ifp))
6740 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6741 vty_out (vty, "%s", VTY_NEWLINE);
6742 }
6743
6744 /* OSPF interface authentication print */
6745 if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) &&
6746 params->auth_type != OSPF_AUTH_NOTSET)
6747 {
6748 char *auth_str;
6749
6750 /* Translation tables are not that much help here due to syntax
6751 of the simple option */
6752 switch (params->auth_type)
6753 {
6754
6755 case OSPF_AUTH_NULL:
6756 auth_str = " null";
6757 break;
6758
6759 case OSPF_AUTH_SIMPLE:
6760 auth_str = "";
6761 break;
6762
6763 case OSPF_AUTH_CRYPTOGRAPHIC:
6764 auth_str = " message-digest";
6765 break;
6766
6767 default:
6768 auth_str = "";
6769 break;
6770 }
6771
6772 vty_out (vty, " ip ospf authentication%s", auth_str);
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 /* Simple Authentication Password print. */
6779 if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) &&
6780 params->auth_simple[0] != '\0')
6781 {
6782 vty_out (vty, " ip ospf authentication-key %s",
6783 params->auth_simple);
6784 if (params != IF_DEF_PARAMS (ifp))
6785 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6786 vty_out (vty, "%s", VTY_NEWLINE);
6787 }
6788
6789 /* Cryptographic Authentication Key print. */
6790 for (n2 = listhead (params->auth_crypt); n2; nextnode (n2))
6791 {
6792 ck = getdata (n2);
6793 vty_out (vty, " ip ospf message-digest-key %d md5 %s",
6794 ck->key_id, ck->auth_key);
6795 if (params != IF_DEF_PARAMS (ifp))
6796 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6797 vty_out (vty, "%s", VTY_NEWLINE);
6798 }
6799
6800 /* Interface Output Cost print. */
6801 if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd))
6802 {
6803 vty_out (vty, " ip ospf cost %u", params->output_cost_cmd);
6804 if (params != IF_DEF_PARAMS (ifp))
6805 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6806 vty_out (vty, "%s", VTY_NEWLINE);
6807 }
6808
6809 /* Hello Interval print. */
6810 if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) &&
6811 params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT)
6812 {
6813 vty_out (vty, " ip ospf hello-interval %u", params->v_hello);
6814 if (params != IF_DEF_PARAMS (ifp))
6815 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6816 vty_out (vty, "%s", VTY_NEWLINE);
6817 }
6818
6819
6820 /* Router Dead Interval print. */
6821 if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
6822 params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
6823 {
6824 vty_out (vty, " ip ospf dead-interval %u", params->v_wait);
6825 if (params != IF_DEF_PARAMS (ifp))
6826 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6827 vty_out (vty, "%s", VTY_NEWLINE);
6828 }
6829
6830 /* Router Priority print. */
6831 if (OSPF_IF_PARAM_CONFIGURED (params, priority) &&
6832 params->priority != OSPF_ROUTER_PRIORITY_DEFAULT)
6833 {
6834 vty_out (vty, " ip ospf priority %u", params->priority);
6835 if (params != IF_DEF_PARAMS (ifp))
6836 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6837 vty_out (vty, "%s", VTY_NEWLINE);
6838 }
6839
6840 /* Retransmit Interval print. */
6841 if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) &&
6842 params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT)
6843 {
6844 vty_out (vty, " ip ospf retransmit-interval %u",
6845 params->retransmit_interval);
6846 if (params != IF_DEF_PARAMS (ifp))
6847 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6848 vty_out (vty, "%s", VTY_NEWLINE);
6849 }
6850
6851 /* Transmit Delay print. */
6852 if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) &&
6853 params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT)
6854 {
6855 vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay);
6856 if (params != IF_DEF_PARAMS (ifp))
6857 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6858 vty_out (vty, "%s", VTY_NEWLINE);
6859 }
6860
6861 while (1)
6862 {
6863 if (rn == NULL)
6864 rn = route_top (IF_OIFS_PARAMS (ifp));
6865 else
6866 rn = route_next (rn);
6867
6868 if (rn == NULL)
6869 break;
6870 params = rn->info;
6871 if (params != NULL)
6872 break;
6873 }
6874 } while (rn);
6875
6876#ifdef HAVE_OPAQUE_LSA
6877 ospf_opaque_config_write_if (vty, ifp);
6878#endif /* HAVE_OPAQUE_LSA */
6879 }
6880
6881 return write;
6882}
6883
6884int
paul68980082003-03-25 05:07:42 +00006885config_write_network_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006886{
6887 struct route_node *rn;
6888 u_char buf[INET_ADDRSTRLEN];
6889
6890 /* `network area' print. */
paul68980082003-03-25 05:07:42 +00006891 for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00006892 if (rn->info)
6893 {
6894 struct ospf_network *n = rn->info;
6895
6896 memset (buf, 0, INET_ADDRSTRLEN);
6897
6898 /* Create Area ID string by specified Area ID format. */
6899 if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS)
6900 strncpy (buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN);
6901 else
6902 sprintf (buf, "%lu",
6903 (unsigned long int) ntohl (n->area_id.s_addr));
6904
6905 /* Network print. */
6906 vty_out (vty, " network %s/%d area %s%s",
6907 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
6908 buf, VTY_NEWLINE);
6909 }
6910
6911 return 0;
6912}
6913
6914int
paul68980082003-03-25 05:07:42 +00006915config_write_ospf_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006916{
6917 listnode node;
6918 u_char buf[INET_ADDRSTRLEN];
6919
6920 /* Area configuration print. */
paul68980082003-03-25 05:07:42 +00006921 for (node = listhead (ospf->areas); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00006922 {
6923 struct ospf_area *area = getdata (node);
6924 struct route_node *rn1;
6925
6926 area_id2str (buf, INET_ADDRSTRLEN, area);
6927
6928 if (area->auth_type != OSPF_AUTH_NULL)
6929 {
6930 if (area->auth_type == OSPF_AUTH_SIMPLE)
6931 vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE);
6932 else
6933 vty_out (vty, " area %s authentication message-digest%s",
6934 buf, VTY_NEWLINE);
6935 }
6936
6937 if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT)
6938 vty_out (vty, " area %s shortcut %s%s", buf,
6939 ospf_shortcut_mode_str[area->shortcut_configured],
6940 VTY_NEWLINE);
6941
6942 if ((area->external_routing == OSPF_AREA_STUB)
6943#ifdef HAVE_NSSA
6944 || (area->external_routing == OSPF_AREA_NSSA)
6945#endif /* HAVE_NSSA */
6946 )
6947 {
6948#ifdef HAVE_NSSA
6949 if (area->external_routing == OSPF_AREA_NSSA)
6950 vty_out (vty, " area %s nssa", buf);
6951 else
6952#endif /* HAVE_NSSA */
6953 vty_out (vty, " area %s stub", buf);
6954
6955 if (area->no_summary)
6956 vty_out (vty, " no-summary");
6957
6958 vty_out (vty, "%s", VTY_NEWLINE);
6959
6960 if (area->default_cost != 1)
6961 vty_out (vty, " area %s default-cost %d%s", buf,
6962 area->default_cost, VTY_NEWLINE);
6963 }
6964
6965 for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1))
6966 if (rn1->info)
6967 {
6968 struct ospf_area_range *range = rn1->info;
6969
6970 vty_out (vty, " area %s range %s/%d", buf,
6971 inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen);
6972
6973 if (range->cost_config != -1)
6974 vty_out (vty, " cost %d", range->cost_config);
6975
6976 if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
6977 vty_out (vty, " not-advertise");
6978
6979 if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE))
6980 vty_out (vty, " substitute %s/%d",
6981 inet_ntoa (range->subst_addr), range->subst_masklen);
6982
6983 vty_out (vty, "%s", VTY_NEWLINE);
6984 }
6985
6986 if (EXPORT_NAME (area))
6987 vty_out (vty, " area %s export-list %s%s", buf,
6988 EXPORT_NAME (area), VTY_NEWLINE);
6989
6990 if (IMPORT_NAME (area))
6991 vty_out (vty, " area %s import-list %s%s", buf,
6992 IMPORT_NAME (area), VTY_NEWLINE);
6993
6994 if (PREFIX_NAME_IN (area))
6995 vty_out (vty, " area %s filter-list prefix %s in%s", buf,
6996 PREFIX_NAME_IN (area), VTY_NEWLINE);
6997
6998 if (PREFIX_NAME_OUT (area))
6999 vty_out (vty, " area %s filter-list prefix %s out%s", buf,
7000 PREFIX_NAME_OUT (area), VTY_NEWLINE);
7001 }
7002
7003 return 0;
7004}
7005
7006int
paul68980082003-03-25 05:07:42 +00007007config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007008{
7009 struct ospf_nbr_nbma *nbr_nbma;
7010 struct route_node *rn;
7011
7012 /* Static Neighbor configuration print. */
paul68980082003-03-25 05:07:42 +00007013 for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007014 if ((nbr_nbma = rn->info))
7015 {
7016 vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr));
7017
7018 if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT)
7019 vty_out (vty, " priority %d", nbr_nbma->priority);
7020
7021 if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
7022 vty_out (vty, " poll-interval %d", nbr_nbma->v_poll);
7023
7024 vty_out (vty, "%s", VTY_NEWLINE);
7025 }
7026
7027 return 0;
7028}
7029
7030int
paul68980082003-03-25 05:07:42 +00007031config_write_virtual_link (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007032{
7033 listnode node;
7034 u_char buf[INET_ADDRSTRLEN];
7035
7036 /* Virtual-Link print */
paul68980082003-03-25 05:07:42 +00007037 for (node = listhead (ospf->vlinks); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00007038 {
7039 listnode n2;
7040 struct crypt_key *ck;
7041 struct ospf_vl_data *vl_data = getdata (node);
7042 struct ospf_interface *oi;
7043
7044 if (vl_data != NULL)
7045 {
7046 memset (buf, 0, INET_ADDRSTRLEN);
7047
7048 if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS)
7049 strncpy (buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN);
7050 else
7051 sprintf (buf, "%lu",
7052 (unsigned long int) ntohl (vl_data->vl_area_id.s_addr));
7053 oi = vl_data->vl_oi;
7054
7055 /* timers */
7056 if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT ||
7057 OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT ||
7058 OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT ||
7059 OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT)
7060 vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7061 buf,
7062 inet_ntoa (vl_data->vl_peer),
7063 OSPF_IF_PARAM (oi, v_hello),
7064 OSPF_IF_PARAM (oi, retransmit_interval),
7065 OSPF_IF_PARAM (oi, transmit_delay),
7066 OSPF_IF_PARAM (oi, v_wait),
7067 VTY_NEWLINE);
7068 else
7069 vty_out (vty, " area %s virtual-link %s%s", buf,
7070 inet_ntoa (vl_data->vl_peer), VTY_NEWLINE);
7071 /* Auth key */
7072 if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0')
7073 vty_out (vty, " area %s virtual-link %s authentication-key %s%s",
7074 buf,
7075 inet_ntoa (vl_data->vl_peer),
7076 IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple,
7077 VTY_NEWLINE);
7078 /* md5 keys */
7079 for (n2 = listhead (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt); n2; nextnode (n2))
7080 {
7081 ck = getdata (n2);
7082 vty_out (vty, " area %s virtual-link %s message-digest-key %d md5 %s%s",
7083 buf,
7084 inet_ntoa (vl_data->vl_peer),
7085 ck->key_id, ck->auth_key, VTY_NEWLINE);
7086 }
7087
7088 }
7089 }
7090
7091 return 0;
7092}
7093
7094
7095char *distribute_str[] = { "system", "kernel", "connected", "static", "rip",
7096 "ripng", "ospf", "ospf6", "bgp"};
7097int
paul68980082003-03-25 05:07:42 +00007098config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007099{
7100 int type;
7101
7102 /* redistribute print. */
7103 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
7104 if (type != zclient->redist_default && zclient->redist[type])
7105 {
7106 vty_out (vty, " redistribute %s", distribute_str[type]);
paul68980082003-03-25 05:07:42 +00007107 if (ospf->dmetric[type].value >= 0)
paul020709f2003-04-04 02:44:16 +00007108 vty_out (vty, " metric %d", ospf->dmetric[type].value);
paul718e3742002-12-13 20:15:29 +00007109
paul68980082003-03-25 05:07:42 +00007110 if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007111 vty_out (vty, " metric-type 1");
7112
paul020709f2003-04-04 02:44:16 +00007113 if (ROUTEMAP_NAME (ospf, type))
7114 vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type));
paul718e3742002-12-13 20:15:29 +00007115
7116 vty_out (vty, "%s", VTY_NEWLINE);
7117 }
7118
7119 return 0;
7120}
7121
7122int
paul68980082003-03-25 05:07:42 +00007123config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007124{
paul68980082003-03-25 05:07:42 +00007125 if (ospf->default_metric != -1)
7126 vty_out (vty, " default-metric %d%s", ospf->default_metric,
paul718e3742002-12-13 20:15:29 +00007127 VTY_NEWLINE);
7128 return 0;
7129}
7130
7131int
paul68980082003-03-25 05:07:42 +00007132config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007133{
7134 int type;
7135
paul68980082003-03-25 05:07:42 +00007136 if (ospf)
paul718e3742002-12-13 20:15:29 +00007137 {
7138 /* distribute-list print. */
7139 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
paul68980082003-03-25 05:07:42 +00007140 if (ospf->dlist[type].name)
paul718e3742002-12-13 20:15:29 +00007141 vty_out (vty, " distribute-list %s out %s%s",
paul68980082003-03-25 05:07:42 +00007142 ospf->dlist[type].name,
paul718e3742002-12-13 20:15:29 +00007143 distribute_str[type], VTY_NEWLINE);
7144
7145 /* default-information print. */
paul68980082003-03-25 05:07:42 +00007146 if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
paul718e3742002-12-13 20:15:29 +00007147 {
paul68980082003-03-25 05:07:42 +00007148 if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA)
paul718e3742002-12-13 20:15:29 +00007149 vty_out (vty, " default-information originate");
7150 else
7151 vty_out (vty, " default-information originate always");
7152
paul68980082003-03-25 05:07:42 +00007153 if (ospf->dmetric[DEFAULT_ROUTE].value >= 0)
paul718e3742002-12-13 20:15:29 +00007154 vty_out (vty, " metric %d",
paul68980082003-03-25 05:07:42 +00007155 ospf->dmetric[DEFAULT_ROUTE].value);
7156 if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007157 vty_out (vty, " metric-type 1");
7158
paul020709f2003-04-04 02:44:16 +00007159 if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE))
7160 vty_out (vty, " route-map %s",
7161 ROUTEMAP_NAME (ospf, DEFAULT_ROUTE));
paul718e3742002-12-13 20:15:29 +00007162
7163 vty_out (vty, "%s", VTY_NEWLINE);
7164 }
7165
7166 }
7167
7168 return 0;
7169}
7170
7171int
paul68980082003-03-25 05:07:42 +00007172config_write_ospf_distance (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007173{
7174 struct route_node *rn;
7175 struct ospf_distance *odistance;
7176
paul68980082003-03-25 05:07:42 +00007177 if (ospf->distance_all)
7178 vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007179
paul68980082003-03-25 05:07:42 +00007180 if (ospf->distance_intra
7181 || ospf->distance_inter
7182 || ospf->distance_external)
paul718e3742002-12-13 20:15:29 +00007183 {
7184 vty_out (vty, " distance ospf");
7185
paul68980082003-03-25 05:07:42 +00007186 if (ospf->distance_intra)
7187 vty_out (vty, " intra-area %d", ospf->distance_intra);
7188 if (ospf->distance_inter)
7189 vty_out (vty, " inter-area %d", ospf->distance_inter);
7190 if (ospf->distance_external)
7191 vty_out (vty, " external %d", ospf->distance_external);
paul718e3742002-12-13 20:15:29 +00007192
7193 vty_out (vty, "%s", VTY_NEWLINE);
7194 }
7195
paul68980082003-03-25 05:07:42 +00007196 for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007197 if ((odistance = rn->info) != NULL)
7198 {
7199 vty_out (vty, " distance %d %s/%d %s%s", odistance->distance,
7200 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
7201 odistance->access_list ? odistance->access_list : "",
7202 VTY_NEWLINE);
7203 }
7204 return 0;
7205}
7206
7207/* OSPF configuration write function. */
7208int
7209ospf_config_write (struct vty *vty)
7210{
paul020709f2003-04-04 02:44:16 +00007211 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00007212 listnode node;
7213 int write = 0;
7214
paul020709f2003-04-04 02:44:16 +00007215 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00007216 if (ospf != NULL)
paul718e3742002-12-13 20:15:29 +00007217 {
7218 /* `router ospf' print. */
7219 vty_out (vty, "router ospf%s", VTY_NEWLINE);
7220
7221 write++;
7222
paul68980082003-03-25 05:07:42 +00007223 if (!ospf->networks)
paul718e3742002-12-13 20:15:29 +00007224 return write;
7225
7226 /* Router ID print. */
paul68980082003-03-25 05:07:42 +00007227 if (ospf->router_id_static.s_addr != 0)
paul718e3742002-12-13 20:15:29 +00007228 vty_out (vty, " ospf router-id %s%s",
paul68980082003-03-25 05:07:42 +00007229 inet_ntoa (ospf->router_id_static), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007230
7231 /* ABR type print. */
paul68980082003-03-25 05:07:42 +00007232 if (ospf->abr_type != OSPF_ABR_STAND)
paul718e3742002-12-13 20:15:29 +00007233 vty_out (vty, " ospf abr-type %s%s",
paul68980082003-03-25 05:07:42 +00007234 ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007235
7236 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
paul68980082003-03-25 05:07:42 +00007237 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
paul718e3742002-12-13 20:15:29 +00007238 vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE);
7239
7240 /* auto-cost reference-bandwidth configuration. */
paul68980082003-03-25 05:07:42 +00007241 if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00007242 vty_out (vty, " auto-cost reference-bandwidth %d%s",
paul68980082003-03-25 05:07:42 +00007243 ospf->ref_bandwidth / 1000, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007244
7245 /* SPF timers print. */
paul68980082003-03-25 05:07:42 +00007246 if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
7247 ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007248 vty_out (vty, " timers spf %d %d%s",
paul68980082003-03-25 05:07:42 +00007249 ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007250
7251 /* SPF refresh parameters print. */
paul68980082003-03-25 05:07:42 +00007252 if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007253 vty_out (vty, " refresh timer %d%s",
paul68980082003-03-25 05:07:42 +00007254 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007255
7256 /* Redistribute information print. */
paul68980082003-03-25 05:07:42 +00007257 config_write_ospf_redistribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007258
7259 /* passive-interface print. */
paul020709f2003-04-04 02:44:16 +00007260 for (node = listhead (om->iflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00007261 {
7262 struct interface *ifp = getdata (node);
7263
7264 if (!ifp)
7265 continue;
7266 if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE)
7267 vty_out (vty, " passive-interface %s%s",
7268 ifp->name, VTY_NEWLINE);
7269 }
7270
paul68980082003-03-25 05:07:42 +00007271 for (node = listhead (ospf->oiflist); node; nextnode (node))
paul718e3742002-12-13 20:15:29 +00007272 {
7273 struct ospf_interface *oi = getdata (node);
7274
7275 if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) &&
7276 oi->params->passive_interface == OSPF_IF_PASSIVE)
7277 vty_out (vty, " passive-interface %s%s",
7278 inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
7279 }
7280
7281
7282 /* Network area print. */
paul68980082003-03-25 05:07:42 +00007283 config_write_network_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007284
7285 /* Area config print. */
paul68980082003-03-25 05:07:42 +00007286 config_write_ospf_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007287
7288 /* static neighbor print. */
paul68980082003-03-25 05:07:42 +00007289 config_write_ospf_nbr_nbma (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007290
7291 /* Virtual-Link print. */
paul68980082003-03-25 05:07:42 +00007292 config_write_virtual_link (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007293
7294 /* Default metric configuration. */
paul68980082003-03-25 05:07:42 +00007295 config_write_ospf_default_metric (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007296
7297 /* Distribute-list and default-information print. */
paul68980082003-03-25 05:07:42 +00007298 config_write_ospf_distribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007299
7300 /* Distance configuration. */
paul68980082003-03-25 05:07:42 +00007301 config_write_ospf_distance (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007302
7303#ifdef HAVE_OPAQUE_LSA
paul68980082003-03-25 05:07:42 +00007304 ospf_opaque_config_write_router (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007305#endif /* HAVE_OPAQUE_LSA */
7306 }
7307
7308 return write;
7309}
7310
7311void
7312ospf_vty_show_init ()
7313{
7314 /* "show ip ospf" commands. */
7315 install_element (VIEW_NODE, &show_ip_ospf_cmd);
7316 install_element (ENABLE_NODE, &show_ip_ospf_cmd);
7317
7318 /* "show ip ospf database" commands. */
7319 install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd);
7320 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd);
7321 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
7322 install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
7323 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd);
7324 install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd);
7325 install_element (VIEW_NODE, &show_ip_ospf_database_cmd);
7326 install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd);
7327 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd);
7328 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
7329 install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd);
7330 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd);
7331 install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd);
7332 install_element (ENABLE_NODE, &show_ip_ospf_database_cmd);
7333
7334 /* "show ip ospf interface" commands. */
7335 install_element (VIEW_NODE, &show_ip_ospf_interface_cmd);
7336 install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd);
7337
7338 /* "show ip ospf neighbor" commands. */
7339 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
7340 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd);
7341 install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd);
7342 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
7343 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd);
7344 install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd);
7345 install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd);
7346 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
7347 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd);
7348 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd);
7349 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
7350 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd);
7351 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd);
7352 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd);
7353
7354 /* "show ip ospf route" commands. */
7355 install_element (VIEW_NODE, &show_ip_ospf_route_cmd);
7356 install_element (ENABLE_NODE, &show_ip_ospf_route_cmd);
7357#ifdef HAVE_NSSA
7358 install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd);
7359 install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
7360#endif /* HAVE_NSSA */
7361}
7362
7363
7364/* ospfd's interface node. */
7365struct cmd_node interface_node =
7366{
7367 INTERFACE_NODE,
7368 "%s(config-if)# ",
7369 1
7370};
7371
7372/* Initialization of OSPF interface. */
7373void
7374ospf_vty_if_init ()
7375{
7376 /* Install interface node. */
7377 install_node (&interface_node, config_write_interface);
7378
7379 install_element (CONFIG_NODE, &interface_cmd);
7380 install_default (INTERFACE_NODE);
7381
7382 /* "description" commands. */
7383 install_element (INTERFACE_NODE, &interface_desc_cmd);
7384 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
7385
7386 /* "ip ospf authentication" commands. */
7387 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
7388 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd);
7389 install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd);
7390 install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd);
7391 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd);
7392 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd);
7393 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd);
7394 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd);
7395 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd);
7396 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd);
7397
7398 /* "ip ospf message-digest-key" commands. */
7399 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
7400 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
7401 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
7402 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
7403
7404 /* "ip ospf cost" commands. */
7405 install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd);
7406 install_element (INTERFACE_NODE, &ip_ospf_cost_cmd);
7407 install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd);
7408 install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
7409
7410 /* "ip ospf dead-interval" commands. */
7411 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
7412 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
7413 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
7414 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
7415
7416 /* "ip ospf hello-interval" commands. */
7417 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
7418 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
7419 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
7420 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
7421
7422 /* "ip ospf network" commands. */
7423 install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
7424 install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
7425
7426 /* "ip ospf priority" commands. */
7427 install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
7428 install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
7429 install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
7430 install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
7431
7432 /* "ip ospf retransmit-interval" commands. */
7433 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
7434 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd);
7435 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
7436 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd);
7437
7438 /* "ip ospf transmit-delay" commands. */
7439 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
7440 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd);
7441 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
7442 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd);
7443
7444 /* These commands are compatibitliy for previous version. */
7445 install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
7446 install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);
7447 install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
7448 install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
7449 install_element (INTERFACE_NODE, &ospf_cost_cmd);
7450 install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
7451 install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
7452 install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
7453 install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
7454 install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
7455 install_element (INTERFACE_NODE, &ospf_network_cmd);
7456 install_element (INTERFACE_NODE, &no_ospf_network_cmd);
7457 install_element (INTERFACE_NODE, &ospf_priority_cmd);
7458 install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
7459 install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
7460 install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
7461 install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
7462 install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
7463}
7464
7465/* Zebra node structure. */
7466struct cmd_node zebra_node =
7467{
7468 ZEBRA_NODE,
7469 "%s(config-router)#",
7470};
7471
7472void
7473ospf_vty_zebra_init ()
7474{
7475 install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd);
7476 install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd);
7477 install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd);
7478 install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd);
7479 install_element (OSPF_NODE, &ospf_redistribute_source_cmd);
7480 install_element (OSPF_NODE,
7481 &ospf_redistribute_source_metric_type_routemap_cmd);
7482 install_element (OSPF_NODE,
7483 &ospf_redistribute_source_type_metric_routemap_cmd);
7484 install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd);
7485 install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd);
7486 install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd);
7487
7488 install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);
7489
7490 install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);
7491 install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);
7492
7493 install_element (OSPF_NODE,
7494 &ospf_default_information_originate_metric_type_cmd);
7495 install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd);
7496 install_element (OSPF_NODE,
7497 &ospf_default_information_originate_type_metric_cmd);
7498 install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd);
7499 install_element (OSPF_NODE, &ospf_default_information_originate_cmd);
7500 install_element (OSPF_NODE,
7501 &ospf_default_information_originate_always_metric_type_cmd);
7502 install_element (OSPF_NODE,
7503 &ospf_default_information_originate_always_metric_cmd);
7504 install_element (OSPF_NODE,
7505 &ospf_default_information_originate_always_cmd);
7506 install_element (OSPF_NODE,
7507 &ospf_default_information_originate_always_type_metric_cmd);
7508 install_element (OSPF_NODE,
7509 &ospf_default_information_originate_always_type_cmd);
7510
7511 install_element (OSPF_NODE,
7512 &ospf_default_information_originate_metric_type_routemap_cmd);
7513 install_element (OSPF_NODE,
7514 &ospf_default_information_originate_metric_routemap_cmd);
7515 install_element (OSPF_NODE,
7516 &ospf_default_information_originate_routemap_cmd);
7517 install_element (OSPF_NODE,
7518 &ospf_default_information_originate_type_metric_routemap_cmd);
7519 install_element (OSPF_NODE,
7520 &ospf_default_information_originate_type_routemap_cmd);
7521 install_element (OSPF_NODE,
7522 &ospf_default_information_originate_always_metric_type_routemap_cmd);
7523 install_element (OSPF_NODE,
7524 &ospf_default_information_originate_always_metric_routemap_cmd);
7525 install_element (OSPF_NODE,
7526 &ospf_default_information_originate_always_routemap_cmd);
7527 install_element (OSPF_NODE,
7528 &ospf_default_information_originate_always_type_metric_routemap_cmd);
7529 install_element (OSPF_NODE,
7530 &ospf_default_information_originate_always_type_routemap_cmd);
7531
7532 install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);
7533
7534 install_element (OSPF_NODE, &ospf_default_metric_cmd);
7535 install_element (OSPF_NODE, &no_ospf_default_metric_cmd);
7536 install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd);
7537
7538 install_element (OSPF_NODE, &ospf_distance_cmd);
7539 install_element (OSPF_NODE, &no_ospf_distance_cmd);
7540 install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);
7541 install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd);
7542 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd);
7543 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd);
7544 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd);
7545 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd);
7546 install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd);
7547 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd);
7548 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd);
7549 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd);
7550 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd);
7551 install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd);
7552 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd);
7553 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd);
7554 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd);
7555 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd);
7556#if 0
7557 install_element (OSPF_NODE, &ospf_distance_source_cmd);
7558 install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
7559 install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd);
7560 install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd);
7561#endif /* 0 */
7562}
7563
7564struct cmd_node ospf_node =
7565{
7566 OSPF_NODE,
7567 "%s(config-router)# ",
7568 1
7569};
7570
7571
7572/* Install OSPF related vty commands. */
7573void
7574ospf_vty_init ()
7575{
7576 /* Install ospf top node. */
7577 install_node (&ospf_node, ospf_config_write);
7578
7579 /* "router ospf" commands. */
7580 install_element (CONFIG_NODE, &router_ospf_cmd);
7581 install_element (CONFIG_NODE, &no_router_ospf_cmd);
7582
7583 install_default (OSPF_NODE);
7584
7585 /* "ospf router-id" commands. */
7586 install_element (OSPF_NODE, &ospf_router_id_cmd);
7587 install_element (OSPF_NODE, &no_ospf_router_id_cmd);
paula2c62832003-04-23 17:01:31 +00007588 install_element (OSPF_NODE, &router_ospf_id_cmd);
7589 install_element (OSPF_NODE, &no_router_ospf_id_cmd);
paul718e3742002-12-13 20:15:29 +00007590
7591 /* "passive-interface" commands. */
paula2c62832003-04-23 17:01:31 +00007592 install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd);
7593 install_element (OSPF_NODE, &ospf_passive_interface_cmd);
7594 install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd);
7595 install_element (OSPF_NODE, &no_ospf_passive_interface_cmd);
paul718e3742002-12-13 20:15:29 +00007596
7597 /* "ospf abr-type" commands. */
7598 install_element (OSPF_NODE, &ospf_abr_type_cmd);
7599 install_element (OSPF_NODE, &no_ospf_abr_type_cmd);
7600
7601 /* "ospf rfc1583-compatible" commands. */
7602 install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd);
7603 install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd);
7604 install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd);
7605 install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd);
7606
7607 /* "network area" commands. */
paula2c62832003-04-23 17:01:31 +00007608 install_element (OSPF_NODE, &ospf_network_area_cmd);
7609 install_element (OSPF_NODE, &no_ospf_network_area_cmd);
paul718e3742002-12-13 20:15:29 +00007610
7611 /* "area authentication" commands. */
paula2c62832003-04-23 17:01:31 +00007612 install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd);
7613 install_element (OSPF_NODE, &ospf_area_authentication_cmd);
7614 install_element (OSPF_NODE, &no_ospf_area_authentication_cmd);
paul718e3742002-12-13 20:15:29 +00007615
7616 /* "area range" commands. */
paula2c62832003-04-23 17:01:31 +00007617 install_element (OSPF_NODE, &ospf_area_range_cmd);
7618 install_element (OSPF_NODE, &ospf_area_range_advertise_cmd);
7619 install_element (OSPF_NODE, &ospf_area_range_cost_cmd);
7620 install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd);
7621 install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd);
7622 install_element (OSPF_NODE, &no_ospf_area_range_cmd);
7623 install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd);
7624 install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd);
7625 install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd);
7626 install_element (OSPF_NODE, &ospf_area_range_substitute_cmd);
7627 install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd);
paul718e3742002-12-13 20:15:29 +00007628
7629 /* "area virtual-link" commands. */
paula2c62832003-04-23 17:01:31 +00007630 install_element (OSPF_NODE, &ospf_area_vlink_cmd);
7631 install_element (OSPF_NODE, &no_ospf_area_vlink_cmd);
paul718e3742002-12-13 20:15:29 +00007632
paula2c62832003-04-23 17:01:31 +00007633 install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd);
7634 install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd);
paul718e3742002-12-13 20:15:29 +00007635
paula2c62832003-04-23 17:01:31 +00007636 install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd);
7637 install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd);
paul718e3742002-12-13 20:15:29 +00007638
paula2c62832003-04-23 17:01:31 +00007639 install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd);
7640 install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd);
paul718e3742002-12-13 20:15:29 +00007641
paula2c62832003-04-23 17:01:31 +00007642 install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd);
7643 install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd);
paul718e3742002-12-13 20:15:29 +00007644
paula2c62832003-04-23 17:01:31 +00007645 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd);
7646 install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd);
7647 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd);
paul718e3742002-12-13 20:15:29 +00007648
paula2c62832003-04-23 17:01:31 +00007649 install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd);
7650 install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd);
paul718e3742002-12-13 20:15:29 +00007651
paula2c62832003-04-23 17:01:31 +00007652 install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd);
7653 install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd);
paul718e3742002-12-13 20:15:29 +00007654
paula2c62832003-04-23 17:01:31 +00007655 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd);
7656 install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd);
7657 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd);
paul718e3742002-12-13 20:15:29 +00007658
paula2c62832003-04-23 17:01:31 +00007659 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd);
7660 install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd);
7661 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd);
paul718e3742002-12-13 20:15:29 +00007662
7663 /* "area stub" commands. */
paula2c62832003-04-23 17:01:31 +00007664 install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd);
7665 install_element (OSPF_NODE, &ospf_area_stub_cmd);
7666 install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd);
7667 install_element (OSPF_NODE, &no_ospf_area_stub_cmd);
paul718e3742002-12-13 20:15:29 +00007668
7669#ifdef HAVE_NSSA
7670 /* "area nssa" commands. */
paula2c62832003-04-23 17:01:31 +00007671 install_element (OSPF_NODE, &ospf_area_nssa_cmd);
7672 install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd);
7673 install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd);
7674 install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd);
7675 install_element (OSPF_NODE, &no_ospf_area_nssa_cmd);
7676 install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd);
paul718e3742002-12-13 20:15:29 +00007677#endif /* HAVE_NSSA */
7678
paula2c62832003-04-23 17:01:31 +00007679 install_element (OSPF_NODE, &ospf_area_default_cost_cmd);
7680 install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd);
paul718e3742002-12-13 20:15:29 +00007681
paula2c62832003-04-23 17:01:31 +00007682 install_element (OSPF_NODE, &ospf_area_shortcut_cmd);
7683 install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd);
paul718e3742002-12-13 20:15:29 +00007684
paula2c62832003-04-23 17:01:31 +00007685 install_element (OSPF_NODE, &ospf_area_export_list_cmd);
7686 install_element (OSPF_NODE, &no_ospf_area_export_list_cmd);
paul718e3742002-12-13 20:15:29 +00007687
paula2c62832003-04-23 17:01:31 +00007688 install_element (OSPF_NODE, &ospf_area_filter_list_cmd);
7689 install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00007690
paula2c62832003-04-23 17:01:31 +00007691 install_element (OSPF_NODE, &ospf_area_import_list_cmd);
7692 install_element (OSPF_NODE, &no_ospf_area_import_list_cmd);
paul718e3742002-12-13 20:15:29 +00007693
paula2c62832003-04-23 17:01:31 +00007694 install_element (OSPF_NODE, &ospf_timers_spf_cmd);
7695 install_element (OSPF_NODE, &no_ospf_timers_spf_cmd);
paul718e3742002-12-13 20:15:29 +00007696
paula2c62832003-04-23 17:01:31 +00007697 install_element (OSPF_NODE, &ospf_refresh_timer_cmd);
7698 install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd);
7699 install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd);
paul718e3742002-12-13 20:15:29 +00007700
paula2c62832003-04-23 17:01:31 +00007701 install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd);
7702 install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd);
paul718e3742002-12-13 20:15:29 +00007703
7704 /* "neighbor" commands. */
paula2c62832003-04-23 17:01:31 +00007705 install_element (OSPF_NODE, &ospf_neighbor_cmd);
7706 install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd);
7707 install_element (OSPF_NODE, &ospf_neighbor_priority_cmd);
7708 install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd);
7709 install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd);
7710 install_element (OSPF_NODE, &no_ospf_neighbor_cmd);
7711 install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd);
7712 install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd);
paul718e3742002-12-13 20:15:29 +00007713
7714 /* Init interface related vty commands. */
7715 ospf_vty_if_init ();
7716
7717 /* Init zebra related vty commands. */
7718 ospf_vty_zebra_init ();
7719}