blob: 0f2a0fce5d9f339ec639a576236fa8425772a950 [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
hassoeb1ce602004-10-08 08:17:22 +000052const static char *ospf_network_type_str[] =
paul718e3742002-12-13 20:15:29 +000053{
54 "Null",
55 "POINTOPOINT",
56 "BROADCAST",
57 "NBMA",
58 "POINTOMULTIPOINT",
59 "VIRTUALLINK",
60 "LOOPBACK"
61};
62
63
64/* Utility functions. */
paul4dadc292005-05-06 21:37:42 +000065static int
paul6c835672004-10-11 11:00:30 +000066ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
paul718e3742002-12-13 20:15:29 +000067{
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
paul4dadc292005-05-06 21:37:42 +000094static int
paul6c835672004-10-11 11:00:30 +000095str2distribute_source (const char *str, int *source)
paul718e3742002-12-13 20:15:29 +000096{
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
paul4dadc292005-05-06 21:37:42 +0000117static int
paul6c835672004-10-11 11:00:30 +0000118str2metric (const char *str, int *metric)
paul718e3742002-12-13 20:15:29 +0000119{
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
paul4dadc292005-05-06 21:37:42 +0000134static int
paul6c835672004-10-11 11:00:30 +0000135str2metric_type (const char *str, int *metric_type)
paul718e3742002-12-13 20:15:29 +0000136{
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;
ajsba6454e2005-02-08 15:37:30 +0000263 struct route_node *rn;
paul718e3742002-12-13 20:15:29 +0000264
265 ifp = if_lookup_by_name (argv[0]);
266
267 if (ifp == NULL)
268 {
269 vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE);
270 return CMD_WARNING;
271 }
272
273 params = IF_DEF_PARAMS (ifp);
274
275 if (argc == 2)
276 {
277 ret = inet_aton(argv[1], &addr);
278 if (!ret)
279 {
280 vty_out (vty, "Please specify interface address by A.B.C.D%s",
281 VTY_NEWLINE);
282 return CMD_WARNING;
283 }
284
285 params = ospf_get_if_params (ifp, addr);
286 ospf_if_update_params (ifp, addr);
287 }
288
289 SET_IF_PARAM (params, passive_interface);
290 params->passive_interface = OSPF_IF_PASSIVE;
ajsba6454e2005-02-08 15:37:30 +0000291
292 /* XXX We should call ospf_if_set_multicast on exactly those
293 * interfaces for which the passive property changed. It is too much
294 * work to determine this set, so we do this for every interface.
295 * This is safe and reasonable because ospf_if_set_multicast uses a
296 * record of joined groups to avoid systems calls if the desired
297 * memberships match the current memership.
298 */
299 for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn))
300 {
301 struct ospf_interface *oi = rn->info;
302
303 if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE))
304 ospf_if_set_multicast(oi);
305 }
306 /*
307 * XXX It is not clear what state transitions the interface needs to
308 * undergo when going from active to passive. Fixing this will
309 * require precise identification of interfaces having such a
310 * transition.
311 */
312
paul718e3742002-12-13 20:15:29 +0000313 return CMD_SUCCESS;
314}
315
paula2c62832003-04-23 17:01:31 +0000316ALIAS (ospf_passive_interface,
317 ospf_passive_interface_cmd,
paul718e3742002-12-13 20:15:29 +0000318 "passive-interface IFNAME",
319 "Suppress routing updates on an interface\n"
320 "Interface's name\n")
321
paula2c62832003-04-23 17:01:31 +0000322DEFUN (no_ospf_passive_interface,
323 no_ospf_passive_interface_addr_cmd,
paul718e3742002-12-13 20:15:29 +0000324 "no passive-interface IFNAME A.B.C.D",
325 NO_STR
326 "Allow routing updates on an interface\n"
327 "Interface's name\n")
328{
329 struct interface *ifp;
330 struct in_addr addr;
331 struct ospf_if_params *params;
332 int ret;
ajsba6454e2005-02-08 15:37:30 +0000333 struct route_node *rn;
paul718e3742002-12-13 20:15:29 +0000334
335 ifp = if_lookup_by_name (argv[0]);
336
337 if (ifp == NULL)
338 {
339 vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE);
340 return CMD_WARNING;
341 }
342
343 params = IF_DEF_PARAMS (ifp);
344
345 if (argc == 2)
346 {
347 ret = inet_aton(argv[1], &addr);
348 if (!ret)
349 {
350 vty_out (vty, "Please specify interface address by A.B.C.D%s",
351 VTY_NEWLINE);
352 return CMD_WARNING;
353 }
354
355 params = ospf_lookup_if_params (ifp, addr);
356 if (params == NULL)
357 return CMD_SUCCESS;
358 }
359
360 UNSET_IF_PARAM (params, passive_interface);
361 params->passive_interface = OSPF_IF_ACTIVE;
362
363 if (params != IF_DEF_PARAMS (ifp))
364 {
365 ospf_free_if_params (ifp, addr);
366 ospf_if_update_params (ifp, addr);
367 }
ajsba6454e2005-02-08 15:37:30 +0000368
369 /* XXX We should call ospf_if_set_multicast on exactly those
370 * interfaces for which the passive property changed. It is too much
371 * work to determine this set, so we do this for every interface.
372 * This is safe and reasonable because ospf_if_set_multicast uses a
373 * record of joined groups to avoid systems calls if the desired
374 * memberships match the current memership.
375 */
376 for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn))
377 {
378 struct ospf_interface *oi = rn->info;
379
380 if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE))
381 ospf_if_set_multicast(oi);
382 }
383
paul718e3742002-12-13 20:15:29 +0000384 return CMD_SUCCESS;
385}
386
paula2c62832003-04-23 17:01:31 +0000387ALIAS (no_ospf_passive_interface,
388 no_ospf_passive_interface_cmd,
paul718e3742002-12-13 20:15:29 +0000389 "no passive-interface IFNAME",
390 NO_STR
391 "Allow routing updates on an interface\n"
392 "Interface's name\n")
393
paula2c62832003-04-23 17:01:31 +0000394DEFUN (ospf_network_area,
395 ospf_network_area_cmd,
paul718e3742002-12-13 20:15:29 +0000396 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
397 "Enable routing on an IP network\n"
398 "OSPF network prefix\n"
399 "Set the OSPF area ID\n"
400 "OSPF area ID in IP address format\n"
401 "OSPF area ID as a decimal value\n")
402{
403 struct ospf *ospf= vty->index;
404 struct prefix_ipv4 p;
405 struct in_addr area_id;
406 int ret, format;
407
408 /* Get network prefix and Area ID. */
409 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
410 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
411
412 ret = ospf_network_set (ospf, &p, area_id);
413 if (ret == 0)
414 {
415 vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
416 return CMD_WARNING;
417 }
418
419 return CMD_SUCCESS;
420}
421
paula2c62832003-04-23 17:01:31 +0000422DEFUN (no_ospf_network_area,
423 no_ospf_network_area_cmd,
paul718e3742002-12-13 20:15:29 +0000424 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
425 NO_STR
426 "Enable routing on an IP network\n"
427 "OSPF network prefix\n"
428 "Set the OSPF area ID\n"
429 "OSPF area ID in IP address format\n"
430 "OSPF area ID as a decimal value\n")
431{
432 struct ospf *ospf = (struct ospf *) vty->index;
433 struct prefix_ipv4 p;
434 struct in_addr area_id;
435 int ret, format;
436
437 /* Get network prefix and Area ID. */
438 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
439 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
440
441 ret = ospf_network_unset (ospf, &p, area_id);
442 if (ret == 0)
443 {
444 vty_out (vty, "Can't find specified network area configuration.%s",
445 VTY_NEWLINE);
446 return CMD_WARNING;
447 }
448
449 return CMD_SUCCESS;
450}
451
452
paula2c62832003-04-23 17:01:31 +0000453DEFUN (ospf_area_range,
454 ospf_area_range_cmd,
paul718e3742002-12-13 20:15:29 +0000455 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
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{
462 struct ospf *ospf = vty->index;
463 struct prefix_ipv4 p;
464 struct in_addr area_id;
465 int format;
466 u_int32_t cost;
467
468 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
469 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
470
471 ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
472 if (argc > 2)
473 {
paul4dadc292005-05-06 21:37:42 +0000474 VTY_GET_INTEGER ("range cost", cost, argv[2]);
paul718e3742002-12-13 20:15:29 +0000475 ospf_area_range_cost_set (ospf, area_id, &p, cost);
476 }
477
478 return CMD_SUCCESS;
479}
480
paula2c62832003-04-23 17:01:31 +0000481ALIAS (ospf_area_range,
482 ospf_area_range_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000483 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
484 "OSPF area parameters\n"
485 "OSPF area ID in IP address format\n"
486 "OSPF area ID as a decimal value\n"
487 "OSPF area range for route advertise (default)\n"
488 "Area range prefix\n"
489 "Advertise this range (default)\n")
490
paula2c62832003-04-23 17:01:31 +0000491ALIAS (ospf_area_range,
492 ospf_area_range_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000493 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
494 "OSPF area parameters\n"
495 "OSPF area ID in IP address format\n"
496 "OSPF area ID as a decimal value\n"
497 "Summarize routes matching address/mask (border routers only)\n"
498 "Area range prefix\n"
499 "User specified metric for this range\n"
500 "Advertised metric for this range\n")
501
paula2c62832003-04-23 17:01:31 +0000502ALIAS (ospf_area_range,
503 ospf_area_range_advertise_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000504 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
505 "OSPF area parameters\n"
506 "OSPF area ID in IP address format\n"
507 "OSPF area ID as a decimal value\n"
508 "Summarize routes matching address/mask (border routers only)\n"
509 "Area range prefix\n"
510 "Advertise this range (default)\n"
511 "User specified metric for this range\n"
512 "Advertised metric for this range\n")
513
paula2c62832003-04-23 17:01:31 +0000514DEFUN (ospf_area_range_not_advertise,
515 ospf_area_range_not_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000516 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
517 "OSPF area parameters\n"
518 "OSPF area ID in IP address format\n"
519 "OSPF area ID as a decimal value\n"
520 "Summarize routes matching address/mask (border routers only)\n"
521 "Area range prefix\n"
522 "DoNotAdvertise this range\n")
523{
524 struct ospf *ospf = vty->index;
525 struct prefix_ipv4 p;
526 struct in_addr area_id;
527 int format;
528
529 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
530 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
531
532 ospf_area_range_set (ospf, area_id, &p, 0);
533
534 return CMD_SUCCESS;
535}
536
paula2c62832003-04-23 17:01:31 +0000537DEFUN (no_ospf_area_range,
538 no_ospf_area_range_cmd,
paul718e3742002-12-13 20:15:29 +0000539 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
540 NO_STR
541 "OSPF area parameters\n"
542 "OSPF area ID in IP address format\n"
543 "OSPF area ID as a decimal value\n"
544 "Summarize routes matching address/mask (border routers only)\n"
545 "Area range prefix\n")
546{
547 struct ospf *ospf = vty->index;
548 struct prefix_ipv4 p;
549 struct in_addr area_id;
550 int format;
551
552 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
553 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
554
555 ospf_area_range_unset (ospf, area_id, &p);
556
557 return CMD_SUCCESS;
558}
559
paula2c62832003-04-23 17:01:31 +0000560ALIAS (no_ospf_area_range,
561 no_ospf_area_range_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000562 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
563 NO_STR
564 "OSPF area parameters\n"
565 "OSPF area ID in IP address format\n"
566 "OSPF area ID as a decimal value\n"
567 "Summarize routes matching address/mask (border routers only)\n"
568 "Area range prefix\n"
569 "Advertise this range (default)\n"
570 "DoNotAdvertise this range\n")
571
paula2c62832003-04-23 17:01:31 +0000572ALIAS (no_ospf_area_range,
573 no_ospf_area_range_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000574 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
575 NO_STR
576 "OSPF area parameters\n"
577 "OSPF area ID in IP address format\n"
578 "OSPF area ID as a decimal value\n"
579 "Summarize routes matching address/mask (border routers only)\n"
580 "Area range prefix\n"
581 "User specified metric for this range\n"
582 "Advertised metric for this range\n")
583
paula2c62832003-04-23 17:01:31 +0000584ALIAS (no_ospf_area_range,
585 no_ospf_area_range_advertise_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000586 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
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 "Advertise this range (default)\n"
594 "User specified metric for this range\n"
595 "Advertised metric for this range\n")
596
paula2c62832003-04-23 17:01:31 +0000597DEFUN (ospf_area_range_substitute,
598 ospf_area_range_substitute_cmd,
paul718e3742002-12-13 20:15:29 +0000599 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
600 "OSPF area parameters\n"
601 "OSPF area ID in IP address format\n"
602 "OSPF area ID as a decimal value\n"
603 "Summarize routes matching address/mask (border routers only)\n"
604 "Area range prefix\n"
605 "Announce area range as another prefix\n"
606 "Network prefix to be announced instead of range\n")
607{
608 struct ospf *ospf = vty->index;
609 struct prefix_ipv4 p, s;
610 struct in_addr area_id;
611 int format;
612
613 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
614 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
615 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
616
617 ospf_area_range_substitute_set (ospf, area_id, &p, &s);
618
619 return CMD_SUCCESS;
620}
621
paula2c62832003-04-23 17:01:31 +0000622DEFUN (no_ospf_area_range_substitute,
623 no_ospf_area_range_substitute_cmd,
paul718e3742002-12-13 20:15:29 +0000624 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
625 NO_STR
626 "OSPF area parameters\n"
627 "OSPF area ID in IP address format\n"
628 "OSPF area ID as a decimal value\n"
629 "Summarize routes matching address/mask (border routers only)\n"
630 "Area range prefix\n"
631 "Announce area range as another prefix\n"
632 "Network prefix to be announced instead of range\n")
633{
634 struct ospf *ospf = vty->index;
635 struct prefix_ipv4 p, s;
636 struct in_addr area_id;
637 int format;
638
639 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
640 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
641 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
642
643 ospf_area_range_substitute_unset (ospf, area_id, &p);
644
645 return CMD_SUCCESS;
646}
647
648
649/* Command Handler Logic in VLink stuff is delicate!!
650
651 ALTER AT YOUR OWN RISK!!!!
652
653 Various dummy values are used to represent 'NoChange' state for
654 VLink configuration NOT being changed by a VLink command, and
655 special syntax is used within the command strings so that the
656 typed in command verbs can be seen in the configuration command
657 bacckend handler. This is to drastically reduce the verbeage
658 required to coe up with a reasonably compatible Cisco VLink command
659
660 - Matthew Grant <grantma@anathoth.gen.nz>
661 Wed, 21 Feb 2001 15:13:52 +1300
662 */
663
664
665/* Configuration data for virtual links
666 */
667struct ospf_vl_config_data {
668 struct vty *vty; /* vty stuff */
669 struct in_addr area_id; /* area ID from command line */
670 int format; /* command line area ID format */
671 struct in_addr vl_peer; /* command line vl_peer */
672 int auth_type; /* Authehntication type, if given */
673 char *auth_key; /* simple password if present */
674 int crypto_key_id; /* Cryptographic key ID */
675 char *md5_key; /* MD5 authentication key */
676 int hello_interval; /* Obvious what these are... */
677 int retransmit_interval;
678 int transmit_delay;
679 int dead_interval;
680};
681
paul4dadc292005-05-06 21:37:42 +0000682static void
paul718e3742002-12-13 20:15:29 +0000683ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config,
684 struct vty *vty)
685{
686 memset (vl_config, 0, sizeof (struct ospf_vl_config_data));
687 vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN;
688 vl_config->vty = vty;
689}
690
paul4dadc292005-05-06 21:37:42 +0000691static struct ospf_vl_data *
paul68980082003-03-25 05:07:42 +0000692ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000693{
694 struct ospf_area *area;
695 struct ospf_vl_data *vl_data;
696 struct vty *vty;
697 struct in_addr area_id;
698
699 vty = vl_config->vty;
700 area_id = vl_config->area_id;
701
702 if (area_id.s_addr == OSPF_AREA_BACKBONE)
703 {
704 vty_out (vty,
705 "Configuring VLs over the backbone is not allowed%s",
706 VTY_NEWLINE);
707 return NULL;
708 }
paul68980082003-03-25 05:07:42 +0000709 area = ospf_area_get (ospf, area_id, vl_config->format);
paul718e3742002-12-13 20:15:29 +0000710
711 if (area->external_routing != OSPF_AREA_DEFAULT)
712 {
713 if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS)
714 vty_out (vty, "Area %s is %s%s",
715 inet_ntoa (area_id),
paul718e3742002-12-13 20:15:29 +0000716 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
paul718e3742002-12-13 20:15:29 +0000717 VTY_NEWLINE);
718 else
719 vty_out (vty, "Area %ld is %s%s",
720 (u_long)ntohl (area_id.s_addr),
paul718e3742002-12-13 20:15:29 +0000721 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
paul718e3742002-12-13 20:15:29 +0000722 VTY_NEWLINE);
723 return NULL;
724 }
725
726 if ((vl_data = ospf_vl_lookup (area, vl_config->vl_peer)) == NULL)
727 {
728 vl_data = ospf_vl_data_new (area, vl_config->vl_peer);
729 if (vl_data->vl_oi == NULL)
730 {
paul68980082003-03-25 05:07:42 +0000731 vl_data->vl_oi = ospf_vl_new (ospf, vl_data);
732 ospf_vl_add (ospf, vl_data);
733 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +0000734 }
735 }
736 return vl_data;
737}
738
739
paul4dadc292005-05-06 21:37:42 +0000740static int
paul718e3742002-12-13 20:15:29 +0000741ospf_vl_set_security (struct ospf_vl_data *vl_data,
742 struct ospf_vl_config_data *vl_config)
743{
744 struct crypt_key *ck;
745 struct vty *vty;
746 struct interface *ifp = vl_data->vl_oi->ifp;
747
748 vty = vl_config->vty;
749
750 if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN)
751 {
752 SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type);
753 IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type;
754 }
755
756 if (vl_config->auth_key)
757 {
758 memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1);
hassoc9e52be2004-09-26 16:09:34 +0000759 strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key,
paul718e3742002-12-13 20:15:29 +0000760 OSPF_AUTH_SIMPLE_SIZE);
761 }
762 else if (vl_config->md5_key)
763 {
764 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id)
765 != NULL)
766 {
767 vty_out (vty, "OSPF: Key %d already exists%s",
768 vl_config->crypto_key_id, VTY_NEWLINE);
769 return CMD_WARNING;
770 }
771 ck = ospf_crypt_key_new ();
772 ck->key_id = vl_config->crypto_key_id;
773 memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
hassoc9e52be2004-09-26 16:09:34 +0000774 strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE);
paul718e3742002-12-13 20:15:29 +0000775
776 ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck);
777 }
778 else if (vl_config->crypto_key_id != 0)
779 {
780 /* Delete a key */
781
782 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt,
783 vl_config->crypto_key_id) == NULL)
784 {
785 vty_out (vty, "OSPF: Key %d does not exist%s",
786 vl_config->crypto_key_id, VTY_NEWLINE);
787 return CMD_WARNING;
788 }
789
790 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id);
791
792 }
793
794 return CMD_SUCCESS;
795}
796
paul4dadc292005-05-06 21:37:42 +0000797static int
paul718e3742002-12-13 20:15:29 +0000798ospf_vl_set_timers (struct ospf_vl_data *vl_data,
799 struct ospf_vl_config_data *vl_config)
800{
801 struct interface *ifp = ifp = vl_data->vl_oi->ifp;
802 /* Virtual Link data initialised to defaults, so only set
803 if a value given */
804 if (vl_config->hello_interval)
805 {
806 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello);
807 IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval;
808 }
809
810 if (vl_config->dead_interval)
811 {
812 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait);
813 IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval;
814 }
815
816 if (vl_config->retransmit_interval)
817 {
818 SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval);
819 IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval;
820 }
821
822 if (vl_config->transmit_delay)
823 {
824 SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay);
825 IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay;
826 }
827
828 return CMD_SUCCESS;
829}
830
831
832
833/* The business end of all of the above */
paul4dadc292005-05-06 21:37:42 +0000834static int
paul68980082003-03-25 05:07:42 +0000835ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000836{
837 struct ospf_vl_data *vl_data;
838 int ret;
839
paul68980082003-03-25 05:07:42 +0000840 vl_data = ospf_find_vl_data (ospf, vl_config);
paul718e3742002-12-13 20:15:29 +0000841 if (!vl_data)
842 return CMD_WARNING;
843
844 /* Process this one first as it can have a fatal result, which can
845 only logically occur if the virtual link exists already
846 Thus a command error does not result in a change to the
847 running configuration such as unexpectedly altered timer
848 values etc.*/
849 ret = ospf_vl_set_security (vl_data, vl_config);
850 if (ret != CMD_SUCCESS)
851 return ret;
852
853 /* Set any time based parameters, these area already range checked */
854
855 ret = ospf_vl_set_timers (vl_data, vl_config);
856 if (ret != CMD_SUCCESS)
857 return ret;
858
859 return CMD_SUCCESS;
860
861}
862
863/* This stuff exists to make specifying all the alias commands A LOT simpler
864 */
865#define VLINK_HELPSTR_IPADDR \
866 "OSPF area parameters\n" \
867 "OSPF area ID in IP address format\n" \
868 "OSPF area ID as a decimal value\n" \
869 "Configure a virtual link\n" \
870 "Router ID of the remote ABR\n"
871
872#define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
873 "Enable authentication on this virtual link\n" \
874 "dummy string \n"
875
876#define VLINK_HELPSTR_AUTHTYPE_ALL \
877 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
878 "Use null authentication\n" \
879 "Use message-digest authentication\n"
880
881#define VLINK_HELPSTR_TIME_PARAM_NOSECS \
882 "Time between HELLO packets\n" \
883 "Time between retransmitting lost link state advertisements\n" \
884 "Link state transmit delay\n" \
885 "Interval after which a neighbor is declared dead\n"
886
887#define VLINK_HELPSTR_TIME_PARAM \
888 VLINK_HELPSTR_TIME_PARAM_NOSECS \
889 "Seconds\n"
890
891#define VLINK_HELPSTR_AUTH_SIMPLE \
892 "Authentication password (key)\n" \
893 "The OSPF password (key)"
894
895#define VLINK_HELPSTR_AUTH_MD5 \
896 "Message digest authentication password (key)\n" \
897 "dummy string \n" \
898 "Key ID\n" \
899 "Use MD5 algorithm\n" \
900 "The OSPF password (key)"
901
paula2c62832003-04-23 17:01:31 +0000902DEFUN (ospf_area_vlink,
903 ospf_area_vlink_cmd,
paul718e3742002-12-13 20:15:29 +0000904 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
905 VLINK_HELPSTR_IPADDR)
906{
paul68980082003-03-25 05:07:42 +0000907 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000908 struct ospf_vl_config_data vl_config;
909 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
910 char md5_key[OSPF_AUTH_MD5_SIZE+1];
911 int i;
912 int ret;
913
914 ospf_vl_config_data_init(&vl_config, vty);
915
916 /* Read off first 2 parameters and check them */
917 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format);
918 if (ret < 0)
919 {
920 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
921 return CMD_WARNING;
922 }
923
924 ret = inet_aton (argv[1], &vl_config.vl_peer);
925 if (! ret)
926 {
927 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
928 VTY_NEWLINE);
929 return CMD_WARNING;
930 }
931
932 if (argc <=2)
933 {
934 /* Thats all folks! - BUGS B. strikes again!!!*/
935
paul68980082003-03-25 05:07:42 +0000936 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +0000937 }
938
939 /* Deal with other parameters */
940 for (i=2; i < argc; i++)
941 {
942
943 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
944
945 switch (argv[i][0])
946 {
947
948 case 'a':
949 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
950 {
951 /* authentication-key - this option can occur anywhere on
952 command line. At start of command line
953 must check for authentication option. */
954 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
955 strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE);
956 vl_config.auth_key = auth_key;
957 i++;
958 }
959 else if (strncmp (argv[i], "authentication", 14) == 0)
960 {
961 /* authentication - this option can only occur at start
962 of command line */
963 vl_config.auth_type = OSPF_AUTH_SIMPLE;
964 if ((i+1) < argc)
965 {
966 if (strncmp (argv[i+1], "n", 1) == 0)
967 {
968 /* "authentication null" */
969 vl_config.auth_type = OSPF_AUTH_NULL;
970 i++;
971 }
972 else if (strncmp (argv[i+1], "m", 1) == 0
973 && strcmp (argv[i+1], "message-digest-") != 0)
974 {
975 /* "authentication message-digest" */
976 vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
977 i++;
978 }
979 }
980 }
981 break;
982
983 case 'm':
984 /* message-digest-key */
985 i++;
986 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
987 if (vl_config.crypto_key_id < 0)
988 return CMD_WARNING;
989 i++;
990 memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1);
991 strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE);
992 vl_config.md5_key = md5_key;
993 break;
994
995 case 'h':
996 /* Hello interval */
997 i++;
998 vl_config.hello_interval = strtol (argv[i], NULL, 10);
999 if (vl_config.hello_interval < 0)
1000 return CMD_WARNING;
1001 break;
1002
1003 case 'r':
1004 /* Retransmit Interval */
1005 i++;
1006 vl_config.retransmit_interval = strtol (argv[i], NULL, 10);
1007 if (vl_config.retransmit_interval < 0)
1008 return CMD_WARNING;
1009 break;
1010
1011 case 't':
1012 /* Transmit Delay */
1013 i++;
1014 vl_config.transmit_delay = strtol (argv[i], NULL, 10);
1015 if (vl_config.transmit_delay < 0)
1016 return CMD_WARNING;
1017 break;
1018
1019 case 'd':
1020 /* Dead Interval */
1021 i++;
1022 vl_config.dead_interval = strtol (argv[i], NULL, 10);
1023 if (vl_config.dead_interval < 0)
1024 return CMD_WARNING;
1025 break;
1026 }
1027 }
1028
1029
1030 /* Action configuration */
1031
paul68980082003-03-25 05:07:42 +00001032 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001033
1034}
1035
paula2c62832003-04-23 17:01:31 +00001036DEFUN (no_ospf_area_vlink,
1037 no_ospf_area_vlink_cmd,
paul718e3742002-12-13 20:15:29 +00001038 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1039 NO_STR
1040 VLINK_HELPSTR_IPADDR)
1041{
paul68980082003-03-25 05:07:42 +00001042 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001043 struct ospf_area *area;
1044 struct ospf_vl_config_data vl_config;
1045 struct ospf_vl_data *vl_data = NULL;
1046 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
1047 int i;
1048 int ret, format;
1049
1050 ospf_vl_config_data_init(&vl_config, vty);
1051
1052 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format);
1053 if (ret < 0)
1054 {
1055 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
1056 return CMD_WARNING;
1057 }
1058
paul68980082003-03-25 05:07:42 +00001059 area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001060 if (!area)
1061 {
1062 vty_out (vty, "Area does not exist%s", VTY_NEWLINE);
1063 return CMD_WARNING;
1064 }
1065
1066 ret = inet_aton (argv[1], &vl_config.vl_peer);
1067 if (! ret)
1068 {
1069 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
1070 VTY_NEWLINE);
1071 return CMD_WARNING;
1072 }
1073
1074 if (argc <=2)
1075 {
1076 /* Basic VLink no command */
1077 /* Thats all folks! - BUGS B. strikes again!!!*/
1078 if ((vl_data = ospf_vl_lookup (area, vl_config.vl_peer)))
paul68980082003-03-25 05:07:42 +00001079 ospf_vl_delete (ospf, vl_data);
paul718e3742002-12-13 20:15:29 +00001080
paul68980082003-03-25 05:07:42 +00001081 ospf_area_check_free (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001082
1083 return CMD_SUCCESS;
1084 }
1085
1086 /* If we are down here, we are reseting parameters */
1087
1088 /* Deal with other parameters */
1089 for (i=2; i < argc; i++)
1090 {
paul718e3742002-12-13 20:15:29 +00001091 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1092
1093 switch (argv[i][0])
1094 {
1095
1096 case 'a':
1097 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
1098 {
1099 /* authentication-key - this option can occur anywhere on
1100 command line. At start of command line
1101 must check for authentication option. */
1102 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
1103 vl_config.auth_key = auth_key;
1104 }
1105 else if (strncmp (argv[i], "authentication", 14) == 0)
1106 {
1107 /* authentication - this option can only occur at start
1108 of command line */
1109 vl_config.auth_type = OSPF_AUTH_NOTSET;
1110 }
1111 break;
1112
1113 case 'm':
1114 /* message-digest-key */
1115 /* Delete one key */
1116 i++;
1117 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
1118 if (vl_config.crypto_key_id < 0)
1119 return CMD_WARNING;
1120 vl_config.md5_key = NULL;
1121 break;
1122
1123 case 'h':
1124 /* Hello interval */
1125 vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
1126 break;
1127
1128 case 'r':
1129 /* Retransmit Interval */
1130 vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
1131 break;
1132
1133 case 't':
1134 /* Transmit Delay */
1135 vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
1136 break;
1137
1138 case 'd':
1139 /* Dead Interval */
1140 i++;
1141 vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
1142 break;
1143 }
1144 }
1145
1146
1147 /* Action configuration */
1148
paul68980082003-03-25 05:07:42 +00001149 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001150}
1151
paula2c62832003-04-23 17:01:31 +00001152ALIAS (ospf_area_vlink,
1153 ospf_area_vlink_param1_cmd,
paul718e3742002-12-13 20:15:29 +00001154 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1155 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1156 VLINK_HELPSTR_IPADDR
1157 VLINK_HELPSTR_TIME_PARAM)
1158
paula2c62832003-04-23 17:01:31 +00001159ALIAS (no_ospf_area_vlink,
1160 no_ospf_area_vlink_param1_cmd,
paul718e3742002-12-13 20:15:29 +00001161 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1162 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1163 NO_STR
1164 VLINK_HELPSTR_IPADDR
1165 VLINK_HELPSTR_TIME_PARAM)
1166
paula2c62832003-04-23 17:01:31 +00001167ALIAS (ospf_area_vlink,
1168 ospf_area_vlink_param2_cmd,
paul718e3742002-12-13 20:15:29 +00001169 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1170 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1171 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1172 VLINK_HELPSTR_IPADDR
1173 VLINK_HELPSTR_TIME_PARAM
1174 VLINK_HELPSTR_TIME_PARAM)
1175
paula2c62832003-04-23 17:01:31 +00001176ALIAS (no_ospf_area_vlink,
1177 no_ospf_area_vlink_param2_cmd,
paul718e3742002-12-13 20:15:29 +00001178 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1179 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1180 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1181 NO_STR
1182 VLINK_HELPSTR_IPADDR
1183 VLINK_HELPSTR_TIME_PARAM
1184 VLINK_HELPSTR_TIME_PARAM)
1185
paula2c62832003-04-23 17:01:31 +00001186ALIAS (ospf_area_vlink,
1187 ospf_area_vlink_param3_cmd,
paul718e3742002-12-13 20:15:29 +00001188 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1189 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1190 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1191 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1192 VLINK_HELPSTR_IPADDR
1193 VLINK_HELPSTR_TIME_PARAM
1194 VLINK_HELPSTR_TIME_PARAM
1195 VLINK_HELPSTR_TIME_PARAM)
1196
paula2c62832003-04-23 17:01:31 +00001197ALIAS (no_ospf_area_vlink,
1198 no_ospf_area_vlink_param3_cmd,
paul718e3742002-12-13 20:15:29 +00001199 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1200 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1201 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1202 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1203 NO_STR
1204 VLINK_HELPSTR_IPADDR
1205 VLINK_HELPSTR_TIME_PARAM
1206 VLINK_HELPSTR_TIME_PARAM
1207 VLINK_HELPSTR_TIME_PARAM)
1208
paula2c62832003-04-23 17:01:31 +00001209ALIAS (ospf_area_vlink,
1210 ospf_area_vlink_param4_cmd,
paul718e3742002-12-13 20:15:29 +00001211 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1212 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1213 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1214 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1215 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1216 VLINK_HELPSTR_IPADDR
1217 VLINK_HELPSTR_TIME_PARAM
1218 VLINK_HELPSTR_TIME_PARAM
1219 VLINK_HELPSTR_TIME_PARAM
1220 VLINK_HELPSTR_TIME_PARAM)
1221
paula2c62832003-04-23 17:01:31 +00001222ALIAS (no_ospf_area_vlink,
1223 no_ospf_area_vlink_param4_cmd,
paul718e3742002-12-13 20:15:29 +00001224 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1225 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1226 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1227 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1228 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1229 NO_STR
1230 VLINK_HELPSTR_IPADDR
1231 VLINK_HELPSTR_TIME_PARAM
1232 VLINK_HELPSTR_TIME_PARAM
1233 VLINK_HELPSTR_TIME_PARAM
1234 VLINK_HELPSTR_TIME_PARAM)
1235
paula2c62832003-04-23 17:01:31 +00001236ALIAS (ospf_area_vlink,
1237 ospf_area_vlink_authtype_args_cmd,
paul718e3742002-12-13 20:15:29 +00001238 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1239 "(authentication|) (message-digest|null)",
1240 VLINK_HELPSTR_IPADDR
1241 VLINK_HELPSTR_AUTHTYPE_ALL)
1242
paula2c62832003-04-23 17:01:31 +00001243ALIAS (ospf_area_vlink,
1244 ospf_area_vlink_authtype_cmd,
paul718e3742002-12-13 20:15:29 +00001245 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1246 "(authentication|)",
1247 VLINK_HELPSTR_IPADDR
1248 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1249
paula2c62832003-04-23 17:01:31 +00001250ALIAS (no_ospf_area_vlink,
1251 no_ospf_area_vlink_authtype_cmd,
paul718e3742002-12-13 20:15:29 +00001252 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1253 "(authentication|)",
1254 NO_STR
1255 VLINK_HELPSTR_IPADDR
1256 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1257
paula2c62832003-04-23 17:01:31 +00001258ALIAS (ospf_area_vlink,
1259 ospf_area_vlink_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001260 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1261 "(message-digest-key|) <1-255> md5 KEY",
1262 VLINK_HELPSTR_IPADDR
1263 VLINK_HELPSTR_AUTH_MD5)
1264
paula2c62832003-04-23 17:01:31 +00001265ALIAS (no_ospf_area_vlink,
1266 no_ospf_area_vlink_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001267 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1268 "(message-digest-key|) <1-255>",
1269 NO_STR
1270 VLINK_HELPSTR_IPADDR
1271 VLINK_HELPSTR_AUTH_MD5)
1272
paula2c62832003-04-23 17:01:31 +00001273ALIAS (ospf_area_vlink,
1274 ospf_area_vlink_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001275 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1276 "(authentication-key|) AUTH_KEY",
1277 VLINK_HELPSTR_IPADDR
1278 VLINK_HELPSTR_AUTH_SIMPLE)
1279
paula2c62832003-04-23 17:01:31 +00001280ALIAS (no_ospf_area_vlink,
1281 no_ospf_area_vlink_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001282 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1283 "(authentication-key|)",
1284 NO_STR
1285 VLINK_HELPSTR_IPADDR
1286 VLINK_HELPSTR_AUTH_SIMPLE)
1287
paula2c62832003-04-23 17:01:31 +00001288ALIAS (ospf_area_vlink,
1289 ospf_area_vlink_authtype_args_authkey_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 "(authentication-key|) AUTH_KEY",
1293 VLINK_HELPSTR_IPADDR
1294 VLINK_HELPSTR_AUTHTYPE_ALL
1295 VLINK_HELPSTR_AUTH_SIMPLE)
1296
paula2c62832003-04-23 17:01:31 +00001297ALIAS (ospf_area_vlink,
1298 ospf_area_vlink_authtype_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001299 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1300 "(authentication|) "
1301 "(authentication-key|) AUTH_KEY",
1302 VLINK_HELPSTR_IPADDR
1303 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1304 VLINK_HELPSTR_AUTH_SIMPLE)
1305
paula2c62832003-04-23 17:01:31 +00001306ALIAS (no_ospf_area_vlink,
1307 no_ospf_area_vlink_authtype_authkey_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 "(authentication-key|)",
1311 NO_STR
1312 VLINK_HELPSTR_IPADDR
1313 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1314 VLINK_HELPSTR_AUTH_SIMPLE)
1315
paula2c62832003-04-23 17:01:31 +00001316ALIAS (ospf_area_vlink,
1317 ospf_area_vlink_authtype_args_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001318 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1319 "(authentication|) (message-digest|null) "
1320 "(message-digest-key|) <1-255> md5 KEY",
1321 VLINK_HELPSTR_IPADDR
1322 VLINK_HELPSTR_AUTHTYPE_ALL
1323 VLINK_HELPSTR_AUTH_MD5)
1324
paula2c62832003-04-23 17:01:31 +00001325ALIAS (ospf_area_vlink,
1326 ospf_area_vlink_authtype_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001327 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1328 "(authentication|) "
1329 "(message-digest-key|) <1-255> md5 KEY",
1330 VLINK_HELPSTR_IPADDR
1331 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1332 VLINK_HELPSTR_AUTH_MD5)
1333
paula2c62832003-04-23 17:01:31 +00001334ALIAS (no_ospf_area_vlink,
1335 no_ospf_area_vlink_authtype_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001336 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1337 "(authentication|) "
1338 "(message-digest-key|)",
1339 NO_STR
1340 VLINK_HELPSTR_IPADDR
1341 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1342 VLINK_HELPSTR_AUTH_MD5)
1343
1344
paula2c62832003-04-23 17:01:31 +00001345DEFUN (ospf_area_shortcut,
1346 ospf_area_shortcut_cmd,
paul718e3742002-12-13 20:15:29 +00001347 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1348 "OSPF area parameters\n"
1349 "OSPF area ID in IP address format\n"
1350 "OSPF area ID as a decimal value\n"
1351 "Configure the area's shortcutting mode\n"
1352 "Set default shortcutting behavior\n"
1353 "Enable shortcutting through the area\n"
1354 "Disable shortcutting through the area\n")
1355{
paul68980082003-03-25 05:07:42 +00001356 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001357 struct ospf_area *area;
1358 struct in_addr area_id;
1359 int mode;
1360 int format;
1361
1362 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1363
paul68980082003-03-25 05:07:42 +00001364 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001365
1366 if (strncmp (argv[1], "de", 2) == 0)
1367 mode = OSPF_SHORTCUT_DEFAULT;
1368 else if (strncmp (argv[1], "di", 2) == 0)
1369 mode = OSPF_SHORTCUT_DISABLE;
1370 else if (strncmp (argv[1], "e", 1) == 0)
1371 mode = OSPF_SHORTCUT_ENABLE;
1372 else
1373 return CMD_WARNING;
1374
paul68980082003-03-25 05:07:42 +00001375 ospf_area_shortcut_set (ospf, area, mode);
paul718e3742002-12-13 20:15:29 +00001376
paul68980082003-03-25 05:07:42 +00001377 if (ospf->abr_type != OSPF_ABR_SHORTCUT)
paul718e3742002-12-13 20:15:29 +00001378 vty_out (vty, "Shortcut area setting will take effect "
1379 "only when the router is configured as Shortcut ABR%s",
1380 VTY_NEWLINE);
1381
1382 return CMD_SUCCESS;
1383}
1384
paula2c62832003-04-23 17:01:31 +00001385DEFUN (no_ospf_area_shortcut,
1386 no_ospf_area_shortcut_cmd,
paul718e3742002-12-13 20:15:29 +00001387 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1388 NO_STR
1389 "OSPF area parameters\n"
1390 "OSPF area ID in IP address format\n"
1391 "OSPF area ID as a decimal value\n"
1392 "Deconfigure the area's shortcutting mode\n"
1393 "Deconfigure enabled shortcutting through the area\n"
1394 "Deconfigure disabled shortcutting through the area\n")
1395{
paul68980082003-03-25 05:07:42 +00001396 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001397 struct ospf_area *area;
1398 struct in_addr area_id;
1399 int format;
1400
1401 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1402
paul68980082003-03-25 05:07:42 +00001403 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001404 if (!area)
1405 return CMD_SUCCESS;
1406
paul68980082003-03-25 05:07:42 +00001407 ospf_area_shortcut_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001408
1409 return CMD_SUCCESS;
1410}
1411
1412
paula2c62832003-04-23 17:01:31 +00001413DEFUN (ospf_area_stub,
1414 ospf_area_stub_cmd,
paul718e3742002-12-13 20:15:29 +00001415 "area (A.B.C.D|<0-4294967295>) stub",
1416 "OSPF area parameters\n"
1417 "OSPF area ID in IP address format\n"
1418 "OSPF area ID as a decimal value\n"
1419 "Configure OSPF area as 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, "First deconfigure all virtual link through this area%s",
1431 VTY_NEWLINE);
1432 return CMD_WARNING;
1433 }
1434
1435 ospf_area_no_summary_unset (ospf, area_id);
1436
1437 return CMD_SUCCESS;
1438}
1439
paula2c62832003-04-23 17:01:31 +00001440DEFUN (ospf_area_stub_no_summary,
1441 ospf_area_stub_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001442 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1443 "OSPF stub parameters\n"
1444 "OSPF area ID in IP address format\n"
1445 "OSPF area ID as a decimal value\n"
1446 "Configure OSPF area as stub\n"
1447 "Do not inject inter-area routes into stub\n")
1448{
1449 struct ospf *ospf = vty->index;
1450 struct in_addr area_id;
1451 int ret, format;
1452
1453 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1454
1455 ret = ospf_area_stub_set (ospf, area_id);
1456 if (ret == 0)
1457 {
paulb0a053b2003-06-22 09:04:47 +00001458 vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s",
paul718e3742002-12-13 20:15:29 +00001459 VTY_NEWLINE);
1460 return CMD_WARNING;
1461 }
1462
1463 ospf_area_no_summary_set (ospf, area_id);
1464
1465 return CMD_SUCCESS;
1466}
1467
paula2c62832003-04-23 17:01:31 +00001468DEFUN (no_ospf_area_stub,
1469 no_ospf_area_stub_cmd,
paul718e3742002-12-13 20:15:29 +00001470 "no area (A.B.C.D|<0-4294967295>) stub",
1471 NO_STR
1472 "OSPF area parameters\n"
1473 "OSPF area ID in IP address format\n"
1474 "OSPF area ID as a decimal value\n"
1475 "Configure OSPF area as stub\n")
1476{
1477 struct ospf *ospf = vty->index;
1478 struct in_addr area_id;
1479 int format;
1480
1481 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1482
1483 ospf_area_stub_unset (ospf, area_id);
1484 ospf_area_no_summary_unset (ospf, area_id);
1485
1486 return CMD_SUCCESS;
1487}
1488
paula2c62832003-04-23 17:01:31 +00001489DEFUN (no_ospf_area_stub_no_summary,
1490 no_ospf_area_stub_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001491 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1492 NO_STR
1493 "OSPF area parameters\n"
1494 "OSPF area ID in IP address format\n"
1495 "OSPF area ID as a decimal value\n"
1496 "Configure OSPF area as stub\n"
1497 "Do not inject inter-area routes into area\n")
1498{
1499 struct ospf *ospf = vty->index;
1500 struct in_addr area_id;
1501 int format;
1502
1503 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1504 ospf_area_no_summary_unset (ospf, area_id);
1505
1506 return CMD_SUCCESS;
1507}
1508
paul4dadc292005-05-06 21:37:42 +00001509static int
paul6c835672004-10-11 11:00:30 +00001510ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[],
1511 int nosum)
paul718e3742002-12-13 20:15:29 +00001512{
1513 struct ospf *ospf = vty->index;
1514 struct in_addr area_id;
1515 int ret, format;
1516
1517 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1518
1519 ret = ospf_area_nssa_set (ospf, area_id);
1520 if (ret == 0)
1521 {
1522 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1523 VTY_NEWLINE);
1524 return CMD_WARNING;
1525 }
1526
1527 if (argc > 1)
1528 {
1529 if (strncmp (argv[1], "translate-c", 11) == 0)
paulb0a053b2003-06-22 09:04:47 +00001530 ospf_area_nssa_translator_role_set (ospf, area_id,
paul718e3742002-12-13 20:15:29 +00001531 OSPF_NSSA_ROLE_CANDIDATE);
1532 else if (strncmp (argv[1], "translate-n", 11) == 0)
paulb0a053b2003-06-22 09:04:47 +00001533 ospf_area_nssa_translator_role_set (ospf, area_id,
paul718e3742002-12-13 20:15:29 +00001534 OSPF_NSSA_ROLE_NEVER);
1535 else if (strncmp (argv[1], "translate-a", 11) == 0)
paulb0a053b2003-06-22 09:04:47 +00001536 ospf_area_nssa_translator_role_set (ospf, area_id,
paul718e3742002-12-13 20:15:29 +00001537 OSPF_NSSA_ROLE_ALWAYS);
1538 }
paulb0a053b2003-06-22 09:04:47 +00001539 else
1540 {
1541 ospf_area_nssa_translator_role_set (ospf, area_id,
1542 OSPF_NSSA_ROLE_CANDIDATE);
1543 }
paul718e3742002-12-13 20:15:29 +00001544
paulb0a053b2003-06-22 09:04:47 +00001545 if (nosum)
paul718e3742002-12-13 20:15:29 +00001546 ospf_area_no_summary_set (ospf, area_id);
paulb0a053b2003-06-22 09:04:47 +00001547 else
1548 ospf_area_no_summary_unset (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001549
paulb0a053b2003-06-22 09:04:47 +00001550 ospf_schedule_abr_task (ospf);
1551
paul718e3742002-12-13 20:15:29 +00001552 return CMD_SUCCESS;
1553}
1554
paulb0a053b2003-06-22 09:04:47 +00001555DEFUN (ospf_area_nssa_translate_no_summary,
paula2c62832003-04-23 17:01:31 +00001556 ospf_area_nssa_translate_no_summary_cmd,
paulb0a053b2003-06-22 09:04:47 +00001557 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
paul718e3742002-12-13 20:15:29 +00001558 "OSPF area parameters\n"
1559 "OSPF area ID in IP address format\n"
1560 "OSPF area ID as a decimal value\n"
1561 "Configure OSPF area as nssa\n"
1562 "Configure NSSA-ABR for translate election (default)\n"
1563 "Configure NSSA-ABR to never translate\n"
1564 "Configure NSSA-ABR to always translate\n"
paulb0a053b2003-06-22 09:04:47 +00001565 "Do not inject inter-area routes into nssa\n")
1566{
1567 return ospf_area_nssa_cmd_handler (vty, argc, argv, 1);
1568}
paul718e3742002-12-13 20:15:29 +00001569
paulb0a053b2003-06-22 09:04:47 +00001570DEFUN (ospf_area_nssa_translate,
paula2c62832003-04-23 17:01:31 +00001571 ospf_area_nssa_translate_cmd,
paul718e3742002-12-13 20:15:29 +00001572 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
1573 "OSPF area parameters\n"
1574 "OSPF area ID in IP address format\n"
1575 "OSPF area ID as a decimal value\n"
1576 "Configure OSPF area as nssa\n"
1577 "Configure NSSA-ABR for translate election (default)\n"
1578 "Configure NSSA-ABR to never translate\n"
1579 "Configure NSSA-ABR to always translate\n")
paulb0a053b2003-06-22 09:04:47 +00001580{
1581 return ospf_area_nssa_cmd_handler (vty, argc, argv, 0);
1582}
1583
1584DEFUN (ospf_area_nssa,
1585 ospf_area_nssa_cmd,
1586 "area (A.B.C.D|<0-4294967295>) nssa",
1587 "OSPF area parameters\n"
1588 "OSPF area ID in IP address format\n"
1589 "OSPF area ID as a decimal value\n"
1590 "Configure OSPF area as nssa\n")
1591{
1592 return ospf_area_nssa_cmd_handler (vty, argc, argv, 0);
1593}
paul718e3742002-12-13 20:15:29 +00001594
paula2c62832003-04-23 17:01:31 +00001595DEFUN (ospf_area_nssa_no_summary,
1596 ospf_area_nssa_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001597 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1598 "OSPF area parameters\n"
1599 "OSPF area ID in IP address format\n"
1600 "OSPF area ID as a decimal value\n"
1601 "Configure OSPF area as nssa\n"
1602 "Do not inject inter-area routes into nssa\n")
1603{
paulb0a053b2003-06-22 09:04:47 +00001604 return ospf_area_nssa_cmd_handler (vty, argc, argv, 1);
paul718e3742002-12-13 20:15:29 +00001605}
1606
paula2c62832003-04-23 17:01:31 +00001607DEFUN (no_ospf_area_nssa,
1608 no_ospf_area_nssa_cmd,
paul718e3742002-12-13 20:15:29 +00001609 "no area (A.B.C.D|<0-4294967295>) nssa",
1610 NO_STR
1611 "OSPF area parameters\n"
1612 "OSPF area ID in IP address format\n"
1613 "OSPF area ID as a decimal value\n"
1614 "Configure OSPF area as nssa\n")
1615{
1616 struct ospf *ospf = vty->index;
1617 struct in_addr area_id;
1618 int format;
1619
1620 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1621
1622 ospf_area_nssa_unset (ospf, area_id);
1623 ospf_area_no_summary_unset (ospf, area_id);
1624
paulb0a053b2003-06-22 09:04:47 +00001625 ospf_schedule_abr_task (ospf);
1626
paul718e3742002-12-13 20:15:29 +00001627 return CMD_SUCCESS;
1628}
1629
paula2c62832003-04-23 17:01:31 +00001630DEFUN (no_ospf_area_nssa_no_summary,
1631 no_ospf_area_nssa_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001632 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1633 NO_STR
1634 "OSPF area parameters\n"
1635 "OSPF area ID in IP address format\n"
1636 "OSPF area ID as a decimal value\n"
1637 "Configure OSPF area as nssa\n"
1638 "Do not inject inter-area routes into nssa\n")
1639{
1640 struct ospf *ospf = vty->index;
1641 struct in_addr area_id;
1642 int format;
1643
1644 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1645 ospf_area_no_summary_unset (ospf, area_id);
1646
1647 return CMD_SUCCESS;
1648}
1649
paula2c62832003-04-23 17:01:31 +00001650DEFUN (ospf_area_default_cost,
1651 ospf_area_default_cost_cmd,
paul718e3742002-12-13 20:15:29 +00001652 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
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_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001669
1670 if (area->external_routing == OSPF_AREA_DEFAULT)
1671 {
1672 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1673 return CMD_WARNING;
1674 }
1675
1676 area->default_cost = cost;
1677
1678 return CMD_SUCCESS;
1679}
1680
paula2c62832003-04-23 17:01:31 +00001681DEFUN (no_ospf_area_default_cost,
1682 no_ospf_area_default_cost_cmd,
paul718e3742002-12-13 20:15:29 +00001683 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1684 NO_STR
1685 "OSPF area parameters\n"
1686 "OSPF area ID in IP address format\n"
1687 "OSPF area ID as a decimal value\n"
1688 "Set the summary-default cost of a NSSA or stub area\n"
1689 "Stub's advertised default summary cost\n")
1690{
paul68980082003-03-25 05:07:42 +00001691 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001692 struct ospf_area *area;
1693 struct in_addr area_id;
1694 u_int32_t cost;
1695 int format;
1696
1697 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1698 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1699
paul68980082003-03-25 05:07:42 +00001700 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001701 if (area == NULL)
1702 return CMD_SUCCESS;
1703
1704 if (area->external_routing == OSPF_AREA_DEFAULT)
1705 {
1706 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1707 return CMD_WARNING;
1708 }
1709
1710 area->default_cost = 1;
1711
paul68980082003-03-25 05:07:42 +00001712 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001713
1714 return CMD_SUCCESS;
1715}
1716
paula2c62832003-04-23 17:01:31 +00001717DEFUN (ospf_area_export_list,
1718 ospf_area_export_list_cmd,
paul718e3742002-12-13 20:15:29 +00001719 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1720 "OSPF area parameters\n"
1721 "OSPF area ID in IP address format\n"
1722 "OSPF area ID as a decimal value\n"
1723 "Set the filter for networks announced to other areas\n"
1724 "Name of the access-list\n")
1725{
paul68980082003-03-25 05:07:42 +00001726 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001727 struct ospf_area *area;
1728 struct in_addr area_id;
1729 int format;
1730
hasso52930762004-04-19 18:26:53 +00001731 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1732
paul68980082003-03-25 05:07:42 +00001733 area = ospf_area_get (ospf, area_id, format);
1734 ospf_area_export_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001735
1736 return CMD_SUCCESS;
1737}
1738
paula2c62832003-04-23 17:01:31 +00001739DEFUN (no_ospf_area_export_list,
1740 no_ospf_area_export_list_cmd,
paul718e3742002-12-13 20:15:29 +00001741 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1742 NO_STR
1743 "OSPF area parameters\n"
1744 "OSPF area ID in IP address format\n"
1745 "OSPF area ID as a decimal value\n"
1746 "Unset the filter for networks announced to other areas\n"
1747 "Name of the access-list\n")
1748{
paul68980082003-03-25 05:07:42 +00001749 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001750 struct ospf_area *area;
1751 struct in_addr area_id;
1752 int format;
1753
hasso52930762004-04-19 18:26:53 +00001754 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1755
paul68980082003-03-25 05:07:42 +00001756 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001757 if (area == NULL)
1758 return CMD_SUCCESS;
1759
paul68980082003-03-25 05:07:42 +00001760 ospf_area_export_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001761
1762 return CMD_SUCCESS;
1763}
1764
1765
paula2c62832003-04-23 17:01:31 +00001766DEFUN (ospf_area_import_list,
1767 ospf_area_import_list_cmd,
paul718e3742002-12-13 20:15:29 +00001768 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1769 "OSPF area parameters\n"
1770 "OSPF area ID in IP address format\n"
1771 "OSPF area ID as a decimal value\n"
1772 "Set the filter for networks from other areas announced to the specified one\n"
1773 "Name of the access-list\n")
1774{
paul68980082003-03-25 05:07:42 +00001775 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001776 struct ospf_area *area;
1777 struct in_addr area_id;
1778 int format;
1779
hasso52930762004-04-19 18:26:53 +00001780 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1781
paul68980082003-03-25 05:07:42 +00001782 area = ospf_area_get (ospf, area_id, format);
1783 ospf_area_import_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001784
1785 return CMD_SUCCESS;
1786}
1787
paula2c62832003-04-23 17:01:31 +00001788DEFUN (no_ospf_area_import_list,
1789 no_ospf_area_import_list_cmd,
paul718e3742002-12-13 20:15:29 +00001790 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1791 NO_STR
1792 "OSPF area parameters\n"
1793 "OSPF area ID in IP address format\n"
1794 "OSPF area ID as a decimal value\n"
1795 "Unset the filter for networks announced to other areas\n"
1796 "Name of the access-list\n")
1797{
paul68980082003-03-25 05:07:42 +00001798 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001799 struct ospf_area *area;
1800 struct in_addr area_id;
1801 int format;
1802
hasso52930762004-04-19 18:26:53 +00001803 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1804
paul68980082003-03-25 05:07:42 +00001805 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001806 if (area == NULL)
1807 return CMD_SUCCESS;
1808
paul68980082003-03-25 05:07:42 +00001809 ospf_area_import_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001810
1811 return CMD_SUCCESS;
1812}
1813
paula2c62832003-04-23 17:01:31 +00001814DEFUN (ospf_area_filter_list,
1815 ospf_area_filter_list_cmd,
paul718e3742002-12-13 20:15:29 +00001816 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1817 "OSPF area parameters\n"
1818 "OSPF area ID in IP address format\n"
1819 "OSPF area ID as a decimal value\n"
1820 "Filter networks between OSPF areas\n"
1821 "Filter prefixes between OSPF areas\n"
1822 "Name of an IP prefix-list\n"
1823 "Filter networks sent to this area\n"
1824 "Filter networks sent from this area\n")
1825{
paul68980082003-03-25 05:07:42 +00001826 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001827 struct ospf_area *area;
1828 struct in_addr area_id;
1829 struct prefix_list *plist;
1830 int format;
1831
1832 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1833
paul68980082003-03-25 05:07:42 +00001834 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001835 plist = prefix_list_lookup (AFI_IP, argv[1]);
1836 if (strncmp (argv[2], "in", 2) == 0)
1837 {
1838 PREFIX_LIST_IN (area) = plist;
1839 if (PREFIX_NAME_IN (area))
1840 free (PREFIX_NAME_IN (area));
1841
1842 PREFIX_NAME_IN (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001843 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001844 }
1845 else
1846 {
1847 PREFIX_LIST_OUT (area) = plist;
1848 if (PREFIX_NAME_OUT (area))
1849 free (PREFIX_NAME_OUT (area));
1850
1851 PREFIX_NAME_OUT (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001852 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001853 }
1854
1855 return CMD_SUCCESS;
1856}
1857
paula2c62832003-04-23 17:01:31 +00001858DEFUN (no_ospf_area_filter_list,
1859 no_ospf_area_filter_list_cmd,
paul718e3742002-12-13 20:15:29 +00001860 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1861 NO_STR
1862 "OSPF area parameters\n"
1863 "OSPF area ID in IP address format\n"
1864 "OSPF area ID as a decimal value\n"
1865 "Filter networks between OSPF areas\n"
1866 "Filter prefixes between OSPF areas\n"
1867 "Name of an IP prefix-list\n"
1868 "Filter networks sent to this area\n"
1869 "Filter networks sent from this area\n")
1870{
paul68980082003-03-25 05:07:42 +00001871 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001872 struct ospf_area *area;
1873 struct in_addr area_id;
1874 struct prefix_list *plist;
1875 int format;
1876
1877 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1878
paul68980082003-03-25 05:07:42 +00001879 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001880 plist = prefix_list_lookup (AFI_IP, argv[1]);
1881 if (strncmp (argv[2], "in", 2) == 0)
1882 {
1883 if (PREFIX_NAME_IN (area))
1884 if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0)
1885 return CMD_SUCCESS;
1886
1887 PREFIX_LIST_IN (area) = NULL;
1888 if (PREFIX_NAME_IN (area))
1889 free (PREFIX_NAME_IN (area));
1890
1891 PREFIX_NAME_IN (area) = NULL;
1892
paul68980082003-03-25 05:07:42 +00001893 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001894 }
1895 else
1896 {
1897 if (PREFIX_NAME_OUT (area))
1898 if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0)
1899 return CMD_SUCCESS;
1900
1901 PREFIX_LIST_OUT (area) = NULL;
1902 if (PREFIX_NAME_OUT (area))
1903 free (PREFIX_NAME_OUT (area));
1904
1905 PREFIX_NAME_OUT (area) = NULL;
1906
paul68980082003-03-25 05:07:42 +00001907 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001908 }
1909
1910 return CMD_SUCCESS;
1911}
1912
1913
paula2c62832003-04-23 17:01:31 +00001914DEFUN (ospf_area_authentication_message_digest,
1915 ospf_area_authentication_message_digest_cmd,
paul718e3742002-12-13 20:15:29 +00001916 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1917 "OSPF area parameters\n"
1918 "Enable authentication\n"
1919 "Use message-digest authentication\n")
1920{
paul68980082003-03-25 05:07:42 +00001921 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001922 struct ospf_area *area;
1923 struct in_addr area_id;
1924 int format;
1925
1926 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1927
paul68980082003-03-25 05:07:42 +00001928 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001929 area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
1930
1931 return CMD_SUCCESS;
1932}
1933
paula2c62832003-04-23 17:01:31 +00001934DEFUN (ospf_area_authentication,
1935 ospf_area_authentication_cmd,
paul718e3742002-12-13 20:15:29 +00001936 "area (A.B.C.D|<0-4294967295>) authentication",
1937 "OSPF area parameters\n"
1938 "OSPF area ID in IP address format\n"
1939 "OSPF area ID as a decimal value\n"
1940 "Enable authentication\n")
1941{
paul68980082003-03-25 05:07:42 +00001942 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001943 struct ospf_area *area;
1944 struct in_addr area_id;
1945 int format;
1946
1947 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1948
paul68980082003-03-25 05:07:42 +00001949 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001950 area->auth_type = OSPF_AUTH_SIMPLE;
1951
1952 return CMD_SUCCESS;
1953}
1954
paula2c62832003-04-23 17:01:31 +00001955DEFUN (no_ospf_area_authentication,
1956 no_ospf_area_authentication_cmd,
paul718e3742002-12-13 20:15:29 +00001957 "no area (A.B.C.D|<0-4294967295>) authentication",
1958 NO_STR
1959 "OSPF area parameters\n"
1960 "OSPF area ID in IP address format\n"
1961 "OSPF area ID as a decimal value\n"
1962 "Enable authentication\n")
1963{
paul68980082003-03-25 05:07:42 +00001964 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001965 struct ospf_area *area;
1966 struct in_addr area_id;
1967 int format;
1968
1969 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1970
paul68980082003-03-25 05:07:42 +00001971 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001972 if (area == NULL)
1973 return CMD_SUCCESS;
1974
1975 area->auth_type = OSPF_AUTH_NULL;
1976
paul68980082003-03-25 05:07:42 +00001977 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001978
1979 return CMD_SUCCESS;
1980}
1981
1982
1983DEFUN (ospf_abr_type,
1984 ospf_abr_type_cmd,
1985 "ospf abr-type (cisco|ibm|shortcut|standard)",
1986 "OSPF specific commands\n"
1987 "Set OSPF ABR type\n"
1988 "Alternative ABR, cisco implementation\n"
1989 "Alternative ABR, IBM implementation\n"
1990 "Shortcut ABR\n"
1991 "Standard behavior (RFC2328)\n")
1992{
paul68980082003-03-25 05:07:42 +00001993 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001994 u_char abr_type = OSPF_ABR_UNKNOWN;
1995
1996 if (strncmp (argv[0], "c", 1) == 0)
1997 abr_type = OSPF_ABR_CISCO;
1998 else if (strncmp (argv[0], "i", 1) == 0)
1999 abr_type = OSPF_ABR_IBM;
2000 else if (strncmp (argv[0], "sh", 2) == 0)
2001 abr_type = OSPF_ABR_SHORTCUT;
2002 else if (strncmp (argv[0], "st", 2) == 0)
2003 abr_type = OSPF_ABR_STAND;
2004 else
2005 return CMD_WARNING;
2006
2007 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00002008 if (ospf->abr_type != abr_type)
paul718e3742002-12-13 20:15:29 +00002009 {
paul68980082003-03-25 05:07:42 +00002010 ospf->abr_type = abr_type;
2011 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00002012 }
2013
2014 return CMD_SUCCESS;
2015}
2016
2017DEFUN (no_ospf_abr_type,
2018 no_ospf_abr_type_cmd,
pauld57834f2005-07-12 20:04:22 +00002019 "no ospf abr-type (cisco|ibm|shortcut|standard)",
paul718e3742002-12-13 20:15:29 +00002020 NO_STR
2021 "OSPF specific commands\n"
2022 "Set OSPF ABR type\n"
2023 "Alternative ABR, cisco implementation\n"
2024 "Alternative ABR, IBM implementation\n"
2025 "Shortcut ABR\n")
2026{
paul68980082003-03-25 05:07:42 +00002027 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002028 u_char abr_type = OSPF_ABR_UNKNOWN;
2029
2030 if (strncmp (argv[0], "c", 1) == 0)
2031 abr_type = OSPF_ABR_CISCO;
2032 else if (strncmp (argv[0], "i", 1) == 0)
2033 abr_type = OSPF_ABR_IBM;
2034 else if (strncmp (argv[0], "s", 1) == 0)
2035 abr_type = OSPF_ABR_SHORTCUT;
2036 else
2037 return CMD_WARNING;
2038
2039 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00002040 if (ospf->abr_type == abr_type)
paul718e3742002-12-13 20:15:29 +00002041 {
pauld57834f2005-07-12 20:04:22 +00002042 ospf->abr_type = OSPF_ABR_DEFAULT;
paul68980082003-03-25 05:07:42 +00002043 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00002044 }
2045
2046 return CMD_SUCCESS;
2047}
2048
2049DEFUN (ospf_compatible_rfc1583,
2050 ospf_compatible_rfc1583_cmd,
2051 "compatible rfc1583",
2052 "OSPF compatibility list\n"
2053 "compatible with RFC 1583\n")
2054{
2055 struct ospf *ospf = vty->index;
2056
2057 if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2058 {
2059 SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002060 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002061 }
2062 return CMD_SUCCESS;
2063}
2064
2065DEFUN (no_ospf_compatible_rfc1583,
2066 no_ospf_compatible_rfc1583_cmd,
2067 "no compatible rfc1583",
2068 NO_STR
2069 "OSPF compatibility list\n"
2070 "compatible with RFC 1583\n")
2071{
2072 struct ospf *ospf = vty->index;
2073
2074 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2075 {
2076 UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002077 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002078 }
2079 return CMD_SUCCESS;
2080}
2081
2082ALIAS (ospf_compatible_rfc1583,
2083 ospf_rfc1583_flag_cmd,
2084 "ospf rfc1583compatibility",
2085 "OSPF specific commands\n"
2086 "Enable the RFC1583Compatibility flag\n")
2087
2088ALIAS (no_ospf_compatible_rfc1583,
2089 no_ospf_rfc1583_flag_cmd,
2090 "no ospf rfc1583compatibility",
2091 NO_STR
2092 "OSPF specific commands\n"
2093 "Disable the RFC1583Compatibility flag\n")
2094
paula2c62832003-04-23 17:01:31 +00002095DEFUN (ospf_timers_spf,
2096 ospf_timers_spf_cmd,
paul718e3742002-12-13 20:15:29 +00002097 "timers spf <0-4294967295> <0-4294967295>",
2098 "Adjust routing timers\n"
2099 "OSPF SPF timers\n"
2100 "Delay between receiving a change to SPF calculation\n"
2101 "Hold time between consecutive SPF calculations\n")
2102{
2103 struct ospf *ospf = vty->index;
2104 u_int32_t delay, hold;
2105
paul4dadc292005-05-06 21:37:42 +00002106 VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]);
2107 VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]);
paul718e3742002-12-13 20:15:29 +00002108
2109 ospf_timers_spf_set (ospf, delay, hold);
2110
2111 return CMD_SUCCESS;
2112}
2113
paula2c62832003-04-23 17:01:31 +00002114DEFUN (no_ospf_timers_spf,
2115 no_ospf_timers_spf_cmd,
paul718e3742002-12-13 20:15:29 +00002116 "no timers spf",
2117 NO_STR
2118 "Adjust routing timers\n"
2119 "OSPF SPF timers\n")
2120{
paul68980082003-03-25 05:07:42 +00002121 struct ospf *ospf = vty->index;
2122
2123 ospf->spf_delay = OSPF_SPF_DELAY_DEFAULT;
2124 ospf->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002125
2126 return CMD_SUCCESS;
2127}
2128
2129
paula2c62832003-04-23 17:01:31 +00002130DEFUN (ospf_neighbor,
2131 ospf_neighbor_cmd,
paul718e3742002-12-13 20:15:29 +00002132 "neighbor A.B.C.D",
2133 NEIGHBOR_STR
2134 "Neighbor IP address\n")
2135{
2136 struct ospf *ospf = vty->index;
2137 struct in_addr nbr_addr;
hassoeb1ce602004-10-08 08:17:22 +00002138 unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2139 unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002140
2141 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2142
2143 if (argc > 1)
2144 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255);
2145
2146 if (argc > 2)
2147 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535);
2148
2149 ospf_nbr_nbma_set (ospf, nbr_addr);
2150 if (argc > 1)
2151 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2152 if (argc > 2)
2153 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority);
2154
2155 return CMD_SUCCESS;
2156}
2157
paula2c62832003-04-23 17:01:31 +00002158ALIAS (ospf_neighbor,
2159 ospf_neighbor_priority_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002160 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2161 NEIGHBOR_STR
2162 "Neighbor IP address\n"
2163 "Neighbor Priority\n"
2164 "Priority\n"
2165 "Dead Neighbor Polling interval\n"
2166 "Seconds\n")
2167
paula2c62832003-04-23 17:01:31 +00002168ALIAS (ospf_neighbor,
2169 ospf_neighbor_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002170 "neighbor A.B.C.D priority <0-255>",
2171 NEIGHBOR_STR
2172 "Neighbor IP address\n"
2173 "Neighbor Priority\n"
2174 "Seconds\n")
2175
paula2c62832003-04-23 17:01:31 +00002176DEFUN (ospf_neighbor_poll_interval,
2177 ospf_neighbor_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002178 "neighbor A.B.C.D poll-interval <1-65535>",
2179 NEIGHBOR_STR
2180 "Neighbor IP address\n"
2181 "Dead Neighbor Polling interval\n"
2182 "Seconds\n")
2183{
2184 struct ospf *ospf = vty->index;
2185 struct in_addr nbr_addr;
hassoeb1ce602004-10-08 08:17:22 +00002186 unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2187 unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002188
2189 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2190
2191 if (argc > 1)
2192 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535);
2193
2194 if (argc > 2)
2195 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255);
2196
2197 ospf_nbr_nbma_set (ospf, nbr_addr);
2198 if (argc > 1)
2199 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
2200 if (argc > 2)
2201 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2202
2203 return CMD_SUCCESS;
2204}
2205
paula2c62832003-04-23 17:01:31 +00002206ALIAS (ospf_neighbor_poll_interval,
2207 ospf_neighbor_poll_interval_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002208 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2209 NEIGHBOR_STR
2210 "Neighbor address\n"
2211 "OSPF dead-router polling interval\n"
2212 "Seconds\n"
2213 "OSPF priority of non-broadcast neighbor\n"
2214 "Priority\n")
2215
paula2c62832003-04-23 17:01:31 +00002216DEFUN (no_ospf_neighbor,
2217 no_ospf_neighbor_cmd,
paul718e3742002-12-13 20:15:29 +00002218 "no neighbor A.B.C.D",
2219 NO_STR
2220 NEIGHBOR_STR
2221 "Neighbor IP address\n")
2222{
2223 struct ospf *ospf = vty->index;
2224 struct in_addr nbr_addr;
2225 int ret;
2226
2227 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2228
2229 ret = ospf_nbr_nbma_unset (ospf, nbr_addr);
2230
2231 return CMD_SUCCESS;
2232}
2233
paula2c62832003-04-23 17:01:31 +00002234ALIAS (no_ospf_neighbor,
2235 no_ospf_neighbor_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002236 "no neighbor A.B.C.D priority <0-255>",
2237 NO_STR
2238 NEIGHBOR_STR
2239 "Neighbor IP address\n"
2240 "Neighbor Priority\n"
2241 "Priority\n")
2242
paula2c62832003-04-23 17:01:31 +00002243ALIAS (no_ospf_neighbor,
2244 no_ospf_neighbor_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002245 "no neighbor A.B.C.D poll-interval <1-65535>",
2246 NO_STR
2247 NEIGHBOR_STR
2248 "Neighbor IP address\n"
2249 "Dead Neighbor Polling interval\n"
2250 "Seconds\n")
2251
paula2c62832003-04-23 17:01:31 +00002252ALIAS (no_ospf_neighbor,
2253 no_ospf_neighbor_priority_pollinterval_cmd,
paul718e3742002-12-13 20:15:29 +00002254 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2255 NO_STR
2256 NEIGHBOR_STR
2257 "Neighbor IP address\n"
2258 "Neighbor Priority\n"
2259 "Priority\n"
2260 "Dead Neighbor Polling interval\n"
2261 "Seconds\n")
2262
2263
paula2c62832003-04-23 17:01:31 +00002264DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd,
paul718e3742002-12-13 20:15:29 +00002265 "refresh timer <10-1800>",
2266 "Adjust refresh parameters\n"
2267 "Set refresh timer\n"
2268 "Timer value in seconds\n")
2269{
2270 struct ospf *ospf = vty->index;
hassoeb1ce602004-10-08 08:17:22 +00002271 unsigned int interval;
paul718e3742002-12-13 20:15:29 +00002272
2273 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2274 interval = (interval / 10) * 10;
2275
2276 ospf_timers_refresh_set (ospf, interval);
2277
2278 return CMD_SUCCESS;
2279}
2280
paula2c62832003-04-23 17:01:31 +00002281DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd,
paul718e3742002-12-13 20:15:29 +00002282 "no refresh timer <10-1800>",
2283 "Adjust refresh parameters\n"
2284 "Unset refresh timer\n"
2285 "Timer value in seconds\n")
2286{
2287 struct ospf *ospf = vty->index;
hassoeb1ce602004-10-08 08:17:22 +00002288 unsigned int interval;
paul718e3742002-12-13 20:15:29 +00002289
2290 if (argc == 1)
2291 {
2292 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2293
2294 if (ospf->lsa_refresh_interval != interval ||
2295 interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
2296 return CMD_SUCCESS;
2297 }
2298
2299 ospf_timers_refresh_unset (ospf);
2300
2301 return CMD_SUCCESS;
2302}
2303
paula2c62832003-04-23 17:01:31 +00002304ALIAS (no_ospf_refresh_timer,
2305 no_ospf_refresh_timer_cmd,
paul718e3742002-12-13 20:15:29 +00002306 "no refresh timer",
2307 "Adjust refresh parameters\n"
2308 "Unset refresh timer\n")
2309
paula2c62832003-04-23 17:01:31 +00002310DEFUN (ospf_auto_cost_reference_bandwidth,
2311 ospf_auto_cost_reference_bandwidth_cmd,
paul718e3742002-12-13 20:15:29 +00002312 "auto-cost reference-bandwidth <1-4294967>",
2313 "Calculate OSPF interface cost according to bandwidth\n"
2314 "Use reference bandwidth method to assign OSPF cost\n"
2315 "The reference bandwidth in terms of Mbits per second\n")
2316{
paul68980082003-03-25 05:07:42 +00002317 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002318 u_int32_t refbw;
hasso52dc7ee2004-09-23 19:18:23 +00002319 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00002320 struct interface *ifp;
paul718e3742002-12-13 20:15:29 +00002321
2322 refbw = strtol (argv[0], NULL, 10);
2323 if (refbw < 1 || refbw > 4294967)
2324 {
2325 vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
2326 return CMD_WARNING;
2327 }
2328
2329 /* If reference bandwidth is changed. */
paul68980082003-03-25 05:07:42 +00002330 if ((refbw * 1000) == ospf->ref_bandwidth)
paul718e3742002-12-13 20:15:29 +00002331 return CMD_SUCCESS;
2332
paul68980082003-03-25 05:07:42 +00002333 ospf->ref_bandwidth = refbw * 1000;
paul718e3742002-12-13 20:15:29 +00002334 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2335 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2336
paul1eb8ef22005-04-07 07:30:20 +00002337 for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
2338 ospf_if_recalculate_output_cost (ifp);
paul718e3742002-12-13 20:15:29 +00002339
2340 return CMD_SUCCESS;
2341}
2342
paula2c62832003-04-23 17:01:31 +00002343DEFUN (no_ospf_auto_cost_reference_bandwidth,
2344 no_ospf_auto_cost_reference_bandwidth_cmd,
paul718e3742002-12-13 20:15:29 +00002345 "no auto-cost reference-bandwidth",
2346 NO_STR
2347 "Calculate OSPF interface cost according to bandwidth\n"
2348 "Use reference bandwidth method to assign OSPF cost\n")
2349{
paul68980082003-03-25 05:07:42 +00002350 struct ospf *ospf = vty->index;
paul1eb8ef22005-04-07 07:30:20 +00002351 struct listnode *node, *nnode;
2352 struct interface *ifp;
paul718e3742002-12-13 20:15:29 +00002353
paul68980082003-03-25 05:07:42 +00002354 if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00002355 return CMD_SUCCESS;
2356
paul68980082003-03-25 05:07:42 +00002357 ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;
paul718e3742002-12-13 20:15:29 +00002358 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2359 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2360
paul1eb8ef22005-04-07 07:30:20 +00002361 for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp))
2362 ospf_if_recalculate_output_cost (ifp);
paul718e3742002-12-13 20:15:29 +00002363
2364 return CMD_SUCCESS;
2365}
2366
hassoeb1ce602004-10-08 08:17:22 +00002367const char *ospf_abr_type_descr_str[] =
paul718e3742002-12-13 20:15:29 +00002368{
2369 "Unknown",
2370 "Standard (RFC2328)",
2371 "Alternative IBM",
2372 "Alternative Cisco",
2373 "Alternative Shortcut"
2374};
2375
hassoeb1ce602004-10-08 08:17:22 +00002376const char *ospf_shortcut_mode_descr_str[] =
paul718e3742002-12-13 20:15:29 +00002377{
2378 "Default",
2379 "Enabled",
2380 "Disabled"
2381};
2382
2383
2384
paul4dadc292005-05-06 21:37:42 +00002385static void
paul718e3742002-12-13 20:15:29 +00002386show_ip_ospf_area (struct vty *vty, struct ospf_area *area)
2387{
2388 /* Show Area ID. */
2389 vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id));
2390
2391 /* Show Area type/mode. */
2392 if (OSPF_IS_AREA_BACKBONE (area))
2393 vty_out (vty, " (Backbone)%s", VTY_NEWLINE);
2394 else
2395 {
2396 if (area->external_routing == OSPF_AREA_STUB)
paulb0a053b2003-06-22 09:04:47 +00002397 vty_out (vty, " (Stub%s%s)",
2398 area->no_summary ? ", no summary" : "",
2399 area->shortcut_configured ? "; " : "");
paul718e3742002-12-13 20:15:29 +00002400
paulb0a053b2003-06-22 09:04:47 +00002401 else if (area->external_routing == OSPF_AREA_NSSA)
2402 vty_out (vty, " (NSSA%s%s)",
2403 area->no_summary ? ", no summary" : "",
2404 area->shortcut_configured ? "; " : "");
paul718e3742002-12-13 20:15:29 +00002405
2406 vty_out (vty, "%s", VTY_NEWLINE);
2407 vty_out (vty, " Shortcutting mode: %s",
paulb0a053b2003-06-22 09:04:47 +00002408 ospf_shortcut_mode_descr_str[area->shortcut_configured]);
paul718e3742002-12-13 20:15:29 +00002409 vty_out (vty, ", S-bit consensus: %s%s",
paulb0a053b2003-06-22 09:04:47 +00002410 area->shortcut_capability ? "ok" : "no", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002411 }
2412
2413 /* Show number of interfaces. */
2414 vty_out (vty, " Number of interfaces in this area: Total: %d, "
2415 "Active: %d%s", listcount (area->oiflist),
2416 area->act_ints, VTY_NEWLINE);
2417
paul718e3742002-12-13 20:15:29 +00002418 if (area->external_routing == OSPF_AREA_NSSA)
2419 {
2420 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 +00002421 if (! IS_OSPF_ABR (area->ospf))
paulb0a053b2003-06-22 09:04:47 +00002422 vty_out (vty, " It is not ABR, therefore not Translator. %s",
2423 VTY_NEWLINE);
2424 else if (area->NSSATranslatorState)
2425 {
2426 vty_out (vty, " We are an ABR and ");
2427 if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE)
2428 vty_out (vty, "the NSSA Elected Translator. %s",
2429 VTY_NEWLINE);
2430 else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS)
2431 vty_out (vty, "always an NSSA Translator. %s",
2432 VTY_NEWLINE);
2433 }
paul718e3742002-12-13 20:15:29 +00002434 else
paulb0a053b2003-06-22 09:04:47 +00002435 {
2436 vty_out (vty, " We are an ABR, but ");
2437 if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE)
2438 vty_out (vty, "not the NSSA Elected Translator. %s",
2439 VTY_NEWLINE);
2440 else
hassoc6b87812004-12-22 13:09:59 +00002441 vty_out (vty, "never an NSSA Translator. %s",
paulb0a053b2003-06-22 09:04:47 +00002442 VTY_NEWLINE);
2443 }
paul718e3742002-12-13 20:15:29 +00002444 }
paul718e3742002-12-13 20:15:29 +00002445
2446 /* Show number of fully adjacent neighbors. */
2447 vty_out (vty, " Number of fully adjacent neighbors in this area:"
paulb0a053b2003-06-22 09:04:47 +00002448 " %d%s", area->full_nbrs, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002449
2450 /* Show authentication type. */
2451 vty_out (vty, " Area has ");
2452 if (area->auth_type == OSPF_AUTH_NULL)
2453 vty_out (vty, "no authentication%s", VTY_NEWLINE);
2454 else if (area->auth_type == OSPF_AUTH_SIMPLE)
2455 vty_out (vty, "simple password authentication%s", VTY_NEWLINE);
2456 else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC)
2457 vty_out (vty, "message digest authentication%s", VTY_NEWLINE);
2458
2459 if (!OSPF_IS_AREA_BACKBONE (area))
2460 vty_out (vty, " Number of full virtual adjacencies going through"
2461 " this area: %d%s", area->full_vls, VTY_NEWLINE);
2462
2463 /* Show SPF calculation times. */
2464 vty_out (vty, " SPF algorithm executed %d times%s",
2465 area->spf_calculation, VTY_NEWLINE);
2466
2467 /* Show number of LSA. */
2468 vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE);
hassofe71a972004-12-22 16:16:02 +00002469 vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
2470 ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA),
2471 ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE);
2472 vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
2473 ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA),
2474 ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE);
2475 vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
2476 ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA),
2477 ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE);
2478 vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
2479 ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA),
2480 ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE);
2481 vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
2482 ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA),
2483 ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE);
2484#ifdef HAVE_OPAQUE_LSA
2485 vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
2486 ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA),
2487 ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE);
2488 vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
2489 ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA),
2490 ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE);
2491#endif /* HAVE_OPAQUE_LSA */
paul718e3742002-12-13 20:15:29 +00002492 vty_out (vty, "%s", VTY_NEWLINE);
2493}
2494
2495DEFUN (show_ip_ospf,
2496 show_ip_ospf_cmd,
2497 "show ip ospf",
2498 SHOW_STR
2499 IP_STR
2500 "OSPF information\n")
2501{
paul1eb8ef22005-04-07 07:30:20 +00002502 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00002503 struct ospf_area * area;
paul020709f2003-04-04 02:44:16 +00002504 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002505
2506 /* Check OSPF is enable. */
paul020709f2003-04-04 02:44:16 +00002507 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002508 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002509 {
2510 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2511 return CMD_SUCCESS;
2512 }
2513
2514 /* Show Router ID. */
2515 vty_out (vty, " OSPF Routing Process, Router ID: %s%s",
paul68980082003-03-25 05:07:42 +00002516 inet_ntoa (ospf->router_id),
paul718e3742002-12-13 20:15:29 +00002517 VTY_NEWLINE);
2518
2519 /* Show capability. */
2520 vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE);
2521 vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE);
2522 vty_out (vty, " RFC1583Compatibility flag is %s%s",
paul68980082003-03-25 05:07:42 +00002523 CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?
paul718e3742002-12-13 20:15:29 +00002524 "enabled" : "disabled", VTY_NEWLINE);
2525#ifdef HAVE_OPAQUE_LSA
2526 vty_out (vty, " OpaqueCapability flag is %s%s%s",
paul68980082003-03-25 05:07:42 +00002527 CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ?
paul718e3742002-12-13 20:15:29 +00002528 "enabled" : "disabled",
paul68980082003-03-25 05:07:42 +00002529 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ?
paul718e3742002-12-13 20:15:29 +00002530 " (origination blocked)" : "",
2531 VTY_NEWLINE);
2532#endif /* HAVE_OPAQUE_LSA */
2533
2534 /* Show SPF timers. */
2535 vty_out (vty, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s",
paul68980082003-03-25 05:07:42 +00002536 ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002537
2538 /* Show refresh parameters. */
2539 vty_out (vty, " Refresh timer %d secs%s",
paul68980082003-03-25 05:07:42 +00002540 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002541
2542 /* Show ABR/ASBR flags. */
paul68980082003-03-25 05:07:42 +00002543 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR))
paul718e3742002-12-13 20:15:29 +00002544 vty_out (vty, " This router is an ABR, ABR type is: %s%s",
paul68980082003-03-25 05:07:42 +00002545 ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002546
paul68980082003-03-25 05:07:42 +00002547 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR))
paul718e3742002-12-13 20:15:29 +00002548 vty_out (vty, " This router is an ASBR "
2549 "(injecting external routing information)%s", VTY_NEWLINE);
2550
2551 /* Show Number of AS-external-LSAs. */
hassofe71a972004-12-22 16:16:02 +00002552 vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
2553 ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA),
2554 ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE);
2555#ifdef HAVE_OPAQUE_LSA
2556 vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
2557 ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA),
2558 ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE);
2559#endif /* HAVE_OPAQUE_LSA */
paul718e3742002-12-13 20:15:29 +00002560 /* Show number of areas attached. */
2561 vty_out (vty, " Number of areas attached to this router: %d%s%s",
paul68980082003-03-25 05:07:42 +00002562 listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002563
2564 /* Show each area status. */
paul1eb8ef22005-04-07 07:30:20 +00002565 for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area))
2566 show_ip_ospf_area (vty, area);
paul718e3742002-12-13 20:15:29 +00002567
2568 return CMD_SUCCESS;
2569}
2570
2571
ajsfd651fa2005-03-29 16:08:16 +00002572static void
paul68980082003-03-25 05:07:42 +00002573show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
2574 struct interface *ifp)
paul718e3742002-12-13 20:15:29 +00002575{
ajsfd651fa2005-03-29 16:08:16 +00002576 int is_up;
paul718e3742002-12-13 20:15:29 +00002577 struct ospf_neighbor *nbr;
paul718e3742002-12-13 20:15:29 +00002578 struct route_node *rn;
2579 char buf[9];
2580
paul718e3742002-12-13 20:15:29 +00002581 /* Is interface up? */
ajsfd651fa2005-03-29 16:08:16 +00002582 vty_out (vty, "%s is %s%s", ifp->name,
2583 ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE);
ajsd2fc8892005-04-02 18:38:43 +00002584 vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s",
2585 ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags),
2586 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002587
2588 /* Is interface OSPF enabled? */
ajsfd651fa2005-03-29 16:08:16 +00002589 if (ospf_oi_count(ifp) == 0)
paul718e3742002-12-13 20:15:29 +00002590 {
2591 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
2592 return;
2593 }
ajsfd651fa2005-03-29 16:08:16 +00002594 else if (!is_up)
2595 {
2596 vty_out (vty, " OSPF is enabled, but not running on this interface%s",
2597 VTY_NEWLINE);
2598 return;
2599 }
2600
paul718e3742002-12-13 20:15:29 +00002601 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
2602 {
2603 struct ospf_interface *oi = rn->info;
2604
2605 if (oi == NULL)
2606 continue;
2607
2608 /* Show OSPF interface information. */
2609 vty_out (vty, " Internet Address %s/%d,",
2610 inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
2611
hasso3fb9cd62004-10-19 19:44:43 +00002612 if (oi->connected->destination)
2613 vty_out (vty, " %s %s,",
2614 ((ifp->flags & IFF_POINTOPOINT) ? "Peer" : "Broadcast"),
2615 inet_ntoa (oi->connected->destination->u.prefix4));
2616
paul718e3742002-12-13 20:15:29 +00002617 vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
2618 VTY_NEWLINE);
2619
2620 vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s",
paul68980082003-03-25 05:07:42 +00002621 inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
paul718e3742002-12-13 20:15:29 +00002622 oi->output_cost, VTY_NEWLINE);
2623
2624 vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s",
2625 OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state),
2626 PRIORITY (oi), VTY_NEWLINE);
2627
2628 /* Show DR information. */
2629 if (DR (oi).s_addr == 0)
2630 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2631 else
2632 {
2633 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi));
2634 if (nbr == NULL)
2635 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2636 else
2637 {
2638 vty_out (vty, " Designated Router (ID) %s,",
2639 inet_ntoa (nbr->router_id));
2640 vty_out (vty, " Interface Address %s%s",
2641 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2642 }
2643 }
2644
2645 /* Show BDR information. */
2646 if (BDR (oi).s_addr == 0)
2647 vty_out (vty, " No backup designated router on this network%s",
2648 VTY_NEWLINE);
2649 else
2650 {
2651 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi));
2652 if (nbr == NULL)
2653 vty_out (vty, " No backup designated router on this network%s",
2654 VTY_NEWLINE);
2655 else
2656 {
2657 vty_out (vty, " Backup Designated Router (ID) %s,",
2658 inet_ntoa (nbr->router_id));
2659 vty_out (vty, " Interface Address %s%s",
2660 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2661 }
2662 }
ajsba6454e2005-02-08 15:37:30 +00002663
2664 vty_out (vty, " Multicast group memberships:");
2665 if (CHECK_FLAG(oi->multicast_memberships, MEMBER_ALLROUTERS))
2666 vty_out (vty, " OSPFAllRouters");
2667 if (CHECK_FLAG(oi->multicast_memberships, MEMBER_DROUTERS))
2668 vty_out (vty, " OSPFDesignatedRouters");
2669 if (!CHECK_FLAG(oi->multicast_memberships,
2670 MEMBER_ALLROUTERS|MEMBER_DROUTERS))
2671 vty_out (vty, " <None>");
2672 vty_out (vty, "%s", VTY_NEWLINE);
2673
paul718e3742002-12-13 20:15:29 +00002674 vty_out (vty, " Timer intervals configured,");
2675 vty_out (vty, " Hello %d, Dead %d, Wait %d, Retransmit %d%s",
2676 OSPF_IF_PARAM (oi, v_hello), OSPF_IF_PARAM (oi, v_wait),
2677 OSPF_IF_PARAM (oi, v_wait),
2678 OSPF_IF_PARAM (oi, retransmit_interval),
2679 VTY_NEWLINE);
2680
2681 if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE)
2682 vty_out (vty, " Hello due in %s%s",
2683 ospf_timer_dump (oi->t_hello, buf, 9), VTY_NEWLINE);
2684 else /* OSPF_IF_PASSIVE is set */
2685 vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
2686
2687 vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
paul68980082003-03-25 05:07:42 +00002688 ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full),
paul718e3742002-12-13 20:15:29 +00002689 VTY_NEWLINE);
2690 }
2691}
2692
2693DEFUN (show_ip_ospf_interface,
2694 show_ip_ospf_interface_cmd,
2695 "show ip ospf interface [INTERFACE]",
2696 SHOW_STR
2697 IP_STR
2698 "OSPF information\n"
2699 "Interface information\n"
2700 "Interface name\n")
2701{
2702 struct interface *ifp;
paul020709f2003-04-04 02:44:16 +00002703 struct ospf *ospf;
hasso52dc7ee2004-09-23 19:18:23 +00002704 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00002705
paul020709f2003-04-04 02:44:16 +00002706 ospf = ospf_lookup ();
2707
paul718e3742002-12-13 20:15:29 +00002708 /* Show All Interfaces. */
2709 if (argc == 0)
paul1eb8ef22005-04-07 07:30:20 +00002710 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
2711 show_ip_ospf_interface_sub (vty, ospf, ifp);
paul718e3742002-12-13 20:15:29 +00002712 /* Interface name is specified. */
2713 else
2714 {
2715 if ((ifp = if_lookup_by_name (argv[0])) == NULL)
2716 vty_out (vty, "No such interface name%s", VTY_NEWLINE);
2717 else
paul68980082003-03-25 05:07:42 +00002718 show_ip_ospf_interface_sub (vty, ospf, ifp);
paul718e3742002-12-13 20:15:29 +00002719 }
2720
2721 return CMD_SUCCESS;
2722}
2723
paul4dadc292005-05-06 21:37:42 +00002724static void
paul718e3742002-12-13 20:15:29 +00002725show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi)
2726{
2727 struct route_node *rn;
2728 struct ospf_neighbor *nbr;
2729 char msgbuf[16];
2730 char timebuf[9];
2731
2732 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
2733 if ((nbr = rn->info))
2734 /* Do not show myself. */
2735 if (nbr != oi->nbr_self)
2736 /* Down state is not shown. */
2737 if (nbr->state != NSM_Down)
2738 {
2739 ospf_nbr_state_message (nbr, msgbuf, 16);
2740
2741 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
2742 vty_out (vty, "%-15s %3d %-15s %8s ",
2743 "-", nbr->priority,
2744 msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9));
2745 else
2746 vty_out (vty, "%-15s %3d %-15s %8s ",
2747 inet_ntoa (nbr->router_id), nbr->priority,
2748 msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9));
2749 vty_out (vty, "%-15s ", inet_ntoa (nbr->src));
2750 vty_out (vty, "%-15s %5ld %5ld %5d%s",
2751 IF_NAME (oi), ospf_ls_retransmit_count (nbr),
2752 ospf_ls_request_count (nbr), ospf_db_summary_count (nbr),
2753 VTY_NEWLINE);
2754 }
2755}
2756
2757DEFUN (show_ip_ospf_neighbor,
2758 show_ip_ospf_neighbor_cmd,
2759 "show ip ospf neighbor",
2760 SHOW_STR
2761 IP_STR
2762 "OSPF information\n"
2763 "Neighbor list\n")
2764{
paul020709f2003-04-04 02:44:16 +00002765 struct ospf *ospf;
paul1eb8ef22005-04-07 07:30:20 +00002766 struct ospf_interface *oi;
hasso52dc7ee2004-09-23 19:18:23 +00002767 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00002768
paul020709f2003-04-04 02:44:16 +00002769 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002770 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002771 {
2772 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2773 return CMD_SUCCESS;
2774 }
2775
2776 /* Show All neighbors. */
2777 vty_out (vty, "%sNeighbor ID Pri State Dead "
2778 "Time Address Interface RXmtL "
2779 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2780
paul1eb8ef22005-04-07 07:30:20 +00002781 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
2782 show_ip_ospf_neighbor_sub (vty, oi);
paul718e3742002-12-13 20:15:29 +00002783
2784 return CMD_SUCCESS;
2785}
2786
2787DEFUN (show_ip_ospf_neighbor_all,
2788 show_ip_ospf_neighbor_all_cmd,
2789 "show ip ospf neighbor all",
2790 SHOW_STR
2791 IP_STR
2792 "OSPF information\n"
2793 "Neighbor list\n"
2794 "include down status neighbor\n")
2795{
paul68980082003-03-25 05:07:42 +00002796 struct ospf *ospf = vty->index;
hasso52dc7ee2004-09-23 19:18:23 +00002797 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00002798 struct ospf_interface *oi;
paul718e3742002-12-13 20:15:29 +00002799
paul68980082003-03-25 05:07:42 +00002800 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002801 {
2802 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2803 return CMD_SUCCESS;
2804 }
2805
2806 /* Show All neighbors. */
2807 vty_out (vty, "%sNeighbor ID Pri State Dead "
2808 "Time Address Interface RXmtL "
2809 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2810
paul1eb8ef22005-04-07 07:30:20 +00002811 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
paul718e3742002-12-13 20:15:29 +00002812 {
hasso52dc7ee2004-09-23 19:18:23 +00002813 struct listnode *nbr_node;
paul1eb8ef22005-04-07 07:30:20 +00002814 struct ospf_nbr_nbma *nbr_nbma;
paul718e3742002-12-13 20:15:29 +00002815
2816 show_ip_ospf_neighbor_sub (vty, oi);
2817
2818 /* print Down neighbor status */
paul1eb8ef22005-04-07 07:30:20 +00002819 for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma))
paul718e3742002-12-13 20:15:29 +00002820 {
paul718e3742002-12-13 20:15:29 +00002821 if (nbr_nbma->nbr == NULL
2822 || nbr_nbma->nbr->state == NSM_Down)
2823 {
2824 vty_out (vty, "%-15s %3d %-15s %8s ",
2825 "-", nbr_nbma->priority, "Down", "-");
2826 vty_out (vty, "%-15s %-15s %5d %5d %5d%s",
2827 inet_ntoa (nbr_nbma->addr), IF_NAME (oi),
2828 0, 0, 0, VTY_NEWLINE);
2829 }
2830 }
2831 }
2832
2833 return CMD_SUCCESS;
2834}
2835
2836DEFUN (show_ip_ospf_neighbor_int,
2837 show_ip_ospf_neighbor_int_cmd,
2838 "show ip ospf neighbor A.B.C.D",
2839 SHOW_STR
2840 IP_STR
2841 "OSPF information\n"
2842 "Neighbor list\n"
2843 "Interface name\n")
2844{
paul020709f2003-04-04 02:44:16 +00002845 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00002846 struct ospf_interface *oi;
2847 struct in_addr addr;
2848 int ret;
2849
paul718e3742002-12-13 20:15:29 +00002850 ret = inet_aton (argv[0], &addr);
2851 if (!ret)
2852 {
2853 vty_out (vty, "Please specify interface address by A.B.C.D%s",
2854 VTY_NEWLINE);
2855 return CMD_WARNING;
2856 }
2857
paul020709f2003-04-04 02:44:16 +00002858 ospf = ospf_lookup ();
2859 if (ospf == NULL)
2860 {
2861 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2862 return CMD_SUCCESS;
2863 }
2864
paul68980082003-03-25 05:07:42 +00002865 if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL)
paul718e3742002-12-13 20:15:29 +00002866 vty_out (vty, "No such interface address%s", VTY_NEWLINE);
2867 else
2868 {
2869 vty_out (vty, "%sNeighbor ID Pri State Dead "
2870 "Time Address Interface RXmtL "
2871 "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE);
2872 show_ip_ospf_neighbor_sub (vty, oi);
2873 }
2874
2875 return CMD_SUCCESS;
2876}
2877
paul4dadc292005-05-06 21:37:42 +00002878static void
paul718e3742002-12-13 20:15:29 +00002879show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi,
2880 struct ospf_nbr_nbma *nbr_nbma)
2881{
2882 char timebuf[9];
2883
2884 /* Show neighbor ID. */
2885 vty_out (vty, " Neighbor %s,", "-");
2886
2887 /* Show interface address. */
2888 vty_out (vty, " interface address %s%s",
2889 inet_ntoa (nbr_nbma->addr), VTY_NEWLINE);
2890 /* Show Area ID. */
2891 vty_out (vty, " In the area %s via interface %s%s",
2892 ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE);
2893 /* Show neighbor priority and state. */
2894 vty_out (vty, " Neighbor priority is %d, State is %s,",
2895 nbr_nbma->priority, "Down");
2896 /* Show state changes. */
2897 vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE);
2898
2899 /* Show PollInterval */
2900 vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE);
2901
2902 /* Show poll-interval timer. */
2903 vty_out (vty, " Poll timer due in %s%s",
2904 ospf_timer_dump (nbr_nbma->t_poll, timebuf, 9), VTY_NEWLINE);
2905
2906 /* Show poll-interval timer thread. */
2907 vty_out (vty, " Thread Poll Timer %s%s",
2908 nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE);
2909}
2910
paul4dadc292005-05-06 21:37:42 +00002911static void
paul718e3742002-12-13 20:15:29 +00002912show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
2913 struct ospf_neighbor *nbr)
2914{
2915 char timebuf[9];
2916
2917 /* Show neighbor ID. */
2918 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
2919 vty_out (vty, " Neighbor %s,", "-");
2920 else
2921 vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id));
2922
2923 /* Show interface address. */
2924 vty_out (vty, " interface address %s%s",
2925 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2926 /* Show Area ID. */
2927 vty_out (vty, " In the area %s via interface %s%s",
2928 ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE);
2929 /* Show neighbor priority and state. */
2930 vty_out (vty, " Neighbor priority is %d, State is %s,",
2931 nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state));
2932 /* Show state changes. */
2933 vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
2934
2935 /* Show Designated Rotuer ID. */
2936 vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router));
2937 /* Show Backup Designated Rotuer ID. */
2938 vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE);
2939 /* Show options. */
2940 vty_out (vty, " Options %d %s%s", nbr->options,
2941 ospf_options_dump (nbr->options), VTY_NEWLINE);
2942 /* Show Router Dead interval timer. */
2943 vty_out (vty, " Dead timer due in %s%s",
2944 ospf_timer_dump (nbr->t_inactivity, timebuf, 9), VTY_NEWLINE);
2945 /* Show Database Summary list. */
2946 vty_out (vty, " Database Summary List %d%s",
2947 ospf_db_summary_count (nbr), VTY_NEWLINE);
2948 /* Show Link State Request list. */
2949 vty_out (vty, " Link State Request List %ld%s",
2950 ospf_ls_request_count (nbr), VTY_NEWLINE);
2951 /* Show Link State Retransmission list. */
2952 vty_out (vty, " Link State Retransmission List %ld%s",
2953 ospf_ls_retransmit_count (nbr), VTY_NEWLINE);
2954 /* Show inactivity timer thread. */
2955 vty_out (vty, " Thread Inactivity Timer %s%s",
2956 nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE);
2957 /* Show Database Description retransmission thread. */
2958 vty_out (vty, " Thread Database Description Retransmision %s%s",
2959 nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE);
2960 /* Show Link State Request Retransmission thread. */
2961 vty_out (vty, " Thread Link State Request Retransmission %s%s",
2962 nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE);
2963 /* Show Link State Update Retransmission thread. */
2964 vty_out (vty, " Thread Link State Update Retransmission %s%s%s",
2965 nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE);
2966}
2967
2968DEFUN (show_ip_ospf_neighbor_id,
2969 show_ip_ospf_neighbor_id_cmd,
2970 "show ip ospf neighbor A.B.C.D",
2971 SHOW_STR
2972 IP_STR
2973 "OSPF information\n"
2974 "Neighbor list\n"
2975 "Neighbor ID\n")
2976{
paul020709f2003-04-04 02:44:16 +00002977 struct ospf *ospf;
hasso52dc7ee2004-09-23 19:18:23 +00002978 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00002979 struct ospf_neighbor *nbr;
paul1eb8ef22005-04-07 07:30:20 +00002980 struct ospf_interface *oi;
paul718e3742002-12-13 20:15:29 +00002981 struct in_addr router_id;
2982 int ret;
2983
2984 ret = inet_aton (argv[0], &router_id);
2985 if (!ret)
2986 {
2987 vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE);
2988 return CMD_WARNING;
2989 }
2990
paul020709f2003-04-04 02:44:16 +00002991 ospf = ospf_lookup ();
2992 if (ospf == NULL)
2993 {
2994 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2995 return CMD_SUCCESS;
2996 }
2997
paul1eb8ef22005-04-07 07:30:20 +00002998 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
2999 if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id)))
3000 {
3001 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
3002 return CMD_SUCCESS;
3003 }
paul718e3742002-12-13 20:15:29 +00003004
3005 /* Nothing to show. */
3006 return CMD_SUCCESS;
3007}
3008
3009DEFUN (show_ip_ospf_neighbor_detail,
3010 show_ip_ospf_neighbor_detail_cmd,
3011 "show ip ospf neighbor detail",
3012 SHOW_STR
3013 IP_STR
3014 "OSPF information\n"
3015 "Neighbor list\n"
3016 "detail of all neighbors\n")
3017{
paul020709f2003-04-04 02:44:16 +00003018 struct ospf *ospf;
paul1eb8ef22005-04-07 07:30:20 +00003019 struct ospf_interface *oi;
hasso52dc7ee2004-09-23 19:18:23 +00003020 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003021
paul020709f2003-04-04 02:44:16 +00003022 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003023 if (ospf == NULL)
paul020709f2003-04-04 02:44:16 +00003024 {
3025 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3026 return CMD_SUCCESS;
3027 }
paul718e3742002-12-13 20:15:29 +00003028
paul1eb8ef22005-04-07 07:30:20 +00003029 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
paul718e3742002-12-13 20:15:29 +00003030 {
paul718e3742002-12-13 20:15:29 +00003031 struct route_node *rn;
3032 struct ospf_neighbor *nbr;
3033
3034 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3035 if ((nbr = rn->info))
3036 if (nbr != oi->nbr_self)
3037 if (nbr->state != NSM_Down)
3038 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
3039 }
3040
3041 return CMD_SUCCESS;
3042}
3043
3044DEFUN (show_ip_ospf_neighbor_detail_all,
3045 show_ip_ospf_neighbor_detail_all_cmd,
3046 "show ip ospf neighbor detail all",
3047 SHOW_STR
3048 IP_STR
3049 "OSPF information\n"
3050 "Neighbor list\n"
3051 "detail of all neighbors\n"
3052 "include down status neighbor\n")
3053{
paul020709f2003-04-04 02:44:16 +00003054 struct ospf *ospf;
hasso52dc7ee2004-09-23 19:18:23 +00003055 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003056 struct ospf_interface *oi;
paul718e3742002-12-13 20:15:29 +00003057
paul020709f2003-04-04 02:44:16 +00003058 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003059 if (ospf == NULL)
paul020709f2003-04-04 02:44:16 +00003060 {
3061 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3062 return CMD_SUCCESS;
3063 }
paul718e3742002-12-13 20:15:29 +00003064
paul1eb8ef22005-04-07 07:30:20 +00003065 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
paul718e3742002-12-13 20:15:29 +00003066 {
paul718e3742002-12-13 20:15:29 +00003067 struct route_node *rn;
3068 struct ospf_neighbor *nbr;
paul1eb8ef22005-04-07 07:30:20 +00003069 struct ospf_nbr_nbma *nbr_nbma;
paul718e3742002-12-13 20:15:29 +00003070
3071 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3072 if ((nbr = rn->info))
3073 if (nbr != oi->nbr_self)
3074 if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down)
3075 show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info);
3076
3077 if (oi->type == OSPF_IFTYPE_NBMA)
3078 {
hasso52dc7ee2004-09-23 19:18:23 +00003079 struct listnode *nd;
paul718e3742002-12-13 20:15:29 +00003080
paul1eb8ef22005-04-07 07:30:20 +00003081 for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma))
3082 if (nbr_nbma->nbr == NULL
3083 || nbr_nbma->nbr->state == NSM_Down)
3084 show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma);
paul718e3742002-12-13 20:15:29 +00003085 }
3086 }
3087
3088 return CMD_SUCCESS;
3089}
3090
3091DEFUN (show_ip_ospf_neighbor_int_detail,
3092 show_ip_ospf_neighbor_int_detail_cmd,
3093 "show ip ospf neighbor A.B.C.D detail",
3094 SHOW_STR
3095 IP_STR
3096 "OSPF information\n"
3097 "Neighbor list\n"
3098 "Interface address\n"
3099 "detail of all neighbors")
3100{
paul020709f2003-04-04 02:44:16 +00003101 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003102 struct ospf_interface *oi;
3103 struct in_addr addr;
3104 int ret;
3105
3106 ret = inet_aton (argv[0], &addr);
3107 if (!ret)
3108 {
3109 vty_out (vty, "Please specify interface address by A.B.C.D%s",
3110 VTY_NEWLINE);
3111 return CMD_WARNING;
3112 }
3113
paul020709f2003-04-04 02:44:16 +00003114 ospf = ospf_lookup ();
3115 if (ospf == NULL)
3116 {
3117 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3118 return CMD_SUCCESS;
3119 }
paul68980082003-03-25 05:07:42 +00003120
paul020709f2003-04-04 02:44:16 +00003121 if ((oi = ospf_if_is_configured (ospf, &addr)) == NULL)
paul718e3742002-12-13 20:15:29 +00003122 vty_out (vty, "No such interface address%s", VTY_NEWLINE);
3123 else
3124 {
3125 struct route_node *rn;
3126 struct ospf_neighbor *nbr;
3127
3128 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3129 if ((nbr = rn->info))
3130 if (nbr != oi->nbr_self)
3131 if (nbr->state != NSM_Down)
3132 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
3133 }
3134
3135 return CMD_SUCCESS;
3136}
3137
3138
3139/* Show functions */
paul4dadc292005-05-06 21:37:42 +00003140static int
paul020709f2003-04-04 02:44:16 +00003141show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)
paul718e3742002-12-13 20:15:29 +00003142{
paul718e3742002-12-13 20:15:29 +00003143 struct router_lsa *rl;
3144 struct summary_lsa *sl;
3145 struct as_external_lsa *asel;
3146 struct prefix_ipv4 p;
3147
3148 if (lsa != NULL)
3149 /* If self option is set, check LSA self flag. */
3150 if (self == 0 || IS_LSA_SELF (lsa))
3151 {
3152 /* LSA common part show. */
3153 vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id));
3154 vty_out (vty, "%-15s %4d 0x%08lx 0x%04x",
3155 inet_ntoa (lsa->data->adv_router), LS_AGE (lsa),
3156 (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum));
3157 /* LSA specific part show. */
3158 switch (lsa->data->type)
3159 {
3160 case OSPF_ROUTER_LSA:
3161 rl = (struct router_lsa *) lsa->data;
3162 vty_out (vty, " %-d", ntohs (rl->links));
3163 break;
3164 case OSPF_SUMMARY_LSA:
3165 sl = (struct summary_lsa *) lsa->data;
3166
3167 p.family = AF_INET;
3168 p.prefix = sl->header.id;
3169 p.prefixlen = ip_masklen (sl->mask);
3170 apply_mask_ipv4 (&p);
3171
3172 vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen);
3173 break;
3174 case OSPF_AS_EXTERNAL_LSA:
paul551a8972003-05-18 15:22:55 +00003175 case OSPF_AS_NSSA_LSA:
paul718e3742002-12-13 20:15:29 +00003176 asel = (struct as_external_lsa *) lsa->data;
3177
3178 p.family = AF_INET;
3179 p.prefix = asel->header.id;
3180 p.prefixlen = ip_masklen (asel->mask);
3181 apply_mask_ipv4 (&p);
3182
3183 vty_out (vty, " %s %s/%d [0x%lx]",
3184 IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1",
3185 inet_ntoa (p.prefix), p.prefixlen,
3186 (u_long)ntohl (asel->e[0].route_tag));
3187 break;
3188 case OSPF_NETWORK_LSA:
3189 case OSPF_ASBR_SUMMARY_LSA:
3190#ifdef HAVE_OPAQUE_LSA
3191 case OSPF_OPAQUE_LINK_LSA:
3192 case OSPF_OPAQUE_AREA_LSA:
3193 case OSPF_OPAQUE_AS_LSA:
3194#endif /* HAVE_OPAQUE_LSA */
3195 default:
3196 break;
3197 }
3198 vty_out (vty, VTY_NEWLINE);
3199 }
3200
3201 return 0;
3202}
3203
hassoeb1ce602004-10-08 08:17:22 +00003204const char *show_database_desc[] =
paul718e3742002-12-13 20:15:29 +00003205{
3206 "unknown",
3207 "Router Link States",
3208 "Net Link States",
3209 "Summary Link States",
3210 "ASBR-Summary Link States",
3211 "AS External Link States",
paul718e3742002-12-13 20:15:29 +00003212 "Group Membership LSA",
3213 "NSSA-external Link States",
paul718e3742002-12-13 20:15:29 +00003214#ifdef HAVE_OPAQUE_LSA
3215 "Type-8 LSA",
3216 "Link-Local Opaque-LSA",
3217 "Area-Local Opaque-LSA",
3218 "AS-external Opaque-LSA",
3219#endif /* HAVE_OPAQUE_LSA */
3220};
3221
3222#define SHOW_OSPF_COMMON_HEADER \
3223 "Link ID ADV Router Age Seq# CkSum"
3224
hassoeb1ce602004-10-08 08:17:22 +00003225const char *show_database_header[] =
paul718e3742002-12-13 20:15:29 +00003226{
3227 "",
3228 "Link ID ADV Router Age Seq# CkSum Link count",
3229 "Link ID ADV Router Age Seq# CkSum",
3230 "Link ID ADV Router Age Seq# CkSum Route",
3231 "Link ID ADV Router Age Seq# CkSum",
3232 "Link ID ADV Router Age Seq# CkSum Route",
paul718e3742002-12-13 20:15:29 +00003233 " --- header for Group Member ----",
3234 "Link ID ADV Router Age Seq# CkSum Route",
paul718e3742002-12-13 20:15:29 +00003235#ifdef HAVE_OPAQUE_LSA
paul718e3742002-12-13 20:15:29 +00003236 " --- type-8 ---",
3237 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3238 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3239 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3240#endif /* HAVE_OPAQUE_LSA */
3241};
3242
hassoeb1ce602004-10-08 08:17:22 +00003243const char *show_lsa_flags[] =
paul4957f492003-06-27 01:28:45 +00003244{
3245 "Self-originated",
3246 "Checked",
3247 "Received",
3248 "Approved",
3249 "Discard",
paul4957f492003-06-27 01:28:45 +00003250 "Translated",
paul4957f492003-06-27 01:28:45 +00003251};
3252
paul4dadc292005-05-06 21:37:42 +00003253static void
paul718e3742002-12-13 20:15:29 +00003254show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa)
3255{
3256 struct router_lsa *rlsa = (struct router_lsa*) lsa->data;
paul4957f492003-06-27 01:28:45 +00003257
paul718e3742002-12-13 20:15:29 +00003258 vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE);
paul4957f492003-06-27 01:28:45 +00003259 vty_out (vty, " Options: 0x%-2x : %s%s",
3260 lsa->data->options,
3261 ospf_options_dump(lsa->data->options),
3262 VTY_NEWLINE);
3263 vty_out (vty, " LS Flags: 0x%-2x %s%s",
paul9d526032003-06-30 22:46:14 +00003264 lsa->flags,
paul4957f492003-06-27 01:28:45 +00003265 ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""),
3266 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003267
3268 if (lsa->data->type == OSPF_ROUTER_LSA)
3269 {
3270 vty_out (vty, " Flags: 0x%x" , rlsa->flags);
3271
3272 if (rlsa->flags)
3273 vty_out (vty, " :%s%s%s%s",
3274 IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "",
3275 IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "",
3276 IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "",
3277 IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : "");
3278
3279 vty_out (vty, "%s", VTY_NEWLINE);
3280 }
3281 vty_out (vty, " LS Type: %s%s",
3282 LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE);
3283 vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id),
3284 LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE);
3285 vty_out (vty, " Advertising Router: %s%s",
3286 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3287 vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum),
3288 VTY_NEWLINE);
3289 vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum),
3290 VTY_NEWLINE);
3291 vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE);
3292}
3293
hassoeb1ce602004-10-08 08:17:22 +00003294const char *link_type_desc[] =
paul718e3742002-12-13 20:15:29 +00003295{
3296 "(null)",
3297 "another Router (point-to-point)",
3298 "a Transit Network",
3299 "Stub Network",
3300 "a Virtual Link",
3301};
3302
hassoeb1ce602004-10-08 08:17:22 +00003303const char *link_id_desc[] =
paul718e3742002-12-13 20:15:29 +00003304{
3305 "(null)",
3306 "Neighboring Router ID",
3307 "Designated Router address",
paul68980082003-03-25 05:07:42 +00003308 "Net",
paul718e3742002-12-13 20:15:29 +00003309 "Neighboring Router ID",
3310};
3311
hassoeb1ce602004-10-08 08:17:22 +00003312const char *link_data_desc[] =
paul718e3742002-12-13 20:15:29 +00003313{
3314 "(null)",
3315 "Router Interface address",
3316 "Router Interface address",
3317 "Network Mask",
3318 "Router Interface address",
3319};
3320
3321/* Show router-LSA each Link information. */
paul4dadc292005-05-06 21:37:42 +00003322static void
paul718e3742002-12-13 20:15:29 +00003323show_ip_ospf_database_router_links (struct vty *vty,
3324 struct router_lsa *rl)
3325{
3326 int len, i, type;
3327
3328 len = ntohs (rl->header.length) - 4;
3329 for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++)
3330 {
3331 type = rl->link[i].type;
3332
3333 vty_out (vty, " Link connected to: %s%s",
3334 link_type_desc[type], VTY_NEWLINE);
3335 vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type],
3336 inet_ntoa (rl->link[i].link_id), VTY_NEWLINE);
3337 vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type],
3338 inet_ntoa (rl->link[i].link_data), VTY_NEWLINE);
3339 vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE);
3340 vty_out (vty, " TOS 0 Metric: %d%s",
3341 ntohs (rl->link[i].metric), VTY_NEWLINE);
3342 vty_out (vty, "%s", VTY_NEWLINE);
3343 }
3344}
3345
3346/* Show router-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003347static int
paul718e3742002-12-13 20:15:29 +00003348show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3349{
3350 if (lsa != NULL)
3351 {
3352 struct router_lsa *rl = (struct router_lsa *) lsa->data;
3353
3354 show_ip_ospf_database_header (vty, lsa);
3355
3356 vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links),
3357 VTY_NEWLINE, VTY_NEWLINE);
3358
3359 show_ip_ospf_database_router_links (vty, rl);
paulb0a053b2003-06-22 09:04:47 +00003360 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003361 }
3362
3363 return 0;
3364}
3365
3366/* Show network-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003367static int
paul718e3742002-12-13 20:15:29 +00003368show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3369{
3370 int length, i;
3371
3372 if (lsa != NULL)
3373 {
3374 struct network_lsa *nl = (struct network_lsa *) lsa->data;
3375
3376 show_ip_ospf_database_header (vty, lsa);
3377
3378 vty_out (vty, " Network Mask: /%d%s",
3379 ip_masklen (nl->mask), VTY_NEWLINE);
3380
3381 length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4;
3382
3383 for (i = 0; length > 0; i++, length -= 4)
3384 vty_out (vty, " Attached Router: %s%s",
3385 inet_ntoa (nl->routers[i]), VTY_NEWLINE);
3386
3387 vty_out (vty, "%s", VTY_NEWLINE);
3388 }
3389
3390 return 0;
3391}
3392
3393/* Show summary-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003394static int
paul718e3742002-12-13 20:15:29 +00003395show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3396{
3397 if (lsa != NULL)
3398 {
3399 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3400
3401 show_ip_ospf_database_header (vty, lsa);
3402
3403 vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask),
3404 VTY_NEWLINE);
3405 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3406 VTY_NEWLINE);
paulb0a053b2003-06-22 09:04:47 +00003407 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003408 }
3409
3410 return 0;
3411}
3412
3413/* Show summary-ASBR-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003414static int
paul718e3742002-12-13 20:15:29 +00003415show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3416{
3417 if (lsa != NULL)
3418 {
3419 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3420
3421 show_ip_ospf_database_header (vty, lsa);
3422
3423 vty_out (vty, " Network Mask: /%d%s",
3424 ip_masklen (sl->mask), VTY_NEWLINE);
3425 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3426 VTY_NEWLINE);
paulb0a053b2003-06-22 09:04:47 +00003427 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003428 }
3429
3430 return 0;
3431}
3432
3433/* Show AS-external-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003434static int
paul718e3742002-12-13 20:15:29 +00003435show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3436{
3437 if (lsa != NULL)
3438 {
3439 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3440
3441 show_ip_ospf_database_header (vty, lsa);
3442
3443 vty_out (vty, " Network Mask: /%d%s",
3444 ip_masklen (al->mask), VTY_NEWLINE);
3445 vty_out (vty, " Metric Type: %s%s",
3446 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3447 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3448 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3449 vty_out (vty, " Metric: %d%s",
3450 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3451 vty_out (vty, " Forward Address: %s%s",
3452 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3453
3454 vty_out (vty, " External Route Tag: %lu%s%s",
3455 (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3456 }
3457
3458 return 0;
3459}
3460
ajs2a42e282004-12-08 18:43:03 +00003461/* N.B. This function currently seems to be unused. */
paul4dadc292005-05-06 21:37:42 +00003462static int
paul718e3742002-12-13 20:15:29 +00003463show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
3464{
3465 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3466
3467 /* show_ip_ospf_database_header (vty, lsa); */
3468
ajs2a42e282004-12-08 18:43:03 +00003469 zlog_debug( " Network Mask: /%d%s",
paul718e3742002-12-13 20:15:29 +00003470 ip_masklen (al->mask), "\n");
ajs2a42e282004-12-08 18:43:03 +00003471 zlog_debug( " Metric Type: %s%s",
paul718e3742002-12-13 20:15:29 +00003472 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3473 "2 (Larger than any link state path)" : "1", "\n");
ajs2a42e282004-12-08 18:43:03 +00003474 zlog_debug( " TOS: 0%s", "\n");
3475 zlog_debug( " Metric: %d%s",
paul718e3742002-12-13 20:15:29 +00003476 GET_METRIC (al->e[0].metric), "\n");
ajs2a42e282004-12-08 18:43:03 +00003477 zlog_debug( " Forward Address: %s%s",
paul718e3742002-12-13 20:15:29 +00003478 inet_ntoa (al->e[0].fwd_addr), "\n");
3479
ajs2a42e282004-12-08 18:43:03 +00003480 zlog_debug( " External Route Tag: %u%s%s",
paul718e3742002-12-13 20:15:29 +00003481 ntohl (al->e[0].route_tag), "\n", "\n");
3482
3483 return 0;
3484}
3485
3486/* Show AS-NSSA-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003487static int
paul718e3742002-12-13 20:15:29 +00003488show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3489{
3490 if (lsa != NULL)
3491 {
3492 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3493
3494 show_ip_ospf_database_header (vty, lsa);
3495
3496 vty_out (vty, " Network Mask: /%d%s",
3497 ip_masklen (al->mask), VTY_NEWLINE);
3498 vty_out (vty, " Metric Type: %s%s",
3499 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3500 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3501 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3502 vty_out (vty, " Metric: %d%s",
3503 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3504 vty_out (vty, " NSSA: Forward Address: %s%s",
3505 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3506
3507 vty_out (vty, " External Route Tag: %u%s%s",
3508 ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3509 }
3510
3511 return 0;
3512}
3513
paul4dadc292005-05-06 21:37:42 +00003514static int
paul718e3742002-12-13 20:15:29 +00003515show_func_dummy (struct vty *vty, struct ospf_lsa *lsa)
3516{
3517 return 0;
3518}
3519
3520#ifdef HAVE_OPAQUE_LSA
paul4dadc292005-05-06 21:37:42 +00003521static int
paul718e3742002-12-13 20:15:29 +00003522show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3523{
3524 if (lsa != NULL)
3525 {
3526 show_ip_ospf_database_header (vty, lsa);
3527 show_opaque_info_detail (vty, lsa);
3528
3529 vty_out (vty, "%s", VTY_NEWLINE);
3530 }
3531 return 0;
3532}
3533#endif /* HAVE_OPAQUE_LSA */
3534
3535int (*show_function[])(struct vty *, struct ospf_lsa *) =
3536{
3537 NULL,
3538 show_router_lsa_detail,
3539 show_network_lsa_detail,
3540 show_summary_lsa_detail,
3541 show_summary_asbr_lsa_detail,
3542 show_as_external_lsa_detail,
paul718e3742002-12-13 20:15:29 +00003543 show_func_dummy,
3544 show_as_nssa_lsa_detail, /* almost same as external */
paul718e3742002-12-13 20:15:29 +00003545#ifdef HAVE_OPAQUE_LSA
paul718e3742002-12-13 20:15:29 +00003546 NULL, /* type-8 */
3547 show_opaque_lsa_detail,
3548 show_opaque_lsa_detail,
3549 show_opaque_lsa_detail,
3550#endif /* HAVE_OPAQUE_LSA */
3551};
3552
paul4dadc292005-05-06 21:37:42 +00003553static void
paul718e3742002-12-13 20:15:29 +00003554show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id,
3555 struct in_addr *adv_router)
3556{
3557 memset (lp, 0, sizeof (struct prefix_ls));
3558 lp->family = 0;
3559 if (id == NULL)
3560 lp->prefixlen = 0;
3561 else if (adv_router == NULL)
3562 {
3563 lp->prefixlen = 32;
3564 lp->id = *id;
3565 }
3566 else
3567 {
3568 lp->prefixlen = 64;
3569 lp->id = *id;
3570 lp->adv_router = *adv_router;
3571 }
3572}
3573
paul4dadc292005-05-06 21:37:42 +00003574static void
paul718e3742002-12-13 20:15:29 +00003575show_lsa_detail_proc (struct vty *vty, struct route_table *rt,
3576 struct in_addr *id, struct in_addr *adv_router)
3577{
3578 struct prefix_ls lp;
3579 struct route_node *rn, *start;
3580 struct ospf_lsa *lsa;
3581
3582 show_lsa_prefix_set (vty, &lp, id, adv_router);
3583 start = route_node_get (rt, (struct prefix *) &lp);
3584 if (start)
3585 {
3586 route_lock_node (start);
3587 for (rn = start; rn; rn = route_next_until (rn, start))
3588 if ((lsa = rn->info))
3589 {
paul718e3742002-12-13 20:15:29 +00003590 if (show_function[lsa->data->type] != NULL)
3591 show_function[lsa->data->type] (vty, lsa);
3592 }
3593 route_unlock_node (start);
3594 }
3595}
3596
3597/* Show detail LSA information
3598 -- if id is NULL then show all LSAs. */
paul4dadc292005-05-06 21:37:42 +00003599static void
paul020709f2003-04-04 02:44:16 +00003600show_lsa_detail (struct vty *vty, struct ospf *ospf, int type,
paul718e3742002-12-13 20:15:29 +00003601 struct in_addr *id, struct in_addr *adv_router)
3602{
hasso52dc7ee2004-09-23 19:18:23 +00003603 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003604 struct ospf_area *area;
3605
paul718e3742002-12-13 20:15:29 +00003606 switch (type)
3607 {
3608 case OSPF_AS_EXTERNAL_LSA:
3609#ifdef HAVE_OPAQUE_LSA
3610 case OSPF_OPAQUE_AS_LSA:
3611#endif /* HAVE_OPAQUE_LSA */
3612 vty_out (vty, " %s %s%s",
3613 show_database_desc[type],
3614 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003615 show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router);
paul718e3742002-12-13 20:15:29 +00003616 break;
3617 default:
paul1eb8ef22005-04-07 07:30:20 +00003618 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00003619 {
paul718e3742002-12-13 20:15:29 +00003620 vty_out (vty, "%s %s (Area %s)%s%s",
3621 VTY_NEWLINE, show_database_desc[type],
3622 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3623 show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router);
3624 }
3625 break;
3626 }
3627}
3628
paul4dadc292005-05-06 21:37:42 +00003629static void
paul718e3742002-12-13 20:15:29 +00003630show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt,
3631 struct in_addr *adv_router)
3632{
3633 struct route_node *rn;
3634 struct ospf_lsa *lsa;
3635
3636 for (rn = route_top (rt); rn; rn = route_next (rn))
3637 if ((lsa = rn->info))
3638 if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router))
3639 {
paul718e3742002-12-13 20:15:29 +00003640 if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
3641 continue;
paul718e3742002-12-13 20:15:29 +00003642 if (show_function[lsa->data->type] != NULL)
3643 show_function[lsa->data->type] (vty, lsa);
3644 }
3645}
3646
3647/* Show detail LSA information. */
paul4dadc292005-05-06 21:37:42 +00003648static void
paul020709f2003-04-04 02:44:16 +00003649show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type,
paul718e3742002-12-13 20:15:29 +00003650 struct in_addr *adv_router)
3651{
hasso52dc7ee2004-09-23 19:18:23 +00003652 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003653 struct ospf_area *area;
paul718e3742002-12-13 20:15:29 +00003654
3655 switch (type)
3656 {
3657 case OSPF_AS_EXTERNAL_LSA:
3658#ifdef HAVE_OPAQUE_LSA
3659 case OSPF_OPAQUE_AS_LSA:
3660#endif /* HAVE_OPAQUE_LSA */
3661 vty_out (vty, " %s %s%s",
3662 show_database_desc[type],
3663 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003664 show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type),
paul718e3742002-12-13 20:15:29 +00003665 adv_router);
3666 break;
3667 default:
paul1eb8ef22005-04-07 07:30:20 +00003668 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00003669 {
paul718e3742002-12-13 20:15:29 +00003670 vty_out (vty, "%s %s (Area %s)%s%s",
3671 VTY_NEWLINE, show_database_desc[type],
3672 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3673 show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type),
3674 adv_router);
3675 }
3676 break;
3677 }
3678}
3679
paul4dadc292005-05-06 21:37:42 +00003680static void
paul020709f2003-04-04 02:44:16 +00003681show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self)
paul718e3742002-12-13 20:15:29 +00003682{
paul020709f2003-04-04 02:44:16 +00003683 struct ospf_lsa *lsa;
3684 struct route_node *rn;
paul1eb8ef22005-04-07 07:30:20 +00003685 struct ospf_area *area;
hasso52dc7ee2004-09-23 19:18:23 +00003686 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003687 int type;
3688
paul1eb8ef22005-04-07 07:30:20 +00003689 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00003690 {
paul718e3742002-12-13 20:15:29 +00003691 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3692 {
3693 switch (type)
3694 {
3695 case OSPF_AS_EXTERNAL_LSA:
3696#ifdef HAVE_OPAQUE_LSA
3697 case OSPF_OPAQUE_AS_LSA:
3698#endif /* HAVE_OPAQUE_LSA */
3699 continue;
3700 default:
3701 break;
3702 }
3703 if (ospf_lsdb_count_self (area->lsdb, type) > 0 ||
3704 (!self && ospf_lsdb_count (area->lsdb, type) > 0))
3705 {
3706 vty_out (vty, " %s (Area %s)%s%s",
3707 show_database_desc[type],
3708 ospf_area_desc_string (area),
3709 VTY_NEWLINE, VTY_NEWLINE);
3710 vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE);
3711
paul020709f2003-04-04 02:44:16 +00003712 LSDB_LOOP (AREA_LSDB (area, type), rn, lsa)
3713 show_lsa_summary (vty, lsa, self);
paul718e3742002-12-13 20:15:29 +00003714
3715 vty_out (vty, "%s", VTY_NEWLINE);
3716 }
3717 }
3718 }
3719
3720 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3721 {
3722 switch (type)
3723 {
3724 case OSPF_AS_EXTERNAL_LSA:
3725#ifdef HAVE_OPAQUE_LSA
3726 case OSPF_OPAQUE_AS_LSA:
3727#endif /* HAVE_OPAQUE_LSA */
3728 break;;
3729 default:
3730 continue;
3731 }
paul68980082003-03-25 05:07:42 +00003732 if (ospf_lsdb_count_self (ospf->lsdb, type) ||
3733 (!self && ospf_lsdb_count (ospf->lsdb, type)))
paul718e3742002-12-13 20:15:29 +00003734 {
3735 vty_out (vty, " %s%s%s",
3736 show_database_desc[type],
3737 VTY_NEWLINE, VTY_NEWLINE);
3738 vty_out (vty, "%s%s", show_database_header[type],
3739 VTY_NEWLINE);
paul020709f2003-04-04 02:44:16 +00003740
3741 LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa)
3742 show_lsa_summary (vty, lsa, self);
3743
paul718e3742002-12-13 20:15:29 +00003744 vty_out (vty, "%s", VTY_NEWLINE);
3745 }
3746 }
3747
3748 vty_out (vty, "%s", VTY_NEWLINE);
3749}
3750
paul4dadc292005-05-06 21:37:42 +00003751static void
paul020709f2003-04-04 02:44:16 +00003752show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00003753{
hasso52dc7ee2004-09-23 19:18:23 +00003754 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003755 struct ospf_lsa *lsa;
3756
3757 vty_out (vty, "%s MaxAge Link States:%s%s",
3758 VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
3759
paul1eb8ef22005-04-07 07:30:20 +00003760 for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa))
3761 {
3762 vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);
3763 vty_out (vty, "Link State ID: %s%s",
3764 inet_ntoa (lsa->data->id), VTY_NEWLINE);
3765 vty_out (vty, "Advertising Router: %s%s",
3766 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3767 vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);
3768 vty_out (vty, "%s", VTY_NEWLINE);
3769 }
paul718e3742002-12-13 20:15:29 +00003770}
3771
paul718e3742002-12-13 20:15:29 +00003772#define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
3773#define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
paul718e3742002-12-13 20:15:29 +00003774
3775#ifdef HAVE_OPAQUE_LSA
3776#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
3777#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
3778#define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
3779#define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
3780#else /* HAVE_OPAQUE_LSA */
3781#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
3782#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
3783#define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
3784#define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
3785#endif /* HAVE_OPAQUE_LSA */
3786
3787#define OSPF_LSA_TYPES_CMD_STR \
3788 "asbr-summary|external|network|router|summary" \
3789 OSPF_LSA_TYPE_NSSA_CMD_STR \
3790 OSPF_LSA_TYPE_OPAQUE_CMD_STR
3791
3792#define OSPF_LSA_TYPES_DESC \
3793 "ASBR summary link states\n" \
3794 "External link states\n" \
3795 "Network link states\n" \
3796 "Router link states\n" \
3797 "Network summary link states\n" \
3798 OSPF_LSA_TYPE_NSSA_DESC \
3799 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
3800 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
3801 OSPF_LSA_TYPE_OPAQUE_AS_DESC
3802
3803DEFUN (show_ip_ospf_database,
3804 show_ip_ospf_database_cmd,
3805 "show ip ospf database",
3806 SHOW_STR
3807 IP_STR
3808 "OSPF information\n"
3809 "Database summary\n")
3810{
paul020709f2003-04-04 02:44:16 +00003811 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003812 int type, ret;
3813 struct in_addr id, adv_router;
3814
paul020709f2003-04-04 02:44:16 +00003815 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003816 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003817 return CMD_SUCCESS;
3818
3819 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00003820 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003821
3822 /* Show all LSA. */
3823 if (argc == 0)
3824 {
paul020709f2003-04-04 02:44:16 +00003825 show_ip_ospf_database_summary (vty, ospf, 0);
paul718e3742002-12-13 20:15:29 +00003826 return CMD_SUCCESS;
3827 }
3828
3829 /* Set database type to show. */
3830 if (strncmp (argv[0], "r", 1) == 0)
3831 type = OSPF_ROUTER_LSA;
3832 else if (strncmp (argv[0], "ne", 2) == 0)
3833 type = OSPF_NETWORK_LSA;
paul718e3742002-12-13 20:15:29 +00003834 else if (strncmp (argv[0], "ns", 2) == 0)
3835 type = OSPF_AS_NSSA_LSA;
paul718e3742002-12-13 20:15:29 +00003836 else if (strncmp (argv[0], "su", 2) == 0)
3837 type = OSPF_SUMMARY_LSA;
3838 else if (strncmp (argv[0], "a", 1) == 0)
3839 type = OSPF_ASBR_SUMMARY_LSA;
3840 else if (strncmp (argv[0], "e", 1) == 0)
3841 type = OSPF_AS_EXTERNAL_LSA;
3842 else if (strncmp (argv[0], "se", 2) == 0)
3843 {
paul020709f2003-04-04 02:44:16 +00003844 show_ip_ospf_database_summary (vty, ospf, 1);
paul718e3742002-12-13 20:15:29 +00003845 return CMD_SUCCESS;
3846 }
3847 else if (strncmp (argv[0], "m", 1) == 0)
3848 {
paul020709f2003-04-04 02:44:16 +00003849 show_ip_ospf_database_maxage (vty, ospf);
paul718e3742002-12-13 20:15:29 +00003850 return CMD_SUCCESS;
3851 }
3852#ifdef HAVE_OPAQUE_LSA
3853 else if (strncmp (argv[0], "opaque-l", 8) == 0)
3854 type = OSPF_OPAQUE_LINK_LSA;
3855 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
3856 type = OSPF_OPAQUE_AREA_LSA;
3857 else if (strncmp (argv[0], "opaque-as", 9) == 0)
3858 type = OSPF_OPAQUE_AS_LSA;
3859#endif /* HAVE_OPAQUE_LSA */
3860 else
3861 return CMD_WARNING;
3862
3863 /* `show ip ospf database LSA'. */
3864 if (argc == 1)
paul020709f2003-04-04 02:44:16 +00003865 show_lsa_detail (vty, ospf, type, NULL, NULL);
paul718e3742002-12-13 20:15:29 +00003866 else if (argc >= 2)
3867 {
3868 ret = inet_aton (argv[1], &id);
3869 if (!ret)
3870 return CMD_WARNING;
3871
3872 /* `show ip ospf database LSA ID'. */
3873 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00003874 show_lsa_detail (vty, ospf, type, &id, NULL);
paul718e3742002-12-13 20:15:29 +00003875 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
3876 else if (argc == 3)
3877 {
3878 if (strncmp (argv[2], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00003879 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00003880 else
3881 {
3882 ret = inet_aton (argv[2], &adv_router);
3883 if (!ret)
3884 return CMD_WARNING;
3885 }
paul020709f2003-04-04 02:44:16 +00003886 show_lsa_detail (vty, ospf, type, &id, &adv_router);
paul718e3742002-12-13 20:15:29 +00003887 }
3888 }
3889
3890 return CMD_SUCCESS;
3891}
3892
3893ALIAS (show_ip_ospf_database,
3894 show_ip_ospf_database_type_cmd,
3895 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)",
3896 SHOW_STR
3897 IP_STR
3898 "OSPF information\n"
3899 "Database summary\n"
3900 OSPF_LSA_TYPES_DESC
3901 "LSAs in MaxAge list\n"
3902 "Self-originated link states\n")
3903
3904ALIAS (show_ip_ospf_database,
3905 show_ip_ospf_database_type_id_cmd,
3906 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D",
3907 SHOW_STR
3908 IP_STR
3909 "OSPF information\n"
3910 "Database summary\n"
3911 OSPF_LSA_TYPES_DESC
3912 "Link State ID (as an IP address)\n")
3913
3914ALIAS (show_ip_ospf_database,
3915 show_ip_ospf_database_type_id_adv_router_cmd,
3916 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D",
3917 SHOW_STR
3918 IP_STR
3919 "OSPF information\n"
3920 "Database summary\n"
3921 OSPF_LSA_TYPES_DESC
3922 "Link State ID (as an IP address)\n"
3923 "Advertising Router link states\n"
3924 "Advertising Router (as an IP address)\n")
3925
3926ALIAS (show_ip_ospf_database,
3927 show_ip_ospf_database_type_id_self_cmd,
3928 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
3929 SHOW_STR
3930 IP_STR
3931 "OSPF information\n"
3932 "Database summary\n"
3933 OSPF_LSA_TYPES_DESC
3934 "Link State ID (as an IP address)\n"
3935 "Self-originated link states\n"
3936 "\n")
3937
3938DEFUN (show_ip_ospf_database_type_adv_router,
3939 show_ip_ospf_database_type_adv_router_cmd,
3940 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D",
3941 SHOW_STR
3942 IP_STR
3943 "OSPF information\n"
3944 "Database summary\n"
3945 OSPF_LSA_TYPES_DESC
3946 "Advertising Router link states\n"
3947 "Advertising Router (as an IP address)\n")
3948{
paul020709f2003-04-04 02:44:16 +00003949 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003950 int type, ret;
3951 struct in_addr adv_router;
3952
paul020709f2003-04-04 02:44:16 +00003953 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003954 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003955 return CMD_SUCCESS;
3956
3957 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00003958 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003959
3960 if (argc != 2)
3961 return CMD_WARNING;
3962
3963 /* Set database type to show. */
3964 if (strncmp (argv[0], "r", 1) == 0)
3965 type = OSPF_ROUTER_LSA;
3966 else if (strncmp (argv[0], "ne", 2) == 0)
3967 type = OSPF_NETWORK_LSA;
paul718e3742002-12-13 20:15:29 +00003968 else if (strncmp (argv[0], "ns", 2) == 0)
3969 type = OSPF_AS_NSSA_LSA;
paul718e3742002-12-13 20:15:29 +00003970 else if (strncmp (argv[0], "s", 1) == 0)
3971 type = OSPF_SUMMARY_LSA;
3972 else if (strncmp (argv[0], "a", 1) == 0)
3973 type = OSPF_ASBR_SUMMARY_LSA;
3974 else if (strncmp (argv[0], "e", 1) == 0)
3975 type = OSPF_AS_EXTERNAL_LSA;
3976#ifdef HAVE_OPAQUE_LSA
3977 else if (strncmp (argv[0], "opaque-l", 8) == 0)
3978 type = OSPF_OPAQUE_LINK_LSA;
3979 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
3980 type = OSPF_OPAQUE_AREA_LSA;
3981 else if (strncmp (argv[0], "opaque-as", 9) == 0)
3982 type = OSPF_OPAQUE_AS_LSA;
3983#endif /* HAVE_OPAQUE_LSA */
3984 else
3985 return CMD_WARNING;
3986
3987 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
3988 if (strncmp (argv[1], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00003989 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00003990 else
3991 {
3992 ret = inet_aton (argv[1], &adv_router);
3993 if (!ret)
3994 return CMD_WARNING;
3995 }
3996
paul020709f2003-04-04 02:44:16 +00003997 show_lsa_detail_adv_router (vty, ospf, type, &adv_router);
paul718e3742002-12-13 20:15:29 +00003998
3999 return CMD_SUCCESS;
4000}
4001
4002ALIAS (show_ip_ospf_database_type_adv_router,
4003 show_ip_ospf_database_type_self_cmd,
4004 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
4005 SHOW_STR
4006 IP_STR
4007 "OSPF information\n"
4008 "Database summary\n"
4009 OSPF_LSA_TYPES_DESC
4010 "Self-originated link states\n")
4011
4012
4013DEFUN (ip_ospf_authentication_args,
4014 ip_ospf_authentication_args_addr_cmd,
4015 "ip ospf authentication (null|message-digest) A.B.C.D",
4016 "IP Information\n"
4017 "OSPF interface commands\n"
4018 "Enable authentication on this interface\n"
4019 "Use null authentication\n"
4020 "Use message-digest authentication\n"
4021 "Address of interface")
4022{
4023 struct interface *ifp;
4024 struct in_addr addr;
4025 int ret;
4026 struct ospf_if_params *params;
4027
4028 ifp = vty->index;
4029 params = IF_DEF_PARAMS (ifp);
4030
4031 if (argc == 2)
4032 {
4033 ret = inet_aton(argv[1], &addr);
4034 if (!ret)
4035 {
4036 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4037 VTY_NEWLINE);
4038 return CMD_WARNING;
4039 }
4040
4041 params = ospf_get_if_params (ifp, addr);
4042 ospf_if_update_params (ifp, addr);
4043 }
4044
4045 /* Handle null authentication */
4046 if ( argv[0][0] == 'n' )
4047 {
4048 SET_IF_PARAM (params, auth_type);
4049 params->auth_type = OSPF_AUTH_NULL;
4050 return CMD_SUCCESS;
4051 }
4052
4053 /* Handle message-digest authentication */
4054 if ( argv[0][0] == 'm' )
4055 {
4056 SET_IF_PARAM (params, auth_type);
4057 params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
4058 return CMD_SUCCESS;
4059 }
4060
4061 vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE);
4062 return CMD_WARNING;
4063}
4064
4065ALIAS (ip_ospf_authentication_args,
4066 ip_ospf_authentication_args_cmd,
4067 "ip ospf authentication (null|message-digest)",
4068 "IP Information\n"
4069 "OSPF interface commands\n"
4070 "Enable authentication on this interface\n"
4071 "Use null authentication\n"
4072 "Use message-digest authentication\n")
4073
4074DEFUN (ip_ospf_authentication,
4075 ip_ospf_authentication_addr_cmd,
4076 "ip ospf authentication A.B.C.D",
4077 "IP Information\n"
4078 "OSPF interface commands\n"
4079 "Enable authentication on this interface\n"
4080 "Address of interface")
4081{
4082 struct interface *ifp;
4083 struct in_addr addr;
4084 int ret;
4085 struct ospf_if_params *params;
4086
4087 ifp = vty->index;
4088 params = IF_DEF_PARAMS (ifp);
4089
4090 if (argc == 1)
4091 {
4092 ret = inet_aton(argv[1], &addr);
4093 if (!ret)
4094 {
4095 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4096 VTY_NEWLINE);
4097 return CMD_WARNING;
4098 }
4099
4100 params = ospf_get_if_params (ifp, addr);
4101 ospf_if_update_params (ifp, addr);
4102 }
4103
4104 SET_IF_PARAM (params, auth_type);
4105 params->auth_type = OSPF_AUTH_SIMPLE;
4106
4107 return CMD_SUCCESS;
4108}
4109
4110ALIAS (ip_ospf_authentication,
4111 ip_ospf_authentication_cmd,
4112 "ip ospf authentication",
4113 "IP Information\n"
4114 "OSPF interface commands\n"
4115 "Enable authentication on this interface\n")
4116
4117DEFUN (no_ip_ospf_authentication,
4118 no_ip_ospf_authentication_addr_cmd,
4119 "no ip ospf authentication A.B.C.D",
4120 NO_STR
4121 "IP Information\n"
4122 "OSPF interface commands\n"
4123 "Enable authentication on this interface\n"
4124 "Address of interface")
4125{
4126 struct interface *ifp;
4127 struct in_addr addr;
4128 int ret;
4129 struct ospf_if_params *params;
4130
4131 ifp = vty->index;
4132 params = IF_DEF_PARAMS (ifp);
4133
4134 if (argc == 1)
4135 {
4136 ret = inet_aton(argv[1], &addr);
4137 if (!ret)
4138 {
4139 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4140 VTY_NEWLINE);
4141 return CMD_WARNING;
4142 }
4143
4144 params = ospf_lookup_if_params (ifp, addr);
4145 if (params == NULL)
4146 return CMD_SUCCESS;
4147 }
4148
4149 params->auth_type = OSPF_AUTH_NOTSET;
4150 UNSET_IF_PARAM (params, auth_type);
4151
4152 if (params != IF_DEF_PARAMS (ifp))
4153 {
4154 ospf_free_if_params (ifp, addr);
4155 ospf_if_update_params (ifp, addr);
4156 }
4157
4158 return CMD_SUCCESS;
4159}
4160
4161ALIAS (no_ip_ospf_authentication,
4162 no_ip_ospf_authentication_cmd,
4163 "no ip ospf authentication",
4164 NO_STR
4165 "IP Information\n"
4166 "OSPF interface commands\n"
4167 "Enable authentication on this interface\n")
4168
4169DEFUN (ip_ospf_authentication_key,
4170 ip_ospf_authentication_key_addr_cmd,
4171 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4172 "IP Information\n"
4173 "OSPF interface commands\n"
4174 "Authentication password (key)\n"
4175 "The OSPF password (key)\n"
4176 "Address of interface")
4177{
4178 struct interface *ifp;
4179 struct in_addr addr;
4180 int ret;
4181 struct ospf_if_params *params;
4182
4183 ifp = vty->index;
4184 params = IF_DEF_PARAMS (ifp);
4185
4186 if (argc == 2)
4187 {
4188 ret = inet_aton(argv[1], &addr);
4189 if (!ret)
4190 {
4191 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4192 VTY_NEWLINE);
4193 return CMD_WARNING;
4194 }
4195
4196 params = ospf_get_if_params (ifp, addr);
4197 ospf_if_update_params (ifp, addr);
4198 }
4199
4200
4201 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
hassoc9e52be2004-09-26 16:09:34 +00004202 strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE);
paul718e3742002-12-13 20:15:29 +00004203 SET_IF_PARAM (params, auth_simple);
4204
4205 return CMD_SUCCESS;
4206}
4207
4208ALIAS (ip_ospf_authentication_key,
4209 ip_ospf_authentication_key_cmd,
4210 "ip ospf authentication-key AUTH_KEY",
4211 "IP Information\n"
4212 "OSPF interface commands\n"
4213 "Authentication password (key)\n"
4214 "The OSPF password (key)")
4215
4216ALIAS (ip_ospf_authentication_key,
4217 ospf_authentication_key_cmd,
4218 "ospf authentication-key AUTH_KEY",
4219 "OSPF interface commands\n"
4220 "Authentication password (key)\n"
4221 "The OSPF password (key)")
4222
4223DEFUN (no_ip_ospf_authentication_key,
4224 no_ip_ospf_authentication_key_addr_cmd,
4225 "no ip ospf authentication-key A.B.C.D",
4226 NO_STR
4227 "IP Information\n"
4228 "OSPF interface commands\n"
4229 "Authentication password (key)\n"
4230 "Address of interface")
4231{
4232 struct interface *ifp;
4233 struct in_addr addr;
4234 int ret;
4235 struct ospf_if_params *params;
4236
4237 ifp = vty->index;
4238 params = IF_DEF_PARAMS (ifp);
4239
4240 if (argc == 2)
4241 {
4242 ret = inet_aton(argv[1], &addr);
4243 if (!ret)
4244 {
4245 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4246 VTY_NEWLINE);
4247 return CMD_WARNING;
4248 }
4249
4250 params = ospf_lookup_if_params (ifp, addr);
4251 if (params == NULL)
4252 return CMD_SUCCESS;
4253 }
4254
4255 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
4256 UNSET_IF_PARAM (params, auth_simple);
4257
4258 if (params != IF_DEF_PARAMS (ifp))
4259 {
4260 ospf_free_if_params (ifp, addr);
4261 ospf_if_update_params (ifp, addr);
4262 }
4263
4264 return CMD_SUCCESS;
4265}
4266
4267ALIAS (no_ip_ospf_authentication_key,
4268 no_ip_ospf_authentication_key_cmd,
4269 "no ip ospf authentication-key",
4270 NO_STR
4271 "IP Information\n"
4272 "OSPF interface commands\n"
4273 "Authentication password (key)\n")
4274
4275ALIAS (no_ip_ospf_authentication_key,
4276 no_ospf_authentication_key_cmd,
4277 "no ospf authentication-key",
4278 NO_STR
4279 "OSPF interface commands\n"
4280 "Authentication password (key)\n")
4281
4282DEFUN (ip_ospf_message_digest_key,
4283 ip_ospf_message_digest_key_addr_cmd,
4284 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4285 "IP Information\n"
4286 "OSPF interface commands\n"
4287 "Message digest authentication password (key)\n"
4288 "Key ID\n"
4289 "Use MD5 algorithm\n"
4290 "The OSPF password (key)"
4291 "Address of interface")
4292{
4293 struct interface *ifp;
4294 struct crypt_key *ck;
4295 u_char key_id;
4296 struct in_addr addr;
4297 int ret;
4298 struct ospf_if_params *params;
4299
4300 ifp = vty->index;
4301 params = IF_DEF_PARAMS (ifp);
4302
4303 if (argc == 3)
4304 {
4305 ret = inet_aton(argv[2], &addr);
4306 if (!ret)
4307 {
4308 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4309 VTY_NEWLINE);
4310 return CMD_WARNING;
4311 }
4312
4313 params = ospf_get_if_params (ifp, addr);
4314 ospf_if_update_params (ifp, addr);
4315 }
4316
4317 key_id = strtol (argv[0], NULL, 10);
4318 if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
4319 {
4320 vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
4321 return CMD_WARNING;
4322 }
4323
4324 ck = ospf_crypt_key_new ();
4325 ck->key_id = (u_char) key_id;
4326 memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
hassoc9e52be2004-09-26 16:09:34 +00004327 strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE);
paul718e3742002-12-13 20:15:29 +00004328
4329 ospf_crypt_key_add (params->auth_crypt, ck);
4330 SET_IF_PARAM (params, auth_crypt);
4331
4332 return CMD_SUCCESS;
4333}
4334
4335ALIAS (ip_ospf_message_digest_key,
4336 ip_ospf_message_digest_key_cmd,
4337 "ip ospf message-digest-key <1-255> md5 KEY",
4338 "IP Information\n"
4339 "OSPF interface commands\n"
4340 "Message digest authentication password (key)\n"
4341 "Key ID\n"
4342 "Use MD5 algorithm\n"
4343 "The OSPF password (key)")
4344
4345ALIAS (ip_ospf_message_digest_key,
4346 ospf_message_digest_key_cmd,
4347 "ospf message-digest-key <1-255> md5 KEY",
4348 "OSPF interface commands\n"
4349 "Message digest authentication password (key)\n"
4350 "Key ID\n"
4351 "Use MD5 algorithm\n"
4352 "The OSPF password (key)")
4353
4354DEFUN (no_ip_ospf_message_digest_key,
4355 no_ip_ospf_message_digest_key_addr_cmd,
4356 "no ip ospf message-digest-key <1-255> A.B.C.D",
4357 NO_STR
4358 "IP Information\n"
4359 "OSPF interface commands\n"
4360 "Message digest authentication password (key)\n"
4361 "Key ID\n"
4362 "Address of interface")
4363{
4364 struct interface *ifp;
4365 struct crypt_key *ck;
4366 int key_id;
4367 struct in_addr addr;
4368 int ret;
4369 struct ospf_if_params *params;
4370
4371 ifp = vty->index;
4372 params = IF_DEF_PARAMS (ifp);
4373
4374 if (argc == 2)
4375 {
4376 ret = inet_aton(argv[1], &addr);
4377 if (!ret)
4378 {
4379 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4380 VTY_NEWLINE);
4381 return CMD_WARNING;
4382 }
4383
4384 params = ospf_lookup_if_params (ifp, addr);
4385 if (params == NULL)
4386 return CMD_SUCCESS;
4387 }
4388
4389 key_id = strtol (argv[0], NULL, 10);
4390 ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
4391 if (ck == NULL)
4392 {
4393 vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
4394 return CMD_WARNING;
4395 }
4396
4397 ospf_crypt_key_delete (params->auth_crypt, key_id);
4398
4399 if (params != IF_DEF_PARAMS (ifp))
4400 {
4401 ospf_free_if_params (ifp, addr);
4402 ospf_if_update_params (ifp, addr);
4403 }
4404
4405 return CMD_SUCCESS;
4406}
4407
4408ALIAS (no_ip_ospf_message_digest_key,
4409 no_ip_ospf_message_digest_key_cmd,
4410 "no ip ospf message-digest-key <1-255>",
4411 NO_STR
4412 "IP Information\n"
4413 "OSPF interface commands\n"
4414 "Message digest authentication password (key)\n"
4415 "Key ID\n")
4416
4417ALIAS (no_ip_ospf_message_digest_key,
4418 no_ospf_message_digest_key_cmd,
4419 "no ospf message-digest-key <1-255>",
4420 NO_STR
4421 "OSPF interface commands\n"
4422 "Message digest authentication password (key)\n"
4423 "Key ID\n")
4424
4425DEFUN (ip_ospf_cost,
4426 ip_ospf_cost_addr_cmd,
4427 "ip ospf cost <1-65535> A.B.C.D",
4428 "IP Information\n"
4429 "OSPF interface commands\n"
4430 "Interface cost\n"
4431 "Cost\n"
4432 "Address of interface")
4433{
4434 struct interface *ifp = vty->index;
4435 u_int32_t cost;
4436 struct in_addr addr;
4437 int ret;
4438 struct ospf_if_params *params;
4439
4440 params = IF_DEF_PARAMS (ifp);
4441
4442 cost = strtol (argv[0], NULL, 10);
4443
4444 /* cost range is <1-65535>. */
4445 if (cost < 1 || cost > 65535)
4446 {
4447 vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
4448 return CMD_WARNING;
4449 }
4450
4451 if (argc == 2)
4452 {
4453 ret = inet_aton(argv[1], &addr);
4454 if (!ret)
4455 {
4456 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4457 VTY_NEWLINE);
4458 return CMD_WARNING;
4459 }
4460
4461 params = ospf_get_if_params (ifp, addr);
4462 ospf_if_update_params (ifp, addr);
4463 }
4464
4465 SET_IF_PARAM (params, output_cost_cmd);
4466 params->output_cost_cmd = cost;
4467
4468 ospf_if_recalculate_output_cost (ifp);
4469
4470 return CMD_SUCCESS;
4471}
4472
4473ALIAS (ip_ospf_cost,
4474 ip_ospf_cost_cmd,
4475 "ip ospf cost <1-65535>",
4476 "IP Information\n"
4477 "OSPF interface commands\n"
4478 "Interface cost\n"
4479 "Cost")
4480
4481ALIAS (ip_ospf_cost,
4482 ospf_cost_cmd,
4483 "ospf cost <1-65535>",
4484 "OSPF interface commands\n"
4485 "Interface cost\n"
4486 "Cost")
4487
4488DEFUN (no_ip_ospf_cost,
4489 no_ip_ospf_cost_addr_cmd,
4490 "no ip ospf cost A.B.C.D",
4491 NO_STR
4492 "IP Information\n"
4493 "OSPF interface commands\n"
4494 "Interface cost\n"
4495 "Address of interface")
4496{
4497 struct interface *ifp = vty->index;
4498 struct in_addr addr;
4499 int ret;
4500 struct ospf_if_params *params;
4501
4502 ifp = vty->index;
4503 params = IF_DEF_PARAMS (ifp);
4504
4505 if (argc == 1)
4506 {
4507 ret = inet_aton(argv[0], &addr);
4508 if (!ret)
4509 {
4510 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4511 VTY_NEWLINE);
4512 return CMD_WARNING;
4513 }
4514
4515 params = ospf_lookup_if_params (ifp, addr);
4516 if (params == NULL)
4517 return CMD_SUCCESS;
4518 }
4519
4520 UNSET_IF_PARAM (params, output_cost_cmd);
4521
4522 if (params != IF_DEF_PARAMS (ifp))
4523 {
4524 ospf_free_if_params (ifp, addr);
4525 ospf_if_update_params (ifp, addr);
4526 }
4527
4528 ospf_if_recalculate_output_cost (ifp);
4529
4530 return CMD_SUCCESS;
4531}
4532
4533ALIAS (no_ip_ospf_cost,
4534 no_ip_ospf_cost_cmd,
4535 "no ip ospf cost",
4536 NO_STR
4537 "IP Information\n"
4538 "OSPF interface commands\n"
4539 "Interface cost\n")
4540
4541ALIAS (no_ip_ospf_cost,
4542 no_ospf_cost_cmd,
4543 "no ospf cost",
4544 NO_STR
4545 "OSPF interface commands\n"
4546 "Interface cost\n")
4547
paul4dadc292005-05-06 21:37:42 +00004548static void
paul718e3742002-12-13 20:15:29 +00004549ospf_nbr_timer_update (struct ospf_interface *oi)
4550{
4551 struct route_node *rn;
4552 struct ospf_neighbor *nbr;
4553
4554 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
4555 if ((nbr = rn->info))
4556 {
4557 nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait);
4558 nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval);
4559 nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval);
4560 nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval);
4561 }
4562}
4563
4564DEFUN (ip_ospf_dead_interval,
4565 ip_ospf_dead_interval_addr_cmd,
4566 "ip ospf dead-interval <1-65535> A.B.C.D",
4567 "IP Information\n"
4568 "OSPF interface commands\n"
4569 "Interval after which a neighbor is declared dead\n"
4570 "Seconds\n"
4571 "Address of interface")
4572{
4573 struct interface *ifp = vty->index;
4574 u_int32_t seconds;
4575 struct in_addr addr;
4576 int ret;
4577 struct ospf_if_params *params;
4578 struct ospf_interface *oi;
4579 struct route_node *rn;
paul020709f2003-04-04 02:44:16 +00004580 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00004581
paul020709f2003-04-04 02:44:16 +00004582 ospf = ospf_lookup ();
4583
paul718e3742002-12-13 20:15:29 +00004584 params = IF_DEF_PARAMS (ifp);
4585
4586 seconds = strtol (argv[0], NULL, 10);
4587
4588 /* dead_interval range is <1-65535>. */
4589 if (seconds < 1 || seconds > 65535)
4590 {
4591 vty_out (vty, "Router Dead Interval is invalid%s", VTY_NEWLINE);
4592 return CMD_WARNING;
4593 }
4594
4595 if (argc == 2)
4596 {
4597 ret = inet_aton(argv[1], &addr);
4598 if (!ret)
4599 {
4600 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4601 VTY_NEWLINE);
4602 return CMD_WARNING;
4603 }
4604
4605 params = ospf_get_if_params (ifp, addr);
4606 ospf_if_update_params (ifp, addr);
4607 }
4608
4609 SET_IF_PARAM (params, v_wait);
4610 params->v_wait = seconds;
4611
4612 /* Update timer values in neighbor structure. */
4613 if (argc == 2)
4614 {
paul68980082003-03-25 05:07:42 +00004615 if (ospf)
4616 {
4617 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
4618 if (oi)
4619 ospf_nbr_timer_update (oi);
4620 }
paul718e3742002-12-13 20:15:29 +00004621 }
4622 else
4623 {
4624 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4625 if ((oi = rn->info))
4626 ospf_nbr_timer_update (oi);
4627 }
4628
4629 return CMD_SUCCESS;
4630}
4631
4632ALIAS (ip_ospf_dead_interval,
4633 ip_ospf_dead_interval_cmd,
4634 "ip ospf dead-interval <1-65535>",
4635 "IP Information\n"
4636 "OSPF interface commands\n"
4637 "Interval after which a neighbor is declared dead\n"
4638 "Seconds\n")
4639
4640ALIAS (ip_ospf_dead_interval,
4641 ospf_dead_interval_cmd,
4642 "ospf dead-interval <1-65535>",
4643 "OSPF interface commands\n"
4644 "Interval after which a neighbor is declared dead\n"
4645 "Seconds\n")
4646
4647DEFUN (no_ip_ospf_dead_interval,
4648 no_ip_ospf_dead_interval_addr_cmd,
4649 "no ip ospf dead-interval A.B.C.D",
4650 NO_STR
4651 "IP Information\n"
4652 "OSPF interface commands\n"
4653 "Interval after which a neighbor is declared dead\n"
4654 "Address of interface")
4655{
4656 struct interface *ifp = vty->index;
4657 struct in_addr addr;
4658 int ret;
4659 struct ospf_if_params *params;
4660 struct ospf_interface *oi;
4661 struct route_node *rn;
paul020709f2003-04-04 02:44:16 +00004662 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00004663
paul020709f2003-04-04 02:44:16 +00004664 ospf = ospf_lookup ();
4665
paul718e3742002-12-13 20:15:29 +00004666 ifp = vty->index;
4667 params = IF_DEF_PARAMS (ifp);
4668
4669 if (argc == 1)
4670 {
4671 ret = inet_aton(argv[0], &addr);
4672 if (!ret)
4673 {
4674 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4675 VTY_NEWLINE);
4676 return CMD_WARNING;
4677 }
4678
4679 params = ospf_lookup_if_params (ifp, addr);
4680 if (params == NULL)
4681 return CMD_SUCCESS;
4682 }
4683
4684 UNSET_IF_PARAM (params, v_wait);
4685 params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
4686
4687 if (params != IF_DEF_PARAMS (ifp))
4688 {
4689 ospf_free_if_params (ifp, addr);
4690 ospf_if_update_params (ifp, addr);
4691 }
4692
4693 /* Update timer values in neighbor structure. */
4694 if (argc == 1)
4695 {
paul68980082003-03-25 05:07:42 +00004696 if (ospf)
4697 {
4698 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
4699 if (oi)
4700 ospf_nbr_timer_update (oi);
4701 }
paul718e3742002-12-13 20:15:29 +00004702 }
4703 else
4704 {
4705 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4706 if ((oi = rn->info))
4707 ospf_nbr_timer_update (oi);
4708 }
4709
4710 return CMD_SUCCESS;
4711}
4712
4713ALIAS (no_ip_ospf_dead_interval,
4714 no_ip_ospf_dead_interval_cmd,
4715 "no ip ospf dead-interval",
4716 NO_STR
4717 "IP Information\n"
4718 "OSPF interface commands\n"
4719 "Interval after which a neighbor is declared dead\n")
4720
4721ALIAS (no_ip_ospf_dead_interval,
4722 no_ospf_dead_interval_cmd,
4723 "no ospf dead-interval",
4724 NO_STR
4725 "OSPF interface commands\n"
4726 "Interval after which a neighbor is declared dead\n")
4727
4728DEFUN (ip_ospf_hello_interval,
4729 ip_ospf_hello_interval_addr_cmd,
4730 "ip ospf hello-interval <1-65535> A.B.C.D",
4731 "IP Information\n"
4732 "OSPF interface commands\n"
4733 "Time between HELLO packets\n"
4734 "Seconds\n"
4735 "Address of interface")
4736{
4737 struct interface *ifp = vty->index;
4738 u_int32_t seconds;
4739 struct in_addr addr;
4740 int ret;
4741 struct ospf_if_params *params;
4742
4743 params = IF_DEF_PARAMS (ifp);
4744
4745 seconds = strtol (argv[0], NULL, 10);
4746
4747 /* HelloInterval range is <1-65535>. */
4748 if (seconds < 1 || seconds > 65535)
4749 {
4750 vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
4751 return CMD_WARNING;
4752 }
4753
4754 if (argc == 2)
4755 {
4756 ret = inet_aton(argv[1], &addr);
4757 if (!ret)
4758 {
4759 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4760 VTY_NEWLINE);
4761 return CMD_WARNING;
4762 }
4763
4764 params = ospf_get_if_params (ifp, addr);
4765 ospf_if_update_params (ifp, addr);
4766 }
4767
4768 SET_IF_PARAM (params, v_hello);
4769 params->v_hello = seconds;
4770
4771 return CMD_SUCCESS;
4772}
4773
4774ALIAS (ip_ospf_hello_interval,
4775 ip_ospf_hello_interval_cmd,
4776 "ip ospf hello-interval <1-65535>",
4777 "IP Information\n"
4778 "OSPF interface commands\n"
4779 "Time between HELLO packets\n"
4780 "Seconds\n")
4781
4782ALIAS (ip_ospf_hello_interval,
4783 ospf_hello_interval_cmd,
4784 "ospf hello-interval <1-65535>",
4785 "OSPF interface commands\n"
4786 "Time between HELLO packets\n"
4787 "Seconds\n")
4788
4789DEFUN (no_ip_ospf_hello_interval,
4790 no_ip_ospf_hello_interval_addr_cmd,
4791 "no ip ospf hello-interval A.B.C.D",
4792 NO_STR
4793 "IP Information\n"
4794 "OSPF interface commands\n"
4795 "Time between HELLO packets\n"
4796 "Address of interface")
4797{
4798 struct interface *ifp = vty->index;
4799 struct in_addr addr;
4800 int ret;
4801 struct ospf_if_params *params;
4802
4803 ifp = vty->index;
4804 params = IF_DEF_PARAMS (ifp);
4805
4806 if (argc == 1)
4807 {
4808 ret = inet_aton(argv[0], &addr);
4809 if (!ret)
4810 {
4811 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4812 VTY_NEWLINE);
4813 return CMD_WARNING;
4814 }
4815
4816 params = ospf_lookup_if_params (ifp, addr);
4817 if (params == NULL)
4818 return CMD_SUCCESS;
4819 }
4820
4821 UNSET_IF_PARAM (params, v_hello);
4822 params->v_hello = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
4823
4824 if (params != IF_DEF_PARAMS (ifp))
4825 {
4826 ospf_free_if_params (ifp, addr);
4827 ospf_if_update_params (ifp, addr);
4828 }
4829
4830 return CMD_SUCCESS;
4831}
4832
4833ALIAS (no_ip_ospf_hello_interval,
4834 no_ip_ospf_hello_interval_cmd,
4835 "no ip ospf hello-interval",
4836 NO_STR
4837 "IP Information\n"
4838 "OSPF interface commands\n"
4839 "Time between HELLO packets\n")
4840
4841ALIAS (no_ip_ospf_hello_interval,
4842 no_ospf_hello_interval_cmd,
4843 "no ospf hello-interval",
4844 NO_STR
4845 "OSPF interface commands\n"
4846 "Time between HELLO packets\n")
4847
4848DEFUN (ip_ospf_network,
4849 ip_ospf_network_cmd,
4850 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4851 "IP Information\n"
4852 "OSPF interface commands\n"
4853 "Network type\n"
4854 "Specify OSPF broadcast multi-access network\n"
4855 "Specify OSPF NBMA network\n"
4856 "Specify OSPF point-to-multipoint network\n"
4857 "Specify OSPF point-to-point network\n")
4858{
4859 struct interface *ifp = vty->index;
4860 int old_type = IF_DEF_PARAMS (ifp)->type;
4861 struct route_node *rn;
4862
4863 if (strncmp (argv[0], "b", 1) == 0)
4864 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
4865 else if (strncmp (argv[0], "n", 1) == 0)
4866 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
4867 else if (strncmp (argv[0], "point-to-m", 10) == 0)
4868 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
4869 else if (strncmp (argv[0], "point-to-p", 10) == 0)
4870 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
4871
4872 if (IF_DEF_PARAMS (ifp)->type == old_type)
4873 return CMD_SUCCESS;
4874
4875 SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
4876
4877 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4878 {
4879 struct ospf_interface *oi = rn->info;
4880
4881 if (!oi)
4882 continue;
4883
4884 oi->type = IF_DEF_PARAMS (ifp)->type;
4885
4886 if (oi->state > ISM_Down)
4887 {
4888 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
4889 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
4890 }
4891 }
4892
4893 return CMD_SUCCESS;
4894}
4895
4896ALIAS (ip_ospf_network,
4897 ospf_network_cmd,
4898 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
4899 "OSPF interface commands\n"
4900 "Network type\n"
4901 "Specify OSPF broadcast multi-access network\n"
4902 "Specify OSPF NBMA network\n"
4903 "Specify OSPF point-to-multipoint network\n"
4904 "Specify OSPF point-to-point network\n")
4905
4906DEFUN (no_ip_ospf_network,
4907 no_ip_ospf_network_cmd,
4908 "no ip ospf network",
4909 NO_STR
4910 "IP Information\n"
4911 "OSPF interface commands\n"
4912 "Network type\n")
4913{
4914 struct interface *ifp = vty->index;
4915 int old_type = IF_DEF_PARAMS (ifp)->type;
4916 struct route_node *rn;
4917
ajsbc18d612004-12-15 15:07:19 +00004918 IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
paul718e3742002-12-13 20:15:29 +00004919
4920 if (IF_DEF_PARAMS (ifp)->type == old_type)
4921 return CMD_SUCCESS;
4922
4923 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4924 {
4925 struct ospf_interface *oi = rn->info;
4926
4927 if (!oi)
4928 continue;
4929
4930 oi->type = IF_DEF_PARAMS (ifp)->type;
4931
4932 if (oi->state > ISM_Down)
4933 {
4934 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
4935 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
4936 }
4937 }
4938
4939 return CMD_SUCCESS;
4940}
4941
4942ALIAS (no_ip_ospf_network,
4943 no_ospf_network_cmd,
4944 "no ospf network",
4945 NO_STR
4946 "OSPF interface commands\n"
4947 "Network type\n")
4948
4949DEFUN (ip_ospf_priority,
4950 ip_ospf_priority_addr_cmd,
4951 "ip ospf priority <0-255> A.B.C.D",
4952 "IP Information\n"
4953 "OSPF interface commands\n"
4954 "Router priority\n"
4955 "Priority\n"
4956 "Address of interface")
4957{
4958 struct interface *ifp = vty->index;
4959 u_int32_t priority;
4960 struct route_node *rn;
4961 struct in_addr addr;
4962 int ret;
4963 struct ospf_if_params *params;
4964
4965 params = IF_DEF_PARAMS (ifp);
4966
4967 priority = strtol (argv[0], NULL, 10);
4968
4969 /* Router Priority range is <0-255>. */
4970 if (priority < 0 || priority > 255)
4971 {
4972 vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
4973 return CMD_WARNING;
4974 }
4975
4976 if (argc == 2)
4977 {
4978 ret = inet_aton(argv[1], &addr);
4979 if (!ret)
4980 {
4981 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4982 VTY_NEWLINE);
4983 return CMD_WARNING;
4984 }
4985
4986 params = ospf_get_if_params (ifp, addr);
4987 ospf_if_update_params (ifp, addr);
4988 }
4989
4990 SET_IF_PARAM (params, priority);
4991 params->priority = priority;
4992
4993 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
4994 {
4995 struct ospf_interface *oi = rn->info;
4996
4997 if (!oi)
4998 continue;
4999
5000
5001 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
5002 {
5003 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
5004 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
5005 }
5006 }
5007
5008 return CMD_SUCCESS;
5009}
5010
5011ALIAS (ip_ospf_priority,
5012 ip_ospf_priority_cmd,
5013 "ip ospf priority <0-255>",
5014 "IP Information\n"
5015 "OSPF interface commands\n"
5016 "Router priority\n"
5017 "Priority\n")
5018
5019ALIAS (ip_ospf_priority,
5020 ospf_priority_cmd,
5021 "ospf priority <0-255>",
5022 "OSPF interface commands\n"
5023 "Router priority\n"
5024 "Priority\n")
5025
5026DEFUN (no_ip_ospf_priority,
5027 no_ip_ospf_priority_addr_cmd,
5028 "no ip ospf priority A.B.C.D",
5029 NO_STR
5030 "IP Information\n"
5031 "OSPF interface commands\n"
5032 "Router priority\n"
5033 "Address of interface")
5034{
5035 struct interface *ifp = vty->index;
5036 struct route_node *rn;
5037 struct in_addr addr;
5038 int ret;
5039 struct ospf_if_params *params;
5040
5041 ifp = vty->index;
5042 params = IF_DEF_PARAMS (ifp);
5043
5044 if (argc == 1)
5045 {
5046 ret = inet_aton(argv[0], &addr);
5047 if (!ret)
5048 {
5049 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5050 VTY_NEWLINE);
5051 return CMD_WARNING;
5052 }
5053
5054 params = ospf_lookup_if_params (ifp, addr);
5055 if (params == NULL)
5056 return CMD_SUCCESS;
5057 }
5058
5059 UNSET_IF_PARAM (params, priority);
5060 params->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
5061
5062 if (params != IF_DEF_PARAMS (ifp))
5063 {
5064 ospf_free_if_params (ifp, addr);
5065 ospf_if_update_params (ifp, addr);
5066 }
5067
5068 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5069 {
5070 struct ospf_interface *oi = rn->info;
5071
5072 if (!oi)
5073 continue;
5074
5075
5076 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
5077 {
5078 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
5079 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
5080 }
5081 }
5082
5083 return CMD_SUCCESS;
5084}
5085
5086ALIAS (no_ip_ospf_priority,
5087 no_ip_ospf_priority_cmd,
5088 "no ip ospf priority",
5089 NO_STR
5090 "IP Information\n"
5091 "OSPF interface commands\n"
5092 "Router priority\n")
5093
5094ALIAS (no_ip_ospf_priority,
5095 no_ospf_priority_cmd,
5096 "no ospf priority",
5097 NO_STR
5098 "OSPF interface commands\n"
5099 "Router priority\n")
5100
5101DEFUN (ip_ospf_retransmit_interval,
5102 ip_ospf_retransmit_interval_addr_cmd,
5103 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5104 "IP Information\n"
5105 "OSPF interface commands\n"
5106 "Time between retransmitting lost link state advertisements\n"
5107 "Seconds\n"
5108 "Address of interface")
5109{
5110 struct interface *ifp = vty->index;
5111 u_int32_t seconds;
5112 struct in_addr addr;
5113 int ret;
5114 struct ospf_if_params *params;
5115
5116 params = IF_DEF_PARAMS (ifp);
5117 seconds = strtol (argv[0], NULL, 10);
5118
5119 /* Retransmit Interval range is <3-65535>. */
5120 if (seconds < 3 || seconds > 65535)
5121 {
5122 vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
5123 return CMD_WARNING;
5124 }
5125
5126
5127 if (argc == 2)
5128 {
5129 ret = inet_aton(argv[1], &addr);
5130 if (!ret)
5131 {
5132 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5133 VTY_NEWLINE);
5134 return CMD_WARNING;
5135 }
5136
5137 params = ospf_get_if_params (ifp, addr);
5138 ospf_if_update_params (ifp, addr);
5139 }
5140
5141 SET_IF_PARAM (params, retransmit_interval);
5142 params->retransmit_interval = seconds;
5143
5144 return CMD_SUCCESS;
5145}
5146
5147ALIAS (ip_ospf_retransmit_interval,
5148 ip_ospf_retransmit_interval_cmd,
5149 "ip ospf retransmit-interval <3-65535>",
5150 "IP Information\n"
5151 "OSPF interface commands\n"
5152 "Time between retransmitting lost link state advertisements\n"
5153 "Seconds\n")
5154
5155ALIAS (ip_ospf_retransmit_interval,
5156 ospf_retransmit_interval_cmd,
5157 "ospf retransmit-interval <3-65535>",
5158 "OSPF interface commands\n"
5159 "Time between retransmitting lost link state advertisements\n"
5160 "Seconds\n")
5161
5162DEFUN (no_ip_ospf_retransmit_interval,
5163 no_ip_ospf_retransmit_interval_addr_cmd,
5164 "no ip ospf retransmit-interval A.B.C.D",
5165 NO_STR
5166 "IP Information\n"
5167 "OSPF interface commands\n"
5168 "Time between retransmitting lost link state advertisements\n"
5169 "Address of interface")
5170{
5171 struct interface *ifp = vty->index;
5172 struct in_addr addr;
5173 int ret;
5174 struct ospf_if_params *params;
5175
5176 ifp = vty->index;
5177 params = IF_DEF_PARAMS (ifp);
5178
5179 if (argc == 1)
5180 {
5181 ret = inet_aton(argv[0], &addr);
5182 if (!ret)
5183 {
5184 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5185 VTY_NEWLINE);
5186 return CMD_WARNING;
5187 }
5188
5189 params = ospf_lookup_if_params (ifp, addr);
5190 if (params == NULL)
5191 return CMD_SUCCESS;
5192 }
5193
5194 UNSET_IF_PARAM (params, retransmit_interval);
5195 params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
5196
5197 if (params != IF_DEF_PARAMS (ifp))
5198 {
5199 ospf_free_if_params (ifp, addr);
5200 ospf_if_update_params (ifp, addr);
5201 }
5202
5203 return CMD_SUCCESS;
5204}
5205
5206ALIAS (no_ip_ospf_retransmit_interval,
5207 no_ip_ospf_retransmit_interval_cmd,
5208 "no ip ospf retransmit-interval",
5209 NO_STR
5210 "IP Information\n"
5211 "OSPF interface commands\n"
5212 "Time between retransmitting lost link state advertisements\n")
5213
5214ALIAS (no_ip_ospf_retransmit_interval,
5215 no_ospf_retransmit_interval_cmd,
5216 "no ospf retransmit-interval",
5217 NO_STR
5218 "OSPF interface commands\n"
5219 "Time between retransmitting lost link state advertisements\n")
5220
5221DEFUN (ip_ospf_transmit_delay,
5222 ip_ospf_transmit_delay_addr_cmd,
5223 "ip ospf transmit-delay <1-65535> A.B.C.D",
5224 "IP Information\n"
5225 "OSPF interface commands\n"
5226 "Link state transmit delay\n"
5227 "Seconds\n"
5228 "Address of interface")
5229{
5230 struct interface *ifp = vty->index;
5231 u_int32_t seconds;
5232 struct in_addr addr;
5233 int ret;
5234 struct ospf_if_params *params;
5235
5236 params = IF_DEF_PARAMS (ifp);
5237 seconds = strtol (argv[0], NULL, 10);
5238
5239 /* Transmit Delay range is <1-65535>. */
5240 if (seconds < 1 || seconds > 65535)
5241 {
5242 vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
5243 return CMD_WARNING;
5244 }
5245
5246 if (argc == 2)
5247 {
5248 ret = inet_aton(argv[1], &addr);
5249 if (!ret)
5250 {
5251 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5252 VTY_NEWLINE);
5253 return CMD_WARNING;
5254 }
5255
5256 params = ospf_get_if_params (ifp, addr);
5257 ospf_if_update_params (ifp, addr);
5258 }
5259
5260 SET_IF_PARAM (params, transmit_delay);
5261 params->transmit_delay = seconds;
5262
5263 return CMD_SUCCESS;
5264}
5265
5266ALIAS (ip_ospf_transmit_delay,
5267 ip_ospf_transmit_delay_cmd,
5268 "ip ospf transmit-delay <1-65535>",
5269 "IP Information\n"
5270 "OSPF interface commands\n"
5271 "Link state transmit delay\n"
5272 "Seconds\n")
5273
5274ALIAS (ip_ospf_transmit_delay,
5275 ospf_transmit_delay_cmd,
5276 "ospf transmit-delay <1-65535>",
5277 "OSPF interface commands\n"
5278 "Link state transmit delay\n"
5279 "Seconds\n")
5280
5281DEFUN (no_ip_ospf_transmit_delay,
5282 no_ip_ospf_transmit_delay_addr_cmd,
5283 "no ip ospf transmit-delay A.B.C.D",
5284 NO_STR
5285 "IP Information\n"
5286 "OSPF interface commands\n"
5287 "Link state transmit delay\n"
5288 "Address of interface")
5289{
5290 struct interface *ifp = vty->index;
5291 struct in_addr addr;
5292 int ret;
5293 struct ospf_if_params *params;
5294
5295 ifp = vty->index;
5296 params = IF_DEF_PARAMS (ifp);
5297
5298 if (argc == 1)
5299 {
5300 ret = inet_aton(argv[0], &addr);
5301 if (!ret)
5302 {
5303 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5304 VTY_NEWLINE);
5305 return CMD_WARNING;
5306 }
5307
5308 params = ospf_lookup_if_params (ifp, addr);
5309 if (params == NULL)
5310 return CMD_SUCCESS;
5311 }
5312
5313 UNSET_IF_PARAM (params, transmit_delay);
5314 params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
5315
5316 if (params != IF_DEF_PARAMS (ifp))
5317 {
5318 ospf_free_if_params (ifp, addr);
5319 ospf_if_update_params (ifp, addr);
5320 }
5321
5322 return CMD_SUCCESS;
5323}
5324
5325ALIAS (no_ip_ospf_transmit_delay,
5326 no_ip_ospf_transmit_delay_cmd,
5327 "no ip ospf transmit-delay",
5328 NO_STR
5329 "IP Information\n"
5330 "OSPF interface commands\n"
5331 "Link state transmit delay\n")
5332
5333ALIAS (no_ip_ospf_transmit_delay,
5334 no_ospf_transmit_delay_cmd,
5335 "no ospf transmit-delay",
5336 NO_STR
5337 "OSPF interface commands\n"
5338 "Link state transmit delay\n")
5339
5340
5341DEFUN (ospf_redistribute_source_metric_type,
5342 ospf_redistribute_source_metric_type_routemap_cmd,
5343 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD",
5344 "Redistribute information from another routing protocol\n"
5345 "Kernel routes\n"
5346 "Connected\n"
5347 "Static routes\n"
5348 "Routing Information Protocol (RIP)\n"
5349 "Border Gateway Protocol (BGP)\n"
5350 "Metric for redistributed routes\n"
5351 "OSPF default metric\n"
5352 "OSPF exterior metric type for redistributed routes\n"
5353 "Set OSPF External Type 1 metrics\n"
5354 "Set OSPF External Type 2 metrics\n"
5355 "Route map reference\n"
5356 "Pointer to route-map entries\n")
5357{
paul020709f2003-04-04 02:44:16 +00005358 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005359 int source;
5360 int type = -1;
5361 int metric = -1;
5362
5363 /* Get distribute source. */
5364 if (!str2distribute_source (argv[0], &source))
5365 return CMD_WARNING;
5366
5367 /* Get metric value. */
5368 if (argc >= 2)
5369 if (!str2metric (argv[1], &metric))
5370 return CMD_WARNING;
5371
5372 /* Get metric type. */
5373 if (argc >= 3)
5374 if (!str2metric_type (argv[2], &type))
5375 return CMD_WARNING;
5376
5377 if (argc == 4)
paul020709f2003-04-04 02:44:16 +00005378 ospf_routemap_set (ospf, source, argv[3]);
paul718e3742002-12-13 20:15:29 +00005379 else
paul020709f2003-04-04 02:44:16 +00005380 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005381
paul020709f2003-04-04 02:44:16 +00005382 return ospf_redistribute_set (ospf, source, type, metric);
paul718e3742002-12-13 20:15:29 +00005383}
5384
5385ALIAS (ospf_redistribute_source_metric_type,
5386 ospf_redistribute_source_metric_type_cmd,
5387 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)",
5388 "Redistribute information from another routing protocol\n"
5389 "Kernel routes\n"
5390 "Connected\n"
5391 "Static routes\n"
5392 "Routing Information Protocol (RIP)\n"
5393 "Border Gateway Protocol (BGP)\n"
5394 "Metric for redistributed routes\n"
5395 "OSPF default metric\n"
5396 "OSPF exterior metric type for redistributed routes\n"
5397 "Set OSPF External Type 1 metrics\n"
5398 "Set OSPF External Type 2 metrics\n")
5399
5400ALIAS (ospf_redistribute_source_metric_type,
5401 ospf_redistribute_source_metric_cmd,
5402 "redistribute (kernel|connected|static|rip|bgp) 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 "Metric for redistributed routes\n"
5410 "OSPF default metric\n")
5411
5412DEFUN (ospf_redistribute_source_type_metric,
5413 ospf_redistribute_source_type_metric_routemap_cmd,
5414 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD",
5415 "Redistribute information from another routing protocol\n"
5416 "Kernel routes\n"
5417 "Connected\n"
5418 "Static routes\n"
5419 "Routing Information Protocol (RIP)\n"
5420 "Border Gateway Protocol (BGP)\n"
5421 "OSPF exterior metric type for redistributed routes\n"
5422 "Set OSPF External Type 1 metrics\n"
5423 "Set OSPF External Type 2 metrics\n"
5424 "Metric for redistributed routes\n"
5425 "OSPF default metric\n"
5426 "Route map reference\n"
5427 "Pointer to route-map entries\n")
5428{
paul020709f2003-04-04 02:44:16 +00005429 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005430 int source;
5431 int type = -1;
5432 int metric = -1;
5433
5434 /* Get distribute source. */
5435 if (!str2distribute_source (argv[0], &source))
5436 return CMD_WARNING;
5437
5438 /* Get metric value. */
5439 if (argc >= 2)
5440 if (!str2metric_type (argv[1], &type))
5441 return CMD_WARNING;
5442
5443 /* Get metric type. */
5444 if (argc >= 3)
5445 if (!str2metric (argv[2], &metric))
5446 return CMD_WARNING;
5447
5448 if (argc == 4)
paul020709f2003-04-04 02:44:16 +00005449 ospf_routemap_set (ospf, source, argv[3]);
paul718e3742002-12-13 20:15:29 +00005450 else
paul020709f2003-04-04 02:44:16 +00005451 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005452
paul020709f2003-04-04 02:44:16 +00005453 return ospf_redistribute_set (ospf, source, type, metric);
paul718e3742002-12-13 20:15:29 +00005454}
5455
5456ALIAS (ospf_redistribute_source_type_metric,
5457 ospf_redistribute_source_type_metric_cmd,
5458 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>",
5459 "Redistribute information from another routing protocol\n"
5460 "Kernel routes\n"
5461 "Connected\n"
5462 "Static routes\n"
5463 "Routing Information Protocol (RIP)\n"
5464 "Border Gateway Protocol (BGP)\n"
5465 "OSPF exterior metric type for redistributed routes\n"
5466 "Set OSPF External Type 1 metrics\n"
5467 "Set OSPF External Type 2 metrics\n"
5468 "Metric for redistributed routes\n"
5469 "OSPF default metric\n")
5470
5471ALIAS (ospf_redistribute_source_type_metric,
5472 ospf_redistribute_source_type_cmd,
5473 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)",
5474 "Redistribute information from another routing protocol\n"
5475 "Kernel routes\n"
5476 "Connected\n"
5477 "Static routes\n"
5478 "Routing Information Protocol (RIP)\n"
5479 "Border Gateway Protocol (BGP)\n"
5480 "OSPF exterior metric type for redistributed routes\n"
5481 "Set OSPF External Type 1 metrics\n"
5482 "Set OSPF External Type 2 metrics\n")
5483
5484ALIAS (ospf_redistribute_source_type_metric,
5485 ospf_redistribute_source_cmd,
5486 "redistribute (kernel|connected|static|rip|bgp)",
5487 "Redistribute information from another routing protocol\n"
5488 "Kernel routes\n"
5489 "Connected\n"
5490 "Static routes\n"
5491 "Routing Information Protocol (RIP)\n"
5492 "Border Gateway Protocol (BGP)\n")
5493
5494DEFUN (ospf_redistribute_source_metric_routemap,
5495 ospf_redistribute_source_metric_routemap_cmd,
5496 "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD",
5497 "Redistribute information from another routing protocol\n"
5498 "Kernel routes\n"
5499 "Connected\n"
5500 "Static routes\n"
5501 "Routing Information Protocol (RIP)\n"
5502 "Border Gateway Protocol (BGP)\n"
5503 "Metric for redistributed routes\n"
5504 "OSPF default metric\n"
5505 "Route map reference\n"
5506 "Pointer to route-map entries\n")
5507{
paul020709f2003-04-04 02:44:16 +00005508 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005509 int source;
5510 int metric = -1;
5511
5512 /* Get distribute source. */
5513 if (!str2distribute_source (argv[0], &source))
5514 return CMD_WARNING;
5515
5516 /* Get metric value. */
5517 if (argc >= 2)
5518 if (!str2metric (argv[1], &metric))
5519 return CMD_WARNING;
5520
5521 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005522 ospf_routemap_set (ospf, source, argv[2]);
paul718e3742002-12-13 20:15:29 +00005523 else
paul020709f2003-04-04 02:44:16 +00005524 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005525
paul020709f2003-04-04 02:44:16 +00005526 return ospf_redistribute_set (ospf, source, -1, metric);
paul718e3742002-12-13 20:15:29 +00005527}
5528
5529DEFUN (ospf_redistribute_source_type_routemap,
5530 ospf_redistribute_source_type_routemap_cmd,
5531 "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD",
5532 "Redistribute information from another routing protocol\n"
5533 "Kernel routes\n"
5534 "Connected\n"
5535 "Static routes\n"
5536 "Routing Information Protocol (RIP)\n"
5537 "Border Gateway Protocol (BGP)\n"
5538 "OSPF exterior metric type for redistributed routes\n"
5539 "Set OSPF External Type 1 metrics\n"
5540 "Set OSPF External Type 2 metrics\n"
5541 "Route map reference\n"
5542 "Pointer to route-map entries\n")
5543{
paul020709f2003-04-04 02:44:16 +00005544 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005545 int source;
5546 int type = -1;
5547
5548 /* Get distribute source. */
5549 if (!str2distribute_source (argv[0], &source))
5550 return CMD_WARNING;
5551
5552 /* Get metric value. */
5553 if (argc >= 2)
5554 if (!str2metric_type (argv[1], &type))
5555 return CMD_WARNING;
5556
5557 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005558 ospf_routemap_set (ospf, source, argv[2]);
paul718e3742002-12-13 20:15:29 +00005559 else
paul020709f2003-04-04 02:44:16 +00005560 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005561
paul020709f2003-04-04 02:44:16 +00005562 return ospf_redistribute_set (ospf, source, type, -1);
paul718e3742002-12-13 20:15:29 +00005563}
5564
5565DEFUN (ospf_redistribute_source_routemap,
5566 ospf_redistribute_source_routemap_cmd,
5567 "redistribute (kernel|connected|static|rip|bgp) route-map WORD",
5568 "Redistribute information from another routing protocol\n"
5569 "Kernel routes\n"
5570 "Connected\n"
5571 "Static routes\n"
5572 "Routing Information Protocol (RIP)\n"
5573 "Border Gateway Protocol (BGP)\n"
5574 "Route map reference\n"
5575 "Pointer to route-map entries\n")
5576{
paul020709f2003-04-04 02:44:16 +00005577 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005578 int source;
5579
5580 /* Get distribute source. */
5581 if (!str2distribute_source (argv[0], &source))
5582 return CMD_WARNING;
5583
5584 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005585 ospf_routemap_set (ospf, source, argv[1]);
paul718e3742002-12-13 20:15:29 +00005586 else
paul020709f2003-04-04 02:44:16 +00005587 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005588
paul020709f2003-04-04 02:44:16 +00005589 return ospf_redistribute_set (ospf, source, -1, -1);
paul718e3742002-12-13 20:15:29 +00005590}
5591
5592DEFUN (no_ospf_redistribute_source,
5593 no_ospf_redistribute_source_cmd,
5594 "no redistribute (kernel|connected|static|rip|bgp)",
5595 NO_STR
5596 "Redistribute information from another routing protocol\n"
5597 "Kernel routes\n"
5598 "Connected\n"
5599 "Static routes\n"
5600 "Routing Information Protocol (RIP)\n"
5601 "Border Gateway Protocol (BGP)\n")
5602{
paul020709f2003-04-04 02:44:16 +00005603 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005604 int source;
5605
5606 if (!str2distribute_source (argv[0], &source))
5607 return CMD_WARNING;
5608
paul020709f2003-04-04 02:44:16 +00005609 ospf_routemap_unset (ospf, source);
5610 return ospf_redistribute_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005611}
5612
5613DEFUN (ospf_distribute_list_out,
5614 ospf_distribute_list_out_cmd,
5615 "distribute-list WORD out (kernel|connected|static|rip|bgp)",
5616 "Filter networks in routing updates\n"
5617 "Access-list name\n"
5618 OUT_STR
5619 "Kernel routes\n"
5620 "Connected\n"
5621 "Static routes\n"
5622 "Routing Information Protocol (RIP)\n"
5623 "Border Gateway Protocol (BGP)\n")
5624{
paul68980082003-03-25 05:07:42 +00005625 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005626 int source;
5627
5628 /* Get distribute source. */
5629 if (!str2distribute_source (argv[1], &source))
5630 return CMD_WARNING;
5631
paul68980082003-03-25 05:07:42 +00005632 return ospf_distribute_list_out_set (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00005633}
5634
5635DEFUN (no_ospf_distribute_list_out,
5636 no_ospf_distribute_list_out_cmd,
5637 "no distribute-list WORD out (kernel|connected|static|rip|bgp)",
5638 NO_STR
5639 "Filter networks in routing updates\n"
5640 "Access-list name\n"
5641 OUT_STR
5642 "Kernel routes\n"
5643 "Connected\n"
5644 "Static routes\n"
5645 "Routing Information Protocol (RIP)\n"
5646 "Border Gateway Protocol (BGP)\n")
5647{
paul68980082003-03-25 05:07:42 +00005648 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005649 int source;
5650
5651 if (!str2distribute_source (argv[1], &source))
5652 return CMD_WARNING;
5653
paul68980082003-03-25 05:07:42 +00005654 return ospf_distribute_list_out_unset (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00005655}
5656
5657/* Default information originate. */
5658DEFUN (ospf_default_information_originate_metric_type_routemap,
5659 ospf_default_information_originate_metric_type_routemap_cmd,
5660 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
5661 "Control distribution of default information\n"
5662 "Distribute a default route\n"
5663 "OSPF default metric\n"
5664 "OSPF metric\n"
5665 "OSPF metric type for default routes\n"
5666 "Set OSPF External Type 1 metrics\n"
5667 "Set OSPF External Type 2 metrics\n"
5668 "Route map reference\n"
5669 "Pointer to route-map entries\n")
5670{
paul020709f2003-04-04 02:44:16 +00005671 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005672 int type = -1;
5673 int metric = -1;
5674
5675 /* Get metric value. */
5676 if (argc >= 1)
5677 if (!str2metric (argv[0], &metric))
5678 return CMD_WARNING;
5679
5680 /* Get metric type. */
5681 if (argc >= 2)
5682 if (!str2metric_type (argv[1], &type))
5683 return CMD_WARNING;
5684
5685 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005686 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005687 else
paul020709f2003-04-04 02:44:16 +00005688 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005689
paul020709f2003-04-04 02:44:16 +00005690 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5691 type, metric);
paul718e3742002-12-13 20:15:29 +00005692}
5693
5694ALIAS (ospf_default_information_originate_metric_type_routemap,
5695 ospf_default_information_originate_metric_type_cmd,
5696 "default-information originate metric <0-16777214> metric-type (1|2)",
5697 "Control distribution of default information\n"
5698 "Distribute a default route\n"
5699 "OSPF default metric\n"
5700 "OSPF metric\n"
5701 "OSPF metric type for default routes\n"
5702 "Set OSPF External Type 1 metrics\n"
5703 "Set OSPF External Type 2 metrics\n")
5704
5705ALIAS (ospf_default_information_originate_metric_type_routemap,
5706 ospf_default_information_originate_metric_cmd,
5707 "default-information originate metric <0-16777214>",
5708 "Control distribution of default information\n"
5709 "Distribute a default route\n"
5710 "OSPF default metric\n"
5711 "OSPF metric\n")
5712
5713ALIAS (ospf_default_information_originate_metric_type_routemap,
5714 ospf_default_information_originate_cmd,
5715 "default-information originate",
5716 "Control distribution of default information\n"
5717 "Distribute a default route\n")
5718
5719/* Default information originate. */
5720DEFUN (ospf_default_information_originate_metric_routemap,
5721 ospf_default_information_originate_metric_routemap_cmd,
5722 "default-information originate metric <0-16777214> route-map WORD",
5723 "Control distribution of default information\n"
5724 "Distribute a default route\n"
5725 "OSPF default metric\n"
5726 "OSPF metric\n"
5727 "Route map reference\n"
5728 "Pointer to route-map entries\n")
5729{
paul020709f2003-04-04 02:44:16 +00005730 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005731 int metric = -1;
5732
5733 /* Get metric value. */
5734 if (argc >= 1)
5735 if (!str2metric (argv[0], &metric))
5736 return CMD_WARNING;
5737
5738 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005739 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00005740 else
paul020709f2003-04-04 02:44:16 +00005741 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005742
paul020709f2003-04-04 02:44:16 +00005743 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5744 -1, metric);
paul718e3742002-12-13 20:15:29 +00005745}
5746
5747/* Default information originate. */
5748DEFUN (ospf_default_information_originate_routemap,
5749 ospf_default_information_originate_routemap_cmd,
5750 "default-information originate route-map WORD",
5751 "Control distribution of default information\n"
5752 "Distribute a default route\n"
5753 "Route map reference\n"
5754 "Pointer to route-map entries\n")
5755{
paul020709f2003-04-04 02:44:16 +00005756 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005757
paul020709f2003-04-04 02:44:16 +00005758 if (argc == 1)
5759 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
5760 else
5761 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
5762
5763 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1);
paul718e3742002-12-13 20:15:29 +00005764}
5765
5766DEFUN (ospf_default_information_originate_type_metric_routemap,
5767 ospf_default_information_originate_type_metric_routemap_cmd,
5768 "default-information originate metric-type (1|2) metric <0-16777214> 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 "OSPF default metric\n"
5775 "OSPF metric\n"
5776 "Route map reference\n"
5777 "Pointer to route-map entries\n")
5778{
paul020709f2003-04-04 02:44:16 +00005779 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005780 int type = -1;
5781 int metric = -1;
5782
5783 /* Get metric type. */
5784 if (argc >= 1)
5785 if (!str2metric_type (argv[0], &type))
5786 return CMD_WARNING;
5787
5788 /* Get metric value. */
5789 if (argc >= 2)
5790 if (!str2metric (argv[1], &metric))
5791 return CMD_WARNING;
5792
5793 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005794 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005795 else
paul020709f2003-04-04 02:44:16 +00005796 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005797
paul020709f2003-04-04 02:44:16 +00005798 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5799 type, metric);
paul718e3742002-12-13 20:15:29 +00005800}
5801
5802ALIAS (ospf_default_information_originate_type_metric_routemap,
5803 ospf_default_information_originate_type_metric_cmd,
5804 "default-information originate metric-type (1|2) metric <0-16777214>",
5805 "Control distribution of default information\n"
5806 "Distribute a default route\n"
5807 "OSPF metric type for default routes\n"
5808 "Set OSPF External Type 1 metrics\n"
5809 "Set OSPF External Type 2 metrics\n"
5810 "OSPF default metric\n"
5811 "OSPF metric\n")
5812
5813ALIAS (ospf_default_information_originate_type_metric_routemap,
5814 ospf_default_information_originate_type_cmd,
5815 "default-information originate metric-type (1|2)",
5816 "Control distribution of default information\n"
5817 "Distribute a default route\n"
5818 "OSPF metric type for default routes\n"
5819 "Set OSPF External Type 1 metrics\n"
5820 "Set OSPF External Type 2 metrics\n")
5821
5822DEFUN (ospf_default_information_originate_type_routemap,
5823 ospf_default_information_originate_type_routemap_cmd,
5824 "default-information originate metric-type (1|2) route-map WORD",
5825 "Control distribution of default information\n"
5826 "Distribute a default route\n"
5827 "OSPF metric type for default routes\n"
5828 "Set OSPF External Type 1 metrics\n"
5829 "Set OSPF External Type 2 metrics\n"
5830 "Route map reference\n"
5831 "Pointer to route-map entries\n")
5832{
paul020709f2003-04-04 02:44:16 +00005833 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005834 int type = -1;
5835
5836 /* Get metric type. */
5837 if (argc >= 1)
5838 if (!str2metric_type (argv[0], &type))
5839 return CMD_WARNING;
5840
5841 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005842 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00005843 else
paul020709f2003-04-04 02:44:16 +00005844 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005845
paul020709f2003-04-04 02:44:16 +00005846 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
5847 type, -1);
paul718e3742002-12-13 20:15:29 +00005848}
5849
5850DEFUN (ospf_default_information_originate_always_metric_type_routemap,
5851 ospf_default_information_originate_always_metric_type_routemap_cmd,
5852 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
5853 "Control distribution of default information\n"
5854 "Distribute a default route\n"
5855 "Always advertise default route\n"
5856 "OSPF default metric\n"
5857 "OSPF metric\n"
5858 "OSPF metric type for default routes\n"
5859 "Set OSPF External Type 1 metrics\n"
5860 "Set OSPF External Type 2 metrics\n"
5861 "Route map reference\n"
5862 "Pointer to route-map entries\n")
5863{
paul020709f2003-04-04 02:44:16 +00005864 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005865 int type = -1;
5866 int metric = -1;
5867
5868 /* Get metric value. */
5869 if (argc >= 1)
5870 if (!str2metric (argv[0], &metric))
5871 return CMD_WARNING;
5872
5873 /* Get metric type. */
5874 if (argc >= 2)
5875 if (!str2metric_type (argv[1], &type))
5876 return CMD_WARNING;
5877
5878 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005879 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005880 else
paul020709f2003-04-04 02:44:16 +00005881 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005882
paul020709f2003-04-04 02:44:16 +00005883 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00005884 type, metric);
5885}
5886
5887ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5888 ospf_default_information_originate_always_metric_type_cmd,
5889 "default-information originate always metric <0-16777214> metric-type (1|2)",
5890 "Control distribution of default information\n"
5891 "Distribute a default route\n"
5892 "Always advertise default route\n"
5893 "OSPF default metric\n"
5894 "OSPF metric\n"
5895 "OSPF metric type for default routes\n"
5896 "Set OSPF External Type 1 metrics\n"
5897 "Set OSPF External Type 2 metrics\n")
5898
5899ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5900 ospf_default_information_originate_always_metric_cmd,
5901 "default-information originate always metric <0-16777214>",
5902 "Control distribution of default information\n"
5903 "Distribute a default route\n"
5904 "Always advertise default route\n"
5905 "OSPF default metric\n"
5906 "OSPF metric\n"
5907 "OSPF metric type for default routes\n")
5908
5909ALIAS (ospf_default_information_originate_always_metric_type_routemap,
5910 ospf_default_information_originate_always_cmd,
5911 "default-information originate always",
5912 "Control distribution of default information\n"
5913 "Distribute a default route\n"
5914 "Always advertise default route\n")
5915
5916DEFUN (ospf_default_information_originate_always_metric_routemap,
5917 ospf_default_information_originate_always_metric_routemap_cmd,
5918 "default-information originate always metric <0-16777214> route-map WORD",
5919 "Control distribution of default information\n"
5920 "Distribute a default route\n"
5921 "Always advertise default route\n"
5922 "OSPF default metric\n"
5923 "OSPF metric\n"
5924 "Route map reference\n"
5925 "Pointer to route-map entries\n")
5926{
paul020709f2003-04-04 02:44:16 +00005927 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005928 int metric = -1;
5929
5930 /* Get metric value. */
5931 if (argc >= 1)
5932 if (!str2metric (argv[0], &metric))
5933 return CMD_WARNING;
5934
5935 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005936 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
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,
5941 -1, metric);
paul718e3742002-12-13 20:15:29 +00005942}
5943
5944DEFUN (ospf_default_information_originate_always_routemap,
5945 ospf_default_information_originate_always_routemap_cmd,
5946 "default-information originate always route-map WORD",
5947 "Control distribution of default information\n"
5948 "Distribute a default route\n"
5949 "Always advertise default route\n"
5950 "Route map reference\n"
5951 "Pointer to route-map entries\n")
5952{
paul020709f2003-04-04 02:44:16 +00005953 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005954
paul020709f2003-04-04 02:44:16 +00005955 if (argc == 1)
5956 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
5957 else
5958 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
5959
5960 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1);
paul718e3742002-12-13 20:15:29 +00005961}
5962
5963DEFUN (ospf_default_information_originate_always_type_metric_routemap,
5964 ospf_default_information_originate_always_type_metric_routemap_cmd,
5965 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
5966 "Control distribution of default information\n"
5967 "Distribute a default route\n"
5968 "Always advertise default route\n"
5969 "OSPF metric type for default routes\n"
5970 "Set OSPF External Type 1 metrics\n"
5971 "Set OSPF External Type 2 metrics\n"
5972 "OSPF default metric\n"
5973 "OSPF metric\n"
5974 "Route map reference\n"
5975 "Pointer to route-map entries\n")
5976{
paul020709f2003-04-04 02:44:16 +00005977 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005978 int type = -1;
5979 int metric = -1;
5980
5981 /* Get metric type. */
5982 if (argc >= 1)
5983 if (!str2metric_type (argv[0], &type))
5984 return CMD_WARNING;
5985
5986 /* Get metric value. */
5987 if (argc >= 2)
5988 if (!str2metric (argv[1], &metric))
5989 return CMD_WARNING;
5990
5991 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005992 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00005993 else
paul020709f2003-04-04 02:44:16 +00005994 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00005995
paul020709f2003-04-04 02:44:16 +00005996 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00005997 type, metric);
5998}
5999
6000ALIAS (ospf_default_information_originate_always_type_metric_routemap,
6001 ospf_default_information_originate_always_type_metric_cmd,
6002 "default-information originate always metric-type (1|2) metric <0-16777214>",
6003 "Control distribution of default information\n"
6004 "Distribute a default route\n"
6005 "Always advertise default route\n"
6006 "OSPF metric type for default routes\n"
6007 "Set OSPF External Type 1 metrics\n"
6008 "Set OSPF External Type 2 metrics\n"
6009 "OSPF default metric\n"
6010 "OSPF metric\n")
6011
6012ALIAS (ospf_default_information_originate_always_type_metric_routemap,
6013 ospf_default_information_originate_always_type_cmd,
6014 "default-information originate always metric-type (1|2)",
6015 "Control distribution of default information\n"
6016 "Distribute a default route\n"
6017 "Always advertise default route\n"
6018 "OSPF metric type for default routes\n"
6019 "Set OSPF External Type 1 metrics\n"
6020 "Set OSPF External Type 2 metrics\n")
6021
6022DEFUN (ospf_default_information_originate_always_type_routemap,
6023 ospf_default_information_originate_always_type_routemap_cmd,
6024 "default-information originate always metric-type (1|2) route-map WORD",
6025 "Control distribution of default information\n"
6026 "Distribute a default route\n"
6027 "Always advertise default route\n"
6028 "OSPF metric type for default routes\n"
6029 "Set OSPF External Type 1 metrics\n"
6030 "Set OSPF External Type 2 metrics\n"
6031 "Route map reference\n"
6032 "Pointer to route-map entries\n")
6033{
paul020709f2003-04-04 02:44:16 +00006034 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006035 int type = -1;
6036
6037 /* Get metric type. */
6038 if (argc >= 1)
6039 if (!str2metric_type (argv[0], &type))
6040 return CMD_WARNING;
6041
6042 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00006043 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00006044 else
paul020709f2003-04-04 02:44:16 +00006045 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006046
paul020709f2003-04-04 02:44:16 +00006047 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00006048 type, -1);
6049}
6050
6051DEFUN (no_ospf_default_information_originate,
6052 no_ospf_default_information_originate_cmd,
6053 "no default-information originate",
6054 NO_STR
6055 "Control distribution of default information\n"
6056 "Distribute a default route\n")
6057{
paul68980082003-03-25 05:07:42 +00006058 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006059 struct prefix_ipv4 p;
6060 struct in_addr nexthop;
6061
6062 p.family = AF_INET;
6063 p.prefix.s_addr = 0;
6064 p.prefixlen = 0;
6065
paul68980082003-03-25 05:07:42 +00006066 ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0, nexthop);
paul718e3742002-12-13 20:15:29 +00006067
6068 if (EXTERNAL_INFO (DEFAULT_ROUTE)) {
6069 ospf_external_info_delete (DEFAULT_ROUTE, p);
6070 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE));
6071 EXTERNAL_INFO (DEFAULT_ROUTE) = NULL;
6072 }
6073
paul020709f2003-04-04 02:44:16 +00006074 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
6075 return ospf_redistribute_default_unset (ospf);
paul718e3742002-12-13 20:15:29 +00006076}
6077
6078DEFUN (ospf_default_metric,
6079 ospf_default_metric_cmd,
6080 "default-metric <0-16777214>",
6081 "Set metric of redistributed routes\n"
6082 "Default metric\n")
6083{
paul68980082003-03-25 05:07:42 +00006084 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006085 int metric = -1;
6086
6087 if (!str2metric (argv[0], &metric))
6088 return CMD_WARNING;
6089
paul68980082003-03-25 05:07:42 +00006090 ospf->default_metric = metric;
paul718e3742002-12-13 20:15:29 +00006091
6092 return CMD_SUCCESS;
6093}
6094
6095DEFUN (no_ospf_default_metric,
6096 no_ospf_default_metric_cmd,
6097 "no default-metric",
6098 NO_STR
6099 "Set metric of redistributed routes\n")
6100{
paul68980082003-03-25 05:07:42 +00006101 struct ospf *ospf = vty->index;
6102
6103 ospf->default_metric = -1;
6104
paul718e3742002-12-13 20:15:29 +00006105 return CMD_SUCCESS;
6106}
6107
6108ALIAS (no_ospf_default_metric,
6109 no_ospf_default_metric_val_cmd,
6110 "no default-metric <0-16777214>",
6111 NO_STR
6112 "Set metric of redistributed routes\n"
6113 "Default metric\n")
6114
6115DEFUN (ospf_distance,
6116 ospf_distance_cmd,
6117 "distance <1-255>",
6118 "Define an administrative distance\n"
6119 "OSPF Administrative distance\n")
6120{
paul68980082003-03-25 05:07:42 +00006121 struct ospf *ospf = vty->index;
6122
6123 ospf->distance_all = atoi (argv[0]);
6124
paul718e3742002-12-13 20:15:29 +00006125 return CMD_SUCCESS;
6126}
6127
6128DEFUN (no_ospf_distance,
6129 no_ospf_distance_cmd,
6130 "no distance <1-255>",
6131 NO_STR
6132 "Define an administrative distance\n"
6133 "OSPF Administrative distance\n")
6134{
paul68980082003-03-25 05:07:42 +00006135 struct ospf *ospf = vty->index;
6136
6137 ospf->distance_all = 0;
6138
paul718e3742002-12-13 20:15:29 +00006139 return CMD_SUCCESS;
6140}
6141
6142DEFUN (no_ospf_distance_ospf,
6143 no_ospf_distance_ospf_cmd,
6144 "no distance ospf",
6145 NO_STR
6146 "Define an administrative distance\n"
6147 "OSPF Administrative distance\n"
6148 "OSPF Distance\n")
6149{
paul68980082003-03-25 05:07:42 +00006150 struct ospf *ospf = vty->index;
6151
6152 ospf->distance_intra = 0;
6153 ospf->distance_inter = 0;
6154 ospf->distance_external = 0;
6155
paul718e3742002-12-13 20:15:29 +00006156 return CMD_SUCCESS;
6157}
6158
6159DEFUN (ospf_distance_ospf_intra,
6160 ospf_distance_ospf_intra_cmd,
6161 "distance ospf intra-area <1-255>",
6162 "Define an administrative distance\n"
6163 "OSPF Administrative distance\n"
6164 "Intra-area routes\n"
6165 "Distance for intra-area routes\n")
6166{
paul68980082003-03-25 05:07:42 +00006167 struct ospf *ospf = vty->index;
6168
6169 ospf->distance_intra = atoi (argv[0]);
6170
paul718e3742002-12-13 20:15:29 +00006171 return CMD_SUCCESS;
6172}
6173
6174DEFUN (ospf_distance_ospf_intra_inter,
6175 ospf_distance_ospf_intra_inter_cmd,
6176 "distance ospf intra-area <1-255> inter-area <1-255>",
6177 "Define an administrative distance\n"
6178 "OSPF Administrative distance\n"
6179 "Intra-area routes\n"
6180 "Distance for intra-area routes\n"
6181 "Inter-area routes\n"
6182 "Distance for inter-area routes\n")
6183{
paul68980082003-03-25 05:07:42 +00006184 struct ospf *ospf = vty->index;
6185
6186 ospf->distance_intra = atoi (argv[0]);
6187 ospf->distance_inter = atoi (argv[1]);
6188
paul718e3742002-12-13 20:15:29 +00006189 return CMD_SUCCESS;
6190}
6191
6192DEFUN (ospf_distance_ospf_intra_external,
6193 ospf_distance_ospf_intra_external_cmd,
6194 "distance ospf intra-area <1-255> external <1-255>",
6195 "Define an administrative distance\n"
6196 "OSPF Administrative distance\n"
6197 "Intra-area routes\n"
6198 "Distance for intra-area routes\n"
6199 "External routes\n"
6200 "Distance for external routes\n")
6201{
paul68980082003-03-25 05:07:42 +00006202 struct ospf *ospf = vty->index;
6203
6204 ospf->distance_intra = atoi (argv[0]);
6205 ospf->distance_external = atoi (argv[1]);
6206
paul718e3742002-12-13 20:15:29 +00006207 return CMD_SUCCESS;
6208}
6209
6210DEFUN (ospf_distance_ospf_intra_inter_external,
6211 ospf_distance_ospf_intra_inter_external_cmd,
6212 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6213 "Define an administrative distance\n"
6214 "OSPF Administrative distance\n"
6215 "Intra-area routes\n"
6216 "Distance for intra-area routes\n"
6217 "Inter-area routes\n"
6218 "Distance for inter-area routes\n"
6219 "External routes\n"
6220 "Distance for external routes\n")
6221{
paul68980082003-03-25 05:07:42 +00006222 struct ospf *ospf = vty->index;
6223
6224 ospf->distance_intra = atoi (argv[0]);
6225 ospf->distance_inter = atoi (argv[1]);
6226 ospf->distance_external = atoi (argv[2]);
6227
paul718e3742002-12-13 20:15:29 +00006228 return CMD_SUCCESS;
6229}
6230
6231DEFUN (ospf_distance_ospf_intra_external_inter,
6232 ospf_distance_ospf_intra_external_inter_cmd,
6233 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6234 "Define an administrative distance\n"
6235 "OSPF Administrative distance\n"
6236 "Intra-area routes\n"
6237 "Distance for intra-area routes\n"
6238 "External routes\n"
6239 "Distance for external routes\n"
6240 "Inter-area routes\n"
6241 "Distance for inter-area routes\n")
6242{
paul68980082003-03-25 05:07:42 +00006243 struct ospf *ospf = vty->index;
6244
6245 ospf->distance_intra = atoi (argv[0]);
6246 ospf->distance_external = atoi (argv[1]);
6247 ospf->distance_inter = atoi (argv[2]);
6248
paul718e3742002-12-13 20:15:29 +00006249 return CMD_SUCCESS;
6250}
6251
6252DEFUN (ospf_distance_ospf_inter,
6253 ospf_distance_ospf_inter_cmd,
6254 "distance ospf inter-area <1-255>",
6255 "Define an administrative distance\n"
6256 "OSPF Administrative distance\n"
6257 "Inter-area routes\n"
6258 "Distance for inter-area routes\n")
6259{
paul68980082003-03-25 05:07:42 +00006260 struct ospf *ospf = vty->index;
6261
6262 ospf->distance_inter = atoi (argv[0]);
6263
paul718e3742002-12-13 20:15:29 +00006264 return CMD_SUCCESS;
6265}
6266
6267DEFUN (ospf_distance_ospf_inter_intra,
6268 ospf_distance_ospf_inter_intra_cmd,
6269 "distance ospf inter-area <1-255> intra-area <1-255>",
6270 "Define an administrative distance\n"
6271 "OSPF Administrative distance\n"
6272 "Inter-area routes\n"
6273 "Distance for inter-area routes\n"
6274 "Intra-area routes\n"
6275 "Distance for intra-area routes\n")
6276{
paul68980082003-03-25 05:07:42 +00006277 struct ospf *ospf = vty->index;
6278
6279 ospf->distance_inter = atoi (argv[0]);
6280 ospf->distance_intra = atoi (argv[1]);
6281
paul718e3742002-12-13 20:15:29 +00006282 return CMD_SUCCESS;
6283}
6284
6285DEFUN (ospf_distance_ospf_inter_external,
6286 ospf_distance_ospf_inter_external_cmd,
6287 "distance ospf inter-area <1-255> external <1-255>",
6288 "Define an administrative distance\n"
6289 "OSPF Administrative distance\n"
6290 "Inter-area routes\n"
6291 "Distance for inter-area routes\n"
6292 "External routes\n"
6293 "Distance for external routes\n")
6294{
paul68980082003-03-25 05:07:42 +00006295 struct ospf *ospf = vty->index;
6296
6297 ospf->distance_inter = atoi (argv[0]);
6298 ospf->distance_external = atoi (argv[1]);
6299
paul718e3742002-12-13 20:15:29 +00006300 return CMD_SUCCESS;
6301}
6302
6303DEFUN (ospf_distance_ospf_inter_intra_external,
6304 ospf_distance_ospf_inter_intra_external_cmd,
6305 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6306 "Define an administrative distance\n"
6307 "OSPF Administrative distance\n"
6308 "Inter-area routes\n"
6309 "Distance for inter-area routes\n"
6310 "Intra-area routes\n"
6311 "Distance for intra-area routes\n"
6312 "External routes\n"
6313 "Distance for external routes\n")
6314{
paul68980082003-03-25 05:07:42 +00006315 struct ospf *ospf = vty->index;
6316
6317 ospf->distance_inter = atoi (argv[0]);
6318 ospf->distance_intra = atoi (argv[1]);
6319 ospf->distance_external = atoi (argv[2]);
6320
paul718e3742002-12-13 20:15:29 +00006321 return CMD_SUCCESS;
6322}
6323
6324DEFUN (ospf_distance_ospf_inter_external_intra,
6325 ospf_distance_ospf_inter_external_intra_cmd,
6326 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6327 "Define an administrative distance\n"
6328 "OSPF Administrative distance\n"
6329 "Inter-area routes\n"
6330 "Distance for inter-area routes\n"
6331 "External routes\n"
6332 "Distance for external routes\n"
6333 "Intra-area routes\n"
6334 "Distance for intra-area routes\n")
6335{
paul68980082003-03-25 05:07:42 +00006336 struct ospf *ospf = vty->index;
6337
6338 ospf->distance_inter = atoi (argv[0]);
6339 ospf->distance_external = atoi (argv[1]);
6340 ospf->distance_intra = atoi (argv[2]);
6341
paul718e3742002-12-13 20:15:29 +00006342 return CMD_SUCCESS;
6343}
6344
6345DEFUN (ospf_distance_ospf_external,
6346 ospf_distance_ospf_external_cmd,
6347 "distance ospf external <1-255>",
6348 "Define an administrative distance\n"
6349 "OSPF Administrative distance\n"
6350 "External routes\n"
6351 "Distance for external routes\n")
6352{
paul68980082003-03-25 05:07:42 +00006353 struct ospf *ospf = vty->index;
6354
6355 ospf->distance_external = atoi (argv[0]);
6356
paul718e3742002-12-13 20:15:29 +00006357 return CMD_SUCCESS;
6358}
6359
6360DEFUN (ospf_distance_ospf_external_intra,
6361 ospf_distance_ospf_external_intra_cmd,
6362 "distance ospf external <1-255> intra-area <1-255>",
6363 "Define an administrative distance\n"
6364 "OSPF Administrative distance\n"
6365 "External routes\n"
6366 "Distance for external routes\n"
6367 "Intra-area routes\n"
6368 "Distance for intra-area routes\n")
6369{
paul68980082003-03-25 05:07:42 +00006370 struct ospf *ospf = vty->index;
6371
6372 ospf->distance_external = atoi (argv[0]);
6373 ospf->distance_intra = atoi (argv[1]);
6374
paul718e3742002-12-13 20:15:29 +00006375 return CMD_SUCCESS;
6376}
6377
6378DEFUN (ospf_distance_ospf_external_inter,
6379 ospf_distance_ospf_external_inter_cmd,
6380 "distance ospf external <1-255> inter-area <1-255>",
6381 "Define an administrative distance\n"
6382 "OSPF Administrative distance\n"
6383 "External routes\n"
6384 "Distance for external routes\n"
6385 "Inter-area routes\n"
6386 "Distance for inter-area routes\n")
6387{
paul68980082003-03-25 05:07:42 +00006388 struct ospf *ospf = vty->index;
6389
6390 ospf->distance_external = atoi (argv[0]);
6391 ospf->distance_inter = atoi (argv[1]);
6392
paul718e3742002-12-13 20:15:29 +00006393 return CMD_SUCCESS;
6394}
6395
6396DEFUN (ospf_distance_ospf_external_intra_inter,
6397 ospf_distance_ospf_external_intra_inter_cmd,
6398 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6399 "Define an administrative distance\n"
6400 "OSPF Administrative distance\n"
6401 "External routes\n"
6402 "Distance for external routes\n"
6403 "Intra-area routes\n"
6404 "Distance for intra-area routes\n"
6405 "Inter-area routes\n"
6406 "Distance for inter-area routes\n")
6407{
paul68980082003-03-25 05:07:42 +00006408 struct ospf *ospf = vty->index;
6409
6410 ospf->distance_external = atoi (argv[0]);
6411 ospf->distance_intra = atoi (argv[1]);
6412 ospf->distance_inter = atoi (argv[2]);
6413
paul718e3742002-12-13 20:15:29 +00006414 return CMD_SUCCESS;
6415}
6416
6417DEFUN (ospf_distance_ospf_external_inter_intra,
6418 ospf_distance_ospf_external_inter_intra_cmd,
6419 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6420 "Define an administrative distance\n"
6421 "OSPF Administrative distance\n"
6422 "External routes\n"
6423 "Distance for external routes\n"
6424 "Inter-area routes\n"
6425 "Distance for inter-area routes\n"
6426 "Intra-area routes\n"
6427 "Distance for intra-area routes\n")
6428{
paul68980082003-03-25 05:07:42 +00006429 struct ospf *ospf = vty->index;
6430
6431 ospf->distance_external = atoi (argv[0]);
6432 ospf->distance_inter = atoi (argv[1]);
6433 ospf->distance_intra = atoi (argv[2]);
6434
paul718e3742002-12-13 20:15:29 +00006435 return CMD_SUCCESS;
6436}
6437
6438DEFUN (ospf_distance_source,
6439 ospf_distance_source_cmd,
6440 "distance <1-255> A.B.C.D/M",
6441 "Administrative distance\n"
6442 "Distance value\n"
6443 "IP source prefix\n")
6444{
paul020709f2003-04-04 02:44:16 +00006445 struct ospf *ospf = vty->index;
6446
6447 ospf_distance_set (vty, ospf, argv[0], argv[1], NULL);
paul68980082003-03-25 05:07:42 +00006448
paul718e3742002-12-13 20:15:29 +00006449 return CMD_SUCCESS;
6450}
6451
6452DEFUN (no_ospf_distance_source,
6453 no_ospf_distance_source_cmd,
6454 "no distance <1-255> A.B.C.D/M",
6455 NO_STR
6456 "Administrative distance\n"
6457 "Distance value\n"
6458 "IP source prefix\n")
6459{
paul020709f2003-04-04 02:44:16 +00006460 struct ospf *ospf = vty->index;
6461
6462 ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL);
6463
paul718e3742002-12-13 20:15:29 +00006464 return CMD_SUCCESS;
6465}
6466
6467DEFUN (ospf_distance_source_access_list,
6468 ospf_distance_source_access_list_cmd,
6469 "distance <1-255> A.B.C.D/M WORD",
6470 "Administrative distance\n"
6471 "Distance value\n"
6472 "IP source prefix\n"
6473 "Access list name\n")
6474{
paul020709f2003-04-04 02:44:16 +00006475 struct ospf *ospf = vty->index;
6476
6477 ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]);
6478
paul718e3742002-12-13 20:15:29 +00006479 return CMD_SUCCESS;
6480}
6481
6482DEFUN (no_ospf_distance_source_access_list,
6483 no_ospf_distance_source_access_list_cmd,
6484 "no distance <1-255> A.B.C.D/M WORD",
6485 NO_STR
6486 "Administrative distance\n"
6487 "Distance value\n"
6488 "IP source prefix\n"
6489 "Access list name\n")
6490{
paul020709f2003-04-04 02:44:16 +00006491 struct ospf *ospf = vty->index;
6492
6493 ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]);
6494
paul718e3742002-12-13 20:15:29 +00006495 return CMD_SUCCESS;
6496}
6497
paul4dadc292005-05-06 21:37:42 +00006498static void
paul718e3742002-12-13 20:15:29 +00006499show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
6500{
6501 struct route_node *rn;
6502 struct ospf_route *or;
paul1eb8ef22005-04-07 07:30:20 +00006503 struct listnode *pnode, *pnnode;
paul718e3742002-12-13 20:15:29 +00006504 struct ospf_path *path;
6505
6506 vty_out (vty, "============ OSPF network routing table ============%s",
6507 VTY_NEWLINE);
6508
6509 for (rn = route_top (rt); rn; rn = route_next (rn))
6510 if ((or = rn->info) != NULL)
6511 {
6512 char buf1[19];
6513 snprintf (buf1, 19, "%s/%d",
6514 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
6515
6516 switch (or->path_type)
6517 {
6518 case OSPF_PATH_INTER_AREA:
6519 if (or->type == OSPF_DESTINATION_NETWORK)
6520 vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost,
6521 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
6522 else if (or->type == OSPF_DESTINATION_DISCARD)
6523 vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE);
6524 break;
6525 case OSPF_PATH_INTRA_AREA:
6526 vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost,
6527 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
6528 break;
6529 default:
6530 break;
6531 }
6532
6533 if (or->type == OSPF_DESTINATION_NETWORK)
paul1eb8ef22005-04-07 07:30:20 +00006534 for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path))
paul96735ee2003-08-10 02:51:22 +00006535 {
hasso54bedb52005-08-17 13:31:47 +00006536 if (path->oi != NULL && ospf_if_exists(path->oi))
paul96735ee2003-08-10 02:51:22 +00006537 {
6538 if (path->nexthop.s_addr == 0)
6539 vty_out (vty, "%24s directly attached to %s%s",
6540 "", path->oi->ifp->name, VTY_NEWLINE);
6541 else
6542 vty_out (vty, "%24s via %s, %s%s", "",
6543 inet_ntoa (path->nexthop), path->oi->ifp->name,
6544 VTY_NEWLINE);
6545 }
6546 }
paul718e3742002-12-13 20:15:29 +00006547 }
6548 vty_out (vty, "%s", VTY_NEWLINE);
6549}
6550
paul4dadc292005-05-06 21:37:42 +00006551static void
paul718e3742002-12-13 20:15:29 +00006552show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs)
6553{
6554 struct route_node *rn;
6555 struct ospf_route *or;
paul1eb8ef22005-04-07 07:30:20 +00006556 struct listnode *pnode;
6557 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00006558 struct ospf_path *path;
6559
6560 vty_out (vty, "============ OSPF router routing table =============%s",
6561 VTY_NEWLINE);
6562 for (rn = route_top (rtrs); rn; rn = route_next (rn))
6563 if (rn->info)
6564 {
6565 int flag = 0;
6566
6567 vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4));
6568
paul1eb8ef22005-04-07 07:30:20 +00006569 for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or))
6570 {
6571 if (flag++)
6572 vty_out (vty, "%24s", "");
paul718e3742002-12-13 20:15:29 +00006573
paul1eb8ef22005-04-07 07:30:20 +00006574 /* Show path. */
6575 vty_out (vty, "%s [%d] area: %s",
6576 (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "),
6577 or->cost, inet_ntoa (or->u.std.area_id));
6578 /* Show flags. */
6579 vty_out (vty, "%s%s%s",
6580 (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""),
6581 (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""),
6582 VTY_NEWLINE);
6583
6584 for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
6585 {
hasso54bedb52005-08-17 13:31:47 +00006586 if (path->oi != NULL && ospf_if_exists(path->oi))
6587 {
6588 if (path->nexthop.s_addr == 0)
6589 vty_out (vty, "%24s directly attached to %s%s",
6590 "", path->oi->ifp->name, VTY_NEWLINE);
6591 else
6592 vty_out (vty, "%24s via %s, %s%s", "",
6593 inet_ntoa (path->nexthop),
6594 path->oi->ifp->name, VTY_NEWLINE);
6595 }
paul1eb8ef22005-04-07 07:30:20 +00006596 }
6597 }
paul718e3742002-12-13 20:15:29 +00006598 }
6599 vty_out (vty, "%s", VTY_NEWLINE);
6600}
6601
paul4dadc292005-05-06 21:37:42 +00006602static void
paul718e3742002-12-13 20:15:29 +00006603show_ip_ospf_route_external (struct vty *vty, struct route_table *rt)
6604{
6605 struct route_node *rn;
6606 struct ospf_route *er;
paul1eb8ef22005-04-07 07:30:20 +00006607 struct listnode *pnode, *pnnode;
paul718e3742002-12-13 20:15:29 +00006608 struct ospf_path *path;
6609
6610 vty_out (vty, "============ OSPF external routing table ===========%s",
6611 VTY_NEWLINE);
6612 for (rn = route_top (rt); rn; rn = route_next (rn))
6613 if ((er = rn->info) != NULL)
6614 {
6615 char buf1[19];
6616 snprintf (buf1, 19, "%s/%d",
6617 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
6618
6619 switch (er->path_type)
6620 {
6621 case OSPF_PATH_TYPE1_EXTERNAL:
6622 vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
6623 er->cost, er->u.ext.tag, VTY_NEWLINE);
6624 break;
6625 case OSPF_PATH_TYPE2_EXTERNAL:
6626 vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
6627 er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
6628 break;
6629 }
6630
paul1eb8ef22005-04-07 07:30:20 +00006631 for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path))
paul718e3742002-12-13 20:15:29 +00006632 {
hasso54bedb52005-08-17 13:31:47 +00006633 if (path->oi != NULL && ospf_if_exists(path->oi))
paul718e3742002-12-13 20:15:29 +00006634 {
6635 if (path->nexthop.s_addr == 0)
paul96735ee2003-08-10 02:51:22 +00006636 vty_out (vty, "%24s directly attached to %s%s",
6637 "", path->oi->ifp->name, VTY_NEWLINE);
6638 else
6639 vty_out (vty, "%24s via %s, %s%s", "",
6640 inet_ntoa (path->nexthop), path->oi->ifp->name,
6641 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00006642 }
6643 }
6644 }
6645 vty_out (vty, "%s", VTY_NEWLINE);
6646}
6647
paul718e3742002-12-13 20:15:29 +00006648DEFUN (show_ip_ospf_border_routers,
6649 show_ip_ospf_border_routers_cmd,
6650 "show ip ospf border-routers",
6651 SHOW_STR
6652 IP_STR
6653 "show all the ABR's and ASBR's\n"
6654 "for this area\n")
6655{
paul020709f2003-04-04 02:44:16 +00006656 struct ospf *ospf;
paul68980082003-03-25 05:07:42 +00006657
paul020709f2003-04-04 02:44:16 +00006658 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00006659 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00006660 {
6661 vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
6662 return CMD_SUCCESS;
6663 }
6664
paul68980082003-03-25 05:07:42 +00006665 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00006666 {
6667 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
6668 return CMD_SUCCESS;
6669 }
6670
6671 /* Show Network routes.
paul020709f2003-04-04 02:44:16 +00006672 show_ip_ospf_route_network (vty, ospf->new_table); */
paul718e3742002-12-13 20:15:29 +00006673
6674 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00006675 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00006676
6677 return CMD_SUCCESS;
6678}
paul718e3742002-12-13 20:15:29 +00006679
6680DEFUN (show_ip_ospf_route,
6681 show_ip_ospf_route_cmd,
6682 "show ip ospf route",
6683 SHOW_STR
6684 IP_STR
6685 "OSPF information\n"
6686 "OSPF routing table\n")
6687{
paul020709f2003-04-04 02:44:16 +00006688 struct ospf *ospf;
paul68980082003-03-25 05:07:42 +00006689
paul020709f2003-04-04 02:44:16 +00006690 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00006691 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00006692 {
6693 vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE);
6694 return CMD_SUCCESS;
6695 }
6696
paul68980082003-03-25 05:07:42 +00006697 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00006698 {
6699 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
6700 return CMD_SUCCESS;
6701 }
6702
6703 /* Show Network routes. */
paul68980082003-03-25 05:07:42 +00006704 show_ip_ospf_route_network (vty, ospf->new_table);
paul718e3742002-12-13 20:15:29 +00006705
6706 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00006707 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00006708
6709 /* Show AS External routes. */
paul68980082003-03-25 05:07:42 +00006710 show_ip_ospf_route_external (vty, ospf->old_external_route);
paul718e3742002-12-13 20:15:29 +00006711
6712 return CMD_SUCCESS;
6713}
6714
6715
hassoeb1ce602004-10-08 08:17:22 +00006716const char *ospf_abr_type_str[] =
paul718e3742002-12-13 20:15:29 +00006717{
6718 "unknown",
6719 "standard",
6720 "ibm",
6721 "cisco",
6722 "shortcut"
6723};
6724
hassoeb1ce602004-10-08 08:17:22 +00006725const char *ospf_shortcut_mode_str[] =
paul718e3742002-12-13 20:15:29 +00006726{
6727 "default",
6728 "enable",
6729 "disable"
6730};
6731
6732
paul4dadc292005-05-06 21:37:42 +00006733static void
paul718e3742002-12-13 20:15:29 +00006734area_id2str (char *buf, int length, struct ospf_area *area)
6735{
6736 memset (buf, 0, length);
6737
6738 if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS)
6739 strncpy (buf, inet_ntoa (area->area_id), length);
6740 else
6741 sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));
6742}
6743
6744
hassoeb1ce602004-10-08 08:17:22 +00006745const char *ospf_int_type_str[] =
paul718e3742002-12-13 20:15:29 +00006746{
6747 "unknown", /* should never be used. */
6748 "point-to-point",
6749 "broadcast",
6750 "non-broadcast",
6751 "point-to-multipoint",
6752 "virtual-link", /* should never be used. */
6753 "loopback"
6754};
6755
6756/* Configuration write function for ospfd. */
paul4dadc292005-05-06 21:37:42 +00006757static int
paul718e3742002-12-13 20:15:29 +00006758config_write_interface (struct vty *vty)
6759{
hasso52dc7ee2004-09-23 19:18:23 +00006760 struct listnode *n1, *n2;
paul718e3742002-12-13 20:15:29 +00006761 struct interface *ifp;
6762 struct crypt_key *ck;
6763 int write = 0;
6764 struct route_node *rn = NULL;
6765 struct ospf_if_params *params;
6766
paul1eb8ef22005-04-07 07:30:20 +00006767 for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp))
paul718e3742002-12-13 20:15:29 +00006768 {
paul718e3742002-12-13 20:15:29 +00006769 if (memcmp (ifp->name, "VLINK", 5) == 0)
6770 continue;
6771
6772 vty_out (vty, "!%s", VTY_NEWLINE);
6773 vty_out (vty, "interface %s%s", ifp->name,
6774 VTY_NEWLINE);
6775 if (ifp->desc)
6776 vty_out (vty, " description %s%s", ifp->desc,
6777 VTY_NEWLINE);
6778
6779 write++;
6780
6781 params = IF_DEF_PARAMS (ifp);
6782
6783 do {
6784 /* Interface Network print. */
6785 if (OSPF_IF_PARAM_CONFIGURED (params, type) &&
paul718e3742002-12-13 20:15:29 +00006786 params->type != OSPF_IFTYPE_LOOPBACK)
6787 {
ajsbc18d612004-12-15 15:07:19 +00006788 if (params->type != ospf_default_iftype(ifp))
hasso7b901432004-08-31 13:37:42 +00006789 {
6790 vty_out (vty, " ip ospf network %s",
6791 ospf_int_type_str[params->type]);
6792 if (params != IF_DEF_PARAMS (ifp))
6793 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6794 vty_out (vty, "%s", VTY_NEWLINE);
6795 }
paul718e3742002-12-13 20:15:29 +00006796 }
6797
6798 /* OSPF interface authentication print */
6799 if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) &&
6800 params->auth_type != OSPF_AUTH_NOTSET)
6801 {
hassoeb1ce602004-10-08 08:17:22 +00006802 const char *auth_str;
paul718e3742002-12-13 20:15:29 +00006803
6804 /* Translation tables are not that much help here due to syntax
6805 of the simple option */
6806 switch (params->auth_type)
6807 {
6808
6809 case OSPF_AUTH_NULL:
6810 auth_str = " null";
6811 break;
6812
6813 case OSPF_AUTH_SIMPLE:
6814 auth_str = "";
6815 break;
6816
6817 case OSPF_AUTH_CRYPTOGRAPHIC:
6818 auth_str = " message-digest";
6819 break;
6820
6821 default:
6822 auth_str = "";
6823 break;
6824 }
6825
6826 vty_out (vty, " ip ospf authentication%s", auth_str);
6827 if (params != IF_DEF_PARAMS (ifp))
6828 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6829 vty_out (vty, "%s", VTY_NEWLINE);
6830 }
6831
6832 /* Simple Authentication Password print. */
6833 if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) &&
6834 params->auth_simple[0] != '\0')
6835 {
6836 vty_out (vty, " ip ospf authentication-key %s",
6837 params->auth_simple);
6838 if (params != IF_DEF_PARAMS (ifp))
6839 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6840 vty_out (vty, "%s", VTY_NEWLINE);
6841 }
6842
6843 /* Cryptographic Authentication Key print. */
paul1eb8ef22005-04-07 07:30:20 +00006844 for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck))
paul718e3742002-12-13 20:15:29 +00006845 {
paul718e3742002-12-13 20:15:29 +00006846 vty_out (vty, " ip ospf message-digest-key %d md5 %s",
6847 ck->key_id, ck->auth_key);
6848 if (params != IF_DEF_PARAMS (ifp))
6849 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6850 vty_out (vty, "%s", VTY_NEWLINE);
6851 }
6852
6853 /* Interface Output Cost print. */
6854 if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd))
6855 {
6856 vty_out (vty, " ip ospf cost %u", params->output_cost_cmd);
6857 if (params != IF_DEF_PARAMS (ifp))
6858 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6859 vty_out (vty, "%s", VTY_NEWLINE);
6860 }
6861
6862 /* Hello Interval print. */
6863 if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) &&
6864 params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT)
6865 {
6866 vty_out (vty, " ip ospf hello-interval %u", params->v_hello);
6867 if (params != IF_DEF_PARAMS (ifp))
6868 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6869 vty_out (vty, "%s", VTY_NEWLINE);
6870 }
6871
6872
6873 /* Router Dead Interval print. */
6874 if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
6875 params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
6876 {
6877 vty_out (vty, " ip ospf dead-interval %u", params->v_wait);
6878 if (params != IF_DEF_PARAMS (ifp))
6879 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6880 vty_out (vty, "%s", VTY_NEWLINE);
6881 }
6882
6883 /* Router Priority print. */
6884 if (OSPF_IF_PARAM_CONFIGURED (params, priority) &&
6885 params->priority != OSPF_ROUTER_PRIORITY_DEFAULT)
6886 {
6887 vty_out (vty, " ip ospf priority %u", params->priority);
6888 if (params != IF_DEF_PARAMS (ifp))
6889 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6890 vty_out (vty, "%s", VTY_NEWLINE);
6891 }
6892
6893 /* Retransmit Interval print. */
6894 if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) &&
6895 params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT)
6896 {
6897 vty_out (vty, " ip ospf retransmit-interval %u",
6898 params->retransmit_interval);
6899 if (params != IF_DEF_PARAMS (ifp))
6900 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6901 vty_out (vty, "%s", VTY_NEWLINE);
6902 }
6903
6904 /* Transmit Delay print. */
6905 if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) &&
6906 params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT)
6907 {
6908 vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay);
6909 if (params != IF_DEF_PARAMS (ifp))
6910 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
6911 vty_out (vty, "%s", VTY_NEWLINE);
6912 }
6913
6914 while (1)
6915 {
6916 if (rn == NULL)
6917 rn = route_top (IF_OIFS_PARAMS (ifp));
6918 else
6919 rn = route_next (rn);
6920
6921 if (rn == NULL)
6922 break;
6923 params = rn->info;
6924 if (params != NULL)
6925 break;
6926 }
6927 } while (rn);
6928
6929#ifdef HAVE_OPAQUE_LSA
6930 ospf_opaque_config_write_if (vty, ifp);
6931#endif /* HAVE_OPAQUE_LSA */
6932 }
6933
6934 return write;
6935}
6936
paul4dadc292005-05-06 21:37:42 +00006937static int
paul68980082003-03-25 05:07:42 +00006938config_write_network_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006939{
6940 struct route_node *rn;
6941 u_char buf[INET_ADDRSTRLEN];
6942
6943 /* `network area' print. */
paul68980082003-03-25 05:07:42 +00006944 for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00006945 if (rn->info)
6946 {
6947 struct ospf_network *n = rn->info;
6948
6949 memset (buf, 0, INET_ADDRSTRLEN);
6950
6951 /* Create Area ID string by specified Area ID format. */
6952 if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS)
hassoc9e52be2004-09-26 16:09:34 +00006953 strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN);
paul718e3742002-12-13 20:15:29 +00006954 else
hassoc9e52be2004-09-26 16:09:34 +00006955 sprintf ((char *) buf, "%lu",
paul718e3742002-12-13 20:15:29 +00006956 (unsigned long int) ntohl (n->area_id.s_addr));
6957
6958 /* Network print. */
6959 vty_out (vty, " network %s/%d area %s%s",
6960 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
6961 buf, VTY_NEWLINE);
6962 }
6963
6964 return 0;
6965}
6966
paul4dadc292005-05-06 21:37:42 +00006967static int
paul68980082003-03-25 05:07:42 +00006968config_write_ospf_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00006969{
hasso52dc7ee2004-09-23 19:18:23 +00006970 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00006971 struct ospf_area *area;
paul718e3742002-12-13 20:15:29 +00006972 u_char buf[INET_ADDRSTRLEN];
6973
6974 /* Area configuration print. */
paul1eb8ef22005-04-07 07:30:20 +00006975 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00006976 {
paul718e3742002-12-13 20:15:29 +00006977 struct route_node *rn1;
6978
hassoc9e52be2004-09-26 16:09:34 +00006979 area_id2str ((char *) buf, INET_ADDRSTRLEN, area);
paul718e3742002-12-13 20:15:29 +00006980
6981 if (area->auth_type != OSPF_AUTH_NULL)
6982 {
6983 if (area->auth_type == OSPF_AUTH_SIMPLE)
6984 vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE);
6985 else
6986 vty_out (vty, " area %s authentication message-digest%s",
6987 buf, VTY_NEWLINE);
6988 }
6989
6990 if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT)
6991 vty_out (vty, " area %s shortcut %s%s", buf,
6992 ospf_shortcut_mode_str[area->shortcut_configured],
6993 VTY_NEWLINE);
6994
6995 if ((area->external_routing == OSPF_AREA_STUB)
paul718e3742002-12-13 20:15:29 +00006996 || (area->external_routing == OSPF_AREA_NSSA)
paul718e3742002-12-13 20:15:29 +00006997 )
6998 {
paulb0a053b2003-06-22 09:04:47 +00006999 if (area->external_routing == OSPF_AREA_STUB)
paul718e3742002-12-13 20:15:29 +00007000 vty_out (vty, " area %s stub", buf);
paulb0a053b2003-06-22 09:04:47 +00007001 else if (area->external_routing == OSPF_AREA_NSSA)
7002 {
7003 vty_out (vty, " area %s nssa", buf);
7004 switch (area->NSSATranslatorRole)
7005 {
7006 case OSPF_NSSA_ROLE_NEVER:
7007 vty_out (vty, " translate-never");
7008 break;
7009 case OSPF_NSSA_ROLE_ALWAYS:
7010 vty_out (vty, " translate-always");
7011 break;
7012 case OSPF_NSSA_ROLE_CANDIDATE:
7013 default:
7014 vty_out (vty, " translate-candidate");
7015 }
7016 }
paul718e3742002-12-13 20:15:29 +00007017
7018 if (area->no_summary)
7019 vty_out (vty, " no-summary");
7020
7021 vty_out (vty, "%s", VTY_NEWLINE);
7022
7023 if (area->default_cost != 1)
7024 vty_out (vty, " area %s default-cost %d%s", buf,
7025 area->default_cost, VTY_NEWLINE);
7026 }
7027
7028 for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1))
7029 if (rn1->info)
7030 {
7031 struct ospf_area_range *range = rn1->info;
7032
7033 vty_out (vty, " area %s range %s/%d", buf,
7034 inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen);
7035
paul6c835672004-10-11 11:00:30 +00007036 if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC)
paul718e3742002-12-13 20:15:29 +00007037 vty_out (vty, " cost %d", range->cost_config);
7038
7039 if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
7040 vty_out (vty, " not-advertise");
7041
7042 if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE))
7043 vty_out (vty, " substitute %s/%d",
7044 inet_ntoa (range->subst_addr), range->subst_masklen);
7045
7046 vty_out (vty, "%s", VTY_NEWLINE);
7047 }
7048
7049 if (EXPORT_NAME (area))
7050 vty_out (vty, " area %s export-list %s%s", buf,
7051 EXPORT_NAME (area), VTY_NEWLINE);
7052
7053 if (IMPORT_NAME (area))
7054 vty_out (vty, " area %s import-list %s%s", buf,
7055 IMPORT_NAME (area), VTY_NEWLINE);
7056
7057 if (PREFIX_NAME_IN (area))
7058 vty_out (vty, " area %s filter-list prefix %s in%s", buf,
7059 PREFIX_NAME_IN (area), VTY_NEWLINE);
7060
7061 if (PREFIX_NAME_OUT (area))
7062 vty_out (vty, " area %s filter-list prefix %s out%s", buf,
7063 PREFIX_NAME_OUT (area), VTY_NEWLINE);
7064 }
7065
7066 return 0;
7067}
7068
paul4dadc292005-05-06 21:37:42 +00007069static int
paul68980082003-03-25 05:07:42 +00007070config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007071{
7072 struct ospf_nbr_nbma *nbr_nbma;
7073 struct route_node *rn;
7074
7075 /* Static Neighbor configuration print. */
paul68980082003-03-25 05:07:42 +00007076 for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007077 if ((nbr_nbma = rn->info))
7078 {
7079 vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr));
7080
7081 if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT)
7082 vty_out (vty, " priority %d", nbr_nbma->priority);
7083
7084 if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
7085 vty_out (vty, " poll-interval %d", nbr_nbma->v_poll);
7086
7087 vty_out (vty, "%s", VTY_NEWLINE);
7088 }
7089
7090 return 0;
7091}
7092
paul4dadc292005-05-06 21:37:42 +00007093static int
paul68980082003-03-25 05:07:42 +00007094config_write_virtual_link (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007095{
hasso52dc7ee2004-09-23 19:18:23 +00007096 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00007097 struct ospf_vl_data *vl_data;
paul718e3742002-12-13 20:15:29 +00007098 u_char buf[INET_ADDRSTRLEN];
7099
7100 /* Virtual-Link print */
paul1eb8ef22005-04-07 07:30:20 +00007101 for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data))
paul718e3742002-12-13 20:15:29 +00007102 {
hasso52dc7ee2004-09-23 19:18:23 +00007103 struct listnode *n2;
paul718e3742002-12-13 20:15:29 +00007104 struct crypt_key *ck;
paul718e3742002-12-13 20:15:29 +00007105 struct ospf_interface *oi;
7106
7107 if (vl_data != NULL)
7108 {
7109 memset (buf, 0, INET_ADDRSTRLEN);
7110
7111 if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS)
hassoc9e52be2004-09-26 16:09:34 +00007112 strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN);
paul718e3742002-12-13 20:15:29 +00007113 else
hassoc9e52be2004-09-26 16:09:34 +00007114 sprintf ((char *) buf, "%lu",
paul718e3742002-12-13 20:15:29 +00007115 (unsigned long int) ntohl (vl_data->vl_area_id.s_addr));
7116 oi = vl_data->vl_oi;
7117
7118 /* timers */
7119 if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT ||
7120 OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT ||
7121 OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT ||
7122 OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT)
7123 vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7124 buf,
7125 inet_ntoa (vl_data->vl_peer),
7126 OSPF_IF_PARAM (oi, v_hello),
7127 OSPF_IF_PARAM (oi, retransmit_interval),
7128 OSPF_IF_PARAM (oi, transmit_delay),
7129 OSPF_IF_PARAM (oi, v_wait),
7130 VTY_NEWLINE);
7131 else
7132 vty_out (vty, " area %s virtual-link %s%s", buf,
7133 inet_ntoa (vl_data->vl_peer), VTY_NEWLINE);
7134 /* Auth key */
7135 if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0')
7136 vty_out (vty, " area %s virtual-link %s authentication-key %s%s",
7137 buf,
7138 inet_ntoa (vl_data->vl_peer),
7139 IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple,
7140 VTY_NEWLINE);
7141 /* md5 keys */
paul1eb8ef22005-04-07 07:30:20 +00007142 for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt,
7143 n2, ck))
7144 vty_out (vty, " area %s virtual-link %s"
7145 " message-digest-key %d md5 %s%s",
7146 buf,
7147 inet_ntoa (vl_data->vl_peer),
7148 ck->key_id, ck->auth_key, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007149
7150 }
7151 }
7152
7153 return 0;
7154}
7155
7156
hassoeb1ce602004-10-08 08:17:22 +00007157const char *distribute_str[] = { "system", "kernel", "connected", "static",
7158 "rip", "ripng", "ospf", "ospf6", "isis", "bgp"};
paul4dadc292005-05-06 21:37:42 +00007159static int
paul68980082003-03-25 05:07:42 +00007160config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007161{
7162 int type;
7163
7164 /* redistribute print. */
7165 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
7166 if (type != zclient->redist_default && zclient->redist[type])
7167 {
7168 vty_out (vty, " redistribute %s", distribute_str[type]);
paul68980082003-03-25 05:07:42 +00007169 if (ospf->dmetric[type].value >= 0)
paul020709f2003-04-04 02:44:16 +00007170 vty_out (vty, " metric %d", ospf->dmetric[type].value);
paul718e3742002-12-13 20:15:29 +00007171
paul68980082003-03-25 05:07:42 +00007172 if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007173 vty_out (vty, " metric-type 1");
7174
paul020709f2003-04-04 02:44:16 +00007175 if (ROUTEMAP_NAME (ospf, type))
7176 vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type));
paul718e3742002-12-13 20:15:29 +00007177
7178 vty_out (vty, "%s", VTY_NEWLINE);
7179 }
7180
7181 return 0;
7182}
7183
paul4dadc292005-05-06 21:37:42 +00007184static int
paul68980082003-03-25 05:07:42 +00007185config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007186{
paul68980082003-03-25 05:07:42 +00007187 if (ospf->default_metric != -1)
7188 vty_out (vty, " default-metric %d%s", ospf->default_metric,
paul718e3742002-12-13 20:15:29 +00007189 VTY_NEWLINE);
7190 return 0;
7191}
7192
paul4dadc292005-05-06 21:37:42 +00007193static int
paul68980082003-03-25 05:07:42 +00007194config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007195{
7196 int type;
7197
paul68980082003-03-25 05:07:42 +00007198 if (ospf)
paul718e3742002-12-13 20:15:29 +00007199 {
7200 /* distribute-list print. */
7201 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
paul68980082003-03-25 05:07:42 +00007202 if (ospf->dlist[type].name)
paul718e3742002-12-13 20:15:29 +00007203 vty_out (vty, " distribute-list %s out %s%s",
paul68980082003-03-25 05:07:42 +00007204 ospf->dlist[type].name,
paul718e3742002-12-13 20:15:29 +00007205 distribute_str[type], VTY_NEWLINE);
7206
7207 /* default-information print. */
paul68980082003-03-25 05:07:42 +00007208 if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
paul718e3742002-12-13 20:15:29 +00007209 {
paul68980082003-03-25 05:07:42 +00007210 if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA)
paul718e3742002-12-13 20:15:29 +00007211 vty_out (vty, " default-information originate");
7212 else
7213 vty_out (vty, " default-information originate always");
7214
paul68980082003-03-25 05:07:42 +00007215 if (ospf->dmetric[DEFAULT_ROUTE].value >= 0)
paul718e3742002-12-13 20:15:29 +00007216 vty_out (vty, " metric %d",
paul68980082003-03-25 05:07:42 +00007217 ospf->dmetric[DEFAULT_ROUTE].value);
7218 if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007219 vty_out (vty, " metric-type 1");
7220
paul020709f2003-04-04 02:44:16 +00007221 if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE))
7222 vty_out (vty, " route-map %s",
7223 ROUTEMAP_NAME (ospf, DEFAULT_ROUTE));
paul718e3742002-12-13 20:15:29 +00007224
7225 vty_out (vty, "%s", VTY_NEWLINE);
7226 }
7227
7228 }
7229
7230 return 0;
7231}
7232
paul4dadc292005-05-06 21:37:42 +00007233static int
paul68980082003-03-25 05:07:42 +00007234config_write_ospf_distance (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007235{
7236 struct route_node *rn;
7237 struct ospf_distance *odistance;
7238
paul68980082003-03-25 05:07:42 +00007239 if (ospf->distance_all)
7240 vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007241
paul68980082003-03-25 05:07:42 +00007242 if (ospf->distance_intra
7243 || ospf->distance_inter
7244 || ospf->distance_external)
paul718e3742002-12-13 20:15:29 +00007245 {
7246 vty_out (vty, " distance ospf");
7247
paul68980082003-03-25 05:07:42 +00007248 if (ospf->distance_intra)
7249 vty_out (vty, " intra-area %d", ospf->distance_intra);
7250 if (ospf->distance_inter)
7251 vty_out (vty, " inter-area %d", ospf->distance_inter);
7252 if (ospf->distance_external)
7253 vty_out (vty, " external %d", ospf->distance_external);
paul718e3742002-12-13 20:15:29 +00007254
7255 vty_out (vty, "%s", VTY_NEWLINE);
7256 }
7257
paul68980082003-03-25 05:07:42 +00007258 for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007259 if ((odistance = rn->info) != NULL)
7260 {
7261 vty_out (vty, " distance %d %s/%d %s%s", odistance->distance,
7262 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
7263 odistance->access_list ? odistance->access_list : "",
7264 VTY_NEWLINE);
7265 }
7266 return 0;
7267}
7268
7269/* OSPF configuration write function. */
paul4dadc292005-05-06 21:37:42 +00007270static int
paul718e3742002-12-13 20:15:29 +00007271ospf_config_write (struct vty *vty)
7272{
paul020709f2003-04-04 02:44:16 +00007273 struct ospf *ospf;
paul1eb8ef22005-04-07 07:30:20 +00007274 struct interface *ifp;
7275 struct ospf_interface *oi;
hasso52dc7ee2004-09-23 19:18:23 +00007276 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00007277 int write = 0;
7278
paul020709f2003-04-04 02:44:16 +00007279 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00007280 if (ospf != NULL)
paul718e3742002-12-13 20:15:29 +00007281 {
7282 /* `router ospf' print. */
7283 vty_out (vty, "router ospf%s", VTY_NEWLINE);
7284
7285 write++;
7286
paul68980082003-03-25 05:07:42 +00007287 if (!ospf->networks)
paul718e3742002-12-13 20:15:29 +00007288 return write;
7289
7290 /* Router ID print. */
paul68980082003-03-25 05:07:42 +00007291 if (ospf->router_id_static.s_addr != 0)
paul718e3742002-12-13 20:15:29 +00007292 vty_out (vty, " ospf router-id %s%s",
paul68980082003-03-25 05:07:42 +00007293 inet_ntoa (ospf->router_id_static), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007294
7295 /* ABR type print. */
pauld57834f2005-07-12 20:04:22 +00007296 if (ospf->abr_type != OSPF_ABR_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007297 vty_out (vty, " ospf abr-type %s%s",
paul68980082003-03-25 05:07:42 +00007298 ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007299
7300 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
paul68980082003-03-25 05:07:42 +00007301 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
paul718e3742002-12-13 20:15:29 +00007302 vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE);
7303
7304 /* auto-cost reference-bandwidth configuration. */
paul68980082003-03-25 05:07:42 +00007305 if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00007306 vty_out (vty, " auto-cost reference-bandwidth %d%s",
paul68980082003-03-25 05:07:42 +00007307 ospf->ref_bandwidth / 1000, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007308
7309 /* SPF timers print. */
paul68980082003-03-25 05:07:42 +00007310 if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
7311 ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007312 vty_out (vty, " timers spf %d %d%s",
paul68980082003-03-25 05:07:42 +00007313 ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007314
7315 /* SPF refresh parameters print. */
paul68980082003-03-25 05:07:42 +00007316 if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007317 vty_out (vty, " refresh timer %d%s",
paul68980082003-03-25 05:07:42 +00007318 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007319
7320 /* Redistribute information print. */
paul68980082003-03-25 05:07:42 +00007321 config_write_ospf_redistribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007322
7323 /* passive-interface print. */
paul1eb8ef22005-04-07 07:30:20 +00007324 for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
7325 if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE)
7326 vty_out (vty, " passive-interface %s%s",
7327 ifp->name, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007328
paul1eb8ef22005-04-07 07:30:20 +00007329 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
7330 if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) &&
7331 oi->params->passive_interface == OSPF_IF_PASSIVE)
7332 vty_out (vty, " passive-interface %s %s%s",
7333 oi->ifp->name,
7334 inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007335
7336 /* Network area print. */
paul68980082003-03-25 05:07:42 +00007337 config_write_network_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007338
7339 /* Area config print. */
paul68980082003-03-25 05:07:42 +00007340 config_write_ospf_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007341
7342 /* static neighbor print. */
paul68980082003-03-25 05:07:42 +00007343 config_write_ospf_nbr_nbma (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007344
7345 /* Virtual-Link print. */
paul68980082003-03-25 05:07:42 +00007346 config_write_virtual_link (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007347
7348 /* Default metric configuration. */
paul68980082003-03-25 05:07:42 +00007349 config_write_ospf_default_metric (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007350
7351 /* Distribute-list and default-information print. */
paul68980082003-03-25 05:07:42 +00007352 config_write_ospf_distribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007353
7354 /* Distance configuration. */
paul68980082003-03-25 05:07:42 +00007355 config_write_ospf_distance (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007356
7357#ifdef HAVE_OPAQUE_LSA
paul68980082003-03-25 05:07:42 +00007358 ospf_opaque_config_write_router (vty, ospf);
paul718e3742002-12-13 20:15:29 +00007359#endif /* HAVE_OPAQUE_LSA */
7360 }
7361
7362 return write;
7363}
7364
7365void
paul4dadc292005-05-06 21:37:42 +00007366ospf_vty_show_init (void)
paul718e3742002-12-13 20:15:29 +00007367{
7368 /* "show ip ospf" commands. */
7369 install_element (VIEW_NODE, &show_ip_ospf_cmd);
7370 install_element (ENABLE_NODE, &show_ip_ospf_cmd);
7371
7372 /* "show ip ospf database" commands. */
7373 install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd);
7374 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd);
7375 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
7376 install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
7377 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd);
7378 install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd);
7379 install_element (VIEW_NODE, &show_ip_ospf_database_cmd);
7380 install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd);
7381 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd);
7382 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
7383 install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd);
7384 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd);
7385 install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd);
7386 install_element (ENABLE_NODE, &show_ip_ospf_database_cmd);
7387
7388 /* "show ip ospf interface" commands. */
7389 install_element (VIEW_NODE, &show_ip_ospf_interface_cmd);
7390 install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd);
7391
7392 /* "show ip ospf neighbor" commands. */
7393 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
7394 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd);
7395 install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd);
7396 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
7397 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd);
7398 install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd);
7399 install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd);
7400 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
7401 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd);
7402 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd);
7403 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
7404 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd);
7405 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd);
7406 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd);
7407
7408 /* "show ip ospf route" commands. */
7409 install_element (VIEW_NODE, &show_ip_ospf_route_cmd);
7410 install_element (ENABLE_NODE, &show_ip_ospf_route_cmd);
paul718e3742002-12-13 20:15:29 +00007411 install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd);
7412 install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
paul718e3742002-12-13 20:15:29 +00007413}
7414
7415
7416/* ospfd's interface node. */
7417struct cmd_node interface_node =
7418{
7419 INTERFACE_NODE,
7420 "%s(config-if)# ",
7421 1
7422};
7423
7424/* Initialization of OSPF interface. */
paul4dadc292005-05-06 21:37:42 +00007425static void
7426ospf_vty_if_init (void)
paul718e3742002-12-13 20:15:29 +00007427{
7428 /* Install interface node. */
7429 install_node (&interface_node, config_write_interface);
7430
7431 install_element (CONFIG_NODE, &interface_cmd);
paul32d24632003-05-23 09:25:20 +00007432 install_element (CONFIG_NODE, &no_interface_cmd);
paul718e3742002-12-13 20:15:29 +00007433 install_default (INTERFACE_NODE);
7434
7435 /* "description" commands. */
7436 install_element (INTERFACE_NODE, &interface_desc_cmd);
7437 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
7438
7439 /* "ip ospf authentication" commands. */
7440 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
7441 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd);
7442 install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd);
7443 install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd);
7444 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd);
7445 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd);
7446 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd);
7447 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd);
7448 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd);
7449 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd);
7450
7451 /* "ip ospf message-digest-key" commands. */
7452 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
7453 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
7454 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
7455 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
7456
7457 /* "ip ospf cost" commands. */
7458 install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd);
7459 install_element (INTERFACE_NODE, &ip_ospf_cost_cmd);
7460 install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd);
7461 install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
7462
7463 /* "ip ospf dead-interval" commands. */
7464 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
7465 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
7466 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
7467 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
7468
7469 /* "ip ospf hello-interval" commands. */
7470 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
7471 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
7472 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
7473 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
7474
7475 /* "ip ospf network" commands. */
7476 install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
7477 install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
7478
7479 /* "ip ospf priority" commands. */
7480 install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
7481 install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
7482 install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
7483 install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
7484
7485 /* "ip ospf retransmit-interval" commands. */
7486 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
7487 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd);
7488 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
7489 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd);
7490
7491 /* "ip ospf transmit-delay" commands. */
7492 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
7493 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd);
7494 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
7495 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd);
7496
7497 /* These commands are compatibitliy for previous version. */
7498 install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
7499 install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);
7500 install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
7501 install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
7502 install_element (INTERFACE_NODE, &ospf_cost_cmd);
7503 install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
7504 install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
7505 install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
7506 install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
7507 install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
7508 install_element (INTERFACE_NODE, &ospf_network_cmd);
7509 install_element (INTERFACE_NODE, &no_ospf_network_cmd);
7510 install_element (INTERFACE_NODE, &ospf_priority_cmd);
7511 install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
7512 install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
7513 install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
7514 install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
7515 install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
7516}
7517
7518/* Zebra node structure. */
7519struct cmd_node zebra_node =
7520{
7521 ZEBRA_NODE,
7522 "%s(config-router)#",
7523};
7524
paul4dadc292005-05-06 21:37:42 +00007525static void
7526ospf_vty_zebra_init (void)
paul718e3742002-12-13 20:15:29 +00007527{
7528 install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd);
7529 install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd);
7530 install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd);
7531 install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd);
7532 install_element (OSPF_NODE, &ospf_redistribute_source_cmd);
7533 install_element (OSPF_NODE,
7534 &ospf_redistribute_source_metric_type_routemap_cmd);
7535 install_element (OSPF_NODE,
7536 &ospf_redistribute_source_type_metric_routemap_cmd);
7537 install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd);
7538 install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd);
7539 install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd);
7540
7541 install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);
7542
7543 install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);
7544 install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);
7545
7546 install_element (OSPF_NODE,
7547 &ospf_default_information_originate_metric_type_cmd);
7548 install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd);
7549 install_element (OSPF_NODE,
7550 &ospf_default_information_originate_type_metric_cmd);
7551 install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd);
7552 install_element (OSPF_NODE, &ospf_default_information_originate_cmd);
7553 install_element (OSPF_NODE,
7554 &ospf_default_information_originate_always_metric_type_cmd);
7555 install_element (OSPF_NODE,
7556 &ospf_default_information_originate_always_metric_cmd);
7557 install_element (OSPF_NODE,
7558 &ospf_default_information_originate_always_cmd);
7559 install_element (OSPF_NODE,
7560 &ospf_default_information_originate_always_type_metric_cmd);
7561 install_element (OSPF_NODE,
7562 &ospf_default_information_originate_always_type_cmd);
7563
7564 install_element (OSPF_NODE,
7565 &ospf_default_information_originate_metric_type_routemap_cmd);
7566 install_element (OSPF_NODE,
7567 &ospf_default_information_originate_metric_routemap_cmd);
7568 install_element (OSPF_NODE,
7569 &ospf_default_information_originate_routemap_cmd);
7570 install_element (OSPF_NODE,
7571 &ospf_default_information_originate_type_metric_routemap_cmd);
7572 install_element (OSPF_NODE,
7573 &ospf_default_information_originate_type_routemap_cmd);
7574 install_element (OSPF_NODE,
7575 &ospf_default_information_originate_always_metric_type_routemap_cmd);
7576 install_element (OSPF_NODE,
7577 &ospf_default_information_originate_always_metric_routemap_cmd);
7578 install_element (OSPF_NODE,
7579 &ospf_default_information_originate_always_routemap_cmd);
7580 install_element (OSPF_NODE,
7581 &ospf_default_information_originate_always_type_metric_routemap_cmd);
7582 install_element (OSPF_NODE,
7583 &ospf_default_information_originate_always_type_routemap_cmd);
7584
7585 install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);
7586
7587 install_element (OSPF_NODE, &ospf_default_metric_cmd);
7588 install_element (OSPF_NODE, &no_ospf_default_metric_cmd);
7589 install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd);
7590
7591 install_element (OSPF_NODE, &ospf_distance_cmd);
7592 install_element (OSPF_NODE, &no_ospf_distance_cmd);
7593 install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);
7594 install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd);
7595 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd);
7596 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd);
7597 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd);
7598 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd);
7599 install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd);
7600 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd);
7601 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd);
7602 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd);
7603 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd);
7604 install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd);
7605 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd);
7606 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd);
7607 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd);
7608 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd);
7609#if 0
7610 install_element (OSPF_NODE, &ospf_distance_source_cmd);
7611 install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
7612 install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd);
7613 install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd);
7614#endif /* 0 */
7615}
7616
7617struct cmd_node ospf_node =
7618{
7619 OSPF_NODE,
7620 "%s(config-router)# ",
7621 1
7622};
7623
7624
7625/* Install OSPF related vty commands. */
7626void
paul4dadc292005-05-06 21:37:42 +00007627ospf_vty_init (void)
paul718e3742002-12-13 20:15:29 +00007628{
7629 /* Install ospf top node. */
7630 install_node (&ospf_node, ospf_config_write);
7631
7632 /* "router ospf" commands. */
7633 install_element (CONFIG_NODE, &router_ospf_cmd);
7634 install_element (CONFIG_NODE, &no_router_ospf_cmd);
7635
7636 install_default (OSPF_NODE);
7637
7638 /* "ospf router-id" commands. */
7639 install_element (OSPF_NODE, &ospf_router_id_cmd);
7640 install_element (OSPF_NODE, &no_ospf_router_id_cmd);
paula2c62832003-04-23 17:01:31 +00007641 install_element (OSPF_NODE, &router_ospf_id_cmd);
7642 install_element (OSPF_NODE, &no_router_ospf_id_cmd);
paul718e3742002-12-13 20:15:29 +00007643
7644 /* "passive-interface" commands. */
paula2c62832003-04-23 17:01:31 +00007645 install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd);
7646 install_element (OSPF_NODE, &ospf_passive_interface_cmd);
7647 install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd);
7648 install_element (OSPF_NODE, &no_ospf_passive_interface_cmd);
paul718e3742002-12-13 20:15:29 +00007649
7650 /* "ospf abr-type" commands. */
7651 install_element (OSPF_NODE, &ospf_abr_type_cmd);
7652 install_element (OSPF_NODE, &no_ospf_abr_type_cmd);
7653
7654 /* "ospf rfc1583-compatible" commands. */
7655 install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd);
7656 install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd);
7657 install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd);
7658 install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd);
7659
7660 /* "network area" commands. */
paula2c62832003-04-23 17:01:31 +00007661 install_element (OSPF_NODE, &ospf_network_area_cmd);
7662 install_element (OSPF_NODE, &no_ospf_network_area_cmd);
paul718e3742002-12-13 20:15:29 +00007663
7664 /* "area authentication" commands. */
paula2c62832003-04-23 17:01:31 +00007665 install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd);
7666 install_element (OSPF_NODE, &ospf_area_authentication_cmd);
7667 install_element (OSPF_NODE, &no_ospf_area_authentication_cmd);
paul718e3742002-12-13 20:15:29 +00007668
7669 /* "area range" commands. */
paula2c62832003-04-23 17:01:31 +00007670 install_element (OSPF_NODE, &ospf_area_range_cmd);
7671 install_element (OSPF_NODE, &ospf_area_range_advertise_cmd);
7672 install_element (OSPF_NODE, &ospf_area_range_cost_cmd);
7673 install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd);
7674 install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd);
7675 install_element (OSPF_NODE, &no_ospf_area_range_cmd);
7676 install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd);
7677 install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd);
7678 install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd);
7679 install_element (OSPF_NODE, &ospf_area_range_substitute_cmd);
7680 install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd);
paul718e3742002-12-13 20:15:29 +00007681
7682 /* "area virtual-link" commands. */
paula2c62832003-04-23 17:01:31 +00007683 install_element (OSPF_NODE, &ospf_area_vlink_cmd);
7684 install_element (OSPF_NODE, &no_ospf_area_vlink_cmd);
paul718e3742002-12-13 20:15:29 +00007685
paula2c62832003-04-23 17:01:31 +00007686 install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd);
7687 install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd);
paul718e3742002-12-13 20:15:29 +00007688
paula2c62832003-04-23 17:01:31 +00007689 install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd);
7690 install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd);
paul718e3742002-12-13 20:15:29 +00007691
paula2c62832003-04-23 17:01:31 +00007692 install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd);
7693 install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd);
paul718e3742002-12-13 20:15:29 +00007694
paula2c62832003-04-23 17:01:31 +00007695 install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd);
7696 install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd);
paul718e3742002-12-13 20:15:29 +00007697
paula2c62832003-04-23 17:01:31 +00007698 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd);
7699 install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd);
7700 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd);
paul718e3742002-12-13 20:15:29 +00007701
paula2c62832003-04-23 17:01:31 +00007702 install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd);
7703 install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd);
paul718e3742002-12-13 20:15:29 +00007704
paula2c62832003-04-23 17:01:31 +00007705 install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd);
7706 install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd);
paul718e3742002-12-13 20:15:29 +00007707
paula2c62832003-04-23 17:01:31 +00007708 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd);
7709 install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd);
7710 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd);
paul718e3742002-12-13 20:15:29 +00007711
paula2c62832003-04-23 17:01:31 +00007712 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd);
7713 install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd);
7714 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd);
paul718e3742002-12-13 20:15:29 +00007715
7716 /* "area stub" commands. */
paula2c62832003-04-23 17:01:31 +00007717 install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd);
7718 install_element (OSPF_NODE, &ospf_area_stub_cmd);
7719 install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd);
7720 install_element (OSPF_NODE, &no_ospf_area_stub_cmd);
paul718e3742002-12-13 20:15:29 +00007721
paul718e3742002-12-13 20:15:29 +00007722 /* "area nssa" commands. */
paula2c62832003-04-23 17:01:31 +00007723 install_element (OSPF_NODE, &ospf_area_nssa_cmd);
7724 install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd);
7725 install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd);
7726 install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd);
7727 install_element (OSPF_NODE, &no_ospf_area_nssa_cmd);
7728 install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd);
paul718e3742002-12-13 20:15:29 +00007729
paula2c62832003-04-23 17:01:31 +00007730 install_element (OSPF_NODE, &ospf_area_default_cost_cmd);
7731 install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd);
paul718e3742002-12-13 20:15:29 +00007732
paula2c62832003-04-23 17:01:31 +00007733 install_element (OSPF_NODE, &ospf_area_shortcut_cmd);
7734 install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd);
paul718e3742002-12-13 20:15:29 +00007735
paula2c62832003-04-23 17:01:31 +00007736 install_element (OSPF_NODE, &ospf_area_export_list_cmd);
7737 install_element (OSPF_NODE, &no_ospf_area_export_list_cmd);
paul718e3742002-12-13 20:15:29 +00007738
paula2c62832003-04-23 17:01:31 +00007739 install_element (OSPF_NODE, &ospf_area_filter_list_cmd);
7740 install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00007741
paula2c62832003-04-23 17:01:31 +00007742 install_element (OSPF_NODE, &ospf_area_import_list_cmd);
7743 install_element (OSPF_NODE, &no_ospf_area_import_list_cmd);
paul718e3742002-12-13 20:15:29 +00007744
paula2c62832003-04-23 17:01:31 +00007745 install_element (OSPF_NODE, &ospf_timers_spf_cmd);
7746 install_element (OSPF_NODE, &no_ospf_timers_spf_cmd);
paul718e3742002-12-13 20:15:29 +00007747
paula2c62832003-04-23 17:01:31 +00007748 install_element (OSPF_NODE, &ospf_refresh_timer_cmd);
7749 install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd);
7750 install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd);
paul718e3742002-12-13 20:15:29 +00007751
paula2c62832003-04-23 17:01:31 +00007752 install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd);
7753 install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd);
paul718e3742002-12-13 20:15:29 +00007754
7755 /* "neighbor" commands. */
paula2c62832003-04-23 17:01:31 +00007756 install_element (OSPF_NODE, &ospf_neighbor_cmd);
7757 install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd);
7758 install_element (OSPF_NODE, &ospf_neighbor_priority_cmd);
7759 install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd);
7760 install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd);
7761 install_element (OSPF_NODE, &no_ospf_neighbor_cmd);
7762 install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd);
7763 install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd);
paul718e3742002-12-13 20:15:29 +00007764
7765 /* Init interface related vty commands. */
7766 ospf_vty_if_init ();
7767
7768 /* Init zebra related vty commands. */
7769 ospf_vty_zebra_init ();
7770}