blob: b1526c33faf9ba78acdb71713f500a2a38bb0659 [file] [log] [blame]
paul718e3742002-12-13 20:15:29 +00001/* OSPF VTY interface.
vincentba682532005-09-29 13:52:57 +00002 * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com>
paul718e3742002-12-13 20:15:29 +00003 * Copyright (C) 2000 Toshiaki Takada
4 *
5 * This file is part of GNU Zebra.
6 *
7 * GNU Zebra is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2, or (at your option) any
10 * later version.
11 *
12 * GNU Zebra is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * General Public License for more details.
16 *
17 * You should have received a copy of the GNU General Public License
18 * along with GNU Zebra; see the file COPYING. If not, write to the Free
19 * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
20 * 02111-1307, USA.
21 */
22
23#include <zebra.h>
24
25#include "memory.h"
26#include "thread.h"
27#include "prefix.h"
28#include "table.h"
29#include "vty.h"
30#include "command.h"
31#include "plist.h"
32#include "log.h"
33#include "zclient.h"
34
35#include "ospfd/ospfd.h"
36#include "ospfd/ospf_asbr.h"
37#include "ospfd/ospf_lsa.h"
38#include "ospfd/ospf_lsdb.h"
39#include "ospfd/ospf_ism.h"
40#include "ospfd/ospf_interface.h"
41#include "ospfd/ospf_nsm.h"
42#include "ospfd/ospf_neighbor.h"
43#include "ospfd/ospf_flood.h"
44#include "ospfd/ospf_abr.h"
45#include "ospfd/ospf_spf.h"
46#include "ospfd/ospf_route.h"
47#include "ospfd/ospf_zebra.h"
48/*#include "ospfd/ospf_routemap.h" */
49#include "ospfd/ospf_vty.h"
50#include "ospfd/ospf_dump.h"
51
52
Paul Jakma30a22312008-08-15 14:05:22 +010053static const char *ospf_network_type_str[] =
paul718e3742002-12-13 20:15:29 +000054{
55 "Null",
56 "POINTOPOINT",
57 "BROADCAST",
58 "NBMA",
59 "POINTOMULTIPOINT",
60 "VIRTUALLINK",
61 "LOOPBACK"
62};
63
64
65/* Utility functions. */
paul4dadc292005-05-06 21:37:42 +000066static int
paul6c835672004-10-11 11:00:30 +000067ospf_str2area_id (const char *str, struct in_addr *area_id, int *format)
paul718e3742002-12-13 20:15:29 +000068{
69 char *endptr = NULL;
70 unsigned long ret;
71
72 /* match "A.B.C.D". */
73 if (strchr (str, '.') != NULL)
74 {
75 ret = inet_aton (str, area_id);
76 if (!ret)
77 return -1;
78 *format = OSPF_AREA_ID_FORMAT_ADDRESS;
79 }
80 /* match "<0-4294967295>". */
81 else
82 {
83 ret = strtoul (str, &endptr, 10);
84 if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE))
85 return -1;
86
87 area_id->s_addr = htonl (ret);
88 *format = OSPF_AREA_ID_FORMAT_DECIMAL;
89 }
90
91 return 0;
92}
93
94
paul4dadc292005-05-06 21:37:42 +000095static int
paul6c835672004-10-11 11:00:30 +000096str2metric (const char *str, int *metric)
paul718e3742002-12-13 20:15:29 +000097{
98 /* Sanity check. */
99 if (str == NULL)
100 return 0;
101
102 *metric = strtol (str, NULL, 10);
103 if (*metric < 0 && *metric > 16777214)
104 {
105 /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */
106 return 0;
107 }
108
109 return 1;
110}
111
paul4dadc292005-05-06 21:37:42 +0000112static int
paul6c835672004-10-11 11:00:30 +0000113str2metric_type (const char *str, int *metric_type)
paul718e3742002-12-13 20:15:29 +0000114{
115 /* Sanity check. */
116 if (str == NULL)
117 return 0;
118
119 if (strncmp (str, "1", 1) == 0)
120 *metric_type = EXTERNAL_METRIC_TYPE_1;
121 else if (strncmp (str, "2", 1) == 0)
122 *metric_type = EXTERNAL_METRIC_TYPE_2;
123 else
124 return 0;
125
126 return 1;
127}
128
129int
130ospf_oi_count (struct interface *ifp)
131{
132 struct route_node *rn;
133 int i = 0;
134
135 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
136 if (rn->info)
137 i++;
138
139 return i;
140}
141
142
143DEFUN (router_ospf,
144 router_ospf_cmd,
145 "router ospf",
146 "Enable a routing process\n"
147 "Start OSPF configuration\n")
148{
149 vty->node = OSPF_NODE;
150 vty->index = ospf_get ();
151
152 return CMD_SUCCESS;
153}
154
155DEFUN (no_router_ospf,
156 no_router_ospf_cmd,
157 "no router ospf",
158 NO_STR
159 "Enable a routing process\n"
160 "Start OSPF configuration\n")
161{
paul020709f2003-04-04 02:44:16 +0000162 struct ospf *ospf;
163
164 ospf = ospf_lookup ();
165 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +0000166 {
paul020709f2003-04-04 02:44:16 +0000167 vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +0000168 return CMD_WARNING;
169 }
170
paul020709f2003-04-04 02:44:16 +0000171 ospf_finish (ospf);
paul718e3742002-12-13 20:15:29 +0000172
173 return CMD_SUCCESS;
174}
175
176DEFUN (ospf_router_id,
177 ospf_router_id_cmd,
178 "ospf router-id A.B.C.D",
179 "OSPF specific commands\n"
180 "router-id for the OSPF process\n"
181 "OSPF router-id in IP address format\n")
182{
paul68980082003-03-25 05:07:42 +0000183 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000184 struct in_addr router_id;
paul68980082003-03-25 05:07:42 +0000185 int ret;
paul718e3742002-12-13 20:15:29 +0000186
187 ret = inet_aton (argv[0], &router_id);
188 if (!ret)
189 {
190 vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE);
191 return CMD_WARNING;
192 }
193
paul68980082003-03-25 05:07:42 +0000194 ospf->router_id_static = router_id;
paulb29800a2005-11-20 14:50:45 +0000195
196 ospf_router_id_update (ospf);
197
paul718e3742002-12-13 20:15:29 +0000198 return CMD_SUCCESS;
199}
200
201ALIAS (ospf_router_id,
paula2c62832003-04-23 17:01:31 +0000202 router_ospf_id_cmd,
paul718e3742002-12-13 20:15:29 +0000203 "router-id A.B.C.D",
204 "router-id for the OSPF process\n"
205 "OSPF router-id in IP address format\n")
206
207DEFUN (no_ospf_router_id,
208 no_ospf_router_id_cmd,
209 "no ospf router-id",
210 NO_STR
211 "OSPF specific commands\n"
212 "router-id for the OSPF process\n")
213{
paul68980082003-03-25 05:07:42 +0000214 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000215
paul68980082003-03-25 05:07:42 +0000216 ospf->router_id_static.s_addr = 0;
217
218 ospf_router_id_update (ospf);
paul718e3742002-12-13 20:15:29 +0000219
220 return CMD_SUCCESS;
221}
222
223ALIAS (no_ospf_router_id,
paula2c62832003-04-23 17:01:31 +0000224 no_router_ospf_id_cmd,
paul718e3742002-12-13 20:15:29 +0000225 "no router-id",
226 NO_STR
227 "router-id for the OSPF process\n")
228
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000229static void
Andrew J. Schorr43540882006-11-28 16:36:39 +0000230ospf_passive_interface_default (struct ospf *ospf, u_char newval)
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000231{
232 struct listnode *ln;
233 struct interface *ifp;
234 struct ospf_interface *oi;
235
Andrew J. Schorr43540882006-11-28 16:36:39 +0000236 ospf->passive_interface_default = newval;
237
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000238 for (ALL_LIST_ELEMENTS_RO (om->iflist, ln, ifp))
239 {
240 if (ifp &&
241 OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface))
242 UNSET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface);
243 }
244 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, ln, oi))
245 {
246 if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface))
247 UNSET_IF_PARAM (oi->params, passive_interface);
Andrew J. Schorr43540882006-11-28 16:36:39 +0000248 /* update multicast memberships */
249 ospf_if_set_multicast(oi);
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000250 }
251}
252
253static void
254ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp,
255 struct in_addr addr,
256 struct ospf_if_params *params, u_char value)
257{
258 u_char dflt;
259
260 params->passive_interface = value;
261 if (params != IF_DEF_PARAMS (ifp))
262 {
263 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface))
264 dflt = IF_DEF_PARAMS (ifp)->passive_interface;
265 else
266 dflt = ospf->passive_interface_default;
267
268 if (value != dflt)
269 SET_IF_PARAM (params, passive_interface);
270 else
271 UNSET_IF_PARAM (params, passive_interface);
272
273 ospf_free_if_params (ifp, addr);
274 ospf_if_update_params (ifp, addr);
275 }
276 else
277 {
278 if (value != ospf->passive_interface_default)
279 SET_IF_PARAM (params, passive_interface);
280 else
281 UNSET_IF_PARAM (params, passive_interface);
282 }
283}
284
paula2c62832003-04-23 17:01:31 +0000285DEFUN (ospf_passive_interface,
286 ospf_passive_interface_addr_cmd,
paul718e3742002-12-13 20:15:29 +0000287 "passive-interface IFNAME A.B.C.D",
288 "Suppress routing updates on an interface\n"
289 "Interface's name\n")
290{
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000291 struct interface *ifp;
292 struct in_addr addr;
293 int ret;
294 struct ospf_if_params *params;
295 struct route_node *rn;
296 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000297
Andrew J. Schorr43540882006-11-28 16:36:39 +0000298 if (argc == 0)
299 {
300 ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE);
301 return CMD_SUCCESS;
302 }
303
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000304 ifp = if_get_by_name (argv[0]);
paul718e3742002-12-13 20:15:29 +0000305
306 params = IF_DEF_PARAMS (ifp);
307
Andrew J. Schorr43540882006-11-28 16:36:39 +0000308 if (argc == 2)
paul718e3742002-12-13 20:15:29 +0000309 {
Andrew J. Schorr43540882006-11-28 16:36:39 +0000310 ret = inet_aton(argv[1], &addr);
311 if (!ret)
312 {
313 vty_out (vty, "Please specify interface address by A.B.C.D%s",
314 VTY_NEWLINE);
315 return CMD_WARNING;
316 }
paul718e3742002-12-13 20:15:29 +0000317
Andrew J. Schorr43540882006-11-28 16:36:39 +0000318 params = ospf_get_if_params (ifp, addr);
319 ospf_if_update_params (ifp, addr);
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000320 }
Andrew J. Schorr43540882006-11-28 16:36:39 +0000321 ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE);
322
ajsba6454e2005-02-08 15:37:30 +0000323 /* XXX We should call ospf_if_set_multicast on exactly those
324 * interfaces for which the passive property changed. It is too much
325 * work to determine this set, so we do this for every interface.
326 * This is safe and reasonable because ospf_if_set_multicast uses a
327 * record of joined groups to avoid systems calls if the desired
328 * memberships match the current memership.
329 */
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000330
ajsba6454e2005-02-08 15:37:30 +0000331 for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn))
332 {
333 struct ospf_interface *oi = rn->info;
334
335 if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE))
Andrew J. Schorr43540882006-11-28 16:36:39 +0000336 ospf_if_set_multicast(oi);
ajsba6454e2005-02-08 15:37:30 +0000337 }
338 /*
339 * XXX It is not clear what state transitions the interface needs to
340 * undergo when going from active to passive. Fixing this will
341 * require precise identification of interfaces having such a
342 * transition.
343 */
344
paul718e3742002-12-13 20:15:29 +0000345 return CMD_SUCCESS;
346}
347
paula2c62832003-04-23 17:01:31 +0000348ALIAS (ospf_passive_interface,
349 ospf_passive_interface_cmd,
paul718e3742002-12-13 20:15:29 +0000350 "passive-interface IFNAME",
351 "Suppress routing updates on an interface\n"
352 "Interface's name\n")
353
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000354ALIAS (ospf_passive_interface,
355 ospf_passive_interface_default_cmd,
356 "passive-interface default",
357 "Suppress routing updates on an interface\n"
358 "Suppress routing updates on interfaces by default\n")
359
paula2c62832003-04-23 17:01:31 +0000360DEFUN (no_ospf_passive_interface,
361 no_ospf_passive_interface_addr_cmd,
paul718e3742002-12-13 20:15:29 +0000362 "no passive-interface IFNAME A.B.C.D",
363 NO_STR
364 "Allow routing updates on an interface\n"
365 "Interface's name\n")
366{
367 struct interface *ifp;
368 struct in_addr addr;
369 struct ospf_if_params *params;
370 int ret;
ajsba6454e2005-02-08 15:37:30 +0000371 struct route_node *rn;
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000372 struct ospf *ospf = vty->index;
Andrew J. Schorr43540882006-11-28 16:36:39 +0000373
374 if (argc == 0)
375 {
376 ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE);
377 return CMD_SUCCESS;
378 }
paul718e3742002-12-13 20:15:29 +0000379
Andrew J. Schorr6e72cb62006-06-18 00:45:48 +0000380 ifp = if_get_by_name (argv[0]);
paul718e3742002-12-13 20:15:29 +0000381
382 params = IF_DEF_PARAMS (ifp);
383
Andrew J. Schorr43540882006-11-28 16:36:39 +0000384 if (argc == 2)
paul718e3742002-12-13 20:15:29 +0000385 {
Andrew J. Schorr43540882006-11-28 16:36:39 +0000386 ret = inet_aton(argv[1], &addr);
387 if (!ret)
388 {
389 vty_out (vty, "Please specify interface address by A.B.C.D%s",
390 VTY_NEWLINE);
391 return CMD_WARNING;
392 }
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000393
Andrew J. Schorr43540882006-11-28 16:36:39 +0000394 params = ospf_lookup_if_params (ifp, addr);
395 if (params == NULL)
396 return CMD_SUCCESS;
paul718e3742002-12-13 20:15:29 +0000397 }
Andrew J. Schorr43540882006-11-28 16:36:39 +0000398 ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE);
ajsba6454e2005-02-08 15:37:30 +0000399
400 /* XXX We should call ospf_if_set_multicast on exactly those
401 * interfaces for which the passive property changed. It is too much
402 * work to determine this set, so we do this for every interface.
403 * This is safe and reasonable because ospf_if_set_multicast uses a
404 * record of joined groups to avoid systems calls if the desired
405 * memberships match the current memership.
406 */
407 for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn))
408 {
409 struct ospf_interface *oi = rn->info;
410
411 if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE))
412 ospf_if_set_multicast(oi);
413 }
414
paul718e3742002-12-13 20:15:29 +0000415 return CMD_SUCCESS;
416}
417
paula2c62832003-04-23 17:01:31 +0000418ALIAS (no_ospf_passive_interface,
419 no_ospf_passive_interface_cmd,
paul718e3742002-12-13 20:15:29 +0000420 "no passive-interface IFNAME",
421 NO_STR
422 "Allow routing updates on an interface\n"
423 "Interface's name\n")
424
Paul Jakma7ffa8fa2006-10-22 20:07:53 +0000425ALIAS (no_ospf_passive_interface,
426 no_ospf_passive_interface_default_cmd,
427 "no passive-interface default",
428 NO_STR
429 "Allow routing updates on an interface\n"
430 "Allow routing updates on interfaces by default\n")
431
paula2c62832003-04-23 17:01:31 +0000432DEFUN (ospf_network_area,
433 ospf_network_area_cmd,
paul718e3742002-12-13 20:15:29 +0000434 "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
435 "Enable routing on an IP network\n"
436 "OSPF network prefix\n"
437 "Set the OSPF area ID\n"
438 "OSPF area ID in IP address format\n"
439 "OSPF area ID as a decimal value\n")
440{
441 struct ospf *ospf= vty->index;
442 struct prefix_ipv4 p;
443 struct in_addr area_id;
444 int ret, format;
445
446 /* Get network prefix and Area ID. */
447 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
448 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
449
450 ret = ospf_network_set (ospf, &p, area_id);
451 if (ret == 0)
452 {
453 vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE);
454 return CMD_WARNING;
455 }
456
457 return CMD_SUCCESS;
458}
459
paula2c62832003-04-23 17:01:31 +0000460DEFUN (no_ospf_network_area,
461 no_ospf_network_area_cmd,
paul718e3742002-12-13 20:15:29 +0000462 "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)",
463 NO_STR
464 "Enable routing on an IP network\n"
465 "OSPF network prefix\n"
466 "Set the OSPF area ID\n"
467 "OSPF area ID in IP address format\n"
468 "OSPF area ID as a decimal value\n")
469{
470 struct ospf *ospf = (struct ospf *) vty->index;
471 struct prefix_ipv4 p;
472 struct in_addr area_id;
473 int ret, format;
474
475 /* Get network prefix and Area ID. */
476 VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]);
477 VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]);
478
479 ret = ospf_network_unset (ospf, &p, area_id);
480 if (ret == 0)
481 {
482 vty_out (vty, "Can't find specified network area configuration.%s",
483 VTY_NEWLINE);
484 return CMD_WARNING;
485 }
486
487 return CMD_SUCCESS;
488}
489
490
paula2c62832003-04-23 17:01:31 +0000491DEFUN (ospf_area_range,
492 ospf_area_range_cmd,
paul718e3742002-12-13 20:15:29 +0000493 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
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{
500 struct ospf *ospf = vty->index;
501 struct prefix_ipv4 p;
502 struct in_addr area_id;
503 int format;
504 u_int32_t cost;
505
506 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
507 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
508
509 ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE);
510 if (argc > 2)
511 {
paul4dadc292005-05-06 21:37:42 +0000512 VTY_GET_INTEGER ("range cost", cost, argv[2]);
paul718e3742002-12-13 20:15:29 +0000513 ospf_area_range_cost_set (ospf, area_id, &p, cost);
514 }
515
516 return CMD_SUCCESS;
517}
518
paula2c62832003-04-23 17:01:31 +0000519ALIAS (ospf_area_range,
520 ospf_area_range_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000521 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise",
522 "OSPF area parameters\n"
523 "OSPF area ID in IP address format\n"
524 "OSPF area ID as a decimal value\n"
525 "OSPF area range for route advertise (default)\n"
526 "Area range prefix\n"
527 "Advertise this range (default)\n")
528
paula2c62832003-04-23 17:01:31 +0000529ALIAS (ospf_area_range,
530 ospf_area_range_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000531 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
532 "OSPF area parameters\n"
533 "OSPF area ID in IP address format\n"
534 "OSPF area ID as a decimal value\n"
535 "Summarize routes matching address/mask (border routers only)\n"
536 "Area range prefix\n"
537 "User specified metric for this range\n"
538 "Advertised metric for this range\n")
539
paula2c62832003-04-23 17:01:31 +0000540ALIAS (ospf_area_range,
541 ospf_area_range_advertise_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000542 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
543 "OSPF area parameters\n"
544 "OSPF area ID in IP address format\n"
545 "OSPF area ID as a decimal value\n"
546 "Summarize routes matching address/mask (border routers only)\n"
547 "Area range prefix\n"
548 "Advertise this range (default)\n"
549 "User specified metric for this range\n"
550 "Advertised metric for this range\n")
551
paula2c62832003-04-23 17:01:31 +0000552DEFUN (ospf_area_range_not_advertise,
553 ospf_area_range_not_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000554 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise",
555 "OSPF area parameters\n"
556 "OSPF area ID in IP address format\n"
557 "OSPF area ID as a decimal value\n"
558 "Summarize routes matching address/mask (border routers only)\n"
559 "Area range prefix\n"
560 "DoNotAdvertise this range\n")
561{
562 struct ospf *ospf = vty->index;
563 struct prefix_ipv4 p;
564 struct in_addr area_id;
565 int format;
566
567 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
568 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
569
570 ospf_area_range_set (ospf, area_id, &p, 0);
571
572 return CMD_SUCCESS;
573}
574
paula2c62832003-04-23 17:01:31 +0000575DEFUN (no_ospf_area_range,
576 no_ospf_area_range_cmd,
paul718e3742002-12-13 20:15:29 +0000577 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M",
578 NO_STR
579 "OSPF area parameters\n"
580 "OSPF area ID in IP address format\n"
581 "OSPF area ID as a decimal value\n"
582 "Summarize routes matching address/mask (border routers only)\n"
583 "Area range prefix\n")
584{
585 struct ospf *ospf = vty->index;
586 struct prefix_ipv4 p;
587 struct in_addr area_id;
588 int format;
589
590 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
591 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
592
593 ospf_area_range_unset (ospf, area_id, &p);
594
595 return CMD_SUCCESS;
596}
597
paula2c62832003-04-23 17:01:31 +0000598ALIAS (no_ospf_area_range,
599 no_ospf_area_range_advertise_cmd,
paul718e3742002-12-13 20:15:29 +0000600 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)",
601 NO_STR
602 "OSPF area parameters\n"
603 "OSPF area ID in IP address format\n"
604 "OSPF area ID as a decimal value\n"
605 "Summarize routes matching address/mask (border routers only)\n"
606 "Area range prefix\n"
607 "Advertise this range (default)\n"
608 "DoNotAdvertise this range\n")
609
paula2c62832003-04-23 17:01:31 +0000610ALIAS (no_ospf_area_range,
611 no_ospf_area_range_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000612 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>",
613 NO_STR
614 "OSPF area parameters\n"
615 "OSPF area ID in IP address format\n"
616 "OSPF area ID as a decimal value\n"
617 "Summarize routes matching address/mask (border routers only)\n"
618 "Area range prefix\n"
619 "User specified metric for this range\n"
620 "Advertised metric for this range\n")
621
paula2c62832003-04-23 17:01:31 +0000622ALIAS (no_ospf_area_range,
623 no_ospf_area_range_advertise_cost_cmd,
paul718e3742002-12-13 20:15:29 +0000624 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>",
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 "Advertise this range (default)\n"
632 "User specified metric for this range\n"
633 "Advertised metric for this range\n")
634
paula2c62832003-04-23 17:01:31 +0000635DEFUN (ospf_area_range_substitute,
636 ospf_area_range_substitute_cmd,
paul718e3742002-12-13 20:15:29 +0000637 "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
638 "OSPF area parameters\n"
639 "OSPF area ID in IP address format\n"
640 "OSPF area ID as a decimal value\n"
641 "Summarize routes matching address/mask (border routers only)\n"
642 "Area range prefix\n"
643 "Announce area range as another prefix\n"
644 "Network prefix to be announced instead of range\n")
645{
646 struct ospf *ospf = vty->index;
647 struct prefix_ipv4 p, s;
648 struct in_addr area_id;
649 int format;
650
651 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
652 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
653 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
654
655 ospf_area_range_substitute_set (ospf, area_id, &p, &s);
656
657 return CMD_SUCCESS;
658}
659
paula2c62832003-04-23 17:01:31 +0000660DEFUN (no_ospf_area_range_substitute,
661 no_ospf_area_range_substitute_cmd,
paul718e3742002-12-13 20:15:29 +0000662 "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M",
663 NO_STR
664 "OSPF area parameters\n"
665 "OSPF area ID in IP address format\n"
666 "OSPF area ID as a decimal value\n"
667 "Summarize routes matching address/mask (border routers only)\n"
668 "Area range prefix\n"
669 "Announce area range as another prefix\n"
670 "Network prefix to be announced instead of range\n")
671{
672 struct ospf *ospf = vty->index;
673 struct prefix_ipv4 p, s;
674 struct in_addr area_id;
675 int format;
676
677 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
678 VTY_GET_IPV4_PREFIX ("area range", p, argv[1]);
679 VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]);
680
681 ospf_area_range_substitute_unset (ospf, area_id, &p);
682
683 return CMD_SUCCESS;
684}
685
686
687/* Command Handler Logic in VLink stuff is delicate!!
688
689 ALTER AT YOUR OWN RISK!!!!
690
691 Various dummy values are used to represent 'NoChange' state for
692 VLink configuration NOT being changed by a VLink command, and
693 special syntax is used within the command strings so that the
694 typed in command verbs can be seen in the configuration command
695 bacckend handler. This is to drastically reduce the verbeage
696 required to coe up with a reasonably compatible Cisco VLink command
697
698 - Matthew Grant <grantma@anathoth.gen.nz>
699 Wed, 21 Feb 2001 15:13:52 +1300
700 */
701
702
703/* Configuration data for virtual links
704 */
705struct ospf_vl_config_data {
706 struct vty *vty; /* vty stuff */
707 struct in_addr area_id; /* area ID from command line */
708 int format; /* command line area ID format */
709 struct in_addr vl_peer; /* command line vl_peer */
710 int auth_type; /* Authehntication type, if given */
711 char *auth_key; /* simple password if present */
712 int crypto_key_id; /* Cryptographic key ID */
713 char *md5_key; /* MD5 authentication key */
714 int hello_interval; /* Obvious what these are... */
715 int retransmit_interval;
716 int transmit_delay;
717 int dead_interval;
718};
719
paul4dadc292005-05-06 21:37:42 +0000720static void
paul718e3742002-12-13 20:15:29 +0000721ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config,
722 struct vty *vty)
723{
724 memset (vl_config, 0, sizeof (struct ospf_vl_config_data));
725 vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN;
726 vl_config->vty = vty;
727}
728
paul4dadc292005-05-06 21:37:42 +0000729static struct ospf_vl_data *
paul68980082003-03-25 05:07:42 +0000730ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000731{
732 struct ospf_area *area;
733 struct ospf_vl_data *vl_data;
734 struct vty *vty;
735 struct in_addr area_id;
736
737 vty = vl_config->vty;
738 area_id = vl_config->area_id;
739
740 if (area_id.s_addr == OSPF_AREA_BACKBONE)
741 {
742 vty_out (vty,
743 "Configuring VLs over the backbone is not allowed%s",
744 VTY_NEWLINE);
745 return NULL;
746 }
paul68980082003-03-25 05:07:42 +0000747 area = ospf_area_get (ospf, area_id, vl_config->format);
paul718e3742002-12-13 20:15:29 +0000748
749 if (area->external_routing != OSPF_AREA_DEFAULT)
750 {
751 if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS)
752 vty_out (vty, "Area %s is %s%s",
753 inet_ntoa (area_id),
paul718e3742002-12-13 20:15:29 +0000754 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
paul718e3742002-12-13 20:15:29 +0000755 VTY_NEWLINE);
756 else
757 vty_out (vty, "Area %ld is %s%s",
758 (u_long)ntohl (area_id.s_addr),
paul718e3742002-12-13 20:15:29 +0000759 area->external_routing == OSPF_AREA_NSSA?"nssa":"stub",
paul718e3742002-12-13 20:15:29 +0000760 VTY_NEWLINE);
761 return NULL;
762 }
763
Paul Jakma9c27ef92006-05-04 07:32:57 +0000764 if ((vl_data = ospf_vl_lookup (ospf, area, vl_config->vl_peer)) == NULL)
paul718e3742002-12-13 20:15:29 +0000765 {
766 vl_data = ospf_vl_data_new (area, vl_config->vl_peer);
767 if (vl_data->vl_oi == NULL)
768 {
paul68980082003-03-25 05:07:42 +0000769 vl_data->vl_oi = ospf_vl_new (ospf, vl_data);
770 ospf_vl_add (ospf, vl_data);
771 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +0000772 }
773 }
774 return vl_data;
775}
776
777
paul4dadc292005-05-06 21:37:42 +0000778static int
paul718e3742002-12-13 20:15:29 +0000779ospf_vl_set_security (struct ospf_vl_data *vl_data,
780 struct ospf_vl_config_data *vl_config)
781{
782 struct crypt_key *ck;
783 struct vty *vty;
784 struct interface *ifp = vl_data->vl_oi->ifp;
785
786 vty = vl_config->vty;
787
788 if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN)
789 {
790 SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type);
791 IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type;
792 }
793
794 if (vl_config->auth_key)
795 {
796 memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1);
hassoc9e52be2004-09-26 16:09:34 +0000797 strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key,
paul718e3742002-12-13 20:15:29 +0000798 OSPF_AUTH_SIMPLE_SIZE);
799 }
800 else if (vl_config->md5_key)
801 {
802 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id)
803 != NULL)
804 {
805 vty_out (vty, "OSPF: Key %d already exists%s",
806 vl_config->crypto_key_id, VTY_NEWLINE);
807 return CMD_WARNING;
808 }
809 ck = ospf_crypt_key_new ();
810 ck->key_id = vl_config->crypto_key_id;
811 memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
hassoc9e52be2004-09-26 16:09:34 +0000812 strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE);
paul718e3742002-12-13 20:15:29 +0000813
814 ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck);
815 }
816 else if (vl_config->crypto_key_id != 0)
817 {
818 /* Delete a key */
819
820 if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt,
821 vl_config->crypto_key_id) == NULL)
822 {
823 vty_out (vty, "OSPF: Key %d does not exist%s",
824 vl_config->crypto_key_id, VTY_NEWLINE);
825 return CMD_WARNING;
826 }
827
828 ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id);
829
830 }
831
832 return CMD_SUCCESS;
833}
834
paul4dadc292005-05-06 21:37:42 +0000835static int
paul718e3742002-12-13 20:15:29 +0000836ospf_vl_set_timers (struct ospf_vl_data *vl_data,
837 struct ospf_vl_config_data *vl_config)
838{
839 struct interface *ifp = ifp = vl_data->vl_oi->ifp;
840 /* Virtual Link data initialised to defaults, so only set
841 if a value given */
842 if (vl_config->hello_interval)
843 {
844 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello);
845 IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval;
846 }
847
848 if (vl_config->dead_interval)
849 {
850 SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait);
851 IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval;
852 }
853
854 if (vl_config->retransmit_interval)
855 {
856 SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval);
857 IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval;
858 }
859
860 if (vl_config->transmit_delay)
861 {
862 SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay);
863 IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay;
864 }
865
866 return CMD_SUCCESS;
867}
868
869
870
871/* The business end of all of the above */
paul4dadc292005-05-06 21:37:42 +0000872static int
paul68980082003-03-25 05:07:42 +0000873ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config)
paul718e3742002-12-13 20:15:29 +0000874{
875 struct ospf_vl_data *vl_data;
876 int ret;
877
paul68980082003-03-25 05:07:42 +0000878 vl_data = ospf_find_vl_data (ospf, vl_config);
paul718e3742002-12-13 20:15:29 +0000879 if (!vl_data)
880 return CMD_WARNING;
881
882 /* Process this one first as it can have a fatal result, which can
883 only logically occur if the virtual link exists already
884 Thus a command error does not result in a change to the
885 running configuration such as unexpectedly altered timer
886 values etc.*/
887 ret = ospf_vl_set_security (vl_data, vl_config);
888 if (ret != CMD_SUCCESS)
889 return ret;
890
891 /* Set any time based parameters, these area already range checked */
892
893 ret = ospf_vl_set_timers (vl_data, vl_config);
894 if (ret != CMD_SUCCESS)
895 return ret;
896
897 return CMD_SUCCESS;
898
899}
900
901/* This stuff exists to make specifying all the alias commands A LOT simpler
902 */
903#define VLINK_HELPSTR_IPADDR \
904 "OSPF area parameters\n" \
905 "OSPF area ID in IP address format\n" \
906 "OSPF area ID as a decimal value\n" \
907 "Configure a virtual link\n" \
908 "Router ID of the remote ABR\n"
909
910#define VLINK_HELPSTR_AUTHTYPE_SIMPLE \
911 "Enable authentication on this virtual link\n" \
912 "dummy string \n"
913
914#define VLINK_HELPSTR_AUTHTYPE_ALL \
915 VLINK_HELPSTR_AUTHTYPE_SIMPLE \
916 "Use null authentication\n" \
917 "Use message-digest authentication\n"
918
919#define VLINK_HELPSTR_TIME_PARAM_NOSECS \
920 "Time between HELLO packets\n" \
921 "Time between retransmitting lost link state advertisements\n" \
922 "Link state transmit delay\n" \
923 "Interval after which a neighbor is declared dead\n"
924
925#define VLINK_HELPSTR_TIME_PARAM \
926 VLINK_HELPSTR_TIME_PARAM_NOSECS \
927 "Seconds\n"
928
929#define VLINK_HELPSTR_AUTH_SIMPLE \
930 "Authentication password (key)\n" \
931 "The OSPF password (key)"
932
933#define VLINK_HELPSTR_AUTH_MD5 \
934 "Message digest authentication password (key)\n" \
935 "dummy string \n" \
936 "Key ID\n" \
937 "Use MD5 algorithm\n" \
938 "The OSPF password (key)"
939
paula2c62832003-04-23 17:01:31 +0000940DEFUN (ospf_area_vlink,
941 ospf_area_vlink_cmd,
paul718e3742002-12-13 20:15:29 +0000942 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
943 VLINK_HELPSTR_IPADDR)
944{
paul68980082003-03-25 05:07:42 +0000945 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +0000946 struct ospf_vl_config_data vl_config;
947 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
948 char md5_key[OSPF_AUTH_MD5_SIZE+1];
949 int i;
950 int ret;
951
952 ospf_vl_config_data_init(&vl_config, vty);
953
954 /* Read off first 2 parameters and check them */
955 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format);
956 if (ret < 0)
957 {
958 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
959 return CMD_WARNING;
960 }
961
962 ret = inet_aton (argv[1], &vl_config.vl_peer);
963 if (! ret)
964 {
965 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
966 VTY_NEWLINE);
967 return CMD_WARNING;
968 }
969
970 if (argc <=2)
971 {
972 /* Thats all folks! - BUGS B. strikes again!!!*/
973
paul68980082003-03-25 05:07:42 +0000974 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +0000975 }
976
977 /* Deal with other parameters */
978 for (i=2; i < argc; i++)
979 {
980
981 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
982
983 switch (argv[i][0])
984 {
985
986 case 'a':
987 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
988 {
989 /* authentication-key - this option can occur anywhere on
990 command line. At start of command line
991 must check for authentication option. */
992 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
993 strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE);
994 vl_config.auth_key = auth_key;
995 i++;
996 }
997 else if (strncmp (argv[i], "authentication", 14) == 0)
998 {
999 /* authentication - this option can only occur at start
1000 of command line */
1001 vl_config.auth_type = OSPF_AUTH_SIMPLE;
1002 if ((i+1) < argc)
1003 {
1004 if (strncmp (argv[i+1], "n", 1) == 0)
1005 {
1006 /* "authentication null" */
1007 vl_config.auth_type = OSPF_AUTH_NULL;
1008 i++;
1009 }
1010 else if (strncmp (argv[i+1], "m", 1) == 0
1011 && strcmp (argv[i+1], "message-digest-") != 0)
1012 {
1013 /* "authentication message-digest" */
1014 vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
1015 i++;
1016 }
1017 }
1018 }
1019 break;
1020
1021 case 'm':
1022 /* message-digest-key */
1023 i++;
1024 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
1025 if (vl_config.crypto_key_id < 0)
1026 return CMD_WARNING;
1027 i++;
1028 memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1);
1029 strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE);
1030 vl_config.md5_key = md5_key;
1031 break;
1032
1033 case 'h':
1034 /* Hello interval */
1035 i++;
1036 vl_config.hello_interval = strtol (argv[i], NULL, 10);
1037 if (vl_config.hello_interval < 0)
1038 return CMD_WARNING;
1039 break;
1040
1041 case 'r':
1042 /* Retransmit Interval */
1043 i++;
1044 vl_config.retransmit_interval = strtol (argv[i], NULL, 10);
1045 if (vl_config.retransmit_interval < 0)
1046 return CMD_WARNING;
1047 break;
1048
1049 case 't':
1050 /* Transmit Delay */
1051 i++;
1052 vl_config.transmit_delay = strtol (argv[i], NULL, 10);
1053 if (vl_config.transmit_delay < 0)
1054 return CMD_WARNING;
1055 break;
1056
1057 case 'd':
1058 /* Dead Interval */
1059 i++;
1060 vl_config.dead_interval = strtol (argv[i], NULL, 10);
1061 if (vl_config.dead_interval < 0)
1062 return CMD_WARNING;
1063 break;
1064 }
1065 }
1066
1067
1068 /* Action configuration */
1069
paul68980082003-03-25 05:07:42 +00001070 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001071
1072}
1073
paula2c62832003-04-23 17:01:31 +00001074DEFUN (no_ospf_area_vlink,
1075 no_ospf_area_vlink_cmd,
paul718e3742002-12-13 20:15:29 +00001076 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D",
1077 NO_STR
1078 VLINK_HELPSTR_IPADDR)
1079{
paul68980082003-03-25 05:07:42 +00001080 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001081 struct ospf_area *area;
1082 struct ospf_vl_config_data vl_config;
1083 struct ospf_vl_data *vl_data = NULL;
1084 char auth_key[OSPF_AUTH_SIMPLE_SIZE+1];
1085 int i;
1086 int ret, format;
1087
1088 ospf_vl_config_data_init(&vl_config, vty);
1089
1090 ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format);
1091 if (ret < 0)
1092 {
1093 vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE);
1094 return CMD_WARNING;
1095 }
1096
paul68980082003-03-25 05:07:42 +00001097 area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001098 if (!area)
1099 {
1100 vty_out (vty, "Area does not exist%s", VTY_NEWLINE);
1101 return CMD_WARNING;
1102 }
1103
1104 ret = inet_aton (argv[1], &vl_config.vl_peer);
1105 if (! ret)
1106 {
1107 vty_out (vty, "Please specify valid Router ID as a.b.c.d%s",
1108 VTY_NEWLINE);
1109 return CMD_WARNING;
1110 }
1111
1112 if (argc <=2)
1113 {
1114 /* Basic VLink no command */
1115 /* Thats all folks! - BUGS B. strikes again!!!*/
Paul Jakma9c27ef92006-05-04 07:32:57 +00001116 if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer)))
paul68980082003-03-25 05:07:42 +00001117 ospf_vl_delete (ospf, vl_data);
paul718e3742002-12-13 20:15:29 +00001118
paul68980082003-03-25 05:07:42 +00001119 ospf_area_check_free (ospf, vl_config.area_id);
paul718e3742002-12-13 20:15:29 +00001120
1121 return CMD_SUCCESS;
1122 }
1123
1124 /* If we are down here, we are reseting parameters */
1125
1126 /* Deal with other parameters */
1127 for (i=2; i < argc; i++)
1128 {
paul718e3742002-12-13 20:15:29 +00001129 /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */
1130
1131 switch (argv[i][0])
1132 {
1133
1134 case 'a':
1135 if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0)
1136 {
1137 /* authentication-key - this option can occur anywhere on
1138 command line. At start of command line
1139 must check for authentication option. */
1140 memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
1141 vl_config.auth_key = auth_key;
1142 }
1143 else if (strncmp (argv[i], "authentication", 14) == 0)
1144 {
1145 /* authentication - this option can only occur at start
1146 of command line */
1147 vl_config.auth_type = OSPF_AUTH_NOTSET;
1148 }
1149 break;
1150
1151 case 'm':
1152 /* message-digest-key */
1153 /* Delete one key */
1154 i++;
1155 vl_config.crypto_key_id = strtol (argv[i], NULL, 10);
1156 if (vl_config.crypto_key_id < 0)
1157 return CMD_WARNING;
1158 vl_config.md5_key = NULL;
1159 break;
1160
1161 case 'h':
1162 /* Hello interval */
1163 vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT;
1164 break;
1165
1166 case 'r':
1167 /* Retransmit Interval */
1168 vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
1169 break;
1170
1171 case 't':
1172 /* Transmit Delay */
1173 vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
1174 break;
1175
1176 case 'd':
1177 /* Dead Interval */
1178 i++;
1179 vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
1180 break;
1181 }
1182 }
1183
1184
1185 /* Action configuration */
1186
paul68980082003-03-25 05:07:42 +00001187 return ospf_vl_set (ospf, &vl_config);
paul718e3742002-12-13 20:15:29 +00001188}
1189
paula2c62832003-04-23 17:01:31 +00001190ALIAS (ospf_area_vlink,
1191 ospf_area_vlink_param1_cmd,
paul718e3742002-12-13 20:15:29 +00001192 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1193 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1194 VLINK_HELPSTR_IPADDR
1195 VLINK_HELPSTR_TIME_PARAM)
1196
paula2c62832003-04-23 17:01:31 +00001197ALIAS (no_ospf_area_vlink,
1198 no_ospf_area_vlink_param1_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 NO_STR
1202 VLINK_HELPSTR_IPADDR
1203 VLINK_HELPSTR_TIME_PARAM)
1204
paula2c62832003-04-23 17:01:31 +00001205ALIAS (ospf_area_vlink,
1206 ospf_area_vlink_param2_cmd,
paul718e3742002-12-13 20:15:29 +00001207 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1208 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1209 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1210 VLINK_HELPSTR_IPADDR
1211 VLINK_HELPSTR_TIME_PARAM
1212 VLINK_HELPSTR_TIME_PARAM)
1213
paula2c62832003-04-23 17:01:31 +00001214ALIAS (no_ospf_area_vlink,
1215 no_ospf_area_vlink_param2_cmd,
paul718e3742002-12-13 20:15:29 +00001216 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1217 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1218 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1219 NO_STR
1220 VLINK_HELPSTR_IPADDR
1221 VLINK_HELPSTR_TIME_PARAM
1222 VLINK_HELPSTR_TIME_PARAM)
1223
paula2c62832003-04-23 17:01:31 +00001224ALIAS (ospf_area_vlink,
1225 ospf_area_vlink_param3_cmd,
paul718e3742002-12-13 20:15:29 +00001226 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1227 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1228 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1229 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1230 VLINK_HELPSTR_IPADDR
1231 VLINK_HELPSTR_TIME_PARAM
1232 VLINK_HELPSTR_TIME_PARAM
1233 VLINK_HELPSTR_TIME_PARAM)
1234
paula2c62832003-04-23 17:01:31 +00001235ALIAS (no_ospf_area_vlink,
1236 no_ospf_area_vlink_param3_cmd,
paul718e3742002-12-13 20:15:29 +00001237 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1238 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1239 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1240 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1241 NO_STR
1242 VLINK_HELPSTR_IPADDR
1243 VLINK_HELPSTR_TIME_PARAM
1244 VLINK_HELPSTR_TIME_PARAM
1245 VLINK_HELPSTR_TIME_PARAM)
1246
paula2c62832003-04-23 17:01:31 +00001247ALIAS (ospf_area_vlink,
1248 ospf_area_vlink_param4_cmd,
paul718e3742002-12-13 20:15:29 +00001249 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1250 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1251 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1252 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> "
1253 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>",
1254 VLINK_HELPSTR_IPADDR
1255 VLINK_HELPSTR_TIME_PARAM
1256 VLINK_HELPSTR_TIME_PARAM
1257 VLINK_HELPSTR_TIME_PARAM
1258 VLINK_HELPSTR_TIME_PARAM)
1259
paula2c62832003-04-23 17:01:31 +00001260ALIAS (no_ospf_area_vlink,
1261 no_ospf_area_vlink_param4_cmd,
paul718e3742002-12-13 20:15:29 +00001262 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1263 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1264 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1265 "(hello-interval|retransmit-interval|transmit-delay|dead-interval) "
1266 "(hello-interval|retransmit-interval|transmit-delay|dead-interval)",
1267 NO_STR
1268 VLINK_HELPSTR_IPADDR
1269 VLINK_HELPSTR_TIME_PARAM
1270 VLINK_HELPSTR_TIME_PARAM
1271 VLINK_HELPSTR_TIME_PARAM
1272 VLINK_HELPSTR_TIME_PARAM)
1273
paula2c62832003-04-23 17:01:31 +00001274ALIAS (ospf_area_vlink,
1275 ospf_area_vlink_authtype_args_cmd,
paul718e3742002-12-13 20:15:29 +00001276 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1277 "(authentication|) (message-digest|null)",
1278 VLINK_HELPSTR_IPADDR
1279 VLINK_HELPSTR_AUTHTYPE_ALL)
1280
paula2c62832003-04-23 17:01:31 +00001281ALIAS (ospf_area_vlink,
1282 ospf_area_vlink_authtype_cmd,
paul718e3742002-12-13 20:15:29 +00001283 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1284 "(authentication|)",
1285 VLINK_HELPSTR_IPADDR
1286 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1287
paula2c62832003-04-23 17:01:31 +00001288ALIAS (no_ospf_area_vlink,
1289 no_ospf_area_vlink_authtype_cmd,
paul718e3742002-12-13 20:15:29 +00001290 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1291 "(authentication|)",
1292 NO_STR
1293 VLINK_HELPSTR_IPADDR
1294 VLINK_HELPSTR_AUTHTYPE_SIMPLE)
1295
paula2c62832003-04-23 17:01:31 +00001296ALIAS (ospf_area_vlink,
1297 ospf_area_vlink_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001298 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1299 "(message-digest-key|) <1-255> md5 KEY",
1300 VLINK_HELPSTR_IPADDR
1301 VLINK_HELPSTR_AUTH_MD5)
1302
paula2c62832003-04-23 17:01:31 +00001303ALIAS (no_ospf_area_vlink,
1304 no_ospf_area_vlink_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001305 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1306 "(message-digest-key|) <1-255>",
1307 NO_STR
1308 VLINK_HELPSTR_IPADDR
1309 VLINK_HELPSTR_AUTH_MD5)
1310
paula2c62832003-04-23 17:01:31 +00001311ALIAS (ospf_area_vlink,
1312 ospf_area_vlink_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001313 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1314 "(authentication-key|) AUTH_KEY",
1315 VLINK_HELPSTR_IPADDR
1316 VLINK_HELPSTR_AUTH_SIMPLE)
1317
paula2c62832003-04-23 17:01:31 +00001318ALIAS (no_ospf_area_vlink,
1319 no_ospf_area_vlink_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001320 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1321 "(authentication-key|)",
1322 NO_STR
1323 VLINK_HELPSTR_IPADDR
1324 VLINK_HELPSTR_AUTH_SIMPLE)
1325
paula2c62832003-04-23 17:01:31 +00001326ALIAS (ospf_area_vlink,
1327 ospf_area_vlink_authtype_args_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001328 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1329 "(authentication|) (message-digest|null) "
1330 "(authentication-key|) AUTH_KEY",
1331 VLINK_HELPSTR_IPADDR
1332 VLINK_HELPSTR_AUTHTYPE_ALL
1333 VLINK_HELPSTR_AUTH_SIMPLE)
1334
paula2c62832003-04-23 17:01:31 +00001335ALIAS (ospf_area_vlink,
1336 ospf_area_vlink_authtype_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001337 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1338 "(authentication|) "
1339 "(authentication-key|) AUTH_KEY",
1340 VLINK_HELPSTR_IPADDR
1341 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1342 VLINK_HELPSTR_AUTH_SIMPLE)
1343
paula2c62832003-04-23 17:01:31 +00001344ALIAS (no_ospf_area_vlink,
1345 no_ospf_area_vlink_authtype_authkey_cmd,
paul718e3742002-12-13 20:15:29 +00001346 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1347 "(authentication|) "
1348 "(authentication-key|)",
1349 NO_STR
1350 VLINK_HELPSTR_IPADDR
1351 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1352 VLINK_HELPSTR_AUTH_SIMPLE)
1353
paula2c62832003-04-23 17:01:31 +00001354ALIAS (ospf_area_vlink,
1355 ospf_area_vlink_authtype_args_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001356 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1357 "(authentication|) (message-digest|null) "
1358 "(message-digest-key|) <1-255> md5 KEY",
1359 VLINK_HELPSTR_IPADDR
1360 VLINK_HELPSTR_AUTHTYPE_ALL
1361 VLINK_HELPSTR_AUTH_MD5)
1362
paula2c62832003-04-23 17:01:31 +00001363ALIAS (ospf_area_vlink,
1364 ospf_area_vlink_authtype_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001365 "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1366 "(authentication|) "
1367 "(message-digest-key|) <1-255> md5 KEY",
1368 VLINK_HELPSTR_IPADDR
1369 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1370 VLINK_HELPSTR_AUTH_MD5)
1371
paula2c62832003-04-23 17:01:31 +00001372ALIAS (no_ospf_area_vlink,
1373 no_ospf_area_vlink_authtype_md5_cmd,
paul718e3742002-12-13 20:15:29 +00001374 "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D "
1375 "(authentication|) "
1376 "(message-digest-key|)",
1377 NO_STR
1378 VLINK_HELPSTR_IPADDR
1379 VLINK_HELPSTR_AUTHTYPE_SIMPLE
1380 VLINK_HELPSTR_AUTH_MD5)
1381
1382
paula2c62832003-04-23 17:01:31 +00001383DEFUN (ospf_area_shortcut,
1384 ospf_area_shortcut_cmd,
paul718e3742002-12-13 20:15:29 +00001385 "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)",
1386 "OSPF area parameters\n"
1387 "OSPF area ID in IP address format\n"
1388 "OSPF area ID as a decimal value\n"
1389 "Configure the area's shortcutting mode\n"
1390 "Set default shortcutting behavior\n"
1391 "Enable shortcutting through the area\n"
1392 "Disable shortcutting through the area\n")
1393{
paul68980082003-03-25 05:07:42 +00001394 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001395 struct ospf_area *area;
1396 struct in_addr area_id;
1397 int mode;
1398 int format;
1399
1400 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1401
paul68980082003-03-25 05:07:42 +00001402 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001403
1404 if (strncmp (argv[1], "de", 2) == 0)
1405 mode = OSPF_SHORTCUT_DEFAULT;
1406 else if (strncmp (argv[1], "di", 2) == 0)
1407 mode = OSPF_SHORTCUT_DISABLE;
1408 else if (strncmp (argv[1], "e", 1) == 0)
1409 mode = OSPF_SHORTCUT_ENABLE;
1410 else
1411 return CMD_WARNING;
1412
paul68980082003-03-25 05:07:42 +00001413 ospf_area_shortcut_set (ospf, area, mode);
paul718e3742002-12-13 20:15:29 +00001414
paul68980082003-03-25 05:07:42 +00001415 if (ospf->abr_type != OSPF_ABR_SHORTCUT)
paul718e3742002-12-13 20:15:29 +00001416 vty_out (vty, "Shortcut area setting will take effect "
1417 "only when the router is configured as Shortcut ABR%s",
1418 VTY_NEWLINE);
1419
1420 return CMD_SUCCESS;
1421}
1422
paula2c62832003-04-23 17:01:31 +00001423DEFUN (no_ospf_area_shortcut,
1424 no_ospf_area_shortcut_cmd,
paul718e3742002-12-13 20:15:29 +00001425 "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)",
1426 NO_STR
1427 "OSPF area parameters\n"
1428 "OSPF area ID in IP address format\n"
1429 "OSPF area ID as a decimal value\n"
1430 "Deconfigure the area's shortcutting mode\n"
1431 "Deconfigure enabled shortcutting through the area\n"
1432 "Deconfigure disabled shortcutting through the area\n")
1433{
paul68980082003-03-25 05:07:42 +00001434 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001435 struct ospf_area *area;
1436 struct in_addr area_id;
1437 int format;
1438
1439 VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]);
1440
paul68980082003-03-25 05:07:42 +00001441 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001442 if (!area)
1443 return CMD_SUCCESS;
1444
paul68980082003-03-25 05:07:42 +00001445 ospf_area_shortcut_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001446
1447 return CMD_SUCCESS;
1448}
1449
1450
paula2c62832003-04-23 17:01:31 +00001451DEFUN (ospf_area_stub,
1452 ospf_area_stub_cmd,
paul718e3742002-12-13 20:15:29 +00001453 "area (A.B.C.D|<0-4294967295>) stub",
1454 "OSPF area parameters\n"
1455 "OSPF area ID in IP address format\n"
1456 "OSPF area ID as a decimal value\n"
1457 "Configure OSPF area as stub\n")
1458{
1459 struct ospf *ospf = vty->index;
1460 struct in_addr area_id;
1461 int ret, format;
1462
1463 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1464
1465 ret = ospf_area_stub_set (ospf, area_id);
1466 if (ret == 0)
1467 {
1468 vty_out (vty, "First deconfigure all virtual link through this area%s",
1469 VTY_NEWLINE);
1470 return CMD_WARNING;
1471 }
1472
1473 ospf_area_no_summary_unset (ospf, area_id);
1474
1475 return CMD_SUCCESS;
1476}
1477
paula2c62832003-04-23 17:01:31 +00001478DEFUN (ospf_area_stub_no_summary,
1479 ospf_area_stub_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001480 "area (A.B.C.D|<0-4294967295>) stub no-summary",
1481 "OSPF stub parameters\n"
1482 "OSPF area ID in IP address format\n"
1483 "OSPF area ID as a decimal value\n"
1484 "Configure OSPF area as stub\n"
1485 "Do not inject inter-area routes into stub\n")
1486{
1487 struct ospf *ospf = vty->index;
1488 struct in_addr area_id;
1489 int ret, format;
1490
1491 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1492
1493 ret = ospf_area_stub_set (ospf, area_id);
1494 if (ret == 0)
1495 {
paulb0a053b2003-06-22 09:04:47 +00001496 vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s",
paul718e3742002-12-13 20:15:29 +00001497 VTY_NEWLINE);
1498 return CMD_WARNING;
1499 }
1500
1501 ospf_area_no_summary_set (ospf, area_id);
1502
1503 return CMD_SUCCESS;
1504}
1505
paula2c62832003-04-23 17:01:31 +00001506DEFUN (no_ospf_area_stub,
1507 no_ospf_area_stub_cmd,
paul718e3742002-12-13 20:15:29 +00001508 "no area (A.B.C.D|<0-4294967295>) stub",
1509 NO_STR
1510 "OSPF area parameters\n"
1511 "OSPF area ID in IP address format\n"
1512 "OSPF area ID as a decimal value\n"
1513 "Configure OSPF area as stub\n")
1514{
1515 struct ospf *ospf = vty->index;
1516 struct in_addr area_id;
1517 int format;
1518
1519 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1520
1521 ospf_area_stub_unset (ospf, area_id);
1522 ospf_area_no_summary_unset (ospf, area_id);
1523
1524 return CMD_SUCCESS;
1525}
1526
paula2c62832003-04-23 17:01:31 +00001527DEFUN (no_ospf_area_stub_no_summary,
1528 no_ospf_area_stub_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001529 "no area (A.B.C.D|<0-4294967295>) stub no-summary",
1530 NO_STR
1531 "OSPF area parameters\n"
1532 "OSPF area ID in IP address format\n"
1533 "OSPF area ID as a decimal value\n"
1534 "Configure OSPF area as stub\n"
1535 "Do not inject inter-area routes into area\n")
1536{
1537 struct ospf *ospf = vty->index;
1538 struct in_addr area_id;
1539 int format;
1540
1541 VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]);
1542 ospf_area_no_summary_unset (ospf, area_id);
1543
1544 return CMD_SUCCESS;
1545}
1546
paul4dadc292005-05-06 21:37:42 +00001547static int
paul6c835672004-10-11 11:00:30 +00001548ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[],
1549 int nosum)
paul718e3742002-12-13 20:15:29 +00001550{
1551 struct ospf *ospf = vty->index;
1552 struct in_addr area_id;
1553 int ret, format;
1554
1555 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1556
1557 ret = ospf_area_nssa_set (ospf, area_id);
1558 if (ret == 0)
1559 {
1560 vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s",
1561 VTY_NEWLINE);
1562 return CMD_WARNING;
1563 }
1564
1565 if (argc > 1)
1566 {
1567 if (strncmp (argv[1], "translate-c", 11) == 0)
paulb0a053b2003-06-22 09:04:47 +00001568 ospf_area_nssa_translator_role_set (ospf, area_id,
paul718e3742002-12-13 20:15:29 +00001569 OSPF_NSSA_ROLE_CANDIDATE);
1570 else if (strncmp (argv[1], "translate-n", 11) == 0)
paulb0a053b2003-06-22 09:04:47 +00001571 ospf_area_nssa_translator_role_set (ospf, area_id,
paul718e3742002-12-13 20:15:29 +00001572 OSPF_NSSA_ROLE_NEVER);
1573 else if (strncmp (argv[1], "translate-a", 11) == 0)
paulb0a053b2003-06-22 09:04:47 +00001574 ospf_area_nssa_translator_role_set (ospf, area_id,
paul718e3742002-12-13 20:15:29 +00001575 OSPF_NSSA_ROLE_ALWAYS);
1576 }
paulb0a053b2003-06-22 09:04:47 +00001577 else
1578 {
1579 ospf_area_nssa_translator_role_set (ospf, area_id,
1580 OSPF_NSSA_ROLE_CANDIDATE);
1581 }
paul718e3742002-12-13 20:15:29 +00001582
paulb0a053b2003-06-22 09:04:47 +00001583 if (nosum)
paul718e3742002-12-13 20:15:29 +00001584 ospf_area_no_summary_set (ospf, area_id);
paulb0a053b2003-06-22 09:04:47 +00001585 else
1586 ospf_area_no_summary_unset (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001587
paulb0a053b2003-06-22 09:04:47 +00001588 ospf_schedule_abr_task (ospf);
1589
paul718e3742002-12-13 20:15:29 +00001590 return CMD_SUCCESS;
1591}
1592
paulb0a053b2003-06-22 09:04:47 +00001593DEFUN (ospf_area_nssa_translate_no_summary,
paula2c62832003-04-23 17:01:31 +00001594 ospf_area_nssa_translate_no_summary_cmd,
paulb0a053b2003-06-22 09:04:47 +00001595 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary",
paul718e3742002-12-13 20:15:29 +00001596 "OSPF area parameters\n"
1597 "OSPF area ID in IP address format\n"
1598 "OSPF area ID as a decimal value\n"
1599 "Configure OSPF area as nssa\n"
1600 "Configure NSSA-ABR for translate election (default)\n"
1601 "Configure NSSA-ABR to never translate\n"
1602 "Configure NSSA-ABR to always translate\n"
paulb0a053b2003-06-22 09:04:47 +00001603 "Do not inject inter-area routes into nssa\n")
1604{
1605 return ospf_area_nssa_cmd_handler (vty, argc, argv, 1);
1606}
paul718e3742002-12-13 20:15:29 +00001607
paulb0a053b2003-06-22 09:04:47 +00001608DEFUN (ospf_area_nssa_translate,
paula2c62832003-04-23 17:01:31 +00001609 ospf_area_nssa_translate_cmd,
paul718e3742002-12-13 20:15:29 +00001610 "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)",
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 "Configure NSSA-ABR for translate election (default)\n"
1616 "Configure NSSA-ABR to never translate\n"
1617 "Configure NSSA-ABR to always translate\n")
paulb0a053b2003-06-22 09:04:47 +00001618{
1619 return ospf_area_nssa_cmd_handler (vty, argc, argv, 0);
1620}
1621
1622DEFUN (ospf_area_nssa,
1623 ospf_area_nssa_cmd,
1624 "area (A.B.C.D|<0-4294967295>) nssa",
1625 "OSPF area parameters\n"
1626 "OSPF area ID in IP address format\n"
1627 "OSPF area ID as a decimal value\n"
1628 "Configure OSPF area as nssa\n")
1629{
1630 return ospf_area_nssa_cmd_handler (vty, argc, argv, 0);
1631}
paul718e3742002-12-13 20:15:29 +00001632
paula2c62832003-04-23 17:01:31 +00001633DEFUN (ospf_area_nssa_no_summary,
1634 ospf_area_nssa_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001635 "area (A.B.C.D|<0-4294967295>) nssa no-summary",
1636 "OSPF area parameters\n"
1637 "OSPF area ID in IP address format\n"
1638 "OSPF area ID as a decimal value\n"
1639 "Configure OSPF area as nssa\n"
1640 "Do not inject inter-area routes into nssa\n")
1641{
paulb0a053b2003-06-22 09:04:47 +00001642 return ospf_area_nssa_cmd_handler (vty, argc, argv, 1);
paul718e3742002-12-13 20:15:29 +00001643}
1644
paula2c62832003-04-23 17:01:31 +00001645DEFUN (no_ospf_area_nssa,
1646 no_ospf_area_nssa_cmd,
paul718e3742002-12-13 20:15:29 +00001647 "no area (A.B.C.D|<0-4294967295>) nssa",
1648 NO_STR
1649 "OSPF area parameters\n"
1650 "OSPF area ID in IP address format\n"
1651 "OSPF area ID as a decimal value\n"
1652 "Configure OSPF area as nssa\n")
1653{
1654 struct ospf *ospf = vty->index;
1655 struct in_addr area_id;
1656 int format;
1657
1658 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1659
1660 ospf_area_nssa_unset (ospf, area_id);
1661 ospf_area_no_summary_unset (ospf, area_id);
1662
paulb0a053b2003-06-22 09:04:47 +00001663 ospf_schedule_abr_task (ospf);
1664
paul718e3742002-12-13 20:15:29 +00001665 return CMD_SUCCESS;
1666}
1667
paula2c62832003-04-23 17:01:31 +00001668DEFUN (no_ospf_area_nssa_no_summary,
1669 no_ospf_area_nssa_no_summary_cmd,
paul718e3742002-12-13 20:15:29 +00001670 "no area (A.B.C.D|<0-4294967295>) nssa no-summary",
1671 NO_STR
1672 "OSPF area parameters\n"
1673 "OSPF area ID in IP address format\n"
1674 "OSPF area ID as a decimal value\n"
1675 "Configure OSPF area as nssa\n"
1676 "Do not inject inter-area routes into nssa\n")
1677{
1678 struct ospf *ospf = vty->index;
1679 struct in_addr area_id;
1680 int format;
1681
1682 VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]);
1683 ospf_area_no_summary_unset (ospf, area_id);
1684
1685 return CMD_SUCCESS;
1686}
1687
paula2c62832003-04-23 17:01:31 +00001688DEFUN (ospf_area_default_cost,
1689 ospf_area_default_cost_cmd,
paul718e3742002-12-13 20:15:29 +00001690 "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1691 "OSPF area parameters\n"
1692 "OSPF area ID in IP address format\n"
1693 "OSPF area ID as a decimal value\n"
1694 "Set the summary-default cost of a NSSA or stub area\n"
1695 "Stub's advertised default summary cost\n")
1696{
paul68980082003-03-25 05:07:42 +00001697 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001698 struct ospf_area *area;
1699 struct in_addr area_id;
1700 u_int32_t cost;
1701 int format;
vincentba682532005-09-29 13:52:57 +00001702 struct prefix_ipv4 p;
paul718e3742002-12-13 20:15:29 +00001703
1704 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1705 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1706
paul68980082003-03-25 05:07:42 +00001707 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001708
1709 if (area->external_routing == OSPF_AREA_DEFAULT)
1710 {
1711 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1712 return CMD_WARNING;
1713 }
1714
1715 area->default_cost = cost;
1716
vincentba682532005-09-29 13:52:57 +00001717 p.family = AF_INET;
1718 p.prefix.s_addr = OSPF_DEFAULT_DESTINATION;
1719 p.prefixlen = 0;
1720 if (IS_DEBUG_OSPF_EVENT)
1721 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1722 "announcing 0.0.0.0/0 to area %s",
1723 inet_ntoa (area->area_id));
1724 ospf_abr_announce_network_to_area (&p, area->default_cost, area);
1725
paul718e3742002-12-13 20:15:29 +00001726 return CMD_SUCCESS;
1727}
1728
paula2c62832003-04-23 17:01:31 +00001729DEFUN (no_ospf_area_default_cost,
1730 no_ospf_area_default_cost_cmd,
paul718e3742002-12-13 20:15:29 +00001731 "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>",
1732 NO_STR
1733 "OSPF area parameters\n"
1734 "OSPF area ID in IP address format\n"
1735 "OSPF area ID as a decimal value\n"
1736 "Set the summary-default cost of a NSSA or stub area\n"
1737 "Stub's advertised default summary cost\n")
1738{
paul68980082003-03-25 05:07:42 +00001739 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001740 struct ospf_area *area;
1741 struct in_addr area_id;
1742 u_int32_t cost;
1743 int format;
vincentba682532005-09-29 13:52:57 +00001744 struct prefix_ipv4 p;
paul718e3742002-12-13 20:15:29 +00001745
1746 VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]);
1747 VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215);
1748
paul68980082003-03-25 05:07:42 +00001749 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001750 if (area == NULL)
1751 return CMD_SUCCESS;
1752
1753 if (area->external_routing == OSPF_AREA_DEFAULT)
1754 {
1755 vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE);
1756 return CMD_WARNING;
1757 }
1758
1759 area->default_cost = 1;
1760
vincentba682532005-09-29 13:52:57 +00001761 p.family = AF_INET;
1762 p.prefix.s_addr = OSPF_DEFAULT_DESTINATION;
1763 p.prefixlen = 0;
1764 if (IS_DEBUG_OSPF_EVENT)
1765 zlog_debug ("ospf_abr_announce_stub_defaults(): "
1766 "announcing 0.0.0.0/0 to area %s",
1767 inet_ntoa (area->area_id));
1768 ospf_abr_announce_network_to_area (&p, area->default_cost, area);
1769
1770
paul68980082003-03-25 05:07:42 +00001771 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001772
1773 return CMD_SUCCESS;
1774}
1775
paula2c62832003-04-23 17:01:31 +00001776DEFUN (ospf_area_export_list,
1777 ospf_area_export_list_cmd,
paul718e3742002-12-13 20:15:29 +00001778 "area (A.B.C.D|<0-4294967295>) export-list NAME",
1779 "OSPF area parameters\n"
1780 "OSPF area ID in IP address format\n"
1781 "OSPF area ID as a decimal value\n"
1782 "Set the filter for networks announced to other areas\n"
1783 "Name of the access-list\n")
1784{
paul68980082003-03-25 05:07:42 +00001785 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001786 struct ospf_area *area;
1787 struct in_addr area_id;
1788 int format;
1789
hasso52930762004-04-19 18:26:53 +00001790 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1791
paul68980082003-03-25 05:07:42 +00001792 area = ospf_area_get (ospf, area_id, format);
1793 ospf_area_export_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001794
1795 return CMD_SUCCESS;
1796}
1797
paula2c62832003-04-23 17:01:31 +00001798DEFUN (no_ospf_area_export_list,
1799 no_ospf_area_export_list_cmd,
paul718e3742002-12-13 20:15:29 +00001800 "no area (A.B.C.D|<0-4294967295>) export-list NAME",
1801 NO_STR
1802 "OSPF area parameters\n"
1803 "OSPF area ID in IP address format\n"
1804 "OSPF area ID as a decimal value\n"
1805 "Unset the filter for networks announced to other areas\n"
1806 "Name of the access-list\n")
1807{
paul68980082003-03-25 05:07:42 +00001808 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001809 struct ospf_area *area;
1810 struct in_addr area_id;
1811 int format;
1812
hasso52930762004-04-19 18:26:53 +00001813 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1814
paul68980082003-03-25 05:07:42 +00001815 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001816 if (area == NULL)
1817 return CMD_SUCCESS;
1818
paul68980082003-03-25 05:07:42 +00001819 ospf_area_export_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001820
1821 return CMD_SUCCESS;
1822}
1823
1824
paula2c62832003-04-23 17:01:31 +00001825DEFUN (ospf_area_import_list,
1826 ospf_area_import_list_cmd,
paul718e3742002-12-13 20:15:29 +00001827 "area (A.B.C.D|<0-4294967295>) import-list NAME",
1828 "OSPF area parameters\n"
1829 "OSPF area ID in IP address format\n"
1830 "OSPF area ID as a decimal value\n"
1831 "Set the filter for networks from other areas announced to the specified one\n"
1832 "Name of the access-list\n")
1833{
paul68980082003-03-25 05:07:42 +00001834 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001835 struct ospf_area *area;
1836 struct in_addr area_id;
1837 int format;
1838
hasso52930762004-04-19 18:26:53 +00001839 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1840
paul68980082003-03-25 05:07:42 +00001841 area = ospf_area_get (ospf, area_id, format);
1842 ospf_area_import_list_set (ospf, area, argv[1]);
paul718e3742002-12-13 20:15:29 +00001843
1844 return CMD_SUCCESS;
1845}
1846
paula2c62832003-04-23 17:01:31 +00001847DEFUN (no_ospf_area_import_list,
1848 no_ospf_area_import_list_cmd,
paul718e3742002-12-13 20:15:29 +00001849 "no area (A.B.C.D|<0-4294967295>) import-list NAME",
1850 NO_STR
1851 "OSPF area parameters\n"
1852 "OSPF area ID in IP address format\n"
1853 "OSPF area ID as a decimal value\n"
1854 "Unset the filter for networks announced to other areas\n"
1855 "Name of the access-list\n")
1856{
paul68980082003-03-25 05:07:42 +00001857 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001858 struct ospf_area *area;
1859 struct in_addr area_id;
1860 int format;
1861
hasso52930762004-04-19 18:26:53 +00001862 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1863
paul68980082003-03-25 05:07:42 +00001864 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00001865 if (area == NULL)
1866 return CMD_SUCCESS;
1867
paul68980082003-03-25 05:07:42 +00001868 ospf_area_import_list_unset (ospf, area);
paul718e3742002-12-13 20:15:29 +00001869
1870 return CMD_SUCCESS;
1871}
1872
paula2c62832003-04-23 17:01:31 +00001873DEFUN (ospf_area_filter_list,
1874 ospf_area_filter_list_cmd,
paul718e3742002-12-13 20:15:29 +00001875 "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1876 "OSPF area parameters\n"
1877 "OSPF area ID in IP address format\n"
1878 "OSPF area ID as a decimal value\n"
1879 "Filter networks between OSPF areas\n"
1880 "Filter prefixes between OSPF areas\n"
1881 "Name of an IP prefix-list\n"
1882 "Filter networks sent to this area\n"
1883 "Filter networks sent from this area\n")
1884{
paul68980082003-03-25 05:07:42 +00001885 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001886 struct ospf_area *area;
1887 struct in_addr area_id;
1888 struct prefix_list *plist;
1889 int format;
1890
1891 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1892
paul68980082003-03-25 05:07:42 +00001893 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001894 plist = prefix_list_lookup (AFI_IP, argv[1]);
1895 if (strncmp (argv[2], "in", 2) == 0)
1896 {
1897 PREFIX_LIST_IN (area) = plist;
1898 if (PREFIX_NAME_IN (area))
1899 free (PREFIX_NAME_IN (area));
1900
1901 PREFIX_NAME_IN (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001902 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001903 }
1904 else
1905 {
1906 PREFIX_LIST_OUT (area) = plist;
1907 if (PREFIX_NAME_OUT (area))
1908 free (PREFIX_NAME_OUT (area));
1909
1910 PREFIX_NAME_OUT (area) = strdup (argv[1]);
paul68980082003-03-25 05:07:42 +00001911 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001912 }
1913
1914 return CMD_SUCCESS;
1915}
1916
paula2c62832003-04-23 17:01:31 +00001917DEFUN (no_ospf_area_filter_list,
1918 no_ospf_area_filter_list_cmd,
paul718e3742002-12-13 20:15:29 +00001919 "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)",
1920 NO_STR
1921 "OSPF area parameters\n"
1922 "OSPF area ID in IP address format\n"
1923 "OSPF area ID as a decimal value\n"
1924 "Filter networks between OSPF areas\n"
1925 "Filter prefixes between OSPF areas\n"
1926 "Name of an IP prefix-list\n"
1927 "Filter networks sent to this area\n"
1928 "Filter networks sent from this area\n")
1929{
paul68980082003-03-25 05:07:42 +00001930 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001931 struct ospf_area *area;
1932 struct in_addr area_id;
1933 struct prefix_list *plist;
1934 int format;
1935
1936 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1937
Paul Jakma1a8ec2b2006-05-11 13:34:08 +00001938 if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL)
1939 return CMD_SUCCESS;
1940
paul718e3742002-12-13 20:15:29 +00001941 plist = prefix_list_lookup (AFI_IP, argv[1]);
1942 if (strncmp (argv[2], "in", 2) == 0)
1943 {
1944 if (PREFIX_NAME_IN (area))
1945 if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0)
1946 return CMD_SUCCESS;
1947
1948 PREFIX_LIST_IN (area) = NULL;
1949 if (PREFIX_NAME_IN (area))
1950 free (PREFIX_NAME_IN (area));
1951
1952 PREFIX_NAME_IN (area) = NULL;
1953
paul68980082003-03-25 05:07:42 +00001954 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001955 }
1956 else
1957 {
1958 if (PREFIX_NAME_OUT (area))
1959 if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0)
1960 return CMD_SUCCESS;
1961
1962 PREFIX_LIST_OUT (area) = NULL;
1963 if (PREFIX_NAME_OUT (area))
1964 free (PREFIX_NAME_OUT (area));
1965
1966 PREFIX_NAME_OUT (area) = NULL;
1967
paul68980082003-03-25 05:07:42 +00001968 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00001969 }
1970
1971 return CMD_SUCCESS;
1972}
1973
1974
paula2c62832003-04-23 17:01:31 +00001975DEFUN (ospf_area_authentication_message_digest,
1976 ospf_area_authentication_message_digest_cmd,
paul718e3742002-12-13 20:15:29 +00001977 "area (A.B.C.D|<0-4294967295>) authentication message-digest",
1978 "OSPF area parameters\n"
1979 "Enable authentication\n"
1980 "Use message-digest authentication\n")
1981{
paul68980082003-03-25 05:07:42 +00001982 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00001983 struct ospf_area *area;
1984 struct in_addr area_id;
1985 int format;
1986
1987 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
1988
paul68980082003-03-25 05:07:42 +00001989 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00001990 area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
1991
1992 return CMD_SUCCESS;
1993}
1994
paula2c62832003-04-23 17:01:31 +00001995DEFUN (ospf_area_authentication,
1996 ospf_area_authentication_cmd,
paul718e3742002-12-13 20:15:29 +00001997 "area (A.B.C.D|<0-4294967295>) authentication",
1998 "OSPF area parameters\n"
1999 "OSPF area ID in IP address format\n"
2000 "OSPF area ID as a decimal value\n"
2001 "Enable authentication\n")
2002{
paul68980082003-03-25 05:07:42 +00002003 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002004 struct ospf_area *area;
2005 struct in_addr area_id;
2006 int format;
2007
2008 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
2009
paul68980082003-03-25 05:07:42 +00002010 area = ospf_area_get (ospf, area_id, format);
paul718e3742002-12-13 20:15:29 +00002011 area->auth_type = OSPF_AUTH_SIMPLE;
2012
2013 return CMD_SUCCESS;
2014}
2015
paula2c62832003-04-23 17:01:31 +00002016DEFUN (no_ospf_area_authentication,
2017 no_ospf_area_authentication_cmd,
paul718e3742002-12-13 20:15:29 +00002018 "no area (A.B.C.D|<0-4294967295>) authentication",
2019 NO_STR
2020 "OSPF area parameters\n"
2021 "OSPF area ID in IP address format\n"
2022 "OSPF area ID as a decimal value\n"
2023 "Enable authentication\n")
2024{
paul68980082003-03-25 05:07:42 +00002025 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002026 struct ospf_area *area;
2027 struct in_addr area_id;
2028 int format;
2029
2030 VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]);
2031
paul68980082003-03-25 05:07:42 +00002032 area = ospf_area_lookup_by_area_id (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00002033 if (area == NULL)
2034 return CMD_SUCCESS;
2035
2036 area->auth_type = OSPF_AUTH_NULL;
2037
paul68980082003-03-25 05:07:42 +00002038 ospf_area_check_free (ospf, area_id);
paul718e3742002-12-13 20:15:29 +00002039
2040 return CMD_SUCCESS;
2041}
2042
2043
2044DEFUN (ospf_abr_type,
2045 ospf_abr_type_cmd,
2046 "ospf abr-type (cisco|ibm|shortcut|standard)",
2047 "OSPF specific commands\n"
2048 "Set OSPF ABR type\n"
2049 "Alternative ABR, cisco implementation\n"
2050 "Alternative ABR, IBM implementation\n"
2051 "Shortcut ABR\n"
2052 "Standard behavior (RFC2328)\n")
2053{
paul68980082003-03-25 05:07:42 +00002054 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002055 u_char abr_type = OSPF_ABR_UNKNOWN;
2056
2057 if (strncmp (argv[0], "c", 1) == 0)
2058 abr_type = OSPF_ABR_CISCO;
2059 else if (strncmp (argv[0], "i", 1) == 0)
2060 abr_type = OSPF_ABR_IBM;
2061 else if (strncmp (argv[0], "sh", 2) == 0)
2062 abr_type = OSPF_ABR_SHORTCUT;
2063 else if (strncmp (argv[0], "st", 2) == 0)
2064 abr_type = OSPF_ABR_STAND;
2065 else
2066 return CMD_WARNING;
2067
2068 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00002069 if (ospf->abr_type != abr_type)
paul718e3742002-12-13 20:15:29 +00002070 {
paul68980082003-03-25 05:07:42 +00002071 ospf->abr_type = abr_type;
2072 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00002073 }
2074
2075 return CMD_SUCCESS;
2076}
2077
2078DEFUN (no_ospf_abr_type,
2079 no_ospf_abr_type_cmd,
pauld57834f2005-07-12 20:04:22 +00002080 "no ospf abr-type (cisco|ibm|shortcut|standard)",
paul718e3742002-12-13 20:15:29 +00002081 NO_STR
2082 "OSPF specific commands\n"
2083 "Set OSPF ABR type\n"
2084 "Alternative ABR, cisco implementation\n"
2085 "Alternative ABR, IBM implementation\n"
2086 "Shortcut ABR\n")
2087{
paul68980082003-03-25 05:07:42 +00002088 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002089 u_char abr_type = OSPF_ABR_UNKNOWN;
2090
2091 if (strncmp (argv[0], "c", 1) == 0)
2092 abr_type = OSPF_ABR_CISCO;
2093 else if (strncmp (argv[0], "i", 1) == 0)
2094 abr_type = OSPF_ABR_IBM;
Francesco Dolcini04d23312009-06-02 18:20:09 +01002095 else if (strncmp (argv[0], "sh", 2) == 0)
paul718e3742002-12-13 20:15:29 +00002096 abr_type = OSPF_ABR_SHORTCUT;
Francesco Dolcini04d23312009-06-02 18:20:09 +01002097 else if (strncmp (argv[0], "st", 2) == 0)
2098 abr_type = OSPF_ABR_STAND;
paul718e3742002-12-13 20:15:29 +00002099 else
2100 return CMD_WARNING;
2101
2102 /* If ABR type value is changed, schedule ABR task. */
paul68980082003-03-25 05:07:42 +00002103 if (ospf->abr_type == abr_type)
paul718e3742002-12-13 20:15:29 +00002104 {
pauld57834f2005-07-12 20:04:22 +00002105 ospf->abr_type = OSPF_ABR_DEFAULT;
paul68980082003-03-25 05:07:42 +00002106 ospf_schedule_abr_task (ospf);
paul718e3742002-12-13 20:15:29 +00002107 }
2108
2109 return CMD_SUCCESS;
2110}
2111
Andrew J. Schorrd7e60dd2006-06-29 20:20:52 +00002112DEFUN (ospf_log_adjacency_changes,
2113 ospf_log_adjacency_changes_cmd,
2114 "log-adjacency-changes",
2115 "Log changes in adjacency state\n")
2116{
2117 struct ospf *ospf = vty->index;
2118
2119 SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES);
2120 return CMD_SUCCESS;
2121}
2122
2123DEFUN (ospf_log_adjacency_changes_detail,
2124 ospf_log_adjacency_changes_detail_cmd,
2125 "log-adjacency-changes detail",
2126 "Log changes in adjacency state\n"
2127 "Log all state changes\n")
2128{
2129 struct ospf *ospf = vty->index;
2130
2131 SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES);
2132 SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL);
2133 return CMD_SUCCESS;
2134}
2135
2136DEFUN (no_ospf_log_adjacency_changes,
2137 no_ospf_log_adjacency_changes_cmd,
2138 "no log-adjacency-changes",
2139 NO_STR
2140 "Log changes in adjacency state\n")
2141{
2142 struct ospf *ospf = vty->index;
2143
2144 UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL);
2145 UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES);
2146 return CMD_SUCCESS;
2147}
2148
2149DEFUN (no_ospf_log_adjacency_changes_detail,
2150 no_ospf_log_adjacency_changes_detail_cmd,
2151 "no log-adjacency-changes detail",
2152 NO_STR
2153 "Log changes in adjacency state\n"
2154 "Log all state changes\n")
2155{
2156 struct ospf *ospf = vty->index;
2157
2158 UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL);
2159 return CMD_SUCCESS;
2160}
2161
paul718e3742002-12-13 20:15:29 +00002162DEFUN (ospf_compatible_rfc1583,
2163 ospf_compatible_rfc1583_cmd,
2164 "compatible rfc1583",
2165 "OSPF compatibility list\n"
2166 "compatible with RFC 1583\n")
2167{
2168 struct ospf *ospf = vty->index;
2169
2170 if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2171 {
2172 SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002173 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002174 }
2175 return CMD_SUCCESS;
2176}
2177
2178DEFUN (no_ospf_compatible_rfc1583,
2179 no_ospf_compatible_rfc1583_cmd,
2180 "no compatible rfc1583",
2181 NO_STR
2182 "OSPF compatibility list\n"
2183 "compatible with RFC 1583\n")
2184{
2185 struct ospf *ospf = vty->index;
2186
2187 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
2188 {
2189 UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE);
paul68980082003-03-25 05:07:42 +00002190 ospf_spf_calculate_schedule (ospf);
paul718e3742002-12-13 20:15:29 +00002191 }
2192 return CMD_SUCCESS;
2193}
2194
2195ALIAS (ospf_compatible_rfc1583,
2196 ospf_rfc1583_flag_cmd,
2197 "ospf rfc1583compatibility",
2198 "OSPF specific commands\n"
2199 "Enable the RFC1583Compatibility flag\n")
2200
2201ALIAS (no_ospf_compatible_rfc1583,
2202 no_ospf_rfc1583_flag_cmd,
2203 "no ospf rfc1583compatibility",
2204 NO_STR
2205 "OSPF specific commands\n"
2206 "Disable the RFC1583Compatibility flag\n")
pauld24f6e22005-10-21 09:23:12 +00002207
2208static int
2209ospf_timers_spf_set (struct vty *vty, unsigned int delay,
2210 unsigned int hold,
2211 unsigned int max)
2212{
2213 struct ospf *ospf = vty->index;
2214
2215 ospf->spf_delay = delay;
2216 ospf->spf_holdtime = hold;
2217 ospf->spf_max_holdtime = max;
2218
2219 return CMD_SUCCESS;
2220}
paul718e3742002-12-13 20:15:29 +00002221
pauld24f6e22005-10-21 09:23:12 +00002222DEFUN (ospf_timers_throttle_spf,
2223 ospf_timers_throttle_spf_cmd,
2224 "timers throttle spf <0-600000> <0-600000> <0-600000>",
2225 "Adjust routing timers\n"
2226 "Throttling adaptive timer\n"
2227 "OSPF SPF timers\n"
2228 "Delay (msec) from first change received till SPF calculation\n"
2229 "Initial hold time (msec) between consecutive SPF calculations\n"
2230 "Maximum hold time (msec)\n")
2231{
2232 unsigned int delay, hold, max;
2233
2234 if (argc != 3)
2235 {
2236 vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE);
2237 return CMD_WARNING;
2238 }
2239
2240 VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000);
2241 VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000);
2242 VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000);
2243
2244 return ospf_timers_spf_set (vty, delay, hold, max);
2245}
2246
2247DEFUN_DEPRECATED (ospf_timers_spf,
paula2c62832003-04-23 17:01:31 +00002248 ospf_timers_spf_cmd,
paul718e3742002-12-13 20:15:29 +00002249 "timers spf <0-4294967295> <0-4294967295>",
2250 "Adjust routing timers\n"
2251 "OSPF SPF timers\n"
pauld24f6e22005-10-21 09:23:12 +00002252 "Delay (s) between receiving a change to SPF calculation\n"
2253 "Hold time (s) between consecutive SPF calculations\n")
paul718e3742002-12-13 20:15:29 +00002254{
pauld24f6e22005-10-21 09:23:12 +00002255 unsigned int delay, hold;
2256
2257 if (argc != 2)
2258 {
2259 vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE);
2260 return CMD_WARNING;
2261 }
2262
paul4dadc292005-05-06 21:37:42 +00002263 VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]);
2264 VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]);
pauld24f6e22005-10-21 09:23:12 +00002265
2266 /* truncate down the second values if they're greater than 600000ms */
2267 if (delay > (600000 / 1000))
2268 delay = 600000;
2269 else if (delay == 0)
2270 /* 0s delay was probably specified because of lack of ms resolution */
2271 delay = OSPF_SPF_DELAY_DEFAULT;
2272 if (hold > (600000 / 1000))
2273 hold = 600000;
2274
2275 return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000);
paul718e3742002-12-13 20:15:29 +00002276}
2277
pauld24f6e22005-10-21 09:23:12 +00002278DEFUN (no_ospf_timers_throttle_spf,
2279 no_ospf_timers_throttle_spf_cmd,
2280 "no timers throttle spf",
paul718e3742002-12-13 20:15:29 +00002281 NO_STR
2282 "Adjust routing timers\n"
pauld24f6e22005-10-21 09:23:12 +00002283 "Throttling adaptive timer\n"
paul718e3742002-12-13 20:15:29 +00002284 "OSPF SPF timers\n")
2285{
pauld24f6e22005-10-21 09:23:12 +00002286 return ospf_timers_spf_set (vty,
2287 OSPF_SPF_DELAY_DEFAULT,
2288 OSPF_SPF_HOLDTIME_DEFAULT,
2289 OSPF_SPF_MAX_HOLDTIME_DEFAULT);
paul718e3742002-12-13 20:15:29 +00002290}
2291
pauld24f6e22005-10-21 09:23:12 +00002292ALIAS_DEPRECATED (no_ospf_timers_throttle_spf,
2293 no_ospf_timers_spf_cmd,
2294 "no timers spf",
2295 NO_STR
2296 "Adjust routing timers\n"
2297 "OSPF SPF timers\n")
paul718e3742002-12-13 20:15:29 +00002298
paula2c62832003-04-23 17:01:31 +00002299DEFUN (ospf_neighbor,
2300 ospf_neighbor_cmd,
paul718e3742002-12-13 20:15:29 +00002301 "neighbor A.B.C.D",
2302 NEIGHBOR_STR
2303 "Neighbor IP address\n")
2304{
2305 struct ospf *ospf = vty->index;
2306 struct in_addr nbr_addr;
hassoeb1ce602004-10-08 08:17:22 +00002307 unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2308 unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002309
2310 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2311
2312 if (argc > 1)
2313 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255);
2314
2315 if (argc > 2)
2316 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535);
2317
2318 ospf_nbr_nbma_set (ospf, nbr_addr);
2319 if (argc > 1)
2320 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2321 if (argc > 2)
2322 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority);
2323
2324 return CMD_SUCCESS;
2325}
2326
paula2c62832003-04-23 17:01:31 +00002327ALIAS (ospf_neighbor,
2328 ospf_neighbor_priority_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002329 "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2330 NEIGHBOR_STR
2331 "Neighbor IP address\n"
2332 "Neighbor Priority\n"
2333 "Priority\n"
2334 "Dead Neighbor Polling interval\n"
2335 "Seconds\n")
2336
paula2c62832003-04-23 17:01:31 +00002337ALIAS (ospf_neighbor,
2338 ospf_neighbor_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002339 "neighbor A.B.C.D priority <0-255>",
2340 NEIGHBOR_STR
2341 "Neighbor IP address\n"
2342 "Neighbor Priority\n"
2343 "Seconds\n")
2344
paula2c62832003-04-23 17:01:31 +00002345DEFUN (ospf_neighbor_poll_interval,
2346 ospf_neighbor_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002347 "neighbor A.B.C.D poll-interval <1-65535>",
2348 NEIGHBOR_STR
2349 "Neighbor IP address\n"
2350 "Dead Neighbor Polling interval\n"
2351 "Seconds\n")
2352{
2353 struct ospf *ospf = vty->index;
2354 struct in_addr nbr_addr;
hassoeb1ce602004-10-08 08:17:22 +00002355 unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT;
2356 unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT;
paul718e3742002-12-13 20:15:29 +00002357
2358 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2359
2360 if (argc > 1)
2361 VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535);
2362
2363 if (argc > 2)
2364 VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255);
2365
2366 ospf_nbr_nbma_set (ospf, nbr_addr);
2367 if (argc > 1)
2368 ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval);
2369 if (argc > 2)
2370 ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority);
2371
2372 return CMD_SUCCESS;
2373}
2374
paula2c62832003-04-23 17:01:31 +00002375ALIAS (ospf_neighbor_poll_interval,
2376 ospf_neighbor_poll_interval_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002377 "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>",
2378 NEIGHBOR_STR
2379 "Neighbor address\n"
2380 "OSPF dead-router polling interval\n"
2381 "Seconds\n"
2382 "OSPF priority of non-broadcast neighbor\n"
2383 "Priority\n")
2384
paula2c62832003-04-23 17:01:31 +00002385DEFUN (no_ospf_neighbor,
2386 no_ospf_neighbor_cmd,
paul718e3742002-12-13 20:15:29 +00002387 "no neighbor A.B.C.D",
2388 NO_STR
2389 NEIGHBOR_STR
2390 "Neighbor IP address\n")
2391{
2392 struct ospf *ospf = vty->index;
2393 struct in_addr nbr_addr;
2394 int ret;
2395
2396 VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]);
2397
2398 ret = ospf_nbr_nbma_unset (ospf, nbr_addr);
2399
2400 return CMD_SUCCESS;
2401}
2402
paula2c62832003-04-23 17:01:31 +00002403ALIAS (no_ospf_neighbor,
2404 no_ospf_neighbor_priority_cmd,
paul718e3742002-12-13 20:15:29 +00002405 "no neighbor A.B.C.D priority <0-255>",
2406 NO_STR
2407 NEIGHBOR_STR
2408 "Neighbor IP address\n"
2409 "Neighbor Priority\n"
2410 "Priority\n")
2411
paula2c62832003-04-23 17:01:31 +00002412ALIAS (no_ospf_neighbor,
2413 no_ospf_neighbor_poll_interval_cmd,
paul718e3742002-12-13 20:15:29 +00002414 "no neighbor A.B.C.D poll-interval <1-65535>",
2415 NO_STR
2416 NEIGHBOR_STR
2417 "Neighbor IP address\n"
2418 "Dead Neighbor Polling interval\n"
2419 "Seconds\n")
2420
paula2c62832003-04-23 17:01:31 +00002421ALIAS (no_ospf_neighbor,
2422 no_ospf_neighbor_priority_pollinterval_cmd,
paul718e3742002-12-13 20:15:29 +00002423 "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>",
2424 NO_STR
2425 NEIGHBOR_STR
2426 "Neighbor IP address\n"
2427 "Neighbor Priority\n"
2428 "Priority\n"
2429 "Dead Neighbor Polling interval\n"
2430 "Seconds\n")
2431
2432
paula2c62832003-04-23 17:01:31 +00002433DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd,
paul718e3742002-12-13 20:15:29 +00002434 "refresh timer <10-1800>",
2435 "Adjust refresh parameters\n"
2436 "Set refresh timer\n"
2437 "Timer value in seconds\n")
2438{
2439 struct ospf *ospf = vty->index;
hassoeb1ce602004-10-08 08:17:22 +00002440 unsigned int interval;
paul718e3742002-12-13 20:15:29 +00002441
2442 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2443 interval = (interval / 10) * 10;
2444
2445 ospf_timers_refresh_set (ospf, interval);
2446
2447 return CMD_SUCCESS;
2448}
2449
paula2c62832003-04-23 17:01:31 +00002450DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd,
paul718e3742002-12-13 20:15:29 +00002451 "no refresh timer <10-1800>",
2452 "Adjust refresh parameters\n"
2453 "Unset refresh timer\n"
2454 "Timer value in seconds\n")
2455{
2456 struct ospf *ospf = vty->index;
hassoeb1ce602004-10-08 08:17:22 +00002457 unsigned int interval;
paul718e3742002-12-13 20:15:29 +00002458
2459 if (argc == 1)
2460 {
2461 VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800);
2462
2463 if (ospf->lsa_refresh_interval != interval ||
2464 interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
2465 return CMD_SUCCESS;
2466 }
2467
2468 ospf_timers_refresh_unset (ospf);
2469
2470 return CMD_SUCCESS;
2471}
2472
paula2c62832003-04-23 17:01:31 +00002473ALIAS (no_ospf_refresh_timer,
2474 no_ospf_refresh_timer_cmd,
paul718e3742002-12-13 20:15:29 +00002475 "no refresh timer",
2476 "Adjust refresh parameters\n"
2477 "Unset refresh timer\n")
2478
paula2c62832003-04-23 17:01:31 +00002479DEFUN (ospf_auto_cost_reference_bandwidth,
2480 ospf_auto_cost_reference_bandwidth_cmd,
paul718e3742002-12-13 20:15:29 +00002481 "auto-cost reference-bandwidth <1-4294967>",
2482 "Calculate OSPF interface cost according to bandwidth\n"
2483 "Use reference bandwidth method to assign OSPF cost\n"
2484 "The reference bandwidth in terms of Mbits per second\n")
2485{
paul68980082003-03-25 05:07:42 +00002486 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00002487 u_int32_t refbw;
hasso52dc7ee2004-09-23 19:18:23 +00002488 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00002489 struct interface *ifp;
paul718e3742002-12-13 20:15:29 +00002490
2491 refbw = strtol (argv[0], NULL, 10);
2492 if (refbw < 1 || refbw > 4294967)
2493 {
2494 vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE);
2495 return CMD_WARNING;
2496 }
2497
2498 /* If reference bandwidth is changed. */
paul68980082003-03-25 05:07:42 +00002499 if ((refbw * 1000) == ospf->ref_bandwidth)
paul718e3742002-12-13 20:15:29 +00002500 return CMD_SUCCESS;
2501
paul68980082003-03-25 05:07:42 +00002502 ospf->ref_bandwidth = refbw * 1000;
paul1eb8ef22005-04-07 07:30:20 +00002503 for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
2504 ospf_if_recalculate_output_cost (ifp);
paul718e3742002-12-13 20:15:29 +00002505
2506 return CMD_SUCCESS;
2507}
2508
paula2c62832003-04-23 17:01:31 +00002509DEFUN (no_ospf_auto_cost_reference_bandwidth,
2510 no_ospf_auto_cost_reference_bandwidth_cmd,
paul718e3742002-12-13 20:15:29 +00002511 "no auto-cost reference-bandwidth",
2512 NO_STR
2513 "Calculate OSPF interface cost according to bandwidth\n"
2514 "Use reference bandwidth method to assign OSPF cost\n")
2515{
paul68980082003-03-25 05:07:42 +00002516 struct ospf *ospf = vty->index;
paul1eb8ef22005-04-07 07:30:20 +00002517 struct listnode *node, *nnode;
2518 struct interface *ifp;
paul718e3742002-12-13 20:15:29 +00002519
paul68980082003-03-25 05:07:42 +00002520 if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH)
paul718e3742002-12-13 20:15:29 +00002521 return CMD_SUCCESS;
2522
paul68980082003-03-25 05:07:42 +00002523 ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH;
paul718e3742002-12-13 20:15:29 +00002524 vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE);
2525 vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE);
2526
paul1eb8ef22005-04-07 07:30:20 +00002527 for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp))
2528 ospf_if_recalculate_output_cost (ifp);
paul718e3742002-12-13 20:15:29 +00002529
2530 return CMD_SUCCESS;
2531}
2532
hassoeb1ce602004-10-08 08:17:22 +00002533const char *ospf_abr_type_descr_str[] =
paul718e3742002-12-13 20:15:29 +00002534{
2535 "Unknown",
2536 "Standard (RFC2328)",
2537 "Alternative IBM",
2538 "Alternative Cisco",
2539 "Alternative Shortcut"
2540};
2541
hassoeb1ce602004-10-08 08:17:22 +00002542const char *ospf_shortcut_mode_descr_str[] =
paul718e3742002-12-13 20:15:29 +00002543{
2544 "Default",
2545 "Enabled",
2546 "Disabled"
2547};
2548
2549
2550
paul4dadc292005-05-06 21:37:42 +00002551static void
paul718e3742002-12-13 20:15:29 +00002552show_ip_ospf_area (struct vty *vty, struct ospf_area *area)
2553{
2554 /* Show Area ID. */
2555 vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id));
2556
2557 /* Show Area type/mode. */
2558 if (OSPF_IS_AREA_BACKBONE (area))
2559 vty_out (vty, " (Backbone)%s", VTY_NEWLINE);
2560 else
2561 {
2562 if (area->external_routing == OSPF_AREA_STUB)
paulb0a053b2003-06-22 09:04:47 +00002563 vty_out (vty, " (Stub%s%s)",
2564 area->no_summary ? ", no summary" : "",
2565 area->shortcut_configured ? "; " : "");
paul718e3742002-12-13 20:15:29 +00002566
paulb0a053b2003-06-22 09:04:47 +00002567 else if (area->external_routing == OSPF_AREA_NSSA)
2568 vty_out (vty, " (NSSA%s%s)",
2569 area->no_summary ? ", no summary" : "",
2570 area->shortcut_configured ? "; " : "");
paul718e3742002-12-13 20:15:29 +00002571
2572 vty_out (vty, "%s", VTY_NEWLINE);
2573 vty_out (vty, " Shortcutting mode: %s",
paulb0a053b2003-06-22 09:04:47 +00002574 ospf_shortcut_mode_descr_str[area->shortcut_configured]);
paul718e3742002-12-13 20:15:29 +00002575 vty_out (vty, ", S-bit consensus: %s%s",
paulb0a053b2003-06-22 09:04:47 +00002576 area->shortcut_capability ? "ok" : "no", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002577 }
2578
2579 /* Show number of interfaces. */
2580 vty_out (vty, " Number of interfaces in this area: Total: %d, "
2581 "Active: %d%s", listcount (area->oiflist),
2582 area->act_ints, VTY_NEWLINE);
2583
paul718e3742002-12-13 20:15:29 +00002584 if (area->external_routing == OSPF_AREA_NSSA)
2585 {
2586 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 +00002587 if (! IS_OSPF_ABR (area->ospf))
paulb0a053b2003-06-22 09:04:47 +00002588 vty_out (vty, " It is not ABR, therefore not Translator. %s",
2589 VTY_NEWLINE);
2590 else if (area->NSSATranslatorState)
2591 {
2592 vty_out (vty, " We are an ABR and ");
2593 if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE)
2594 vty_out (vty, "the NSSA Elected Translator. %s",
2595 VTY_NEWLINE);
2596 else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS)
2597 vty_out (vty, "always an NSSA Translator. %s",
2598 VTY_NEWLINE);
2599 }
paul718e3742002-12-13 20:15:29 +00002600 else
paulb0a053b2003-06-22 09:04:47 +00002601 {
2602 vty_out (vty, " We are an ABR, but ");
2603 if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE)
2604 vty_out (vty, "not the NSSA Elected Translator. %s",
2605 VTY_NEWLINE);
2606 else
hassoc6b87812004-12-22 13:09:59 +00002607 vty_out (vty, "never an NSSA Translator. %s",
paulb0a053b2003-06-22 09:04:47 +00002608 VTY_NEWLINE);
2609 }
paul718e3742002-12-13 20:15:29 +00002610 }
paul88d6cf32005-10-29 12:50:09 +00002611 /* Stub-router state for this area */
2612 if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED))
2613 {
ajs649654a2005-11-16 20:17:52 +00002614 char timebuf[OSPF_TIME_DUMP_SIZE];
paul88d6cf32005-10-29 12:50:09 +00002615 vty_out (vty, " Originating stub / maximum-distance Router-LSA%s",
2616 VTY_NEWLINE);
2617 if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
2618 vty_out (vty, " Administratively activated (indefinitely)%s",
2619 VTY_NEWLINE);
2620 if (area->t_stub_router)
2621 vty_out (vty, " Active from startup, %s remaining%s",
2622 ospf_timer_dump (area->t_stub_router, timebuf,
2623 sizeof(timebuf)), VTY_NEWLINE);
2624 }
2625
paul718e3742002-12-13 20:15:29 +00002626 /* Show number of fully adjacent neighbors. */
2627 vty_out (vty, " Number of fully adjacent neighbors in this area:"
paulb0a053b2003-06-22 09:04:47 +00002628 " %d%s", area->full_nbrs, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002629
2630 /* Show authentication type. */
2631 vty_out (vty, " Area has ");
2632 if (area->auth_type == OSPF_AUTH_NULL)
2633 vty_out (vty, "no authentication%s", VTY_NEWLINE);
2634 else if (area->auth_type == OSPF_AUTH_SIMPLE)
2635 vty_out (vty, "simple password authentication%s", VTY_NEWLINE);
2636 else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC)
2637 vty_out (vty, "message digest authentication%s", VTY_NEWLINE);
2638
2639 if (!OSPF_IS_AREA_BACKBONE (area))
2640 vty_out (vty, " Number of full virtual adjacencies going through"
2641 " this area: %d%s", area->full_vls, VTY_NEWLINE);
2642
2643 /* Show SPF calculation times. */
2644 vty_out (vty, " SPF algorithm executed %d times%s",
2645 area->spf_calculation, VTY_NEWLINE);
2646
2647 /* Show number of LSA. */
2648 vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE);
hassofe71a972004-12-22 16:16:02 +00002649 vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s",
2650 ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA),
2651 ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE);
2652 vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s",
2653 ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA),
2654 ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE);
2655 vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s",
2656 ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA),
2657 ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE);
2658 vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s",
2659 ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA),
2660 ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE);
2661 vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s",
2662 ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA),
2663 ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE);
2664#ifdef HAVE_OPAQUE_LSA
2665 vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s",
2666 ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA),
2667 ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE);
2668 vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s",
2669 ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA),
2670 ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE);
2671#endif /* HAVE_OPAQUE_LSA */
paul718e3742002-12-13 20:15:29 +00002672 vty_out (vty, "%s", VTY_NEWLINE);
2673}
2674
2675DEFUN (show_ip_ospf,
2676 show_ip_ospf_cmd,
2677 "show ip ospf",
2678 SHOW_STR
2679 IP_STR
2680 "OSPF information\n")
2681{
paul1eb8ef22005-04-07 07:30:20 +00002682 struct listnode *node, *nnode;
paul718e3742002-12-13 20:15:29 +00002683 struct ospf_area * area;
paul020709f2003-04-04 02:44:16 +00002684 struct ospf *ospf;
pauld24f6e22005-10-21 09:23:12 +00002685 struct timeval result;
ajs649654a2005-11-16 20:17:52 +00002686 char timebuf[OSPF_TIME_DUMP_SIZE];
paul718e3742002-12-13 20:15:29 +00002687
2688 /* Check OSPF is enable. */
paul020709f2003-04-04 02:44:16 +00002689 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00002690 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00002691 {
2692 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
2693 return CMD_SUCCESS;
2694 }
2695
2696 /* Show Router ID. */
2697 vty_out (vty, " OSPF Routing Process, Router ID: %s%s",
paul68980082003-03-25 05:07:42 +00002698 inet_ntoa (ospf->router_id),
paul718e3742002-12-13 20:15:29 +00002699 VTY_NEWLINE);
paul88d6cf32005-10-29 12:50:09 +00002700
2701 /* Graceful shutdown */
paulc9c93d52005-11-26 13:31:11 +00002702 if (ospf->t_deferred_shutdown)
2703 vty_out (vty, " Deferred shutdown in progress, %s remaining%s",
2704 ospf_timer_dump (ospf->t_deferred_shutdown,
paul88d6cf32005-10-29 12:50:09 +00002705 timebuf, sizeof (timebuf)), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002706 /* Show capability. */
2707 vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE);
2708 vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE);
2709 vty_out (vty, " RFC1583Compatibility flag is %s%s",
paul68980082003-03-25 05:07:42 +00002710 CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ?
paul718e3742002-12-13 20:15:29 +00002711 "enabled" : "disabled", VTY_NEWLINE);
2712#ifdef HAVE_OPAQUE_LSA
2713 vty_out (vty, " OpaqueCapability flag is %s%s%s",
paul68980082003-03-25 05:07:42 +00002714 CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ?
paul718e3742002-12-13 20:15:29 +00002715 "enabled" : "disabled",
paul68980082003-03-25 05:07:42 +00002716 IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ?
paul718e3742002-12-13 20:15:29 +00002717 " (origination blocked)" : "",
2718 VTY_NEWLINE);
2719#endif /* HAVE_OPAQUE_LSA */
paul88d6cf32005-10-29 12:50:09 +00002720
2721 /* Show stub-router configuration */
2722 if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED
2723 || ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED)
2724 {
2725 vty_out (vty, " Stub router advertisement is configured%s",
2726 VTY_NEWLINE);
2727 if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED)
2728 vty_out (vty, " Enabled for %us after start-up%s",
2729 ospf->stub_router_startup_time, VTY_NEWLINE);
2730 if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED)
2731 vty_out (vty, " Enabled for %us prior to full shutdown%s",
2732 ospf->stub_router_shutdown_time, VTY_NEWLINE);
2733 }
2734
paul718e3742002-12-13 20:15:29 +00002735 /* Show SPF timers. */
pauld24f6e22005-10-21 09:23:12 +00002736 vty_out (vty, " Initial SPF scheduling delay %d millisec(s)%s"
2737 " Minimum hold time between consecutive SPFs %d millisec(s)%s"
2738 " Maximum hold time between consecutive SPFs %d millisec(s)%s"
2739 " Hold time multiplier is currently %d%s",
2740 ospf->spf_delay, VTY_NEWLINE,
2741 ospf->spf_holdtime, VTY_NEWLINE,
2742 ospf->spf_max_holdtime, VTY_NEWLINE,
2743 ospf->spf_hold_multiplier, VTY_NEWLINE);
paulb8ad39d2005-10-23 15:23:05 +00002744 vty_out (vty, " SPF algorithm ");
2745 if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec)
2746 {
Paul Jakma2518efd2006-08-27 06:49:29 +00002747 result = tv_sub (recent_relative_time (), ospf->ts_spf);
paulb8ad39d2005-10-23 15:23:05 +00002748 vty_out (vty, "last executed %s ago%s",
2749 ospf_timeval_dump (&result, timebuf, sizeof (timebuf)),
2750 VTY_NEWLINE);
2751 }
2752 else
2753 vty_out (vty, "has not been run%s", VTY_NEWLINE);
pauld24f6e22005-10-21 09:23:12 +00002754 vty_out (vty, " SPF timer %s%s%s",
2755 (ospf->t_spf_calc ? "due in " : "is "),
2756 ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)),
2757 VTY_NEWLINE);
2758
paul718e3742002-12-13 20:15:29 +00002759 /* Show refresh parameters. */
2760 vty_out (vty, " Refresh timer %d secs%s",
paul68980082003-03-25 05:07:42 +00002761 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002762
2763 /* Show ABR/ASBR flags. */
paul68980082003-03-25 05:07:42 +00002764 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR))
paul718e3742002-12-13 20:15:29 +00002765 vty_out (vty, " This router is an ABR, ABR type is: %s%s",
paul68980082003-03-25 05:07:42 +00002766 ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002767
paul68980082003-03-25 05:07:42 +00002768 if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR))
paul718e3742002-12-13 20:15:29 +00002769 vty_out (vty, " This router is an ASBR "
2770 "(injecting external routing information)%s", VTY_NEWLINE);
2771
2772 /* Show Number of AS-external-LSAs. */
hassofe71a972004-12-22 16:16:02 +00002773 vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s",
2774 ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA),
2775 ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE);
2776#ifdef HAVE_OPAQUE_LSA
2777 vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s",
2778 ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA),
2779 ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE);
2780#endif /* HAVE_OPAQUE_LSA */
paul718e3742002-12-13 20:15:29 +00002781 /* Show number of areas attached. */
Andrew J. Schorrd7e60dd2006-06-29 20:20:52 +00002782 vty_out (vty, " Number of areas attached to this router: %d%s",
2783 listcount (ospf->areas), VTY_NEWLINE);
2784
2785 if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES))
2786 {
2787 if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL))
2788 vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE);
2789 else
2790 vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE);
2791 }
2792
2793 vty_out (vty, "%s",VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002794
2795 /* Show each area status. */
paul1eb8ef22005-04-07 07:30:20 +00002796 for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area))
2797 show_ip_ospf_area (vty, area);
paul718e3742002-12-13 20:15:29 +00002798
2799 return CMD_SUCCESS;
2800}
2801
2802
ajsfd651fa2005-03-29 16:08:16 +00002803static void
paul68980082003-03-25 05:07:42 +00002804show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf,
2805 struct interface *ifp)
paul718e3742002-12-13 20:15:29 +00002806{
ajsfd651fa2005-03-29 16:08:16 +00002807 int is_up;
paul718e3742002-12-13 20:15:29 +00002808 struct ospf_neighbor *nbr;
paul718e3742002-12-13 20:15:29 +00002809 struct route_node *rn;
paul718e3742002-12-13 20:15:29 +00002810
paul718e3742002-12-13 20:15:29 +00002811 /* Is interface up? */
ajsfd651fa2005-03-29 16:08:16 +00002812 vty_out (vty, "%s is %s%s", ifp->name,
2813 ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE);
ajsd2fc8892005-04-02 18:38:43 +00002814 vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s",
2815 ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags),
2816 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00002817
2818 /* Is interface OSPF enabled? */
ajsfd651fa2005-03-29 16:08:16 +00002819 if (ospf_oi_count(ifp) == 0)
paul718e3742002-12-13 20:15:29 +00002820 {
2821 vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE);
2822 return;
2823 }
ajsfd651fa2005-03-29 16:08:16 +00002824 else if (!is_up)
2825 {
2826 vty_out (vty, " OSPF is enabled, but not running on this interface%s",
2827 VTY_NEWLINE);
2828 return;
2829 }
2830
paul718e3742002-12-13 20:15:29 +00002831 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
2832 {
2833 struct ospf_interface *oi = rn->info;
2834
2835 if (oi == NULL)
2836 continue;
2837
2838 /* Show OSPF interface information. */
2839 vty_out (vty, " Internet Address %s/%d,",
2840 inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen);
2841
Paul Jakma9c27ef92006-05-04 07:32:57 +00002842 if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK)
2843 {
2844 struct in_addr *dest;
2845 const char *dstr;
2846
Andrew J. Schorre4529632006-12-12 19:18:21 +00002847 if (CONNECTED_PEER(oi->connected)
2848 || oi->type == OSPF_IFTYPE_VIRTUALLINK)
Paul Jakma9c27ef92006-05-04 07:32:57 +00002849 dstr = "Peer";
2850 else
2851 dstr = "Broadcast";
2852
2853 /* For Vlinks, showing the peer address is probably more
2854 * informative than the local interface that is being used
2855 */
2856 if (oi->type == OSPF_IFTYPE_VIRTUALLINK)
2857 dest = &oi->vl_data->peer_addr;
2858 else
2859 dest = &oi->connected->destination->u.prefix4;
2860
2861 vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest));
2862 }
hasso3fb9cd62004-10-19 19:44:43 +00002863
paul718e3742002-12-13 20:15:29 +00002864 vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area),
2865 VTY_NEWLINE);
2866
vincentba682532005-09-29 13:52:57 +00002867 vty_out (vty, " MTU mismatch detection:%s%s",
2868 OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE);
2869
paul718e3742002-12-13 20:15:29 +00002870 vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s",
paul68980082003-03-25 05:07:42 +00002871 inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type],
paul718e3742002-12-13 20:15:29 +00002872 oi->output_cost, VTY_NEWLINE);
2873
2874 vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s",
2875 OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state),
2876 PRIORITY (oi), VTY_NEWLINE);
2877
2878 /* Show DR information. */
2879 if (DR (oi).s_addr == 0)
2880 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2881 else
2882 {
2883 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi));
2884 if (nbr == NULL)
2885 vty_out (vty, " No designated router on this network%s", VTY_NEWLINE);
2886 else
2887 {
2888 vty_out (vty, " Designated Router (ID) %s,",
2889 inet_ntoa (nbr->router_id));
2890 vty_out (vty, " Interface Address %s%s",
2891 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2892 }
2893 }
2894
2895 /* Show BDR information. */
2896 if (BDR (oi).s_addr == 0)
2897 vty_out (vty, " No backup designated router on this network%s",
2898 VTY_NEWLINE);
2899 else
2900 {
2901 nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi));
2902 if (nbr == NULL)
2903 vty_out (vty, " No backup designated router on this network%s",
2904 VTY_NEWLINE);
2905 else
2906 {
2907 vty_out (vty, " Backup Designated Router (ID) %s,",
2908 inet_ntoa (nbr->router_id));
2909 vty_out (vty, " Interface Address %s%s",
2910 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
2911 }
2912 }
ajsba6454e2005-02-08 15:37:30 +00002913
2914 vty_out (vty, " Multicast group memberships:");
Paul Jakma429ac782006-06-15 18:40:49 +00002915 if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)
2916 || OI_MEMBER_CHECK(oi, MEMBER_DROUTERS))
2917 {
2918 if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS))
2919 vty_out (vty, " OSPFAllRouters");
2920 if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS))
2921 vty_out (vty, " OSPFDesignatedRouters");
2922 }
2923 else
ajsba6454e2005-02-08 15:37:30 +00002924 vty_out (vty, " <None>");
2925 vty_out (vty, "%s", VTY_NEWLINE);
2926
paul718e3742002-12-13 20:15:29 +00002927 vty_out (vty, " Timer intervals configured,");
paulf9ad9372005-10-21 00:45:17 +00002928 vty_out (vty, " Hello ");
2929 if (OSPF_IF_PARAM (oi, fast_hello) == 0)
2930 vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello));
2931 else
2932 vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello));
2933 vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s",
2934 OSPF_IF_PARAM (oi, v_wait),
paul718e3742002-12-13 20:15:29 +00002935 OSPF_IF_PARAM (oi, v_wait),
2936 OSPF_IF_PARAM (oi, retransmit_interval),
2937 VTY_NEWLINE);
2938
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00002939 if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_ACTIVE)
paulf9ad9372005-10-21 00:45:17 +00002940 {
ajs649654a2005-11-16 20:17:52 +00002941 char timebuf[OSPF_TIME_DUMP_SIZE];
paulf9ad9372005-10-21 00:45:17 +00002942 vty_out (vty, " Hello due in %s%s",
ajs649654a2005-11-16 20:17:52 +00002943 ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)),
paulf9ad9372005-10-21 00:45:17 +00002944 VTY_NEWLINE);
2945 }
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00002946 else /* passive-interface is set */
paul718e3742002-12-13 20:15:29 +00002947 vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE);
2948
2949 vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s",
paul68980082003-03-25 05:07:42 +00002950 ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full),
paul718e3742002-12-13 20:15:29 +00002951 VTY_NEWLINE);
2952 }
2953}
2954
2955DEFUN (show_ip_ospf_interface,
2956 show_ip_ospf_interface_cmd,
2957 "show ip ospf interface [INTERFACE]",
2958 SHOW_STR
2959 IP_STR
2960 "OSPF information\n"
2961 "Interface information\n"
2962 "Interface name\n")
2963{
2964 struct interface *ifp;
paul020709f2003-04-04 02:44:16 +00002965 struct ospf *ospf;
hasso52dc7ee2004-09-23 19:18:23 +00002966 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00002967
paul020709f2003-04-04 02:44:16 +00002968 ospf = ospf_lookup ();
Paul Jakmacac3b5c2006-05-11 13:31:11 +00002969 if (ospf == NULL)
2970 {
2971 vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE);
2972 return CMD_SUCCESS;
2973 }
paul020709f2003-04-04 02:44:16 +00002974
paul718e3742002-12-13 20:15:29 +00002975 /* Show All Interfaces. */
2976 if (argc == 0)
paul1eb8ef22005-04-07 07:30:20 +00002977 for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp))
2978 show_ip_ospf_interface_sub (vty, ospf, ifp);
paul718e3742002-12-13 20:15:29 +00002979 /* Interface name is specified. */
2980 else
2981 {
2982 if ((ifp = if_lookup_by_name (argv[0])) == NULL)
2983 vty_out (vty, "No such interface name%s", VTY_NEWLINE);
2984 else
paul68980082003-03-25 05:07:42 +00002985 show_ip_ospf_interface_sub (vty, ospf, ifp);
paul718e3742002-12-13 20:15:29 +00002986 }
2987
2988 return CMD_SUCCESS;
2989}
2990
paul4dadc292005-05-06 21:37:42 +00002991static void
pauld24f6e22005-10-21 09:23:12 +00002992show_ip_ospf_neighbour_header (struct vty *vty)
2993{
2994 vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s",
2995 VTY_NEWLINE,
2996 "Neighbor ID", "Pri", "State", "Dead Time",
2997 "Address", "Interface", "RXmtL", "RqstL", "DBsmL",
2998 VTY_NEWLINE);
2999}
3000
3001static void
paul718e3742002-12-13 20:15:29 +00003002show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi)
3003{
3004 struct route_node *rn;
3005 struct ospf_neighbor *nbr;
3006 char msgbuf[16];
ajs649654a2005-11-16 20:17:52 +00003007 char timebuf[OSPF_TIME_DUMP_SIZE];
paul718e3742002-12-13 20:15:29 +00003008
3009 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3010 if ((nbr = rn->info))
3011 /* Do not show myself. */
3012 if (nbr != oi->nbr_self)
3013 /* Down state is not shown. */
3014 if (nbr->state != NSM_Down)
3015 {
3016 ospf_nbr_state_message (nbr, msgbuf, 16);
3017
3018 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
pauld24f6e22005-10-21 09:23:12 +00003019 vty_out (vty, "%-15s %3d %-15s ",
3020 "-", nbr->priority,
3021 msgbuf);
3022 else
3023 vty_out (vty, "%-15s %3d %-15s ",
3024 inet_ntoa (nbr->router_id), nbr->priority,
3025 msgbuf);
3026
3027 vty_out (vty, "%9s ",
3028 ospf_timer_dump (nbr->t_inactivity, timebuf,
3029 sizeof(timebuf)));
3030
paul718e3742002-12-13 20:15:29 +00003031 vty_out (vty, "%-15s ", inet_ntoa (nbr->src));
pauld24f6e22005-10-21 09:23:12 +00003032 vty_out (vty, "%-20s %5ld %5ld %5d%s",
paul718e3742002-12-13 20:15:29 +00003033 IF_NAME (oi), ospf_ls_retransmit_count (nbr),
3034 ospf_ls_request_count (nbr), ospf_db_summary_count (nbr),
3035 VTY_NEWLINE);
3036 }
3037}
3038
3039DEFUN (show_ip_ospf_neighbor,
3040 show_ip_ospf_neighbor_cmd,
3041 "show ip ospf neighbor",
3042 SHOW_STR
3043 IP_STR
3044 "OSPF information\n"
3045 "Neighbor list\n")
3046{
paul020709f2003-04-04 02:44:16 +00003047 struct ospf *ospf;
paul1eb8ef22005-04-07 07:30:20 +00003048 struct ospf_interface *oi;
hasso52dc7ee2004-09-23 19:18:23 +00003049 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003050
paul020709f2003-04-04 02:44:16 +00003051 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003052 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003053 {
3054 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3055 return CMD_SUCCESS;
3056 }
3057
pauld24f6e22005-10-21 09:23:12 +00003058 show_ip_ospf_neighbour_header (vty);
paul718e3742002-12-13 20:15:29 +00003059
paul1eb8ef22005-04-07 07:30:20 +00003060 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
3061 show_ip_ospf_neighbor_sub (vty, oi);
paul718e3742002-12-13 20:15:29 +00003062
3063 return CMD_SUCCESS;
3064}
3065
3066DEFUN (show_ip_ospf_neighbor_all,
3067 show_ip_ospf_neighbor_all_cmd,
3068 "show ip ospf neighbor all",
3069 SHOW_STR
3070 IP_STR
3071 "OSPF information\n"
3072 "Neighbor list\n"
3073 "include down status neighbor\n")
3074{
Joakim Tjernlund35f89142008-07-01 16:54:07 +02003075 struct ospf *ospf = ospf_lookup ();
hasso52dc7ee2004-09-23 19:18:23 +00003076 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003077 struct ospf_interface *oi;
paul718e3742002-12-13 20:15:29 +00003078
paul68980082003-03-25 05:07:42 +00003079 if (ospf == NULL)
paul718e3742002-12-13 20:15:29 +00003080 {
3081 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3082 return CMD_SUCCESS;
3083 }
pauld24f6e22005-10-21 09:23:12 +00003084
3085 show_ip_ospf_neighbour_header (vty);
3086
paul1eb8ef22005-04-07 07:30:20 +00003087 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
paul718e3742002-12-13 20:15:29 +00003088 {
hasso52dc7ee2004-09-23 19:18:23 +00003089 struct listnode *nbr_node;
paul1eb8ef22005-04-07 07:30:20 +00003090 struct ospf_nbr_nbma *nbr_nbma;
paul718e3742002-12-13 20:15:29 +00003091
3092 show_ip_ospf_neighbor_sub (vty, oi);
3093
3094 /* print Down neighbor status */
paul1eb8ef22005-04-07 07:30:20 +00003095 for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma))
paul718e3742002-12-13 20:15:29 +00003096 {
paul718e3742002-12-13 20:15:29 +00003097 if (nbr_nbma->nbr == NULL
3098 || nbr_nbma->nbr->state == NSM_Down)
3099 {
pauld24f6e22005-10-21 09:23:12 +00003100 vty_out (vty, "%-15s %3d %-15s %9s ",
paul718e3742002-12-13 20:15:29 +00003101 "-", nbr_nbma->priority, "Down", "-");
pauld24f6e22005-10-21 09:23:12 +00003102 vty_out (vty, "%-15s %-20s %5d %5d %5d%s",
paul718e3742002-12-13 20:15:29 +00003103 inet_ntoa (nbr_nbma->addr), IF_NAME (oi),
3104 0, 0, 0, VTY_NEWLINE);
3105 }
3106 }
3107 }
3108
3109 return CMD_SUCCESS;
3110}
3111
3112DEFUN (show_ip_ospf_neighbor_int,
3113 show_ip_ospf_neighbor_int_cmd,
hassobb5b7552005-08-21 20:01:15 +00003114 "show ip ospf neighbor IFNAME",
paul718e3742002-12-13 20:15:29 +00003115 SHOW_STR
3116 IP_STR
3117 "OSPF information\n"
3118 "Neighbor list\n"
3119 "Interface name\n")
3120{
paul020709f2003-04-04 02:44:16 +00003121 struct ospf *ospf;
hassobb5b7552005-08-21 20:01:15 +00003122 struct interface *ifp;
3123 struct route_node *rn;
3124
3125 ifp = if_lookup_by_name (argv[0]);
3126 if (!ifp)
paul718e3742002-12-13 20:15:29 +00003127 {
hassobb5b7552005-08-21 20:01:15 +00003128 vty_out (vty, "No such interface.%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003129 return CMD_WARNING;
3130 }
3131
paul020709f2003-04-04 02:44:16 +00003132 ospf = ospf_lookup ();
3133 if (ospf == NULL)
3134 {
3135 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3136 return CMD_SUCCESS;
3137 }
pauld24f6e22005-10-21 09:23:12 +00003138
3139 show_ip_ospf_neighbour_header (vty);
3140
hassobb5b7552005-08-21 20:01:15 +00003141 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00003142 {
hassobb5b7552005-08-21 20:01:15 +00003143 struct ospf_interface *oi = rn->info;
3144
3145 if (oi == NULL)
3146 continue;
3147
paul718e3742002-12-13 20:15:29 +00003148 show_ip_ospf_neighbor_sub (vty, oi);
3149 }
3150
3151 return CMD_SUCCESS;
3152}
3153
paul4dadc292005-05-06 21:37:42 +00003154static void
paul718e3742002-12-13 20:15:29 +00003155show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi,
3156 struct ospf_nbr_nbma *nbr_nbma)
3157{
ajs649654a2005-11-16 20:17:52 +00003158 char timebuf[OSPF_TIME_DUMP_SIZE];
paul718e3742002-12-13 20:15:29 +00003159
3160 /* Show neighbor ID. */
3161 vty_out (vty, " Neighbor %s,", "-");
3162
3163 /* Show interface address. */
3164 vty_out (vty, " interface address %s%s",
3165 inet_ntoa (nbr_nbma->addr), VTY_NEWLINE);
3166 /* Show Area ID. */
3167 vty_out (vty, " In the area %s via interface %s%s",
3168 ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE);
3169 /* Show neighbor priority and state. */
3170 vty_out (vty, " Neighbor priority is %d, State is %s,",
3171 nbr_nbma->priority, "Down");
3172 /* Show state changes. */
3173 vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE);
3174
3175 /* Show PollInterval */
3176 vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE);
3177
3178 /* Show poll-interval timer. */
3179 vty_out (vty, " Poll timer due in %s%s",
pauld24f6e22005-10-21 09:23:12 +00003180 ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)),
3181 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003182
3183 /* Show poll-interval timer thread. */
3184 vty_out (vty, " Thread Poll Timer %s%s",
3185 nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE);
3186}
3187
paul4dadc292005-05-06 21:37:42 +00003188static void
paul718e3742002-12-13 20:15:29 +00003189show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi,
3190 struct ospf_neighbor *nbr)
3191{
ajs649654a2005-11-16 20:17:52 +00003192 char timebuf[OSPF_TIME_DUMP_SIZE];
paul718e3742002-12-13 20:15:29 +00003193
3194 /* Show neighbor ID. */
3195 if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0)
3196 vty_out (vty, " Neighbor %s,", "-");
3197 else
3198 vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id));
3199
3200 /* Show interface address. */
3201 vty_out (vty, " interface address %s%s",
3202 inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE);
3203 /* Show Area ID. */
3204 vty_out (vty, " In the area %s via interface %s%s",
3205 ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE);
3206 /* Show neighbor priority and state. */
3207 vty_out (vty, " Neighbor priority is %d, State is %s,",
3208 nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state));
3209 /* Show state changes. */
3210 vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE);
Paul Jakma3fed4162006-07-25 20:44:12 +00003211 if (nbr->ts_last_progress.tv_sec || nbr->ts_last_progress.tv_usec)
Paul Jakma90c33172006-07-11 17:57:25 +00003212 {
Paul Jakma2518efd2006-08-27 06:49:29 +00003213 struct timeval res
3214 = tv_sub (recent_relative_time (), nbr->ts_last_progress);
Paul Jakma3fed4162006-07-25 20:44:12 +00003215 vty_out (vty, " Most recent state change statistics:%s",
3216 VTY_NEWLINE);
3217 vty_out (vty, " Progressive change %s ago%s",
Paul Jakma90c33172006-07-11 17:57:25 +00003218 ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
Paul Jakma3fed4162006-07-25 20:44:12 +00003219 VTY_NEWLINE);
3220 }
3221 if (nbr->ts_last_regress.tv_sec || nbr->ts_last_regress.tv_usec)
3222 {
Paul Jakma2518efd2006-08-27 06:49:29 +00003223 struct timeval res
3224 = tv_sub (recent_relative_time (), nbr->ts_last_regress);
Paul Jakma3fed4162006-07-25 20:44:12 +00003225 vty_out (vty, " Regressive change %s ago, due to %s%s",
3226 ospf_timeval_dump (&res, timebuf, sizeof(timebuf)),
3227 (nbr->last_regress_str ? nbr->last_regress_str : "??"),
Paul Jakma90c33172006-07-11 17:57:25 +00003228 VTY_NEWLINE);
3229 }
paul718e3742002-12-13 20:15:29 +00003230 /* Show Designated Rotuer ID. */
3231 vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router));
3232 /* Show Backup Designated Rotuer ID. */
3233 vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE);
3234 /* Show options. */
3235 vty_out (vty, " Options %d %s%s", nbr->options,
3236 ospf_options_dump (nbr->options), VTY_NEWLINE);
3237 /* Show Router Dead interval timer. */
3238 vty_out (vty, " Dead timer due in %s%s",
pauld24f6e22005-10-21 09:23:12 +00003239 ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)),
3240 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003241 /* Show Database Summary list. */
3242 vty_out (vty, " Database Summary List %d%s",
3243 ospf_db_summary_count (nbr), VTY_NEWLINE);
3244 /* Show Link State Request list. */
3245 vty_out (vty, " Link State Request List %ld%s",
3246 ospf_ls_request_count (nbr), VTY_NEWLINE);
3247 /* Show Link State Retransmission list. */
3248 vty_out (vty, " Link State Retransmission List %ld%s",
3249 ospf_ls_retransmit_count (nbr), VTY_NEWLINE);
3250 /* Show inactivity timer thread. */
3251 vty_out (vty, " Thread Inactivity Timer %s%s",
3252 nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE);
3253 /* Show Database Description retransmission thread. */
3254 vty_out (vty, " Thread Database Description Retransmision %s%s",
3255 nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE);
3256 /* Show Link State Request Retransmission thread. */
3257 vty_out (vty, " Thread Link State Request Retransmission %s%s",
3258 nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE);
3259 /* Show Link State Update Retransmission thread. */
3260 vty_out (vty, " Thread Link State Update Retransmission %s%s%s",
3261 nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE);
3262}
3263
3264DEFUN (show_ip_ospf_neighbor_id,
3265 show_ip_ospf_neighbor_id_cmd,
3266 "show ip ospf neighbor A.B.C.D",
3267 SHOW_STR
3268 IP_STR
3269 "OSPF information\n"
3270 "Neighbor list\n"
3271 "Neighbor ID\n")
3272{
paul020709f2003-04-04 02:44:16 +00003273 struct ospf *ospf;
hasso52dc7ee2004-09-23 19:18:23 +00003274 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003275 struct ospf_neighbor *nbr;
paul1eb8ef22005-04-07 07:30:20 +00003276 struct ospf_interface *oi;
paul718e3742002-12-13 20:15:29 +00003277 struct in_addr router_id;
3278 int ret;
3279
3280 ret = inet_aton (argv[0], &router_id);
3281 if (!ret)
3282 {
3283 vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE);
3284 return CMD_WARNING;
3285 }
3286
paul020709f2003-04-04 02:44:16 +00003287 ospf = ospf_lookup ();
3288 if (ospf == NULL)
3289 {
3290 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3291 return CMD_SUCCESS;
3292 }
3293
paul1eb8ef22005-04-07 07:30:20 +00003294 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
3295 if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id)))
Andrew J. Schorr1c066bf2006-06-30 16:53:47 +00003296 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
paul718e3742002-12-13 20:15:29 +00003297
paul718e3742002-12-13 20:15:29 +00003298 return CMD_SUCCESS;
3299}
3300
3301DEFUN (show_ip_ospf_neighbor_detail,
3302 show_ip_ospf_neighbor_detail_cmd,
3303 "show ip ospf neighbor detail",
3304 SHOW_STR
3305 IP_STR
3306 "OSPF information\n"
3307 "Neighbor list\n"
3308 "detail of all neighbors\n")
3309{
paul020709f2003-04-04 02:44:16 +00003310 struct ospf *ospf;
paul1eb8ef22005-04-07 07:30:20 +00003311 struct ospf_interface *oi;
hasso52dc7ee2004-09-23 19:18:23 +00003312 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003313
paul020709f2003-04-04 02:44:16 +00003314 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003315 if (ospf == NULL)
paul020709f2003-04-04 02:44:16 +00003316 {
3317 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3318 return CMD_SUCCESS;
3319 }
paul718e3742002-12-13 20:15:29 +00003320
paul1eb8ef22005-04-07 07:30:20 +00003321 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
paul718e3742002-12-13 20:15:29 +00003322 {
paul718e3742002-12-13 20:15:29 +00003323 struct route_node *rn;
3324 struct ospf_neighbor *nbr;
3325
3326 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3327 if ((nbr = rn->info))
3328 if (nbr != oi->nbr_self)
3329 if (nbr->state != NSM_Down)
3330 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
3331 }
3332
3333 return CMD_SUCCESS;
3334}
3335
3336DEFUN (show_ip_ospf_neighbor_detail_all,
3337 show_ip_ospf_neighbor_detail_all_cmd,
3338 "show ip ospf neighbor detail all",
3339 SHOW_STR
3340 IP_STR
3341 "OSPF information\n"
3342 "Neighbor list\n"
3343 "detail of all neighbors\n"
3344 "include down status neighbor\n")
3345{
paul020709f2003-04-04 02:44:16 +00003346 struct ospf *ospf;
hasso52dc7ee2004-09-23 19:18:23 +00003347 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003348 struct ospf_interface *oi;
paul718e3742002-12-13 20:15:29 +00003349
paul020709f2003-04-04 02:44:16 +00003350 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00003351 if (ospf == NULL)
paul020709f2003-04-04 02:44:16 +00003352 {
3353 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3354 return CMD_SUCCESS;
3355 }
paul718e3742002-12-13 20:15:29 +00003356
paul1eb8ef22005-04-07 07:30:20 +00003357 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
paul718e3742002-12-13 20:15:29 +00003358 {
paul718e3742002-12-13 20:15:29 +00003359 struct route_node *rn;
3360 struct ospf_neighbor *nbr;
paul1eb8ef22005-04-07 07:30:20 +00003361 struct ospf_nbr_nbma *nbr_nbma;
paul718e3742002-12-13 20:15:29 +00003362
3363 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
3364 if ((nbr = rn->info))
3365 if (nbr != oi->nbr_self)
3366 if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down)
3367 show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info);
3368
3369 if (oi->type == OSPF_IFTYPE_NBMA)
3370 {
hasso52dc7ee2004-09-23 19:18:23 +00003371 struct listnode *nd;
paul718e3742002-12-13 20:15:29 +00003372
paul1eb8ef22005-04-07 07:30:20 +00003373 for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma))
3374 if (nbr_nbma->nbr == NULL
3375 || nbr_nbma->nbr->state == NSM_Down)
3376 show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma);
paul718e3742002-12-13 20:15:29 +00003377 }
3378 }
3379
3380 return CMD_SUCCESS;
3381}
3382
3383DEFUN (show_ip_ospf_neighbor_int_detail,
3384 show_ip_ospf_neighbor_int_detail_cmd,
hassobb5b7552005-08-21 20:01:15 +00003385 "show ip ospf neighbor IFNAME detail",
paul718e3742002-12-13 20:15:29 +00003386 SHOW_STR
3387 IP_STR
3388 "OSPF information\n"
3389 "Neighbor list\n"
hassobb5b7552005-08-21 20:01:15 +00003390 "Interface name\n"
paul718e3742002-12-13 20:15:29 +00003391 "detail of all neighbors")
3392{
paul020709f2003-04-04 02:44:16 +00003393 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00003394 struct ospf_interface *oi;
hassobb5b7552005-08-21 20:01:15 +00003395 struct interface *ifp;
3396 struct route_node *rn, *nrn;
3397 struct ospf_neighbor *nbr;
3398
3399 ifp = if_lookup_by_name (argv[0]);
3400 if (!ifp)
paul718e3742002-12-13 20:15:29 +00003401 {
hassobb5b7552005-08-21 20:01:15 +00003402 vty_out (vty, "No such interface.%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003403 return CMD_WARNING;
3404 }
3405
paul020709f2003-04-04 02:44:16 +00003406 ospf = ospf_lookup ();
3407 if (ospf == NULL)
3408 {
3409 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
3410 return CMD_SUCCESS;
3411 }
paul68980082003-03-25 05:07:42 +00003412
paul718e3742002-12-13 20:15:29 +00003413
hassobb5b7552005-08-21 20:01:15 +00003414 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
3415 if ((oi = rn->info))
3416 for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn))
3417 if ((nbr = nrn->info))
paul718e3742002-12-13 20:15:29 +00003418 if (nbr != oi->nbr_self)
3419 if (nbr->state != NSM_Down)
3420 show_ip_ospf_neighbor_detail_sub (vty, oi, nbr);
paul718e3742002-12-13 20:15:29 +00003421
3422 return CMD_SUCCESS;
3423}
3424
3425
3426/* Show functions */
paul4dadc292005-05-06 21:37:42 +00003427static int
paul020709f2003-04-04 02:44:16 +00003428show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self)
paul718e3742002-12-13 20:15:29 +00003429{
paul718e3742002-12-13 20:15:29 +00003430 struct router_lsa *rl;
3431 struct summary_lsa *sl;
3432 struct as_external_lsa *asel;
3433 struct prefix_ipv4 p;
3434
3435 if (lsa != NULL)
3436 /* If self option is set, check LSA self flag. */
3437 if (self == 0 || IS_LSA_SELF (lsa))
3438 {
3439 /* LSA common part show. */
3440 vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id));
3441 vty_out (vty, "%-15s %4d 0x%08lx 0x%04x",
3442 inet_ntoa (lsa->data->adv_router), LS_AGE (lsa),
3443 (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum));
3444 /* LSA specific part show. */
3445 switch (lsa->data->type)
3446 {
3447 case OSPF_ROUTER_LSA:
3448 rl = (struct router_lsa *) lsa->data;
3449 vty_out (vty, " %-d", ntohs (rl->links));
3450 break;
3451 case OSPF_SUMMARY_LSA:
3452 sl = (struct summary_lsa *) lsa->data;
3453
3454 p.family = AF_INET;
3455 p.prefix = sl->header.id;
3456 p.prefixlen = ip_masklen (sl->mask);
3457 apply_mask_ipv4 (&p);
3458
3459 vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen);
3460 break;
3461 case OSPF_AS_EXTERNAL_LSA:
paul551a8972003-05-18 15:22:55 +00003462 case OSPF_AS_NSSA_LSA:
paul718e3742002-12-13 20:15:29 +00003463 asel = (struct as_external_lsa *) lsa->data;
3464
3465 p.family = AF_INET;
3466 p.prefix = asel->header.id;
3467 p.prefixlen = ip_masklen (asel->mask);
3468 apply_mask_ipv4 (&p);
3469
3470 vty_out (vty, " %s %s/%d [0x%lx]",
3471 IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1",
3472 inet_ntoa (p.prefix), p.prefixlen,
3473 (u_long)ntohl (asel->e[0].route_tag));
3474 break;
3475 case OSPF_NETWORK_LSA:
3476 case OSPF_ASBR_SUMMARY_LSA:
3477#ifdef HAVE_OPAQUE_LSA
3478 case OSPF_OPAQUE_LINK_LSA:
3479 case OSPF_OPAQUE_AREA_LSA:
3480 case OSPF_OPAQUE_AS_LSA:
3481#endif /* HAVE_OPAQUE_LSA */
3482 default:
3483 break;
3484 }
3485 vty_out (vty, VTY_NEWLINE);
3486 }
3487
3488 return 0;
3489}
3490
Stephen Hemminger8b6a15b2009-12-03 19:25:04 +03003491static const char *show_database_desc[] =
paul718e3742002-12-13 20:15:29 +00003492{
3493 "unknown",
3494 "Router Link States",
3495 "Net Link States",
3496 "Summary Link States",
3497 "ASBR-Summary Link States",
3498 "AS External Link States",
paul718e3742002-12-13 20:15:29 +00003499 "Group Membership LSA",
3500 "NSSA-external Link States",
paul718e3742002-12-13 20:15:29 +00003501#ifdef HAVE_OPAQUE_LSA
3502 "Type-8 LSA",
3503 "Link-Local Opaque-LSA",
3504 "Area-Local Opaque-LSA",
3505 "AS-external Opaque-LSA",
3506#endif /* HAVE_OPAQUE_LSA */
3507};
3508
Stephen Hemminger8b6a15b2009-12-03 19:25:04 +03003509static const char *show_database_header[] =
paul718e3742002-12-13 20:15:29 +00003510{
3511 "",
3512 "Link ID ADV Router Age Seq# CkSum Link count",
3513 "Link ID ADV Router Age Seq# CkSum",
3514 "Link ID ADV Router Age Seq# CkSum Route",
3515 "Link ID ADV Router Age Seq# CkSum",
3516 "Link ID ADV Router Age Seq# CkSum Route",
paul718e3742002-12-13 20:15:29 +00003517 " --- header for Group Member ----",
3518 "Link ID ADV Router Age Seq# CkSum Route",
paul718e3742002-12-13 20:15:29 +00003519#ifdef HAVE_OPAQUE_LSA
paul718e3742002-12-13 20:15:29 +00003520 " --- type-8 ---",
3521 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3522 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3523 "Opaque-Type/Id ADV Router Age Seq# CkSum",
3524#endif /* HAVE_OPAQUE_LSA */
3525};
3526
paul4dadc292005-05-06 21:37:42 +00003527static void
paul718e3742002-12-13 20:15:29 +00003528show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa)
3529{
3530 struct router_lsa *rlsa = (struct router_lsa*) lsa->data;
paul4957f492003-06-27 01:28:45 +00003531
paul718e3742002-12-13 20:15:29 +00003532 vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE);
paul4957f492003-06-27 01:28:45 +00003533 vty_out (vty, " Options: 0x%-2x : %s%s",
3534 lsa->data->options,
3535 ospf_options_dump(lsa->data->options),
3536 VTY_NEWLINE);
3537 vty_out (vty, " LS Flags: 0x%-2x %s%s",
paul9d526032003-06-30 22:46:14 +00003538 lsa->flags,
paul4957f492003-06-27 01:28:45 +00003539 ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""),
3540 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003541
3542 if (lsa->data->type == OSPF_ROUTER_LSA)
3543 {
3544 vty_out (vty, " Flags: 0x%x" , rlsa->flags);
3545
3546 if (rlsa->flags)
3547 vty_out (vty, " :%s%s%s%s",
3548 IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "",
3549 IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "",
3550 IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "",
3551 IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : "");
3552
3553 vty_out (vty, "%s", VTY_NEWLINE);
3554 }
3555 vty_out (vty, " LS Type: %s%s",
3556 LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE);
3557 vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id),
3558 LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE);
3559 vty_out (vty, " Advertising Router: %s%s",
3560 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
3561 vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum),
3562 VTY_NEWLINE);
3563 vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum),
3564 VTY_NEWLINE);
3565 vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE);
3566}
3567
hassoeb1ce602004-10-08 08:17:22 +00003568const char *link_type_desc[] =
paul718e3742002-12-13 20:15:29 +00003569{
3570 "(null)",
3571 "another Router (point-to-point)",
3572 "a Transit Network",
3573 "Stub Network",
3574 "a Virtual Link",
3575};
3576
hassoeb1ce602004-10-08 08:17:22 +00003577const char *link_id_desc[] =
paul718e3742002-12-13 20:15:29 +00003578{
3579 "(null)",
3580 "Neighboring Router ID",
3581 "Designated Router address",
paul68980082003-03-25 05:07:42 +00003582 "Net",
paul718e3742002-12-13 20:15:29 +00003583 "Neighboring Router ID",
3584};
3585
hassoeb1ce602004-10-08 08:17:22 +00003586const char *link_data_desc[] =
paul718e3742002-12-13 20:15:29 +00003587{
3588 "(null)",
3589 "Router Interface address",
3590 "Router Interface address",
3591 "Network Mask",
3592 "Router Interface address",
3593};
3594
3595/* Show router-LSA each Link information. */
paul4dadc292005-05-06 21:37:42 +00003596static void
paul718e3742002-12-13 20:15:29 +00003597show_ip_ospf_database_router_links (struct vty *vty,
3598 struct router_lsa *rl)
3599{
3600 int len, i, type;
3601
3602 len = ntohs (rl->header.length) - 4;
3603 for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++)
3604 {
3605 type = rl->link[i].type;
3606
3607 vty_out (vty, " Link connected to: %s%s",
3608 link_type_desc[type], VTY_NEWLINE);
3609 vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type],
3610 inet_ntoa (rl->link[i].link_id), VTY_NEWLINE);
3611 vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type],
3612 inet_ntoa (rl->link[i].link_data), VTY_NEWLINE);
3613 vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE);
3614 vty_out (vty, " TOS 0 Metric: %d%s",
3615 ntohs (rl->link[i].metric), VTY_NEWLINE);
3616 vty_out (vty, "%s", VTY_NEWLINE);
3617 }
3618}
3619
3620/* Show router-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003621static int
paul718e3742002-12-13 20:15:29 +00003622show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3623{
3624 if (lsa != NULL)
3625 {
3626 struct router_lsa *rl = (struct router_lsa *) lsa->data;
3627
3628 show_ip_ospf_database_header (vty, lsa);
3629
3630 vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links),
3631 VTY_NEWLINE, VTY_NEWLINE);
3632
3633 show_ip_ospf_database_router_links (vty, rl);
paulb0a053b2003-06-22 09:04:47 +00003634 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003635 }
3636
3637 return 0;
3638}
3639
3640/* Show network-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003641static int
paul718e3742002-12-13 20:15:29 +00003642show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3643{
3644 int length, i;
3645
3646 if (lsa != NULL)
3647 {
3648 struct network_lsa *nl = (struct network_lsa *) lsa->data;
3649
3650 show_ip_ospf_database_header (vty, lsa);
3651
3652 vty_out (vty, " Network Mask: /%d%s",
3653 ip_masklen (nl->mask), VTY_NEWLINE);
3654
3655 length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4;
3656
3657 for (i = 0; length > 0; i++, length -= 4)
3658 vty_out (vty, " Attached Router: %s%s",
3659 inet_ntoa (nl->routers[i]), VTY_NEWLINE);
3660
3661 vty_out (vty, "%s", VTY_NEWLINE);
3662 }
3663
3664 return 0;
3665}
3666
3667/* Show summary-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003668static int
paul718e3742002-12-13 20:15:29 +00003669show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3670{
3671 if (lsa != NULL)
3672 {
3673 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3674
3675 show_ip_ospf_database_header (vty, lsa);
3676
3677 vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask),
3678 VTY_NEWLINE);
3679 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3680 VTY_NEWLINE);
paulb0a053b2003-06-22 09:04:47 +00003681 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003682 }
3683
3684 return 0;
3685}
3686
3687/* Show summary-ASBR-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003688static int
paul718e3742002-12-13 20:15:29 +00003689show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3690{
3691 if (lsa != NULL)
3692 {
3693 struct summary_lsa *sl = (struct summary_lsa *) lsa->data;
3694
3695 show_ip_ospf_database_header (vty, lsa);
3696
3697 vty_out (vty, " Network Mask: /%d%s",
3698 ip_masklen (sl->mask), VTY_NEWLINE);
3699 vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric),
3700 VTY_NEWLINE);
paulb0a053b2003-06-22 09:04:47 +00003701 vty_out (vty, "%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00003702 }
3703
3704 return 0;
3705}
3706
3707/* Show AS-external-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003708static int
paul718e3742002-12-13 20:15:29 +00003709show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3710{
3711 if (lsa != NULL)
3712 {
3713 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3714
3715 show_ip_ospf_database_header (vty, lsa);
3716
3717 vty_out (vty, " Network Mask: /%d%s",
3718 ip_masklen (al->mask), VTY_NEWLINE);
3719 vty_out (vty, " Metric Type: %s%s",
3720 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3721 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3722 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3723 vty_out (vty, " Metric: %d%s",
3724 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3725 vty_out (vty, " Forward Address: %s%s",
3726 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3727
3728 vty_out (vty, " External Route Tag: %lu%s%s",
3729 (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3730 }
3731
3732 return 0;
3733}
3734
ajs2a42e282004-12-08 18:43:03 +00003735/* N.B. This function currently seems to be unused. */
paul4dadc292005-05-06 21:37:42 +00003736static int
paul718e3742002-12-13 20:15:29 +00003737show_as_external_lsa_stdvty (struct ospf_lsa *lsa)
3738{
3739 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3740
3741 /* show_ip_ospf_database_header (vty, lsa); */
3742
ajs2a42e282004-12-08 18:43:03 +00003743 zlog_debug( " Network Mask: /%d%s",
paul718e3742002-12-13 20:15:29 +00003744 ip_masklen (al->mask), "\n");
ajs2a42e282004-12-08 18:43:03 +00003745 zlog_debug( " Metric Type: %s%s",
paul718e3742002-12-13 20:15:29 +00003746 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3747 "2 (Larger than any link state path)" : "1", "\n");
ajs2a42e282004-12-08 18:43:03 +00003748 zlog_debug( " TOS: 0%s", "\n");
3749 zlog_debug( " Metric: %d%s",
paul718e3742002-12-13 20:15:29 +00003750 GET_METRIC (al->e[0].metric), "\n");
ajs2a42e282004-12-08 18:43:03 +00003751 zlog_debug( " Forward Address: %s%s",
paul718e3742002-12-13 20:15:29 +00003752 inet_ntoa (al->e[0].fwd_addr), "\n");
3753
ajs2a42e282004-12-08 18:43:03 +00003754 zlog_debug( " External Route Tag: %u%s%s",
paul718e3742002-12-13 20:15:29 +00003755 ntohl (al->e[0].route_tag), "\n", "\n");
3756
3757 return 0;
3758}
3759
3760/* Show AS-NSSA-LSA detail information. */
paul4dadc292005-05-06 21:37:42 +00003761static int
paul718e3742002-12-13 20:15:29 +00003762show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3763{
3764 if (lsa != NULL)
3765 {
3766 struct as_external_lsa *al = (struct as_external_lsa *) lsa->data;
3767
3768 show_ip_ospf_database_header (vty, lsa);
3769
3770 vty_out (vty, " Network Mask: /%d%s",
3771 ip_masklen (al->mask), VTY_NEWLINE);
3772 vty_out (vty, " Metric Type: %s%s",
3773 IS_EXTERNAL_METRIC (al->e[0].tos) ?
3774 "2 (Larger than any link state path)" : "1", VTY_NEWLINE);
3775 vty_out (vty, " TOS: 0%s", VTY_NEWLINE);
3776 vty_out (vty, " Metric: %d%s",
3777 GET_METRIC (al->e[0].metric), VTY_NEWLINE);
3778 vty_out (vty, " NSSA: Forward Address: %s%s",
3779 inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE);
3780
3781 vty_out (vty, " External Route Tag: %u%s%s",
3782 ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE);
3783 }
3784
3785 return 0;
3786}
3787
paul4dadc292005-05-06 21:37:42 +00003788static int
paul718e3742002-12-13 20:15:29 +00003789show_func_dummy (struct vty *vty, struct ospf_lsa *lsa)
3790{
3791 return 0;
3792}
3793
3794#ifdef HAVE_OPAQUE_LSA
paul4dadc292005-05-06 21:37:42 +00003795static int
paul718e3742002-12-13 20:15:29 +00003796show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa)
3797{
3798 if (lsa != NULL)
3799 {
3800 show_ip_ospf_database_header (vty, lsa);
3801 show_opaque_info_detail (vty, lsa);
3802
3803 vty_out (vty, "%s", VTY_NEWLINE);
3804 }
3805 return 0;
3806}
3807#endif /* HAVE_OPAQUE_LSA */
3808
3809int (*show_function[])(struct vty *, struct ospf_lsa *) =
3810{
3811 NULL,
3812 show_router_lsa_detail,
3813 show_network_lsa_detail,
3814 show_summary_lsa_detail,
3815 show_summary_asbr_lsa_detail,
3816 show_as_external_lsa_detail,
paul718e3742002-12-13 20:15:29 +00003817 show_func_dummy,
3818 show_as_nssa_lsa_detail, /* almost same as external */
paul718e3742002-12-13 20:15:29 +00003819#ifdef HAVE_OPAQUE_LSA
paul718e3742002-12-13 20:15:29 +00003820 NULL, /* type-8 */
3821 show_opaque_lsa_detail,
3822 show_opaque_lsa_detail,
3823 show_opaque_lsa_detail,
3824#endif /* HAVE_OPAQUE_LSA */
3825};
3826
paul4dadc292005-05-06 21:37:42 +00003827static void
paul718e3742002-12-13 20:15:29 +00003828show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id,
3829 struct in_addr *adv_router)
3830{
3831 memset (lp, 0, sizeof (struct prefix_ls));
3832 lp->family = 0;
3833 if (id == NULL)
3834 lp->prefixlen = 0;
3835 else if (adv_router == NULL)
3836 {
3837 lp->prefixlen = 32;
3838 lp->id = *id;
3839 }
3840 else
3841 {
3842 lp->prefixlen = 64;
3843 lp->id = *id;
3844 lp->adv_router = *adv_router;
3845 }
3846}
3847
paul4dadc292005-05-06 21:37:42 +00003848static void
paul718e3742002-12-13 20:15:29 +00003849show_lsa_detail_proc (struct vty *vty, struct route_table *rt,
3850 struct in_addr *id, struct in_addr *adv_router)
3851{
3852 struct prefix_ls lp;
3853 struct route_node *rn, *start;
3854 struct ospf_lsa *lsa;
3855
3856 show_lsa_prefix_set (vty, &lp, id, adv_router);
3857 start = route_node_get (rt, (struct prefix *) &lp);
3858 if (start)
3859 {
3860 route_lock_node (start);
3861 for (rn = start; rn; rn = route_next_until (rn, start))
3862 if ((lsa = rn->info))
3863 {
paul718e3742002-12-13 20:15:29 +00003864 if (show_function[lsa->data->type] != NULL)
3865 show_function[lsa->data->type] (vty, lsa);
3866 }
3867 route_unlock_node (start);
3868 }
3869}
3870
3871/* Show detail LSA information
3872 -- if id is NULL then show all LSAs. */
paul4dadc292005-05-06 21:37:42 +00003873static void
paul020709f2003-04-04 02:44:16 +00003874show_lsa_detail (struct vty *vty, struct ospf *ospf, int type,
paul718e3742002-12-13 20:15:29 +00003875 struct in_addr *id, struct in_addr *adv_router)
3876{
hasso52dc7ee2004-09-23 19:18:23 +00003877 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003878 struct ospf_area *area;
3879
paul718e3742002-12-13 20:15:29 +00003880 switch (type)
3881 {
3882 case OSPF_AS_EXTERNAL_LSA:
3883#ifdef HAVE_OPAQUE_LSA
3884 case OSPF_OPAQUE_AS_LSA:
3885#endif /* HAVE_OPAQUE_LSA */
3886 vty_out (vty, " %s %s%s",
3887 show_database_desc[type],
3888 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003889 show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router);
paul718e3742002-12-13 20:15:29 +00003890 break;
3891 default:
paul1eb8ef22005-04-07 07:30:20 +00003892 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00003893 {
paul718e3742002-12-13 20:15:29 +00003894 vty_out (vty, "%s %s (Area %s)%s%s",
3895 VTY_NEWLINE, show_database_desc[type],
3896 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3897 show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router);
3898 }
3899 break;
3900 }
3901}
3902
paul4dadc292005-05-06 21:37:42 +00003903static void
paul718e3742002-12-13 20:15:29 +00003904show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt,
3905 struct in_addr *adv_router)
3906{
3907 struct route_node *rn;
3908 struct ospf_lsa *lsa;
3909
3910 for (rn = route_top (rt); rn; rn = route_next (rn))
3911 if ((lsa = rn->info))
3912 if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router))
3913 {
paul718e3742002-12-13 20:15:29 +00003914 if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT))
3915 continue;
paul718e3742002-12-13 20:15:29 +00003916 if (show_function[lsa->data->type] != NULL)
3917 show_function[lsa->data->type] (vty, lsa);
3918 }
3919}
3920
3921/* Show detail LSA information. */
paul4dadc292005-05-06 21:37:42 +00003922static void
paul020709f2003-04-04 02:44:16 +00003923show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type,
paul718e3742002-12-13 20:15:29 +00003924 struct in_addr *adv_router)
3925{
hasso52dc7ee2004-09-23 19:18:23 +00003926 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00003927 struct ospf_area *area;
paul718e3742002-12-13 20:15:29 +00003928
3929 switch (type)
3930 {
3931 case OSPF_AS_EXTERNAL_LSA:
3932#ifdef HAVE_OPAQUE_LSA
3933 case OSPF_OPAQUE_AS_LSA:
3934#endif /* HAVE_OPAQUE_LSA */
3935 vty_out (vty, " %s %s%s",
3936 show_database_desc[type],
3937 VTY_NEWLINE, VTY_NEWLINE);
paul68980082003-03-25 05:07:42 +00003938 show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type),
paul718e3742002-12-13 20:15:29 +00003939 adv_router);
3940 break;
3941 default:
paul1eb8ef22005-04-07 07:30:20 +00003942 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00003943 {
paul718e3742002-12-13 20:15:29 +00003944 vty_out (vty, "%s %s (Area %s)%s%s",
3945 VTY_NEWLINE, show_database_desc[type],
3946 ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE);
3947 show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type),
3948 adv_router);
3949 }
3950 break;
3951 }
3952}
3953
paul4dadc292005-05-06 21:37:42 +00003954static void
paul020709f2003-04-04 02:44:16 +00003955show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self)
paul718e3742002-12-13 20:15:29 +00003956{
paul020709f2003-04-04 02:44:16 +00003957 struct ospf_lsa *lsa;
3958 struct route_node *rn;
paul1eb8ef22005-04-07 07:30:20 +00003959 struct ospf_area *area;
hasso52dc7ee2004-09-23 19:18:23 +00003960 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00003961 int type;
3962
paul1eb8ef22005-04-07 07:30:20 +00003963 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00003964 {
paul718e3742002-12-13 20:15:29 +00003965 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3966 {
3967 switch (type)
3968 {
3969 case OSPF_AS_EXTERNAL_LSA:
3970#ifdef HAVE_OPAQUE_LSA
3971 case OSPF_OPAQUE_AS_LSA:
3972#endif /* HAVE_OPAQUE_LSA */
3973 continue;
3974 default:
3975 break;
3976 }
3977 if (ospf_lsdb_count_self (area->lsdb, type) > 0 ||
3978 (!self && ospf_lsdb_count (area->lsdb, type) > 0))
3979 {
3980 vty_out (vty, " %s (Area %s)%s%s",
3981 show_database_desc[type],
3982 ospf_area_desc_string (area),
3983 VTY_NEWLINE, VTY_NEWLINE);
3984 vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE);
3985
paul020709f2003-04-04 02:44:16 +00003986 LSDB_LOOP (AREA_LSDB (area, type), rn, lsa)
3987 show_lsa_summary (vty, lsa, self);
paul718e3742002-12-13 20:15:29 +00003988
3989 vty_out (vty, "%s", VTY_NEWLINE);
3990 }
3991 }
3992 }
3993
3994 for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++)
3995 {
3996 switch (type)
3997 {
3998 case OSPF_AS_EXTERNAL_LSA:
3999#ifdef HAVE_OPAQUE_LSA
4000 case OSPF_OPAQUE_AS_LSA:
4001#endif /* HAVE_OPAQUE_LSA */
paule8e19462006-01-19 20:16:55 +00004002 break;
paul718e3742002-12-13 20:15:29 +00004003 default:
4004 continue;
4005 }
paul68980082003-03-25 05:07:42 +00004006 if (ospf_lsdb_count_self (ospf->lsdb, type) ||
4007 (!self && ospf_lsdb_count (ospf->lsdb, type)))
paul718e3742002-12-13 20:15:29 +00004008 {
4009 vty_out (vty, " %s%s%s",
4010 show_database_desc[type],
4011 VTY_NEWLINE, VTY_NEWLINE);
4012 vty_out (vty, "%s%s", show_database_header[type],
4013 VTY_NEWLINE);
paul020709f2003-04-04 02:44:16 +00004014
4015 LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa)
4016 show_lsa_summary (vty, lsa, self);
4017
paul718e3742002-12-13 20:15:29 +00004018 vty_out (vty, "%s", VTY_NEWLINE);
4019 }
4020 }
4021
4022 vty_out (vty, "%s", VTY_NEWLINE);
4023}
4024
paul4dadc292005-05-06 21:37:42 +00004025static void
paul020709f2003-04-04 02:44:16 +00004026show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00004027{
hasso52dc7ee2004-09-23 19:18:23 +00004028 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00004029 struct ospf_lsa *lsa;
4030
4031 vty_out (vty, "%s MaxAge Link States:%s%s",
4032 VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE);
4033
paul1eb8ef22005-04-07 07:30:20 +00004034 for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa))
4035 {
4036 vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE);
4037 vty_out (vty, "Link State ID: %s%s",
4038 inet_ntoa (lsa->data->id), VTY_NEWLINE);
4039 vty_out (vty, "Advertising Router: %s%s",
4040 inet_ntoa (lsa->data->adv_router), VTY_NEWLINE);
4041 vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE);
4042 vty_out (vty, "%s", VTY_NEWLINE);
4043 }
paul718e3742002-12-13 20:15:29 +00004044}
4045
paul718e3742002-12-13 20:15:29 +00004046#define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n"
4047#define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external"
paul718e3742002-12-13 20:15:29 +00004048
4049#ifdef HAVE_OPAQUE_LSA
4050#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n"
4051#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n"
4052#define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n"
4053#define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as"
4054#else /* HAVE_OPAQUE_LSA */
4055#define OSPF_LSA_TYPE_OPAQUE_LINK_DESC ""
4056#define OSPF_LSA_TYPE_OPAQUE_AREA_DESC ""
4057#define OSPF_LSA_TYPE_OPAQUE_AS_DESC ""
4058#define OSPF_LSA_TYPE_OPAQUE_CMD_STR ""
4059#endif /* HAVE_OPAQUE_LSA */
4060
4061#define OSPF_LSA_TYPES_CMD_STR \
4062 "asbr-summary|external|network|router|summary" \
4063 OSPF_LSA_TYPE_NSSA_CMD_STR \
4064 OSPF_LSA_TYPE_OPAQUE_CMD_STR
4065
4066#define OSPF_LSA_TYPES_DESC \
4067 "ASBR summary link states\n" \
4068 "External link states\n" \
4069 "Network link states\n" \
4070 "Router link states\n" \
4071 "Network summary link states\n" \
4072 OSPF_LSA_TYPE_NSSA_DESC \
4073 OSPF_LSA_TYPE_OPAQUE_LINK_DESC \
4074 OSPF_LSA_TYPE_OPAQUE_AREA_DESC \
4075 OSPF_LSA_TYPE_OPAQUE_AS_DESC
4076
4077DEFUN (show_ip_ospf_database,
4078 show_ip_ospf_database_cmd,
4079 "show ip ospf database",
4080 SHOW_STR
4081 IP_STR
4082 "OSPF information\n"
4083 "Database summary\n")
4084{
paul020709f2003-04-04 02:44:16 +00004085 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00004086 int type, ret;
4087 struct in_addr id, adv_router;
4088
paul020709f2003-04-04 02:44:16 +00004089 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00004090 if (ospf == NULL)
Paul Jakmacac3b5c2006-05-11 13:31:11 +00004091 {
4092 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
4093 return CMD_SUCCESS;
4094 }
paul718e3742002-12-13 20:15:29 +00004095
4096 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00004097 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00004098
4099 /* Show all LSA. */
4100 if (argc == 0)
4101 {
paul020709f2003-04-04 02:44:16 +00004102 show_ip_ospf_database_summary (vty, ospf, 0);
paul718e3742002-12-13 20:15:29 +00004103 return CMD_SUCCESS;
4104 }
4105
4106 /* Set database type to show. */
4107 if (strncmp (argv[0], "r", 1) == 0)
4108 type = OSPF_ROUTER_LSA;
4109 else if (strncmp (argv[0], "ne", 2) == 0)
4110 type = OSPF_NETWORK_LSA;
paul718e3742002-12-13 20:15:29 +00004111 else if (strncmp (argv[0], "ns", 2) == 0)
4112 type = OSPF_AS_NSSA_LSA;
paul718e3742002-12-13 20:15:29 +00004113 else if (strncmp (argv[0], "su", 2) == 0)
4114 type = OSPF_SUMMARY_LSA;
4115 else if (strncmp (argv[0], "a", 1) == 0)
4116 type = OSPF_ASBR_SUMMARY_LSA;
4117 else if (strncmp (argv[0], "e", 1) == 0)
4118 type = OSPF_AS_EXTERNAL_LSA;
4119 else if (strncmp (argv[0], "se", 2) == 0)
4120 {
paul020709f2003-04-04 02:44:16 +00004121 show_ip_ospf_database_summary (vty, ospf, 1);
paul718e3742002-12-13 20:15:29 +00004122 return CMD_SUCCESS;
4123 }
4124 else if (strncmp (argv[0], "m", 1) == 0)
4125 {
paul020709f2003-04-04 02:44:16 +00004126 show_ip_ospf_database_maxage (vty, ospf);
paul718e3742002-12-13 20:15:29 +00004127 return CMD_SUCCESS;
4128 }
4129#ifdef HAVE_OPAQUE_LSA
4130 else if (strncmp (argv[0], "opaque-l", 8) == 0)
4131 type = OSPF_OPAQUE_LINK_LSA;
4132 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
4133 type = OSPF_OPAQUE_AREA_LSA;
4134 else if (strncmp (argv[0], "opaque-as", 9) == 0)
4135 type = OSPF_OPAQUE_AS_LSA;
4136#endif /* HAVE_OPAQUE_LSA */
4137 else
4138 return CMD_WARNING;
4139
4140 /* `show ip ospf database LSA'. */
4141 if (argc == 1)
paul020709f2003-04-04 02:44:16 +00004142 show_lsa_detail (vty, ospf, type, NULL, NULL);
paul718e3742002-12-13 20:15:29 +00004143 else if (argc >= 2)
4144 {
4145 ret = inet_aton (argv[1], &id);
4146 if (!ret)
4147 return CMD_WARNING;
4148
4149 /* `show ip ospf database LSA ID'. */
4150 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00004151 show_lsa_detail (vty, ospf, type, &id, NULL);
paul718e3742002-12-13 20:15:29 +00004152 /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */
4153 else if (argc == 3)
4154 {
4155 if (strncmp (argv[2], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00004156 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00004157 else
4158 {
4159 ret = inet_aton (argv[2], &adv_router);
4160 if (!ret)
4161 return CMD_WARNING;
4162 }
paul020709f2003-04-04 02:44:16 +00004163 show_lsa_detail (vty, ospf, type, &id, &adv_router);
paul718e3742002-12-13 20:15:29 +00004164 }
4165 }
4166
4167 return CMD_SUCCESS;
4168}
4169
4170ALIAS (show_ip_ospf_database,
4171 show_ip_ospf_database_type_cmd,
4172 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)",
4173 SHOW_STR
4174 IP_STR
4175 "OSPF information\n"
4176 "Database summary\n"
4177 OSPF_LSA_TYPES_DESC
4178 "LSAs in MaxAge list\n"
4179 "Self-originated link states\n")
4180
4181ALIAS (show_ip_ospf_database,
4182 show_ip_ospf_database_type_id_cmd,
4183 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D",
4184 SHOW_STR
4185 IP_STR
4186 "OSPF information\n"
4187 "Database summary\n"
4188 OSPF_LSA_TYPES_DESC
4189 "Link State ID (as an IP address)\n")
4190
4191ALIAS (show_ip_ospf_database,
4192 show_ip_ospf_database_type_id_adv_router_cmd,
4193 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D",
4194 SHOW_STR
4195 IP_STR
4196 "OSPF information\n"
4197 "Database summary\n"
4198 OSPF_LSA_TYPES_DESC
4199 "Link State ID (as an IP address)\n"
4200 "Advertising Router link states\n"
4201 "Advertising Router (as an IP address)\n")
4202
4203ALIAS (show_ip_ospf_database,
4204 show_ip_ospf_database_type_id_self_cmd,
4205 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)",
4206 SHOW_STR
4207 IP_STR
4208 "OSPF information\n"
4209 "Database summary\n"
4210 OSPF_LSA_TYPES_DESC
4211 "Link State ID (as an IP address)\n"
4212 "Self-originated link states\n"
4213 "\n")
4214
4215DEFUN (show_ip_ospf_database_type_adv_router,
4216 show_ip_ospf_database_type_adv_router_cmd,
4217 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D",
4218 SHOW_STR
4219 IP_STR
4220 "OSPF information\n"
4221 "Database summary\n"
4222 OSPF_LSA_TYPES_DESC
4223 "Advertising Router link states\n"
4224 "Advertising Router (as an IP address)\n")
4225{
paul020709f2003-04-04 02:44:16 +00004226 struct ospf *ospf;
paul718e3742002-12-13 20:15:29 +00004227 int type, ret;
4228 struct in_addr adv_router;
4229
paul020709f2003-04-04 02:44:16 +00004230 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00004231 if (ospf == NULL)
Paul Jakmacac3b5c2006-05-11 13:31:11 +00004232 {
4233 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
4234 return CMD_SUCCESS;
4235 }
paul718e3742002-12-13 20:15:29 +00004236
4237 vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE,
paul68980082003-03-25 05:07:42 +00004238 inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00004239
4240 if (argc != 2)
4241 return CMD_WARNING;
4242
4243 /* Set database type to show. */
4244 if (strncmp (argv[0], "r", 1) == 0)
4245 type = OSPF_ROUTER_LSA;
4246 else if (strncmp (argv[0], "ne", 2) == 0)
4247 type = OSPF_NETWORK_LSA;
paul718e3742002-12-13 20:15:29 +00004248 else if (strncmp (argv[0], "ns", 2) == 0)
4249 type = OSPF_AS_NSSA_LSA;
paul718e3742002-12-13 20:15:29 +00004250 else if (strncmp (argv[0], "s", 1) == 0)
4251 type = OSPF_SUMMARY_LSA;
4252 else if (strncmp (argv[0], "a", 1) == 0)
4253 type = OSPF_ASBR_SUMMARY_LSA;
4254 else if (strncmp (argv[0], "e", 1) == 0)
4255 type = OSPF_AS_EXTERNAL_LSA;
4256#ifdef HAVE_OPAQUE_LSA
4257 else if (strncmp (argv[0], "opaque-l", 8) == 0)
4258 type = OSPF_OPAQUE_LINK_LSA;
4259 else if (strncmp (argv[0], "opaque-ar", 9) == 0)
4260 type = OSPF_OPAQUE_AREA_LSA;
4261 else if (strncmp (argv[0], "opaque-as", 9) == 0)
4262 type = OSPF_OPAQUE_AS_LSA;
4263#endif /* HAVE_OPAQUE_LSA */
4264 else
4265 return CMD_WARNING;
4266
4267 /* `show ip ospf database LSA adv-router ADV_ROUTER'. */
4268 if (strncmp (argv[1], "s", 1) == 0)
paul68980082003-03-25 05:07:42 +00004269 adv_router = ospf->router_id;
paul718e3742002-12-13 20:15:29 +00004270 else
4271 {
4272 ret = inet_aton (argv[1], &adv_router);
4273 if (!ret)
4274 return CMD_WARNING;
4275 }
4276
paul020709f2003-04-04 02:44:16 +00004277 show_lsa_detail_adv_router (vty, ospf, type, &adv_router);
paul718e3742002-12-13 20:15:29 +00004278
4279 return CMD_SUCCESS;
4280}
4281
4282ALIAS (show_ip_ospf_database_type_adv_router,
4283 show_ip_ospf_database_type_self_cmd,
4284 "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)",
4285 SHOW_STR
4286 IP_STR
4287 "OSPF information\n"
4288 "Database summary\n"
4289 OSPF_LSA_TYPES_DESC
4290 "Self-originated link states\n")
4291
4292
4293DEFUN (ip_ospf_authentication_args,
4294 ip_ospf_authentication_args_addr_cmd,
4295 "ip ospf authentication (null|message-digest) A.B.C.D",
4296 "IP Information\n"
4297 "OSPF interface commands\n"
4298 "Enable authentication on this interface\n"
4299 "Use null authentication\n"
4300 "Use message-digest authentication\n"
4301 "Address of interface")
4302{
4303 struct interface *ifp;
4304 struct in_addr addr;
4305 int ret;
4306 struct ospf_if_params *params;
4307
4308 ifp = vty->index;
4309 params = IF_DEF_PARAMS (ifp);
4310
4311 if (argc == 2)
4312 {
4313 ret = inet_aton(argv[1], &addr);
4314 if (!ret)
4315 {
4316 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4317 VTY_NEWLINE);
4318 return CMD_WARNING;
4319 }
4320
4321 params = ospf_get_if_params (ifp, addr);
4322 ospf_if_update_params (ifp, addr);
4323 }
4324
4325 /* Handle null authentication */
4326 if ( argv[0][0] == 'n' )
4327 {
4328 SET_IF_PARAM (params, auth_type);
4329 params->auth_type = OSPF_AUTH_NULL;
4330 return CMD_SUCCESS;
4331 }
4332
4333 /* Handle message-digest authentication */
4334 if ( argv[0][0] == 'm' )
4335 {
4336 SET_IF_PARAM (params, auth_type);
4337 params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC;
4338 return CMD_SUCCESS;
4339 }
4340
4341 vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE);
4342 return CMD_WARNING;
4343}
4344
4345ALIAS (ip_ospf_authentication_args,
4346 ip_ospf_authentication_args_cmd,
4347 "ip ospf authentication (null|message-digest)",
4348 "IP Information\n"
4349 "OSPF interface commands\n"
4350 "Enable authentication on this interface\n"
4351 "Use null authentication\n"
4352 "Use message-digest authentication\n")
4353
4354DEFUN (ip_ospf_authentication,
4355 ip_ospf_authentication_addr_cmd,
4356 "ip ospf authentication A.B.C.D",
4357 "IP Information\n"
4358 "OSPF interface commands\n"
4359 "Enable authentication on this interface\n"
4360 "Address of interface")
4361{
4362 struct interface *ifp;
4363 struct in_addr addr;
4364 int ret;
4365 struct ospf_if_params *params;
4366
4367 ifp = vty->index;
4368 params = IF_DEF_PARAMS (ifp);
4369
4370 if (argc == 1)
4371 {
Paul Jakma5dcf71d2007-05-10 03:00:09 +00004372 ret = inet_aton(argv[0], &addr);
paul718e3742002-12-13 20:15:29 +00004373 if (!ret)
4374 {
4375 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4376 VTY_NEWLINE);
4377 return CMD_WARNING;
4378 }
4379
4380 params = ospf_get_if_params (ifp, addr);
4381 ospf_if_update_params (ifp, addr);
4382 }
4383
4384 SET_IF_PARAM (params, auth_type);
4385 params->auth_type = OSPF_AUTH_SIMPLE;
4386
4387 return CMD_SUCCESS;
4388}
4389
4390ALIAS (ip_ospf_authentication,
4391 ip_ospf_authentication_cmd,
4392 "ip ospf authentication",
4393 "IP Information\n"
4394 "OSPF interface commands\n"
4395 "Enable authentication on this interface\n")
4396
4397DEFUN (no_ip_ospf_authentication,
4398 no_ip_ospf_authentication_addr_cmd,
4399 "no ip ospf authentication A.B.C.D",
4400 NO_STR
4401 "IP Information\n"
4402 "OSPF interface commands\n"
4403 "Enable authentication on this interface\n"
4404 "Address of interface")
4405{
4406 struct interface *ifp;
4407 struct in_addr addr;
4408 int ret;
4409 struct ospf_if_params *params;
4410
4411 ifp = vty->index;
4412 params = IF_DEF_PARAMS (ifp);
4413
4414 if (argc == 1)
4415 {
Paul Jakma5dcf71d2007-05-10 03:00:09 +00004416 ret = inet_aton(argv[0], &addr);
paul718e3742002-12-13 20:15:29 +00004417 if (!ret)
4418 {
4419 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4420 VTY_NEWLINE);
4421 return CMD_WARNING;
4422 }
4423
4424 params = ospf_lookup_if_params (ifp, addr);
4425 if (params == NULL)
4426 return CMD_SUCCESS;
4427 }
4428
4429 params->auth_type = OSPF_AUTH_NOTSET;
4430 UNSET_IF_PARAM (params, auth_type);
4431
4432 if (params != IF_DEF_PARAMS (ifp))
4433 {
4434 ospf_free_if_params (ifp, addr);
4435 ospf_if_update_params (ifp, addr);
4436 }
4437
4438 return CMD_SUCCESS;
4439}
4440
4441ALIAS (no_ip_ospf_authentication,
4442 no_ip_ospf_authentication_cmd,
4443 "no ip ospf authentication",
4444 NO_STR
4445 "IP Information\n"
4446 "OSPF interface commands\n"
4447 "Enable authentication on this interface\n")
4448
4449DEFUN (ip_ospf_authentication_key,
4450 ip_ospf_authentication_key_addr_cmd,
4451 "ip ospf authentication-key AUTH_KEY A.B.C.D",
4452 "IP Information\n"
4453 "OSPF interface commands\n"
4454 "Authentication password (key)\n"
4455 "The OSPF password (key)\n"
4456 "Address of interface")
4457{
4458 struct interface *ifp;
4459 struct in_addr addr;
4460 int ret;
4461 struct ospf_if_params *params;
4462
4463 ifp = vty->index;
4464 params = IF_DEF_PARAMS (ifp);
4465
4466 if (argc == 2)
4467 {
4468 ret = inet_aton(argv[1], &addr);
4469 if (!ret)
4470 {
4471 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4472 VTY_NEWLINE);
4473 return CMD_WARNING;
4474 }
4475
4476 params = ospf_get_if_params (ifp, addr);
4477 ospf_if_update_params (ifp, addr);
4478 }
4479
4480
4481 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1);
hassoc9e52be2004-09-26 16:09:34 +00004482 strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE);
paul718e3742002-12-13 20:15:29 +00004483 SET_IF_PARAM (params, auth_simple);
4484
4485 return CMD_SUCCESS;
4486}
4487
4488ALIAS (ip_ospf_authentication_key,
4489 ip_ospf_authentication_key_cmd,
4490 "ip ospf authentication-key AUTH_KEY",
4491 "IP Information\n"
4492 "OSPF interface commands\n"
4493 "Authentication password (key)\n"
4494 "The OSPF password (key)")
4495
4496ALIAS (ip_ospf_authentication_key,
4497 ospf_authentication_key_cmd,
4498 "ospf authentication-key AUTH_KEY",
4499 "OSPF interface commands\n"
4500 "Authentication password (key)\n"
4501 "The OSPF password (key)")
4502
4503DEFUN (no_ip_ospf_authentication_key,
4504 no_ip_ospf_authentication_key_addr_cmd,
4505 "no ip ospf authentication-key A.B.C.D",
4506 NO_STR
4507 "IP Information\n"
4508 "OSPF interface commands\n"
4509 "Authentication password (key)\n"
4510 "Address of interface")
4511{
4512 struct interface *ifp;
4513 struct in_addr addr;
4514 int ret;
4515 struct ospf_if_params *params;
4516
4517 ifp = vty->index;
4518 params = IF_DEF_PARAMS (ifp);
4519
Paul Jakma5dcf71d2007-05-10 03:00:09 +00004520 if (argc == 1)
paul718e3742002-12-13 20:15:29 +00004521 {
Paul Jakma5dcf71d2007-05-10 03:00:09 +00004522 ret = inet_aton(argv[0], &addr);
paul718e3742002-12-13 20:15:29 +00004523 if (!ret)
4524 {
4525 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4526 VTY_NEWLINE);
4527 return CMD_WARNING;
4528 }
4529
4530 params = ospf_lookup_if_params (ifp, addr);
4531 if (params == NULL)
4532 return CMD_SUCCESS;
4533 }
4534
4535 memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE);
4536 UNSET_IF_PARAM (params, auth_simple);
4537
4538 if (params != IF_DEF_PARAMS (ifp))
4539 {
4540 ospf_free_if_params (ifp, addr);
4541 ospf_if_update_params (ifp, addr);
4542 }
4543
4544 return CMD_SUCCESS;
4545}
4546
4547ALIAS (no_ip_ospf_authentication_key,
4548 no_ip_ospf_authentication_key_cmd,
4549 "no ip ospf authentication-key",
4550 NO_STR
4551 "IP Information\n"
4552 "OSPF interface commands\n"
4553 "Authentication password (key)\n")
4554
4555ALIAS (no_ip_ospf_authentication_key,
4556 no_ospf_authentication_key_cmd,
4557 "no ospf authentication-key",
4558 NO_STR
4559 "OSPF interface commands\n"
4560 "Authentication password (key)\n")
4561
4562DEFUN (ip_ospf_message_digest_key,
4563 ip_ospf_message_digest_key_addr_cmd,
4564 "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D",
4565 "IP Information\n"
4566 "OSPF interface commands\n"
4567 "Message digest authentication password (key)\n"
4568 "Key ID\n"
4569 "Use MD5 algorithm\n"
4570 "The OSPF password (key)"
4571 "Address of interface")
4572{
4573 struct interface *ifp;
4574 struct crypt_key *ck;
4575 u_char key_id;
4576 struct in_addr addr;
4577 int ret;
4578 struct ospf_if_params *params;
4579
4580 ifp = vty->index;
4581 params = IF_DEF_PARAMS (ifp);
4582
4583 if (argc == 3)
4584 {
4585 ret = inet_aton(argv[2], &addr);
4586 if (!ret)
4587 {
4588 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4589 VTY_NEWLINE);
4590 return CMD_WARNING;
4591 }
4592
4593 params = ospf_get_if_params (ifp, addr);
4594 ospf_if_update_params (ifp, addr);
4595 }
4596
4597 key_id = strtol (argv[0], NULL, 10);
4598 if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL)
4599 {
4600 vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE);
4601 return CMD_WARNING;
4602 }
4603
4604 ck = ospf_crypt_key_new ();
4605 ck->key_id = (u_char) key_id;
4606 memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1);
hassoc9e52be2004-09-26 16:09:34 +00004607 strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE);
paul718e3742002-12-13 20:15:29 +00004608
4609 ospf_crypt_key_add (params->auth_crypt, ck);
4610 SET_IF_PARAM (params, auth_crypt);
4611
4612 return CMD_SUCCESS;
4613}
4614
4615ALIAS (ip_ospf_message_digest_key,
4616 ip_ospf_message_digest_key_cmd,
4617 "ip ospf message-digest-key <1-255> md5 KEY",
4618 "IP Information\n"
4619 "OSPF interface commands\n"
4620 "Message digest authentication password (key)\n"
4621 "Key ID\n"
4622 "Use MD5 algorithm\n"
4623 "The OSPF password (key)")
4624
4625ALIAS (ip_ospf_message_digest_key,
4626 ospf_message_digest_key_cmd,
4627 "ospf message-digest-key <1-255> md5 KEY",
4628 "OSPF interface commands\n"
4629 "Message digest authentication password (key)\n"
4630 "Key ID\n"
4631 "Use MD5 algorithm\n"
4632 "The OSPF password (key)")
4633
4634DEFUN (no_ip_ospf_message_digest_key,
4635 no_ip_ospf_message_digest_key_addr_cmd,
4636 "no ip ospf message-digest-key <1-255> A.B.C.D",
4637 NO_STR
4638 "IP Information\n"
4639 "OSPF interface commands\n"
4640 "Message digest authentication password (key)\n"
4641 "Key ID\n"
4642 "Address of interface")
4643{
4644 struct interface *ifp;
4645 struct crypt_key *ck;
4646 int key_id;
4647 struct in_addr addr;
4648 int ret;
4649 struct ospf_if_params *params;
4650
4651 ifp = vty->index;
4652 params = IF_DEF_PARAMS (ifp);
4653
4654 if (argc == 2)
4655 {
4656 ret = inet_aton(argv[1], &addr);
4657 if (!ret)
4658 {
4659 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4660 VTY_NEWLINE);
4661 return CMD_WARNING;
4662 }
4663
4664 params = ospf_lookup_if_params (ifp, addr);
4665 if (params == NULL)
4666 return CMD_SUCCESS;
4667 }
4668
4669 key_id = strtol (argv[0], NULL, 10);
4670 ck = ospf_crypt_key_lookup (params->auth_crypt, key_id);
4671 if (ck == NULL)
4672 {
4673 vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE);
4674 return CMD_WARNING;
4675 }
4676
4677 ospf_crypt_key_delete (params->auth_crypt, key_id);
4678
4679 if (params != IF_DEF_PARAMS (ifp))
4680 {
4681 ospf_free_if_params (ifp, addr);
4682 ospf_if_update_params (ifp, addr);
4683 }
4684
4685 return CMD_SUCCESS;
4686}
4687
4688ALIAS (no_ip_ospf_message_digest_key,
4689 no_ip_ospf_message_digest_key_cmd,
4690 "no ip ospf message-digest-key <1-255>",
4691 NO_STR
4692 "IP Information\n"
4693 "OSPF interface commands\n"
4694 "Message digest authentication password (key)\n"
4695 "Key ID\n")
4696
4697ALIAS (no_ip_ospf_message_digest_key,
4698 no_ospf_message_digest_key_cmd,
4699 "no ospf message-digest-key <1-255>",
4700 NO_STR
4701 "OSPF interface commands\n"
4702 "Message digest authentication password (key)\n"
4703 "Key ID\n")
4704
4705DEFUN (ip_ospf_cost,
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004706 ip_ospf_cost_u32_inet4_cmd,
paul718e3742002-12-13 20:15:29 +00004707 "ip ospf cost <1-65535> A.B.C.D",
4708 "IP Information\n"
4709 "OSPF interface commands\n"
4710 "Interface cost\n"
4711 "Cost\n"
4712 "Address of interface")
4713{
4714 struct interface *ifp = vty->index;
4715 u_int32_t cost;
4716 struct in_addr addr;
4717 int ret;
4718 struct ospf_if_params *params;
4719
4720 params = IF_DEF_PARAMS (ifp);
4721
4722 cost = strtol (argv[0], NULL, 10);
4723
4724 /* cost range is <1-65535>. */
4725 if (cost < 1 || cost > 65535)
4726 {
4727 vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
4728 return CMD_WARNING;
4729 }
4730
4731 if (argc == 2)
4732 {
4733 ret = inet_aton(argv[1], &addr);
4734 if (!ret)
4735 {
4736 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4737 VTY_NEWLINE);
4738 return CMD_WARNING;
4739 }
4740
4741 params = ospf_get_if_params (ifp, addr);
4742 ospf_if_update_params (ifp, addr);
4743 }
4744
4745 SET_IF_PARAM (params, output_cost_cmd);
4746 params->output_cost_cmd = cost;
4747
4748 ospf_if_recalculate_output_cost (ifp);
4749
4750 return CMD_SUCCESS;
4751}
4752
4753ALIAS (ip_ospf_cost,
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004754 ip_ospf_cost_u32_cmd,
paul718e3742002-12-13 20:15:29 +00004755 "ip ospf cost <1-65535>",
4756 "IP Information\n"
4757 "OSPF interface commands\n"
4758 "Interface cost\n"
4759 "Cost")
4760
4761ALIAS (ip_ospf_cost,
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004762 ospf_cost_u32_cmd,
paul718e3742002-12-13 20:15:29 +00004763 "ospf cost <1-65535>",
4764 "OSPF interface commands\n"
4765 "Interface cost\n"
4766 "Cost")
4767
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004768ALIAS (ip_ospf_cost,
4769 ospf_cost_u32_inet4_cmd,
4770 "ospf cost <1-65535> A.B.C.D",
4771 "OSPF interface commands\n"
4772 "Interface cost\n"
4773 "Cost\n"
4774 "Address of interface")
4775
paul718e3742002-12-13 20:15:29 +00004776DEFUN (no_ip_ospf_cost,
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004777 no_ip_ospf_cost_inet4_cmd,
paul718e3742002-12-13 20:15:29 +00004778 "no ip ospf cost A.B.C.D",
4779 NO_STR
4780 "IP Information\n"
4781 "OSPF interface commands\n"
4782 "Interface cost\n"
4783 "Address of interface")
4784{
4785 struct interface *ifp = vty->index;
4786 struct in_addr addr;
4787 int ret;
4788 struct ospf_if_params *params;
4789
4790 ifp = vty->index;
4791 params = IF_DEF_PARAMS (ifp);
4792
4793 if (argc == 1)
4794 {
4795 ret = inet_aton(argv[0], &addr);
4796 if (!ret)
4797 {
4798 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4799 VTY_NEWLINE);
4800 return CMD_WARNING;
4801 }
4802
4803 params = ospf_lookup_if_params (ifp, addr);
4804 if (params == NULL)
4805 return CMD_SUCCESS;
4806 }
4807
4808 UNSET_IF_PARAM (params, output_cost_cmd);
4809
4810 if (params != IF_DEF_PARAMS (ifp))
4811 {
4812 ospf_free_if_params (ifp, addr);
4813 ospf_if_update_params (ifp, addr);
4814 }
4815
4816 ospf_if_recalculate_output_cost (ifp);
4817
4818 return CMD_SUCCESS;
4819}
4820
4821ALIAS (no_ip_ospf_cost,
4822 no_ip_ospf_cost_cmd,
4823 "no ip ospf cost",
4824 NO_STR
4825 "IP Information\n"
4826 "OSPF interface commands\n"
4827 "Interface cost\n")
4828
4829ALIAS (no_ip_ospf_cost,
4830 no_ospf_cost_cmd,
4831 "no ospf cost",
4832 NO_STR
4833 "OSPF interface commands\n"
4834 "Interface cost\n")
4835
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004836ALIAS (no_ip_ospf_cost,
4837 no_ospf_cost_inet4_cmd,
4838 "no ospf cost A.B.C.D",
4839 NO_STR
4840 "OSPF interface commands\n"
4841 "Interface cost\n"
4842 "Address of interface")
4843
Denis Ovsienko827341b2009-09-28 19:34:59 +04004844DEFUN (no_ip_ospf_cost2,
4845 no_ip_ospf_cost_u32_cmd,
4846 "no ip ospf cost <1-65535>",
4847 NO_STR
4848 "IP Information\n"
4849 "OSPF interface commands\n"
4850 "Interface cost\n"
4851 "Cost")
4852{
4853 struct interface *ifp = vty->index;
4854 struct in_addr addr;
4855 u_int32_t cost;
4856 int ret;
4857 struct ospf_if_params *params;
4858
4859 ifp = vty->index;
4860 params = IF_DEF_PARAMS (ifp);
4861
4862 /* According to the semantics we are mimicking "no ip ospf cost N" is
4863 * always treated as "no ip ospf cost" regardless of the actual value
4864 * of N already configured for the interface. Thus the first argument
4865 * is always checked to be a number, but is ignored after that.
4866 */
4867 cost = strtol (argv[0], NULL, 10);
4868 if (cost < 1 || cost > 65535)
4869 {
4870 vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE);
4871 return CMD_WARNING;
4872 }
4873
4874 if (argc == 2)
4875 {
4876 ret = inet_aton(argv[1], &addr);
4877 if (!ret)
4878 {
4879 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4880 VTY_NEWLINE);
4881 return CMD_WARNING;
4882 }
4883
4884 params = ospf_lookup_if_params (ifp, addr);
4885 if (params == NULL)
4886 return CMD_SUCCESS;
4887 }
4888
4889 UNSET_IF_PARAM (params, output_cost_cmd);
4890
4891 if (params != IF_DEF_PARAMS (ifp))
4892 {
4893 ospf_free_if_params (ifp, addr);
4894 ospf_if_update_params (ifp, addr);
4895 }
4896
4897 ospf_if_recalculate_output_cost (ifp);
4898
4899 return CMD_SUCCESS;
4900}
4901
4902ALIAS (no_ip_ospf_cost2,
4903 no_ospf_cost_u32_cmd,
4904 "no ospf cost <1-65535>",
4905 NO_STR
4906 "OSPF interface commands\n"
4907 "Interface cost\n"
4908 "Cost")
4909
4910ALIAS (no_ip_ospf_cost2,
4911 no_ip_ospf_cost_u32_inet4_cmd,
4912 "no ip ospf cost <1-65535> A.B.C.D",
4913 NO_STR
4914 "IP Information\n"
4915 "OSPF interface commands\n"
4916 "Interface cost\n"
4917 "Cost\n"
4918 "Address of interface")
4919
4920ALIAS (no_ip_ospf_cost2,
4921 no_ospf_cost_u32_inet4_cmd,
4922 "no ospf cost <1-65535> A.B.C.D",
4923 NO_STR
4924 "OSPF interface commands\n"
4925 "Interface cost\n"
4926 "Cost\n"
4927 "Address of interface")
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04004928
paul4dadc292005-05-06 21:37:42 +00004929static void
paul718e3742002-12-13 20:15:29 +00004930ospf_nbr_timer_update (struct ospf_interface *oi)
4931{
4932 struct route_node *rn;
4933 struct ospf_neighbor *nbr;
4934
4935 for (rn = route_top (oi->nbrs); rn; rn = route_next (rn))
4936 if ((nbr = rn->info))
4937 {
4938 nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait);
4939 nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval);
4940 nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval);
4941 nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval);
4942 }
4943}
4944
paulf9ad9372005-10-21 00:45:17 +00004945static int
4946ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str,
4947 const char *nbr_str,
4948 const char *fast_hello_str)
paul718e3742002-12-13 20:15:29 +00004949{
4950 struct interface *ifp = vty->index;
4951 u_int32_t seconds;
paulf9ad9372005-10-21 00:45:17 +00004952 u_char hellomult;
paul718e3742002-12-13 20:15:29 +00004953 struct in_addr addr;
4954 int ret;
4955 struct ospf_if_params *params;
4956 struct ospf_interface *oi;
4957 struct route_node *rn;
4958
4959 params = IF_DEF_PARAMS (ifp);
paulf9ad9372005-10-21 00:45:17 +00004960
4961 if (nbr_str)
paul718e3742002-12-13 20:15:29 +00004962 {
paulf9ad9372005-10-21 00:45:17 +00004963 ret = inet_aton(nbr_str, &addr);
paul718e3742002-12-13 20:15:29 +00004964 if (!ret)
4965 {
4966 vty_out (vty, "Please specify interface address by A.B.C.D%s",
4967 VTY_NEWLINE);
4968 return CMD_WARNING;
4969 }
4970
4971 params = ospf_get_if_params (ifp, addr);
4972 ospf_if_update_params (ifp, addr);
4973 }
4974
paulf9ad9372005-10-21 00:45:17 +00004975 if (interval_str)
4976 {
4977 VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str,
4978 1, 65535);
4979
4980 /* reset fast_hello too, just to be sure */
4981 UNSET_IF_PARAM (params, fast_hello);
4982 params->fast_hello = OSPF_FAST_HELLO_DEFAULT;
4983 }
4984 else if (fast_hello_str)
4985 {
4986 VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str,
4987 1, 10);
4988 /* 1s dead-interval with sub-second hellos desired */
4989 seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL;
4990 SET_IF_PARAM (params, fast_hello);
4991 params->fast_hello = hellomult;
4992 }
4993 else
4994 {
4995 vty_out (vty, "Please specify dead-interval or hello-multiplier%s",
4996 VTY_NEWLINE);
4997 return CMD_WARNING;
4998 }
4999
paul718e3742002-12-13 20:15:29 +00005000 SET_IF_PARAM (params, v_wait);
5001 params->v_wait = seconds;
5002
5003 /* Update timer values in neighbor structure. */
paulf9ad9372005-10-21 00:45:17 +00005004 if (nbr_str)
paul718e3742002-12-13 20:15:29 +00005005 {
Paul Jakmacac3b5c2006-05-11 13:31:11 +00005006 struct ospf *ospf;
5007 if ((ospf = ospf_lookup()))
paul68980082003-03-25 05:07:42 +00005008 {
5009 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
5010 if (oi)
5011 ospf_nbr_timer_update (oi);
5012 }
paul718e3742002-12-13 20:15:29 +00005013 }
5014 else
5015 {
5016 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5017 if ((oi = rn->info))
5018 ospf_nbr_timer_update (oi);
5019 }
5020
5021 return CMD_SUCCESS;
5022}
5023
paulf9ad9372005-10-21 00:45:17 +00005024
5025DEFUN (ip_ospf_dead_interval,
5026 ip_ospf_dead_interval_addr_cmd,
5027 "ip ospf dead-interval <1-65535> A.B.C.D",
5028 "IP Information\n"
5029 "OSPF interface commands\n"
5030 "Interval after which a neighbor is declared dead\n"
5031 "Seconds\n"
5032 "Address of interface\n")
5033{
5034 if (argc == 2)
5035 return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL);
5036 else
5037 return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL);
5038}
5039
paul718e3742002-12-13 20:15:29 +00005040ALIAS (ip_ospf_dead_interval,
5041 ip_ospf_dead_interval_cmd,
5042 "ip ospf dead-interval <1-65535>",
5043 "IP Information\n"
5044 "OSPF interface commands\n"
5045 "Interval after which a neighbor is declared dead\n"
5046 "Seconds\n")
5047
5048ALIAS (ip_ospf_dead_interval,
5049 ospf_dead_interval_cmd,
5050 "ospf dead-interval <1-65535>",
5051 "OSPF interface commands\n"
5052 "Interval after which a neighbor is declared dead\n"
5053 "Seconds\n")
5054
paulf9ad9372005-10-21 00:45:17 +00005055DEFUN (ip_ospf_dead_interval_minimal,
5056 ip_ospf_dead_interval_minimal_addr_cmd,
5057 "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D",
5058 "IP Information\n"
5059 "OSPF interface commands\n"
5060 "Interval after which a neighbor is declared dead\n"
5061 "Minimal 1s dead-interval with fast sub-second hellos\n"
5062 "Hello multiplier factor\n"
5063 "Number of Hellos to send each second\n"
5064 "Address of interface\n")
5065{
5066 if (argc == 2)
5067 return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]);
5068 else
5069 return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]);
5070}
5071
5072ALIAS (ip_ospf_dead_interval_minimal,
5073 ip_ospf_dead_interval_minimal_cmd,
5074 "ip ospf dead-interval minimal hello-multiplier <1-10>",
5075 "IP Information\n"
5076 "OSPF interface commands\n"
5077 "Interval after which a neighbor is declared dead\n"
5078 "Minimal 1s dead-interval with fast sub-second hellos\n"
5079 "Hello multiplier factor\n"
5080 "Number of Hellos to send each second\n")
5081
paul718e3742002-12-13 20:15:29 +00005082DEFUN (no_ip_ospf_dead_interval,
5083 no_ip_ospf_dead_interval_addr_cmd,
5084 "no ip ospf dead-interval A.B.C.D",
5085 NO_STR
5086 "IP Information\n"
5087 "OSPF interface commands\n"
5088 "Interval after which a neighbor is declared dead\n"
5089 "Address of interface")
5090{
5091 struct interface *ifp = vty->index;
5092 struct in_addr addr;
5093 int ret;
5094 struct ospf_if_params *params;
5095 struct ospf_interface *oi;
5096 struct route_node *rn;
paul020709f2003-04-04 02:44:16 +00005097
paul718e3742002-12-13 20:15:29 +00005098 ifp = vty->index;
5099 params = IF_DEF_PARAMS (ifp);
5100
5101 if (argc == 1)
5102 {
5103 ret = inet_aton(argv[0], &addr);
5104 if (!ret)
5105 {
5106 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5107 VTY_NEWLINE);
5108 return CMD_WARNING;
5109 }
5110
5111 params = ospf_lookup_if_params (ifp, addr);
5112 if (params == NULL)
5113 return CMD_SUCCESS;
5114 }
5115
5116 UNSET_IF_PARAM (params, v_wait);
5117 params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT;
paulf9ad9372005-10-21 00:45:17 +00005118
5119 UNSET_IF_PARAM (params, fast_hello);
5120 params->fast_hello = OSPF_FAST_HELLO_DEFAULT;
5121
paul718e3742002-12-13 20:15:29 +00005122 if (params != IF_DEF_PARAMS (ifp))
5123 {
5124 ospf_free_if_params (ifp, addr);
5125 ospf_if_update_params (ifp, addr);
5126 }
5127
5128 /* Update timer values in neighbor structure. */
5129 if (argc == 1)
5130 {
Paul Jakmacac3b5c2006-05-11 13:31:11 +00005131 struct ospf *ospf;
5132
5133 if ((ospf = ospf_lookup()))
paul68980082003-03-25 05:07:42 +00005134 {
5135 oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr);
5136 if (oi)
5137 ospf_nbr_timer_update (oi);
5138 }
paul718e3742002-12-13 20:15:29 +00005139 }
5140 else
5141 {
5142 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5143 if ((oi = rn->info))
5144 ospf_nbr_timer_update (oi);
5145 }
5146
5147 return CMD_SUCCESS;
5148}
5149
5150ALIAS (no_ip_ospf_dead_interval,
5151 no_ip_ospf_dead_interval_cmd,
5152 "no ip ospf dead-interval",
5153 NO_STR
5154 "IP Information\n"
5155 "OSPF interface commands\n"
5156 "Interval after which a neighbor is declared dead\n")
5157
5158ALIAS (no_ip_ospf_dead_interval,
5159 no_ospf_dead_interval_cmd,
5160 "no ospf dead-interval",
5161 NO_STR
5162 "OSPF interface commands\n"
5163 "Interval after which a neighbor is declared dead\n")
5164
5165DEFUN (ip_ospf_hello_interval,
5166 ip_ospf_hello_interval_addr_cmd,
5167 "ip ospf hello-interval <1-65535> A.B.C.D",
5168 "IP Information\n"
5169 "OSPF interface commands\n"
5170 "Time between HELLO packets\n"
5171 "Seconds\n"
5172 "Address of interface")
5173{
5174 struct interface *ifp = vty->index;
5175 u_int32_t seconds;
5176 struct in_addr addr;
5177 int ret;
5178 struct ospf_if_params *params;
5179
5180 params = IF_DEF_PARAMS (ifp);
5181
5182 seconds = strtol (argv[0], NULL, 10);
5183
5184 /* HelloInterval range is <1-65535>. */
5185 if (seconds < 1 || seconds > 65535)
5186 {
5187 vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE);
5188 return CMD_WARNING;
5189 }
5190
5191 if (argc == 2)
5192 {
5193 ret = inet_aton(argv[1], &addr);
5194 if (!ret)
5195 {
5196 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5197 VTY_NEWLINE);
5198 return CMD_WARNING;
5199 }
5200
5201 params = ospf_get_if_params (ifp, addr);
5202 ospf_if_update_params (ifp, addr);
5203 }
5204
paulf9ad9372005-10-21 00:45:17 +00005205 SET_IF_PARAM (params, v_hello);
paul718e3742002-12-13 20:15:29 +00005206 params->v_hello = seconds;
5207
5208 return CMD_SUCCESS;
5209}
5210
5211ALIAS (ip_ospf_hello_interval,
5212 ip_ospf_hello_interval_cmd,
5213 "ip ospf hello-interval <1-65535>",
5214 "IP Information\n"
5215 "OSPF interface commands\n"
5216 "Time between HELLO packets\n"
5217 "Seconds\n")
5218
5219ALIAS (ip_ospf_hello_interval,
5220 ospf_hello_interval_cmd,
5221 "ospf hello-interval <1-65535>",
5222 "OSPF interface commands\n"
5223 "Time between HELLO packets\n"
5224 "Seconds\n")
5225
5226DEFUN (no_ip_ospf_hello_interval,
5227 no_ip_ospf_hello_interval_addr_cmd,
5228 "no ip ospf hello-interval A.B.C.D",
5229 NO_STR
5230 "IP Information\n"
5231 "OSPF interface commands\n"
5232 "Time between HELLO packets\n"
5233 "Address of interface")
5234{
5235 struct interface *ifp = vty->index;
5236 struct in_addr addr;
5237 int ret;
5238 struct ospf_if_params *params;
5239
5240 ifp = vty->index;
5241 params = IF_DEF_PARAMS (ifp);
5242
5243 if (argc == 1)
5244 {
5245 ret = inet_aton(argv[0], &addr);
5246 if (!ret)
5247 {
5248 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5249 VTY_NEWLINE);
5250 return CMD_WARNING;
5251 }
5252
5253 params = ospf_lookup_if_params (ifp, addr);
5254 if (params == NULL)
5255 return CMD_SUCCESS;
5256 }
5257
5258 UNSET_IF_PARAM (params, v_hello);
paulf9ad9372005-10-21 00:45:17 +00005259 params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT;
paul718e3742002-12-13 20:15:29 +00005260
5261 if (params != IF_DEF_PARAMS (ifp))
5262 {
5263 ospf_free_if_params (ifp, addr);
5264 ospf_if_update_params (ifp, addr);
5265 }
5266
5267 return CMD_SUCCESS;
5268}
5269
5270ALIAS (no_ip_ospf_hello_interval,
5271 no_ip_ospf_hello_interval_cmd,
5272 "no ip ospf hello-interval",
5273 NO_STR
5274 "IP Information\n"
5275 "OSPF interface commands\n"
5276 "Time between HELLO packets\n")
5277
5278ALIAS (no_ip_ospf_hello_interval,
5279 no_ospf_hello_interval_cmd,
5280 "no ospf hello-interval",
5281 NO_STR
5282 "OSPF interface commands\n"
5283 "Time between HELLO packets\n")
5284
5285DEFUN (ip_ospf_network,
5286 ip_ospf_network_cmd,
5287 "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
5288 "IP Information\n"
5289 "OSPF interface commands\n"
5290 "Network type\n"
5291 "Specify OSPF broadcast multi-access network\n"
5292 "Specify OSPF NBMA network\n"
5293 "Specify OSPF point-to-multipoint network\n"
5294 "Specify OSPF point-to-point network\n")
5295{
5296 struct interface *ifp = vty->index;
5297 int old_type = IF_DEF_PARAMS (ifp)->type;
5298 struct route_node *rn;
5299
5300 if (strncmp (argv[0], "b", 1) == 0)
5301 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST;
5302 else if (strncmp (argv[0], "n", 1) == 0)
5303 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA;
5304 else if (strncmp (argv[0], "point-to-m", 10) == 0)
5305 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT;
5306 else if (strncmp (argv[0], "point-to-p", 10) == 0)
5307 IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT;
5308
5309 if (IF_DEF_PARAMS (ifp)->type == old_type)
5310 return CMD_SUCCESS;
5311
5312 SET_IF_PARAM (IF_DEF_PARAMS (ifp), type);
5313
5314 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5315 {
5316 struct ospf_interface *oi = rn->info;
5317
5318 if (!oi)
5319 continue;
5320
5321 oi->type = IF_DEF_PARAMS (ifp)->type;
5322
5323 if (oi->state > ISM_Down)
5324 {
5325 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
5326 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
5327 }
5328 }
5329
5330 return CMD_SUCCESS;
5331}
5332
5333ALIAS (ip_ospf_network,
5334 ospf_network_cmd,
5335 "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)",
5336 "OSPF interface commands\n"
5337 "Network type\n"
5338 "Specify OSPF broadcast multi-access network\n"
5339 "Specify OSPF NBMA network\n"
5340 "Specify OSPF point-to-multipoint network\n"
5341 "Specify OSPF point-to-point network\n")
5342
5343DEFUN (no_ip_ospf_network,
5344 no_ip_ospf_network_cmd,
5345 "no ip ospf network",
5346 NO_STR
5347 "IP Information\n"
5348 "OSPF interface commands\n"
5349 "Network type\n")
5350{
5351 struct interface *ifp = vty->index;
5352 int old_type = IF_DEF_PARAMS (ifp)->type;
5353 struct route_node *rn;
5354
ajsbc18d612004-12-15 15:07:19 +00005355 IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp);
paul718e3742002-12-13 20:15:29 +00005356
5357 if (IF_DEF_PARAMS (ifp)->type == old_type)
5358 return CMD_SUCCESS;
5359
5360 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5361 {
5362 struct ospf_interface *oi = rn->info;
5363
5364 if (!oi)
5365 continue;
5366
5367 oi->type = IF_DEF_PARAMS (ifp)->type;
5368
5369 if (oi->state > ISM_Down)
5370 {
5371 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown);
5372 OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp);
5373 }
5374 }
5375
5376 return CMD_SUCCESS;
5377}
5378
5379ALIAS (no_ip_ospf_network,
5380 no_ospf_network_cmd,
5381 "no ospf network",
5382 NO_STR
5383 "OSPF interface commands\n"
5384 "Network type\n")
5385
5386DEFUN (ip_ospf_priority,
5387 ip_ospf_priority_addr_cmd,
5388 "ip ospf priority <0-255> A.B.C.D",
5389 "IP Information\n"
5390 "OSPF interface commands\n"
5391 "Router priority\n"
5392 "Priority\n"
5393 "Address of interface")
5394{
5395 struct interface *ifp = vty->index;
5396 u_int32_t priority;
5397 struct route_node *rn;
5398 struct in_addr addr;
5399 int ret;
5400 struct ospf_if_params *params;
5401
5402 params = IF_DEF_PARAMS (ifp);
5403
5404 priority = strtol (argv[0], NULL, 10);
5405
5406 /* Router Priority range is <0-255>. */
5407 if (priority < 0 || priority > 255)
5408 {
5409 vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE);
5410 return CMD_WARNING;
5411 }
5412
5413 if (argc == 2)
5414 {
5415 ret = inet_aton(argv[1], &addr);
5416 if (!ret)
5417 {
5418 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5419 VTY_NEWLINE);
5420 return CMD_WARNING;
5421 }
5422
5423 params = ospf_get_if_params (ifp, addr);
5424 ospf_if_update_params (ifp, addr);
5425 }
5426
5427 SET_IF_PARAM (params, priority);
5428 params->priority = priority;
5429
5430 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5431 {
5432 struct ospf_interface *oi = rn->info;
5433
5434 if (!oi)
5435 continue;
5436
5437
5438 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
5439 {
5440 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
5441 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
5442 }
5443 }
5444
5445 return CMD_SUCCESS;
5446}
5447
5448ALIAS (ip_ospf_priority,
5449 ip_ospf_priority_cmd,
5450 "ip ospf priority <0-255>",
5451 "IP Information\n"
5452 "OSPF interface commands\n"
5453 "Router priority\n"
5454 "Priority\n")
5455
5456ALIAS (ip_ospf_priority,
5457 ospf_priority_cmd,
5458 "ospf priority <0-255>",
5459 "OSPF interface commands\n"
5460 "Router priority\n"
5461 "Priority\n")
5462
5463DEFUN (no_ip_ospf_priority,
5464 no_ip_ospf_priority_addr_cmd,
5465 "no ip ospf priority A.B.C.D",
5466 NO_STR
5467 "IP Information\n"
5468 "OSPF interface commands\n"
5469 "Router priority\n"
5470 "Address of interface")
5471{
5472 struct interface *ifp = vty->index;
5473 struct route_node *rn;
5474 struct in_addr addr;
5475 int ret;
5476 struct ospf_if_params *params;
5477
5478 ifp = vty->index;
5479 params = IF_DEF_PARAMS (ifp);
5480
5481 if (argc == 1)
5482 {
5483 ret = inet_aton(argv[0], &addr);
5484 if (!ret)
5485 {
5486 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5487 VTY_NEWLINE);
5488 return CMD_WARNING;
5489 }
5490
5491 params = ospf_lookup_if_params (ifp, addr);
5492 if (params == NULL)
5493 return CMD_SUCCESS;
5494 }
5495
5496 UNSET_IF_PARAM (params, priority);
5497 params->priority = OSPF_ROUTER_PRIORITY_DEFAULT;
5498
5499 if (params != IF_DEF_PARAMS (ifp))
5500 {
5501 ospf_free_if_params (ifp, addr);
5502 ospf_if_update_params (ifp, addr);
5503 }
5504
5505 for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn))
5506 {
5507 struct ospf_interface *oi = rn->info;
5508
5509 if (!oi)
5510 continue;
5511
5512
5513 if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority))
5514 {
5515 PRIORITY (oi) = OSPF_IF_PARAM (oi, priority);
5516 OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange);
5517 }
5518 }
5519
5520 return CMD_SUCCESS;
5521}
5522
5523ALIAS (no_ip_ospf_priority,
5524 no_ip_ospf_priority_cmd,
5525 "no ip ospf priority",
5526 NO_STR
5527 "IP Information\n"
5528 "OSPF interface commands\n"
5529 "Router priority\n")
5530
5531ALIAS (no_ip_ospf_priority,
5532 no_ospf_priority_cmd,
5533 "no ospf priority",
5534 NO_STR
5535 "OSPF interface commands\n"
5536 "Router priority\n")
5537
5538DEFUN (ip_ospf_retransmit_interval,
5539 ip_ospf_retransmit_interval_addr_cmd,
5540 "ip ospf retransmit-interval <3-65535> A.B.C.D",
5541 "IP Information\n"
5542 "OSPF interface commands\n"
5543 "Time between retransmitting lost link state advertisements\n"
5544 "Seconds\n"
5545 "Address of interface")
5546{
5547 struct interface *ifp = vty->index;
5548 u_int32_t seconds;
5549 struct in_addr addr;
5550 int ret;
5551 struct ospf_if_params *params;
5552
5553 params = IF_DEF_PARAMS (ifp);
5554 seconds = strtol (argv[0], NULL, 10);
5555
5556 /* Retransmit Interval range is <3-65535>. */
5557 if (seconds < 3 || seconds > 65535)
5558 {
5559 vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE);
5560 return CMD_WARNING;
5561 }
5562
5563
5564 if (argc == 2)
5565 {
5566 ret = inet_aton(argv[1], &addr);
5567 if (!ret)
5568 {
5569 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5570 VTY_NEWLINE);
5571 return CMD_WARNING;
5572 }
5573
5574 params = ospf_get_if_params (ifp, addr);
5575 ospf_if_update_params (ifp, addr);
5576 }
5577
5578 SET_IF_PARAM (params, retransmit_interval);
5579 params->retransmit_interval = seconds;
5580
5581 return CMD_SUCCESS;
5582}
5583
5584ALIAS (ip_ospf_retransmit_interval,
5585 ip_ospf_retransmit_interval_cmd,
5586 "ip ospf retransmit-interval <3-65535>",
5587 "IP Information\n"
5588 "OSPF interface commands\n"
5589 "Time between retransmitting lost link state advertisements\n"
5590 "Seconds\n")
5591
5592ALIAS (ip_ospf_retransmit_interval,
5593 ospf_retransmit_interval_cmd,
5594 "ospf retransmit-interval <3-65535>",
5595 "OSPF interface commands\n"
5596 "Time between retransmitting lost link state advertisements\n"
5597 "Seconds\n")
5598
5599DEFUN (no_ip_ospf_retransmit_interval,
5600 no_ip_ospf_retransmit_interval_addr_cmd,
5601 "no ip ospf retransmit-interval A.B.C.D",
5602 NO_STR
5603 "IP Information\n"
5604 "OSPF interface commands\n"
5605 "Time between retransmitting lost link state advertisements\n"
5606 "Address of interface")
5607{
5608 struct interface *ifp = vty->index;
5609 struct in_addr addr;
5610 int ret;
5611 struct ospf_if_params *params;
5612
5613 ifp = vty->index;
5614 params = IF_DEF_PARAMS (ifp);
5615
5616 if (argc == 1)
5617 {
5618 ret = inet_aton(argv[0], &addr);
5619 if (!ret)
5620 {
5621 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5622 VTY_NEWLINE);
5623 return CMD_WARNING;
5624 }
5625
5626 params = ospf_lookup_if_params (ifp, addr);
5627 if (params == NULL)
5628 return CMD_SUCCESS;
5629 }
5630
5631 UNSET_IF_PARAM (params, retransmit_interval);
5632 params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT;
5633
5634 if (params != IF_DEF_PARAMS (ifp))
5635 {
5636 ospf_free_if_params (ifp, addr);
5637 ospf_if_update_params (ifp, addr);
5638 }
5639
5640 return CMD_SUCCESS;
5641}
5642
5643ALIAS (no_ip_ospf_retransmit_interval,
5644 no_ip_ospf_retransmit_interval_cmd,
5645 "no ip ospf retransmit-interval",
5646 NO_STR
5647 "IP Information\n"
5648 "OSPF interface commands\n"
5649 "Time between retransmitting lost link state advertisements\n")
5650
5651ALIAS (no_ip_ospf_retransmit_interval,
5652 no_ospf_retransmit_interval_cmd,
5653 "no ospf retransmit-interval",
5654 NO_STR
5655 "OSPF interface commands\n"
5656 "Time between retransmitting lost link state advertisements\n")
5657
5658DEFUN (ip_ospf_transmit_delay,
5659 ip_ospf_transmit_delay_addr_cmd,
5660 "ip ospf transmit-delay <1-65535> A.B.C.D",
5661 "IP Information\n"
5662 "OSPF interface commands\n"
5663 "Link state transmit delay\n"
5664 "Seconds\n"
5665 "Address of interface")
5666{
5667 struct interface *ifp = vty->index;
5668 u_int32_t seconds;
5669 struct in_addr addr;
5670 int ret;
5671 struct ospf_if_params *params;
5672
5673 params = IF_DEF_PARAMS (ifp);
5674 seconds = strtol (argv[0], NULL, 10);
5675
5676 /* Transmit Delay range is <1-65535>. */
5677 if (seconds < 1 || seconds > 65535)
5678 {
5679 vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE);
5680 return CMD_WARNING;
5681 }
5682
5683 if (argc == 2)
5684 {
5685 ret = inet_aton(argv[1], &addr);
5686 if (!ret)
5687 {
5688 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5689 VTY_NEWLINE);
5690 return CMD_WARNING;
5691 }
5692
5693 params = ospf_get_if_params (ifp, addr);
5694 ospf_if_update_params (ifp, addr);
5695 }
5696
5697 SET_IF_PARAM (params, transmit_delay);
5698 params->transmit_delay = seconds;
5699
5700 return CMD_SUCCESS;
5701}
5702
5703ALIAS (ip_ospf_transmit_delay,
5704 ip_ospf_transmit_delay_cmd,
5705 "ip ospf transmit-delay <1-65535>",
5706 "IP Information\n"
5707 "OSPF interface commands\n"
5708 "Link state transmit delay\n"
5709 "Seconds\n")
5710
5711ALIAS (ip_ospf_transmit_delay,
5712 ospf_transmit_delay_cmd,
5713 "ospf transmit-delay <1-65535>",
5714 "OSPF interface commands\n"
5715 "Link state transmit delay\n"
5716 "Seconds\n")
5717
5718DEFUN (no_ip_ospf_transmit_delay,
5719 no_ip_ospf_transmit_delay_addr_cmd,
5720 "no ip ospf transmit-delay A.B.C.D",
5721 NO_STR
5722 "IP Information\n"
5723 "OSPF interface commands\n"
5724 "Link state transmit delay\n"
5725 "Address of interface")
5726{
5727 struct interface *ifp = vty->index;
5728 struct in_addr addr;
5729 int ret;
5730 struct ospf_if_params *params;
5731
5732 ifp = vty->index;
5733 params = IF_DEF_PARAMS (ifp);
5734
5735 if (argc == 1)
5736 {
5737 ret = inet_aton(argv[0], &addr);
5738 if (!ret)
5739 {
5740 vty_out (vty, "Please specify interface address by A.B.C.D%s",
5741 VTY_NEWLINE);
5742 return CMD_WARNING;
5743 }
5744
5745 params = ospf_lookup_if_params (ifp, addr);
5746 if (params == NULL)
5747 return CMD_SUCCESS;
5748 }
5749
5750 UNSET_IF_PARAM (params, transmit_delay);
5751 params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT;
5752
5753 if (params != IF_DEF_PARAMS (ifp))
5754 {
5755 ospf_free_if_params (ifp, addr);
5756 ospf_if_update_params (ifp, addr);
5757 }
5758
5759 return CMD_SUCCESS;
5760}
5761
5762ALIAS (no_ip_ospf_transmit_delay,
5763 no_ip_ospf_transmit_delay_cmd,
5764 "no ip ospf transmit-delay",
5765 NO_STR
5766 "IP Information\n"
5767 "OSPF interface commands\n"
5768 "Link state transmit delay\n")
5769
5770ALIAS (no_ip_ospf_transmit_delay,
5771 no_ospf_transmit_delay_cmd,
5772 "no ospf transmit-delay",
5773 NO_STR
5774 "OSPF interface commands\n"
5775 "Link state transmit delay\n")
5776
5777
5778DEFUN (ospf_redistribute_source_metric_type,
5779 ospf_redistribute_source_metric_type_routemap_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005780 "redistribute " QUAGGA_REDIST_STR_OSPFD
5781 " metric <0-16777214> metric-type (1|2) route-map WORD",
5782 REDIST_STR
5783 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005784 "Metric for redistributed routes\n"
5785 "OSPF default metric\n"
5786 "OSPF exterior metric type for redistributed routes\n"
5787 "Set OSPF External Type 1 metrics\n"
5788 "Set OSPF External Type 2 metrics\n"
5789 "Route map reference\n"
5790 "Pointer to route-map entries\n")
5791{
paul020709f2003-04-04 02:44:16 +00005792 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005793 int source;
5794 int type = -1;
5795 int metric = -1;
5796
5797 /* Get distribute source. */
David Lamparterdaca2cf2009-09-16 01:52:42 +02005798 source = proto_redistnum(AFI_IP, argv[0]);
5799 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00005800 return CMD_WARNING;
5801
5802 /* Get metric value. */
5803 if (argc >= 2)
5804 if (!str2metric (argv[1], &metric))
5805 return CMD_WARNING;
5806
5807 /* Get metric type. */
5808 if (argc >= 3)
5809 if (!str2metric_type (argv[2], &type))
5810 return CMD_WARNING;
5811
5812 if (argc == 4)
paul020709f2003-04-04 02:44:16 +00005813 ospf_routemap_set (ospf, source, argv[3]);
paul718e3742002-12-13 20:15:29 +00005814 else
paul020709f2003-04-04 02:44:16 +00005815 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005816
paul020709f2003-04-04 02:44:16 +00005817 return ospf_redistribute_set (ospf, source, type, metric);
paul718e3742002-12-13 20:15:29 +00005818}
5819
5820ALIAS (ospf_redistribute_source_metric_type,
5821 ospf_redistribute_source_metric_type_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005822 "redistribute " QUAGGA_REDIST_STR_OSPFD
5823 " metric <0-16777214> metric-type (1|2)",
5824 REDIST_STR
5825 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005826 "Metric for redistributed routes\n"
5827 "OSPF default metric\n"
5828 "OSPF exterior metric type for redistributed routes\n"
5829 "Set OSPF External Type 1 metrics\n"
5830 "Set OSPF External Type 2 metrics\n")
5831
5832ALIAS (ospf_redistribute_source_metric_type,
5833 ospf_redistribute_source_metric_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005834 "redistribute " QUAGGA_REDIST_STR_OSPFD " metric <0-16777214>",
5835 REDIST_STR
5836 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005837 "Metric for redistributed routes\n"
5838 "OSPF default metric\n")
5839
5840DEFUN (ospf_redistribute_source_type_metric,
5841 ospf_redistribute_source_type_metric_routemap_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005842 "redistribute " QUAGGA_REDIST_STR_OSPFD
5843 " metric-type (1|2) metric <0-16777214> route-map WORD",
5844 REDIST_STR
5845 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005846 "OSPF exterior metric type for redistributed routes\n"
5847 "Set OSPF External Type 1 metrics\n"
5848 "Set OSPF External Type 2 metrics\n"
5849 "Metric for redistributed routes\n"
5850 "OSPF default metric\n"
5851 "Route map reference\n"
5852 "Pointer to route-map entries\n")
5853{
paul020709f2003-04-04 02:44:16 +00005854 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005855 int source;
5856 int type = -1;
5857 int metric = -1;
5858
5859 /* Get distribute source. */
David Lamparterdaca2cf2009-09-16 01:52:42 +02005860 source = proto_redistnum(AFI_IP, argv[0]);
5861 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00005862 return CMD_WARNING;
5863
5864 /* Get metric value. */
5865 if (argc >= 2)
5866 if (!str2metric_type (argv[1], &type))
5867 return CMD_WARNING;
5868
5869 /* Get metric type. */
5870 if (argc >= 3)
5871 if (!str2metric (argv[2], &metric))
5872 return CMD_WARNING;
5873
5874 if (argc == 4)
paul020709f2003-04-04 02:44:16 +00005875 ospf_routemap_set (ospf, source, argv[3]);
paul718e3742002-12-13 20:15:29 +00005876 else
paul020709f2003-04-04 02:44:16 +00005877 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005878
paul020709f2003-04-04 02:44:16 +00005879 return ospf_redistribute_set (ospf, source, type, metric);
paul718e3742002-12-13 20:15:29 +00005880}
5881
5882ALIAS (ospf_redistribute_source_type_metric,
5883 ospf_redistribute_source_type_metric_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005884 "redistribute " QUAGGA_REDIST_STR_OSPFD
5885 " metric-type (1|2) metric <0-16777214>",
5886 REDIST_STR
5887 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005888 "OSPF exterior metric type for redistributed routes\n"
5889 "Set OSPF External Type 1 metrics\n"
5890 "Set OSPF External Type 2 metrics\n"
5891 "Metric for redistributed routes\n"
5892 "OSPF default metric\n")
5893
5894ALIAS (ospf_redistribute_source_type_metric,
5895 ospf_redistribute_source_type_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005896 "redistribute " QUAGGA_REDIST_STR_OSPFD " metric-type (1|2)",
5897 REDIST_STR
5898 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005899 "OSPF exterior metric type for redistributed routes\n"
5900 "Set OSPF External Type 1 metrics\n"
5901 "Set OSPF External Type 2 metrics\n")
5902
5903ALIAS (ospf_redistribute_source_type_metric,
5904 ospf_redistribute_source_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005905 "redistribute " QUAGGA_REDIST_STR_OSPFD,
5906 REDIST_STR
5907 QUAGGA_REDIST_HELP_STR_OSPFD)
paul718e3742002-12-13 20:15:29 +00005908
5909DEFUN (ospf_redistribute_source_metric_routemap,
5910 ospf_redistribute_source_metric_routemap_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005911 "redistribute " QUAGGA_REDIST_STR_OSPFD
5912 " metric <0-16777214> route-map WORD",
5913 REDIST_STR
5914 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005915 "Metric for redistributed routes\n"
5916 "OSPF default metric\n"
5917 "Route map reference\n"
5918 "Pointer to route-map entries\n")
5919{
paul020709f2003-04-04 02:44:16 +00005920 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005921 int source;
5922 int metric = -1;
5923
5924 /* Get distribute source. */
David Lamparterdaca2cf2009-09-16 01:52:42 +02005925 source = proto_redistnum(AFI_IP, argv[0]);
5926 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00005927 return CMD_WARNING;
5928
5929 /* Get metric value. */
5930 if (argc >= 2)
5931 if (!str2metric (argv[1], &metric))
5932 return CMD_WARNING;
5933
5934 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005935 ospf_routemap_set (ospf, source, argv[2]);
paul718e3742002-12-13 20:15:29 +00005936 else
paul020709f2003-04-04 02:44:16 +00005937 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005938
paul020709f2003-04-04 02:44:16 +00005939 return ospf_redistribute_set (ospf, source, -1, metric);
paul718e3742002-12-13 20:15:29 +00005940}
5941
5942DEFUN (ospf_redistribute_source_type_routemap,
5943 ospf_redistribute_source_type_routemap_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005944 "redistribute " QUAGGA_REDIST_STR_OSPFD
5945 " metric-type (1|2) route-map WORD",
5946 REDIST_STR
5947 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005948 "OSPF exterior metric type for redistributed routes\n"
5949 "Set OSPF External Type 1 metrics\n"
5950 "Set OSPF External Type 2 metrics\n"
5951 "Route map reference\n"
5952 "Pointer to route-map entries\n")
5953{
paul020709f2003-04-04 02:44:16 +00005954 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005955 int source;
5956 int type = -1;
5957
5958 /* Get distribute source. */
David Lamparterdaca2cf2009-09-16 01:52:42 +02005959 source = proto_redistnum(AFI_IP, argv[0]);
5960 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00005961 return CMD_WARNING;
5962
5963 /* Get metric value. */
5964 if (argc >= 2)
5965 if (!str2metric_type (argv[1], &type))
5966 return CMD_WARNING;
5967
5968 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00005969 ospf_routemap_set (ospf, source, argv[2]);
paul718e3742002-12-13 20:15:29 +00005970 else
paul020709f2003-04-04 02:44:16 +00005971 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005972
paul020709f2003-04-04 02:44:16 +00005973 return ospf_redistribute_set (ospf, source, type, -1);
paul718e3742002-12-13 20:15:29 +00005974}
5975
5976DEFUN (ospf_redistribute_source_routemap,
5977 ospf_redistribute_source_routemap_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00005978 "redistribute " QUAGGA_REDIST_STR_OSPFD " route-map WORD",
5979 REDIST_STR
5980 QUAGGA_REDIST_HELP_STR_OSPFD
paul718e3742002-12-13 20:15:29 +00005981 "Route map reference\n"
5982 "Pointer to route-map entries\n")
5983{
paul020709f2003-04-04 02:44:16 +00005984 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00005985 int source;
5986
5987 /* Get distribute source. */
David Lamparterdaca2cf2009-09-16 01:52:42 +02005988 source = proto_redistnum(AFI_IP, argv[0]);
5989 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00005990 return CMD_WARNING;
5991
5992 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00005993 ospf_routemap_set (ospf, source, argv[1]);
paul718e3742002-12-13 20:15:29 +00005994 else
paul020709f2003-04-04 02:44:16 +00005995 ospf_routemap_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00005996
paul020709f2003-04-04 02:44:16 +00005997 return ospf_redistribute_set (ospf, source, -1, -1);
paul718e3742002-12-13 20:15:29 +00005998}
5999
6000DEFUN (no_ospf_redistribute_source,
6001 no_ospf_redistribute_source_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00006002 "no redistribute " QUAGGA_REDIST_STR_OSPFD,
paul718e3742002-12-13 20:15:29 +00006003 NO_STR
Paul Jakmad1c65c22006-06-27 08:01:43 +00006004 REDIST_STR
6005 QUAGGA_REDIST_HELP_STR_OSPFD)
paul718e3742002-12-13 20:15:29 +00006006{
paul020709f2003-04-04 02:44:16 +00006007 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006008 int source;
6009
David Lamparterdaca2cf2009-09-16 01:52:42 +02006010 source = proto_redistnum(AFI_IP, argv[0]);
6011 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00006012 return CMD_WARNING;
6013
paul020709f2003-04-04 02:44:16 +00006014 ospf_routemap_unset (ospf, source);
6015 return ospf_redistribute_unset (ospf, source);
paul718e3742002-12-13 20:15:29 +00006016}
6017
6018DEFUN (ospf_distribute_list_out,
6019 ospf_distribute_list_out_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00006020 "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD,
paul718e3742002-12-13 20:15:29 +00006021 "Filter networks in routing updates\n"
6022 "Access-list name\n"
6023 OUT_STR
Paul Jakmad1c65c22006-06-27 08:01:43 +00006024 QUAGGA_REDIST_HELP_STR_OSPFD)
paul718e3742002-12-13 20:15:29 +00006025{
paul68980082003-03-25 05:07:42 +00006026 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006027 int source;
6028
6029 /* Get distribute source. */
David Lamparterdaca2cf2009-09-16 01:52:42 +02006030 source = proto_redistnum(AFI_IP, argv[0]);
6031 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00006032 return CMD_WARNING;
6033
paul68980082003-03-25 05:07:42 +00006034 return ospf_distribute_list_out_set (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00006035}
6036
6037DEFUN (no_ospf_distribute_list_out,
6038 no_ospf_distribute_list_out_cmd,
Paul Jakmad1c65c22006-06-27 08:01:43 +00006039 "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD,
paul718e3742002-12-13 20:15:29 +00006040 NO_STR
6041 "Filter networks in routing updates\n"
6042 "Access-list name\n"
6043 OUT_STR
Paul Jakmad1c65c22006-06-27 08:01:43 +00006044 QUAGGA_REDIST_HELP_STR_OSPFD)
paul718e3742002-12-13 20:15:29 +00006045{
paul68980082003-03-25 05:07:42 +00006046 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006047 int source;
6048
David Lamparterdaca2cf2009-09-16 01:52:42 +02006049 source = proto_redistnum(AFI_IP, argv[0]);
6050 if (source < 0 || source == ZEBRA_ROUTE_OSPF)
paul718e3742002-12-13 20:15:29 +00006051 return CMD_WARNING;
6052
paul68980082003-03-25 05:07:42 +00006053 return ospf_distribute_list_out_unset (ospf, source, argv[0]);
paul718e3742002-12-13 20:15:29 +00006054}
6055
6056/* Default information originate. */
6057DEFUN (ospf_default_information_originate_metric_type_routemap,
6058 ospf_default_information_originate_metric_type_routemap_cmd,
6059 "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD",
6060 "Control distribution of default information\n"
6061 "Distribute a default route\n"
6062 "OSPF default metric\n"
6063 "OSPF metric\n"
6064 "OSPF metric type for default routes\n"
6065 "Set OSPF External Type 1 metrics\n"
6066 "Set OSPF External Type 2 metrics\n"
6067 "Route map reference\n"
6068 "Pointer to route-map entries\n")
6069{
paul020709f2003-04-04 02:44:16 +00006070 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006071 int type = -1;
6072 int metric = -1;
6073
6074 /* Get metric value. */
6075 if (argc >= 1)
6076 if (!str2metric (argv[0], &metric))
6077 return CMD_WARNING;
6078
6079 /* Get metric type. */
6080 if (argc >= 2)
6081 if (!str2metric_type (argv[1], &type))
6082 return CMD_WARNING;
6083
6084 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00006085 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00006086 else
paul020709f2003-04-04 02:44:16 +00006087 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006088
paul020709f2003-04-04 02:44:16 +00006089 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
6090 type, metric);
paul718e3742002-12-13 20:15:29 +00006091}
6092
6093ALIAS (ospf_default_information_originate_metric_type_routemap,
6094 ospf_default_information_originate_metric_type_cmd,
6095 "default-information originate metric <0-16777214> metric-type (1|2)",
6096 "Control distribution of default information\n"
6097 "Distribute a default route\n"
6098 "OSPF default metric\n"
6099 "OSPF metric\n"
6100 "OSPF metric type for default routes\n"
6101 "Set OSPF External Type 1 metrics\n"
6102 "Set OSPF External Type 2 metrics\n")
6103
6104ALIAS (ospf_default_information_originate_metric_type_routemap,
6105 ospf_default_information_originate_metric_cmd,
6106 "default-information originate metric <0-16777214>",
6107 "Control distribution of default information\n"
6108 "Distribute a default route\n"
6109 "OSPF default metric\n"
6110 "OSPF metric\n")
6111
6112ALIAS (ospf_default_information_originate_metric_type_routemap,
6113 ospf_default_information_originate_cmd,
6114 "default-information originate",
6115 "Control distribution of default information\n"
6116 "Distribute a default route\n")
6117
6118/* Default information originate. */
6119DEFUN (ospf_default_information_originate_metric_routemap,
6120 ospf_default_information_originate_metric_routemap_cmd,
6121 "default-information originate metric <0-16777214> route-map WORD",
6122 "Control distribution of default information\n"
6123 "Distribute a default route\n"
6124 "OSPF default metric\n"
6125 "OSPF metric\n"
6126 "Route map reference\n"
6127 "Pointer to route-map entries\n")
6128{
paul020709f2003-04-04 02:44:16 +00006129 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006130 int metric = -1;
6131
6132 /* Get metric value. */
6133 if (argc >= 1)
6134 if (!str2metric (argv[0], &metric))
6135 return CMD_WARNING;
6136
6137 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00006138 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00006139 else
paul020709f2003-04-04 02:44:16 +00006140 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006141
paul020709f2003-04-04 02:44:16 +00006142 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
6143 -1, metric);
paul718e3742002-12-13 20:15:29 +00006144}
6145
6146/* Default information originate. */
6147DEFUN (ospf_default_information_originate_routemap,
6148 ospf_default_information_originate_routemap_cmd,
6149 "default-information originate route-map WORD",
6150 "Control distribution of default information\n"
6151 "Distribute a default route\n"
6152 "Route map reference\n"
6153 "Pointer to route-map entries\n")
6154{
paul020709f2003-04-04 02:44:16 +00006155 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006156
paul020709f2003-04-04 02:44:16 +00006157 if (argc == 1)
6158 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
6159 else
6160 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
6161
6162 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1);
paul718e3742002-12-13 20:15:29 +00006163}
6164
6165DEFUN (ospf_default_information_originate_type_metric_routemap,
6166 ospf_default_information_originate_type_metric_routemap_cmd,
6167 "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD",
6168 "Control distribution of default information\n"
6169 "Distribute a default route\n"
6170 "OSPF metric type for default routes\n"
6171 "Set OSPF External Type 1 metrics\n"
6172 "Set OSPF External Type 2 metrics\n"
6173 "OSPF default metric\n"
6174 "OSPF metric\n"
6175 "Route map reference\n"
6176 "Pointer to route-map entries\n")
6177{
paul020709f2003-04-04 02:44:16 +00006178 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006179 int type = -1;
6180 int metric = -1;
6181
6182 /* Get metric type. */
6183 if (argc >= 1)
6184 if (!str2metric_type (argv[0], &type))
6185 return CMD_WARNING;
6186
6187 /* Get metric value. */
6188 if (argc >= 2)
6189 if (!str2metric (argv[1], &metric))
6190 return CMD_WARNING;
6191
6192 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00006193 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00006194 else
paul020709f2003-04-04 02:44:16 +00006195 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006196
paul020709f2003-04-04 02:44:16 +00006197 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
6198 type, metric);
paul718e3742002-12-13 20:15:29 +00006199}
6200
6201ALIAS (ospf_default_information_originate_type_metric_routemap,
6202 ospf_default_information_originate_type_metric_cmd,
6203 "default-information originate metric-type (1|2) metric <0-16777214>",
6204 "Control distribution of default information\n"
6205 "Distribute a default route\n"
6206 "OSPF metric type for default routes\n"
6207 "Set OSPF External Type 1 metrics\n"
6208 "Set OSPF External Type 2 metrics\n"
6209 "OSPF default metric\n"
6210 "OSPF metric\n")
6211
6212ALIAS (ospf_default_information_originate_type_metric_routemap,
6213 ospf_default_information_originate_type_cmd,
6214 "default-information originate metric-type (1|2)",
6215 "Control distribution of default information\n"
6216 "Distribute a default route\n"
6217 "OSPF metric type for default routes\n"
6218 "Set OSPF External Type 1 metrics\n"
6219 "Set OSPF External Type 2 metrics\n")
6220
6221DEFUN (ospf_default_information_originate_type_routemap,
6222 ospf_default_information_originate_type_routemap_cmd,
6223 "default-information originate metric-type (1|2) route-map WORD",
6224 "Control distribution of default information\n"
6225 "Distribute a default route\n"
6226 "OSPF metric type for default routes\n"
6227 "Set OSPF External Type 1 metrics\n"
6228 "Set OSPF External Type 2 metrics\n"
6229 "Route map reference\n"
6230 "Pointer to route-map entries\n")
6231{
paul020709f2003-04-04 02:44:16 +00006232 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006233 int type = -1;
6234
6235 /* Get metric type. */
6236 if (argc >= 1)
6237 if (!str2metric_type (argv[0], &type))
6238 return CMD_WARNING;
6239
6240 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00006241 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00006242 else
paul020709f2003-04-04 02:44:16 +00006243 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006244
paul020709f2003-04-04 02:44:16 +00006245 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA,
6246 type, -1);
paul718e3742002-12-13 20:15:29 +00006247}
6248
6249DEFUN (ospf_default_information_originate_always_metric_type_routemap,
6250 ospf_default_information_originate_always_metric_type_routemap_cmd,
6251 "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD",
6252 "Control distribution of default information\n"
6253 "Distribute a default route\n"
6254 "Always advertise default route\n"
6255 "OSPF default metric\n"
6256 "OSPF metric\n"
6257 "OSPF metric type for default routes\n"
6258 "Set OSPF External Type 1 metrics\n"
6259 "Set OSPF External Type 2 metrics\n"
6260 "Route map reference\n"
6261 "Pointer to route-map entries\n")
6262{
paul020709f2003-04-04 02:44:16 +00006263 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006264 int type = -1;
6265 int metric = -1;
6266
6267 /* Get metric value. */
6268 if (argc >= 1)
6269 if (!str2metric (argv[0], &metric))
6270 return CMD_WARNING;
6271
6272 /* Get metric type. */
6273 if (argc >= 2)
6274 if (!str2metric_type (argv[1], &type))
6275 return CMD_WARNING;
6276
6277 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00006278 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00006279 else
paul020709f2003-04-04 02:44:16 +00006280 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006281
paul020709f2003-04-04 02:44:16 +00006282 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00006283 type, metric);
6284}
6285
6286ALIAS (ospf_default_information_originate_always_metric_type_routemap,
6287 ospf_default_information_originate_always_metric_type_cmd,
6288 "default-information originate always metric <0-16777214> metric-type (1|2)",
6289 "Control distribution of default information\n"
6290 "Distribute a default route\n"
6291 "Always advertise default route\n"
6292 "OSPF default metric\n"
6293 "OSPF metric\n"
6294 "OSPF metric type for default routes\n"
6295 "Set OSPF External Type 1 metrics\n"
6296 "Set OSPF External Type 2 metrics\n")
6297
6298ALIAS (ospf_default_information_originate_always_metric_type_routemap,
6299 ospf_default_information_originate_always_metric_cmd,
6300 "default-information originate always metric <0-16777214>",
6301 "Control distribution of default information\n"
6302 "Distribute a default route\n"
6303 "Always advertise default route\n"
6304 "OSPF default metric\n"
6305 "OSPF metric\n"
6306 "OSPF metric type for default routes\n")
6307
6308ALIAS (ospf_default_information_originate_always_metric_type_routemap,
6309 ospf_default_information_originate_always_cmd,
6310 "default-information originate always",
6311 "Control distribution of default information\n"
6312 "Distribute a default route\n"
6313 "Always advertise default route\n")
6314
6315DEFUN (ospf_default_information_originate_always_metric_routemap,
6316 ospf_default_information_originate_always_metric_routemap_cmd,
6317 "default-information originate always metric <0-16777214> route-map WORD",
6318 "Control distribution of default information\n"
6319 "Distribute a default route\n"
6320 "Always advertise default route\n"
6321 "OSPF default metric\n"
6322 "OSPF metric\n"
6323 "Route map reference\n"
6324 "Pointer to route-map entries\n")
6325{
paul020709f2003-04-04 02:44:16 +00006326 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006327 int metric = -1;
6328
6329 /* Get metric value. */
6330 if (argc >= 1)
6331 if (!str2metric (argv[0], &metric))
6332 return CMD_WARNING;
6333
6334 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00006335 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00006336 else
paul020709f2003-04-04 02:44:16 +00006337 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006338
paul020709f2003-04-04 02:44:16 +00006339 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
6340 -1, metric);
paul718e3742002-12-13 20:15:29 +00006341}
6342
6343DEFUN (ospf_default_information_originate_always_routemap,
6344 ospf_default_information_originate_always_routemap_cmd,
6345 "default-information originate always route-map WORD",
6346 "Control distribution of default information\n"
6347 "Distribute a default route\n"
6348 "Always advertise default route\n"
6349 "Route map reference\n"
6350 "Pointer to route-map entries\n")
6351{
paul020709f2003-04-04 02:44:16 +00006352 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006353
paul020709f2003-04-04 02:44:16 +00006354 if (argc == 1)
6355 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]);
6356 else
6357 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
6358
6359 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1);
paul718e3742002-12-13 20:15:29 +00006360}
6361
6362DEFUN (ospf_default_information_originate_always_type_metric_routemap,
6363 ospf_default_information_originate_always_type_metric_routemap_cmd,
6364 "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD",
6365 "Control distribution of default information\n"
6366 "Distribute a default route\n"
6367 "Always advertise default route\n"
6368 "OSPF metric type for default routes\n"
6369 "Set OSPF External Type 1 metrics\n"
6370 "Set OSPF External Type 2 metrics\n"
6371 "OSPF default metric\n"
6372 "OSPF metric\n"
6373 "Route map reference\n"
6374 "Pointer to route-map entries\n")
6375{
paul020709f2003-04-04 02:44:16 +00006376 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006377 int type = -1;
6378 int metric = -1;
6379
6380 /* Get metric type. */
6381 if (argc >= 1)
6382 if (!str2metric_type (argv[0], &type))
6383 return CMD_WARNING;
6384
6385 /* Get metric value. */
6386 if (argc >= 2)
6387 if (!str2metric (argv[1], &metric))
6388 return CMD_WARNING;
6389
6390 if (argc == 3)
paul020709f2003-04-04 02:44:16 +00006391 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]);
paul718e3742002-12-13 20:15:29 +00006392 else
paul020709f2003-04-04 02:44:16 +00006393 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006394
paul020709f2003-04-04 02:44:16 +00006395 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00006396 type, metric);
6397}
6398
6399ALIAS (ospf_default_information_originate_always_type_metric_routemap,
6400 ospf_default_information_originate_always_type_metric_cmd,
6401 "default-information originate always metric-type (1|2) metric <0-16777214>",
6402 "Control distribution of default information\n"
6403 "Distribute a default route\n"
6404 "Always advertise default route\n"
6405 "OSPF metric type for default routes\n"
6406 "Set OSPF External Type 1 metrics\n"
6407 "Set OSPF External Type 2 metrics\n"
6408 "OSPF default metric\n"
6409 "OSPF metric\n")
6410
6411ALIAS (ospf_default_information_originate_always_type_metric_routemap,
6412 ospf_default_information_originate_always_type_cmd,
6413 "default-information originate always metric-type (1|2)",
6414 "Control distribution of default information\n"
6415 "Distribute a default route\n"
6416 "Always advertise default route\n"
6417 "OSPF metric type for default routes\n"
6418 "Set OSPF External Type 1 metrics\n"
6419 "Set OSPF External Type 2 metrics\n")
6420
6421DEFUN (ospf_default_information_originate_always_type_routemap,
6422 ospf_default_information_originate_always_type_routemap_cmd,
6423 "default-information originate always metric-type (1|2) route-map WORD",
6424 "Control distribution of default information\n"
6425 "Distribute a default route\n"
6426 "Always advertise default route\n"
6427 "OSPF metric type for default routes\n"
6428 "Set OSPF External Type 1 metrics\n"
6429 "Set OSPF External Type 2 metrics\n"
6430 "Route map reference\n"
6431 "Pointer to route-map entries\n")
6432{
paul020709f2003-04-04 02:44:16 +00006433 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006434 int type = -1;
6435
6436 /* Get metric type. */
6437 if (argc >= 1)
6438 if (!str2metric_type (argv[0], &type))
6439 return CMD_WARNING;
6440
6441 if (argc == 2)
paul020709f2003-04-04 02:44:16 +00006442 ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]);
paul718e3742002-12-13 20:15:29 +00006443 else
paul020709f2003-04-04 02:44:16 +00006444 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
paul718e3742002-12-13 20:15:29 +00006445
paul020709f2003-04-04 02:44:16 +00006446 return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS,
paul718e3742002-12-13 20:15:29 +00006447 type, -1);
6448}
6449
6450DEFUN (no_ospf_default_information_originate,
6451 no_ospf_default_information_originate_cmd,
6452 "no default-information originate",
6453 NO_STR
6454 "Control distribution of default information\n"
6455 "Distribute a default route\n")
6456{
paul68980082003-03-25 05:07:42 +00006457 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006458 struct prefix_ipv4 p;
paul718e3742002-12-13 20:15:29 +00006459
6460 p.family = AF_INET;
6461 p.prefix.s_addr = 0;
6462 p.prefixlen = 0;
6463
ajs5339cfd2005-09-19 13:28:05 +00006464 ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0);
paul718e3742002-12-13 20:15:29 +00006465
6466 if (EXTERNAL_INFO (DEFAULT_ROUTE)) {
6467 ospf_external_info_delete (DEFAULT_ROUTE, p);
6468 route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE));
6469 EXTERNAL_INFO (DEFAULT_ROUTE) = NULL;
6470 }
6471
paul020709f2003-04-04 02:44:16 +00006472 ospf_routemap_unset (ospf, DEFAULT_ROUTE);
6473 return ospf_redistribute_default_unset (ospf);
paul718e3742002-12-13 20:15:29 +00006474}
6475
6476DEFUN (ospf_default_metric,
6477 ospf_default_metric_cmd,
6478 "default-metric <0-16777214>",
6479 "Set metric of redistributed routes\n"
6480 "Default metric\n")
6481{
paul68980082003-03-25 05:07:42 +00006482 struct ospf *ospf = vty->index;
paul718e3742002-12-13 20:15:29 +00006483 int metric = -1;
6484
6485 if (!str2metric (argv[0], &metric))
6486 return CMD_WARNING;
6487
paul68980082003-03-25 05:07:42 +00006488 ospf->default_metric = metric;
paul718e3742002-12-13 20:15:29 +00006489
6490 return CMD_SUCCESS;
6491}
6492
6493DEFUN (no_ospf_default_metric,
6494 no_ospf_default_metric_cmd,
6495 "no default-metric",
6496 NO_STR
6497 "Set metric of redistributed routes\n")
6498{
paul68980082003-03-25 05:07:42 +00006499 struct ospf *ospf = vty->index;
6500
6501 ospf->default_metric = -1;
6502
paul718e3742002-12-13 20:15:29 +00006503 return CMD_SUCCESS;
6504}
6505
6506ALIAS (no_ospf_default_metric,
6507 no_ospf_default_metric_val_cmd,
6508 "no default-metric <0-16777214>",
6509 NO_STR
6510 "Set metric of redistributed routes\n"
6511 "Default metric\n")
6512
6513DEFUN (ospf_distance,
6514 ospf_distance_cmd,
6515 "distance <1-255>",
6516 "Define an administrative distance\n"
6517 "OSPF Administrative distance\n")
6518{
paul68980082003-03-25 05:07:42 +00006519 struct ospf *ospf = vty->index;
6520
6521 ospf->distance_all = atoi (argv[0]);
6522
paul718e3742002-12-13 20:15:29 +00006523 return CMD_SUCCESS;
6524}
6525
6526DEFUN (no_ospf_distance,
6527 no_ospf_distance_cmd,
6528 "no distance <1-255>",
6529 NO_STR
6530 "Define an administrative distance\n"
6531 "OSPF Administrative distance\n")
6532{
paul68980082003-03-25 05:07:42 +00006533 struct ospf *ospf = vty->index;
6534
6535 ospf->distance_all = 0;
6536
paul718e3742002-12-13 20:15:29 +00006537 return CMD_SUCCESS;
6538}
6539
6540DEFUN (no_ospf_distance_ospf,
6541 no_ospf_distance_ospf_cmd,
6542 "no distance ospf",
6543 NO_STR
6544 "Define an administrative distance\n"
6545 "OSPF Administrative distance\n"
6546 "OSPF Distance\n")
6547{
paul68980082003-03-25 05:07:42 +00006548 struct ospf *ospf = vty->index;
6549
6550 ospf->distance_intra = 0;
6551 ospf->distance_inter = 0;
6552 ospf->distance_external = 0;
6553
paul718e3742002-12-13 20:15:29 +00006554 return CMD_SUCCESS;
6555}
6556
6557DEFUN (ospf_distance_ospf_intra,
6558 ospf_distance_ospf_intra_cmd,
6559 "distance ospf intra-area <1-255>",
6560 "Define an administrative distance\n"
6561 "OSPF Administrative distance\n"
6562 "Intra-area routes\n"
6563 "Distance for intra-area routes\n")
6564{
paul68980082003-03-25 05:07:42 +00006565 struct ospf *ospf = vty->index;
6566
6567 ospf->distance_intra = atoi (argv[0]);
6568
paul718e3742002-12-13 20:15:29 +00006569 return CMD_SUCCESS;
6570}
6571
6572DEFUN (ospf_distance_ospf_intra_inter,
6573 ospf_distance_ospf_intra_inter_cmd,
6574 "distance ospf intra-area <1-255> inter-area <1-255>",
6575 "Define an administrative distance\n"
6576 "OSPF Administrative distance\n"
6577 "Intra-area routes\n"
6578 "Distance for intra-area routes\n"
6579 "Inter-area routes\n"
6580 "Distance for inter-area routes\n")
6581{
paul68980082003-03-25 05:07:42 +00006582 struct ospf *ospf = vty->index;
6583
6584 ospf->distance_intra = atoi (argv[0]);
6585 ospf->distance_inter = atoi (argv[1]);
6586
paul718e3742002-12-13 20:15:29 +00006587 return CMD_SUCCESS;
6588}
6589
6590DEFUN (ospf_distance_ospf_intra_external,
6591 ospf_distance_ospf_intra_external_cmd,
6592 "distance ospf intra-area <1-255> external <1-255>",
6593 "Define an administrative distance\n"
6594 "OSPF Administrative distance\n"
6595 "Intra-area routes\n"
6596 "Distance for intra-area routes\n"
6597 "External routes\n"
6598 "Distance for external routes\n")
6599{
paul68980082003-03-25 05:07:42 +00006600 struct ospf *ospf = vty->index;
6601
6602 ospf->distance_intra = atoi (argv[0]);
6603 ospf->distance_external = atoi (argv[1]);
6604
paul718e3742002-12-13 20:15:29 +00006605 return CMD_SUCCESS;
6606}
6607
6608DEFUN (ospf_distance_ospf_intra_inter_external,
6609 ospf_distance_ospf_intra_inter_external_cmd,
6610 "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>",
6611 "Define an administrative distance\n"
6612 "OSPF Administrative distance\n"
6613 "Intra-area routes\n"
6614 "Distance for intra-area routes\n"
6615 "Inter-area routes\n"
6616 "Distance for inter-area routes\n"
6617 "External routes\n"
6618 "Distance for external routes\n")
6619{
paul68980082003-03-25 05:07:42 +00006620 struct ospf *ospf = vty->index;
6621
6622 ospf->distance_intra = atoi (argv[0]);
6623 ospf->distance_inter = atoi (argv[1]);
6624 ospf->distance_external = atoi (argv[2]);
6625
paul718e3742002-12-13 20:15:29 +00006626 return CMD_SUCCESS;
6627}
6628
6629DEFUN (ospf_distance_ospf_intra_external_inter,
6630 ospf_distance_ospf_intra_external_inter_cmd,
6631 "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>",
6632 "Define an administrative distance\n"
6633 "OSPF Administrative distance\n"
6634 "Intra-area routes\n"
6635 "Distance for intra-area routes\n"
6636 "External routes\n"
6637 "Distance for external routes\n"
6638 "Inter-area routes\n"
6639 "Distance for inter-area routes\n")
6640{
paul68980082003-03-25 05:07:42 +00006641 struct ospf *ospf = vty->index;
6642
6643 ospf->distance_intra = atoi (argv[0]);
6644 ospf->distance_external = atoi (argv[1]);
6645 ospf->distance_inter = atoi (argv[2]);
6646
paul718e3742002-12-13 20:15:29 +00006647 return CMD_SUCCESS;
6648}
6649
6650DEFUN (ospf_distance_ospf_inter,
6651 ospf_distance_ospf_inter_cmd,
6652 "distance ospf inter-area <1-255>",
6653 "Define an administrative distance\n"
6654 "OSPF Administrative distance\n"
6655 "Inter-area routes\n"
6656 "Distance for inter-area routes\n")
6657{
paul68980082003-03-25 05:07:42 +00006658 struct ospf *ospf = vty->index;
6659
6660 ospf->distance_inter = atoi (argv[0]);
6661
paul718e3742002-12-13 20:15:29 +00006662 return CMD_SUCCESS;
6663}
6664
6665DEFUN (ospf_distance_ospf_inter_intra,
6666 ospf_distance_ospf_inter_intra_cmd,
6667 "distance ospf inter-area <1-255> intra-area <1-255>",
6668 "Define an administrative distance\n"
6669 "OSPF Administrative distance\n"
6670 "Inter-area routes\n"
6671 "Distance for inter-area routes\n"
6672 "Intra-area routes\n"
6673 "Distance for intra-area routes\n")
6674{
paul68980082003-03-25 05:07:42 +00006675 struct ospf *ospf = vty->index;
6676
6677 ospf->distance_inter = atoi (argv[0]);
6678 ospf->distance_intra = atoi (argv[1]);
6679
paul718e3742002-12-13 20:15:29 +00006680 return CMD_SUCCESS;
6681}
6682
6683DEFUN (ospf_distance_ospf_inter_external,
6684 ospf_distance_ospf_inter_external_cmd,
6685 "distance ospf inter-area <1-255> external <1-255>",
6686 "Define an administrative distance\n"
6687 "OSPF Administrative distance\n"
6688 "Inter-area routes\n"
6689 "Distance for inter-area routes\n"
6690 "External routes\n"
6691 "Distance for external routes\n")
6692{
paul68980082003-03-25 05:07:42 +00006693 struct ospf *ospf = vty->index;
6694
6695 ospf->distance_inter = atoi (argv[0]);
6696 ospf->distance_external = atoi (argv[1]);
6697
paul718e3742002-12-13 20:15:29 +00006698 return CMD_SUCCESS;
6699}
6700
6701DEFUN (ospf_distance_ospf_inter_intra_external,
6702 ospf_distance_ospf_inter_intra_external_cmd,
6703 "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>",
6704 "Define an administrative distance\n"
6705 "OSPF Administrative distance\n"
6706 "Inter-area routes\n"
6707 "Distance for inter-area routes\n"
6708 "Intra-area routes\n"
6709 "Distance for intra-area routes\n"
6710 "External routes\n"
6711 "Distance for external routes\n")
6712{
paul68980082003-03-25 05:07:42 +00006713 struct ospf *ospf = vty->index;
6714
6715 ospf->distance_inter = atoi (argv[0]);
6716 ospf->distance_intra = atoi (argv[1]);
6717 ospf->distance_external = atoi (argv[2]);
6718
paul718e3742002-12-13 20:15:29 +00006719 return CMD_SUCCESS;
6720}
6721
6722DEFUN (ospf_distance_ospf_inter_external_intra,
6723 ospf_distance_ospf_inter_external_intra_cmd,
6724 "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>",
6725 "Define an administrative distance\n"
6726 "OSPF Administrative distance\n"
6727 "Inter-area routes\n"
6728 "Distance for inter-area routes\n"
6729 "External routes\n"
6730 "Distance for external routes\n"
6731 "Intra-area routes\n"
6732 "Distance for intra-area routes\n")
6733{
paul68980082003-03-25 05:07:42 +00006734 struct ospf *ospf = vty->index;
6735
6736 ospf->distance_inter = atoi (argv[0]);
6737 ospf->distance_external = atoi (argv[1]);
6738 ospf->distance_intra = atoi (argv[2]);
6739
paul718e3742002-12-13 20:15:29 +00006740 return CMD_SUCCESS;
6741}
6742
6743DEFUN (ospf_distance_ospf_external,
6744 ospf_distance_ospf_external_cmd,
6745 "distance ospf external <1-255>",
6746 "Define an administrative distance\n"
6747 "OSPF Administrative distance\n"
6748 "External routes\n"
6749 "Distance for external routes\n")
6750{
paul68980082003-03-25 05:07:42 +00006751 struct ospf *ospf = vty->index;
6752
6753 ospf->distance_external = atoi (argv[0]);
6754
paul718e3742002-12-13 20:15:29 +00006755 return CMD_SUCCESS;
6756}
6757
6758DEFUN (ospf_distance_ospf_external_intra,
6759 ospf_distance_ospf_external_intra_cmd,
6760 "distance ospf external <1-255> intra-area <1-255>",
6761 "Define an administrative distance\n"
6762 "OSPF Administrative distance\n"
6763 "External routes\n"
6764 "Distance for external routes\n"
6765 "Intra-area routes\n"
6766 "Distance for intra-area routes\n")
6767{
paul68980082003-03-25 05:07:42 +00006768 struct ospf *ospf = vty->index;
6769
6770 ospf->distance_external = atoi (argv[0]);
6771 ospf->distance_intra = atoi (argv[1]);
6772
paul718e3742002-12-13 20:15:29 +00006773 return CMD_SUCCESS;
6774}
6775
6776DEFUN (ospf_distance_ospf_external_inter,
6777 ospf_distance_ospf_external_inter_cmd,
6778 "distance ospf external <1-255> inter-area <1-255>",
6779 "Define an administrative distance\n"
6780 "OSPF Administrative distance\n"
6781 "External routes\n"
6782 "Distance for external routes\n"
6783 "Inter-area routes\n"
6784 "Distance for inter-area routes\n")
6785{
paul68980082003-03-25 05:07:42 +00006786 struct ospf *ospf = vty->index;
6787
6788 ospf->distance_external = atoi (argv[0]);
6789 ospf->distance_inter = atoi (argv[1]);
6790
paul718e3742002-12-13 20:15:29 +00006791 return CMD_SUCCESS;
6792}
6793
6794DEFUN (ospf_distance_ospf_external_intra_inter,
6795 ospf_distance_ospf_external_intra_inter_cmd,
6796 "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>",
6797 "Define an administrative distance\n"
6798 "OSPF Administrative distance\n"
6799 "External routes\n"
6800 "Distance for external routes\n"
6801 "Intra-area routes\n"
6802 "Distance for intra-area routes\n"
6803 "Inter-area routes\n"
6804 "Distance for inter-area routes\n")
6805{
paul68980082003-03-25 05:07:42 +00006806 struct ospf *ospf = vty->index;
6807
6808 ospf->distance_external = atoi (argv[0]);
6809 ospf->distance_intra = atoi (argv[1]);
6810 ospf->distance_inter = atoi (argv[2]);
6811
paul718e3742002-12-13 20:15:29 +00006812 return CMD_SUCCESS;
6813}
6814
6815DEFUN (ospf_distance_ospf_external_inter_intra,
6816 ospf_distance_ospf_external_inter_intra_cmd,
6817 "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>",
6818 "Define an administrative distance\n"
6819 "OSPF Administrative distance\n"
6820 "External routes\n"
6821 "Distance for external routes\n"
6822 "Inter-area routes\n"
6823 "Distance for inter-area routes\n"
6824 "Intra-area routes\n"
6825 "Distance for intra-area routes\n")
6826{
paul68980082003-03-25 05:07:42 +00006827 struct ospf *ospf = vty->index;
6828
6829 ospf->distance_external = atoi (argv[0]);
6830 ospf->distance_inter = atoi (argv[1]);
6831 ospf->distance_intra = atoi (argv[2]);
6832
paul718e3742002-12-13 20:15:29 +00006833 return CMD_SUCCESS;
6834}
6835
6836DEFUN (ospf_distance_source,
6837 ospf_distance_source_cmd,
6838 "distance <1-255> A.B.C.D/M",
6839 "Administrative distance\n"
6840 "Distance value\n"
6841 "IP source prefix\n")
6842{
paul020709f2003-04-04 02:44:16 +00006843 struct ospf *ospf = vty->index;
6844
6845 ospf_distance_set (vty, ospf, argv[0], argv[1], NULL);
paul68980082003-03-25 05:07:42 +00006846
paul718e3742002-12-13 20:15:29 +00006847 return CMD_SUCCESS;
6848}
6849
6850DEFUN (no_ospf_distance_source,
6851 no_ospf_distance_source_cmd,
6852 "no distance <1-255> A.B.C.D/M",
6853 NO_STR
6854 "Administrative distance\n"
6855 "Distance value\n"
6856 "IP source prefix\n")
6857{
paul020709f2003-04-04 02:44:16 +00006858 struct ospf *ospf = vty->index;
6859
6860 ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL);
6861
paul718e3742002-12-13 20:15:29 +00006862 return CMD_SUCCESS;
6863}
6864
6865DEFUN (ospf_distance_source_access_list,
6866 ospf_distance_source_access_list_cmd,
6867 "distance <1-255> A.B.C.D/M WORD",
6868 "Administrative distance\n"
6869 "Distance value\n"
6870 "IP source prefix\n"
6871 "Access list name\n")
6872{
paul020709f2003-04-04 02:44:16 +00006873 struct ospf *ospf = vty->index;
6874
6875 ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]);
6876
paul718e3742002-12-13 20:15:29 +00006877 return CMD_SUCCESS;
6878}
6879
6880DEFUN (no_ospf_distance_source_access_list,
6881 no_ospf_distance_source_access_list_cmd,
6882 "no distance <1-255> A.B.C.D/M WORD",
6883 NO_STR
6884 "Administrative distance\n"
6885 "Distance value\n"
6886 "IP source prefix\n"
6887 "Access list name\n")
6888{
paul020709f2003-04-04 02:44:16 +00006889 struct ospf *ospf = vty->index;
6890
6891 ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]);
6892
paul718e3742002-12-13 20:15:29 +00006893 return CMD_SUCCESS;
6894}
6895
vincentba682532005-09-29 13:52:57 +00006896DEFUN (ip_ospf_mtu_ignore,
6897 ip_ospf_mtu_ignore_addr_cmd,
6898 "ip ospf mtu-ignore A.B.C.D",
6899 "IP Information\n"
6900 "OSPF interface commands\n"
6901 "Disable mtu mismatch detection\n"
6902 "Address of interface")
6903{
6904 struct interface *ifp = vty->index;
6905 struct in_addr addr;
6906 int ret;
6907
6908 struct ospf_if_params *params;
6909 params = IF_DEF_PARAMS (ifp);
6910
6911 if (argc == 1)
6912 {
6913 ret = inet_aton(argv[0], &addr);
6914 if (!ret)
6915 {
6916 vty_out (vty, "Please specify interface address by A.B.C.D%s",
6917 VTY_NEWLINE);
6918 return CMD_WARNING;
6919 }
6920 params = ospf_get_if_params (ifp, addr);
6921 ospf_if_update_params (ifp, addr);
6922 }
6923 params->mtu_ignore = 1;
6924 if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
6925 SET_IF_PARAM (params, mtu_ignore);
6926 else
6927 {
6928 UNSET_IF_PARAM (params, mtu_ignore);
6929 if (params != IF_DEF_PARAMS (ifp))
6930 {
6931 ospf_free_if_params (ifp, addr);
6932 ospf_if_update_params (ifp, addr);
6933 }
6934 }
6935 return CMD_SUCCESS;
6936}
6937
6938ALIAS (ip_ospf_mtu_ignore,
6939 ip_ospf_mtu_ignore_cmd,
6940 "ip ospf mtu-ignore",
6941 "IP Information\n"
6942 "OSPF interface commands\n"
6943 "Disable mtu mismatch detection\n")
6944
6945
6946DEFUN (no_ip_ospf_mtu_ignore,
6947 no_ip_ospf_mtu_ignore_addr_cmd,
6948 "no ip ospf mtu-ignore A.B.C.D",
6949 "IP Information\n"
6950 "OSPF interface commands\n"
6951 "Disable mtu mismatch detection\n"
6952 "Address of interface")
6953{
6954 struct interface *ifp = vty->index;
6955 struct in_addr addr;
6956 int ret;
6957
6958 struct ospf_if_params *params;
6959 params = IF_DEF_PARAMS (ifp);
6960
6961 if (argc == 1)
6962 {
6963 ret = inet_aton(argv[0], &addr);
6964 if (!ret)
6965 {
6966 vty_out (vty, "Please specify interface address by A.B.C.D%s",
6967 VTY_NEWLINE);
6968 return CMD_WARNING;
6969 }
6970 params = ospf_get_if_params (ifp, addr);
6971 ospf_if_update_params (ifp, addr);
6972 }
6973 params->mtu_ignore = 0;
6974 if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
6975 SET_IF_PARAM (params, mtu_ignore);
6976 else
6977 {
6978 UNSET_IF_PARAM (params, mtu_ignore);
6979 if (params != IF_DEF_PARAMS (ifp))
6980 {
6981 ospf_free_if_params (ifp, addr);
6982 ospf_if_update_params (ifp, addr);
6983 }
6984 }
6985 return CMD_SUCCESS;
6986}
6987
6988ALIAS (no_ip_ospf_mtu_ignore,
6989 no_ip_ospf_mtu_ignore_cmd,
6990 "no ip ospf mtu-ignore",
6991 "IP Information\n"
6992 "OSPF interface commands\n"
6993 "Disable mtu mismatch detection\n")
paul88d6cf32005-10-29 12:50:09 +00006994
6995DEFUN (ospf_max_metric_router_lsa_admin,
6996 ospf_max_metric_router_lsa_admin_cmd,
6997 "max-metric router-lsa administrative",
6998 "OSPF maximum / infinite-distance metric\n"
6999 "Advertise own Router-LSA with infinite distance (stub router)\n"
7000 "Administratively applied, for an indefinite period\n")
7001{
7002 struct listnode *ln;
7003 struct ospf_area *area;
7004 struct ospf *ospf = vty->index;
vincentba682532005-09-29 13:52:57 +00007005
paul88d6cf32005-10-29 12:50:09 +00007006 for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area))
7007 {
7008 SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED);
7009
7010 if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED))
7011 ospf_router_lsa_timer_add (area);
7012 }
7013 return CMD_SUCCESS;
7014}
7015
7016DEFUN (no_ospf_max_metric_router_lsa_admin,
7017 no_ospf_max_metric_router_lsa_admin_cmd,
7018 "no max-metric router-lsa administrative",
7019 NO_STR
7020 "OSPF maximum / infinite-distance metric\n"
7021 "Advertise own Router-LSA with infinite distance (stub router)\n"
7022 "Administratively applied, for an indefinite period\n")
7023{
7024 struct listnode *ln;
7025 struct ospf_area *area;
7026 struct ospf *ospf = vty->index;
7027
7028 for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area))
7029 {
7030 UNSET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED);
7031
7032 /* Don't trample on the start-up stub timer */
7033 if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)
7034 && !area->t_stub_router)
7035 {
7036 UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
7037 ospf_router_lsa_timer_add (area);
7038 }
7039 }
7040 return CMD_SUCCESS;
7041}
7042
7043DEFUN (ospf_max_metric_router_lsa_startup,
7044 ospf_max_metric_router_lsa_startup_cmd,
7045 "max-metric router-lsa on-startup <5-86400>",
7046 "OSPF maximum / infinite-distance metric\n"
7047 "Advertise own Router-LSA with infinite distance (stub router)\n"
7048 "Automatically advertise stub Router-LSA on startup of OSPF\n"
7049 "Time (seconds) to advertise self as stub-router\n")
7050{
7051 unsigned int seconds;
7052 struct ospf *ospf = vty->index;
7053
7054 if (argc != 1)
7055 {
7056 vty_out (vty, "%% Must supply stub-router period");
7057 return CMD_WARNING;
7058 }
7059
7060 VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]);
7061
7062 ospf->stub_router_startup_time = seconds;
7063
7064 return CMD_SUCCESS;
7065}
7066
7067DEFUN (no_ospf_max_metric_router_lsa_startup,
7068 no_ospf_max_metric_router_lsa_startup_cmd,
7069 "no max-metric router-lsa on-startup",
7070 NO_STR
7071 "OSPF maximum / infinite-distance metric\n"
7072 "Advertise own Router-LSA with infinite distance (stub router)\n"
7073 "Automatically advertise stub Router-LSA on startup of OSPF\n")
7074{
7075 struct listnode *ln;
7076 struct ospf_area *area;
7077 struct ospf *ospf = vty->index;
7078
7079 ospf->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED;
7080
7081 for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area))
7082 {
7083 SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED);
7084 OSPF_TIMER_OFF (area->t_stub_router);
7085
7086 /* Don't trample on admin stub routed */
7087 if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
7088 {
7089 UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED);
7090 ospf_router_lsa_timer_add (area);
7091 }
7092 }
7093 return CMD_SUCCESS;
7094}
7095
7096DEFUN (ospf_max_metric_router_lsa_shutdown,
7097 ospf_max_metric_router_lsa_shutdown_cmd,
7098 "max-metric router-lsa on-shutdown <5-86400>",
7099 "OSPF maximum / infinite-distance metric\n"
7100 "Advertise own Router-LSA with infinite distance (stub router)\n"
7101 "Advertise stub-router prior to full shutdown of OSPF\n"
7102 "Time (seconds) to wait till full shutdown\n")
7103{
7104 unsigned int seconds;
7105 struct ospf *ospf = vty->index;
7106
7107 if (argc != 1)
7108 {
7109 vty_out (vty, "%% Must supply stub-router shutdown period");
7110 return CMD_WARNING;
7111 }
7112
7113 VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]);
7114
7115 ospf->stub_router_shutdown_time = seconds;
7116
7117 return CMD_SUCCESS;
7118}
7119
7120DEFUN (no_ospf_max_metric_router_lsa_shutdown,
7121 no_ospf_max_metric_router_lsa_shutdown_cmd,
7122 "no max-metric router-lsa on-shutdown",
7123 NO_STR
7124 "OSPF maximum / infinite-distance metric\n"
7125 "Advertise own Router-LSA with infinite distance (stub router)\n"
7126 "Advertise stub-router prior to full shutdown of OSPF\n")
7127{
7128 struct ospf *ospf = vty->index;
7129
7130 ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED;
7131
7132 return CMD_SUCCESS;
7133}
7134
7135static void
7136config_write_stub_router (struct vty *vty, struct ospf *ospf)
7137{
7138 struct listnode *ln;
7139 struct ospf_area *area;
7140
7141 if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED)
7142 vty_out (vty, " max-metric router-lsa on-startup %u%s",
7143 ospf->stub_router_startup_time, VTY_NEWLINE);
7144 if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED)
7145 vty_out (vty, " max-metric router-lsa on-shutdown %u%s",
7146 ospf->stub_router_shutdown_time, VTY_NEWLINE);
7147 for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area))
7148 {
7149 if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED))
7150 {
7151 vty_out (vty, " max-metric router-lsa administrative%s",
7152 VTY_NEWLINE);
7153 break;
7154 }
7155 }
7156 return;
7157}
7158
paul4dadc292005-05-06 21:37:42 +00007159static void
paul718e3742002-12-13 20:15:29 +00007160show_ip_ospf_route_network (struct vty *vty, struct route_table *rt)
7161{
7162 struct route_node *rn;
7163 struct ospf_route *or;
paul1eb8ef22005-04-07 07:30:20 +00007164 struct listnode *pnode, *pnnode;
paul718e3742002-12-13 20:15:29 +00007165 struct ospf_path *path;
7166
7167 vty_out (vty, "============ OSPF network routing table ============%s",
7168 VTY_NEWLINE);
7169
7170 for (rn = route_top (rt); rn; rn = route_next (rn))
7171 if ((or = rn->info) != NULL)
7172 {
7173 char buf1[19];
7174 snprintf (buf1, 19, "%s/%d",
7175 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
7176
7177 switch (or->path_type)
7178 {
7179 case OSPF_PATH_INTER_AREA:
7180 if (or->type == OSPF_DESTINATION_NETWORK)
7181 vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost,
7182 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
7183 else if (or->type == OSPF_DESTINATION_DISCARD)
7184 vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE);
7185 break;
7186 case OSPF_PATH_INTRA_AREA:
7187 vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost,
7188 inet_ntoa (or->u.std.area_id), VTY_NEWLINE);
7189 break;
7190 default:
7191 break;
7192 }
7193
7194 if (or->type == OSPF_DESTINATION_NETWORK)
paul1eb8ef22005-04-07 07:30:20 +00007195 for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path))
paul96735ee2003-08-10 02:51:22 +00007196 {
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007197 if (if_lookup_by_index(path->ifindex))
paul96735ee2003-08-10 02:51:22 +00007198 {
7199 if (path->nexthop.s_addr == 0)
7200 vty_out (vty, "%24s directly attached to %s%s",
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007201 "", ifindex2ifname (path->ifindex), VTY_NEWLINE);
paul96735ee2003-08-10 02:51:22 +00007202 else
7203 vty_out (vty, "%24s via %s, %s%s", "",
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007204 inet_ntoa (path->nexthop),
7205 ifindex2ifname (path->ifindex), VTY_NEWLINE);
paul96735ee2003-08-10 02:51:22 +00007206 }
7207 }
paul718e3742002-12-13 20:15:29 +00007208 }
7209 vty_out (vty, "%s", VTY_NEWLINE);
7210}
7211
paul4dadc292005-05-06 21:37:42 +00007212static void
paul718e3742002-12-13 20:15:29 +00007213show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs)
7214{
7215 struct route_node *rn;
7216 struct ospf_route *or;
paul1eb8ef22005-04-07 07:30:20 +00007217 struct listnode *pnode;
7218 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00007219 struct ospf_path *path;
7220
7221 vty_out (vty, "============ OSPF router routing table =============%s",
7222 VTY_NEWLINE);
7223 for (rn = route_top (rtrs); rn; rn = route_next (rn))
7224 if (rn->info)
7225 {
7226 int flag = 0;
7227
7228 vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4));
7229
paul1eb8ef22005-04-07 07:30:20 +00007230 for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or))
7231 {
7232 if (flag++)
7233 vty_out (vty, "%24s", "");
paul718e3742002-12-13 20:15:29 +00007234
paul1eb8ef22005-04-07 07:30:20 +00007235 /* Show path. */
7236 vty_out (vty, "%s [%d] area: %s",
7237 (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "),
7238 or->cost, inet_ntoa (or->u.std.area_id));
7239 /* Show flags. */
7240 vty_out (vty, "%s%s%s",
7241 (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""),
7242 (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""),
7243 VTY_NEWLINE);
7244
7245 for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path))
7246 {
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007247 if (if_lookup_by_index(path->ifindex))
hasso54bedb52005-08-17 13:31:47 +00007248 {
7249 if (path->nexthop.s_addr == 0)
7250 vty_out (vty, "%24s directly attached to %s%s",
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007251 "", ifindex2ifname (path->ifindex),
7252 VTY_NEWLINE);
hasso54bedb52005-08-17 13:31:47 +00007253 else
7254 vty_out (vty, "%24s via %s, %s%s", "",
7255 inet_ntoa (path->nexthop),
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007256 ifindex2ifname (path->ifindex),
7257 VTY_NEWLINE);
hasso54bedb52005-08-17 13:31:47 +00007258 }
paul1eb8ef22005-04-07 07:30:20 +00007259 }
7260 }
paul718e3742002-12-13 20:15:29 +00007261 }
7262 vty_out (vty, "%s", VTY_NEWLINE);
7263}
7264
paul4dadc292005-05-06 21:37:42 +00007265static void
paul718e3742002-12-13 20:15:29 +00007266show_ip_ospf_route_external (struct vty *vty, struct route_table *rt)
7267{
7268 struct route_node *rn;
7269 struct ospf_route *er;
paul1eb8ef22005-04-07 07:30:20 +00007270 struct listnode *pnode, *pnnode;
paul718e3742002-12-13 20:15:29 +00007271 struct ospf_path *path;
7272
7273 vty_out (vty, "============ OSPF external routing table ===========%s",
7274 VTY_NEWLINE);
7275 for (rn = route_top (rt); rn; rn = route_next (rn))
7276 if ((er = rn->info) != NULL)
7277 {
7278 char buf1[19];
7279 snprintf (buf1, 19, "%s/%d",
7280 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen);
7281
7282 switch (er->path_type)
7283 {
7284 case OSPF_PATH_TYPE1_EXTERNAL:
7285 vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1,
7286 er->cost, er->u.ext.tag, VTY_NEWLINE);
7287 break;
7288 case OSPF_PATH_TYPE2_EXTERNAL:
7289 vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost,
7290 er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE);
7291 break;
7292 }
7293
paul1eb8ef22005-04-07 07:30:20 +00007294 for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path))
paul718e3742002-12-13 20:15:29 +00007295 {
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007296 if (if_lookup_by_index(path->ifindex))
paul718e3742002-12-13 20:15:29 +00007297 {
7298 if (path->nexthop.s_addr == 0)
paul96735ee2003-08-10 02:51:22 +00007299 vty_out (vty, "%24s directly attached to %s%s",
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007300 "", ifindex2ifname (path->ifindex), VTY_NEWLINE);
paul96735ee2003-08-10 02:51:22 +00007301 else
7302 vty_out (vty, "%24s via %s, %s%s", "",
Joakim Tjernlunda8ba8472009-07-27 12:42:34 +02007303 inet_ntoa (path->nexthop),
7304 ifindex2ifname (path->ifindex),
paul96735ee2003-08-10 02:51:22 +00007305 VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007306 }
7307 }
7308 }
7309 vty_out (vty, "%s", VTY_NEWLINE);
7310}
7311
paul718e3742002-12-13 20:15:29 +00007312DEFUN (show_ip_ospf_border_routers,
7313 show_ip_ospf_border_routers_cmd,
7314 "show ip ospf border-routers",
7315 SHOW_STR
7316 IP_STR
7317 "show all the ABR's and ASBR's\n"
7318 "for this area\n")
7319{
paul020709f2003-04-04 02:44:16 +00007320 struct ospf *ospf;
paul68980082003-03-25 05:07:42 +00007321
Paul Jakmacac3b5c2006-05-11 13:31:11 +00007322 if ((ospf = ospf_lookup ()) == NULL)
paul718e3742002-12-13 20:15:29 +00007323 {
Paul Jakmacac3b5c2006-05-11 13:31:11 +00007324 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007325 return CMD_SUCCESS;
7326 }
7327
paul68980082003-03-25 05:07:42 +00007328 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00007329 {
7330 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
7331 return CMD_SUCCESS;
7332 }
7333
7334 /* Show Network routes.
paul020709f2003-04-04 02:44:16 +00007335 show_ip_ospf_route_network (vty, ospf->new_table); */
paul718e3742002-12-13 20:15:29 +00007336
7337 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00007338 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00007339
7340 return CMD_SUCCESS;
7341}
paul718e3742002-12-13 20:15:29 +00007342
7343DEFUN (show_ip_ospf_route,
7344 show_ip_ospf_route_cmd,
7345 "show ip ospf route",
7346 SHOW_STR
7347 IP_STR
7348 "OSPF information\n"
7349 "OSPF routing table\n")
7350{
paul020709f2003-04-04 02:44:16 +00007351 struct ospf *ospf;
paul68980082003-03-25 05:07:42 +00007352
Paul Jakmacac3b5c2006-05-11 13:31:11 +00007353 if ((ospf = ospf_lookup ()) == NULL)
paul718e3742002-12-13 20:15:29 +00007354 {
Paul Jakmacac3b5c2006-05-11 13:31:11 +00007355 vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007356 return CMD_SUCCESS;
7357 }
7358
paul68980082003-03-25 05:07:42 +00007359 if (ospf->new_table == NULL)
paul718e3742002-12-13 20:15:29 +00007360 {
7361 vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE);
7362 return CMD_SUCCESS;
7363 }
7364
7365 /* Show Network routes. */
paul68980082003-03-25 05:07:42 +00007366 show_ip_ospf_route_network (vty, ospf->new_table);
paul718e3742002-12-13 20:15:29 +00007367
7368 /* Show Router routes. */
paul68980082003-03-25 05:07:42 +00007369 show_ip_ospf_route_router (vty, ospf->new_rtrs);
paul718e3742002-12-13 20:15:29 +00007370
7371 /* Show AS External routes. */
paul68980082003-03-25 05:07:42 +00007372 show_ip_ospf_route_external (vty, ospf->old_external_route);
paul718e3742002-12-13 20:15:29 +00007373
7374 return CMD_SUCCESS;
7375}
7376
7377
hassoeb1ce602004-10-08 08:17:22 +00007378const char *ospf_abr_type_str[] =
paul718e3742002-12-13 20:15:29 +00007379{
7380 "unknown",
7381 "standard",
7382 "ibm",
7383 "cisco",
7384 "shortcut"
7385};
7386
hassoeb1ce602004-10-08 08:17:22 +00007387const char *ospf_shortcut_mode_str[] =
paul718e3742002-12-13 20:15:29 +00007388{
7389 "default",
7390 "enable",
7391 "disable"
7392};
7393
7394
paul4dadc292005-05-06 21:37:42 +00007395static void
paul718e3742002-12-13 20:15:29 +00007396area_id2str (char *buf, int length, struct ospf_area *area)
7397{
7398 memset (buf, 0, length);
7399
7400 if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS)
7401 strncpy (buf, inet_ntoa (area->area_id), length);
7402 else
7403 sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr));
7404}
7405
7406
hassoeb1ce602004-10-08 08:17:22 +00007407const char *ospf_int_type_str[] =
paul718e3742002-12-13 20:15:29 +00007408{
7409 "unknown", /* should never be used. */
7410 "point-to-point",
7411 "broadcast",
7412 "non-broadcast",
7413 "point-to-multipoint",
7414 "virtual-link", /* should never be used. */
7415 "loopback"
7416};
7417
7418/* Configuration write function for ospfd. */
paul4dadc292005-05-06 21:37:42 +00007419static int
paul718e3742002-12-13 20:15:29 +00007420config_write_interface (struct vty *vty)
7421{
hasso52dc7ee2004-09-23 19:18:23 +00007422 struct listnode *n1, *n2;
paul718e3742002-12-13 20:15:29 +00007423 struct interface *ifp;
7424 struct crypt_key *ck;
7425 int write = 0;
7426 struct route_node *rn = NULL;
7427 struct ospf_if_params *params;
7428
paul1eb8ef22005-04-07 07:30:20 +00007429 for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp))
paul718e3742002-12-13 20:15:29 +00007430 {
paul718e3742002-12-13 20:15:29 +00007431 if (memcmp (ifp->name, "VLINK", 5) == 0)
7432 continue;
7433
7434 vty_out (vty, "!%s", VTY_NEWLINE);
7435 vty_out (vty, "interface %s%s", ifp->name,
7436 VTY_NEWLINE);
7437 if (ifp->desc)
7438 vty_out (vty, " description %s%s", ifp->desc,
7439 VTY_NEWLINE);
7440
7441 write++;
7442
7443 params = IF_DEF_PARAMS (ifp);
7444
7445 do {
7446 /* Interface Network print. */
7447 if (OSPF_IF_PARAM_CONFIGURED (params, type) &&
paul718e3742002-12-13 20:15:29 +00007448 params->type != OSPF_IFTYPE_LOOPBACK)
7449 {
ajsbc18d612004-12-15 15:07:19 +00007450 if (params->type != ospf_default_iftype(ifp))
hasso7b901432004-08-31 13:37:42 +00007451 {
7452 vty_out (vty, " ip ospf network %s",
7453 ospf_int_type_str[params->type]);
7454 if (params != IF_DEF_PARAMS (ifp))
7455 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7456 vty_out (vty, "%s", VTY_NEWLINE);
7457 }
paul718e3742002-12-13 20:15:29 +00007458 }
7459
7460 /* OSPF interface authentication print */
7461 if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) &&
7462 params->auth_type != OSPF_AUTH_NOTSET)
7463 {
hassoeb1ce602004-10-08 08:17:22 +00007464 const char *auth_str;
paul718e3742002-12-13 20:15:29 +00007465
7466 /* Translation tables are not that much help here due to syntax
7467 of the simple option */
7468 switch (params->auth_type)
7469 {
7470
7471 case OSPF_AUTH_NULL:
7472 auth_str = " null";
7473 break;
7474
7475 case OSPF_AUTH_SIMPLE:
7476 auth_str = "";
7477 break;
7478
7479 case OSPF_AUTH_CRYPTOGRAPHIC:
7480 auth_str = " message-digest";
7481 break;
7482
7483 default:
7484 auth_str = "";
7485 break;
7486 }
7487
7488 vty_out (vty, " ip ospf authentication%s", auth_str);
7489 if (params != IF_DEF_PARAMS (ifp))
7490 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7491 vty_out (vty, "%s", VTY_NEWLINE);
7492 }
7493
7494 /* Simple Authentication Password print. */
7495 if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) &&
7496 params->auth_simple[0] != '\0')
7497 {
7498 vty_out (vty, " ip ospf authentication-key %s",
7499 params->auth_simple);
7500 if (params != IF_DEF_PARAMS (ifp))
7501 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7502 vty_out (vty, "%s", VTY_NEWLINE);
7503 }
7504
7505 /* Cryptographic Authentication Key print. */
paul1eb8ef22005-04-07 07:30:20 +00007506 for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck))
paul718e3742002-12-13 20:15:29 +00007507 {
paul718e3742002-12-13 20:15:29 +00007508 vty_out (vty, " ip ospf message-digest-key %d md5 %s",
7509 ck->key_id, ck->auth_key);
7510 if (params != IF_DEF_PARAMS (ifp))
7511 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7512 vty_out (vty, "%s", VTY_NEWLINE);
7513 }
7514
7515 /* Interface Output Cost print. */
7516 if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd))
7517 {
7518 vty_out (vty, " ip ospf cost %u", params->output_cost_cmd);
7519 if (params != IF_DEF_PARAMS (ifp))
7520 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7521 vty_out (vty, "%s", VTY_NEWLINE);
7522 }
7523
7524 /* Hello Interval print. */
7525 if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) &&
7526 params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT)
7527 {
7528 vty_out (vty, " ip ospf hello-interval %u", params->v_hello);
7529 if (params != IF_DEF_PARAMS (ifp))
7530 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7531 vty_out (vty, "%s", VTY_NEWLINE);
7532 }
7533
7534
7535 /* Router Dead Interval print. */
7536 if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) &&
7537 params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT)
7538 {
paulf9ad9372005-10-21 00:45:17 +00007539 vty_out (vty, " ip ospf dead-interval ");
7540
7541 /* fast hello ? */
7542 if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello))
7543 vty_out (vty, "minimal hello-multiplier %d",
7544 params->fast_hello);
7545 else
7546 vty_out (vty, "%u", params->v_wait);
7547
paul718e3742002-12-13 20:15:29 +00007548 if (params != IF_DEF_PARAMS (ifp))
7549 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7550 vty_out (vty, "%s", VTY_NEWLINE);
7551 }
7552
7553 /* Router Priority print. */
7554 if (OSPF_IF_PARAM_CONFIGURED (params, priority) &&
7555 params->priority != OSPF_ROUTER_PRIORITY_DEFAULT)
7556 {
7557 vty_out (vty, " ip ospf priority %u", params->priority);
7558 if (params != IF_DEF_PARAMS (ifp))
7559 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7560 vty_out (vty, "%s", VTY_NEWLINE);
7561 }
7562
7563 /* Retransmit Interval print. */
7564 if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) &&
7565 params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT)
7566 {
7567 vty_out (vty, " ip ospf retransmit-interval %u",
7568 params->retransmit_interval);
7569 if (params != IF_DEF_PARAMS (ifp))
7570 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7571 vty_out (vty, "%s", VTY_NEWLINE);
7572 }
7573
7574 /* Transmit Delay print. */
7575 if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) &&
7576 params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT)
7577 {
7578 vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay);
7579 if (params != IF_DEF_PARAMS (ifp))
7580 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7581 vty_out (vty, "%s", VTY_NEWLINE);
7582 }
7583
vincentba682532005-09-29 13:52:57 +00007584 /* MTU ignore print. */
7585 if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) &&
7586 params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT)
7587 {
7588 if (params->mtu_ignore == 0)
7589 vty_out (vty, " no ip ospf mtu-ignore");
7590 else
7591 vty_out (vty, " ip ospf mtu-ignore");
7592 if (params != IF_DEF_PARAMS (ifp))
7593 vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4));
7594 vty_out (vty, "%s", VTY_NEWLINE);
7595 }
7596
7597
paul718e3742002-12-13 20:15:29 +00007598 while (1)
7599 {
7600 if (rn == NULL)
7601 rn = route_top (IF_OIFS_PARAMS (ifp));
7602 else
7603 rn = route_next (rn);
7604
7605 if (rn == NULL)
7606 break;
7607 params = rn->info;
7608 if (params != NULL)
7609 break;
7610 }
7611 } while (rn);
7612
7613#ifdef HAVE_OPAQUE_LSA
7614 ospf_opaque_config_write_if (vty, ifp);
7615#endif /* HAVE_OPAQUE_LSA */
7616 }
7617
7618 return write;
7619}
7620
paul4dadc292005-05-06 21:37:42 +00007621static int
paul68980082003-03-25 05:07:42 +00007622config_write_network_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007623{
7624 struct route_node *rn;
7625 u_char buf[INET_ADDRSTRLEN];
7626
7627 /* `network area' print. */
paul68980082003-03-25 05:07:42 +00007628 for (rn = route_top (ospf->networks); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007629 if (rn->info)
7630 {
7631 struct ospf_network *n = rn->info;
7632
7633 memset (buf, 0, INET_ADDRSTRLEN);
7634
7635 /* Create Area ID string by specified Area ID format. */
7636 if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS)
hassoc9e52be2004-09-26 16:09:34 +00007637 strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN);
paul718e3742002-12-13 20:15:29 +00007638 else
hassoc9e52be2004-09-26 16:09:34 +00007639 sprintf ((char *) buf, "%lu",
paul718e3742002-12-13 20:15:29 +00007640 (unsigned long int) ntohl (n->area_id.s_addr));
7641
7642 /* Network print. */
7643 vty_out (vty, " network %s/%d area %s%s",
7644 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
7645 buf, VTY_NEWLINE);
7646 }
7647
7648 return 0;
7649}
7650
paul4dadc292005-05-06 21:37:42 +00007651static int
paul68980082003-03-25 05:07:42 +00007652config_write_ospf_area (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007653{
hasso52dc7ee2004-09-23 19:18:23 +00007654 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00007655 struct ospf_area *area;
paul718e3742002-12-13 20:15:29 +00007656 u_char buf[INET_ADDRSTRLEN];
7657
7658 /* Area configuration print. */
paul1eb8ef22005-04-07 07:30:20 +00007659 for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area))
paul718e3742002-12-13 20:15:29 +00007660 {
paul718e3742002-12-13 20:15:29 +00007661 struct route_node *rn1;
7662
hassoc9e52be2004-09-26 16:09:34 +00007663 area_id2str ((char *) buf, INET_ADDRSTRLEN, area);
paul718e3742002-12-13 20:15:29 +00007664
7665 if (area->auth_type != OSPF_AUTH_NULL)
7666 {
7667 if (area->auth_type == OSPF_AUTH_SIMPLE)
7668 vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE);
7669 else
7670 vty_out (vty, " area %s authentication message-digest%s",
7671 buf, VTY_NEWLINE);
7672 }
7673
7674 if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT)
7675 vty_out (vty, " area %s shortcut %s%s", buf,
7676 ospf_shortcut_mode_str[area->shortcut_configured],
7677 VTY_NEWLINE);
7678
7679 if ((area->external_routing == OSPF_AREA_STUB)
paul718e3742002-12-13 20:15:29 +00007680 || (area->external_routing == OSPF_AREA_NSSA)
paul718e3742002-12-13 20:15:29 +00007681 )
7682 {
paulb0a053b2003-06-22 09:04:47 +00007683 if (area->external_routing == OSPF_AREA_STUB)
paul718e3742002-12-13 20:15:29 +00007684 vty_out (vty, " area %s stub", buf);
paulb0a053b2003-06-22 09:04:47 +00007685 else if (area->external_routing == OSPF_AREA_NSSA)
7686 {
7687 vty_out (vty, " area %s nssa", buf);
7688 switch (area->NSSATranslatorRole)
7689 {
7690 case OSPF_NSSA_ROLE_NEVER:
7691 vty_out (vty, " translate-never");
7692 break;
7693 case OSPF_NSSA_ROLE_ALWAYS:
7694 vty_out (vty, " translate-always");
7695 break;
7696 case OSPF_NSSA_ROLE_CANDIDATE:
7697 default:
7698 vty_out (vty, " translate-candidate");
7699 }
7700 }
paul718e3742002-12-13 20:15:29 +00007701
7702 if (area->no_summary)
7703 vty_out (vty, " no-summary");
7704
7705 vty_out (vty, "%s", VTY_NEWLINE);
7706
7707 if (area->default_cost != 1)
7708 vty_out (vty, " area %s default-cost %d%s", buf,
7709 area->default_cost, VTY_NEWLINE);
7710 }
7711
7712 for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1))
7713 if (rn1->info)
7714 {
7715 struct ospf_area_range *range = rn1->info;
7716
7717 vty_out (vty, " area %s range %s/%d", buf,
7718 inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen);
7719
paul6c835672004-10-11 11:00:30 +00007720 if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC)
paul718e3742002-12-13 20:15:29 +00007721 vty_out (vty, " cost %d", range->cost_config);
7722
7723 if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE))
7724 vty_out (vty, " not-advertise");
7725
7726 if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE))
7727 vty_out (vty, " substitute %s/%d",
7728 inet_ntoa (range->subst_addr), range->subst_masklen);
7729
7730 vty_out (vty, "%s", VTY_NEWLINE);
7731 }
7732
7733 if (EXPORT_NAME (area))
7734 vty_out (vty, " area %s export-list %s%s", buf,
7735 EXPORT_NAME (area), VTY_NEWLINE);
7736
7737 if (IMPORT_NAME (area))
7738 vty_out (vty, " area %s import-list %s%s", buf,
7739 IMPORT_NAME (area), VTY_NEWLINE);
7740
7741 if (PREFIX_NAME_IN (area))
7742 vty_out (vty, " area %s filter-list prefix %s in%s", buf,
7743 PREFIX_NAME_IN (area), VTY_NEWLINE);
7744
7745 if (PREFIX_NAME_OUT (area))
7746 vty_out (vty, " area %s filter-list prefix %s out%s", buf,
7747 PREFIX_NAME_OUT (area), VTY_NEWLINE);
7748 }
7749
7750 return 0;
7751}
7752
paul4dadc292005-05-06 21:37:42 +00007753static int
paul68980082003-03-25 05:07:42 +00007754config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007755{
7756 struct ospf_nbr_nbma *nbr_nbma;
7757 struct route_node *rn;
7758
7759 /* Static Neighbor configuration print. */
paul68980082003-03-25 05:07:42 +00007760 for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007761 if ((nbr_nbma = rn->info))
7762 {
7763 vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr));
7764
7765 if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT)
7766 vty_out (vty, " priority %d", nbr_nbma->priority);
7767
7768 if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT)
7769 vty_out (vty, " poll-interval %d", nbr_nbma->v_poll);
7770
7771 vty_out (vty, "%s", VTY_NEWLINE);
7772 }
7773
7774 return 0;
7775}
7776
paul4dadc292005-05-06 21:37:42 +00007777static int
paul68980082003-03-25 05:07:42 +00007778config_write_virtual_link (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007779{
hasso52dc7ee2004-09-23 19:18:23 +00007780 struct listnode *node;
paul1eb8ef22005-04-07 07:30:20 +00007781 struct ospf_vl_data *vl_data;
paul718e3742002-12-13 20:15:29 +00007782 u_char buf[INET_ADDRSTRLEN];
7783
7784 /* Virtual-Link print */
paul1eb8ef22005-04-07 07:30:20 +00007785 for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data))
paul718e3742002-12-13 20:15:29 +00007786 {
hasso52dc7ee2004-09-23 19:18:23 +00007787 struct listnode *n2;
paul718e3742002-12-13 20:15:29 +00007788 struct crypt_key *ck;
paul718e3742002-12-13 20:15:29 +00007789 struct ospf_interface *oi;
7790
7791 if (vl_data != NULL)
7792 {
7793 memset (buf, 0, INET_ADDRSTRLEN);
7794
7795 if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS)
hassoc9e52be2004-09-26 16:09:34 +00007796 strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN);
paul718e3742002-12-13 20:15:29 +00007797 else
hassoc9e52be2004-09-26 16:09:34 +00007798 sprintf ((char *) buf, "%lu",
paul718e3742002-12-13 20:15:29 +00007799 (unsigned long int) ntohl (vl_data->vl_area_id.s_addr));
7800 oi = vl_data->vl_oi;
7801
7802 /* timers */
7803 if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT ||
7804 OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT ||
7805 OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT ||
7806 OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT)
7807 vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s",
7808 buf,
7809 inet_ntoa (vl_data->vl_peer),
7810 OSPF_IF_PARAM (oi, v_hello),
7811 OSPF_IF_PARAM (oi, retransmit_interval),
7812 OSPF_IF_PARAM (oi, transmit_delay),
7813 OSPF_IF_PARAM (oi, v_wait),
7814 VTY_NEWLINE);
7815 else
7816 vty_out (vty, " area %s virtual-link %s%s", buf,
7817 inet_ntoa (vl_data->vl_peer), VTY_NEWLINE);
7818 /* Auth key */
7819 if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0')
7820 vty_out (vty, " area %s virtual-link %s authentication-key %s%s",
7821 buf,
7822 inet_ntoa (vl_data->vl_peer),
7823 IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple,
7824 VTY_NEWLINE);
7825 /* md5 keys */
paul1eb8ef22005-04-07 07:30:20 +00007826 for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt,
7827 n2, ck))
7828 vty_out (vty, " area %s virtual-link %s"
7829 " message-digest-key %d md5 %s%s",
7830 buf,
7831 inet_ntoa (vl_data->vl_peer),
7832 ck->key_id, ck->auth_key, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007833
7834 }
7835 }
7836
7837 return 0;
7838}
7839
7840
paul4dadc292005-05-06 21:37:42 +00007841static int
paul68980082003-03-25 05:07:42 +00007842config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007843{
7844 int type;
7845
7846 /* redistribute print. */
7847 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
7848 if (type != zclient->redist_default && zclient->redist[type])
7849 {
ajsf52d13c2005-10-01 17:38:06 +00007850 vty_out (vty, " redistribute %s", zebra_route_string(type));
paul68980082003-03-25 05:07:42 +00007851 if (ospf->dmetric[type].value >= 0)
paul020709f2003-04-04 02:44:16 +00007852 vty_out (vty, " metric %d", ospf->dmetric[type].value);
paul718e3742002-12-13 20:15:29 +00007853
paul68980082003-03-25 05:07:42 +00007854 if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007855 vty_out (vty, " metric-type 1");
7856
paul020709f2003-04-04 02:44:16 +00007857 if (ROUTEMAP_NAME (ospf, type))
7858 vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type));
paul718e3742002-12-13 20:15:29 +00007859
7860 vty_out (vty, "%s", VTY_NEWLINE);
7861 }
7862
7863 return 0;
7864}
7865
paul4dadc292005-05-06 21:37:42 +00007866static int
paul68980082003-03-25 05:07:42 +00007867config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007868{
paul68980082003-03-25 05:07:42 +00007869 if (ospf->default_metric != -1)
7870 vty_out (vty, " default-metric %d%s", ospf->default_metric,
paul718e3742002-12-13 20:15:29 +00007871 VTY_NEWLINE);
7872 return 0;
7873}
7874
paul4dadc292005-05-06 21:37:42 +00007875static int
paul68980082003-03-25 05:07:42 +00007876config_write_ospf_distribute (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007877{
7878 int type;
7879
paul68980082003-03-25 05:07:42 +00007880 if (ospf)
paul718e3742002-12-13 20:15:29 +00007881 {
7882 /* distribute-list print. */
7883 for (type = 0; type < ZEBRA_ROUTE_MAX; type++)
Denis Ovsienko4f151e52011-09-10 16:40:23 +04007884 if (DISTRIBUTE_NAME (ospf, type))
paul718e3742002-12-13 20:15:29 +00007885 vty_out (vty, " distribute-list %s out %s%s",
Denis Ovsienko4f151e52011-09-10 16:40:23 +04007886 DISTRIBUTE_NAME (ospf, type),
ajsf52d13c2005-10-01 17:38:06 +00007887 zebra_route_string(type), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007888
7889 /* default-information print. */
paul68980082003-03-25 05:07:42 +00007890 if (ospf->default_originate != DEFAULT_ORIGINATE_NONE)
paul718e3742002-12-13 20:15:29 +00007891 {
paulc42c1772006-01-10 20:36:49 +00007892 vty_out (vty, " default-information originate");
7893 if (ospf->default_originate == DEFAULT_ORIGINATE_ALWAYS)
7894 vty_out (vty, " always");
paul718e3742002-12-13 20:15:29 +00007895
paul68980082003-03-25 05:07:42 +00007896 if (ospf->dmetric[DEFAULT_ROUTE].value >= 0)
paul718e3742002-12-13 20:15:29 +00007897 vty_out (vty, " metric %d",
paul68980082003-03-25 05:07:42 +00007898 ospf->dmetric[DEFAULT_ROUTE].value);
7899 if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1)
paul718e3742002-12-13 20:15:29 +00007900 vty_out (vty, " metric-type 1");
7901
paul020709f2003-04-04 02:44:16 +00007902 if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE))
7903 vty_out (vty, " route-map %s",
7904 ROUTEMAP_NAME (ospf, DEFAULT_ROUTE));
paul718e3742002-12-13 20:15:29 +00007905
7906 vty_out (vty, "%s", VTY_NEWLINE);
7907 }
7908
7909 }
7910
7911 return 0;
7912}
7913
paul4dadc292005-05-06 21:37:42 +00007914static int
paul68980082003-03-25 05:07:42 +00007915config_write_ospf_distance (struct vty *vty, struct ospf *ospf)
paul718e3742002-12-13 20:15:29 +00007916{
7917 struct route_node *rn;
7918 struct ospf_distance *odistance;
7919
paul68980082003-03-25 05:07:42 +00007920 if (ospf->distance_all)
7921 vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007922
paul68980082003-03-25 05:07:42 +00007923 if (ospf->distance_intra
7924 || ospf->distance_inter
7925 || ospf->distance_external)
paul718e3742002-12-13 20:15:29 +00007926 {
7927 vty_out (vty, " distance ospf");
7928
paul68980082003-03-25 05:07:42 +00007929 if (ospf->distance_intra)
7930 vty_out (vty, " intra-area %d", ospf->distance_intra);
7931 if (ospf->distance_inter)
7932 vty_out (vty, " inter-area %d", ospf->distance_inter);
7933 if (ospf->distance_external)
7934 vty_out (vty, " external %d", ospf->distance_external);
paul718e3742002-12-13 20:15:29 +00007935
7936 vty_out (vty, "%s", VTY_NEWLINE);
7937 }
7938
paul68980082003-03-25 05:07:42 +00007939 for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn))
paul718e3742002-12-13 20:15:29 +00007940 if ((odistance = rn->info) != NULL)
7941 {
7942 vty_out (vty, " distance %d %s/%d %s%s", odistance->distance,
7943 inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen,
7944 odistance->access_list ? odistance->access_list : "",
7945 VTY_NEWLINE);
7946 }
7947 return 0;
7948}
7949
7950/* OSPF configuration write function. */
paul4dadc292005-05-06 21:37:42 +00007951static int
paul718e3742002-12-13 20:15:29 +00007952ospf_config_write (struct vty *vty)
7953{
paul020709f2003-04-04 02:44:16 +00007954 struct ospf *ospf;
paul1eb8ef22005-04-07 07:30:20 +00007955 struct interface *ifp;
7956 struct ospf_interface *oi;
hasso52dc7ee2004-09-23 19:18:23 +00007957 struct listnode *node;
paul718e3742002-12-13 20:15:29 +00007958 int write = 0;
7959
paul020709f2003-04-04 02:44:16 +00007960 ospf = ospf_lookup ();
paul68980082003-03-25 05:07:42 +00007961 if (ospf != NULL)
paul718e3742002-12-13 20:15:29 +00007962 {
7963 /* `router ospf' print. */
7964 vty_out (vty, "router ospf%s", VTY_NEWLINE);
7965
7966 write++;
7967
paul68980082003-03-25 05:07:42 +00007968 if (!ospf->networks)
paul718e3742002-12-13 20:15:29 +00007969 return write;
7970
7971 /* Router ID print. */
paul68980082003-03-25 05:07:42 +00007972 if (ospf->router_id_static.s_addr != 0)
paul718e3742002-12-13 20:15:29 +00007973 vty_out (vty, " ospf router-id %s%s",
paul68980082003-03-25 05:07:42 +00007974 inet_ntoa (ospf->router_id_static), VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007975
7976 /* ABR type print. */
pauld57834f2005-07-12 20:04:22 +00007977 if (ospf->abr_type != OSPF_ABR_DEFAULT)
paul718e3742002-12-13 20:15:29 +00007978 vty_out (vty, " ospf abr-type %s%s",
paul68980082003-03-25 05:07:42 +00007979 ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00007980
Andrew J. Schorrd7e60dd2006-06-29 20:20:52 +00007981 /* log-adjacency-changes flag print. */
7982 if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES))
7983 {
7984 vty_out(vty, " log-adjacency-changes");
7985 if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL))
7986 vty_out(vty, " detail");
7987 vty_out(vty, "%s", VTY_NEWLINE);
7988 }
7989
paul718e3742002-12-13 20:15:29 +00007990 /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */
paul68980082003-03-25 05:07:42 +00007991 if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE))
paul718e3742002-12-13 20:15:29 +00007992 vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE);
7993
7994 /* auto-cost reference-bandwidth configuration. */
paul68980082003-03-25 05:07:42 +00007995 if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH)
paulf9ad9372005-10-21 00:45:17 +00007996 {
7997 vty_out (vty, "! Important: ensure reference bandwidth "
7998 "is consistent across all routers%s", VTY_NEWLINE);
7999 vty_out (vty, " auto-cost reference-bandwidth %d%s",
8000 ospf->ref_bandwidth / 1000, VTY_NEWLINE);
8001 }
paul718e3742002-12-13 20:15:29 +00008002
8003 /* SPF timers print. */
paul68980082003-03-25 05:07:42 +00008004 if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT ||
paulea4ffc92005-10-21 20:04:41 +00008005 ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT ||
8006 ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT)
8007 vty_out (vty, " timers throttle spf %d %d %d%s",
paul88d6cf32005-10-29 12:50:09 +00008008 ospf->spf_delay, ospf->spf_holdtime,
paulea4ffc92005-10-21 20:04:41 +00008009 ospf->spf_max_holdtime, VTY_NEWLINE);
paul88d6cf32005-10-29 12:50:09 +00008010
8011 /* Max-metric router-lsa print */
8012 config_write_stub_router (vty, ospf);
8013
paul718e3742002-12-13 20:15:29 +00008014 /* SPF refresh parameters print. */
paul68980082003-03-25 05:07:42 +00008015 if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT)
paul718e3742002-12-13 20:15:29 +00008016 vty_out (vty, " refresh timer %d%s",
paul68980082003-03-25 05:07:42 +00008017 ospf->lsa_refresh_interval, VTY_NEWLINE);
paul718e3742002-12-13 20:15:29 +00008018
8019 /* Redistribute information print. */
paul68980082003-03-25 05:07:42 +00008020 config_write_ospf_redistribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008021
8022 /* passive-interface print. */
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00008023 if (ospf->passive_interface_default == OSPF_IF_PASSIVE)
8024 vty_out (vty, " passive-interface default%s", VTY_NEWLINE);
8025
paul1eb8ef22005-04-07 07:30:20 +00008026 for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp))
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00008027 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)
8028 && IF_DEF_PARAMS (ifp)->passive_interface !=
8029 ospf->passive_interface_default)
8030 {
8031 vty_out (vty, " %spassive-interface %s%s",
8032 IF_DEF_PARAMS (ifp)->passive_interface ? "" : "no ",
8033 ifp->name, VTY_NEWLINE);
8034 }
paul1eb8ef22005-04-07 07:30:20 +00008035 for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi))
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00008036 {
8037 if (!OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface))
8038 continue;
8039 if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi->ifp),
8040 passive_interface))
8041 {
8042 if (oi->params->passive_interface == IF_DEF_PARAMS (oi->ifp)->passive_interface)
8043 continue;
8044 }
8045 else if (oi->params->passive_interface == ospf->passive_interface_default)
8046 continue;
8047
8048 vty_out (vty, " %spassive-interface %s %s%s",
8049 oi->params->passive_interface ? "" : "no ",
paul1eb8ef22005-04-07 07:30:20 +00008050 oi->ifp->name,
8051 inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE);
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00008052 }
paul718e3742002-12-13 20:15:29 +00008053
8054 /* Network area print. */
paul68980082003-03-25 05:07:42 +00008055 config_write_network_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008056
8057 /* Area config print. */
paul68980082003-03-25 05:07:42 +00008058 config_write_ospf_area (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008059
8060 /* static neighbor print. */
paul68980082003-03-25 05:07:42 +00008061 config_write_ospf_nbr_nbma (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008062
8063 /* Virtual-Link print. */
paul68980082003-03-25 05:07:42 +00008064 config_write_virtual_link (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008065
8066 /* Default metric configuration. */
paul68980082003-03-25 05:07:42 +00008067 config_write_ospf_default_metric (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008068
8069 /* Distribute-list and default-information print. */
paul68980082003-03-25 05:07:42 +00008070 config_write_ospf_distribute (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008071
8072 /* Distance configuration. */
paul68980082003-03-25 05:07:42 +00008073 config_write_ospf_distance (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008074
8075#ifdef HAVE_OPAQUE_LSA
paul68980082003-03-25 05:07:42 +00008076 ospf_opaque_config_write_router (vty, ospf);
paul718e3742002-12-13 20:15:29 +00008077#endif /* HAVE_OPAQUE_LSA */
8078 }
8079
8080 return write;
8081}
8082
8083void
paul4dadc292005-05-06 21:37:42 +00008084ospf_vty_show_init (void)
paul718e3742002-12-13 20:15:29 +00008085{
8086 /* "show ip ospf" commands. */
8087 install_element (VIEW_NODE, &show_ip_ospf_cmd);
8088 install_element (ENABLE_NODE, &show_ip_ospf_cmd);
8089
8090 /* "show ip ospf database" commands. */
8091 install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd);
8092 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd);
8093 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
8094 install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd);
8095 install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd);
8096 install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd);
8097 install_element (VIEW_NODE, &show_ip_ospf_database_cmd);
8098 install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd);
8099 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd);
8100 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd);
8101 install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd);
8102 install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd);
8103 install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd);
8104 install_element (ENABLE_NODE, &show_ip_ospf_database_cmd);
8105
8106 /* "show ip ospf interface" commands. */
8107 install_element (VIEW_NODE, &show_ip_ospf_interface_cmd);
8108 install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd);
8109
8110 /* "show ip ospf neighbor" commands. */
8111 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
8112 install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd);
8113 install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd);
8114 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
8115 install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd);
8116 install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd);
8117 install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd);
8118 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd);
8119 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd);
8120 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd);
8121 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd);
8122 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd);
8123 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd);
8124 install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd);
8125
8126 /* "show ip ospf route" commands. */
8127 install_element (VIEW_NODE, &show_ip_ospf_route_cmd);
8128 install_element (ENABLE_NODE, &show_ip_ospf_route_cmd);
paul718e3742002-12-13 20:15:29 +00008129 install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd);
8130 install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd);
paul718e3742002-12-13 20:15:29 +00008131}
8132
8133
8134/* ospfd's interface node. */
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08008135static struct cmd_node interface_node =
paul718e3742002-12-13 20:15:29 +00008136{
8137 INTERFACE_NODE,
8138 "%s(config-if)# ",
8139 1
8140};
8141
8142/* Initialization of OSPF interface. */
paul4dadc292005-05-06 21:37:42 +00008143static void
8144ospf_vty_if_init (void)
paul718e3742002-12-13 20:15:29 +00008145{
8146 /* Install interface node. */
8147 install_node (&interface_node, config_write_interface);
8148
8149 install_element (CONFIG_NODE, &interface_cmd);
paul32d24632003-05-23 09:25:20 +00008150 install_element (CONFIG_NODE, &no_interface_cmd);
paul718e3742002-12-13 20:15:29 +00008151 install_default (INTERFACE_NODE);
8152
8153 /* "description" commands. */
8154 install_element (INTERFACE_NODE, &interface_desc_cmd);
8155 install_element (INTERFACE_NODE, &no_interface_desc_cmd);
8156
8157 /* "ip ospf authentication" commands. */
8158 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd);
8159 install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd);
8160 install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd);
8161 install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd);
8162 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd);
8163 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd);
8164 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd);
8165 install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd);
8166 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd);
8167 install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd);
8168
8169 /* "ip ospf message-digest-key" commands. */
8170 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd);
8171 install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd);
8172 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd);
8173 install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd);
8174
8175 /* "ip ospf cost" commands. */
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04008176 install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd);
8177 install_element (INTERFACE_NODE, &ip_ospf_cost_u32_cmd);
Denis Ovsienko827341b2009-09-28 19:34:59 +04008178 install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd);
8179 install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_inet4_cmd);
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04008180 install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd);
paul718e3742002-12-13 20:15:29 +00008181 install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd);
8182
vincentba682532005-09-29 13:52:57 +00008183 /* "ip ospf mtu-ignore" commands. */
8184 install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd);
8185 install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd);
8186 install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd);
8187 install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd);
8188
paul718e3742002-12-13 20:15:29 +00008189 /* "ip ospf dead-interval" commands. */
8190 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd);
8191 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd);
paulf9ad9372005-10-21 00:45:17 +00008192 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd);
8193 install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd);
paul718e3742002-12-13 20:15:29 +00008194 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd);
8195 install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd);
paulf9ad9372005-10-21 00:45:17 +00008196
paul718e3742002-12-13 20:15:29 +00008197 /* "ip ospf hello-interval" commands. */
8198 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd);
8199 install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd);
8200 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd);
8201 install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd);
8202
8203 /* "ip ospf network" commands. */
8204 install_element (INTERFACE_NODE, &ip_ospf_network_cmd);
8205 install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd);
8206
8207 /* "ip ospf priority" commands. */
8208 install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd);
8209 install_element (INTERFACE_NODE, &ip_ospf_priority_cmd);
8210 install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd);
8211 install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd);
8212
8213 /* "ip ospf retransmit-interval" commands. */
8214 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd);
8215 install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd);
8216 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd);
8217 install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd);
8218
8219 /* "ip ospf transmit-delay" commands. */
8220 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd);
8221 install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd);
8222 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd);
8223 install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd);
8224
8225 /* These commands are compatibitliy for previous version. */
8226 install_element (INTERFACE_NODE, &ospf_authentication_key_cmd);
8227 install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd);
8228 install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd);
8229 install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd);
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04008230 install_element (INTERFACE_NODE, &ospf_cost_u32_cmd);
8231 install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd);
paul718e3742002-12-13 20:15:29 +00008232 install_element (INTERFACE_NODE, &no_ospf_cost_cmd);
Denis Ovsienko827341b2009-09-28 19:34:59 +04008233 install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd);
8234 install_element (INTERFACE_NODE, &no_ospf_cost_u32_inet4_cmd);
Denis Ovsienko9eff36b2009-04-10 18:51:24 +04008235 install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd);
paul718e3742002-12-13 20:15:29 +00008236 install_element (INTERFACE_NODE, &ospf_dead_interval_cmd);
8237 install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd);
8238 install_element (INTERFACE_NODE, &ospf_hello_interval_cmd);
8239 install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd);
8240 install_element (INTERFACE_NODE, &ospf_network_cmd);
8241 install_element (INTERFACE_NODE, &no_ospf_network_cmd);
8242 install_element (INTERFACE_NODE, &ospf_priority_cmd);
8243 install_element (INTERFACE_NODE, &no_ospf_priority_cmd);
8244 install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd);
8245 install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd);
8246 install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd);
8247 install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd);
8248}
8249
paul4dadc292005-05-06 21:37:42 +00008250static void
8251ospf_vty_zebra_init (void)
paul718e3742002-12-13 20:15:29 +00008252{
8253 install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd);
8254 install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd);
8255 install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd);
8256 install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd);
8257 install_element (OSPF_NODE, &ospf_redistribute_source_cmd);
8258 install_element (OSPF_NODE,
8259 &ospf_redistribute_source_metric_type_routemap_cmd);
8260 install_element (OSPF_NODE,
8261 &ospf_redistribute_source_type_metric_routemap_cmd);
8262 install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd);
8263 install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd);
8264 install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd);
8265
8266 install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd);
8267
8268 install_element (OSPF_NODE, &ospf_distribute_list_out_cmd);
8269 install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd);
8270
8271 install_element (OSPF_NODE,
8272 &ospf_default_information_originate_metric_type_cmd);
8273 install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd);
8274 install_element (OSPF_NODE,
8275 &ospf_default_information_originate_type_metric_cmd);
8276 install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd);
8277 install_element (OSPF_NODE, &ospf_default_information_originate_cmd);
8278 install_element (OSPF_NODE,
8279 &ospf_default_information_originate_always_metric_type_cmd);
8280 install_element (OSPF_NODE,
8281 &ospf_default_information_originate_always_metric_cmd);
8282 install_element (OSPF_NODE,
8283 &ospf_default_information_originate_always_cmd);
8284 install_element (OSPF_NODE,
8285 &ospf_default_information_originate_always_type_metric_cmd);
8286 install_element (OSPF_NODE,
8287 &ospf_default_information_originate_always_type_cmd);
8288
8289 install_element (OSPF_NODE,
8290 &ospf_default_information_originate_metric_type_routemap_cmd);
8291 install_element (OSPF_NODE,
8292 &ospf_default_information_originate_metric_routemap_cmd);
8293 install_element (OSPF_NODE,
8294 &ospf_default_information_originate_routemap_cmd);
8295 install_element (OSPF_NODE,
8296 &ospf_default_information_originate_type_metric_routemap_cmd);
8297 install_element (OSPF_NODE,
8298 &ospf_default_information_originate_type_routemap_cmd);
8299 install_element (OSPF_NODE,
8300 &ospf_default_information_originate_always_metric_type_routemap_cmd);
8301 install_element (OSPF_NODE,
8302 &ospf_default_information_originate_always_metric_routemap_cmd);
8303 install_element (OSPF_NODE,
8304 &ospf_default_information_originate_always_routemap_cmd);
8305 install_element (OSPF_NODE,
8306 &ospf_default_information_originate_always_type_metric_routemap_cmd);
8307 install_element (OSPF_NODE,
8308 &ospf_default_information_originate_always_type_routemap_cmd);
8309
8310 install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd);
8311
8312 install_element (OSPF_NODE, &ospf_default_metric_cmd);
8313 install_element (OSPF_NODE, &no_ospf_default_metric_cmd);
8314 install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd);
8315
8316 install_element (OSPF_NODE, &ospf_distance_cmd);
8317 install_element (OSPF_NODE, &no_ospf_distance_cmd);
8318 install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd);
8319 install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd);
8320 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd);
8321 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd);
8322 install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd);
8323 install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd);
8324 install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd);
8325 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd);
8326 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd);
8327 install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd);
8328 install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd);
8329 install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd);
8330 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd);
8331 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd);
8332 install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd);
8333 install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd);
8334#if 0
8335 install_element (OSPF_NODE, &ospf_distance_source_cmd);
8336 install_element (OSPF_NODE, &no_ospf_distance_source_cmd);
8337 install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd);
8338 install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd);
8339#endif /* 0 */
8340}
8341
Stephen Hemminger7fc626d2008-12-01 11:10:34 -08008342static struct cmd_node ospf_node =
paul718e3742002-12-13 20:15:29 +00008343{
8344 OSPF_NODE,
8345 "%s(config-router)# ",
8346 1
8347};
8348
8349
8350/* Install OSPF related vty commands. */
8351void
paul4dadc292005-05-06 21:37:42 +00008352ospf_vty_init (void)
paul718e3742002-12-13 20:15:29 +00008353{
8354 /* Install ospf top node. */
8355 install_node (&ospf_node, ospf_config_write);
8356
8357 /* "router ospf" commands. */
8358 install_element (CONFIG_NODE, &router_ospf_cmd);
8359 install_element (CONFIG_NODE, &no_router_ospf_cmd);
8360
8361 install_default (OSPF_NODE);
8362
8363 /* "ospf router-id" commands. */
8364 install_element (OSPF_NODE, &ospf_router_id_cmd);
8365 install_element (OSPF_NODE, &no_ospf_router_id_cmd);
paula2c62832003-04-23 17:01:31 +00008366 install_element (OSPF_NODE, &router_ospf_id_cmd);
8367 install_element (OSPF_NODE, &no_router_ospf_id_cmd);
paul718e3742002-12-13 20:15:29 +00008368
8369 /* "passive-interface" commands. */
paula2c62832003-04-23 17:01:31 +00008370 install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd);
8371 install_element (OSPF_NODE, &ospf_passive_interface_cmd);
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00008372 install_element (OSPF_NODE, &ospf_passive_interface_default_cmd);
paula2c62832003-04-23 17:01:31 +00008373 install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd);
8374 install_element (OSPF_NODE, &no_ospf_passive_interface_cmd);
Paul Jakma7ffa8fa2006-10-22 20:07:53 +00008375 install_element (OSPF_NODE, &no_ospf_passive_interface_default_cmd);
paul718e3742002-12-13 20:15:29 +00008376
8377 /* "ospf abr-type" commands. */
8378 install_element (OSPF_NODE, &ospf_abr_type_cmd);
8379 install_element (OSPF_NODE, &no_ospf_abr_type_cmd);
8380
Andrew J. Schorrd7e60dd2006-06-29 20:20:52 +00008381 /* "ospf log-adjacency-changes" commands. */
8382 install_element (OSPF_NODE, &ospf_log_adjacency_changes_cmd);
8383 install_element (OSPF_NODE, &ospf_log_adjacency_changes_detail_cmd);
8384 install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_cmd);
8385 install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_detail_cmd);
8386
paul718e3742002-12-13 20:15:29 +00008387 /* "ospf rfc1583-compatible" commands. */
8388 install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd);
8389 install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd);
8390 install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd);
8391 install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd);
8392
8393 /* "network area" commands. */
paula2c62832003-04-23 17:01:31 +00008394 install_element (OSPF_NODE, &ospf_network_area_cmd);
8395 install_element (OSPF_NODE, &no_ospf_network_area_cmd);
paul718e3742002-12-13 20:15:29 +00008396
8397 /* "area authentication" commands. */
paula2c62832003-04-23 17:01:31 +00008398 install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd);
8399 install_element (OSPF_NODE, &ospf_area_authentication_cmd);
8400 install_element (OSPF_NODE, &no_ospf_area_authentication_cmd);
paul718e3742002-12-13 20:15:29 +00008401
8402 /* "area range" commands. */
paula2c62832003-04-23 17:01:31 +00008403 install_element (OSPF_NODE, &ospf_area_range_cmd);
8404 install_element (OSPF_NODE, &ospf_area_range_advertise_cmd);
8405 install_element (OSPF_NODE, &ospf_area_range_cost_cmd);
8406 install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd);
8407 install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd);
8408 install_element (OSPF_NODE, &no_ospf_area_range_cmd);
8409 install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd);
8410 install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd);
8411 install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd);
8412 install_element (OSPF_NODE, &ospf_area_range_substitute_cmd);
8413 install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd);
paul718e3742002-12-13 20:15:29 +00008414
8415 /* "area virtual-link" commands. */
paula2c62832003-04-23 17:01:31 +00008416 install_element (OSPF_NODE, &ospf_area_vlink_cmd);
8417 install_element (OSPF_NODE, &no_ospf_area_vlink_cmd);
paul718e3742002-12-13 20:15:29 +00008418
paula2c62832003-04-23 17:01:31 +00008419 install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd);
8420 install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd);
paul718e3742002-12-13 20:15:29 +00008421
paula2c62832003-04-23 17:01:31 +00008422 install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd);
8423 install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd);
paul718e3742002-12-13 20:15:29 +00008424
paula2c62832003-04-23 17:01:31 +00008425 install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd);
8426 install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd);
paul718e3742002-12-13 20:15:29 +00008427
paula2c62832003-04-23 17:01:31 +00008428 install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd);
8429 install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd);
paul718e3742002-12-13 20:15:29 +00008430
paula2c62832003-04-23 17:01:31 +00008431 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd);
8432 install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd);
8433 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd);
paul718e3742002-12-13 20:15:29 +00008434
paula2c62832003-04-23 17:01:31 +00008435 install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd);
8436 install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd);
paul718e3742002-12-13 20:15:29 +00008437
paula2c62832003-04-23 17:01:31 +00008438 install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd);
8439 install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd);
paul718e3742002-12-13 20:15:29 +00008440
paula2c62832003-04-23 17:01:31 +00008441 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd);
8442 install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd);
8443 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd);
paul718e3742002-12-13 20:15:29 +00008444
paula2c62832003-04-23 17:01:31 +00008445 install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd);
8446 install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd);
8447 install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd);
paul718e3742002-12-13 20:15:29 +00008448
8449 /* "area stub" commands. */
paula2c62832003-04-23 17:01:31 +00008450 install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd);
8451 install_element (OSPF_NODE, &ospf_area_stub_cmd);
8452 install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd);
8453 install_element (OSPF_NODE, &no_ospf_area_stub_cmd);
paul718e3742002-12-13 20:15:29 +00008454
paul718e3742002-12-13 20:15:29 +00008455 /* "area nssa" commands. */
paula2c62832003-04-23 17:01:31 +00008456 install_element (OSPF_NODE, &ospf_area_nssa_cmd);
8457 install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd);
8458 install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd);
8459 install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd);
8460 install_element (OSPF_NODE, &no_ospf_area_nssa_cmd);
8461 install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd);
paul718e3742002-12-13 20:15:29 +00008462
paula2c62832003-04-23 17:01:31 +00008463 install_element (OSPF_NODE, &ospf_area_default_cost_cmd);
8464 install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd);
paul718e3742002-12-13 20:15:29 +00008465
paula2c62832003-04-23 17:01:31 +00008466 install_element (OSPF_NODE, &ospf_area_shortcut_cmd);
8467 install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd);
paul718e3742002-12-13 20:15:29 +00008468
paula2c62832003-04-23 17:01:31 +00008469 install_element (OSPF_NODE, &ospf_area_export_list_cmd);
8470 install_element (OSPF_NODE, &no_ospf_area_export_list_cmd);
paul718e3742002-12-13 20:15:29 +00008471
paula2c62832003-04-23 17:01:31 +00008472 install_element (OSPF_NODE, &ospf_area_filter_list_cmd);
8473 install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd);
paul718e3742002-12-13 20:15:29 +00008474
paula2c62832003-04-23 17:01:31 +00008475 install_element (OSPF_NODE, &ospf_area_import_list_cmd);
8476 install_element (OSPF_NODE, &no_ospf_area_import_list_cmd);
paul88d6cf32005-10-29 12:50:09 +00008477
8478 /* SPF timer commands */
paula2c62832003-04-23 17:01:31 +00008479 install_element (OSPF_NODE, &ospf_timers_spf_cmd);
8480 install_element (OSPF_NODE, &no_ospf_timers_spf_cmd);
pauld24f6e22005-10-21 09:23:12 +00008481 install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd);
8482 install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd);
8483
paul88d6cf32005-10-29 12:50:09 +00008484 /* refresh timer commands */
paula2c62832003-04-23 17:01:31 +00008485 install_element (OSPF_NODE, &ospf_refresh_timer_cmd);
8486 install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd);
8487 install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd);
paul718e3742002-12-13 20:15:29 +00008488
paul88d6cf32005-10-29 12:50:09 +00008489 /* max-metric commands */
8490 install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd);
8491 install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd);
8492 install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd);
8493 install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd);
8494 install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd);
8495 install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd);
8496
8497 /* reference bandwidth commands */
paula2c62832003-04-23 17:01:31 +00008498 install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd);
8499 install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd);
paul718e3742002-12-13 20:15:29 +00008500
8501 /* "neighbor" commands. */
paula2c62832003-04-23 17:01:31 +00008502 install_element (OSPF_NODE, &ospf_neighbor_cmd);
8503 install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd);
8504 install_element (OSPF_NODE, &ospf_neighbor_priority_cmd);
8505 install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd);
8506 install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd);
8507 install_element (OSPF_NODE, &no_ospf_neighbor_cmd);
8508 install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd);
8509 install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd);
paul718e3742002-12-13 20:15:29 +00008510
8511 /* Init interface related vty commands. */
8512 ospf_vty_if_init ();
8513
8514 /* Init zebra related vty commands. */
8515 ospf_vty_zebra_init ();
8516}