]>
Commit | Line | Data |
---|---|---|
718e3744 | 1 | /* OSPF VTY interface. |
ba682537 | 2 | * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com> |
718e3744 | 3 | * 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 | \f | |
eb1ce605 | 53 | const static char *ospf_network_type_str[] = |
718e3744 | 54 | { |
55 | "Null", | |
56 | "POINTOPOINT", | |
57 | "BROADCAST", | |
58 | "NBMA", | |
59 | "POINTOMULTIPOINT", | |
60 | "VIRTUALLINK", | |
61 | "LOOPBACK" | |
62 | }; | |
63 | ||
64 | \f | |
65 | /* Utility functions. */ | |
4dadc291 | 66 | static int |
6c835671 | 67 | ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) |
718e3744 | 68 | { |
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 | \f | |
4dadc291 | 95 | static int |
6c835671 | 96 | str2distribute_source (const char *str, int *source) |
718e3744 | 97 | { |
98 | /* Sanity check. */ | |
99 | if (str == NULL) | |
100 | return 0; | |
101 | ||
102 | if (strncmp (str, "k", 1) == 0) | |
103 | *source = ZEBRA_ROUTE_KERNEL; | |
104 | else if (strncmp (str, "c", 1) == 0) | |
105 | *source = ZEBRA_ROUTE_CONNECT; | |
106 | else if (strncmp (str, "s", 1) == 0) | |
107 | *source = ZEBRA_ROUTE_STATIC; | |
108 | else if (strncmp (str, "r", 1) == 0) | |
109 | *source = ZEBRA_ROUTE_RIP; | |
110 | else if (strncmp (str, "b", 1) == 0) | |
111 | *source = ZEBRA_ROUTE_BGP; | |
112 | else | |
113 | return 0; | |
114 | ||
115 | return 1; | |
116 | } | |
117 | ||
4dadc291 | 118 | static int |
6c835671 | 119 | str2metric (const char *str, int *metric) |
718e3744 | 120 | { |
121 | /* Sanity check. */ | |
122 | if (str == NULL) | |
123 | return 0; | |
124 | ||
125 | *metric = strtol (str, NULL, 10); | |
126 | if (*metric < 0 && *metric > 16777214) | |
127 | { | |
128 | /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */ | |
129 | return 0; | |
130 | } | |
131 | ||
132 | return 1; | |
133 | } | |
134 | ||
4dadc291 | 135 | static int |
6c835671 | 136 | str2metric_type (const char *str, int *metric_type) |
718e3744 | 137 | { |
138 | /* Sanity check. */ | |
139 | if (str == NULL) | |
140 | return 0; | |
141 | ||
142 | if (strncmp (str, "1", 1) == 0) | |
143 | *metric_type = EXTERNAL_METRIC_TYPE_1; | |
144 | else if (strncmp (str, "2", 1) == 0) | |
145 | *metric_type = EXTERNAL_METRIC_TYPE_2; | |
146 | else | |
147 | return 0; | |
148 | ||
149 | return 1; | |
150 | } | |
151 | ||
152 | int | |
153 | ospf_oi_count (struct interface *ifp) | |
154 | { | |
155 | struct route_node *rn; | |
156 | int i = 0; | |
157 | ||
158 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
159 | if (rn->info) | |
160 | i++; | |
161 | ||
162 | return i; | |
163 | } | |
164 | ||
165 | \f | |
166 | DEFUN (router_ospf, | |
167 | router_ospf_cmd, | |
168 | "router ospf", | |
169 | "Enable a routing process\n" | |
170 | "Start OSPF configuration\n") | |
171 | { | |
172 | vty->node = OSPF_NODE; | |
173 | vty->index = ospf_get (); | |
174 | ||
175 | return CMD_SUCCESS; | |
176 | } | |
177 | ||
178 | DEFUN (no_router_ospf, | |
179 | no_router_ospf_cmd, | |
180 | "no router ospf", | |
181 | NO_STR | |
182 | "Enable a routing process\n" | |
183 | "Start OSPF configuration\n") | |
184 | { | |
020709f9 | 185 | struct ospf *ospf; |
186 | ||
187 | ospf = ospf_lookup (); | |
188 | if (ospf == NULL) | |
718e3744 | 189 | { |
020709f9 | 190 | vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); |
718e3744 | 191 | return CMD_WARNING; |
192 | } | |
193 | ||
020709f9 | 194 | ospf_finish (ospf); |
718e3744 | 195 | |
196 | return CMD_SUCCESS; | |
197 | } | |
198 | ||
199 | DEFUN (ospf_router_id, | |
200 | ospf_router_id_cmd, | |
201 | "ospf router-id A.B.C.D", | |
202 | "OSPF specific commands\n" | |
203 | "router-id for the OSPF process\n" | |
204 | "OSPF router-id in IP address format\n") | |
205 | { | |
68980084 | 206 | struct ospf *ospf = vty->index; |
718e3744 | 207 | struct in_addr router_id; |
68980084 | 208 | int ret; |
718e3744 | 209 | |
210 | ret = inet_aton (argv[0], &router_id); | |
211 | if (!ret) | |
212 | { | |
213 | vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); | |
214 | return CMD_WARNING; | |
215 | } | |
216 | ||
68980084 | 217 | ospf->router_id_static = router_id; |
b29800a6 | 218 | |
219 | ospf_router_id_update (ospf); | |
220 | ||
718e3744 | 221 | return CMD_SUCCESS; |
222 | } | |
223 | ||
224 | ALIAS (ospf_router_id, | |
a2c62831 | 225 | router_ospf_id_cmd, |
718e3744 | 226 | "router-id A.B.C.D", |
227 | "router-id for the OSPF process\n" | |
228 | "OSPF router-id in IP address format\n") | |
229 | ||
230 | DEFUN (no_ospf_router_id, | |
231 | no_ospf_router_id_cmd, | |
232 | "no ospf router-id", | |
233 | NO_STR | |
234 | "OSPF specific commands\n" | |
235 | "router-id for the OSPF process\n") | |
236 | { | |
68980084 | 237 | struct ospf *ospf = vty->index; |
238 | ||
239 | ospf->router_id_static.s_addr = 0; | |
718e3744 | 240 | |
68980084 | 241 | ospf_router_id_update (ospf); |
718e3744 | 242 | |
243 | return CMD_SUCCESS; | |
244 | } | |
245 | ||
246 | ALIAS (no_ospf_router_id, | |
a2c62831 | 247 | no_router_ospf_id_cmd, |
718e3744 | 248 | "no router-id", |
249 | NO_STR | |
250 | "router-id for the OSPF process\n") | |
251 | ||
a2c62831 | 252 | DEFUN (ospf_passive_interface, |
253 | ospf_passive_interface_addr_cmd, | |
718e3744 | 254 | "passive-interface IFNAME A.B.C.D", |
255 | "Suppress routing updates on an interface\n" | |
256 | "Interface's name\n") | |
257 | { | |
258 | struct interface *ifp; | |
259 | struct in_addr addr; | |
260 | int ret; | |
261 | struct ospf_if_params *params; | |
ba6454ec | 262 | struct route_node *rn; |
718e3744 | 263 | |
264 | ifp = if_lookup_by_name (argv[0]); | |
265 | ||
266 | if (ifp == NULL) | |
267 | { | |
268 | vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE); | |
269 | return CMD_WARNING; | |
270 | } | |
271 | ||
272 | params = IF_DEF_PARAMS (ifp); | |
273 | ||
274 | if (argc == 2) | |
275 | { | |
276 | ret = inet_aton(argv[1], &addr); | |
277 | if (!ret) | |
278 | { | |
279 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
280 | VTY_NEWLINE); | |
281 | return CMD_WARNING; | |
282 | } | |
283 | ||
284 | params = ospf_get_if_params (ifp, addr); | |
285 | ospf_if_update_params (ifp, addr); | |
286 | } | |
287 | ||
288 | SET_IF_PARAM (params, passive_interface); | |
289 | params->passive_interface = OSPF_IF_PASSIVE; | |
ba6454ec | 290 | |
291 | /* XXX We should call ospf_if_set_multicast on exactly those | |
292 | * interfaces for which the passive property changed. It is too much | |
293 | * work to determine this set, so we do this for every interface. | |
294 | * This is safe and reasonable because ospf_if_set_multicast uses a | |
295 | * record of joined groups to avoid systems calls if the desired | |
296 | * memberships match the current memership. | |
297 | */ | |
298 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) | |
299 | { | |
300 | struct ospf_interface *oi = rn->info; | |
301 | ||
302 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) | |
303 | ospf_if_set_multicast(oi); | |
304 | } | |
305 | /* | |
306 | * XXX It is not clear what state transitions the interface needs to | |
307 | * undergo when going from active to passive. Fixing this will | |
308 | * require precise identification of interfaces having such a | |
309 | * transition. | |
310 | */ | |
311 | ||
718e3744 | 312 | return CMD_SUCCESS; |
313 | } | |
314 | ||
a2c62831 | 315 | ALIAS (ospf_passive_interface, |
316 | ospf_passive_interface_cmd, | |
718e3744 | 317 | "passive-interface IFNAME", |
318 | "Suppress routing updates on an interface\n" | |
319 | "Interface's name\n") | |
320 | ||
a2c62831 | 321 | DEFUN (no_ospf_passive_interface, |
322 | no_ospf_passive_interface_addr_cmd, | |
718e3744 | 323 | "no passive-interface IFNAME A.B.C.D", |
324 | NO_STR | |
325 | "Allow routing updates on an interface\n" | |
326 | "Interface's name\n") | |
327 | { | |
328 | struct interface *ifp; | |
329 | struct in_addr addr; | |
330 | struct ospf_if_params *params; | |
331 | int ret; | |
ba6454ec | 332 | struct route_node *rn; |
718e3744 | 333 | |
334 | ifp = if_lookup_by_name (argv[0]); | |
335 | ||
336 | if (ifp == NULL) | |
337 | { | |
338 | vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE); | |
339 | return CMD_WARNING; | |
340 | } | |
341 | ||
342 | params = IF_DEF_PARAMS (ifp); | |
343 | ||
344 | if (argc == 2) | |
345 | { | |
346 | ret = inet_aton(argv[1], &addr); | |
347 | if (!ret) | |
348 | { | |
349 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
350 | VTY_NEWLINE); | |
351 | return CMD_WARNING; | |
352 | } | |
353 | ||
354 | params = ospf_lookup_if_params (ifp, addr); | |
355 | if (params == NULL) | |
356 | return CMD_SUCCESS; | |
357 | } | |
358 | ||
359 | UNSET_IF_PARAM (params, passive_interface); | |
360 | params->passive_interface = OSPF_IF_ACTIVE; | |
361 | ||
362 | if (params != IF_DEF_PARAMS (ifp)) | |
363 | { | |
364 | ospf_free_if_params (ifp, addr); | |
365 | ospf_if_update_params (ifp, addr); | |
366 | } | |
ba6454ec | 367 | |
368 | /* XXX We should call ospf_if_set_multicast on exactly those | |
369 | * interfaces for which the passive property changed. It is too much | |
370 | * work to determine this set, so we do this for every interface. | |
371 | * This is safe and reasonable because ospf_if_set_multicast uses a | |
372 | * record of joined groups to avoid systems calls if the desired | |
373 | * memberships match the current memership. | |
374 | */ | |
375 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) | |
376 | { | |
377 | struct ospf_interface *oi = rn->info; | |
378 | ||
379 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE)) | |
380 | ospf_if_set_multicast(oi); | |
381 | } | |
382 | ||
718e3744 | 383 | return CMD_SUCCESS; |
384 | } | |
385 | ||
a2c62831 | 386 | ALIAS (no_ospf_passive_interface, |
387 | no_ospf_passive_interface_cmd, | |
718e3744 | 388 | "no passive-interface IFNAME", |
389 | NO_STR | |
390 | "Allow routing updates on an interface\n" | |
391 | "Interface's name\n") | |
392 | ||
a2c62831 | 393 | DEFUN (ospf_network_area, |
394 | ospf_network_area_cmd, | |
718e3744 | 395 | "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
396 | "Enable routing on an IP network\n" | |
397 | "OSPF network prefix\n" | |
398 | "Set the OSPF area ID\n" | |
399 | "OSPF area ID in IP address format\n" | |
400 | "OSPF area ID as a decimal value\n") | |
401 | { | |
402 | struct ospf *ospf= vty->index; | |
403 | struct prefix_ipv4 p; | |
404 | struct in_addr area_id; | |
405 | int ret, format; | |
406 | ||
407 | /* Get network prefix and Area ID. */ | |
408 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); | |
409 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); | |
410 | ||
411 | ret = ospf_network_set (ospf, &p, area_id); | |
412 | if (ret == 0) | |
413 | { | |
414 | vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); | |
415 | return CMD_WARNING; | |
416 | } | |
417 | ||
418 | return CMD_SUCCESS; | |
419 | } | |
420 | ||
a2c62831 | 421 | DEFUN (no_ospf_network_area, |
422 | no_ospf_network_area_cmd, | |
718e3744 | 423 | "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
424 | NO_STR | |
425 | "Enable routing on an IP network\n" | |
426 | "OSPF network prefix\n" | |
427 | "Set the OSPF area ID\n" | |
428 | "OSPF area ID in IP address format\n" | |
429 | "OSPF area ID as a decimal value\n") | |
430 | { | |
431 | struct ospf *ospf = (struct ospf *) vty->index; | |
432 | struct prefix_ipv4 p; | |
433 | struct in_addr area_id; | |
434 | int ret, format; | |
435 | ||
436 | /* Get network prefix and Area ID. */ | |
437 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); | |
438 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); | |
439 | ||
440 | ret = ospf_network_unset (ospf, &p, area_id); | |
441 | if (ret == 0) | |
442 | { | |
443 | vty_out (vty, "Can't find specified network area configuration.%s", | |
444 | VTY_NEWLINE); | |
445 | return CMD_WARNING; | |
446 | } | |
447 | ||
448 | return CMD_SUCCESS; | |
449 | } | |
450 | ||
451 | \f | |
a2c62831 | 452 | DEFUN (ospf_area_range, |
453 | ospf_area_range_cmd, | |
718e3744 | 454 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
455 | "OSPF area parameters\n" | |
456 | "OSPF area ID in IP address format\n" | |
457 | "OSPF area ID as a decimal value\n" | |
458 | "Summarize routes matching address/mask (border routers only)\n" | |
459 | "Area range prefix\n") | |
460 | { | |
461 | struct ospf *ospf = vty->index; | |
462 | struct prefix_ipv4 p; | |
463 | struct in_addr area_id; | |
464 | int format; | |
465 | u_int32_t cost; | |
466 | ||
467 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
468 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); | |
469 | ||
470 | ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); | |
471 | if (argc > 2) | |
472 | { | |
4dadc291 | 473 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
718e3744 | 474 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
475 | } | |
476 | ||
477 | return CMD_SUCCESS; | |
478 | } | |
479 | ||
a2c62831 | 480 | ALIAS (ospf_area_range, |
481 | ospf_area_range_advertise_cmd, | |
718e3744 | 482 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", |
483 | "OSPF area parameters\n" | |
484 | "OSPF area ID in IP address format\n" | |
485 | "OSPF area ID as a decimal value\n" | |
486 | "OSPF area range for route advertise (default)\n" | |
487 | "Area range prefix\n" | |
488 | "Advertise this range (default)\n") | |
489 | ||
a2c62831 | 490 | ALIAS (ospf_area_range, |
491 | ospf_area_range_cost_cmd, | |
718e3744 | 492 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
493 | "OSPF area parameters\n" | |
494 | "OSPF area ID in IP address format\n" | |
495 | "OSPF area ID as a decimal value\n" | |
496 | "Summarize routes matching address/mask (border routers only)\n" | |
497 | "Area range prefix\n" | |
498 | "User specified metric for this range\n" | |
499 | "Advertised metric for this range\n") | |
500 | ||
a2c62831 | 501 | ALIAS (ospf_area_range, |
502 | ospf_area_range_advertise_cost_cmd, | |
718e3744 | 503 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
504 | "OSPF area parameters\n" | |
505 | "OSPF area ID in IP address format\n" | |
506 | "OSPF area ID as a decimal value\n" | |
507 | "Summarize routes matching address/mask (border routers only)\n" | |
508 | "Area range prefix\n" | |
509 | "Advertise this range (default)\n" | |
510 | "User specified metric for this range\n" | |
511 | "Advertised metric for this range\n") | |
512 | ||
a2c62831 | 513 | DEFUN (ospf_area_range_not_advertise, |
514 | ospf_area_range_not_advertise_cmd, | |
718e3744 | 515 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise", |
516 | "OSPF area parameters\n" | |
517 | "OSPF area ID in IP address format\n" | |
518 | "OSPF area ID as a decimal value\n" | |
519 | "Summarize routes matching address/mask (border routers only)\n" | |
520 | "Area range prefix\n" | |
521 | "DoNotAdvertise this range\n") | |
522 | { | |
523 | struct ospf *ospf = vty->index; | |
524 | struct prefix_ipv4 p; | |
525 | struct in_addr area_id; | |
526 | int format; | |
527 | ||
528 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
529 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); | |
530 | ||
531 | ospf_area_range_set (ospf, area_id, &p, 0); | |
532 | ||
533 | return CMD_SUCCESS; | |
534 | } | |
535 | ||
a2c62831 | 536 | DEFUN (no_ospf_area_range, |
537 | no_ospf_area_range_cmd, | |
718e3744 | 538 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
539 | NO_STR | |
540 | "OSPF area parameters\n" | |
541 | "OSPF area ID in IP address format\n" | |
542 | "OSPF area ID as a decimal value\n" | |
543 | "Summarize routes matching address/mask (border routers only)\n" | |
544 | "Area range prefix\n") | |
545 | { | |
546 | struct ospf *ospf = vty->index; | |
547 | struct prefix_ipv4 p; | |
548 | struct in_addr area_id; | |
549 | int format; | |
550 | ||
551 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
552 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); | |
553 | ||
554 | ospf_area_range_unset (ospf, area_id, &p); | |
555 | ||
556 | return CMD_SUCCESS; | |
557 | } | |
558 | ||
a2c62831 | 559 | ALIAS (no_ospf_area_range, |
560 | no_ospf_area_range_advertise_cmd, | |
718e3744 | 561 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", |
562 | NO_STR | |
563 | "OSPF area parameters\n" | |
564 | "OSPF area ID in IP address format\n" | |
565 | "OSPF area ID as a decimal value\n" | |
566 | "Summarize routes matching address/mask (border routers only)\n" | |
567 | "Area range prefix\n" | |
568 | "Advertise this range (default)\n" | |
569 | "DoNotAdvertise this range\n") | |
570 | ||
a2c62831 | 571 | ALIAS (no_ospf_area_range, |
572 | no_ospf_area_range_cost_cmd, | |
718e3744 | 573 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
574 | NO_STR | |
575 | "OSPF area parameters\n" | |
576 | "OSPF area ID in IP address format\n" | |
577 | "OSPF area ID as a decimal value\n" | |
578 | "Summarize routes matching address/mask (border routers only)\n" | |
579 | "Area range prefix\n" | |
580 | "User specified metric for this range\n" | |
581 | "Advertised metric for this range\n") | |
582 | ||
a2c62831 | 583 | ALIAS (no_ospf_area_range, |
584 | no_ospf_area_range_advertise_cost_cmd, | |
718e3744 | 585 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
586 | NO_STR | |
587 | "OSPF area parameters\n" | |
588 | "OSPF area ID in IP address format\n" | |
589 | "OSPF area ID as a decimal value\n" | |
590 | "Summarize routes matching address/mask (border routers only)\n" | |
591 | "Area range prefix\n" | |
592 | "Advertise this range (default)\n" | |
593 | "User specified metric for this range\n" | |
594 | "Advertised metric for this range\n") | |
595 | \f | |
a2c62831 | 596 | DEFUN (ospf_area_range_substitute, |
597 | ospf_area_range_substitute_cmd, | |
718e3744 | 598 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
599 | "OSPF area parameters\n" | |
600 | "OSPF area ID in IP address format\n" | |
601 | "OSPF area ID as a decimal value\n" | |
602 | "Summarize routes matching address/mask (border routers only)\n" | |
603 | "Area range prefix\n" | |
604 | "Announce area range as another prefix\n" | |
605 | "Network prefix to be announced instead of range\n") | |
606 | { | |
607 | struct ospf *ospf = vty->index; | |
608 | struct prefix_ipv4 p, s; | |
609 | struct in_addr area_id; | |
610 | int format; | |
611 | ||
612 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
613 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); | |
614 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); | |
615 | ||
616 | ospf_area_range_substitute_set (ospf, area_id, &p, &s); | |
617 | ||
618 | return CMD_SUCCESS; | |
619 | } | |
620 | ||
a2c62831 | 621 | DEFUN (no_ospf_area_range_substitute, |
622 | no_ospf_area_range_substitute_cmd, | |
718e3744 | 623 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
624 | NO_STR | |
625 | "OSPF area parameters\n" | |
626 | "OSPF area ID in IP address format\n" | |
627 | "OSPF area ID as a decimal value\n" | |
628 | "Summarize routes matching address/mask (border routers only)\n" | |
629 | "Area range prefix\n" | |
630 | "Announce area range as another prefix\n" | |
631 | "Network prefix to be announced instead of range\n") | |
632 | { | |
633 | struct ospf *ospf = vty->index; | |
634 | struct prefix_ipv4 p, s; | |
635 | struct in_addr area_id; | |
636 | int format; | |
637 | ||
638 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
639 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); | |
640 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); | |
641 | ||
642 | ospf_area_range_substitute_unset (ospf, area_id, &p); | |
643 | ||
644 | return CMD_SUCCESS; | |
645 | } | |
646 | ||
647 | \f | |
648 | /* Command Handler Logic in VLink stuff is delicate!! | |
649 | ||
650 | ALTER AT YOUR OWN RISK!!!! | |
651 | ||
652 | Various dummy values are used to represent 'NoChange' state for | |
653 | VLink configuration NOT being changed by a VLink command, and | |
654 | special syntax is used within the command strings so that the | |
655 | typed in command verbs can be seen in the configuration command | |
656 | bacckend handler. This is to drastically reduce the verbeage | |
657 | required to coe up with a reasonably compatible Cisco VLink command | |
658 | ||
659 | - Matthew Grant <grantma@anathoth.gen.nz> | |
660 | Wed, 21 Feb 2001 15:13:52 +1300 | |
661 | */ | |
662 | ||
663 | ||
664 | /* Configuration data for virtual links | |
665 | */ | |
666 | struct ospf_vl_config_data { | |
667 | struct vty *vty; /* vty stuff */ | |
668 | struct in_addr area_id; /* area ID from command line */ | |
669 | int format; /* command line area ID format */ | |
670 | struct in_addr vl_peer; /* command line vl_peer */ | |
671 | int auth_type; /* Authehntication type, if given */ | |
672 | char *auth_key; /* simple password if present */ | |
673 | int crypto_key_id; /* Cryptographic key ID */ | |
674 | char *md5_key; /* MD5 authentication key */ | |
675 | int hello_interval; /* Obvious what these are... */ | |
676 | int retransmit_interval; | |
677 | int transmit_delay; | |
678 | int dead_interval; | |
679 | }; | |
680 | ||
4dadc291 | 681 | static void |
718e3744 | 682 | ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, |
683 | struct vty *vty) | |
684 | { | |
685 | memset (vl_config, 0, sizeof (struct ospf_vl_config_data)); | |
686 | vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN; | |
687 | vl_config->vty = vty; | |
688 | } | |
689 | ||
4dadc291 | 690 | static struct ospf_vl_data * |
68980084 | 691 | ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
718e3744 | 692 | { |
693 | struct ospf_area *area; | |
694 | struct ospf_vl_data *vl_data; | |
695 | struct vty *vty; | |
696 | struct in_addr area_id; | |
697 | ||
698 | vty = vl_config->vty; | |
699 | area_id = vl_config->area_id; | |
700 | ||
701 | if (area_id.s_addr == OSPF_AREA_BACKBONE) | |
702 | { | |
703 | vty_out (vty, | |
704 | "Configuring VLs over the backbone is not allowed%s", | |
705 | VTY_NEWLINE); | |
706 | return NULL; | |
707 | } | |
68980084 | 708 | area = ospf_area_get (ospf, area_id, vl_config->format); |
718e3744 | 709 | |
710 | if (area->external_routing != OSPF_AREA_DEFAULT) | |
711 | { | |
712 | if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) | |
713 | vty_out (vty, "Area %s is %s%s", | |
714 | inet_ntoa (area_id), | |
718e3744 | 715 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
718e3744 | 716 | VTY_NEWLINE); |
717 | else | |
718 | vty_out (vty, "Area %ld is %s%s", | |
719 | (u_long)ntohl (area_id.s_addr), | |
718e3744 | 720 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
718e3744 | 721 | VTY_NEWLINE); |
722 | return NULL; | |
723 | } | |
724 | ||
9c27ef9b | 725 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config->vl_peer)) == NULL) |
718e3744 | 726 | { |
727 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); | |
728 | if (vl_data->vl_oi == NULL) | |
729 | { | |
68980084 | 730 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
731 | ospf_vl_add (ospf, vl_data); | |
732 | ospf_spf_calculate_schedule (ospf); | |
718e3744 | 733 | } |
734 | } | |
735 | return vl_data; | |
736 | } | |
737 | ||
738 | ||
4dadc291 | 739 | static int |
718e3744 | 740 | ospf_vl_set_security (struct ospf_vl_data *vl_data, |
741 | struct ospf_vl_config_data *vl_config) | |
742 | { | |
743 | struct crypt_key *ck; | |
744 | struct vty *vty; | |
745 | struct interface *ifp = vl_data->vl_oi->ifp; | |
746 | ||
747 | vty = vl_config->vty; | |
748 | ||
749 | if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN) | |
750 | { | |
751 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); | |
752 | IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type; | |
753 | } | |
754 | ||
755 | if (vl_config->auth_key) | |
756 | { | |
757 | memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); | |
c9e52be3 | 758 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
718e3744 | 759 | OSPF_AUTH_SIMPLE_SIZE); |
760 | } | |
761 | else if (vl_config->md5_key) | |
762 | { | |
763 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id) | |
764 | != NULL) | |
765 | { | |
766 | vty_out (vty, "OSPF: Key %d already exists%s", | |
767 | vl_config->crypto_key_id, VTY_NEWLINE); | |
768 | return CMD_WARNING; | |
769 | } | |
770 | ck = ospf_crypt_key_new (); | |
771 | ck->key_id = vl_config->crypto_key_id; | |
772 | memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); | |
c9e52be3 | 773 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
718e3744 | 774 | |
775 | ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); | |
776 | } | |
777 | else if (vl_config->crypto_key_id != 0) | |
778 | { | |
779 | /* Delete a key */ | |
780 | ||
781 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, | |
782 | vl_config->crypto_key_id) == NULL) | |
783 | { | |
784 | vty_out (vty, "OSPF: Key %d does not exist%s", | |
785 | vl_config->crypto_key_id, VTY_NEWLINE); | |
786 | return CMD_WARNING; | |
787 | } | |
788 | ||
789 | ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id); | |
790 | ||
791 | } | |
792 | ||
793 | return CMD_SUCCESS; | |
794 | } | |
795 | ||
4dadc291 | 796 | static int |
718e3744 | 797 | ospf_vl_set_timers (struct ospf_vl_data *vl_data, |
798 | struct ospf_vl_config_data *vl_config) | |
799 | { | |
800 | struct interface *ifp = ifp = vl_data->vl_oi->ifp; | |
801 | /* Virtual Link data initialised to defaults, so only set | |
802 | if a value given */ | |
803 | if (vl_config->hello_interval) | |
804 | { | |
805 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); | |
806 | IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval; | |
807 | } | |
808 | ||
809 | if (vl_config->dead_interval) | |
810 | { | |
811 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait); | |
812 | IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval; | |
813 | } | |
814 | ||
815 | if (vl_config->retransmit_interval) | |
816 | { | |
817 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval); | |
818 | IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval; | |
819 | } | |
820 | ||
821 | if (vl_config->transmit_delay) | |
822 | { | |
823 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay); | |
824 | IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay; | |
825 | } | |
826 | ||
827 | return CMD_SUCCESS; | |
828 | } | |
829 | ||
830 | ||
831 | ||
832 | /* The business end of all of the above */ | |
4dadc291 | 833 | static int |
68980084 | 834 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
718e3744 | 835 | { |
836 | struct ospf_vl_data *vl_data; | |
837 | int ret; | |
838 | ||
68980084 | 839 | vl_data = ospf_find_vl_data (ospf, vl_config); |
718e3744 | 840 | if (!vl_data) |
841 | return CMD_WARNING; | |
842 | ||
843 | /* Process this one first as it can have a fatal result, which can | |
844 | only logically occur if the virtual link exists already | |
845 | Thus a command error does not result in a change to the | |
846 | running configuration such as unexpectedly altered timer | |
847 | values etc.*/ | |
848 | ret = ospf_vl_set_security (vl_data, vl_config); | |
849 | if (ret != CMD_SUCCESS) | |
850 | return ret; | |
851 | ||
852 | /* Set any time based parameters, these area already range checked */ | |
853 | ||
854 | ret = ospf_vl_set_timers (vl_data, vl_config); | |
855 | if (ret != CMD_SUCCESS) | |
856 | return ret; | |
857 | ||
858 | return CMD_SUCCESS; | |
859 | ||
860 | } | |
861 | ||
862 | /* This stuff exists to make specifying all the alias commands A LOT simpler | |
863 | */ | |
864 | #define VLINK_HELPSTR_IPADDR \ | |
865 | "OSPF area parameters\n" \ | |
866 | "OSPF area ID in IP address format\n" \ | |
867 | "OSPF area ID as a decimal value\n" \ | |
868 | "Configure a virtual link\n" \ | |
869 | "Router ID of the remote ABR\n" | |
870 | ||
871 | #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \ | |
872 | "Enable authentication on this virtual link\n" \ | |
873 | "dummy string \n" | |
874 | ||
875 | #define VLINK_HELPSTR_AUTHTYPE_ALL \ | |
876 | VLINK_HELPSTR_AUTHTYPE_SIMPLE \ | |
877 | "Use null authentication\n" \ | |
878 | "Use message-digest authentication\n" | |
879 | ||
880 | #define VLINK_HELPSTR_TIME_PARAM_NOSECS \ | |
881 | "Time between HELLO packets\n" \ | |
882 | "Time between retransmitting lost link state advertisements\n" \ | |
883 | "Link state transmit delay\n" \ | |
884 | "Interval after which a neighbor is declared dead\n" | |
885 | ||
886 | #define VLINK_HELPSTR_TIME_PARAM \ | |
887 | VLINK_HELPSTR_TIME_PARAM_NOSECS \ | |
888 | "Seconds\n" | |
889 | ||
890 | #define VLINK_HELPSTR_AUTH_SIMPLE \ | |
891 | "Authentication password (key)\n" \ | |
892 | "The OSPF password (key)" | |
893 | ||
894 | #define VLINK_HELPSTR_AUTH_MD5 \ | |
895 | "Message digest authentication password (key)\n" \ | |
896 | "dummy string \n" \ | |
897 | "Key ID\n" \ | |
898 | "Use MD5 algorithm\n" \ | |
899 | "The OSPF password (key)" | |
900 | ||
a2c62831 | 901 | DEFUN (ospf_area_vlink, |
902 | ospf_area_vlink_cmd, | |
718e3744 | 903 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
904 | VLINK_HELPSTR_IPADDR) | |
905 | { | |
68980084 | 906 | struct ospf *ospf = vty->index; |
718e3744 | 907 | struct ospf_vl_config_data vl_config; |
908 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; | |
909 | char md5_key[OSPF_AUTH_MD5_SIZE+1]; | |
910 | int i; | |
911 | int ret; | |
912 | ||
913 | ospf_vl_config_data_init(&vl_config, vty); | |
914 | ||
915 | /* Read off first 2 parameters and check them */ | |
916 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); | |
917 | if (ret < 0) | |
918 | { | |
919 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); | |
920 | return CMD_WARNING; | |
921 | } | |
922 | ||
923 | ret = inet_aton (argv[1], &vl_config.vl_peer); | |
924 | if (! ret) | |
925 | { | |
926 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", | |
927 | VTY_NEWLINE); | |
928 | return CMD_WARNING; | |
929 | } | |
930 | ||
931 | if (argc <=2) | |
932 | { | |
933 | /* Thats all folks! - BUGS B. strikes again!!!*/ | |
934 | ||
68980084 | 935 | return ospf_vl_set (ospf, &vl_config); |
718e3744 | 936 | } |
937 | ||
938 | /* Deal with other parameters */ | |
939 | for (i=2; i < argc; i++) | |
940 | { | |
941 | ||
942 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ | |
943 | ||
944 | switch (argv[i][0]) | |
945 | { | |
946 | ||
947 | case 'a': | |
948 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) | |
949 | { | |
950 | /* authentication-key - this option can occur anywhere on | |
951 | command line. At start of command line | |
952 | must check for authentication option. */ | |
953 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); | |
954 | strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); | |
955 | vl_config.auth_key = auth_key; | |
956 | i++; | |
957 | } | |
958 | else if (strncmp (argv[i], "authentication", 14) == 0) | |
959 | { | |
960 | /* authentication - this option can only occur at start | |
961 | of command line */ | |
962 | vl_config.auth_type = OSPF_AUTH_SIMPLE; | |
963 | if ((i+1) < argc) | |
964 | { | |
965 | if (strncmp (argv[i+1], "n", 1) == 0) | |
966 | { | |
967 | /* "authentication null" */ | |
968 | vl_config.auth_type = OSPF_AUTH_NULL; | |
969 | i++; | |
970 | } | |
971 | else if (strncmp (argv[i+1], "m", 1) == 0 | |
972 | && strcmp (argv[i+1], "message-digest-") != 0) | |
973 | { | |
974 | /* "authentication message-digest" */ | |
975 | vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; | |
976 | i++; | |
977 | } | |
978 | } | |
979 | } | |
980 | break; | |
981 | ||
982 | case 'm': | |
983 | /* message-digest-key */ | |
984 | i++; | |
985 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); | |
986 | if (vl_config.crypto_key_id < 0) | |
987 | return CMD_WARNING; | |
988 | i++; | |
989 | memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); | |
990 | strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); | |
991 | vl_config.md5_key = md5_key; | |
992 | break; | |
993 | ||
994 | case 'h': | |
995 | /* Hello interval */ | |
996 | i++; | |
997 | vl_config.hello_interval = strtol (argv[i], NULL, 10); | |
998 | if (vl_config.hello_interval < 0) | |
999 | return CMD_WARNING; | |
1000 | break; | |
1001 | ||
1002 | case 'r': | |
1003 | /* Retransmit Interval */ | |
1004 | i++; | |
1005 | vl_config.retransmit_interval = strtol (argv[i], NULL, 10); | |
1006 | if (vl_config.retransmit_interval < 0) | |
1007 | return CMD_WARNING; | |
1008 | break; | |
1009 | ||
1010 | case 't': | |
1011 | /* Transmit Delay */ | |
1012 | i++; | |
1013 | vl_config.transmit_delay = strtol (argv[i], NULL, 10); | |
1014 | if (vl_config.transmit_delay < 0) | |
1015 | return CMD_WARNING; | |
1016 | break; | |
1017 | ||
1018 | case 'd': | |
1019 | /* Dead Interval */ | |
1020 | i++; | |
1021 | vl_config.dead_interval = strtol (argv[i], NULL, 10); | |
1022 | if (vl_config.dead_interval < 0) | |
1023 | return CMD_WARNING; | |
1024 | break; | |
1025 | } | |
1026 | } | |
1027 | ||
1028 | ||
1029 | /* Action configuration */ | |
1030 | ||
68980084 | 1031 | return ospf_vl_set (ospf, &vl_config); |
718e3744 | 1032 | |
1033 | } | |
1034 | ||
a2c62831 | 1035 | DEFUN (no_ospf_area_vlink, |
1036 | no_ospf_area_vlink_cmd, | |
718e3744 | 1037 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
1038 | NO_STR | |
1039 | VLINK_HELPSTR_IPADDR) | |
1040 | { | |
68980084 | 1041 | struct ospf *ospf = vty->index; |
718e3744 | 1042 | struct ospf_area *area; |
1043 | struct ospf_vl_config_data vl_config; | |
1044 | struct ospf_vl_data *vl_data = NULL; | |
1045 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; | |
1046 | int i; | |
1047 | int ret, format; | |
1048 | ||
1049 | ospf_vl_config_data_init(&vl_config, vty); | |
1050 | ||
1051 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); | |
1052 | if (ret < 0) | |
1053 | { | |
1054 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); | |
1055 | return CMD_WARNING; | |
1056 | } | |
1057 | ||
68980084 | 1058 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
718e3744 | 1059 | if (!area) |
1060 | { | |
1061 | vty_out (vty, "Area does not exist%s", VTY_NEWLINE); | |
1062 | return CMD_WARNING; | |
1063 | } | |
1064 | ||
1065 | ret = inet_aton (argv[1], &vl_config.vl_peer); | |
1066 | if (! ret) | |
1067 | { | |
1068 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", | |
1069 | VTY_NEWLINE); | |
1070 | return CMD_WARNING; | |
1071 | } | |
1072 | ||
1073 | if (argc <=2) | |
1074 | { | |
1075 | /* Basic VLink no command */ | |
1076 | /* Thats all folks! - BUGS B. strikes again!!!*/ | |
9c27ef9b | 1077 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) |
68980084 | 1078 | ospf_vl_delete (ospf, vl_data); |
718e3744 | 1079 | |
68980084 | 1080 | ospf_area_check_free (ospf, vl_config.area_id); |
718e3744 | 1081 | |
1082 | return CMD_SUCCESS; | |
1083 | } | |
1084 | ||
1085 | /* If we are down here, we are reseting parameters */ | |
1086 | ||
1087 | /* Deal with other parameters */ | |
1088 | for (i=2; i < argc; i++) | |
1089 | { | |
718e3744 | 1090 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
1091 | ||
1092 | switch (argv[i][0]) | |
1093 | { | |
1094 | ||
1095 | case 'a': | |
1096 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) | |
1097 | { | |
1098 | /* authentication-key - this option can occur anywhere on | |
1099 | command line. At start of command line | |
1100 | must check for authentication option. */ | |
1101 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); | |
1102 | vl_config.auth_key = auth_key; | |
1103 | } | |
1104 | else if (strncmp (argv[i], "authentication", 14) == 0) | |
1105 | { | |
1106 | /* authentication - this option can only occur at start | |
1107 | of command line */ | |
1108 | vl_config.auth_type = OSPF_AUTH_NOTSET; | |
1109 | } | |
1110 | break; | |
1111 | ||
1112 | case 'm': | |
1113 | /* message-digest-key */ | |
1114 | /* Delete one key */ | |
1115 | i++; | |
1116 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); | |
1117 | if (vl_config.crypto_key_id < 0) | |
1118 | return CMD_WARNING; | |
1119 | vl_config.md5_key = NULL; | |
1120 | break; | |
1121 | ||
1122 | case 'h': | |
1123 | /* Hello interval */ | |
1124 | vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; | |
1125 | break; | |
1126 | ||
1127 | case 'r': | |
1128 | /* Retransmit Interval */ | |
1129 | vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; | |
1130 | break; | |
1131 | ||
1132 | case 't': | |
1133 | /* Transmit Delay */ | |
1134 | vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; | |
1135 | break; | |
1136 | ||
1137 | case 'd': | |
1138 | /* Dead Interval */ | |
1139 | i++; | |
1140 | vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; | |
1141 | break; | |
1142 | } | |
1143 | } | |
1144 | ||
1145 | ||
1146 | /* Action configuration */ | |
1147 | ||
68980084 | 1148 | return ospf_vl_set (ospf, &vl_config); |
718e3744 | 1149 | } |
1150 | ||
a2c62831 | 1151 | ALIAS (ospf_area_vlink, |
1152 | ospf_area_vlink_param1_cmd, | |
718e3744 | 1153 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1154 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", | |
1155 | VLINK_HELPSTR_IPADDR | |
1156 | VLINK_HELPSTR_TIME_PARAM) | |
1157 | ||
a2c62831 | 1158 | ALIAS (no_ospf_area_vlink, |
1159 | no_ospf_area_vlink_param1_cmd, | |
718e3744 | 1160 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1161 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", | |
1162 | NO_STR | |
1163 | VLINK_HELPSTR_IPADDR | |
1164 | VLINK_HELPSTR_TIME_PARAM) | |
1165 | ||
a2c62831 | 1166 | ALIAS (ospf_area_vlink, |
1167 | ospf_area_vlink_param2_cmd, | |
718e3744 | 1168 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1169 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " | |
1170 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", | |
1171 | VLINK_HELPSTR_IPADDR | |
1172 | VLINK_HELPSTR_TIME_PARAM | |
1173 | VLINK_HELPSTR_TIME_PARAM) | |
1174 | ||
a2c62831 | 1175 | ALIAS (no_ospf_area_vlink, |
1176 | no_ospf_area_vlink_param2_cmd, | |
718e3744 | 1177 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1178 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " | |
1179 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", | |
1180 | NO_STR | |
1181 | VLINK_HELPSTR_IPADDR | |
1182 | VLINK_HELPSTR_TIME_PARAM | |
1183 | VLINK_HELPSTR_TIME_PARAM) | |
1184 | ||
a2c62831 | 1185 | ALIAS (ospf_area_vlink, |
1186 | ospf_area_vlink_param3_cmd, | |
718e3744 | 1187 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1188 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " | |
1189 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " | |
1190 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", | |
1191 | VLINK_HELPSTR_IPADDR | |
1192 | VLINK_HELPSTR_TIME_PARAM | |
1193 | VLINK_HELPSTR_TIME_PARAM | |
1194 | VLINK_HELPSTR_TIME_PARAM) | |
1195 | ||
a2c62831 | 1196 | ALIAS (no_ospf_area_vlink, |
1197 | no_ospf_area_vlink_param3_cmd, | |
718e3744 | 1198 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1199 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " | |
1200 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " | |
1201 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", | |
1202 | NO_STR | |
1203 | VLINK_HELPSTR_IPADDR | |
1204 | VLINK_HELPSTR_TIME_PARAM | |
1205 | VLINK_HELPSTR_TIME_PARAM | |
1206 | VLINK_HELPSTR_TIME_PARAM) | |
1207 | ||
a2c62831 | 1208 | ALIAS (ospf_area_vlink, |
1209 | ospf_area_vlink_param4_cmd, | |
718e3744 | 1210 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1211 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " | |
1212 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " | |
1213 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " | |
1214 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", | |
1215 | VLINK_HELPSTR_IPADDR | |
1216 | VLINK_HELPSTR_TIME_PARAM | |
1217 | VLINK_HELPSTR_TIME_PARAM | |
1218 | VLINK_HELPSTR_TIME_PARAM | |
1219 | VLINK_HELPSTR_TIME_PARAM) | |
1220 | ||
a2c62831 | 1221 | ALIAS (no_ospf_area_vlink, |
1222 | no_ospf_area_vlink_param4_cmd, | |
718e3744 | 1223 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1224 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " | |
1225 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " | |
1226 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " | |
1227 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", | |
1228 | NO_STR | |
1229 | VLINK_HELPSTR_IPADDR | |
1230 | VLINK_HELPSTR_TIME_PARAM | |
1231 | VLINK_HELPSTR_TIME_PARAM | |
1232 | VLINK_HELPSTR_TIME_PARAM | |
1233 | VLINK_HELPSTR_TIME_PARAM) | |
1234 | ||
a2c62831 | 1235 | ALIAS (ospf_area_vlink, |
1236 | ospf_area_vlink_authtype_args_cmd, | |
718e3744 | 1237 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1238 | "(authentication|) (message-digest|null)", | |
1239 | VLINK_HELPSTR_IPADDR | |
1240 | VLINK_HELPSTR_AUTHTYPE_ALL) | |
1241 | ||
a2c62831 | 1242 | ALIAS (ospf_area_vlink, |
1243 | ospf_area_vlink_authtype_cmd, | |
718e3744 | 1244 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1245 | "(authentication|)", | |
1246 | VLINK_HELPSTR_IPADDR | |
1247 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) | |
1248 | ||
a2c62831 | 1249 | ALIAS (no_ospf_area_vlink, |
1250 | no_ospf_area_vlink_authtype_cmd, | |
718e3744 | 1251 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1252 | "(authentication|)", | |
1253 | NO_STR | |
1254 | VLINK_HELPSTR_IPADDR | |
1255 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) | |
1256 | ||
a2c62831 | 1257 | ALIAS (ospf_area_vlink, |
1258 | ospf_area_vlink_md5_cmd, | |
718e3744 | 1259 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1260 | "(message-digest-key|) <1-255> md5 KEY", | |
1261 | VLINK_HELPSTR_IPADDR | |
1262 | VLINK_HELPSTR_AUTH_MD5) | |
1263 | ||
a2c62831 | 1264 | ALIAS (no_ospf_area_vlink, |
1265 | no_ospf_area_vlink_md5_cmd, | |
718e3744 | 1266 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1267 | "(message-digest-key|) <1-255>", | |
1268 | NO_STR | |
1269 | VLINK_HELPSTR_IPADDR | |
1270 | VLINK_HELPSTR_AUTH_MD5) | |
1271 | ||
a2c62831 | 1272 | ALIAS (ospf_area_vlink, |
1273 | ospf_area_vlink_authkey_cmd, | |
718e3744 | 1274 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1275 | "(authentication-key|) AUTH_KEY", | |
1276 | VLINK_HELPSTR_IPADDR | |
1277 | VLINK_HELPSTR_AUTH_SIMPLE) | |
1278 | ||
a2c62831 | 1279 | ALIAS (no_ospf_area_vlink, |
1280 | no_ospf_area_vlink_authkey_cmd, | |
718e3744 | 1281 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1282 | "(authentication-key|)", | |
1283 | NO_STR | |
1284 | VLINK_HELPSTR_IPADDR | |
1285 | VLINK_HELPSTR_AUTH_SIMPLE) | |
1286 | ||
a2c62831 | 1287 | ALIAS (ospf_area_vlink, |
1288 | ospf_area_vlink_authtype_args_authkey_cmd, | |
718e3744 | 1289 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1290 | "(authentication|) (message-digest|null) " | |
1291 | "(authentication-key|) AUTH_KEY", | |
1292 | VLINK_HELPSTR_IPADDR | |
1293 | VLINK_HELPSTR_AUTHTYPE_ALL | |
1294 | VLINK_HELPSTR_AUTH_SIMPLE) | |
1295 | ||
a2c62831 | 1296 | ALIAS (ospf_area_vlink, |
1297 | ospf_area_vlink_authtype_authkey_cmd, | |
718e3744 | 1298 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1299 | "(authentication|) " | |
1300 | "(authentication-key|) AUTH_KEY", | |
1301 | VLINK_HELPSTR_IPADDR | |
1302 | VLINK_HELPSTR_AUTHTYPE_SIMPLE | |
1303 | VLINK_HELPSTR_AUTH_SIMPLE) | |
1304 | ||
a2c62831 | 1305 | ALIAS (no_ospf_area_vlink, |
1306 | no_ospf_area_vlink_authtype_authkey_cmd, | |
718e3744 | 1307 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1308 | "(authentication|) " | |
1309 | "(authentication-key|)", | |
1310 | NO_STR | |
1311 | VLINK_HELPSTR_IPADDR | |
1312 | VLINK_HELPSTR_AUTHTYPE_SIMPLE | |
1313 | VLINK_HELPSTR_AUTH_SIMPLE) | |
1314 | ||
a2c62831 | 1315 | ALIAS (ospf_area_vlink, |
1316 | ospf_area_vlink_authtype_args_md5_cmd, | |
718e3744 | 1317 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1318 | "(authentication|) (message-digest|null) " | |
1319 | "(message-digest-key|) <1-255> md5 KEY", | |
1320 | VLINK_HELPSTR_IPADDR | |
1321 | VLINK_HELPSTR_AUTHTYPE_ALL | |
1322 | VLINK_HELPSTR_AUTH_MD5) | |
1323 | ||
a2c62831 | 1324 | ALIAS (ospf_area_vlink, |
1325 | ospf_area_vlink_authtype_md5_cmd, | |
718e3744 | 1326 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1327 | "(authentication|) " | |
1328 | "(message-digest-key|) <1-255> md5 KEY", | |
1329 | VLINK_HELPSTR_IPADDR | |
1330 | VLINK_HELPSTR_AUTHTYPE_SIMPLE | |
1331 | VLINK_HELPSTR_AUTH_MD5) | |
1332 | ||
a2c62831 | 1333 | ALIAS (no_ospf_area_vlink, |
1334 | no_ospf_area_vlink_authtype_md5_cmd, | |
718e3744 | 1335 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
1336 | "(authentication|) " | |
1337 | "(message-digest-key|)", | |
1338 | NO_STR | |
1339 | VLINK_HELPSTR_IPADDR | |
1340 | VLINK_HELPSTR_AUTHTYPE_SIMPLE | |
1341 | VLINK_HELPSTR_AUTH_MD5) | |
1342 | ||
1343 | \f | |
a2c62831 | 1344 | DEFUN (ospf_area_shortcut, |
1345 | ospf_area_shortcut_cmd, | |
718e3744 | 1346 | "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", |
1347 | "OSPF area parameters\n" | |
1348 | "OSPF area ID in IP address format\n" | |
1349 | "OSPF area ID as a decimal value\n" | |
1350 | "Configure the area's shortcutting mode\n" | |
1351 | "Set default shortcutting behavior\n" | |
1352 | "Enable shortcutting through the area\n" | |
1353 | "Disable shortcutting through the area\n") | |
1354 | { | |
68980084 | 1355 | struct ospf *ospf = vty->index; |
718e3744 | 1356 | struct ospf_area *area; |
1357 | struct in_addr area_id; | |
1358 | int mode; | |
1359 | int format; | |
1360 | ||
1361 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); | |
1362 | ||
68980084 | 1363 | area = ospf_area_get (ospf, area_id, format); |
718e3744 | 1364 | |
1365 | if (strncmp (argv[1], "de", 2) == 0) | |
1366 | mode = OSPF_SHORTCUT_DEFAULT; | |
1367 | else if (strncmp (argv[1], "di", 2) == 0) | |
1368 | mode = OSPF_SHORTCUT_DISABLE; | |
1369 | else if (strncmp (argv[1], "e", 1) == 0) | |
1370 | mode = OSPF_SHORTCUT_ENABLE; | |
1371 | else | |
1372 | return CMD_WARNING; | |
1373 | ||
68980084 | 1374 | ospf_area_shortcut_set (ospf, area, mode); |
718e3744 | 1375 | |
68980084 | 1376 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
718e3744 | 1377 | vty_out (vty, "Shortcut area setting will take effect " |
1378 | "only when the router is configured as Shortcut ABR%s", | |
1379 | VTY_NEWLINE); | |
1380 | ||
1381 | return CMD_SUCCESS; | |
1382 | } | |
1383 | ||
a2c62831 | 1384 | DEFUN (no_ospf_area_shortcut, |
1385 | no_ospf_area_shortcut_cmd, | |
718e3744 | 1386 | "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", |
1387 | NO_STR | |
1388 | "OSPF area parameters\n" | |
1389 | "OSPF area ID in IP address format\n" | |
1390 | "OSPF area ID as a decimal value\n" | |
1391 | "Deconfigure the area's shortcutting mode\n" | |
1392 | "Deconfigure enabled shortcutting through the area\n" | |
1393 | "Deconfigure disabled shortcutting through the area\n") | |
1394 | { | |
68980084 | 1395 | struct ospf *ospf = vty->index; |
718e3744 | 1396 | struct ospf_area *area; |
1397 | struct in_addr area_id; | |
1398 | int format; | |
1399 | ||
1400 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); | |
1401 | ||
68980084 | 1402 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
718e3744 | 1403 | if (!area) |
1404 | return CMD_SUCCESS; | |
1405 | ||
68980084 | 1406 | ospf_area_shortcut_unset (ospf, area); |
718e3744 | 1407 | |
1408 | return CMD_SUCCESS; | |
1409 | } | |
1410 | ||
1411 | \f | |
a2c62831 | 1412 | DEFUN (ospf_area_stub, |
1413 | ospf_area_stub_cmd, | |
718e3744 | 1414 | "area (A.B.C.D|<0-4294967295>) stub", |
1415 | "OSPF area parameters\n" | |
1416 | "OSPF area ID in IP address format\n" | |
1417 | "OSPF area ID as a decimal value\n" | |
1418 | "Configure OSPF area as stub\n") | |
1419 | { | |
1420 | struct ospf *ospf = vty->index; | |
1421 | struct in_addr area_id; | |
1422 | int ret, format; | |
1423 | ||
1424 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); | |
1425 | ||
1426 | ret = ospf_area_stub_set (ospf, area_id); | |
1427 | if (ret == 0) | |
1428 | { | |
1429 | vty_out (vty, "First deconfigure all virtual link through this area%s", | |
1430 | VTY_NEWLINE); | |
1431 | return CMD_WARNING; | |
1432 | } | |
1433 | ||
1434 | ospf_area_no_summary_unset (ospf, area_id); | |
1435 | ||
1436 | return CMD_SUCCESS; | |
1437 | } | |
1438 | ||
a2c62831 | 1439 | DEFUN (ospf_area_stub_no_summary, |
1440 | ospf_area_stub_no_summary_cmd, | |
718e3744 | 1441 | "area (A.B.C.D|<0-4294967295>) stub no-summary", |
1442 | "OSPF stub parameters\n" | |
1443 | "OSPF area ID in IP address format\n" | |
1444 | "OSPF area ID as a decimal value\n" | |
1445 | "Configure OSPF area as stub\n" | |
1446 | "Do not inject inter-area routes into stub\n") | |
1447 | { | |
1448 | struct ospf *ospf = vty->index; | |
1449 | struct in_addr area_id; | |
1450 | int ret, format; | |
1451 | ||
1452 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); | |
1453 | ||
1454 | ret = ospf_area_stub_set (ospf, area_id); | |
1455 | if (ret == 0) | |
1456 | { | |
b0a053be | 1457 | vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s", |
718e3744 | 1458 | VTY_NEWLINE); |
1459 | return CMD_WARNING; | |
1460 | } | |
1461 | ||
1462 | ospf_area_no_summary_set (ospf, area_id); | |
1463 | ||
1464 | return CMD_SUCCESS; | |
1465 | } | |
1466 | ||
a2c62831 | 1467 | DEFUN (no_ospf_area_stub, |
1468 | no_ospf_area_stub_cmd, | |
718e3744 | 1469 | "no area (A.B.C.D|<0-4294967295>) stub", |
1470 | NO_STR | |
1471 | "OSPF area parameters\n" | |
1472 | "OSPF area ID in IP address format\n" | |
1473 | "OSPF area ID as a decimal value\n" | |
1474 | "Configure OSPF area as stub\n") | |
1475 | { | |
1476 | struct ospf *ospf = vty->index; | |
1477 | struct in_addr area_id; | |
1478 | int format; | |
1479 | ||
1480 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); | |
1481 | ||
1482 | ospf_area_stub_unset (ospf, area_id); | |
1483 | ospf_area_no_summary_unset (ospf, area_id); | |
1484 | ||
1485 | return CMD_SUCCESS; | |
1486 | } | |
1487 | ||
a2c62831 | 1488 | DEFUN (no_ospf_area_stub_no_summary, |
1489 | no_ospf_area_stub_no_summary_cmd, | |
718e3744 | 1490 | "no area (A.B.C.D|<0-4294967295>) stub no-summary", |
1491 | NO_STR | |
1492 | "OSPF area parameters\n" | |
1493 | "OSPF area ID in IP address format\n" | |
1494 | "OSPF area ID as a decimal value\n" | |
1495 | "Configure OSPF area as stub\n" | |
1496 | "Do not inject inter-area routes into area\n") | |
1497 | { | |
1498 | struct ospf *ospf = vty->index; | |
1499 | struct in_addr area_id; | |
1500 | int format; | |
1501 | ||
1502 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); | |
1503 | ospf_area_no_summary_unset (ospf, area_id); | |
1504 | ||
1505 | return CMD_SUCCESS; | |
1506 | } | |
1507 | ||
4dadc291 | 1508 | static int |
6c835671 | 1509 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
1510 | int nosum) | |
718e3744 | 1511 | { |
1512 | struct ospf *ospf = vty->index; | |
1513 | struct in_addr area_id; | |
1514 | int ret, format; | |
1515 | ||
1516 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); | |
1517 | ||
1518 | ret = ospf_area_nssa_set (ospf, area_id); | |
1519 | if (ret == 0) | |
1520 | { | |
1521 | vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", | |
1522 | VTY_NEWLINE); | |
1523 | return CMD_WARNING; | |
1524 | } | |
1525 | ||
1526 | if (argc > 1) | |
1527 | { | |
1528 | if (strncmp (argv[1], "translate-c", 11) == 0) | |
b0a053be | 1529 | ospf_area_nssa_translator_role_set (ospf, area_id, |
718e3744 | 1530 | OSPF_NSSA_ROLE_CANDIDATE); |
1531 | else if (strncmp (argv[1], "translate-n", 11) == 0) | |
b0a053be | 1532 | ospf_area_nssa_translator_role_set (ospf, area_id, |
718e3744 | 1533 | OSPF_NSSA_ROLE_NEVER); |
1534 | else if (strncmp (argv[1], "translate-a", 11) == 0) | |
b0a053be | 1535 | ospf_area_nssa_translator_role_set (ospf, area_id, |
718e3744 | 1536 | OSPF_NSSA_ROLE_ALWAYS); |
1537 | } | |
b0a053be | 1538 | else |
1539 | { | |
1540 | ospf_area_nssa_translator_role_set (ospf, area_id, | |
1541 | OSPF_NSSA_ROLE_CANDIDATE); | |
1542 | } | |
718e3744 | 1543 | |
b0a053be | 1544 | if (nosum) |
718e3744 | 1545 | ospf_area_no_summary_set (ospf, area_id); |
b0a053be | 1546 | else |
1547 | ospf_area_no_summary_unset (ospf, area_id); | |
718e3744 | 1548 | |
b0a053be | 1549 | ospf_schedule_abr_task (ospf); |
1550 | ||
718e3744 | 1551 | return CMD_SUCCESS; |
1552 | } | |
1553 | ||
b0a053be | 1554 | DEFUN (ospf_area_nssa_translate_no_summary, |
a2c62831 | 1555 | ospf_area_nssa_translate_no_summary_cmd, |
b0a053be | 1556 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary", |
718e3744 | 1557 | "OSPF area parameters\n" |
1558 | "OSPF area ID in IP address format\n" | |
1559 | "OSPF area ID as a decimal value\n" | |
1560 | "Configure OSPF area as nssa\n" | |
1561 | "Configure NSSA-ABR for translate election (default)\n" | |
1562 | "Configure NSSA-ABR to never translate\n" | |
1563 | "Configure NSSA-ABR to always translate\n" | |
b0a053be | 1564 | "Do not inject inter-area routes into nssa\n") |
1565 | { | |
1566 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); | |
1567 | } | |
718e3744 | 1568 | |
b0a053be | 1569 | DEFUN (ospf_area_nssa_translate, |
a2c62831 | 1570 | ospf_area_nssa_translate_cmd, |
718e3744 | 1571 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", |
1572 | "OSPF area parameters\n" | |
1573 | "OSPF area ID in IP address format\n" | |
1574 | "OSPF area ID as a decimal value\n" | |
1575 | "Configure OSPF area as nssa\n" | |
1576 | "Configure NSSA-ABR for translate election (default)\n" | |
1577 | "Configure NSSA-ABR to never translate\n" | |
1578 | "Configure NSSA-ABR to always translate\n") | |
b0a053be | 1579 | { |
1580 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); | |
1581 | } | |
1582 | ||
1583 | DEFUN (ospf_area_nssa, | |
1584 | ospf_area_nssa_cmd, | |
1585 | "area (A.B.C.D|<0-4294967295>) nssa", | |
1586 | "OSPF area parameters\n" | |
1587 | "OSPF area ID in IP address format\n" | |
1588 | "OSPF area ID as a decimal value\n" | |
1589 | "Configure OSPF area as nssa\n") | |
1590 | { | |
1591 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); | |
1592 | } | |
718e3744 | 1593 | |
a2c62831 | 1594 | DEFUN (ospf_area_nssa_no_summary, |
1595 | ospf_area_nssa_no_summary_cmd, | |
718e3744 | 1596 | "area (A.B.C.D|<0-4294967295>) nssa no-summary", |
1597 | "OSPF area parameters\n" | |
1598 | "OSPF area ID in IP address format\n" | |
1599 | "OSPF area ID as a decimal value\n" | |
1600 | "Configure OSPF area as nssa\n" | |
1601 | "Do not inject inter-area routes into nssa\n") | |
1602 | { | |
b0a053be | 1603 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
718e3744 | 1604 | } |
1605 | ||
a2c62831 | 1606 | DEFUN (no_ospf_area_nssa, |
1607 | no_ospf_area_nssa_cmd, | |
718e3744 | 1608 | "no area (A.B.C.D|<0-4294967295>) nssa", |
1609 | NO_STR | |
1610 | "OSPF area parameters\n" | |
1611 | "OSPF area ID in IP address format\n" | |
1612 | "OSPF area ID as a decimal value\n" | |
1613 | "Configure OSPF area as nssa\n") | |
1614 | { | |
1615 | struct ospf *ospf = vty->index; | |
1616 | struct in_addr area_id; | |
1617 | int format; | |
1618 | ||
1619 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); | |
1620 | ||
1621 | ospf_area_nssa_unset (ospf, area_id); | |
1622 | ospf_area_no_summary_unset (ospf, area_id); | |
1623 | ||
b0a053be | 1624 | ospf_schedule_abr_task (ospf); |
1625 | ||
718e3744 | 1626 | return CMD_SUCCESS; |
1627 | } | |
1628 | ||
a2c62831 | 1629 | DEFUN (no_ospf_area_nssa_no_summary, |
1630 | no_ospf_area_nssa_no_summary_cmd, | |
718e3744 | 1631 | "no area (A.B.C.D|<0-4294967295>) nssa no-summary", |
1632 | NO_STR | |
1633 | "OSPF area parameters\n" | |
1634 | "OSPF area ID in IP address format\n" | |
1635 | "OSPF area ID as a decimal value\n" | |
1636 | "Configure OSPF area as nssa\n" | |
1637 | "Do not inject inter-area routes into nssa\n") | |
1638 | { | |
1639 | struct ospf *ospf = vty->index; | |
1640 | struct in_addr area_id; | |
1641 | int format; | |
1642 | ||
1643 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); | |
1644 | ospf_area_no_summary_unset (ospf, area_id); | |
1645 | ||
1646 | return CMD_SUCCESS; | |
1647 | } | |
1648 | ||
a2c62831 | 1649 | DEFUN (ospf_area_default_cost, |
1650 | ospf_area_default_cost_cmd, | |
718e3744 | 1651 | "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
1652 | "OSPF area parameters\n" | |
1653 | "OSPF area ID in IP address format\n" | |
1654 | "OSPF area ID as a decimal value\n" | |
1655 | "Set the summary-default cost of a NSSA or stub area\n" | |
1656 | "Stub's advertised default summary cost\n") | |
1657 | { | |
68980084 | 1658 | struct ospf *ospf = vty->index; |
718e3744 | 1659 | struct ospf_area *area; |
1660 | struct in_addr area_id; | |
1661 | u_int32_t cost; | |
1662 | int format; | |
ba682537 | 1663 | struct prefix_ipv4 p; |
718e3744 | 1664 | |
1665 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); | |
1666 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); | |
1667 | ||
68980084 | 1668 | area = ospf_area_get (ospf, area_id, format); |
718e3744 | 1669 | |
1670 | if (area->external_routing == OSPF_AREA_DEFAULT) | |
1671 | { | |
1672 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); | |
1673 | return CMD_WARNING; | |
1674 | } | |
1675 | ||
1676 | area->default_cost = cost; | |
1677 | ||
ba682537 | 1678 | p.family = AF_INET; |
1679 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; | |
1680 | p.prefixlen = 0; | |
1681 | if (IS_DEBUG_OSPF_EVENT) | |
1682 | zlog_debug ("ospf_abr_announce_stub_defaults(): " | |
1683 | "announcing 0.0.0.0/0 to area %s", | |
1684 | inet_ntoa (area->area_id)); | |
1685 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); | |
1686 | ||
718e3744 | 1687 | return CMD_SUCCESS; |
1688 | } | |
1689 | ||
a2c62831 | 1690 | DEFUN (no_ospf_area_default_cost, |
1691 | no_ospf_area_default_cost_cmd, | |
718e3744 | 1692 | "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
1693 | NO_STR | |
1694 | "OSPF area parameters\n" | |
1695 | "OSPF area ID in IP address format\n" | |
1696 | "OSPF area ID as a decimal value\n" | |
1697 | "Set the summary-default cost of a NSSA or stub area\n" | |
1698 | "Stub's advertised default summary cost\n") | |
1699 | { | |
68980084 | 1700 | struct ospf *ospf = vty->index; |
718e3744 | 1701 | struct ospf_area *area; |
1702 | struct in_addr area_id; | |
1703 | u_int32_t cost; | |
1704 | int format; | |
ba682537 | 1705 | struct prefix_ipv4 p; |
718e3744 | 1706 | |
1707 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); | |
1708 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); | |
1709 | ||
68980084 | 1710 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
718e3744 | 1711 | if (area == NULL) |
1712 | return CMD_SUCCESS; | |
1713 | ||
1714 | if (area->external_routing == OSPF_AREA_DEFAULT) | |
1715 | { | |
1716 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); | |
1717 | return CMD_WARNING; | |
1718 | } | |
1719 | ||
1720 | area->default_cost = 1; | |
1721 | ||
ba682537 | 1722 | p.family = AF_INET; |
1723 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; | |
1724 | p.prefixlen = 0; | |
1725 | if (IS_DEBUG_OSPF_EVENT) | |
1726 | zlog_debug ("ospf_abr_announce_stub_defaults(): " | |
1727 | "announcing 0.0.0.0/0 to area %s", | |
1728 | inet_ntoa (area->area_id)); | |
1729 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); | |
1730 | ||
1731 | ||
68980084 | 1732 | ospf_area_check_free (ospf, area_id); |
718e3744 | 1733 | |
1734 | return CMD_SUCCESS; | |
1735 | } | |
1736 | ||
a2c62831 | 1737 | DEFUN (ospf_area_export_list, |
1738 | ospf_area_export_list_cmd, | |
718e3744 | 1739 | "area (A.B.C.D|<0-4294967295>) export-list NAME", |
1740 | "OSPF area parameters\n" | |
1741 | "OSPF area ID in IP address format\n" | |
1742 | "OSPF area ID as a decimal value\n" | |
1743 | "Set the filter for networks announced to other areas\n" | |
1744 | "Name of the access-list\n") | |
1745 | { | |
68980084 | 1746 | struct ospf *ospf = vty->index; |
718e3744 | 1747 | struct ospf_area *area; |
1748 | struct in_addr area_id; | |
1749 | int format; | |
1750 | ||
52930766 | 1751 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
1752 | ||
68980084 | 1753 | area = ospf_area_get (ospf, area_id, format); |
1754 | ospf_area_export_list_set (ospf, area, argv[1]); | |
718e3744 | 1755 | |
1756 | return CMD_SUCCESS; | |
1757 | } | |
1758 | ||
a2c62831 | 1759 | DEFUN (no_ospf_area_export_list, |
1760 | no_ospf_area_export_list_cmd, | |
718e3744 | 1761 | "no area (A.B.C.D|<0-4294967295>) export-list NAME", |
1762 | NO_STR | |
1763 | "OSPF area parameters\n" | |
1764 | "OSPF area ID in IP address format\n" | |
1765 | "OSPF area ID as a decimal value\n" | |
1766 | "Unset the filter for networks announced to other areas\n" | |
1767 | "Name of the access-list\n") | |
1768 | { | |
68980084 | 1769 | struct ospf *ospf = vty->index; |
718e3744 | 1770 | struct ospf_area *area; |
1771 | struct in_addr area_id; | |
1772 | int format; | |
1773 | ||
52930766 | 1774 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
1775 | ||
68980084 | 1776 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
718e3744 | 1777 | if (area == NULL) |
1778 | return CMD_SUCCESS; | |
1779 | ||
68980084 | 1780 | ospf_area_export_list_unset (ospf, area); |
718e3744 | 1781 | |
1782 | return CMD_SUCCESS; | |
1783 | } | |
1784 | ||
1785 | ||
a2c62831 | 1786 | DEFUN (ospf_area_import_list, |
1787 | ospf_area_import_list_cmd, | |
718e3744 | 1788 | "area (A.B.C.D|<0-4294967295>) import-list NAME", |
1789 | "OSPF area parameters\n" | |
1790 | "OSPF area ID in IP address format\n" | |
1791 | "OSPF area ID as a decimal value\n" | |
1792 | "Set the filter for networks from other areas announced to the specified one\n" | |
1793 | "Name of the access-list\n") | |
1794 | { | |
68980084 | 1795 | struct ospf *ospf = vty->index; |
718e3744 | 1796 | struct ospf_area *area; |
1797 | struct in_addr area_id; | |
1798 | int format; | |
1799 | ||
52930766 | 1800 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
1801 | ||
68980084 | 1802 | area = ospf_area_get (ospf, area_id, format); |
1803 | ospf_area_import_list_set (ospf, area, argv[1]); | |
718e3744 | 1804 | |
1805 | return CMD_SUCCESS; | |
1806 | } | |
1807 | ||
a2c62831 | 1808 | DEFUN (no_ospf_area_import_list, |
1809 | no_ospf_area_import_list_cmd, | |
718e3744 | 1810 | "no area (A.B.C.D|<0-4294967295>) import-list NAME", |
1811 | NO_STR | |
1812 | "OSPF area parameters\n" | |
1813 | "OSPF area ID in IP address format\n" | |
1814 | "OSPF area ID as a decimal value\n" | |
1815 | "Unset the filter for networks announced to other areas\n" | |
1816 | "Name of the access-list\n") | |
1817 | { | |
68980084 | 1818 | struct ospf *ospf = vty->index; |
718e3744 | 1819 | struct ospf_area *area; |
1820 | struct in_addr area_id; | |
1821 | int format; | |
1822 | ||
52930766 | 1823 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
1824 | ||
68980084 | 1825 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
718e3744 | 1826 | if (area == NULL) |
1827 | return CMD_SUCCESS; | |
1828 | ||
68980084 | 1829 | ospf_area_import_list_unset (ospf, area); |
718e3744 | 1830 | |
1831 | return CMD_SUCCESS; | |
1832 | } | |
1833 | ||
a2c62831 | 1834 | DEFUN (ospf_area_filter_list, |
1835 | ospf_area_filter_list_cmd, | |
718e3744 | 1836 | "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
1837 | "OSPF area parameters\n" | |
1838 | "OSPF area ID in IP address format\n" | |
1839 | "OSPF area ID as a decimal value\n" | |
1840 | "Filter networks between OSPF areas\n" | |
1841 | "Filter prefixes between OSPF areas\n" | |
1842 | "Name of an IP prefix-list\n" | |
1843 | "Filter networks sent to this area\n" | |
1844 | "Filter networks sent from this area\n") | |
1845 | { | |
68980084 | 1846 | struct ospf *ospf = vty->index; |
718e3744 | 1847 | struct ospf_area *area; |
1848 | struct in_addr area_id; | |
1849 | struct prefix_list *plist; | |
1850 | int format; | |
1851 | ||
1852 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
1853 | ||
68980084 | 1854 | area = ospf_area_get (ospf, area_id, format); |
718e3744 | 1855 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
1856 | if (strncmp (argv[2], "in", 2) == 0) | |
1857 | { | |
1858 | PREFIX_LIST_IN (area) = plist; | |
1859 | if (PREFIX_NAME_IN (area)) | |
1860 | free (PREFIX_NAME_IN (area)); | |
1861 | ||
1862 | PREFIX_NAME_IN (area) = strdup (argv[1]); | |
68980084 | 1863 | ospf_schedule_abr_task (ospf); |
718e3744 | 1864 | } |
1865 | else | |
1866 | { | |
1867 | PREFIX_LIST_OUT (area) = plist; | |
1868 | if (PREFIX_NAME_OUT (area)) | |
1869 | free (PREFIX_NAME_OUT (area)); | |
1870 | ||
1871 | PREFIX_NAME_OUT (area) = strdup (argv[1]); | |
68980084 | 1872 | ospf_schedule_abr_task (ospf); |
718e3744 | 1873 | } |
1874 | ||
1875 | return CMD_SUCCESS; | |
1876 | } | |
1877 | ||
a2c62831 | 1878 | DEFUN (no_ospf_area_filter_list, |
1879 | no_ospf_area_filter_list_cmd, | |
718e3744 | 1880 | "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
1881 | NO_STR | |
1882 | "OSPF area parameters\n" | |
1883 | "OSPF area ID in IP address format\n" | |
1884 | "OSPF area ID as a decimal value\n" | |
1885 | "Filter networks between OSPF areas\n" | |
1886 | "Filter prefixes between OSPF areas\n" | |
1887 | "Name of an IP prefix-list\n" | |
1888 | "Filter networks sent to this area\n" | |
1889 | "Filter networks sent from this area\n") | |
1890 | { | |
68980084 | 1891 | struct ospf *ospf = vty->index; |
718e3744 | 1892 | struct ospf_area *area; |
1893 | struct in_addr area_id; | |
1894 | struct prefix_list *plist; | |
1895 | int format; | |
1896 | ||
1897 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
1898 | ||
68980084 | 1899 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
718e3744 | 1900 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
1901 | if (strncmp (argv[2], "in", 2) == 0) | |
1902 | { | |
1903 | if (PREFIX_NAME_IN (area)) | |
1904 | if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) | |
1905 | return CMD_SUCCESS; | |
1906 | ||
1907 | PREFIX_LIST_IN (area) = NULL; | |
1908 | if (PREFIX_NAME_IN (area)) | |
1909 | free (PREFIX_NAME_IN (area)); | |
1910 | ||
1911 | PREFIX_NAME_IN (area) = NULL; | |
1912 | ||
68980084 | 1913 | ospf_schedule_abr_task (ospf); |
718e3744 | 1914 | } |
1915 | else | |
1916 | { | |
1917 | if (PREFIX_NAME_OUT (area)) | |
1918 | if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) | |
1919 | return CMD_SUCCESS; | |
1920 | ||
1921 | PREFIX_LIST_OUT (area) = NULL; | |
1922 | if (PREFIX_NAME_OUT (area)) | |
1923 | free (PREFIX_NAME_OUT (area)); | |
1924 | ||
1925 | PREFIX_NAME_OUT (area) = NULL; | |
1926 | ||
68980084 | 1927 | ospf_schedule_abr_task (ospf); |
718e3744 | 1928 | } |
1929 | ||
1930 | return CMD_SUCCESS; | |
1931 | } | |
1932 | ||
1933 | \f | |
a2c62831 | 1934 | DEFUN (ospf_area_authentication_message_digest, |
1935 | ospf_area_authentication_message_digest_cmd, | |
718e3744 | 1936 | "area (A.B.C.D|<0-4294967295>) authentication message-digest", |
1937 | "OSPF area parameters\n" | |
1938 | "Enable authentication\n" | |
1939 | "Use message-digest authentication\n") | |
1940 | { | |
68980084 | 1941 | struct ospf *ospf = vty->index; |
718e3744 | 1942 | struct ospf_area *area; |
1943 | struct in_addr area_id; | |
1944 | int format; | |
1945 | ||
1946 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
1947 | ||
68980084 | 1948 | area = ospf_area_get (ospf, area_id, format); |
718e3744 | 1949 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
1950 | ||
1951 | return CMD_SUCCESS; | |
1952 | } | |
1953 | ||
a2c62831 | 1954 | DEFUN (ospf_area_authentication, |
1955 | ospf_area_authentication_cmd, | |
718e3744 | 1956 | "area (A.B.C.D|<0-4294967295>) authentication", |
1957 | "OSPF area parameters\n" | |
1958 | "OSPF area ID in IP address format\n" | |
1959 | "OSPF area ID as a decimal value\n" | |
1960 | "Enable authentication\n") | |
1961 | { | |
68980084 | 1962 | struct ospf *ospf = vty->index; |
718e3744 | 1963 | struct ospf_area *area; |
1964 | struct in_addr area_id; | |
1965 | int format; | |
1966 | ||
1967 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
1968 | ||
68980084 | 1969 | area = ospf_area_get (ospf, area_id, format); |
718e3744 | 1970 | area->auth_type = OSPF_AUTH_SIMPLE; |
1971 | ||
1972 | return CMD_SUCCESS; | |
1973 | } | |
1974 | ||
a2c62831 | 1975 | DEFUN (no_ospf_area_authentication, |
1976 | no_ospf_area_authentication_cmd, | |
718e3744 | 1977 | "no area (A.B.C.D|<0-4294967295>) authentication", |
1978 | NO_STR | |
1979 | "OSPF area parameters\n" | |
1980 | "OSPF area ID in IP address format\n" | |
1981 | "OSPF area ID as a decimal value\n" | |
1982 | "Enable authentication\n") | |
1983 | { | |
68980084 | 1984 | struct ospf *ospf = vty->index; |
718e3744 | 1985 | struct ospf_area *area; |
1986 | struct in_addr area_id; | |
1987 | int format; | |
1988 | ||
1989 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); | |
1990 | ||
68980084 | 1991 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
718e3744 | 1992 | if (area == NULL) |
1993 | return CMD_SUCCESS; | |
1994 | ||
1995 | area->auth_type = OSPF_AUTH_NULL; | |
1996 | ||
68980084 | 1997 | ospf_area_check_free (ospf, area_id); |
718e3744 | 1998 | |
1999 | return CMD_SUCCESS; | |
2000 | } | |
2001 | ||
2002 | \f | |
2003 | DEFUN (ospf_abr_type, | |
2004 | ospf_abr_type_cmd, | |
2005 | "ospf abr-type (cisco|ibm|shortcut|standard)", | |
2006 | "OSPF specific commands\n" | |
2007 | "Set OSPF ABR type\n" | |
2008 | "Alternative ABR, cisco implementation\n" | |
2009 | "Alternative ABR, IBM implementation\n" | |
2010 | "Shortcut ABR\n" | |
2011 | "Standard behavior (RFC2328)\n") | |
2012 | { | |
68980084 | 2013 | struct ospf *ospf = vty->index; |
718e3744 | 2014 | u_char abr_type = OSPF_ABR_UNKNOWN; |
2015 | ||
2016 | if (strncmp (argv[0], "c", 1) == 0) | |
2017 | abr_type = OSPF_ABR_CISCO; | |
2018 | else if (strncmp (argv[0], "i", 1) == 0) | |
2019 | abr_type = OSPF_ABR_IBM; | |
2020 | else if (strncmp (argv[0], "sh", 2) == 0) | |
2021 | abr_type = OSPF_ABR_SHORTCUT; | |
2022 | else if (strncmp (argv[0], "st", 2) == 0) | |
2023 | abr_type = OSPF_ABR_STAND; | |
2024 | else | |
2025 | return CMD_WARNING; | |
2026 | ||
2027 | /* If ABR type value is changed, schedule ABR task. */ | |
68980084 | 2028 | if (ospf->abr_type != abr_type) |
718e3744 | 2029 | { |
68980084 | 2030 | ospf->abr_type = abr_type; |
2031 | ospf_schedule_abr_task (ospf); | |
718e3744 | 2032 | } |
2033 | ||
2034 | return CMD_SUCCESS; | |
2035 | } | |
2036 | ||
2037 | DEFUN (no_ospf_abr_type, | |
2038 | no_ospf_abr_type_cmd, | |
d57834f6 | 2039 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
718e3744 | 2040 | NO_STR |
2041 | "OSPF specific commands\n" | |
2042 | "Set OSPF ABR type\n" | |
2043 | "Alternative ABR, cisco implementation\n" | |
2044 | "Alternative ABR, IBM implementation\n" | |
2045 | "Shortcut ABR\n") | |
2046 | { | |
68980084 | 2047 | struct ospf *ospf = vty->index; |
718e3744 | 2048 | u_char abr_type = OSPF_ABR_UNKNOWN; |
2049 | ||
2050 | if (strncmp (argv[0], "c", 1) == 0) | |
2051 | abr_type = OSPF_ABR_CISCO; | |
2052 | else if (strncmp (argv[0], "i", 1) == 0) | |
2053 | abr_type = OSPF_ABR_IBM; | |
2054 | else if (strncmp (argv[0], "s", 1) == 0) | |
2055 | abr_type = OSPF_ABR_SHORTCUT; | |
2056 | else | |
2057 | return CMD_WARNING; | |
2058 | ||
2059 | /* If ABR type value is changed, schedule ABR task. */ | |
68980084 | 2060 | if (ospf->abr_type == abr_type) |
718e3744 | 2061 | { |
d57834f6 | 2062 | ospf->abr_type = OSPF_ABR_DEFAULT; |
68980084 | 2063 | ospf_schedule_abr_task (ospf); |
718e3744 | 2064 | } |
2065 | ||
2066 | return CMD_SUCCESS; | |
2067 | } | |
2068 | ||
2069 | DEFUN (ospf_compatible_rfc1583, | |
2070 | ospf_compatible_rfc1583_cmd, | |
2071 | "compatible rfc1583", | |
2072 | "OSPF compatibility list\n" | |
2073 | "compatible with RFC 1583\n") | |
2074 | { | |
2075 | struct ospf *ospf = vty->index; | |
2076 | ||
2077 | if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) | |
2078 | { | |
2079 | SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); | |
68980084 | 2080 | ospf_spf_calculate_schedule (ospf); |
718e3744 | 2081 | } |
2082 | return CMD_SUCCESS; | |
2083 | } | |
2084 | ||
2085 | DEFUN (no_ospf_compatible_rfc1583, | |
2086 | no_ospf_compatible_rfc1583_cmd, | |
2087 | "no compatible rfc1583", | |
2088 | NO_STR | |
2089 | "OSPF compatibility list\n" | |
2090 | "compatible with RFC 1583\n") | |
2091 | { | |
2092 | struct ospf *ospf = vty->index; | |
2093 | ||
2094 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) | |
2095 | { | |
2096 | UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); | |
68980084 | 2097 | ospf_spf_calculate_schedule (ospf); |
718e3744 | 2098 | } |
2099 | return CMD_SUCCESS; | |
2100 | } | |
2101 | ||
2102 | ALIAS (ospf_compatible_rfc1583, | |
2103 | ospf_rfc1583_flag_cmd, | |
2104 | "ospf rfc1583compatibility", | |
2105 | "OSPF specific commands\n" | |
2106 | "Enable the RFC1583Compatibility flag\n") | |
2107 | ||
2108 | ALIAS (no_ospf_compatible_rfc1583, | |
2109 | no_ospf_rfc1583_flag_cmd, | |
2110 | "no ospf rfc1583compatibility", | |
2111 | NO_STR | |
2112 | "OSPF specific commands\n" | |
2113 | "Disable the RFC1583Compatibility flag\n") | |
d24f6e2a | 2114 | \f |
2115 | static int | |
2116 | ospf_timers_spf_set (struct vty *vty, unsigned int delay, | |
2117 | unsigned int hold, | |
2118 | unsigned int max) | |
2119 | { | |
2120 | struct ospf *ospf = vty->index; | |
2121 | ||
2122 | ospf->spf_delay = delay; | |
2123 | ospf->spf_holdtime = hold; | |
2124 | ospf->spf_max_holdtime = max; | |
2125 | ||
2126 | return CMD_SUCCESS; | |
2127 | } | |
718e3744 | 2128 | |
d24f6e2a | 2129 | DEFUN (ospf_timers_throttle_spf, |
2130 | ospf_timers_throttle_spf_cmd, | |
2131 | "timers throttle spf <0-600000> <0-600000> <0-600000>", | |
2132 | "Adjust routing timers\n" | |
2133 | "Throttling adaptive timer\n" | |
2134 | "OSPF SPF timers\n" | |
2135 | "Delay (msec) from first change received till SPF calculation\n" | |
2136 | "Initial hold time (msec) between consecutive SPF calculations\n" | |
2137 | "Maximum hold time (msec)\n") | |
2138 | { | |
2139 | unsigned int delay, hold, max; | |
2140 | ||
2141 | if (argc != 3) | |
2142 | { | |
2143 | vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); | |
2144 | return CMD_WARNING; | |
2145 | } | |
2146 | ||
2147 | VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); | |
2148 | VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); | |
2149 | VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); | |
2150 | ||
2151 | return ospf_timers_spf_set (vty, delay, hold, max); | |
2152 | } | |
2153 | ||
2154 | DEFUN_DEPRECATED (ospf_timers_spf, | |
a2c62831 | 2155 | ospf_timers_spf_cmd, |
718e3744 | 2156 | "timers spf <0-4294967295> <0-4294967295>", |
2157 | "Adjust routing timers\n" | |
2158 | "OSPF SPF timers\n" | |
d24f6e2a | 2159 | "Delay (s) between receiving a change to SPF calculation\n" |
2160 | "Hold time (s) between consecutive SPF calculations\n") | |
718e3744 | 2161 | { |
d24f6e2a | 2162 | unsigned int delay, hold; |
2163 | ||
2164 | if (argc != 2) | |
2165 | { | |
2166 | vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); | |
2167 | return CMD_WARNING; | |
2168 | } | |
2169 | ||
4dadc291 | 2170 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
2171 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); | |
d24f6e2a | 2172 | |
2173 | /* truncate down the second values if they're greater than 600000ms */ | |
2174 | if (delay > (600000 / 1000)) | |
2175 | delay = 600000; | |
2176 | else if (delay == 0) | |
2177 | /* 0s delay was probably specified because of lack of ms resolution */ | |
2178 | delay = OSPF_SPF_DELAY_DEFAULT; | |
2179 | if (hold > (600000 / 1000)) | |
2180 | hold = 600000; | |
2181 | ||
2182 | return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000); | |
718e3744 | 2183 | } |
2184 | ||
d24f6e2a | 2185 | DEFUN (no_ospf_timers_throttle_spf, |
2186 | no_ospf_timers_throttle_spf_cmd, | |
2187 | "no timers throttle spf", | |
718e3744 | 2188 | NO_STR |
2189 | "Adjust routing timers\n" | |
d24f6e2a | 2190 | "Throttling adaptive timer\n" |
718e3744 | 2191 | "OSPF SPF timers\n") |
2192 | { | |
d24f6e2a | 2193 | return ospf_timers_spf_set (vty, |
2194 | OSPF_SPF_DELAY_DEFAULT, | |
2195 | OSPF_SPF_HOLDTIME_DEFAULT, | |
2196 | OSPF_SPF_MAX_HOLDTIME_DEFAULT); | |
718e3744 | 2197 | } |
2198 | ||
d24f6e2a | 2199 | ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, |
2200 | no_ospf_timers_spf_cmd, | |
2201 | "no timers spf", | |
2202 | NO_STR | |
2203 | "Adjust routing timers\n" | |
2204 | "OSPF SPF timers\n") | |
718e3744 | 2205 | \f |
a2c62831 | 2206 | DEFUN (ospf_neighbor, |
2207 | ospf_neighbor_cmd, | |
718e3744 | 2208 | "neighbor A.B.C.D", |
2209 | NEIGHBOR_STR | |
2210 | "Neighbor IP address\n") | |
2211 | { | |
2212 | struct ospf *ospf = vty->index; | |
2213 | struct in_addr nbr_addr; | |
eb1ce605 | 2214 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
2215 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; | |
718e3744 | 2216 | |
2217 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); | |
2218 | ||
2219 | if (argc > 1) | |
2220 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); | |
2221 | ||
2222 | if (argc > 2) | |
2223 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); | |
2224 | ||
2225 | ospf_nbr_nbma_set (ospf, nbr_addr); | |
2226 | if (argc > 1) | |
2227 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); | |
2228 | if (argc > 2) | |
2229 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); | |
2230 | ||
2231 | return CMD_SUCCESS; | |
2232 | } | |
2233 | ||
a2c62831 | 2234 | ALIAS (ospf_neighbor, |
2235 | ospf_neighbor_priority_poll_interval_cmd, | |
718e3744 | 2236 | "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
2237 | NEIGHBOR_STR | |
2238 | "Neighbor IP address\n" | |
2239 | "Neighbor Priority\n" | |
2240 | "Priority\n" | |
2241 | "Dead Neighbor Polling interval\n" | |
2242 | "Seconds\n") | |
2243 | ||
a2c62831 | 2244 | ALIAS (ospf_neighbor, |
2245 | ospf_neighbor_priority_cmd, | |
718e3744 | 2246 | "neighbor A.B.C.D priority <0-255>", |
2247 | NEIGHBOR_STR | |
2248 | "Neighbor IP address\n" | |
2249 | "Neighbor Priority\n" | |
2250 | "Seconds\n") | |
2251 | ||
a2c62831 | 2252 | DEFUN (ospf_neighbor_poll_interval, |
2253 | ospf_neighbor_poll_interval_cmd, | |
718e3744 | 2254 | "neighbor A.B.C.D poll-interval <1-65535>", |
2255 | NEIGHBOR_STR | |
2256 | "Neighbor IP address\n" | |
2257 | "Dead Neighbor Polling interval\n" | |
2258 | "Seconds\n") | |
2259 | { | |
2260 | struct ospf *ospf = vty->index; | |
2261 | struct in_addr nbr_addr; | |
eb1ce605 | 2262 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
2263 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; | |
718e3744 | 2264 | |
2265 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); | |
2266 | ||
2267 | if (argc > 1) | |
2268 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); | |
2269 | ||
2270 | if (argc > 2) | |
2271 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); | |
2272 | ||
2273 | ospf_nbr_nbma_set (ospf, nbr_addr); | |
2274 | if (argc > 1) | |
2275 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); | |
2276 | if (argc > 2) | |
2277 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); | |
2278 | ||
2279 | return CMD_SUCCESS; | |
2280 | } | |
2281 | ||
a2c62831 | 2282 | ALIAS (ospf_neighbor_poll_interval, |
2283 | ospf_neighbor_poll_interval_priority_cmd, | |
718e3744 | 2284 | "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", |
2285 | NEIGHBOR_STR | |
2286 | "Neighbor address\n" | |
2287 | "OSPF dead-router polling interval\n" | |
2288 | "Seconds\n" | |
2289 | "OSPF priority of non-broadcast neighbor\n" | |
2290 | "Priority\n") | |
2291 | ||
a2c62831 | 2292 | DEFUN (no_ospf_neighbor, |
2293 | no_ospf_neighbor_cmd, | |
718e3744 | 2294 | "no neighbor A.B.C.D", |
2295 | NO_STR | |
2296 | NEIGHBOR_STR | |
2297 | "Neighbor IP address\n") | |
2298 | { | |
2299 | struct ospf *ospf = vty->index; | |
2300 | struct in_addr nbr_addr; | |
2301 | int ret; | |
2302 | ||
2303 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); | |
2304 | ||
2305 | ret = ospf_nbr_nbma_unset (ospf, nbr_addr); | |
2306 | ||
2307 | return CMD_SUCCESS; | |
2308 | } | |
2309 | ||
a2c62831 | 2310 | ALIAS (no_ospf_neighbor, |
2311 | no_ospf_neighbor_priority_cmd, | |
718e3744 | 2312 | "no neighbor A.B.C.D priority <0-255>", |
2313 | NO_STR | |
2314 | NEIGHBOR_STR | |
2315 | "Neighbor IP address\n" | |
2316 | "Neighbor Priority\n" | |
2317 | "Priority\n") | |
2318 | ||
a2c62831 | 2319 | ALIAS (no_ospf_neighbor, |
2320 | no_ospf_neighbor_poll_interval_cmd, | |
718e3744 | 2321 | "no neighbor A.B.C.D poll-interval <1-65535>", |
2322 | NO_STR | |
2323 | NEIGHBOR_STR | |
2324 | "Neighbor IP address\n" | |
2325 | "Dead Neighbor Polling interval\n" | |
2326 | "Seconds\n") | |
2327 | ||
a2c62831 | 2328 | ALIAS (no_ospf_neighbor, |
2329 | no_ospf_neighbor_priority_pollinterval_cmd, | |
718e3744 | 2330 | "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
2331 | NO_STR | |
2332 | NEIGHBOR_STR | |
2333 | "Neighbor IP address\n" | |
2334 | "Neighbor Priority\n" | |
2335 | "Priority\n" | |
2336 | "Dead Neighbor Polling interval\n" | |
2337 | "Seconds\n") | |
2338 | ||
2339 | \f | |
a2c62831 | 2340 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
718e3744 | 2341 | "refresh timer <10-1800>", |
2342 | "Adjust refresh parameters\n" | |
2343 | "Set refresh timer\n" | |
2344 | "Timer value in seconds\n") | |
2345 | { | |
2346 | struct ospf *ospf = vty->index; | |
eb1ce605 | 2347 | unsigned int interval; |
718e3744 | 2348 | |
2349 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); | |
2350 | interval = (interval / 10) * 10; | |
2351 | ||
2352 | ospf_timers_refresh_set (ospf, interval); | |
2353 | ||
2354 | return CMD_SUCCESS; | |
2355 | } | |
2356 | ||
a2c62831 | 2357 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
718e3744 | 2358 | "no refresh timer <10-1800>", |
2359 | "Adjust refresh parameters\n" | |
2360 | "Unset refresh timer\n" | |
2361 | "Timer value in seconds\n") | |
2362 | { | |
2363 | struct ospf *ospf = vty->index; | |
eb1ce605 | 2364 | unsigned int interval; |
718e3744 | 2365 | |
2366 | if (argc == 1) | |
2367 | { | |
2368 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); | |
2369 | ||
2370 | if (ospf->lsa_refresh_interval != interval || | |
2371 | interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) | |
2372 | return CMD_SUCCESS; | |
2373 | } | |
2374 | ||
2375 | ospf_timers_refresh_unset (ospf); | |
2376 | ||
2377 | return CMD_SUCCESS; | |
2378 | } | |
2379 | ||
a2c62831 | 2380 | ALIAS (no_ospf_refresh_timer, |
2381 | no_ospf_refresh_timer_cmd, | |
718e3744 | 2382 | "no refresh timer", |
2383 | "Adjust refresh parameters\n" | |
2384 | "Unset refresh timer\n") | |
2385 | ||
a2c62831 | 2386 | DEFUN (ospf_auto_cost_reference_bandwidth, |
2387 | ospf_auto_cost_reference_bandwidth_cmd, | |
718e3744 | 2388 | "auto-cost reference-bandwidth <1-4294967>", |
2389 | "Calculate OSPF interface cost according to bandwidth\n" | |
2390 | "Use reference bandwidth method to assign OSPF cost\n" | |
2391 | "The reference bandwidth in terms of Mbits per second\n") | |
2392 | { | |
68980084 | 2393 | struct ospf *ospf = vty->index; |
718e3744 | 2394 | u_int32_t refbw; |
52dc7ee6 | 2395 | struct listnode *node; |
1eb8ef25 | 2396 | struct interface *ifp; |
718e3744 | 2397 | |
2398 | refbw = strtol (argv[0], NULL, 10); | |
2399 | if (refbw < 1 || refbw > 4294967) | |
2400 | { | |
2401 | vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); | |
2402 | return CMD_WARNING; | |
2403 | } | |
2404 | ||
2405 | /* If reference bandwidth is changed. */ | |
68980084 | 2406 | if ((refbw * 1000) == ospf->ref_bandwidth) |
718e3744 | 2407 | return CMD_SUCCESS; |
2408 | ||
68980084 | 2409 | ospf->ref_bandwidth = refbw * 1000; |
1eb8ef25 | 2410 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
2411 | ospf_if_recalculate_output_cost (ifp); | |
718e3744 | 2412 | |
2413 | return CMD_SUCCESS; | |
2414 | } | |
2415 | ||
a2c62831 | 2416 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
2417 | no_ospf_auto_cost_reference_bandwidth_cmd, | |
718e3744 | 2418 | "no auto-cost reference-bandwidth", |
2419 | NO_STR | |
2420 | "Calculate OSPF interface cost according to bandwidth\n" | |
2421 | "Use reference bandwidth method to assign OSPF cost\n") | |
2422 | { | |
68980084 | 2423 | struct ospf *ospf = vty->index; |
1eb8ef25 | 2424 | struct listnode *node, *nnode; |
2425 | struct interface *ifp; | |
718e3744 | 2426 | |
68980084 | 2427 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
718e3744 | 2428 | return CMD_SUCCESS; |
2429 | ||
68980084 | 2430 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
718e3744 | 2431 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
2432 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); | |
2433 | ||
1eb8ef25 | 2434 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
2435 | ospf_if_recalculate_output_cost (ifp); | |
718e3744 | 2436 | |
2437 | return CMD_SUCCESS; | |
2438 | } | |
2439 | ||
eb1ce605 | 2440 | const char *ospf_abr_type_descr_str[] = |
718e3744 | 2441 | { |
2442 | "Unknown", | |
2443 | "Standard (RFC2328)", | |
2444 | "Alternative IBM", | |
2445 | "Alternative Cisco", | |
2446 | "Alternative Shortcut" | |
2447 | }; | |
2448 | ||
eb1ce605 | 2449 | const char *ospf_shortcut_mode_descr_str[] = |
718e3744 | 2450 | { |
2451 | "Default", | |
2452 | "Enabled", | |
2453 | "Disabled" | |
2454 | }; | |
2455 | ||
2456 | ||
2457 | \f | |
4dadc291 | 2458 | static void |
718e3744 | 2459 | show_ip_ospf_area (struct vty *vty, struct ospf_area *area) |
2460 | { | |
2461 | /* Show Area ID. */ | |
2462 | vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); | |
2463 | ||
2464 | /* Show Area type/mode. */ | |
2465 | if (OSPF_IS_AREA_BACKBONE (area)) | |
2466 | vty_out (vty, " (Backbone)%s", VTY_NEWLINE); | |
2467 | else | |
2468 | { | |
2469 | if (area->external_routing == OSPF_AREA_STUB) | |
b0a053be | 2470 | vty_out (vty, " (Stub%s%s)", |
2471 | area->no_summary ? ", no summary" : "", | |
2472 | area->shortcut_configured ? "; " : ""); | |
718e3744 | 2473 | |
b0a053be | 2474 | else if (area->external_routing == OSPF_AREA_NSSA) |
2475 | vty_out (vty, " (NSSA%s%s)", | |
2476 | area->no_summary ? ", no summary" : "", | |
2477 | area->shortcut_configured ? "; " : ""); | |
718e3744 | 2478 | |
2479 | vty_out (vty, "%s", VTY_NEWLINE); | |
2480 | vty_out (vty, " Shortcutting mode: %s", | |
b0a053be | 2481 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
718e3744 | 2482 | vty_out (vty, ", S-bit consensus: %s%s", |
b0a053be | 2483 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
718e3744 | 2484 | } |
2485 | ||
2486 | /* Show number of interfaces. */ | |
2487 | vty_out (vty, " Number of interfaces in this area: Total: %d, " | |
2488 | "Active: %d%s", listcount (area->oiflist), | |
2489 | area->act_ints, VTY_NEWLINE); | |
2490 | ||
718e3744 | 2491 | if (area->external_routing == OSPF_AREA_NSSA) |
2492 | { | |
2493 | vty_out (vty, " It is an NSSA configuration. %s Elected NSSA/ABR performs type-7/type-5 LSA translation. %s", VTY_NEWLINE, VTY_NEWLINE); | |
020709f9 | 2494 | if (! IS_OSPF_ABR (area->ospf)) |
b0a053be | 2495 | vty_out (vty, " It is not ABR, therefore not Translator. %s", |
2496 | VTY_NEWLINE); | |
2497 | else if (area->NSSATranslatorState) | |
2498 | { | |
2499 | vty_out (vty, " We are an ABR and "); | |
2500 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) | |
2501 | vty_out (vty, "the NSSA Elected Translator. %s", | |
2502 | VTY_NEWLINE); | |
2503 | else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) | |
2504 | vty_out (vty, "always an NSSA Translator. %s", | |
2505 | VTY_NEWLINE); | |
2506 | } | |
718e3744 | 2507 | else |
b0a053be | 2508 | { |
2509 | vty_out (vty, " We are an ABR, but "); | |
2510 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) | |
2511 | vty_out (vty, "not the NSSA Elected Translator. %s", | |
2512 | VTY_NEWLINE); | |
2513 | else | |
c6b87819 | 2514 | vty_out (vty, "never an NSSA Translator. %s", |
b0a053be | 2515 | VTY_NEWLINE); |
2516 | } | |
718e3744 | 2517 | } |
88d6cf37 | 2518 | /* Stub-router state for this area */ |
2519 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) | |
2520 | { | |
649654ab | 2521 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
88d6cf37 | 2522 | vty_out (vty, " Originating stub / maximum-distance Router-LSA%s", |
2523 | VTY_NEWLINE); | |
2524 | if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) | |
2525 | vty_out (vty, " Administratively activated (indefinitely)%s", | |
2526 | VTY_NEWLINE); | |
2527 | if (area->t_stub_router) | |
2528 | vty_out (vty, " Active from startup, %s remaining%s", | |
2529 | ospf_timer_dump (area->t_stub_router, timebuf, | |
2530 | sizeof(timebuf)), VTY_NEWLINE); | |
2531 | } | |
2532 | ||
718e3744 | 2533 | /* Show number of fully adjacent neighbors. */ |
2534 | vty_out (vty, " Number of fully adjacent neighbors in this area:" | |
b0a053be | 2535 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
718e3744 | 2536 | |
2537 | /* Show authentication type. */ | |
2538 | vty_out (vty, " Area has "); | |
2539 | if (area->auth_type == OSPF_AUTH_NULL) | |
2540 | vty_out (vty, "no authentication%s", VTY_NEWLINE); | |
2541 | else if (area->auth_type == OSPF_AUTH_SIMPLE) | |
2542 | vty_out (vty, "simple password authentication%s", VTY_NEWLINE); | |
2543 | else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC) | |
2544 | vty_out (vty, "message digest authentication%s", VTY_NEWLINE); | |
2545 | ||
2546 | if (!OSPF_IS_AREA_BACKBONE (area)) | |
2547 | vty_out (vty, " Number of full virtual adjacencies going through" | |
2548 | " this area: %d%s", area->full_vls, VTY_NEWLINE); | |
2549 | ||
2550 | /* Show SPF calculation times. */ | |
2551 | vty_out (vty, " SPF algorithm executed %d times%s", | |
2552 | area->spf_calculation, VTY_NEWLINE); | |
2553 | ||
2554 | /* Show number of LSA. */ | |
2555 | vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE); | |
fe71a97d | 2556 | vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s", |
2557 | ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA), | |
2558 | ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE); | |
2559 | vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s", | |
2560 | ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA), | |
2561 | ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE); | |
2562 | vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s", | |
2563 | ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA), | |
2564 | ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE); | |
2565 | vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s", | |
2566 | ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA), | |
2567 | ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE); | |
2568 | vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s", | |
2569 | ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA), | |
2570 | ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE); | |
2571 | #ifdef HAVE_OPAQUE_LSA | |
2572 | vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s", | |
2573 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA), | |
2574 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE); | |
2575 | vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s", | |
2576 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA), | |
2577 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE); | |
2578 | #endif /* HAVE_OPAQUE_LSA */ | |
718e3744 | 2579 | vty_out (vty, "%s", VTY_NEWLINE); |
2580 | } | |
2581 | ||
2582 | DEFUN (show_ip_ospf, | |
2583 | show_ip_ospf_cmd, | |
2584 | "show ip ospf", | |
2585 | SHOW_STR | |
2586 | IP_STR | |
2587 | "OSPF information\n") | |
2588 | { | |
1eb8ef25 | 2589 | struct listnode *node, *nnode; |
718e3744 | 2590 | struct ospf_area * area; |
020709f9 | 2591 | struct ospf *ospf; |
d24f6e2a | 2592 | struct timeval result; |
649654ab | 2593 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
718e3744 | 2594 | |
2595 | /* Check OSPF is enable. */ | |
020709f9 | 2596 | ospf = ospf_lookup (); |
68980084 | 2597 | if (ospf == NULL) |
718e3744 | 2598 | { |
2599 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
2600 | return CMD_SUCCESS; | |
2601 | } | |
2602 | ||
2603 | /* Show Router ID. */ | |
2604 | vty_out (vty, " OSPF Routing Process, Router ID: %s%s", | |
68980084 | 2605 | inet_ntoa (ospf->router_id), |
718e3744 | 2606 | VTY_NEWLINE); |
88d6cf37 | 2607 | |
2608 | /* Graceful shutdown */ | |
c9c93d50 | 2609 | if (ospf->t_deferred_shutdown) |
2610 | vty_out (vty, " Deferred shutdown in progress, %s remaining%s", | |
2611 | ospf_timer_dump (ospf->t_deferred_shutdown, | |
88d6cf37 | 2612 | timebuf, sizeof (timebuf)), VTY_NEWLINE); |
718e3744 | 2613 | /* Show capability. */ |
2614 | vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE); | |
2615 | vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE); | |
2616 | vty_out (vty, " RFC1583Compatibility flag is %s%s", | |
68980084 | 2617 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
718e3744 | 2618 | "enabled" : "disabled", VTY_NEWLINE); |
2619 | #ifdef HAVE_OPAQUE_LSA | |
2620 | vty_out (vty, " OpaqueCapability flag is %s%s%s", | |
68980084 | 2621 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
718e3744 | 2622 | "enabled" : "disabled", |
68980084 | 2623 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
718e3744 | 2624 | " (origination blocked)" : "", |
2625 | VTY_NEWLINE); | |
2626 | #endif /* HAVE_OPAQUE_LSA */ | |
88d6cf37 | 2627 | |
2628 | /* Show stub-router configuration */ | |
2629 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED | |
2630 | || ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) | |
2631 | { | |
2632 | vty_out (vty, " Stub router advertisement is configured%s", | |
2633 | VTY_NEWLINE); | |
2634 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) | |
2635 | vty_out (vty, " Enabled for %us after start-up%s", | |
2636 | ospf->stub_router_startup_time, VTY_NEWLINE); | |
2637 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) | |
2638 | vty_out (vty, " Enabled for %us prior to full shutdown%s", | |
2639 | ospf->stub_router_shutdown_time, VTY_NEWLINE); | |
2640 | } | |
2641 | ||
718e3744 | 2642 | /* Show SPF timers. */ |
d24f6e2a | 2643 | vty_out (vty, " Initial SPF scheduling delay %d millisec(s)%s" |
2644 | " Minimum hold time between consecutive SPFs %d millisec(s)%s" | |
2645 | " Maximum hold time between consecutive SPFs %d millisec(s)%s" | |
2646 | " Hold time multiplier is currently %d%s", | |
2647 | ospf->spf_delay, VTY_NEWLINE, | |
2648 | ospf->spf_holdtime, VTY_NEWLINE, | |
2649 | ospf->spf_max_holdtime, VTY_NEWLINE, | |
2650 | ospf->spf_hold_multiplier, VTY_NEWLINE); | |
b8ad39d4 | 2651 | vty_out (vty, " SPF algorithm "); |
2652 | if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec) | |
2653 | { | |
c8c1521a | 2654 | result = tv_sub (recent_time, ospf->ts_spf); |
b8ad39d4 | 2655 | vty_out (vty, "last executed %s ago%s", |
2656 | ospf_timeval_dump (&result, timebuf, sizeof (timebuf)), | |
2657 | VTY_NEWLINE); | |
2658 | } | |
2659 | else | |
2660 | vty_out (vty, "has not been run%s", VTY_NEWLINE); | |
d24f6e2a | 2661 | vty_out (vty, " SPF timer %s%s%s", |
2662 | (ospf->t_spf_calc ? "due in " : "is "), | |
2663 | ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)), | |
2664 | VTY_NEWLINE); | |
2665 | ||
718e3744 | 2666 | /* Show refresh parameters. */ |
2667 | vty_out (vty, " Refresh timer %d secs%s", | |
68980084 | 2668 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
718e3744 | 2669 | |
2670 | /* Show ABR/ASBR flags. */ | |
68980084 | 2671 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
718e3744 | 2672 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
68980084 | 2673 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
718e3744 | 2674 | |
68980084 | 2675 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
718e3744 | 2676 | vty_out (vty, " This router is an ASBR " |
2677 | "(injecting external routing information)%s", VTY_NEWLINE); | |
2678 | ||
2679 | /* Show Number of AS-external-LSAs. */ | |
fe71a97d | 2680 | vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s", |
2681 | ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), | |
2682 | ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE); | |
2683 | #ifdef HAVE_OPAQUE_LSA | |
2684 | vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s", | |
2685 | ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA), | |
2686 | ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE); | |
2687 | #endif /* HAVE_OPAQUE_LSA */ | |
718e3744 | 2688 | /* Show number of areas attached. */ |
2689 | vty_out (vty, " Number of areas attached to this router: %d%s%s", | |
68980084 | 2690 | listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE); |
718e3744 | 2691 | |
2692 | /* Show each area status. */ | |
1eb8ef25 | 2693 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
2694 | show_ip_ospf_area (vty, area); | |
718e3744 | 2695 | |
2696 | return CMD_SUCCESS; | |
2697 | } | |
2698 | ||
2699 | \f | |
fd651fa6 | 2700 | static void |
68980084 | 2701 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
2702 | struct interface *ifp) | |
718e3744 | 2703 | { |
fd651fa6 | 2704 | int is_up; |
718e3744 | 2705 | struct ospf_neighbor *nbr; |
718e3744 | 2706 | struct route_node *rn; |
718e3744 | 2707 | |
718e3744 | 2708 | /* Is interface up? */ |
fd651fa6 | 2709 | vty_out (vty, "%s is %s%s", ifp->name, |
2710 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); | |
d2fc8896 | 2711 | vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s", |
2712 | ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), | |
2713 | VTY_NEWLINE); | |
718e3744 | 2714 | |
2715 | /* Is interface OSPF enabled? */ | |
fd651fa6 | 2716 | if (ospf_oi_count(ifp) == 0) |
718e3744 | 2717 | { |
2718 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); | |
2719 | return; | |
2720 | } | |
fd651fa6 | 2721 | else if (!is_up) |
2722 | { | |
2723 | vty_out (vty, " OSPF is enabled, but not running on this interface%s", | |
2724 | VTY_NEWLINE); | |
2725 | return; | |
2726 | } | |
2727 | ||
718e3744 | 2728 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
2729 | { | |
2730 | struct ospf_interface *oi = rn->info; | |
2731 | ||
2732 | if (oi == NULL) | |
2733 | continue; | |
2734 | ||
2735 | /* Show OSPF interface information. */ | |
2736 | vty_out (vty, " Internet Address %s/%d,", | |
2737 | inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen); | |
2738 | ||
9c27ef9b PJ |
2739 | if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
2740 | { | |
2741 | struct in_addr *dest; | |
2742 | const char *dstr; | |
2743 | ||
2744 | if ((ifp->flags & IFF_POINTOPOINT) | |
2745 | || oi->type == OSPF_IFTYPE_VIRTUALLINK) | |
2746 | dstr = "Peer"; | |
2747 | else | |
2748 | dstr = "Broadcast"; | |
2749 | ||
2750 | /* For Vlinks, showing the peer address is probably more | |
2751 | * informative than the local interface that is being used | |
2752 | */ | |
2753 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) | |
2754 | dest = &oi->vl_data->peer_addr; | |
2755 | else | |
2756 | dest = &oi->connected->destination->u.prefix4; | |
2757 | ||
2758 | vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest)); | |
2759 | } | |
3fb9cd6e | 2760 | |
718e3744 | 2761 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
2762 | VTY_NEWLINE); | |
2763 | ||
ba682537 | 2764 | vty_out (vty, " MTU mismatch detection:%s%s", |
2765 | OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE); | |
2766 | ||
718e3744 | 2767 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
68980084 | 2768 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
718e3744 | 2769 | oi->output_cost, VTY_NEWLINE); |
2770 | ||
2771 | vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s", | |
2772 | OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state), | |
2773 | PRIORITY (oi), VTY_NEWLINE); | |
2774 | ||
2775 | /* Show DR information. */ | |
2776 | if (DR (oi).s_addr == 0) | |
2777 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); | |
2778 | else | |
2779 | { | |
2780 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi)); | |
2781 | if (nbr == NULL) | |
2782 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); | |
2783 | else | |
2784 | { | |
2785 | vty_out (vty, " Designated Router (ID) %s,", | |
2786 | inet_ntoa (nbr->router_id)); | |
2787 | vty_out (vty, " Interface Address %s%s", | |
2788 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); | |
2789 | } | |
2790 | } | |
2791 | ||
2792 | /* Show BDR information. */ | |
2793 | if (BDR (oi).s_addr == 0) | |
2794 | vty_out (vty, " No backup designated router on this network%s", | |
2795 | VTY_NEWLINE); | |
2796 | else | |
2797 | { | |
2798 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi)); | |
2799 | if (nbr == NULL) | |
2800 | vty_out (vty, " No backup designated router on this network%s", | |
2801 | VTY_NEWLINE); | |
2802 | else | |
2803 | { | |
2804 | vty_out (vty, " Backup Designated Router (ID) %s,", | |
2805 | inet_ntoa (nbr->router_id)); | |
2806 | vty_out (vty, " Interface Address %s%s", | |
2807 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); | |
2808 | } | |
2809 | } | |
ba6454ec | 2810 | |
2811 | vty_out (vty, " Multicast group memberships:"); | |
2812 | if (CHECK_FLAG(oi->multicast_memberships, MEMBER_ALLROUTERS)) | |
2813 | vty_out (vty, " OSPFAllRouters"); | |
2814 | if (CHECK_FLAG(oi->multicast_memberships, MEMBER_DROUTERS)) | |
2815 | vty_out (vty, " OSPFDesignatedRouters"); | |
2816 | if (!CHECK_FLAG(oi->multicast_memberships, | |
2817 | MEMBER_ALLROUTERS|MEMBER_DROUTERS)) | |
2818 | vty_out (vty, " <None>"); | |
2819 | vty_out (vty, "%s", VTY_NEWLINE); | |
2820 | ||
718e3744 | 2821 | vty_out (vty, " Timer intervals configured,"); |
f9ad937f | 2822 | vty_out (vty, " Hello "); |
2823 | if (OSPF_IF_PARAM (oi, fast_hello) == 0) | |
2824 | vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello)); | |
2825 | else | |
2826 | vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello)); | |
2827 | vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s", | |
2828 | OSPF_IF_PARAM (oi, v_wait), | |
718e3744 | 2829 | OSPF_IF_PARAM (oi, v_wait), |
2830 | OSPF_IF_PARAM (oi, retransmit_interval), | |
2831 | VTY_NEWLINE); | |
2832 | ||
2833 | if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE) | |
f9ad937f | 2834 | { |
649654ab | 2835 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
f9ad937f | 2836 | vty_out (vty, " Hello due in %s%s", |
649654ab | 2837 | ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)), |
f9ad937f | 2838 | VTY_NEWLINE); |
2839 | } | |
718e3744 | 2840 | else /* OSPF_IF_PASSIVE is set */ |
2841 | vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); | |
2842 | ||
2843 | vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", | |
68980084 | 2844 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
718e3744 | 2845 | VTY_NEWLINE); |
2846 | } | |
2847 | } | |
2848 | ||
2849 | DEFUN (show_ip_ospf_interface, | |
2850 | show_ip_ospf_interface_cmd, | |
2851 | "show ip ospf interface [INTERFACE]", | |
2852 | SHOW_STR | |
2853 | IP_STR | |
2854 | "OSPF information\n" | |
2855 | "Interface information\n" | |
2856 | "Interface name\n") | |
2857 | { | |
2858 | struct interface *ifp; | |
020709f9 | 2859 | struct ospf *ospf; |
52dc7ee6 | 2860 | struct listnode *node; |
718e3744 | 2861 | |
020709f9 | 2862 | ospf = ospf_lookup (); |
cac3b5c4 PJ |
2863 | if (ospf == NULL) |
2864 | { | |
2865 | vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
2866 | return CMD_SUCCESS; | |
2867 | } | |
020709f9 | 2868 | |
718e3744 | 2869 | /* Show All Interfaces. */ |
2870 | if (argc == 0) | |
1eb8ef25 | 2871 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
2872 | show_ip_ospf_interface_sub (vty, ospf, ifp); | |
718e3744 | 2873 | /* Interface name is specified. */ |
2874 | else | |
2875 | { | |
2876 | if ((ifp = if_lookup_by_name (argv[0])) == NULL) | |
2877 | vty_out (vty, "No such interface name%s", VTY_NEWLINE); | |
2878 | else | |
68980084 | 2879 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
718e3744 | 2880 | } |
2881 | ||
2882 | return CMD_SUCCESS; | |
2883 | } | |
2884 | ||
d24f6e2a | 2885 | static void |
2886 | show_ip_ospf_neighbour_header (struct vty *vty) | |
2887 | { | |
2888 | vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s", | |
2889 | VTY_NEWLINE, | |
2890 | "Neighbor ID", "Pri", "State", "Dead Time", | |
2891 | "Address", "Interface", "RXmtL", "RqstL", "DBsmL", | |
2892 | VTY_NEWLINE); | |
2893 | } | |
2894 | ||
4dadc291 | 2895 | static void |
718e3744 | 2896 | show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) |
2897 | { | |
2898 | struct route_node *rn; | |
2899 | struct ospf_neighbor *nbr; | |
2900 | char msgbuf[16]; | |
649654ab | 2901 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
718e3744 | 2902 | |
2903 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) | |
2904 | if ((nbr = rn->info)) | |
2905 | /* Do not show myself. */ | |
2906 | if (nbr != oi->nbr_self) | |
2907 | /* Down state is not shown. */ | |
2908 | if (nbr->state != NSM_Down) | |
2909 | { | |
2910 | ospf_nbr_state_message (nbr, msgbuf, 16); | |
2911 | ||
2912 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) | |
d24f6e2a | 2913 | vty_out (vty, "%-15s %3d %-15s ", |
2914 | "-", nbr->priority, | |
2915 | msgbuf); | |
2916 | else | |
2917 | vty_out (vty, "%-15s %3d %-15s ", | |
2918 | inet_ntoa (nbr->router_id), nbr->priority, | |
2919 | msgbuf); | |
2920 | ||
2921 | vty_out (vty, "%9s ", | |
2922 | ospf_timer_dump (nbr->t_inactivity, timebuf, | |
2923 | sizeof(timebuf))); | |
2924 | ||
718e3744 | 2925 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
d24f6e2a | 2926 | vty_out (vty, "%-20s %5ld %5ld %5d%s", |
718e3744 | 2927 | IF_NAME (oi), ospf_ls_retransmit_count (nbr), |
2928 | ospf_ls_request_count (nbr), ospf_db_summary_count (nbr), | |
2929 | VTY_NEWLINE); | |
2930 | } | |
2931 | } | |
2932 | ||
2933 | DEFUN (show_ip_ospf_neighbor, | |
2934 | show_ip_ospf_neighbor_cmd, | |
2935 | "show ip ospf neighbor", | |
2936 | SHOW_STR | |
2937 | IP_STR | |
2938 | "OSPF information\n" | |
2939 | "Neighbor list\n") | |
2940 | { | |
020709f9 | 2941 | struct ospf *ospf; |
1eb8ef25 | 2942 | struct ospf_interface *oi; |
52dc7ee6 | 2943 | struct listnode *node; |
718e3744 | 2944 | |
020709f9 | 2945 | ospf = ospf_lookup (); |
68980084 | 2946 | if (ospf == NULL) |
718e3744 | 2947 | { |
2948 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
2949 | return CMD_SUCCESS; | |
2950 | } | |
2951 | ||
d24f6e2a | 2952 | show_ip_ospf_neighbour_header (vty); |
718e3744 | 2953 | |
1eb8ef25 | 2954 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
2955 | show_ip_ospf_neighbor_sub (vty, oi); | |
718e3744 | 2956 | |
2957 | return CMD_SUCCESS; | |
2958 | } | |
2959 | ||
2960 | DEFUN (show_ip_ospf_neighbor_all, | |
2961 | show_ip_ospf_neighbor_all_cmd, | |
2962 | "show ip ospf neighbor all", | |
2963 | SHOW_STR | |
2964 | IP_STR | |
2965 | "OSPF information\n" | |
2966 | "Neighbor list\n" | |
2967 | "include down status neighbor\n") | |
2968 | { | |
68980084 | 2969 | struct ospf *ospf = vty->index; |
52dc7ee6 | 2970 | struct listnode *node; |
1eb8ef25 | 2971 | struct ospf_interface *oi; |
718e3744 | 2972 | |
68980084 | 2973 | if (ospf == NULL) |
718e3744 | 2974 | { |
2975 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
2976 | return CMD_SUCCESS; | |
2977 | } | |
d24f6e2a | 2978 | |
2979 | show_ip_ospf_neighbour_header (vty); | |
2980 | ||
1eb8ef25 | 2981 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
718e3744 | 2982 | { |
52dc7ee6 | 2983 | struct listnode *nbr_node; |
1eb8ef25 | 2984 | struct ospf_nbr_nbma *nbr_nbma; |
718e3744 | 2985 | |
2986 | show_ip_ospf_neighbor_sub (vty, oi); | |
2987 | ||
2988 | /* print Down neighbor status */ | |
1eb8ef25 | 2989 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
718e3744 | 2990 | { |
718e3744 | 2991 | if (nbr_nbma->nbr == NULL |
2992 | || nbr_nbma->nbr->state == NSM_Down) | |
2993 | { | |
d24f6e2a | 2994 | vty_out (vty, "%-15s %3d %-15s %9s ", |
718e3744 | 2995 | "-", nbr_nbma->priority, "Down", "-"); |
d24f6e2a | 2996 | vty_out (vty, "%-15s %-20s %5d %5d %5d%s", |
718e3744 | 2997 | inet_ntoa (nbr_nbma->addr), IF_NAME (oi), |
2998 | 0, 0, 0, VTY_NEWLINE); | |
2999 | } | |
3000 | } | |
3001 | } | |
3002 | ||
3003 | return CMD_SUCCESS; | |
3004 | } | |
3005 | ||
3006 | DEFUN (show_ip_ospf_neighbor_int, | |
3007 | show_ip_ospf_neighbor_int_cmd, | |
bb5b7552 | 3008 | "show ip ospf neighbor IFNAME", |
718e3744 | 3009 | SHOW_STR |
3010 | IP_STR | |
3011 | "OSPF information\n" | |
3012 | "Neighbor list\n" | |
3013 | "Interface name\n") | |
3014 | { | |
020709f9 | 3015 | struct ospf *ospf; |
bb5b7552 | 3016 | struct interface *ifp; |
3017 | struct route_node *rn; | |
3018 | ||
3019 | ifp = if_lookup_by_name (argv[0]); | |
3020 | if (!ifp) | |
718e3744 | 3021 | { |
bb5b7552 | 3022 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
718e3744 | 3023 | return CMD_WARNING; |
3024 | } | |
3025 | ||
020709f9 | 3026 | ospf = ospf_lookup (); |
3027 | if (ospf == NULL) | |
3028 | { | |
3029 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
3030 | return CMD_SUCCESS; | |
3031 | } | |
d24f6e2a | 3032 | |
3033 | show_ip_ospf_neighbour_header (vty); | |
3034 | ||
bb5b7552 | 3035 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
718e3744 | 3036 | { |
bb5b7552 | 3037 | struct ospf_interface *oi = rn->info; |
3038 | ||
3039 | if (oi == NULL) | |
3040 | continue; | |
3041 | ||
718e3744 | 3042 | show_ip_ospf_neighbor_sub (vty, oi); |
3043 | } | |
3044 | ||
3045 | return CMD_SUCCESS; | |
3046 | } | |
3047 | ||
4dadc291 | 3048 | static void |
718e3744 | 3049 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
3050 | struct ospf_nbr_nbma *nbr_nbma) | |
3051 | { | |
649654ab | 3052 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
718e3744 | 3053 | |
3054 | /* Show neighbor ID. */ | |
3055 | vty_out (vty, " Neighbor %s,", "-"); | |
3056 | ||
3057 | /* Show interface address. */ | |
3058 | vty_out (vty, " interface address %s%s", | |
3059 | inet_ntoa (nbr_nbma->addr), VTY_NEWLINE); | |
3060 | /* Show Area ID. */ | |
3061 | vty_out (vty, " In the area %s via interface %s%s", | |
3062 | ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE); | |
3063 | /* Show neighbor priority and state. */ | |
3064 | vty_out (vty, " Neighbor priority is %d, State is %s,", | |
3065 | nbr_nbma->priority, "Down"); | |
3066 | /* Show state changes. */ | |
3067 | vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE); | |
3068 | ||
3069 | /* Show PollInterval */ | |
3070 | vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE); | |
3071 | ||
3072 | /* Show poll-interval timer. */ | |
3073 | vty_out (vty, " Poll timer due in %s%s", | |
d24f6e2a | 3074 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)), |
3075 | VTY_NEWLINE); | |
718e3744 | 3076 | |
3077 | /* Show poll-interval timer thread. */ | |
3078 | vty_out (vty, " Thread Poll Timer %s%s", | |
3079 | nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); | |
3080 | } | |
3081 | ||
4dadc291 | 3082 | static void |
718e3744 | 3083 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
3084 | struct ospf_neighbor *nbr) | |
3085 | { | |
649654ab | 3086 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
718e3744 | 3087 | |
3088 | /* Show neighbor ID. */ | |
3089 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) | |
3090 | vty_out (vty, " Neighbor %s,", "-"); | |
3091 | else | |
3092 | vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id)); | |
3093 | ||
3094 | /* Show interface address. */ | |
3095 | vty_out (vty, " interface address %s%s", | |
3096 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); | |
3097 | /* Show Area ID. */ | |
3098 | vty_out (vty, " In the area %s via interface %s%s", | |
3099 | ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE); | |
3100 | /* Show neighbor priority and state. */ | |
3101 | vty_out (vty, " Neighbor priority is %d, State is %s,", | |
3102 | nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state)); | |
3103 | /* Show state changes. */ | |
3104 | vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE); | |
3105 | ||
3106 | /* Show Designated Rotuer ID. */ | |
3107 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); | |
3108 | /* Show Backup Designated Rotuer ID. */ | |
3109 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); | |
3110 | /* Show options. */ | |
3111 | vty_out (vty, " Options %d %s%s", nbr->options, | |
3112 | ospf_options_dump (nbr->options), VTY_NEWLINE); | |
3113 | /* Show Router Dead interval timer. */ | |
3114 | vty_out (vty, " Dead timer due in %s%s", | |
d24f6e2a | 3115 | ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)), |
3116 | VTY_NEWLINE); | |
718e3744 | 3117 | /* Show Database Summary list. */ |
3118 | vty_out (vty, " Database Summary List %d%s", | |
3119 | ospf_db_summary_count (nbr), VTY_NEWLINE); | |
3120 | /* Show Link State Request list. */ | |
3121 | vty_out (vty, " Link State Request List %ld%s", | |
3122 | ospf_ls_request_count (nbr), VTY_NEWLINE); | |
3123 | /* Show Link State Retransmission list. */ | |
3124 | vty_out (vty, " Link State Retransmission List %ld%s", | |
3125 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); | |
3126 | /* Show inactivity timer thread. */ | |
3127 | vty_out (vty, " Thread Inactivity Timer %s%s", | |
3128 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); | |
3129 | /* Show Database Description retransmission thread. */ | |
3130 | vty_out (vty, " Thread Database Description Retransmision %s%s", | |
3131 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); | |
3132 | /* Show Link State Request Retransmission thread. */ | |
3133 | vty_out (vty, " Thread Link State Request Retransmission %s%s", | |
3134 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); | |
3135 | /* Show Link State Update Retransmission thread. */ | |
3136 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", | |
3137 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); | |
3138 | } | |
3139 | ||
3140 | DEFUN (show_ip_ospf_neighbor_id, | |
3141 | show_ip_ospf_neighbor_id_cmd, | |
3142 | "show ip ospf neighbor A.B.C.D", | |
3143 | SHOW_STR | |
3144 | IP_STR | |
3145 | "OSPF information\n" | |
3146 | "Neighbor list\n" | |
3147 | "Neighbor ID\n") | |
3148 | { | |
020709f9 | 3149 | struct ospf *ospf; |
52dc7ee6 | 3150 | struct listnode *node; |
718e3744 | 3151 | struct ospf_neighbor *nbr; |
1eb8ef25 | 3152 | struct ospf_interface *oi; |
718e3744 | 3153 | struct in_addr router_id; |
3154 | int ret; | |
3155 | ||
3156 | ret = inet_aton (argv[0], &router_id); | |
3157 | if (!ret) | |
3158 | { | |
3159 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); | |
3160 | return CMD_WARNING; | |
3161 | } | |
3162 | ||
020709f9 | 3163 | ospf = ospf_lookup (); |
3164 | if (ospf == NULL) | |
3165 | { | |
3166 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
3167 | return CMD_SUCCESS; | |
3168 | } | |
3169 | ||
1eb8ef25 | 3170 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
3171 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) | |
3172 | { | |
3173 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); | |
3174 | return CMD_SUCCESS; | |
3175 | } | |
718e3744 | 3176 | |
3177 | /* Nothing to show. */ | |
3178 | return CMD_SUCCESS; | |
3179 | } | |
3180 | ||
3181 | DEFUN (show_ip_ospf_neighbor_detail, | |
3182 | show_ip_ospf_neighbor_detail_cmd, | |
3183 | "show ip ospf neighbor detail", | |
3184 | SHOW_STR | |
3185 | IP_STR | |
3186 | "OSPF information\n" | |
3187 | "Neighbor list\n" | |
3188 | "detail of all neighbors\n") | |
3189 | { | |
020709f9 | 3190 | struct ospf *ospf; |
1eb8ef25 | 3191 | struct ospf_interface *oi; |
52dc7ee6 | 3192 | struct listnode *node; |
718e3744 | 3193 | |
020709f9 | 3194 | ospf = ospf_lookup (); |
68980084 | 3195 | if (ospf == NULL) |
020709f9 | 3196 | { |
3197 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
3198 | return CMD_SUCCESS; | |
3199 | } | |
718e3744 | 3200 | |
1eb8ef25 | 3201 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
718e3744 | 3202 | { |
718e3744 | 3203 | struct route_node *rn; |
3204 | struct ospf_neighbor *nbr; | |
3205 | ||
3206 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) | |
3207 | if ((nbr = rn->info)) | |
3208 | if (nbr != oi->nbr_self) | |
3209 | if (nbr->state != NSM_Down) | |
3210 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); | |
3211 | } | |
3212 | ||
3213 | return CMD_SUCCESS; | |
3214 | } | |
3215 | ||
3216 | DEFUN (show_ip_ospf_neighbor_detail_all, | |
3217 | show_ip_ospf_neighbor_detail_all_cmd, | |
3218 | "show ip ospf neighbor detail all", | |
3219 | SHOW_STR | |
3220 | IP_STR | |
3221 | "OSPF information\n" | |
3222 | "Neighbor list\n" | |
3223 | "detail of all neighbors\n" | |
3224 | "include down status neighbor\n") | |
3225 | { | |
020709f9 | 3226 | struct ospf *ospf; |
52dc7ee6 | 3227 | struct listnode *node; |
1eb8ef25 | 3228 | struct ospf_interface *oi; |
718e3744 | 3229 | |
020709f9 | 3230 | ospf = ospf_lookup (); |
68980084 | 3231 | if (ospf == NULL) |
020709f9 | 3232 | { |
3233 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
3234 | return CMD_SUCCESS; | |
3235 | } | |
718e3744 | 3236 | |
1eb8ef25 | 3237 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
718e3744 | 3238 | { |
718e3744 | 3239 | struct route_node *rn; |
3240 | struct ospf_neighbor *nbr; | |
1eb8ef25 | 3241 | struct ospf_nbr_nbma *nbr_nbma; |
718e3744 | 3242 | |
3243 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) | |
3244 | if ((nbr = rn->info)) | |
3245 | if (nbr != oi->nbr_self) | |
3246 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) | |
3247 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); | |
3248 | ||
3249 | if (oi->type == OSPF_IFTYPE_NBMA) | |
3250 | { | |
52dc7ee6 | 3251 | struct listnode *nd; |
718e3744 | 3252 | |
1eb8ef25 | 3253 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
3254 | if (nbr_nbma->nbr == NULL | |
3255 | || nbr_nbma->nbr->state == NSM_Down) | |
3256 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); | |
718e3744 | 3257 | } |
3258 | } | |
3259 | ||
3260 | return CMD_SUCCESS; | |
3261 | } | |
3262 | ||
3263 | DEFUN (show_ip_ospf_neighbor_int_detail, | |
3264 | show_ip_ospf_neighbor_int_detail_cmd, | |
bb5b7552 | 3265 | "show ip ospf neighbor IFNAME detail", |
718e3744 | 3266 | SHOW_STR |
3267 | IP_STR | |
3268 | "OSPF information\n" | |
3269 | "Neighbor list\n" | |
bb5b7552 | 3270 | "Interface name\n" |
718e3744 | 3271 | "detail of all neighbors") |
3272 | { | |
020709f9 | 3273 | struct ospf *ospf; |
718e3744 | 3274 | struct ospf_interface *oi; |
bb5b7552 | 3275 | struct interface *ifp; |
3276 | struct route_node *rn, *nrn; | |
3277 | struct ospf_neighbor *nbr; | |
3278 | ||
3279 | ifp = if_lookup_by_name (argv[0]); | |
3280 | if (!ifp) | |
718e3744 | 3281 | { |
bb5b7552 | 3282 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
718e3744 | 3283 | return CMD_WARNING; |
3284 | } | |
3285 | ||
020709f9 | 3286 | ospf = ospf_lookup (); |
3287 | if (ospf == NULL) | |
3288 | { | |
3289 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
3290 | return CMD_SUCCESS; | |
3291 | } | |
68980084 | 3292 | |
718e3744 | 3293 | |
bb5b7552 | 3294 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
3295 | if ((oi = rn->info)) | |
3296 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) | |
3297 | if ((nbr = nrn->info)) | |
718e3744 | 3298 | if (nbr != oi->nbr_self) |
3299 | if (nbr->state != NSM_Down) | |
3300 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); | |
718e3744 | 3301 | |
3302 | return CMD_SUCCESS; | |
3303 | } | |
3304 | ||
3305 | \f | |
3306 | /* Show functions */ | |
4dadc291 | 3307 | static int |
020709f9 | 3308 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
718e3744 | 3309 | { |
718e3744 | 3310 | struct router_lsa *rl; |
3311 | struct summary_lsa *sl; | |
3312 | struct as_external_lsa *asel; | |
3313 | struct prefix_ipv4 p; | |
3314 | ||
3315 | if (lsa != NULL) | |
3316 | /* If self option is set, check LSA self flag. */ | |
3317 | if (self == 0 || IS_LSA_SELF (lsa)) | |
3318 | { | |
3319 | /* LSA common part show. */ | |
3320 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); | |
3321 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", | |
3322 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), | |
3323 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); | |
3324 | /* LSA specific part show. */ | |
3325 | switch (lsa->data->type) | |
3326 | { | |
3327 | case OSPF_ROUTER_LSA: | |
3328 | rl = (struct router_lsa *) lsa->data; | |
3329 | vty_out (vty, " %-d", ntohs (rl->links)); | |
3330 | break; | |
3331 | case OSPF_SUMMARY_LSA: | |
3332 | sl = (struct summary_lsa *) lsa->data; | |
3333 | ||
3334 | p.family = AF_INET; | |
3335 | p.prefix = sl->header.id; | |
3336 | p.prefixlen = ip_masklen (sl->mask); | |
3337 | apply_mask_ipv4 (&p); | |
3338 | ||
3339 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); | |
3340 | break; | |
3341 | case OSPF_AS_EXTERNAL_LSA: | |
551a8979 | 3342 | case OSPF_AS_NSSA_LSA: |
718e3744 | 3343 | asel = (struct as_external_lsa *) lsa->data; |
3344 | ||
3345 | p.family = AF_INET; | |
3346 | p.prefix = asel->header.id; | |
3347 | p.prefixlen = ip_masklen (asel->mask); | |
3348 | apply_mask_ipv4 (&p); | |
3349 | ||
3350 | vty_out (vty, " %s %s/%d [0x%lx]", | |
3351 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", | |
3352 | inet_ntoa (p.prefix), p.prefixlen, | |
3353 | (u_long)ntohl (asel->e[0].route_tag)); | |
3354 | break; | |
3355 | case OSPF_NETWORK_LSA: | |
3356 | case OSPF_ASBR_SUMMARY_LSA: | |
3357 | #ifdef HAVE_OPAQUE_LSA | |
3358 | case OSPF_OPAQUE_LINK_LSA: | |
3359 | case OSPF_OPAQUE_AREA_LSA: | |
3360 | case OSPF_OPAQUE_AS_LSA: | |
3361 | #endif /* HAVE_OPAQUE_LSA */ | |
3362 | default: | |
3363 | break; | |
3364 | } | |
3365 | vty_out (vty, VTY_NEWLINE); | |
3366 | } | |
3367 | ||
3368 | return 0; | |
3369 | } | |
3370 | ||
eb1ce605 | 3371 | const char *show_database_desc[] = |
718e3744 | 3372 | { |
3373 | "unknown", | |
3374 | "Router Link States", | |
3375 | "Net Link States", | |
3376 | "Summary Link States", | |
3377 | "ASBR-Summary Link States", | |
3378 | "AS External Link States", | |
718e3744 | 3379 | "Group Membership LSA", |
3380 | "NSSA-external Link States", | |
718e3744 | 3381 | #ifdef HAVE_OPAQUE_LSA |
3382 | "Type-8 LSA", | |
3383 | "Link-Local Opaque-LSA", | |
3384 | "Area-Local Opaque-LSA", | |
3385 | "AS-external Opaque-LSA", | |
3386 | #endif /* HAVE_OPAQUE_LSA */ | |
3387 | }; | |
3388 | ||
3389 | #define SHOW_OSPF_COMMON_HEADER \ | |
3390 | "Link ID ADV Router Age Seq# CkSum" | |
3391 | ||
eb1ce605 | 3392 | const char *show_database_header[] = |
718e3744 | 3393 | { |
3394 | "", | |
3395 | "Link ID ADV Router Age Seq# CkSum Link count", | |
3396 | "Link ID ADV Router Age Seq# CkSum", | |
3397 | "Link ID ADV Router Age Seq# CkSum Route", | |
3398 | "Link ID ADV Router Age Seq# CkSum", | |
3399 | "Link ID ADV Router Age Seq# CkSum Route", | |
718e3744 | 3400 | " --- header for Group Member ----", |
3401 | "Link ID ADV Router Age Seq# CkSum Route", | |
718e3744 | 3402 | #ifdef HAVE_OPAQUE_LSA |
718e3744 | 3403 | " --- type-8 ---", |
3404 | "Opaque-Type/Id ADV Router Age Seq# CkSum", | |
3405 | "Opaque-Type/Id ADV Router Age Seq# CkSum", | |
3406 | "Opaque-Type/Id ADV Router Age Seq# CkSum", | |
3407 | #endif /* HAVE_OPAQUE_LSA */ | |
3408 | }; | |
3409 | ||
eb1ce605 | 3410 | const char *show_lsa_flags[] = |
4957f494 | 3411 | { |
3412 | "Self-originated", | |
3413 | "Checked", | |
3414 | "Received", | |
3415 | "Approved", | |
3416 | "Discard", | |
4957f494 | 3417 | "Translated", |
4957f494 | 3418 | }; |
3419 | ||
4dadc291 | 3420 | static void |
718e3744 | 3421 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
3422 | { | |
3423 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; | |
4957f494 | 3424 | |
718e3744 | 3425 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
4957f494 | 3426 | vty_out (vty, " Options: 0x%-2x : %s%s", |
3427 | lsa->data->options, | |
3428 | ospf_options_dump(lsa->data->options), | |
3429 | VTY_NEWLINE); | |
3430 | vty_out (vty, " LS Flags: 0x%-2x %s%s", | |
9d526037 | 3431 | lsa->flags, |
4957f494 | 3432 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
3433 | VTY_NEWLINE); | |
718e3744 | 3434 | |
3435 | if (lsa->data->type == OSPF_ROUTER_LSA) | |
3436 | { | |
3437 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); | |
3438 | ||
3439 | if (rlsa->flags) | |
3440 | vty_out (vty, " :%s%s%s%s", | |
3441 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", | |
3442 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", | |
3443 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", | |
3444 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); | |
3445 | ||
3446 | vty_out (vty, "%s", VTY_NEWLINE); | |
3447 | } | |
3448 | vty_out (vty, " LS Type: %s%s", | |
3449 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); | |
3450 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), | |
3451 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); | |
3452 | vty_out (vty, " Advertising Router: %s%s", | |
3453 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); | |
3454 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), | |
3455 | VTY_NEWLINE); | |
3456 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), | |
3457 | VTY_NEWLINE); | |
3458 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); | |
3459 | } | |
3460 | ||
eb1ce605 | 3461 | const char *link_type_desc[] = |
718e3744 | 3462 | { |
3463 | "(null)", | |
3464 | "another Router (point-to-point)", | |
3465 | "a Transit Network", | |
3466 | "Stub Network", | |
3467 | "a Virtual Link", | |
3468 | }; | |
3469 | ||
eb1ce605 | 3470 | const char *link_id_desc[] = |
718e3744 | 3471 | { |
3472 | "(null)", | |
3473 | "Neighboring Router ID", | |
3474 | "Designated Router address", | |
68980084 | 3475 | "Net", |
718e3744 | 3476 | "Neighboring Router ID", |
3477 | }; | |
3478 | ||
eb1ce605 | 3479 | const char *link_data_desc[] = |
718e3744 | 3480 | { |
3481 | "(null)", | |
3482 | "Router Interface address", | |
3483 | "Router Interface address", | |
3484 | "Network Mask", | |
3485 | "Router Interface address", | |
3486 | }; | |
3487 | ||
3488 | /* Show router-LSA each Link information. */ | |
4dadc291 | 3489 | static void |
718e3744 | 3490 | show_ip_ospf_database_router_links (struct vty *vty, |
3491 | struct router_lsa *rl) | |
3492 | { | |
3493 | int len, i, type; | |
3494 | ||
3495 | len = ntohs (rl->header.length) - 4; | |
3496 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) | |
3497 | { | |
3498 | type = rl->link[i].type; | |
3499 | ||
3500 | vty_out (vty, " Link connected to: %s%s", | |
3501 | link_type_desc[type], VTY_NEWLINE); | |
3502 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], | |
3503 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); | |
3504 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], | |
3505 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); | |
3506 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); | |
3507 | vty_out (vty, " TOS 0 Metric: %d%s", | |
3508 | ntohs (rl->link[i].metric), VTY_NEWLINE); | |
3509 | vty_out (vty, "%s", VTY_NEWLINE); | |
3510 | } | |
3511 | } | |
3512 | ||
3513 | /* Show router-LSA detail information. */ | |
4dadc291 | 3514 | static int |
718e3744 | 3515 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3516 | { | |
3517 | if (lsa != NULL) | |
3518 | { | |
3519 | struct router_lsa *rl = (struct router_lsa *) lsa->data; | |
3520 | ||
3521 | show_ip_ospf_database_header (vty, lsa); | |
3522 | ||
3523 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), | |
3524 | VTY_NEWLINE, VTY_NEWLINE); | |
3525 | ||
3526 | show_ip_ospf_database_router_links (vty, rl); | |
b0a053be | 3527 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 3528 | } |
3529 | ||
3530 | return 0; | |
3531 | } | |
3532 | ||
3533 | /* Show network-LSA detail information. */ | |
4dadc291 | 3534 | static int |
718e3744 | 3535 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3536 | { | |
3537 | int length, i; | |
3538 | ||
3539 | if (lsa != NULL) | |
3540 | { | |
3541 | struct network_lsa *nl = (struct network_lsa *) lsa->data; | |
3542 | ||
3543 | show_ip_ospf_database_header (vty, lsa); | |
3544 | ||
3545 | vty_out (vty, " Network Mask: /%d%s", | |
3546 | ip_masklen (nl->mask), VTY_NEWLINE); | |
3547 | ||
3548 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; | |
3549 | ||
3550 | for (i = 0; length > 0; i++, length -= 4) | |
3551 | vty_out (vty, " Attached Router: %s%s", | |
3552 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); | |
3553 | ||
3554 | vty_out (vty, "%s", VTY_NEWLINE); | |
3555 | } | |
3556 | ||
3557 | return 0; | |
3558 | } | |
3559 | ||
3560 | /* Show summary-LSA detail information. */ | |
4dadc291 | 3561 | static int |
718e3744 | 3562 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3563 | { | |
3564 | if (lsa != NULL) | |
3565 | { | |
3566 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; | |
3567 | ||
3568 | show_ip_ospf_database_header (vty, lsa); | |
3569 | ||
3570 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), | |
3571 | VTY_NEWLINE); | |
3572 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), | |
3573 | VTY_NEWLINE); | |
b0a053be | 3574 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 3575 | } |
3576 | ||
3577 | return 0; | |
3578 | } | |
3579 | ||
3580 | /* Show summary-ASBR-LSA detail information. */ | |
4dadc291 | 3581 | static int |
718e3744 | 3582 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3583 | { | |
3584 | if (lsa != NULL) | |
3585 | { | |
3586 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; | |
3587 | ||
3588 | show_ip_ospf_database_header (vty, lsa); | |
3589 | ||
3590 | vty_out (vty, " Network Mask: /%d%s", | |
3591 | ip_masklen (sl->mask), VTY_NEWLINE); | |
3592 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), | |
3593 | VTY_NEWLINE); | |
b0a053be | 3594 | vty_out (vty, "%s", VTY_NEWLINE); |
718e3744 | 3595 | } |
3596 | ||
3597 | return 0; | |
3598 | } | |
3599 | ||
3600 | /* Show AS-external-LSA detail information. */ | |
4dadc291 | 3601 | static int |
718e3744 | 3602 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3603 | { | |
3604 | if (lsa != NULL) | |
3605 | { | |
3606 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; | |
3607 | ||
3608 | show_ip_ospf_database_header (vty, lsa); | |
3609 | ||
3610 | vty_out (vty, " Network Mask: /%d%s", | |
3611 | ip_masklen (al->mask), VTY_NEWLINE); | |
3612 | vty_out (vty, " Metric Type: %s%s", | |
3613 | IS_EXTERNAL_METRIC (al->e[0].tos) ? | |
3614 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); | |
3615 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); | |
3616 | vty_out (vty, " Metric: %d%s", | |
3617 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); | |
3618 | vty_out (vty, " Forward Address: %s%s", | |
3619 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); | |
3620 | ||
3621 | vty_out (vty, " External Route Tag: %lu%s%s", | |
3622 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); | |
3623 | } | |
3624 | ||
3625 | return 0; | |
3626 | } | |
3627 | ||
2a42e285 | 3628 | /* N.B. This function currently seems to be unused. */ |
4dadc291 | 3629 | static int |
718e3744 | 3630 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
3631 | { | |
3632 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; | |
3633 | ||
3634 | /* show_ip_ospf_database_header (vty, lsa); */ | |
3635 | ||
2a42e285 | 3636 | zlog_debug( " Network Mask: /%d%s", |
718e3744 | 3637 | ip_masklen (al->mask), "\n"); |
2a42e285 | 3638 | zlog_debug( " Metric Type: %s%s", |
718e3744 | 3639 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
3640 | "2 (Larger than any link state path)" : "1", "\n"); | |
2a42e285 | 3641 | zlog_debug( " TOS: 0%s", "\n"); |
3642 | zlog_debug( " Metric: %d%s", | |
718e3744 | 3643 | GET_METRIC (al->e[0].metric), "\n"); |
2a42e285 | 3644 | zlog_debug( " Forward Address: %s%s", |
718e3744 | 3645 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
3646 | ||
2a42e285 | 3647 | zlog_debug( " External Route Tag: %u%s%s", |
718e3744 | 3648 | ntohl (al->e[0].route_tag), "\n", "\n"); |
3649 | ||
3650 | return 0; | |
3651 | } | |
3652 | ||
3653 | /* Show AS-NSSA-LSA detail information. */ | |
4dadc291 | 3654 | static int |
718e3744 | 3655 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3656 | { | |
3657 | if (lsa != NULL) | |
3658 | { | |
3659 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; | |
3660 | ||
3661 | show_ip_ospf_database_header (vty, lsa); | |
3662 | ||
3663 | vty_out (vty, " Network Mask: /%d%s", | |
3664 | ip_masklen (al->mask), VTY_NEWLINE); | |
3665 | vty_out (vty, " Metric Type: %s%s", | |
3666 | IS_EXTERNAL_METRIC (al->e[0].tos) ? | |
3667 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); | |
3668 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); | |
3669 | vty_out (vty, " Metric: %d%s", | |
3670 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); | |
3671 | vty_out (vty, " NSSA: Forward Address: %s%s", | |
3672 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); | |
3673 | ||
3674 | vty_out (vty, " External Route Tag: %u%s%s", | |
3675 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); | |
3676 | } | |
3677 | ||
3678 | return 0; | |
3679 | } | |
3680 | ||
4dadc291 | 3681 | static int |
718e3744 | 3682 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
3683 | { | |
3684 | return 0; | |
3685 | } | |
3686 | ||
3687 | #ifdef HAVE_OPAQUE_LSA | |
4dadc291 | 3688 | static int |
718e3744 | 3689 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
3690 | { | |
3691 | if (lsa != NULL) | |
3692 | { | |
3693 | show_ip_ospf_database_header (vty, lsa); | |
3694 | show_opaque_info_detail (vty, lsa); | |
3695 | ||
3696 | vty_out (vty, "%s", VTY_NEWLINE); | |
3697 | } | |
3698 | return 0; | |
3699 | } | |
3700 | #endif /* HAVE_OPAQUE_LSA */ | |
3701 | ||
3702 | int (*show_function[])(struct vty *, struct ospf_lsa *) = | |
3703 | { | |
3704 | NULL, | |
3705 | show_router_lsa_detail, | |
3706 | show_network_lsa_detail, | |
3707 | show_summary_lsa_detail, | |
3708 | show_summary_asbr_lsa_detail, | |
3709 | show_as_external_lsa_detail, | |
718e3744 | 3710 | show_func_dummy, |
3711 | show_as_nssa_lsa_detail, /* almost same as external */ | |
718e3744 | 3712 | #ifdef HAVE_OPAQUE_LSA |
718e3744 | 3713 | NULL, /* type-8 */ |
3714 | show_opaque_lsa_detail, | |
3715 | show_opaque_lsa_detail, | |
3716 | show_opaque_lsa_detail, | |
3717 | #endif /* HAVE_OPAQUE_LSA */ | |
3718 | }; | |
3719 | ||
4dadc291 | 3720 | static void |
718e3744 | 3721 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
3722 | struct in_addr *adv_router) | |
3723 | { | |
3724 | memset (lp, 0, sizeof (struct prefix_ls)); | |
3725 | lp->family = 0; | |
3726 | if (id == NULL) | |
3727 | lp->prefixlen = 0; | |
3728 | else if (adv_router == NULL) | |
3729 | { | |
3730 | lp->prefixlen = 32; | |
3731 | lp->id = *id; | |
3732 | } | |
3733 | else | |
3734 | { | |
3735 | lp->prefixlen = 64; | |
3736 | lp->id = *id; | |
3737 | lp->adv_router = *adv_router; | |
3738 | } | |
3739 | } | |
3740 | ||
4dadc291 | 3741 | static void |
718e3744 | 3742 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
3743 | struct in_addr *id, struct in_addr *adv_router) | |
3744 | { | |
3745 | struct prefix_ls lp; | |
3746 | struct route_node *rn, *start; | |
3747 | struct ospf_lsa *lsa; | |
3748 | ||
3749 | show_lsa_prefix_set (vty, &lp, id, adv_router); | |
3750 | start = route_node_get (rt, (struct prefix *) &lp); | |
3751 | if (start) | |
3752 | { | |
3753 | route_lock_node (start); | |
3754 | for (rn = start; rn; rn = route_next_until (rn, start)) | |
3755 | if ((lsa = rn->info)) | |
3756 | { | |
718e3744 | 3757 | if (show_function[lsa->data->type] != NULL) |
3758 | show_function[lsa->data->type] (vty, lsa); | |
3759 | } | |
3760 | route_unlock_node (start); | |
3761 | } | |
3762 | } | |
3763 | ||
3764 | /* Show detail LSA information | |
3765 | -- if id is NULL then show all LSAs. */ | |
4dadc291 | 3766 | static void |
020709f9 | 3767 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
718e3744 | 3768 | struct in_addr *id, struct in_addr *adv_router) |
3769 | { | |
52dc7ee6 | 3770 | struct listnode *node; |
1eb8ef25 | 3771 | struct ospf_area *area; |
3772 | ||
718e3744 | 3773 | switch (type) |
3774 | { | |
3775 | case OSPF_AS_EXTERNAL_LSA: | |
3776 | #ifdef HAVE_OPAQUE_LSA | |
3777 | case OSPF_OPAQUE_AS_LSA: | |
3778 | #endif /* HAVE_OPAQUE_LSA */ | |
3779 | vty_out (vty, " %s %s%s", | |
3780 | show_database_desc[type], | |
3781 | VTY_NEWLINE, VTY_NEWLINE); | |
68980084 | 3782 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
718e3744 | 3783 | break; |
3784 | default: | |
1eb8ef25 | 3785 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
718e3744 | 3786 | { |
718e3744 | 3787 | vty_out (vty, "%s %s (Area %s)%s%s", |
3788 | VTY_NEWLINE, show_database_desc[type], | |
3789 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); | |
3790 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); | |
3791 | } | |
3792 | break; | |
3793 | } | |
3794 | } | |
3795 | ||
4dadc291 | 3796 | static void |
718e3744 | 3797 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
3798 | struct in_addr *adv_router) | |
3799 | { | |
3800 | struct route_node *rn; | |
3801 | struct ospf_lsa *lsa; | |
3802 | ||
3803 | for (rn = route_top (rt); rn; rn = route_next (rn)) | |
3804 | if ((lsa = rn->info)) | |
3805 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) | |
3806 | { | |
718e3744 | 3807 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
3808 | continue; | |
718e3744 | 3809 | if (show_function[lsa->data->type] != NULL) |
3810 | show_function[lsa->data->type] (vty, lsa); | |
3811 | } | |
3812 | } | |
3813 | ||
3814 | /* Show detail LSA information. */ | |
4dadc291 | 3815 | static void |
020709f9 | 3816 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
718e3744 | 3817 | struct in_addr *adv_router) |
3818 | { | |
52dc7ee6 | 3819 | struct listnode *node; |
1eb8ef25 | 3820 | struct ospf_area *area; |
718e3744 | 3821 | |
3822 | switch (type) | |
3823 | { | |
3824 | case OSPF_AS_EXTERNAL_LSA: | |
3825 | #ifdef HAVE_OPAQUE_LSA | |
3826 | case OSPF_OPAQUE_AS_LSA: | |
3827 | #endif /* HAVE_OPAQUE_LSA */ | |
3828 | vty_out (vty, " %s %s%s", | |
3829 | show_database_desc[type], | |
3830 | VTY_NEWLINE, VTY_NEWLINE); | |
68980084 | 3831 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
718e3744 | 3832 | adv_router); |
3833 | break; | |
3834 | default: | |
1eb8ef25 | 3835 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
718e3744 | 3836 | { |
718e3744 | 3837 | vty_out (vty, "%s %s (Area %s)%s%s", |
3838 | VTY_NEWLINE, show_database_desc[type], | |
3839 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); | |
3840 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), | |
3841 | adv_router); | |
3842 | } | |
3843 | break; | |
3844 | } | |
3845 | } | |
3846 | ||
4dadc291 | 3847 | static void |
020709f9 | 3848 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
718e3744 | 3849 | { |
020709f9 | 3850 | struct ospf_lsa *lsa; |
3851 | struct route_node *rn; | |
1eb8ef25 | 3852 | struct ospf_area *area; |
52dc7ee6 | 3853 | struct listnode *node; |
718e3744 | 3854 | int type; |
3855 | ||
1eb8ef25 | 3856 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
718e3744 | 3857 | { |
718e3744 | 3858 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
3859 | { | |
3860 | switch (type) | |
3861 | { | |
3862 | case OSPF_AS_EXTERNAL_LSA: | |
3863 | #ifdef HAVE_OPAQUE_LSA | |
3864 | case OSPF_OPAQUE_AS_LSA: | |
3865 | #endif /* HAVE_OPAQUE_LSA */ | |
3866 | continue; | |
3867 | default: | |
3868 | break; | |
3869 | } | |
3870 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || | |
3871 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) | |
3872 | { | |
3873 | vty_out (vty, " %s (Area %s)%s%s", | |
3874 | show_database_desc[type], | |
3875 | ospf_area_desc_string (area), | |
3876 | VTY_NEWLINE, VTY_NEWLINE); | |
3877 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); | |
3878 | ||
020709f9 | 3879 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
3880 | show_lsa_summary (vty, lsa, self); | |
718e3744 | 3881 | |
3882 | vty_out (vty, "%s", VTY_NEWLINE); | |
3883 | } | |
3884 | } | |
3885 | } | |
3886 | ||
3887 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) | |
3888 | { | |
3889 | switch (type) | |
3890 | { | |
3891 | case OSPF_AS_EXTERNAL_LSA: | |
3892 | #ifdef HAVE_OPAQUE_LSA | |
3893 | case OSPF_OPAQUE_AS_LSA: | |
3894 | #endif /* HAVE_OPAQUE_LSA */ | |
e8e1946e | 3895 | break; |
718e3744 | 3896 | default: |
3897 | continue; | |
3898 | } | |
68980084 | 3899 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
3900 | (!self && ospf_lsdb_count (ospf->lsdb, type))) | |
718e3744 | 3901 | { |
3902 | vty_out (vty, " %s%s%s", | |
3903 | show_database_desc[type], | |
3904 | VTY_NEWLINE, VTY_NEWLINE); | |
3905 | vty_out (vty, "%s%s", show_database_header[type], | |
3906 | VTY_NEWLINE); | |
020709f9 | 3907 | |
3908 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) | |
3909 | show_lsa_summary (vty, lsa, self); | |
3910 | ||
718e3744 | 3911 | vty_out (vty, "%s", VTY_NEWLINE); |
3912 | } | |
3913 | } | |
3914 | ||
3915 | vty_out (vty, "%s", VTY_NEWLINE); | |
3916 | } | |
3917 | ||
4dadc291 | 3918 | static void |
020709f9 | 3919 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
718e3744 | 3920 | { |
52dc7ee6 | 3921 | struct listnode *node; |
718e3744 | 3922 | struct ospf_lsa *lsa; |
3923 | ||
3924 | vty_out (vty, "%s MaxAge Link States:%s%s", | |
3925 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); | |
3926 | ||
1eb8ef25 | 3927 | for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) |
3928 | { | |
3929 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); | |
3930 | vty_out (vty, "Link State ID: %s%s", | |
3931 | inet_ntoa (lsa->data->id), VTY_NEWLINE); | |
3932 | vty_out (vty, "Advertising Router: %s%s", | |
3933 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); | |
3934 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); | |
3935 | vty_out (vty, "%s", VTY_NEWLINE); | |
3936 | } | |
718e3744 | 3937 | } |
3938 | ||
718e3744 | 3939 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
3940 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" | |
718e3744 | 3941 | |
3942 | #ifdef HAVE_OPAQUE_LSA | |
3943 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" | |
3944 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" | |
3945 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" | |
3946 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" | |
3947 | #else /* HAVE_OPAQUE_LSA */ | |
3948 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" | |
3949 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" | |
3950 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" | |
3951 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" | |
3952 | #endif /* HAVE_OPAQUE_LSA */ | |
3953 | ||
3954 | #define OSPF_LSA_TYPES_CMD_STR \ | |
3955 | "asbr-summary|external|network|router|summary" \ | |
3956 | OSPF_LSA_TYPE_NSSA_CMD_STR \ | |
3957 | OSPF_LSA_TYPE_OPAQUE_CMD_STR | |
3958 | ||
3959 | #define OSPF_LSA_TYPES_DESC \ | |
3960 | "ASBR summary link states\n" \ | |
3961 | "External link states\n" \ | |
3962 | "Network link states\n" \ | |
3963 | "Router link states\n" \ | |
3964 | "Network summary link states\n" \ | |
3965 | OSPF_LSA_TYPE_NSSA_DESC \ | |
3966 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ | |
3967 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ | |
3968 | OSPF_LSA_TYPE_OPAQUE_AS_DESC | |
3969 | ||
3970 | DEFUN (show_ip_ospf_database, | |
3971 | show_ip_ospf_database_cmd, | |
3972 | "show ip ospf database", | |
3973 | SHOW_STR | |
3974 | IP_STR | |
3975 | "OSPF information\n" | |
3976 | "Database summary\n") | |
3977 | { | |
020709f9 | 3978 | struct ospf *ospf; |
718e3744 | 3979 | int type, ret; |
3980 | struct in_addr id, adv_router; | |
3981 | ||
020709f9 | 3982 | ospf = ospf_lookup (); |
68980084 | 3983 | if (ospf == NULL) |
cac3b5c4 PJ |
3984 | { |
3985 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
3986 | return CMD_SUCCESS; | |
3987 | } | |
718e3744 | 3988 | |
3989 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, | |
68980084 | 3990 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
718e3744 | 3991 | |
3992 | /* Show all LSA. */ | |
3993 | if (argc == 0) | |
3994 | { | |
020709f9 | 3995 | show_ip_ospf_database_summary (vty, ospf, 0); |
718e3744 | 3996 | return CMD_SUCCESS; |
3997 | } | |
3998 | ||
3999 | /* Set database type to show. */ | |
4000 | if (strncmp (argv[0], "r", 1) == 0) | |
4001 | type = OSPF_ROUTER_LSA; | |
4002 | else if (strncmp (argv[0], "ne", 2) == 0) | |
4003 | type = OSPF_NETWORK_LSA; | |
718e3744 | 4004 | else if (strncmp (argv[0], "ns", 2) == 0) |
4005 | type = OSPF_AS_NSSA_LSA; | |
718e3744 | 4006 | else if (strncmp (argv[0], "su", 2) == 0) |
4007 | type = OSPF_SUMMARY_LSA; | |
4008 | else if (strncmp (argv[0], "a", 1) == 0) | |
4009 | type = OSPF_ASBR_SUMMARY_LSA; | |
4010 | else if (strncmp (argv[0], "e", 1) == 0) | |
4011 | type = OSPF_AS_EXTERNAL_LSA; | |
4012 | else if (strncmp (argv[0], "se", 2) == 0) | |
4013 | { | |
020709f9 | 4014 | show_ip_ospf_database_summary (vty, ospf, 1); |
718e3744 | 4015 | return CMD_SUCCESS; |
4016 | } | |
4017 | else if (strncmp (argv[0], "m", 1) == 0) | |
4018 | { | |
020709f9 | 4019 | show_ip_ospf_database_maxage (vty, ospf); |
718e3744 | 4020 | return CMD_SUCCESS; |
4021 | } | |
4022 | #ifdef HAVE_OPAQUE_LSA | |
4023 | else if (strncmp (argv[0], "opaque-l", 8) == 0) | |
4024 | type = OSPF_OPAQUE_LINK_LSA; | |
4025 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) | |
4026 | type = OSPF_OPAQUE_AREA_LSA; | |
4027 | else if (strncmp (argv[0], "opaque-as", 9) == 0) | |
4028 | type = OSPF_OPAQUE_AS_LSA; | |
4029 | #endif /* HAVE_OPAQUE_LSA */ | |
4030 | else | |
4031 | return CMD_WARNING; | |
4032 | ||
4033 | /* `show ip ospf database LSA'. */ | |
4034 | if (argc == 1) | |
020709f9 | 4035 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
718e3744 | 4036 | else if (argc >= 2) |
4037 | { | |
4038 | ret = inet_aton (argv[1], &id); | |
4039 | if (!ret) | |
4040 | return CMD_WARNING; | |
4041 | ||
4042 | /* `show ip ospf database LSA ID'. */ | |
4043 | if (argc == 2) | |
020709f9 | 4044 | show_lsa_detail (vty, ospf, type, &id, NULL); |
718e3744 | 4045 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
4046 | else if (argc == 3) | |
4047 | { | |
4048 | if (strncmp (argv[2], "s", 1) == 0) | |
68980084 | 4049 | adv_router = ospf->router_id; |
718e3744 | 4050 | else |
4051 | { | |
4052 | ret = inet_aton (argv[2], &adv_router); | |
4053 | if (!ret) | |
4054 | return CMD_WARNING; | |
4055 | } | |
020709f9 | 4056 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
718e3744 | 4057 | } |
4058 | } | |
4059 | ||
4060 | return CMD_SUCCESS; | |
4061 | } | |
4062 | ||
4063 | ALIAS (show_ip_ospf_database, | |
4064 | show_ip_ospf_database_type_cmd, | |
4065 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", | |
4066 | SHOW_STR | |
4067 | IP_STR | |
4068 | "OSPF information\n" | |
4069 | "Database summary\n" | |
4070 | OSPF_LSA_TYPES_DESC | |
4071 | "LSAs in MaxAge list\n" | |
4072 | "Self-originated link states\n") | |
4073 | ||
4074 | ALIAS (show_ip_ospf_database, | |
4075 | show_ip_ospf_database_type_id_cmd, | |
4076 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", | |
4077 | SHOW_STR | |
4078 | IP_STR | |
4079 | "OSPF information\n" | |
4080 | "Database summary\n" | |
4081 | OSPF_LSA_TYPES_DESC | |
4082 | "Link State ID (as an IP address)\n") | |
4083 | ||
4084 | ALIAS (show_ip_ospf_database, | |
4085 | show_ip_ospf_database_type_id_adv_router_cmd, | |
4086 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", | |
4087 | SHOW_STR | |
4088 | IP_STR | |
4089 | "OSPF information\n" | |
4090 | "Database summary\n" | |
4091 | OSPF_LSA_TYPES_DESC | |
4092 | "Link State ID (as an IP address)\n" | |
4093 | "Advertising Router link states\n" | |
4094 | "Advertising Router (as an IP address)\n") | |
4095 | ||
4096 | ALIAS (show_ip_ospf_database, | |
4097 | show_ip_ospf_database_type_id_self_cmd, | |
4098 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", | |
4099 | SHOW_STR | |
4100 | IP_STR | |
4101 | "OSPF information\n" | |
4102 | "Database summary\n" | |
4103 | OSPF_LSA_TYPES_DESC | |
4104 | "Link State ID (as an IP address)\n" | |
4105 | "Self-originated link states\n" | |
4106 | "\n") | |
4107 | ||
4108 | DEFUN (show_ip_ospf_database_type_adv_router, | |
4109 | show_ip_ospf_database_type_adv_router_cmd, | |
4110 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", | |
4111 | SHOW_STR | |
4112 | IP_STR | |
4113 | "OSPF information\n" | |
4114 | "Database summary\n" | |
4115 | OSPF_LSA_TYPES_DESC | |
4116 | "Advertising Router link states\n" | |
4117 | "Advertising Router (as an IP address)\n") | |
4118 | { | |
020709f9 | 4119 | struct ospf *ospf; |
718e3744 | 4120 | int type, ret; |
4121 | struct in_addr adv_router; | |
4122 | ||
020709f9 | 4123 | ospf = ospf_lookup (); |
68980084 | 4124 | if (ospf == NULL) |
cac3b5c4 PJ |
4125 | { |
4126 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); | |
4127 | return CMD_SUCCESS; | |
4128 | } | |
718e3744 | 4129 | |
4130 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, | |
68980084 | 4131 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
718e3744 | 4132 | |
4133 | if (argc != 2) | |
4134 | return CMD_WARNING; | |
4135 | ||
4136 | /* Set database type to show. */ | |
4137 | if (strncmp (argv[0], "r", 1) == 0) | |
4138 | type = OSPF_ROUTER_LSA; | |
4139 | else if (strncmp (argv[0], "ne", 2) == 0) | |
4140 | type = OSPF_NETWORK_LSA; | |
718e3744 | 4141 | else if (strncmp (argv[0], "ns", 2) == 0) |
4142 | type = OSPF_AS_NSSA_LSA; | |
718e3744 | 4143 | else if (strncmp (argv[0], "s", 1) == 0) |
4144 | type = OSPF_SUMMARY_LSA; | |
4145 | else if (strncmp (argv[0], "a", 1) == 0) | |
4146 | type = OSPF_ASBR_SUMMARY_LSA; | |
4147 | else if (strncmp (argv[0], "e", 1) == 0) | |
4148 | type = OSPF_AS_EXTERNAL_LSA; | |
4149 | #ifdef HAVE_OPAQUE_LSA | |
4150 | else if (strncmp (argv[0], "opaque-l", 8) == 0) | |
4151 | type = OSPF_OPAQUE_LINK_LSA; | |
4152 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) | |
4153 | type = OSPF_OPAQUE_AREA_LSA; | |
4154 | else if (strncmp (argv[0], "opaque-as", 9) == 0) | |
4155 | type = OSPF_OPAQUE_AS_LSA; | |
4156 | #endif /* HAVE_OPAQUE_LSA */ | |
4157 | else | |
4158 | return CMD_WARNING; | |
4159 | ||
4160 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ | |
4161 | if (strncmp (argv[1], "s", 1) == 0) | |
68980084 | 4162 | adv_router = ospf->router_id; |
718e3744 | 4163 | else |
4164 | { | |
4165 | ret = inet_aton (argv[1], &adv_router); | |
4166 | if (!ret) | |
4167 | return CMD_WARNING; | |
4168 | } | |
4169 | ||
020709f9 | 4170 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
718e3744 | 4171 | |
4172 | return CMD_SUCCESS; | |
4173 | } | |
4174 | ||
4175 | ALIAS (show_ip_ospf_database_type_adv_router, | |
4176 | show_ip_ospf_database_type_self_cmd, | |
4177 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", | |
4178 | SHOW_STR | |
4179 | IP_STR | |
4180 | "OSPF information\n" | |
4181 | "Database summary\n" | |
4182 | OSPF_LSA_TYPES_DESC | |
4183 | "Self-originated link states\n") | |
4184 | ||
4185 | \f | |
4186 | DEFUN (ip_ospf_authentication_args, | |
4187 | ip_ospf_authentication_args_addr_cmd, | |
4188 | "ip ospf authentication (null|message-digest) A.B.C.D", | |
4189 | "IP Information\n" | |
4190 | "OSPF interface commands\n" | |
4191 | "Enable authentication on this interface\n" | |
4192 | "Use null authentication\n" | |
4193 | "Use message-digest authentication\n" | |
4194 | "Address of interface") | |
4195 | { | |
4196 | struct interface *ifp; | |
4197 | struct in_addr addr; | |
4198 | int ret; | |
4199 | struct ospf_if_params *params; | |
4200 | ||
4201 | ifp = vty->index; | |
4202 | params = IF_DEF_PARAMS (ifp); | |
4203 | ||
4204 | if (argc == 2) | |
4205 | { | |
4206 | ret = inet_aton(argv[1], &addr); | |
4207 | if (!ret) | |
4208 | { | |
4209 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4210 | VTY_NEWLINE); | |
4211 | return CMD_WARNING; | |
4212 | } | |
4213 | ||
4214 | params = ospf_get_if_params (ifp, addr); | |
4215 | ospf_if_update_params (ifp, addr); | |
4216 | } | |
4217 | ||
4218 | /* Handle null authentication */ | |
4219 | if ( argv[0][0] == 'n' ) | |
4220 | { | |
4221 | SET_IF_PARAM (params, auth_type); | |
4222 | params->auth_type = OSPF_AUTH_NULL; | |
4223 | return CMD_SUCCESS; | |
4224 | } | |
4225 | ||
4226 | /* Handle message-digest authentication */ | |
4227 | if ( argv[0][0] == 'm' ) | |
4228 | { | |
4229 | SET_IF_PARAM (params, auth_type); | |
4230 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; | |
4231 | return CMD_SUCCESS; | |
4232 | } | |
4233 | ||
4234 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); | |
4235 | return CMD_WARNING; | |
4236 | } | |
4237 | ||
4238 | ALIAS (ip_ospf_authentication_args, | |
4239 | ip_ospf_authentication_args_cmd, | |
4240 | "ip ospf authentication (null|message-digest)", | |
4241 | "IP Information\n" | |
4242 | "OSPF interface commands\n" | |
4243 | "Enable authentication on this interface\n" | |
4244 | "Use null authentication\n" | |
4245 | "Use message-digest authentication\n") | |
4246 | ||
4247 | DEFUN (ip_ospf_authentication, | |
4248 | ip_ospf_authentication_addr_cmd, | |
4249 | "ip ospf authentication A.B.C.D", | |
4250 | "IP Information\n" | |
4251 | "OSPF interface commands\n" | |
4252 | "Enable authentication on this interface\n" | |
4253 | "Address of interface") | |
4254 | { | |
4255 | struct interface *ifp; | |
4256 | struct in_addr addr; | |
4257 | int ret; | |
4258 | struct ospf_if_params *params; | |
4259 | ||
4260 | ifp = vty->index; | |
4261 | params = IF_DEF_PARAMS (ifp); | |
4262 | ||
4263 | if (argc == 1) | |
4264 | { | |
4265 | ret = inet_aton(argv[1], &addr); | |
4266 | if (!ret) | |
4267 | { | |
4268 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4269 | VTY_NEWLINE); | |
4270 | return CMD_WARNING; | |
4271 | } | |
4272 | ||
4273 | params = ospf_get_if_params (ifp, addr); | |
4274 | ospf_if_update_params (ifp, addr); | |
4275 | } | |
4276 | ||
4277 | SET_IF_PARAM (params, auth_type); | |
4278 | params->auth_type = OSPF_AUTH_SIMPLE; | |
4279 | ||
4280 | return CMD_SUCCESS; | |
4281 | } | |
4282 | ||
4283 | ALIAS (ip_ospf_authentication, | |
4284 | ip_ospf_authentication_cmd, | |
4285 | "ip ospf authentication", | |
4286 | "IP Information\n" | |
4287 | "OSPF interface commands\n" | |
4288 | "Enable authentication on this interface\n") | |
4289 | ||
4290 | DEFUN (no_ip_ospf_authentication, | |
4291 | no_ip_ospf_authentication_addr_cmd, | |
4292 | "no ip ospf authentication A.B.C.D", | |
4293 | NO_STR | |
4294 | "IP Information\n" | |
4295 | "OSPF interface commands\n" | |
4296 | "Enable authentication on this interface\n" | |
4297 | "Address of interface") | |
4298 | { | |
4299 | struct interface *ifp; | |
4300 | struct in_addr addr; | |
4301 | int ret; | |
4302 | struct ospf_if_params *params; | |
4303 | ||
4304 | ifp = vty->index; | |
4305 | params = IF_DEF_PARAMS (ifp); | |
4306 | ||
4307 | if (argc == 1) | |
4308 | { | |
4309 | ret = inet_aton(argv[1], &addr); | |
4310 | if (!ret) | |
4311 | { | |
4312 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4313 | VTY_NEWLINE); | |
4314 | return CMD_WARNING; | |
4315 | } | |
4316 | ||
4317 | params = ospf_lookup_if_params (ifp, addr); | |
4318 | if (params == NULL) | |
4319 | return CMD_SUCCESS; | |
4320 | } | |
4321 | ||
4322 | params->auth_type = OSPF_AUTH_NOTSET; | |
4323 | UNSET_IF_PARAM (params, auth_type); | |
4324 | ||
4325 | if (params != IF_DEF_PARAMS (ifp)) | |
4326 | { | |
4327 | ospf_free_if_params (ifp, addr); | |
4328 | ospf_if_update_params (ifp, addr); | |
4329 | } | |
4330 | ||
4331 | return CMD_SUCCESS; | |
4332 | } | |
4333 | ||
4334 | ALIAS (no_ip_ospf_authentication, | |
4335 | no_ip_ospf_authentication_cmd, | |
4336 | "no ip ospf authentication", | |
4337 | NO_STR | |
4338 | "IP Information\n" | |
4339 | "OSPF interface commands\n" | |
4340 | "Enable authentication on this interface\n") | |
4341 | ||
4342 | DEFUN (ip_ospf_authentication_key, | |
4343 | ip_ospf_authentication_key_addr_cmd, | |
4344 | "ip ospf authentication-key AUTH_KEY A.B.C.D", | |
4345 | "IP Information\n" | |
4346 | "OSPF interface commands\n" | |
4347 | "Authentication password (key)\n" | |
4348 | "The OSPF password (key)\n" | |
4349 | "Address of interface") | |
4350 | { | |
4351 | struct interface *ifp; | |
4352 | struct in_addr addr; | |
4353 | int ret; | |
4354 | struct ospf_if_params *params; | |
4355 | ||
4356 | ifp = vty->index; | |
4357 | params = IF_DEF_PARAMS (ifp); | |
4358 | ||
4359 | if (argc == 2) | |
4360 | { | |
4361 | ret = inet_aton(argv[1], &addr); | |
4362 | if (!ret) | |
4363 | { | |
4364 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4365 | VTY_NEWLINE); | |
4366 | return CMD_WARNING; | |
4367 | } | |
4368 | ||
4369 | params = ospf_get_if_params (ifp, addr); | |
4370 | ospf_if_update_params (ifp, addr); | |
4371 | } | |
4372 | ||
4373 | ||
4374 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); | |
c9e52be3 | 4375 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
718e3744 | 4376 | SET_IF_PARAM (params, auth_simple); |
4377 | ||
4378 | return CMD_SUCCESS; | |
4379 | } | |
4380 | ||
4381 | ALIAS (ip_ospf_authentication_key, | |
4382 | ip_ospf_authentication_key_cmd, | |
4383 | "ip ospf authentication-key AUTH_KEY", | |
4384 | "IP Information\n" | |
4385 | "OSPF interface commands\n" | |
4386 | "Authentication password (key)\n" | |
4387 | "The OSPF password (key)") | |
4388 | ||
4389 | ALIAS (ip_ospf_authentication_key, | |
4390 | ospf_authentication_key_cmd, | |
4391 | "ospf authentication-key AUTH_KEY", | |
4392 | "OSPF interface commands\n" | |
4393 | "Authentication password (key)\n" | |
4394 | "The OSPF password (key)") | |
4395 | ||
4396 | DEFUN (no_ip_ospf_authentication_key, | |
4397 | no_ip_ospf_authentication_key_addr_cmd, | |
4398 | "no ip ospf authentication-key A.B.C.D", | |
4399 | NO_STR | |
4400 | "IP Information\n" | |
4401 | "OSPF interface commands\n" | |
4402 | "Authentication password (key)\n" | |
4403 | "Address of interface") | |
4404 | { | |
4405 | struct interface *ifp; | |
4406 | struct in_addr addr; | |
4407 | int ret; | |
4408 | struct ospf_if_params *params; | |
4409 | ||
4410 | ifp = vty->index; | |
4411 | params = IF_DEF_PARAMS (ifp); | |
4412 | ||
4413 | if (argc == 2) | |
4414 | { | |
4415 | ret = inet_aton(argv[1], &addr); | |
4416 | if (!ret) | |
4417 | { | |
4418 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4419 | VTY_NEWLINE); | |
4420 | return CMD_WARNING; | |
4421 | } | |
4422 | ||
4423 | params = ospf_lookup_if_params (ifp, addr); | |
4424 | if (params == NULL) | |
4425 | return CMD_SUCCESS; | |
4426 | } | |
4427 | ||
4428 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); | |
4429 | UNSET_IF_PARAM (params, auth_simple); | |
4430 | ||
4431 | if (params != IF_DEF_PARAMS (ifp)) | |
4432 | { | |
4433 | ospf_free_if_params (ifp, addr); | |
4434 | ospf_if_update_params (ifp, addr); | |
4435 | } | |
4436 | ||
4437 | return CMD_SUCCESS; | |
4438 | } | |
4439 | ||
4440 | ALIAS (no_ip_ospf_authentication_key, | |
4441 | no_ip_ospf_authentication_key_cmd, | |
4442 | "no ip ospf authentication-key", | |
4443 | NO_STR | |
4444 | "IP Information\n" | |
4445 | "OSPF interface commands\n" | |
4446 | "Authentication password (key)\n") | |
4447 | ||
4448 | ALIAS (no_ip_ospf_authentication_key, | |
4449 | no_ospf_authentication_key_cmd, | |
4450 | "no ospf authentication-key", | |
4451 | NO_STR | |
4452 | "OSPF interface commands\n" | |
4453 | "Authentication password (key)\n") | |
4454 | ||
4455 | DEFUN (ip_ospf_message_digest_key, | |
4456 | ip_ospf_message_digest_key_addr_cmd, | |
4457 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", | |
4458 | "IP Information\n" | |
4459 | "OSPF interface commands\n" | |
4460 | "Message digest authentication password (key)\n" | |
4461 | "Key ID\n" | |
4462 | "Use MD5 algorithm\n" | |
4463 | "The OSPF password (key)" | |
4464 | "Address of interface") | |
4465 | { | |
4466 | struct interface *ifp; | |
4467 | struct crypt_key *ck; | |
4468 | u_char key_id; | |
4469 | struct in_addr addr; | |
4470 | int ret; | |
4471 | struct ospf_if_params *params; | |
4472 | ||
4473 | ifp = vty->index; | |
4474 | params = IF_DEF_PARAMS (ifp); | |
4475 | ||
4476 | if (argc == 3) | |
4477 | { | |
4478 | ret = inet_aton(argv[2], &addr); | |
4479 | if (!ret) | |
4480 | { | |
4481 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4482 | VTY_NEWLINE); | |
4483 | return CMD_WARNING; | |
4484 | } | |
4485 | ||
4486 | params = ospf_get_if_params (ifp, addr); | |
4487 | ospf_if_update_params (ifp, addr); | |
4488 | } | |
4489 | ||
4490 | key_id = strtol (argv[0], NULL, 10); | |
4491 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) | |
4492 | { | |
4493 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); | |
4494 | return CMD_WARNING; | |
4495 | } | |
4496 | ||
4497 | ck = ospf_crypt_key_new (); | |
4498 | ck->key_id = (u_char) key_id; | |
4499 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); | |
c9e52be3 | 4500 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
718e3744 | 4501 | |
4502 | ospf_crypt_key_add (params->auth_crypt, ck); | |
4503 | SET_IF_PARAM (params, auth_crypt); | |
4504 | ||
4505 | return CMD_SUCCESS; | |
4506 | } | |
4507 | ||
4508 | ALIAS (ip_ospf_message_digest_key, | |
4509 | ip_ospf_message_digest_key_cmd, | |
4510 | "ip ospf message-digest-key <1-255> md5 KEY", | |
4511 | "IP Information\n" | |
4512 | "OSPF interface commands\n" | |
4513 | "Message digest authentication password (key)\n" | |
4514 | "Key ID\n" | |
4515 | "Use MD5 algorithm\n" | |
4516 | "The OSPF password (key)") | |
4517 | ||
4518 | ALIAS (ip_ospf_message_digest_key, | |
4519 | ospf_message_digest_key_cmd, | |
4520 | "ospf message-digest-key <1-255> md5 KEY", | |
4521 | "OSPF interface commands\n" | |
4522 | "Message digest authentication password (key)\n" | |
4523 | "Key ID\n" | |
4524 | "Use MD5 algorithm\n" | |
4525 | "The OSPF password (key)") | |
4526 | ||
4527 | DEFUN (no_ip_ospf_message_digest_key, | |
4528 | no_ip_ospf_message_digest_key_addr_cmd, | |
4529 | "no ip ospf message-digest-key <1-255> A.B.C.D", | |
4530 | NO_STR | |
4531 | "IP Information\n" | |
4532 | "OSPF interface commands\n" | |
4533 | "Message digest authentication password (key)\n" | |
4534 | "Key ID\n" | |
4535 | "Address of interface") | |
4536 | { | |
4537 | struct interface *ifp; | |
4538 | struct crypt_key *ck; | |
4539 | int key_id; | |
4540 | struct in_addr addr; | |
4541 | int ret; | |
4542 | struct ospf_if_params *params; | |
4543 | ||
4544 | ifp = vty->index; | |
4545 | params = IF_DEF_PARAMS (ifp); | |
4546 | ||
4547 | if (argc == 2) | |
4548 | { | |
4549 | ret = inet_aton(argv[1], &addr); | |
4550 | if (!ret) | |
4551 | { | |
4552 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4553 | VTY_NEWLINE); | |
4554 | return CMD_WARNING; | |
4555 | } | |
4556 | ||
4557 | params = ospf_lookup_if_params (ifp, addr); | |
4558 | if (params == NULL) | |
4559 | return CMD_SUCCESS; | |
4560 | } | |
4561 | ||
4562 | key_id = strtol (argv[0], NULL, 10); | |
4563 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); | |
4564 | if (ck == NULL) | |
4565 | { | |
4566 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); | |
4567 | return CMD_WARNING; | |
4568 | } | |
4569 | ||
4570 | ospf_crypt_key_delete (params->auth_crypt, key_id); | |
4571 | ||
4572 | if (params != IF_DEF_PARAMS (ifp)) | |
4573 | { | |
4574 | ospf_free_if_params (ifp, addr); | |
4575 | ospf_if_update_params (ifp, addr); | |
4576 | } | |
4577 | ||
4578 | return CMD_SUCCESS; | |
4579 | } | |
4580 | ||
4581 | ALIAS (no_ip_ospf_message_digest_key, | |
4582 | no_ip_ospf_message_digest_key_cmd, | |
4583 | "no ip ospf message-digest-key <1-255>", | |
4584 | NO_STR | |
4585 | "IP Information\n" | |
4586 | "OSPF interface commands\n" | |
4587 | "Message digest authentication password (key)\n" | |
4588 | "Key ID\n") | |
4589 | ||
4590 | ALIAS (no_ip_ospf_message_digest_key, | |
4591 | no_ospf_message_digest_key_cmd, | |
4592 | "no ospf message-digest-key <1-255>", | |
4593 | NO_STR | |
4594 | "OSPF interface commands\n" | |
4595 | "Message digest authentication password (key)\n" | |
4596 | "Key ID\n") | |
4597 | ||
4598 | DEFUN (ip_ospf_cost, | |
4599 | ip_ospf_cost_addr_cmd, | |
4600 | "ip ospf cost <1-65535> A.B.C.D", | |
4601 | "IP Information\n" | |
4602 | "OSPF interface commands\n" | |
4603 | "Interface cost\n" | |
4604 | "Cost\n" | |
4605 | "Address of interface") | |
4606 | { | |
4607 | struct interface *ifp = vty->index; | |
4608 | u_int32_t cost; | |
4609 | struct in_addr addr; | |
4610 | int ret; | |
4611 | struct ospf_if_params *params; | |
4612 | ||
4613 | params = IF_DEF_PARAMS (ifp); | |
4614 | ||
4615 | cost = strtol (argv[0], NULL, 10); | |
4616 | ||
4617 | /* cost range is <1-65535>. */ | |
4618 | if (cost < 1 || cost > 65535) | |
4619 | { | |
4620 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); | |
4621 | return CMD_WARNING; | |
4622 | } | |
4623 | ||
4624 | if (argc == 2) | |
4625 | { | |
4626 | ret = inet_aton(argv[1], &addr); | |
4627 | if (!ret) | |
4628 | { | |
4629 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4630 | VTY_NEWLINE); | |
4631 | return CMD_WARNING; | |
4632 | } | |
4633 | ||
4634 | params = ospf_get_if_params (ifp, addr); | |
4635 | ospf_if_update_params (ifp, addr); | |
4636 | } | |
4637 | ||
4638 | SET_IF_PARAM (params, output_cost_cmd); | |
4639 | params->output_cost_cmd = cost; | |
4640 | ||
4641 | ospf_if_recalculate_output_cost (ifp); | |
4642 | ||
4643 | return CMD_SUCCESS; | |
4644 | } | |
4645 | ||
4646 | ALIAS (ip_ospf_cost, | |
4647 | ip_ospf_cost_cmd, | |
4648 | "ip ospf cost <1-65535>", | |
4649 | "IP Information\n" | |
4650 | "OSPF interface commands\n" | |
4651 | "Interface cost\n" | |
4652 | "Cost") | |
4653 | ||
4654 | ALIAS (ip_ospf_cost, | |
4655 | ospf_cost_cmd, | |
4656 | "ospf cost <1-65535>", | |
4657 | "OSPF interface commands\n" | |
4658 | "Interface cost\n" | |
4659 | "Cost") | |
4660 | ||
4661 | DEFUN (no_ip_ospf_cost, | |
4662 | no_ip_ospf_cost_addr_cmd, | |
4663 | "no ip ospf cost A.B.C.D", | |
4664 | NO_STR | |
4665 | "IP Information\n" | |
4666 | "OSPF interface commands\n" | |
4667 | "Interface cost\n" | |
4668 | "Address of interface") | |
4669 | { | |
4670 | struct interface *ifp = vty->index; | |
4671 | struct in_addr addr; | |
4672 | int ret; | |
4673 | struct ospf_if_params *params; | |
4674 | ||
4675 | ifp = vty->index; | |
4676 | params = IF_DEF_PARAMS (ifp); | |
4677 | ||
4678 | if (argc == 1) | |
4679 | { | |
4680 | ret = inet_aton(argv[0], &addr); | |
4681 | if (!ret) | |
4682 | { | |
4683 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4684 | VTY_NEWLINE); | |
4685 | return CMD_WARNING; | |
4686 | } | |
4687 | ||
4688 | params = ospf_lookup_if_params (ifp, addr); | |
4689 | if (params == NULL) | |
4690 | return CMD_SUCCESS; | |
4691 | } | |
4692 | ||
4693 | UNSET_IF_PARAM (params, output_cost_cmd); | |
4694 | ||
4695 | if (params != IF_DEF_PARAMS (ifp)) | |
4696 | { | |
4697 | ospf_free_if_params (ifp, addr); | |
4698 | ospf_if_update_params (ifp, addr); | |
4699 | } | |
4700 | ||
4701 | ospf_if_recalculate_output_cost (ifp); | |
4702 | ||
4703 | return CMD_SUCCESS; | |
4704 | } | |
4705 | ||
4706 | ALIAS (no_ip_ospf_cost, | |
4707 | no_ip_ospf_cost_cmd, | |
4708 | "no ip ospf cost", | |
4709 | NO_STR | |
4710 | "IP Information\n" | |
4711 | "OSPF interface commands\n" | |
4712 | "Interface cost\n") | |
4713 | ||
4714 | ALIAS (no_ip_ospf_cost, | |
4715 | no_ospf_cost_cmd, | |
4716 | "no ospf cost", | |
4717 | NO_STR | |
4718 | "OSPF interface commands\n" | |
4719 | "Interface cost\n") | |
4720 | ||
4dadc291 | 4721 | static void |
718e3744 | 4722 | ospf_nbr_timer_update (struct ospf_interface *oi) |
4723 | { | |
4724 | struct route_node *rn; | |
4725 | struct ospf_neighbor *nbr; | |
4726 | ||
4727 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) | |
4728 | if ((nbr = rn->info)) | |
4729 | { | |
4730 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); | |
4731 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); | |
4732 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); | |
4733 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); | |
4734 | } | |
4735 | } | |
4736 | ||
f9ad937f | 4737 | static int |
4738 | ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, | |
4739 | const char *nbr_str, | |
4740 | const char *fast_hello_str) | |
718e3744 | 4741 | { |
4742 | struct interface *ifp = vty->index; | |
4743 | u_int32_t seconds; | |
f9ad937f | 4744 | u_char hellomult; |
718e3744 | 4745 | struct in_addr addr; |
4746 | int ret; | |
4747 | struct ospf_if_params *params; | |
4748 | struct ospf_interface *oi; | |
4749 | struct route_node *rn; | |
4750 | ||
4751 | params = IF_DEF_PARAMS (ifp); | |
f9ad937f | 4752 | |
4753 | if (nbr_str) | |
718e3744 | 4754 | { |
f9ad937f | 4755 | ret = inet_aton(nbr_str, &addr); |
718e3744 | 4756 | if (!ret) |
4757 | { | |
4758 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4759 | VTY_NEWLINE); | |
4760 | return CMD_WARNING; | |
4761 | } | |
4762 | ||
4763 | params = ospf_get_if_params (ifp, addr); | |
4764 | ospf_if_update_params (ifp, addr); | |
4765 | } | |
4766 | ||
f9ad937f | 4767 | if (interval_str) |
4768 | { | |
4769 | VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str, | |
4770 | 1, 65535); | |
4771 | ||
4772 | /* reset fast_hello too, just to be sure */ | |
4773 | UNSET_IF_PARAM (params, fast_hello); | |
4774 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; | |
4775 | } | |
4776 | else if (fast_hello_str) | |
4777 | { | |
4778 | VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str, | |
4779 | 1, 10); | |
4780 | /* 1s dead-interval with sub-second hellos desired */ | |
4781 | seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL; | |
4782 | SET_IF_PARAM (params, fast_hello); | |
4783 | params->fast_hello = hellomult; | |
4784 | } | |
4785 | else | |
4786 | { | |
4787 | vty_out (vty, "Please specify dead-interval or hello-multiplier%s", | |
4788 | VTY_NEWLINE); | |
4789 | return CMD_WARNING; | |
4790 | } | |
4791 | ||
718e3744 | 4792 | SET_IF_PARAM (params, v_wait); |
4793 | params->v_wait = seconds; | |
4794 | ||
4795 | /* Update timer values in neighbor structure. */ | |
f9ad937f | 4796 | if (nbr_str) |
718e3744 | 4797 | { |
cac3b5c4 PJ |
4798 | struct ospf *ospf; |
4799 | if ((ospf = ospf_lookup())) | |
68980084 | 4800 | { |
4801 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); | |
4802 | if (oi) | |
4803 | ospf_nbr_timer_update (oi); | |
4804 | } | |
718e3744 | 4805 | } |
4806 | else | |
4807 | { | |
4808 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
4809 | if ((oi = rn->info)) | |
4810 | ospf_nbr_timer_update (oi); | |
4811 | } | |
4812 | ||
4813 | return CMD_SUCCESS; | |
4814 | } | |
4815 | ||
f9ad937f | 4816 | |
4817 | DEFUN (ip_ospf_dead_interval, | |
4818 | ip_ospf_dead_interval_addr_cmd, | |
4819 | "ip ospf dead-interval <1-65535> A.B.C.D", | |
4820 | "IP Information\n" | |
4821 | "OSPF interface commands\n" | |
4822 | "Interval after which a neighbor is declared dead\n" | |
4823 | "Seconds\n" | |
4824 | "Address of interface\n") | |
4825 | { | |
4826 | if (argc == 2) | |
4827 | return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); | |
4828 | else | |
4829 | return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); | |
4830 | } | |
4831 | ||
718e3744 | 4832 | ALIAS (ip_ospf_dead_interval, |
4833 | ip_ospf_dead_interval_cmd, | |
4834 | "ip ospf dead-interval <1-65535>", | |
4835 | "IP Information\n" | |
4836 | "OSPF interface commands\n" | |
4837 | "Interval after which a neighbor is declared dead\n" | |
4838 | "Seconds\n") | |
4839 | ||
4840 | ALIAS (ip_ospf_dead_interval, | |
4841 | ospf_dead_interval_cmd, | |
4842 | "ospf dead-interval <1-65535>", | |
4843 | "OSPF interface commands\n" | |
4844 | "Interval after which a neighbor is declared dead\n" | |
4845 | "Seconds\n") | |
4846 | ||
f9ad937f | 4847 | DEFUN (ip_ospf_dead_interval_minimal, |
4848 | ip_ospf_dead_interval_minimal_addr_cmd, | |
4849 | "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", | |
4850 | "IP Information\n" | |
4851 | "OSPF interface commands\n" | |
4852 | "Interval after which a neighbor is declared dead\n" | |
4853 | "Minimal 1s dead-interval with fast sub-second hellos\n" | |
4854 | "Hello multiplier factor\n" | |
4855 | "Number of Hellos to send each second\n" | |
4856 | "Address of interface\n") | |
4857 | { | |
4858 | if (argc == 2) | |
4859 | return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); | |
4860 | else | |
4861 | return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); | |
4862 | } | |
4863 | ||
4864 | ALIAS (ip_ospf_dead_interval_minimal, | |
4865 | ip_ospf_dead_interval_minimal_cmd, | |
4866 | "ip ospf dead-interval minimal hello-multiplier <1-10>", | |
4867 | "IP Information\n" | |
4868 | "OSPF interface commands\n" | |
4869 | "Interval after which a neighbor is declared dead\n" | |
4870 | "Minimal 1s dead-interval with fast sub-second hellos\n" | |
4871 | "Hello multiplier factor\n" | |
4872 | "Number of Hellos to send each second\n") | |
4873 | ||
718e3744 | 4874 | DEFUN (no_ip_ospf_dead_interval, |
4875 | no_ip_ospf_dead_interval_addr_cmd, | |
4876 | "no ip ospf dead-interval A.B.C.D", | |
4877 | NO_STR | |
4878 | "IP Information\n" | |
4879 | "OSPF interface commands\n" | |
4880 | "Interval after which a neighbor is declared dead\n" | |
4881 | "Address of interface") | |
4882 | { | |
4883 | struct interface *ifp = vty->index; | |
4884 | struct in_addr addr; | |
4885 | int ret; | |
4886 | struct ospf_if_params *params; | |
4887 | struct ospf_interface *oi; | |
4888 | struct route_node *rn; | |
020709f9 | 4889 | |
718e3744 | 4890 | ifp = vty->index; |
4891 | params = IF_DEF_PARAMS (ifp); | |
4892 | ||
4893 | if (argc == 1) | |
4894 | { | |
4895 | ret = inet_aton(argv[0], &addr); | |
4896 | if (!ret) | |
4897 | { | |
4898 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4899 | VTY_NEWLINE); | |
4900 | return CMD_WARNING; | |
4901 | } | |
4902 | ||
4903 | params = ospf_lookup_if_params (ifp, addr); | |
4904 | if (params == NULL) | |
4905 | return CMD_SUCCESS; | |
4906 | } | |
4907 | ||
4908 | UNSET_IF_PARAM (params, v_wait); | |
4909 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; | |
f9ad937f | 4910 | |
4911 | UNSET_IF_PARAM (params, fast_hello); | |
4912 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; | |
4913 | ||
718e3744 | 4914 | if (params != IF_DEF_PARAMS (ifp)) |
4915 | { | |
4916 | ospf_free_if_params (ifp, addr); | |
4917 | ospf_if_update_params (ifp, addr); | |
4918 | } | |
4919 | ||
4920 | /* Update timer values in neighbor structure. */ | |
4921 | if (argc == 1) | |
4922 | { | |
cac3b5c4 PJ |
4923 | struct ospf *ospf; |
4924 | ||
4925 | if ((ospf = ospf_lookup())) | |
68980084 | 4926 | { |
4927 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); | |
4928 | if (oi) | |
4929 | ospf_nbr_timer_update (oi); | |
4930 | } | |
718e3744 | 4931 | } |
4932 | else | |
4933 | { | |
4934 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
4935 | if ((oi = rn->info)) | |
4936 | ospf_nbr_timer_update (oi); | |
4937 | } | |
4938 | ||
4939 | return CMD_SUCCESS; | |
4940 | } | |
4941 | ||
4942 | ALIAS (no_ip_ospf_dead_interval, | |
4943 | no_ip_ospf_dead_interval_cmd, | |
4944 | "no ip ospf dead-interval", | |
4945 | NO_STR | |
4946 | "IP Information\n" | |
4947 | "OSPF interface commands\n" | |
4948 | "Interval after which a neighbor is declared dead\n") | |
4949 | ||
4950 | ALIAS (no_ip_ospf_dead_interval, | |
4951 | no_ospf_dead_interval_cmd, | |
4952 | "no ospf dead-interval", | |
4953 | NO_STR | |
4954 | "OSPF interface commands\n" | |
4955 | "Interval after which a neighbor is declared dead\n") | |
4956 | ||
4957 | DEFUN (ip_ospf_hello_interval, | |
4958 | ip_ospf_hello_interval_addr_cmd, | |
4959 | "ip ospf hello-interval <1-65535> A.B.C.D", | |
4960 | "IP Information\n" | |
4961 | "OSPF interface commands\n" | |
4962 | "Time between HELLO packets\n" | |
4963 | "Seconds\n" | |
4964 | "Address of interface") | |
4965 | { | |
4966 | struct interface *ifp = vty->index; | |
4967 | u_int32_t seconds; | |
4968 | struct in_addr addr; | |
4969 | int ret; | |
4970 | struct ospf_if_params *params; | |
4971 | ||
4972 | params = IF_DEF_PARAMS (ifp); | |
4973 | ||
4974 | seconds = strtol (argv[0], NULL, 10); | |
4975 | ||
4976 | /* HelloInterval range is <1-65535>. */ | |
4977 | if (seconds < 1 || seconds > 65535) | |
4978 | { | |
4979 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); | |
4980 | return CMD_WARNING; | |
4981 | } | |
4982 | ||
4983 | if (argc == 2) | |
4984 | { | |
4985 | ret = inet_aton(argv[1], &addr); | |
4986 | if (!ret) | |
4987 | { | |
4988 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
4989 | VTY_NEWLINE); | |
4990 | return CMD_WARNING; | |
4991 | } | |
4992 | ||
4993 | params = ospf_get_if_params (ifp, addr); | |
4994 | ospf_if_update_params (ifp, addr); | |
4995 | } | |
4996 | ||
f9ad937f | 4997 | SET_IF_PARAM (params, v_hello); |
718e3744 | 4998 | params->v_hello = seconds; |
4999 | ||
5000 | return CMD_SUCCESS; | |
5001 | } | |
5002 | ||
5003 | ALIAS (ip_ospf_hello_interval, | |
5004 | ip_ospf_hello_interval_cmd, | |
5005 | "ip ospf hello-interval <1-65535>", | |
5006 | "IP Information\n" | |
5007 | "OSPF interface commands\n" | |
5008 | "Time between HELLO packets\n" | |
5009 | "Seconds\n") | |
5010 | ||
5011 | ALIAS (ip_ospf_hello_interval, | |
5012 | ospf_hello_interval_cmd, | |
5013 | "ospf hello-interval <1-65535>", | |
5014 | "OSPF interface commands\n" | |
5015 | "Time between HELLO packets\n" | |
5016 | "Seconds\n") | |
5017 | ||
5018 | DEFUN (no_ip_ospf_hello_interval, | |
5019 | no_ip_ospf_hello_interval_addr_cmd, | |
5020 | "no ip ospf hello-interval A.B.C.D", | |
5021 | NO_STR | |
5022 | "IP Information\n" | |
5023 | "OSPF interface commands\n" | |
5024 | "Time between HELLO packets\n" | |
5025 | "Address of interface") | |
5026 | { | |
5027 | struct interface *ifp = vty->index; | |
5028 | struct in_addr addr; | |
5029 | int ret; | |
5030 | struct ospf_if_params *params; | |
5031 | ||
5032 | ifp = vty->index; | |
5033 | params = IF_DEF_PARAMS (ifp); | |
5034 | ||
5035 | if (argc == 1) | |
5036 | { | |
5037 | ret = inet_aton(argv[0], &addr); | |
5038 | if (!ret) | |
5039 | { | |
5040 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5041 | VTY_NEWLINE); | |
5042 | return CMD_WARNING; | |
5043 | } | |
5044 | ||
5045 | params = ospf_lookup_if_params (ifp, addr); | |
5046 | if (params == NULL) | |
5047 | return CMD_SUCCESS; | |
5048 | } | |
5049 | ||
5050 | UNSET_IF_PARAM (params, v_hello); | |
f9ad937f | 5051 | params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; |
718e3744 | 5052 | |
5053 | if (params != IF_DEF_PARAMS (ifp)) | |
5054 | { | |
5055 | ospf_free_if_params (ifp, addr); | |
5056 | ospf_if_update_params (ifp, addr); | |
5057 | } | |
5058 | ||
5059 | return CMD_SUCCESS; | |
5060 | } | |
5061 | ||
5062 | ALIAS (no_ip_ospf_hello_interval, | |
5063 | no_ip_ospf_hello_interval_cmd, | |
5064 | "no ip ospf hello-interval", | |
5065 | NO_STR | |
5066 | "IP Information\n" | |
5067 | "OSPF interface commands\n" | |
5068 | "Time between HELLO packets\n") | |
5069 | ||
5070 | ALIAS (no_ip_ospf_hello_interval, | |
5071 | no_ospf_hello_interval_cmd, | |
5072 | "no ospf hello-interval", | |
5073 | NO_STR | |
5074 | "OSPF interface commands\n" | |
5075 | "Time between HELLO packets\n") | |
5076 | ||
5077 | DEFUN (ip_ospf_network, | |
5078 | ip_ospf_network_cmd, | |
5079 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", | |
5080 | "IP Information\n" | |
5081 | "OSPF interface commands\n" | |
5082 | "Network type\n" | |
5083 | "Specify OSPF broadcast multi-access network\n" | |
5084 | "Specify OSPF NBMA network\n" | |
5085 | "Specify OSPF point-to-multipoint network\n" | |
5086 | "Specify OSPF point-to-point network\n") | |
5087 | { | |
5088 | struct interface *ifp = vty->index; | |
5089 | int old_type = IF_DEF_PARAMS (ifp)->type; | |
5090 | struct route_node *rn; | |
5091 | ||
5092 | if (strncmp (argv[0], "b", 1) == 0) | |
5093 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; | |
5094 | else if (strncmp (argv[0], "n", 1) == 0) | |
5095 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; | |
5096 | else if (strncmp (argv[0], "point-to-m", 10) == 0) | |
5097 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; | |
5098 | else if (strncmp (argv[0], "point-to-p", 10) == 0) | |
5099 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; | |
5100 | ||
5101 | if (IF_DEF_PARAMS (ifp)->type == old_type) | |
5102 | return CMD_SUCCESS; | |
5103 | ||
5104 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); | |
5105 | ||
5106 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
5107 | { | |
5108 | struct ospf_interface *oi = rn->info; | |
5109 | ||
5110 | if (!oi) | |
5111 | continue; | |
5112 | ||
5113 | oi->type = IF_DEF_PARAMS (ifp)->type; | |
5114 | ||
5115 | if (oi->state > ISM_Down) | |
5116 | { | |
5117 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); | |
5118 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); | |
5119 | } | |
5120 | } | |
5121 | ||
5122 | return CMD_SUCCESS; | |
5123 | } | |
5124 | ||
5125 | ALIAS (ip_ospf_network, | |
5126 | ospf_network_cmd, | |
5127 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", | |
5128 | "OSPF interface commands\n" | |
5129 | "Network type\n" | |
5130 | "Specify OSPF broadcast multi-access network\n" | |
5131 | "Specify OSPF NBMA network\n" | |
5132 | "Specify OSPF point-to-multipoint network\n" | |
5133 | "Specify OSPF point-to-point network\n") | |
5134 | ||
5135 | DEFUN (no_ip_ospf_network, | |
5136 | no_ip_ospf_network_cmd, | |
5137 | "no ip ospf network", | |
5138 | NO_STR | |
5139 | "IP Information\n" | |
5140 | "OSPF interface commands\n" | |
5141 | "Network type\n") | |
5142 | { | |
5143 | struct interface *ifp = vty->index; | |
5144 | int old_type = IF_DEF_PARAMS (ifp)->type; | |
5145 | struct route_node *rn; | |
5146 | ||
bc18d616 | 5147 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
718e3744 | 5148 | |
5149 | if (IF_DEF_PARAMS (ifp)->type == old_type) | |
5150 | return CMD_SUCCESS; | |
5151 | ||
5152 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
5153 | { | |
5154 | struct ospf_interface *oi = rn->info; | |
5155 | ||
5156 | if (!oi) | |
5157 | continue; | |
5158 | ||
5159 | oi->type = IF_DEF_PARAMS (ifp)->type; | |
5160 | ||
5161 | if (oi->state > ISM_Down) | |
5162 | { | |
5163 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); | |
5164 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); | |
5165 | } | |
5166 | } | |
5167 | ||
5168 | return CMD_SUCCESS; | |
5169 | } | |
5170 | ||
5171 | ALIAS (no_ip_ospf_network, | |
5172 | no_ospf_network_cmd, | |
5173 | "no ospf network", | |
5174 | NO_STR | |
5175 | "OSPF interface commands\n" | |
5176 | "Network type\n") | |
5177 | ||
5178 | DEFUN (ip_ospf_priority, | |
5179 | ip_ospf_priority_addr_cmd, | |
5180 | "ip ospf priority <0-255> A.B.C.D", | |
5181 | "IP Information\n" | |
5182 | "OSPF interface commands\n" | |
5183 | "Router priority\n" | |
5184 | "Priority\n" | |
5185 | "Address of interface") | |
5186 | { | |
5187 | struct interface *ifp = vty->index; | |
5188 | u_int32_t priority; | |
5189 | struct route_node *rn; | |
5190 | struct in_addr addr; | |
5191 | int ret; | |
5192 | struct ospf_if_params *params; | |
5193 | ||
5194 | params = IF_DEF_PARAMS (ifp); | |
5195 | ||
5196 | priority = strtol (argv[0], NULL, 10); | |
5197 | ||
5198 | /* Router Priority range is <0-255>. */ | |
5199 | if (priority < 0 || priority > 255) | |
5200 | { | |
5201 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); | |
5202 | return CMD_WARNING; | |
5203 | } | |
5204 | ||
5205 | if (argc == 2) | |
5206 | { | |
5207 | ret = inet_aton(argv[1], &addr); | |
5208 | if (!ret) | |
5209 | { | |
5210 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5211 | VTY_NEWLINE); | |
5212 | return CMD_WARNING; | |
5213 | } | |
5214 | ||
5215 | params = ospf_get_if_params (ifp, addr); | |
5216 | ospf_if_update_params (ifp, addr); | |
5217 | } | |
5218 | ||
5219 | SET_IF_PARAM (params, priority); | |
5220 | params->priority = priority; | |
5221 | ||
5222 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
5223 | { | |
5224 | struct ospf_interface *oi = rn->info; | |
5225 | ||
5226 | if (!oi) | |
5227 | continue; | |
5228 | ||
5229 | ||
5230 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) | |
5231 | { | |
5232 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); | |
5233 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); | |
5234 | } | |
5235 | } | |
5236 | ||
5237 | return CMD_SUCCESS; | |
5238 | } | |
5239 | ||
5240 | ALIAS (ip_ospf_priority, | |
5241 | ip_ospf_priority_cmd, | |
5242 | "ip ospf priority <0-255>", | |
5243 | "IP Information\n" | |
5244 | "OSPF interface commands\n" | |
5245 | "Router priority\n" | |
5246 | "Priority\n") | |
5247 | ||
5248 | ALIAS (ip_ospf_priority, | |
5249 | ospf_priority_cmd, | |
5250 | "ospf priority <0-255>", | |
5251 | "OSPF interface commands\n" | |
5252 | "Router priority\n" | |
5253 | "Priority\n") | |
5254 | ||
5255 | DEFUN (no_ip_ospf_priority, | |
5256 | no_ip_ospf_priority_addr_cmd, | |
5257 | "no ip ospf priority A.B.C.D", | |
5258 | NO_STR | |
5259 | "IP Information\n" | |
5260 | "OSPF interface commands\n" | |
5261 | "Router priority\n" | |
5262 | "Address of interface") | |
5263 | { | |
5264 | struct interface *ifp = vty->index; | |
5265 | struct route_node *rn; | |
5266 | struct in_addr addr; | |
5267 | int ret; | |
5268 | struct ospf_if_params *params; | |
5269 | ||
5270 | ifp = vty->index; | |
5271 | params = IF_DEF_PARAMS (ifp); | |
5272 | ||
5273 | if (argc == 1) | |
5274 | { | |
5275 | ret = inet_aton(argv[0], &addr); | |
5276 | if (!ret) | |
5277 | { | |
5278 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5279 | VTY_NEWLINE); | |
5280 | return CMD_WARNING; | |
5281 | } | |
5282 | ||
5283 | params = ospf_lookup_if_params (ifp, addr); | |
5284 | if (params == NULL) | |
5285 | return CMD_SUCCESS; | |
5286 | } | |
5287 | ||
5288 | UNSET_IF_PARAM (params, priority); | |
5289 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; | |
5290 | ||
5291 | if (params != IF_DEF_PARAMS (ifp)) | |
5292 | { | |
5293 | ospf_free_if_params (ifp, addr); | |
5294 | ospf_if_update_params (ifp, addr); | |
5295 | } | |
5296 | ||
5297 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) | |
5298 | { | |
5299 | struct ospf_interface *oi = rn->info; | |
5300 | ||
5301 | if (!oi) | |
5302 | continue; | |
5303 | ||
5304 | ||
5305 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) | |
5306 | { | |
5307 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); | |
5308 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); | |
5309 | } | |
5310 | } | |
5311 | ||
5312 | return CMD_SUCCESS; | |
5313 | } | |
5314 | ||
5315 | ALIAS (no_ip_ospf_priority, | |
5316 | no_ip_ospf_priority_cmd, | |
5317 | "no ip ospf priority", | |
5318 | NO_STR | |
5319 | "IP Information\n" | |
5320 | "OSPF interface commands\n" | |
5321 | "Router priority\n") | |
5322 | ||
5323 | ALIAS (no_ip_ospf_priority, | |
5324 | no_ospf_priority_cmd, | |
5325 | "no ospf priority", | |
5326 | NO_STR | |
5327 | "OSPF interface commands\n" | |
5328 | "Router priority\n") | |
5329 | ||
5330 | DEFUN (ip_ospf_retransmit_interval, | |
5331 | ip_ospf_retransmit_interval_addr_cmd, | |
5332 | "ip ospf retransmit-interval <3-65535> A.B.C.D", | |
5333 | "IP Information\n" | |
5334 | "OSPF interface commands\n" | |
5335 | "Time between retransmitting lost link state advertisements\n" | |
5336 | "Seconds\n" | |
5337 | "Address of interface") | |
5338 | { | |
5339 | struct interface *ifp = vty->index; | |
5340 | u_int32_t seconds; | |
5341 | struct in_addr addr; | |
5342 | int ret; | |
5343 | struct ospf_if_params *params; | |
5344 | ||
5345 | params = IF_DEF_PARAMS (ifp); | |
5346 | seconds = strtol (argv[0], NULL, 10); | |
5347 | ||
5348 | /* Retransmit Interval range is <3-65535>. */ | |
5349 | if (seconds < 3 || seconds > 65535) | |
5350 | { | |
5351 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); | |
5352 | return CMD_WARNING; | |
5353 | } | |
5354 | ||
5355 | ||
5356 | if (argc == 2) | |
5357 | { | |
5358 | ret = inet_aton(argv[1], &addr); | |
5359 | if (!ret) | |
5360 | { | |
5361 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5362 | VTY_NEWLINE); | |
5363 | return CMD_WARNING; | |
5364 | } | |
5365 | ||
5366 | params = ospf_get_if_params (ifp, addr); | |
5367 | ospf_if_update_params (ifp, addr); | |
5368 | } | |
5369 | ||
5370 | SET_IF_PARAM (params, retransmit_interval); | |
5371 | params->retransmit_interval = seconds; | |
5372 | ||
5373 | return CMD_SUCCESS; | |
5374 | } | |
5375 | ||
5376 | ALIAS (ip_ospf_retransmit_interval, | |
5377 | ip_ospf_retransmit_interval_cmd, | |
5378 | "ip ospf retransmit-interval <3-65535>", | |
5379 | "IP Information\n" | |
5380 | "OSPF interface commands\n" | |
5381 | "Time between retransmitting lost link state advertisements\n" | |
5382 | "Seconds\n") | |
5383 | ||
5384 | ALIAS (ip_ospf_retransmit_interval, | |
5385 | ospf_retransmit_interval_cmd, | |
5386 | "ospf retransmit-interval <3-65535>", | |
5387 | "OSPF interface commands\n" | |
5388 | "Time between retransmitting lost link state advertisements\n" | |
5389 | "Seconds\n") | |
5390 | ||
5391 | DEFUN (no_ip_ospf_retransmit_interval, | |
5392 | no_ip_ospf_retransmit_interval_addr_cmd, | |
5393 | "no ip ospf retransmit-interval A.B.C.D", | |
5394 | NO_STR | |
5395 | "IP Information\n" | |
5396 | "OSPF interface commands\n" | |
5397 | "Time between retransmitting lost link state advertisements\n" | |
5398 | "Address of interface") | |
5399 | { | |
5400 | struct interface *ifp = vty->index; | |
5401 | struct in_addr addr; | |
5402 | int ret; | |
5403 | struct ospf_if_params *params; | |
5404 | ||
5405 | ifp = vty->index; | |
5406 | params = IF_DEF_PARAMS (ifp); | |
5407 | ||
5408 | if (argc == 1) | |
5409 | { | |
5410 | ret = inet_aton(argv[0], &addr); | |
5411 | if (!ret) | |
5412 | { | |
5413 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5414 | VTY_NEWLINE); | |
5415 | return CMD_WARNING; | |
5416 | } | |
5417 | ||
5418 | params = ospf_lookup_if_params (ifp, addr); | |
5419 | if (params == NULL) | |
5420 | return CMD_SUCCESS; | |
5421 | } | |
5422 | ||
5423 | UNSET_IF_PARAM (params, retransmit_interval); | |
5424 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; | |
5425 | ||
5426 | if (params != IF_DEF_PARAMS (ifp)) | |
5427 | { | |
5428 | ospf_free_if_params (ifp, addr); | |
5429 | ospf_if_update_params (ifp, addr); | |
5430 | } | |
5431 | ||
5432 | return CMD_SUCCESS; | |
5433 | } | |
5434 | ||
5435 | ALIAS (no_ip_ospf_retransmit_interval, | |
5436 | no_ip_ospf_retransmit_interval_cmd, | |
5437 | "no ip ospf retransmit-interval", | |
5438 | NO_STR | |
5439 | "IP Information\n" | |
5440 | "OSPF interface commands\n" | |
5441 | "Time between retransmitting lost link state advertisements\n") | |
5442 | ||
5443 | ALIAS (no_ip_ospf_retransmit_interval, | |
5444 | no_ospf_retransmit_interval_cmd, | |
5445 | "no ospf retransmit-interval", | |
5446 | NO_STR | |
5447 | "OSPF interface commands\n" | |
5448 | "Time between retransmitting lost link state advertisements\n") | |
5449 | ||
5450 | DEFUN (ip_ospf_transmit_delay, | |
5451 | ip_ospf_transmit_delay_addr_cmd, | |
5452 | "ip ospf transmit-delay <1-65535> A.B.C.D", | |
5453 | "IP Information\n" | |
5454 | "OSPF interface commands\n" | |
5455 | "Link state transmit delay\n" | |
5456 | "Seconds\n" | |
5457 | "Address of interface") | |
5458 | { | |
5459 | struct interface *ifp = vty->index; | |
5460 | u_int32_t seconds; | |
5461 | struct in_addr addr; | |
5462 | int ret; | |
5463 | struct ospf_if_params *params; | |
5464 | ||
5465 | params = IF_DEF_PARAMS (ifp); | |
5466 | seconds = strtol (argv[0], NULL, 10); | |
5467 | ||
5468 | /* Transmit Delay range is <1-65535>. */ | |
5469 | if (seconds < 1 || seconds > 65535) | |
5470 | { | |
5471 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); | |
5472 | return CMD_WARNING; | |
5473 | } | |
5474 | ||
5475 | if (argc == 2) | |
5476 | { | |
5477 | ret = inet_aton(argv[1], &addr); | |
5478 | if (!ret) | |
5479 | { | |
5480 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5481 | VTY_NEWLINE); | |
5482 | return CMD_WARNING; | |
5483 | } | |
5484 | ||
5485 | params = ospf_get_if_params (ifp, addr); | |
5486 | ospf_if_update_params (ifp, addr); | |
5487 | } | |
5488 | ||
5489 | SET_IF_PARAM (params, transmit_delay); | |
5490 | params->transmit_delay = seconds; | |
5491 | ||
5492 | return CMD_SUCCESS; | |
5493 | } | |
5494 | ||
5495 | ALIAS (ip_ospf_transmit_delay, | |
5496 | ip_ospf_transmit_delay_cmd, | |
5497 | "ip ospf transmit-delay <1-65535>", | |
5498 | "IP Information\n" | |
5499 | "OSPF interface commands\n" | |
5500 | "Link state transmit delay\n" | |
5501 | "Seconds\n") | |
5502 | ||
5503 | ALIAS (ip_ospf_transmit_delay, | |
5504 | ospf_transmit_delay_cmd, | |
5505 | "ospf transmit-delay <1-65535>", | |
5506 | "OSPF interface commands\n" | |
5507 | "Link state transmit delay\n" | |
5508 | "Seconds\n") | |
5509 | ||
5510 | DEFUN (no_ip_ospf_transmit_delay, | |
5511 | no_ip_ospf_transmit_delay_addr_cmd, | |
5512 | "no ip ospf transmit-delay A.B.C.D", | |
5513 | NO_STR | |
5514 | "IP Information\n" | |
5515 | "OSPF interface commands\n" | |
5516 | "Link state transmit delay\n" | |
5517 | "Address of interface") | |
5518 | { | |
5519 | struct interface *ifp = vty->index; | |
5520 | struct in_addr addr; | |
5521 | int ret; | |
5522 | struct ospf_if_params *params; | |
5523 | ||
5524 | ifp = vty->index; | |
5525 | params = IF_DEF_PARAMS (ifp); | |
5526 | ||
5527 | if (argc == 1) | |
5528 | { | |
5529 | ret = inet_aton(argv[0], &addr); | |
5530 | if (!ret) | |
5531 | { | |
5532 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
5533 | VTY_NEWLINE); | |
5534 | return CMD_WARNING; | |
5535 | } | |
5536 | ||
5537 | params = ospf_lookup_if_params (ifp, addr); | |
5538 | if (params == NULL) | |
5539 | return CMD_SUCCESS; | |
5540 | } | |
5541 | ||
5542 | UNSET_IF_PARAM (params, transmit_delay); | |
5543 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; | |
5544 | ||
5545 | if (params != IF_DEF_PARAMS (ifp)) | |
5546 | { | |
5547 | ospf_free_if_params (ifp, addr); | |
5548 | ospf_if_update_params (ifp, addr); | |
5549 | } | |
5550 | ||
5551 | return CMD_SUCCESS; | |
5552 | } | |
5553 | ||
5554 | ALIAS (no_ip_ospf_transmit_delay, | |
5555 | no_ip_ospf_transmit_delay_cmd, | |
5556 | "no ip ospf transmit-delay", | |
5557 | NO_STR | |
5558 | "IP Information\n" | |
5559 | "OSPF interface commands\n" | |
5560 | "Link state transmit delay\n") | |
5561 | ||
5562 | ALIAS (no_ip_ospf_transmit_delay, | |
5563 | no_ospf_transmit_delay_cmd, | |
5564 | "no ospf transmit-delay", | |
5565 | NO_STR | |
5566 | "OSPF interface commands\n" | |
5567 | "Link state transmit delay\n") | |
5568 | ||
5569 | \f | |
5570 | DEFUN (ospf_redistribute_source_metric_type, | |
5571 | ospf_redistribute_source_metric_type_routemap_cmd, | |
5572 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", | |
5573 | "Redistribute information from another routing protocol\n" | |
5574 | "Kernel routes\n" | |
5575 | "Connected\n" | |
5576 | "Static routes\n" | |
5577 | "Routing Information Protocol (RIP)\n" | |
5578 | "Border Gateway Protocol (BGP)\n" | |
5579 | "Metric for redistributed routes\n" | |
5580 | "OSPF default metric\n" | |
5581 | "OSPF exterior metric type for redistributed routes\n" | |
5582 | "Set OSPF External Type 1 metrics\n" | |
5583 | "Set OSPF External Type 2 metrics\n" | |
5584 | "Route map reference\n" | |
5585 | "Pointer to route-map entries\n") | |
5586 | { | |
020709f9 | 5587 | struct ospf *ospf = vty->index; |
718e3744 | 5588 | int source; |
5589 | int type = -1; | |
5590 | int metric = -1; | |
5591 | ||
5592 | /* Get distribute source. */ | |
5593 | if (!str2distribute_source (argv[0], &source)) | |
5594 | return CMD_WARNING; | |
5595 | ||
5596 | /* Get metric value. */ | |
5597 | if (argc >= 2) | |
5598 | if (!str2metric (argv[1], &metric)) | |
5599 | return CMD_WARNING; | |
5600 | ||
5601 | /* Get metric type. */ | |
5602 | if (argc >= 3) | |
5603 | if (!str2metric_type (argv[2], &type)) | |
5604 | return CMD_WARNING; | |
5605 | ||
5606 | if (argc == 4) | |
020709f9 | 5607 | ospf_routemap_set (ospf, source, argv[3]); |
718e3744 | 5608 | else |
020709f9 | 5609 | ospf_routemap_unset (ospf, source); |
718e3744 | 5610 | |
020709f9 | 5611 | return ospf_redistribute_set (ospf, source, type, metric); |
718e3744 | 5612 | } |
5613 | ||
5614 | ALIAS (ospf_redistribute_source_metric_type, | |
5615 | ospf_redistribute_source_metric_type_cmd, | |
5616 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", | |
5617 | "Redistribute information from another routing protocol\n" | |
5618 | "Kernel routes\n" | |
5619 | "Connected\n" | |
5620 | "Static routes\n" | |
5621 | "Routing Information Protocol (RIP)\n" | |
5622 | "Border Gateway Protocol (BGP)\n" | |
5623 | "Metric for redistributed routes\n" | |
5624 | "OSPF default metric\n" | |
5625 | "OSPF exterior metric type for redistributed routes\n" | |
5626 | "Set OSPF External Type 1 metrics\n" | |
5627 | "Set OSPF External Type 2 metrics\n") | |
5628 | ||
5629 | ALIAS (ospf_redistribute_source_metric_type, | |
5630 | ospf_redistribute_source_metric_cmd, | |
5631 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", | |
5632 | "Redistribute information from another routing protocol\n" | |
5633 | "Kernel routes\n" | |
5634 | "Connected\n" | |
5635 | "Static routes\n" | |
5636 | "Routing Information Protocol (RIP)\n" | |
5637 | "Border Gateway Protocol (BGP)\n" | |
5638 | "Metric for redistributed routes\n" | |
5639 | "OSPF default metric\n") | |
5640 | ||
5641 | DEFUN (ospf_redistribute_source_type_metric, | |
5642 | ospf_redistribute_source_type_metric_routemap_cmd, | |
5643 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", | |
5644 | "Redistribute information from another routing protocol\n" | |
5645 | "Kernel routes\n" | |
5646 | "Connected\n" | |
5647 | "Static routes\n" | |
5648 | "Routing Information Protocol (RIP)\n" | |
5649 | "Border Gateway Protocol (BGP)\n" | |
5650 | "OSPF exterior metric type for redistributed routes\n" | |
5651 | "Set OSPF External Type 1 metrics\n" | |
5652 | "Set OSPF External Type 2 metrics\n" | |
5653 | "Metric for redistributed routes\n" | |
5654 | "OSPF default metric\n" | |
5655 | "Route map reference\n" | |
5656 | "Pointer to route-map entries\n") | |
5657 | { | |
020709f9 | 5658 | struct ospf *ospf = vty->index; |
718e3744 | 5659 | int source; |
5660 | int type = -1; | |
5661 | int metric = -1; | |
5662 | ||
5663 | /* Get distribute source. */ | |
5664 | if (!str2distribute_source (argv[0], &source)) | |
5665 | return CMD_WARNING; | |
5666 | ||
5667 | /* Get metric value. */ | |
5668 | if (argc >= 2) | |
5669 | if (!str2metric_type (argv[1], &type)) | |
5670 | return CMD_WARNING; | |
5671 | ||
5672 | /* Get metric type. */ | |
5673 | if (argc >= 3) | |
5674 | if (!str2metric (argv[2], &metric)) | |
5675 | return CMD_WARNING; | |
5676 | ||
5677 | if (argc == 4) | |
020709f9 | 5678 | ospf_routemap_set (ospf, source, argv[3]); |
718e3744 | 5679 | else |
020709f9 | 5680 | ospf_routemap_unset (ospf, source); |
718e3744 | 5681 | |
020709f9 | 5682 | return ospf_redistribute_set (ospf, source, type, metric); |
718e3744 | 5683 | } |
5684 | ||
5685 | ALIAS (ospf_redistribute_source_type_metric, | |
5686 | ospf_redistribute_source_type_metric_cmd, | |
5687 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", | |
5688 | "Redistribute information from another routing protocol\n" | |
5689 | "Kernel routes\n" | |
5690 | "Connected\n" | |
5691 | "Static routes\n" | |
5692 | "Routing Information Protocol (RIP)\n" | |
5693 | "Border Gateway Protocol (BGP)\n" | |
5694 | "OSPF exterior metric type for redistributed routes\n" | |
5695 | "Set OSPF External Type 1 metrics\n" | |
5696 | "Set OSPF External Type 2 metrics\n" | |
5697 | "Metric for redistributed routes\n" | |
5698 | "OSPF default metric\n") | |
5699 | ||
5700 | ALIAS (ospf_redistribute_source_type_metric, | |
5701 | ospf_redistribute_source_type_cmd, | |
5702 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", | |
5703 | "Redistribute information from another routing protocol\n" | |
5704 | "Kernel routes\n" | |
5705 | "Connected\n" | |
5706 | "Static routes\n" | |
5707 | "Routing Information Protocol (RIP)\n" | |
5708 | "Border Gateway Protocol (BGP)\n" | |
5709 | "OSPF exterior metric type for redistributed routes\n" | |
5710 | "Set OSPF External Type 1 metrics\n" | |
5711 | "Set OSPF External Type 2 metrics\n") | |
5712 | ||
5713 | ALIAS (ospf_redistribute_source_type_metric, | |
5714 | ospf_redistribute_source_cmd, | |
5715 | "redistribute (kernel|connected|static|rip|bgp)", | |
5716 | "Redistribute information from another routing protocol\n" | |
5717 | "Kernel routes\n" | |
5718 | "Connected\n" | |
5719 | "Static routes\n" | |
5720 | "Routing Information Protocol (RIP)\n" | |
5721 | "Border Gateway Protocol (BGP)\n") | |
5722 | ||
5723 | DEFUN (ospf_redistribute_source_metric_routemap, | |
5724 | ospf_redistribute_source_metric_routemap_cmd, | |
5725 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", | |
5726 | "Redistribute information from another routing protocol\n" | |
5727 | "Kernel routes\n" | |
5728 | "Connected\n" | |
5729 | "Static routes\n" | |
5730 | "Routing Information Protocol (RIP)\n" | |
5731 | "Border Gateway Protocol (BGP)\n" | |
5732 | "Metric for redistributed routes\n" | |
5733 | "OSPF default metric\n" | |
5734 | "Route map reference\n" | |
5735 | "Pointer to route-map entries\n") | |
5736 | { | |
020709f9 | 5737 | struct ospf *ospf = vty->index; |
718e3744 | 5738 | int source; |
5739 | int metric = -1; | |
5740 | ||
5741 | /* Get distribute source. */ | |
5742 | if (!str2distribute_source (argv[0], &source)) | |
5743 | return CMD_WARNING; | |
5744 | ||
5745 | /* Get metric value. */ | |
5746 | if (argc >= 2) | |
5747 | if (!str2metric (argv[1], &metric)) | |
5748 | return CMD_WARNING; | |
5749 | ||
5750 | if (argc == 3) | |
020709f9 | 5751 | ospf_routemap_set (ospf, source, argv[2]); |
718e3744 | 5752 | else |
020709f9 | 5753 | ospf_routemap_unset (ospf, source); |
718e3744 | 5754 | |
020709f9 | 5755 | return ospf_redistribute_set (ospf, source, -1, metric); |
718e3744 | 5756 | } |
5757 | ||
5758 | DEFUN (ospf_redistribute_source_type_routemap, | |
5759 | ospf_redistribute_source_type_routemap_cmd, | |
5760 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", | |
5761 | "Redistribute information from another routing protocol\n" | |
5762 | "Kernel routes\n" | |
5763 | "Connected\n" | |
5764 | "Static routes\n" | |
5765 | "Routing Information Protocol (RIP)\n" | |
5766 | "Border Gateway Protocol (BGP)\n" | |
5767 | "OSPF exterior metric type for redistributed routes\n" | |
5768 | "Set OSPF External Type 1 metrics\n" | |
5769 | "Set OSPF External Type 2 metrics\n" | |
5770 | "Route map reference\n" | |
5771 | "Pointer to route-map entries\n") | |
5772 | { | |
020709f9 | 5773 | struct ospf *ospf = vty->index; |
718e3744 | 5774 | int source; |
5775 | int type = -1; | |
5776 | ||
5777 | /* Get distribute source. */ | |
5778 | if (!str2distribute_source (argv[0], &source)) | |
5779 | return CMD_WARNING; | |
5780 | ||
5781 | /* Get metric value. */ | |
5782 | if (argc >= 2) | |
5783 | if (!str2metric_type (argv[1], &type)) | |
5784 | return CMD_WARNING; | |
5785 | ||
5786 | if (argc == 3) | |
020709f9 | 5787 | ospf_routemap_set (ospf, source, argv[2]); |
718e3744 | 5788 | else |
020709f9 | 5789 | ospf_routemap_unset (ospf, source); |
718e3744 | 5790 | |
020709f9 | 5791 | return ospf_redistribute_set (ospf, source, type, -1); |
718e3744 | 5792 | } |
5793 | ||
5794 | DEFUN (ospf_redistribute_source_routemap, | |
5795 | ospf_redistribute_source_routemap_cmd, | |
5796 | "redistribute (kernel|connected|static|rip|bgp) route-map WORD", | |
5797 | "Redistribute information from another routing protocol\n" | |
5798 | "Kernel routes\n" | |
5799 | "Connected\n" | |
5800 | "Static routes\n" | |
5801 | "Routing Information Protocol (RIP)\n" | |
5802 | "Border Gateway Protocol (BGP)\n" | |
5803 | "Route map reference\n" | |
5804 | "Pointer to route-map entries\n") | |
5805 | { | |
020709f9 | 5806 | struct ospf *ospf = vty->index; |
718e3744 | 5807 | int source; |
5808 | ||
5809 | /* Get distribute source. */ | |
5810 | if (!str2distribute_source (argv[0], &source)) | |
5811 | return CMD_WARNING; | |
5812 | ||
5813 | if (argc == 2) | |
020709f9 | 5814 | ospf_routemap_set (ospf, source, argv[1]); |
718e3744 | 5815 | else |
020709f9 | 5816 | ospf_routemap_unset (ospf, source); |
718e3744 | 5817 | |
020709f9 | 5818 | return ospf_redistribute_set (ospf, source, -1, -1); |
718e3744 | 5819 | } |
5820 | ||
5821 | DEFUN (no_ospf_redistribute_source, | |
5822 | no_ospf_redistribute_source_cmd, | |
5823 | "no redistribute (kernel|connected|static|rip|bgp)", | |
5824 | NO_STR | |
5825 | "Redistribute information from another routing protocol\n" | |
5826 | "Kernel routes\n" | |
5827 | "Connected\n" | |
5828 | "Static routes\n" | |
5829 | "Routing Information Protocol (RIP)\n" | |
5830 | "Border Gateway Protocol (BGP)\n") | |
5831 | { | |
020709f9 | 5832 | struct ospf *ospf = vty->index; |
718e3744 | 5833 | int source; |
5834 | ||
5835 | if (!str2distribute_source (argv[0], &source)) | |
5836 | return CMD_WARNING; | |
5837 | ||
020709f9 | 5838 | ospf_routemap_unset (ospf, source); |
5839 | return ospf_redistribute_unset (ospf, source); | |
718e3744 | 5840 | } |
5841 | ||
5842 | DEFUN (ospf_distribute_list_out, | |
5843 | ospf_distribute_list_out_cmd, | |
5844 | "distribute-list WORD out (kernel|connected|static|rip|bgp)", | |
5845 | "Filter networks in routing updates\n" | |
5846 | "Access-list name\n" | |
5847 | OUT_STR | |
5848 | "Kernel routes\n" | |
5849 | "Connected\n" | |
5850 | "Static routes\n" | |
5851 | "Routing Information Protocol (RIP)\n" | |
5852 | "Border Gateway Protocol (BGP)\n") | |
5853 | { | |
68980084 | 5854 | struct ospf *ospf = vty->index; |
718e3744 | 5855 | int source; |
5856 | ||
5857 | /* Get distribute source. */ | |
5858 | if (!str2distribute_source (argv[1], &source)) | |
5859 | return CMD_WARNING; | |
5860 | ||
68980084 | 5861 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
718e3744 | 5862 | } |
5863 | ||
5864 | DEFUN (no_ospf_distribute_list_out, | |
5865 | no_ospf_distribute_list_out_cmd, | |
5866 | "no distribute-list WORD out (kernel|connected|static|rip|bgp)", | |
5867 | NO_STR | |
5868 | "Filter networks in routing updates\n" | |
5869 | "Access-list name\n" | |
5870 | OUT_STR | |
5871 | "Kernel routes\n" | |
5872 | "Connected\n" | |
5873 | "Static routes\n" | |
5874 | "Routing Information Protocol (RIP)\n" | |
5875 | "Border Gateway Protocol (BGP)\n") | |
5876 | { | |
68980084 | 5877 | struct ospf *ospf = vty->index; |
718e3744 | 5878 | int source; |
5879 | ||
5880 | if (!str2distribute_source (argv[1], &source)) | |
5881 | return CMD_WARNING; | |
5882 | ||
68980084 | 5883 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
718e3744 | 5884 | } |
5885 | ||
5886 | /* Default information originate. */ | |
5887 | DEFUN (ospf_default_information_originate_metric_type_routemap, | |
5888 | ospf_default_information_originate_metric_type_routemap_cmd, | |
5889 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", | |
5890 | "Control distribution of default information\n" | |
5891 | "Distribute a default route\n" | |
5892 | "OSPF default metric\n" | |
5893 | "OSPF metric\n" | |
5894 | "OSPF metric type for default routes\n" | |
5895 | "Set OSPF External Type 1 metrics\n" | |
5896 | "Set OSPF External Type 2 metrics\n" | |
5897 | "Route map reference\n" | |
5898 | "Pointer to route-map entries\n") | |
5899 | { | |
020709f9 | 5900 | struct ospf *ospf = vty->index; |
718e3744 | 5901 | int type = -1; |
5902 | int metric = -1; | |
5903 | ||
5904 | /* Get metric value. */ | |
5905 | if (argc >= 1) | |
5906 | if (!str2metric (argv[0], &metric)) | |
5907 | return CMD_WARNING; | |
5908 | ||
5909 | /* Get metric type. */ | |
5910 | if (argc >= 2) | |
5911 | if (!str2metric_type (argv[1], &type)) | |
5912 | return CMD_WARNING; | |
5913 | ||
5914 | if (argc == 3) | |
020709f9 | 5915 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
718e3744 | 5916 | else |
020709f9 | 5917 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 5918 | |
020709f9 | 5919 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
5920 | type, metric); | |
718e3744 | 5921 | } |
5922 | ||
5923 | ALIAS (ospf_default_information_originate_metric_type_routemap, | |
5924 | ospf_default_information_originate_metric_type_cmd, | |
5925 | "default-information originate metric <0-16777214> metric-type (1|2)", | |
5926 | "Control distribution of default information\n" | |
5927 | "Distribute a default route\n" | |
5928 | "OSPF default metric\n" | |
5929 | "OSPF metric\n" | |
5930 | "OSPF metric type for default routes\n" | |
5931 | "Set OSPF External Type 1 metrics\n" | |
5932 | "Set OSPF External Type 2 metrics\n") | |
5933 | ||
5934 | ALIAS (ospf_default_information_originate_metric_type_routemap, | |
5935 | ospf_default_information_originate_metric_cmd, | |
5936 | "default-information originate metric <0-16777214>", | |
5937 | "Control distribution of default information\n" | |
5938 | "Distribute a default route\n" | |
5939 | "OSPF default metric\n" | |
5940 | "OSPF metric\n") | |
5941 | ||
5942 | ALIAS (ospf_default_information_originate_metric_type_routemap, | |
5943 | ospf_default_information_originate_cmd, | |
5944 | "default-information originate", | |
5945 | "Control distribution of default information\n" | |
5946 | "Distribute a default route\n") | |
5947 | ||
5948 | /* Default information originate. */ | |
5949 | DEFUN (ospf_default_information_originate_metric_routemap, | |
5950 | ospf_default_information_originate_metric_routemap_cmd, | |
5951 | "default-information originate metric <0-16777214> route-map WORD", | |
5952 | "Control distribution of default information\n" | |
5953 | "Distribute a default route\n" | |
5954 | "OSPF default metric\n" | |
5955 | "OSPF metric\n" | |
5956 | "Route map reference\n" | |
5957 | "Pointer to route-map entries\n") | |
5958 | { | |
020709f9 | 5959 | struct ospf *ospf = vty->index; |
718e3744 | 5960 | int metric = -1; |
5961 | ||
5962 | /* Get metric value. */ | |
5963 | if (argc >= 1) | |
5964 | if (!str2metric (argv[0], &metric)) | |
5965 | return CMD_WARNING; | |
5966 | ||
5967 | if (argc == 2) | |
020709f9 | 5968 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
718e3744 | 5969 | else |
020709f9 | 5970 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 5971 | |
020709f9 | 5972 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
5973 | -1, metric); | |
718e3744 | 5974 | } |
5975 | ||
5976 | /* Default information originate. */ | |
5977 | DEFUN (ospf_default_information_originate_routemap, | |
5978 | ospf_default_information_originate_routemap_cmd, | |
5979 | "default-information originate route-map WORD", | |
5980 | "Control distribution of default information\n" | |
5981 | "Distribute a default route\n" | |
5982 | "Route map reference\n" | |
5983 | "Pointer to route-map entries\n") | |
5984 | { | |
020709f9 | 5985 | struct ospf *ospf = vty->index; |
5986 | ||
718e3744 | 5987 | if (argc == 1) |
020709f9 | 5988 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
718e3744 | 5989 | else |
020709f9 | 5990 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 5991 | |
020709f9 | 5992 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
718e3744 | 5993 | } |
5994 | ||
5995 | DEFUN (ospf_default_information_originate_type_metric_routemap, | |
5996 | ospf_default_information_originate_type_metric_routemap_cmd, | |
5997 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", | |
5998 | "Control distribution of default information\n" | |
5999 | "Distribute a default route\n" | |
6000 | "OSPF metric type for default routes\n" | |
6001 | "Set OSPF External Type 1 metrics\n" | |
6002 | "Set OSPF External Type 2 metrics\n" | |
6003 | "OSPF default metric\n" | |
6004 | "OSPF metric\n" | |
6005 | "Route map reference\n" | |
6006 | "Pointer to route-map entries\n") | |
6007 | { | |
020709f9 | 6008 | struct ospf *ospf = vty->index; |
718e3744 | 6009 | int type = -1; |
6010 | int metric = -1; | |
6011 | ||
6012 | /* Get metric type. */ | |
6013 | if (argc >= 1) | |
6014 | if (!str2metric_type (argv[0], &type)) | |
6015 | return CMD_WARNING; | |
6016 | ||
6017 | /* Get metric value. */ | |
6018 | if (argc >= 2) | |
6019 | if (!str2metric (argv[1], &metric)) | |
6020 | return CMD_WARNING; | |
6021 | ||
6022 | if (argc == 3) | |
020709f9 | 6023 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
718e3744 | 6024 | else |
020709f9 | 6025 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6026 | |
020709f9 | 6027 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
6028 | type, metric); | |
718e3744 | 6029 | } |
6030 | ||
6031 | ALIAS (ospf_default_information_originate_type_metric_routemap, | |
6032 | ospf_default_information_originate_type_metric_cmd, | |
6033 | "default-information originate metric-type (1|2) metric <0-16777214>", | |
6034 | "Control distribution of default information\n" | |
6035 | "Distribute a default route\n" | |
6036 | "OSPF metric type for default routes\n" | |
6037 | "Set OSPF External Type 1 metrics\n" | |
6038 | "Set OSPF External Type 2 metrics\n" | |
6039 | "OSPF default metric\n" | |
6040 | "OSPF metric\n") | |
6041 | ||
6042 | ALIAS (ospf_default_information_originate_type_metric_routemap, | |
6043 | ospf_default_information_originate_type_cmd, | |
6044 | "default-information originate metric-type (1|2)", | |
6045 | "Control distribution of default information\n" | |
6046 | "Distribute a default route\n" | |
6047 | "OSPF metric type for default routes\n" | |
6048 | "Set OSPF External Type 1 metrics\n" | |
6049 | "Set OSPF External Type 2 metrics\n") | |
6050 | ||
6051 | DEFUN (ospf_default_information_originate_type_routemap, | |
6052 | ospf_default_information_originate_type_routemap_cmd, | |
6053 | "default-information originate metric-type (1|2) route-map WORD", | |
6054 | "Control distribution of default information\n" | |
6055 | "Distribute a default route\n" | |
6056 | "OSPF metric type for default routes\n" | |
6057 | "Set OSPF External Type 1 metrics\n" | |
6058 | "Set OSPF External Type 2 metrics\n" | |
6059 | "Route map reference\n" | |
6060 | "Pointer to route-map entries\n") | |
6061 | { | |
020709f9 | 6062 | struct ospf *ospf = vty->index; |
718e3744 | 6063 | int type = -1; |
6064 | ||
6065 | /* Get metric type. */ | |
6066 | if (argc >= 1) | |
6067 | if (!str2metric_type (argv[0], &type)) | |
6068 | return CMD_WARNING; | |
6069 | ||
6070 | if (argc == 2) | |
020709f9 | 6071 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
718e3744 | 6072 | else |
020709f9 | 6073 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6074 | |
020709f9 | 6075 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
6076 | type, -1); | |
718e3744 | 6077 | } |
6078 | ||
6079 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, | |
6080 | ospf_default_information_originate_always_metric_type_routemap_cmd, | |
6081 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", | |
6082 | "Control distribution of default information\n" | |
6083 | "Distribute a default route\n" | |
6084 | "Always advertise default route\n" | |
6085 | "OSPF default metric\n" | |
6086 | "OSPF metric\n" | |
6087 | "OSPF metric type for default routes\n" | |
6088 | "Set OSPF External Type 1 metrics\n" | |
6089 | "Set OSPF External Type 2 metrics\n" | |
6090 | "Route map reference\n" | |
6091 | "Pointer to route-map entries\n") | |
6092 | { | |
020709f9 | 6093 | struct ospf *ospf = vty->index; |
718e3744 | 6094 | int type = -1; |
6095 | int metric = -1; | |
6096 | ||
6097 | /* Get metric value. */ | |
6098 | if (argc >= 1) | |
6099 | if (!str2metric (argv[0], &metric)) | |
6100 | return CMD_WARNING; | |
6101 | ||
6102 | /* Get metric type. */ | |
6103 | if (argc >= 2) | |
6104 | if (!str2metric_type (argv[1], &type)) | |
6105 | return CMD_WARNING; | |
6106 | ||
6107 | if (argc == 3) | |
020709f9 | 6108 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
718e3744 | 6109 | else |
020709f9 | 6110 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6111 | |
020709f9 | 6112 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
718e3744 | 6113 | type, metric); |
6114 | } | |
6115 | ||
6116 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, | |
6117 | ospf_default_information_originate_always_metric_type_cmd, | |
6118 | "default-information originate always metric <0-16777214> metric-type (1|2)", | |
6119 | "Control distribution of default information\n" | |
6120 | "Distribute a default route\n" | |
6121 | "Always advertise default route\n" | |
6122 | "OSPF default metric\n" | |
6123 | "OSPF metric\n" | |
6124 | "OSPF metric type for default routes\n" | |
6125 | "Set OSPF External Type 1 metrics\n" | |
6126 | "Set OSPF External Type 2 metrics\n") | |
6127 | ||
6128 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, | |
6129 | ospf_default_information_originate_always_metric_cmd, | |
6130 | "default-information originate always metric <0-16777214>", | |
6131 | "Control distribution of default information\n" | |
6132 | "Distribute a default route\n" | |
6133 | "Always advertise default route\n" | |
6134 | "OSPF default metric\n" | |
6135 | "OSPF metric\n" | |
6136 | "OSPF metric type for default routes\n") | |
6137 | ||
6138 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, | |
6139 | ospf_default_information_originate_always_cmd, | |
6140 | "default-information originate always", | |
6141 | "Control distribution of default information\n" | |
6142 | "Distribute a default route\n" | |
6143 | "Always advertise default route\n") | |
6144 | ||
6145 | DEFUN (ospf_default_information_originate_always_metric_routemap, | |
6146 | ospf_default_information_originate_always_metric_routemap_cmd, | |
6147 | "default-information originate always metric <0-16777214> route-map WORD", | |
6148 | "Control distribution of default information\n" | |
6149 | "Distribute a default route\n" | |
6150 | "Always advertise default route\n" | |
6151 | "OSPF default metric\n" | |
6152 | "OSPF metric\n" | |
6153 | "Route map reference\n" | |
6154 | "Pointer to route-map entries\n") | |
6155 | { | |
020709f9 | 6156 | struct ospf *ospf = vty->index; |
718e3744 | 6157 | int metric = -1; |
6158 | ||
6159 | /* Get metric value. */ | |
6160 | if (argc >= 1) | |
6161 | if (!str2metric (argv[0], &metric)) | |
6162 | return CMD_WARNING; | |
6163 | ||
6164 | if (argc == 2) | |
020709f9 | 6165 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
718e3744 | 6166 | else |
020709f9 | 6167 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6168 | |
020709f9 | 6169 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
6170 | -1, metric); | |
718e3744 | 6171 | } |
6172 | ||
6173 | DEFUN (ospf_default_information_originate_always_routemap, | |
6174 | ospf_default_information_originate_always_routemap_cmd, | |
6175 | "default-information originate always route-map WORD", | |
6176 | "Control distribution of default information\n" | |
6177 | "Distribute a default route\n" | |
6178 | "Always advertise default route\n" | |
6179 | "Route map reference\n" | |
6180 | "Pointer to route-map entries\n") | |
6181 | { | |
020709f9 | 6182 | struct ospf *ospf = vty->index; |
6183 | ||
718e3744 | 6184 | if (argc == 1) |
020709f9 | 6185 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
718e3744 | 6186 | else |
020709f9 | 6187 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6188 | |
020709f9 | 6189 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
718e3744 | 6190 | } |
6191 | ||
6192 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, | |
6193 | ospf_default_information_originate_always_type_metric_routemap_cmd, | |
6194 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", | |
6195 | "Control distribution of default information\n" | |
6196 | "Distribute a default route\n" | |
6197 | "Always advertise default route\n" | |
6198 | "OSPF metric type for default routes\n" | |
6199 | "Set OSPF External Type 1 metrics\n" | |
6200 | "Set OSPF External Type 2 metrics\n" | |
6201 | "OSPF default metric\n" | |
6202 | "OSPF metric\n" | |
6203 | "Route map reference\n" | |
6204 | "Pointer to route-map entries\n") | |
6205 | { | |
020709f9 | 6206 | struct ospf *ospf = vty->index; |
718e3744 | 6207 | int type = -1; |
6208 | int metric = -1; | |
6209 | ||
6210 | /* Get metric type. */ | |
6211 | if (argc >= 1) | |
6212 | if (!str2metric_type (argv[0], &type)) | |
6213 | return CMD_WARNING; | |
6214 | ||
6215 | /* Get metric value. */ | |
6216 | if (argc >= 2) | |
6217 | if (!str2metric (argv[1], &metric)) | |
6218 | return CMD_WARNING; | |
6219 | ||
6220 | if (argc == 3) | |
020709f9 | 6221 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
718e3744 | 6222 | else |
020709f9 | 6223 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6224 | |
020709f9 | 6225 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
718e3744 | 6226 | type, metric); |
6227 | } | |
6228 | ||
6229 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, | |
6230 | ospf_default_information_originate_always_type_metric_cmd, | |
6231 | "default-information originate always metric-type (1|2) metric <0-16777214>", | |
6232 | "Control distribution of default information\n" | |
6233 | "Distribute a default route\n" | |
6234 | "Always advertise default route\n" | |
6235 | "OSPF metric type for default routes\n" | |
6236 | "Set OSPF External Type 1 metrics\n" | |
6237 | "Set OSPF External Type 2 metrics\n" | |
6238 | "OSPF default metric\n" | |
6239 | "OSPF metric\n") | |
6240 | ||
6241 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, | |
6242 | ospf_default_information_originate_always_type_cmd, | |
6243 | "default-information originate always metric-type (1|2)", | |
6244 | "Control distribution of default information\n" | |
6245 | "Distribute a default route\n" | |
6246 | "Always advertise default route\n" | |
6247 | "OSPF metric type for default routes\n" | |
6248 | "Set OSPF External Type 1 metrics\n" | |
6249 | "Set OSPF External Type 2 metrics\n") | |
6250 | ||
6251 | DEFUN (ospf_default_information_originate_always_type_routemap, | |
6252 | ospf_default_information_originate_always_type_routemap_cmd, | |
6253 | "default-information originate always metric-type (1|2) route-map WORD", | |
6254 | "Control distribution of default information\n" | |
6255 | "Distribute a default route\n" | |
6256 | "Always advertise default route\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 | { | |
020709f9 | 6263 | struct ospf *ospf = vty->index; |
718e3744 | 6264 | int type = -1; |
6265 | ||
6266 | /* Get metric type. */ | |
6267 | if (argc >= 1) | |
6268 | if (!str2metric_type (argv[0], &type)) | |
6269 | return CMD_WARNING; | |
6270 | ||
6271 | if (argc == 2) | |
020709f9 | 6272 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
718e3744 | 6273 | else |
020709f9 | 6274 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
718e3744 | 6275 | |
020709f9 | 6276 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
718e3744 | 6277 | type, -1); |
6278 | } | |
6279 | ||
6280 | DEFUN (no_ospf_default_information_originate, | |
6281 | no_ospf_default_information_originate_cmd, | |
6282 | "no default-information originate", | |
6283 | NO_STR | |
6284 | "Control distribution of default information\n" | |
6285 | "Distribute a default route\n") | |
6286 | { | |
68980084 | 6287 | struct ospf *ospf = vty->index; |
718e3744 | 6288 | struct prefix_ipv4 p; |
718e3744 | 6289 | |
6290 | p.family = AF_INET; | |
6291 | p.prefix.s_addr = 0; | |
6292 | p.prefixlen = 0; | |
6293 | ||
5339cfdb | 6294 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
718e3744 | 6295 | |
6296 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { | |
6297 | ospf_external_info_delete (DEFAULT_ROUTE, p); | |
6298 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); | |
6299 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; | |
6300 | } | |
6301 | ||
020709f9 | 6302 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
6303 | return ospf_redistribute_default_unset (ospf); | |
718e3744 | 6304 | } |
6305 | ||
6306 | DEFUN (ospf_default_metric, | |
6307 | ospf_default_metric_cmd, | |
6308 | "default-metric <0-16777214>", | |
6309 | "Set metric of redistributed routes\n" | |
6310 | "Default metric\n") | |
6311 | { | |
68980084 | 6312 | struct ospf *ospf = vty->index; |
718e3744 | 6313 | int metric = -1; |
6314 | ||
6315 | if (!str2metric (argv[0], &metric)) | |
6316 | return CMD_WARNING; | |
6317 | ||
68980084 | 6318 | ospf->default_metric = metric; |
718e3744 | 6319 | |
6320 | return CMD_SUCCESS; | |
6321 | } | |
6322 | ||
6323 | DEFUN (no_ospf_default_metric, | |
6324 | no_ospf_default_metric_cmd, | |
6325 | "no default-metric", | |
6326 | NO_STR | |
6327 | "Set metric of redistributed routes\n") | |
6328 | { | |
68980084 | 6329 | struct ospf *ospf = vty->index; |
6330 | ||
6331 | ospf->default_metric = -1; | |
6332 | ||
718e3744 | 6333 | return CMD_SUCCESS; |
6334 | } | |
6335 | ||
6336 | ALIAS (no_ospf_default_metric, | |
6337 | no_ospf_default_metric_val_cmd, | |
6338 | "no default-metric <0-16777214>", | |
6339 | NO_STR | |
6340 | "Set metric of redistributed routes\n" | |
6341 | "Default metric\n") | |
6342 | ||
6343 | DEFUN (ospf_distance, | |
6344 | ospf_distance_cmd, | |
6345 | "distance <1-255>", | |
6346 | "Define an administrative distance\n" | |
6347 | "OSPF Administrative distance\n") | |
6348 | { | |
68980084 | 6349 | struct ospf *ospf = vty->index; |
6350 | ||
6351 | ospf->distance_all = atoi (argv[0]); | |
6352 | ||
718e3744 | 6353 | return CMD_SUCCESS; |
6354 | } | |
6355 | ||
6356 | DEFUN (no_ospf_distance, | |
6357 | no_ospf_distance_cmd, | |
6358 | "no distance <1-255>", | |
6359 | NO_STR | |
6360 | "Define an administrative distance\n" | |
6361 | "OSPF Administrative distance\n") | |
6362 | { | |
68980084 | 6363 | struct ospf *ospf = vty->index; |
6364 | ||
6365 | ospf->distance_all = 0; | |
6366 | ||
718e3744 | 6367 | return CMD_SUCCESS; |
6368 | } | |
6369 | ||
6370 | DEFUN (no_ospf_distance_ospf, | |
6371 | no_ospf_distance_ospf_cmd, | |
6372 | "no distance ospf", | |
6373 | NO_STR | |
6374 | "Define an administrative distance\n" | |
6375 | "OSPF Administrative distance\n" | |
6376 | "OSPF Distance\n") | |
6377 | { | |
68980084 | 6378 | struct ospf *ospf = vty->index; |
6379 | ||
6380 | ospf->distance_intra = 0; | |
6381 | ospf->distance_inter = 0; | |
6382 | ospf->distance_external = 0; | |
6383 | ||
718e3744 | 6384 | return CMD_SUCCESS; |
6385 | } | |
6386 | ||
6387 | DEFUN (ospf_distance_ospf_intra, | |
6388 | ospf_distance_ospf_intra_cmd, | |
6389 | "distance ospf intra-area <1-255>", | |
6390 | "Define an administrative distance\n" | |
6391 | "OSPF Administrative distance\n" | |
6392 | "Intra-area routes\n" | |
6393 | "Distance for intra-area routes\n") | |
6394 | { | |
68980084 | 6395 | struct ospf *ospf = vty->index; |
6396 | ||
6397 | ospf->distance_intra = atoi (argv[0]); | |
6398 | ||
718e3744 | 6399 | return CMD_SUCCESS; |
6400 | } | |
6401 | ||
6402 | DEFUN (ospf_distance_ospf_intra_inter, | |
6403 | ospf_distance_ospf_intra_inter_cmd, | |
6404 | "distance ospf intra-area <1-255> inter-area <1-255>", | |
6405 | "Define an administrative distance\n" | |
6406 | "OSPF Administrative distance\n" | |
6407 | "Intra-area routes\n" | |
6408 | "Distance for intra-area routes\n" | |
6409 | "Inter-area routes\n" | |
6410 | "Distance for inter-area routes\n") | |
6411 | { | |
68980084 | 6412 | struct ospf *ospf = vty->index; |
6413 | ||
6414 | ospf->distance_intra = atoi (argv[0]); | |
6415 | ospf->distance_inter = atoi (argv[1]); | |
6416 | ||
718e3744 | 6417 | return CMD_SUCCESS; |
6418 | } | |
6419 | ||
6420 | DEFUN (ospf_distance_ospf_intra_external, | |
6421 | ospf_distance_ospf_intra_external_cmd, | |
6422 | "distance ospf intra-area <1-255> external <1-255>", | |
6423 | "Define an administrative distance\n" | |
6424 | "OSPF Administrative distance\n" | |
6425 | "Intra-area routes\n" | |
6426 | "Distance for intra-area routes\n" | |
6427 | "External routes\n" | |
6428 | "Distance for external routes\n") | |
6429 | { | |
68980084 | 6430 | struct ospf *ospf = vty->index; |
6431 | ||
6432 | ospf->distance_intra = atoi (argv[0]); | |
6433 | ospf->distance_external = atoi (argv[1]); | |
6434 | ||
718e3744 | 6435 | return CMD_SUCCESS; |
6436 | } | |
6437 | ||
6438 | DEFUN (ospf_distance_ospf_intra_inter_external, | |
6439 | ospf_distance_ospf_intra_inter_external_cmd, | |
6440 | "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>", | |
6441 | "Define an administrative distance\n" | |
6442 | "OSPF Administrative distance\n" | |
6443 | "Intra-area routes\n" | |
6444 | "Distance for intra-area routes\n" | |
6445 | "Inter-area routes\n" | |
6446 | "Distance for inter-area routes\n" | |
6447 | "External routes\n" | |
6448 | "Distance for external routes\n") | |
6449 | { | |
68980084 | 6450 | struct ospf *ospf = vty->index; |
6451 | ||
6452 | ospf->distance_intra = atoi (argv[0]); | |
6453 | ospf->distance_inter = atoi (argv[1]); | |
6454 | ospf->distance_external = atoi (argv[2]); | |
6455 | ||
718e3744 | 6456 | return CMD_SUCCESS; |
6457 | } | |
6458 | ||
6459 | DEFUN (ospf_distance_ospf_intra_external_inter, | |
6460 | ospf_distance_ospf_intra_external_inter_cmd, | |
6461 | "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>", | |
6462 | "Define an administrative distance\n" | |
6463 | "OSPF Administrative distance\n" | |
6464 | "Intra-area routes\n" | |
6465 | "Distance for intra-area routes\n" | |
6466 | "External routes\n" | |
6467 | "Distance for external routes\n" | |
6468 | "Inter-area routes\n" | |
6469 | "Distance for inter-area routes\n") | |
6470 | { | |
68980084 | 6471 | struct ospf *ospf = vty->index; |
6472 | ||
6473 | ospf->distance_intra = atoi (argv[0]); | |
6474 | ospf->distance_external = atoi (argv[1]); | |
6475 | ospf->distance_inter = atoi (argv[2]); | |
6476 | ||
718e3744 | 6477 | return CMD_SUCCESS; |
6478 | } | |
6479 | ||
6480 | DEFUN (ospf_distance_ospf_inter, | |
6481 | ospf_distance_ospf_inter_cmd, | |
6482 | "distance ospf inter-area <1-255>", | |
6483 | "Define an administrative distance\n" | |
6484 | "OSPF Administrative distance\n" | |
6485 | "Inter-area routes\n" | |
6486 | "Distance for inter-area routes\n") | |
6487 | { | |
68980084 | 6488 | struct ospf *ospf = vty->index; |
6489 | ||
6490 | ospf->distance_inter = atoi (argv[0]); | |
6491 | ||
718e3744 | 6492 | return CMD_SUCCESS; |
6493 | } | |
6494 | ||
6495 | DEFUN (ospf_distance_ospf_inter_intra, | |
6496 | ospf_distance_ospf_inter_intra_cmd, | |
6497 | "distance ospf inter-area <1-255> intra-area <1-255>", | |
6498 | "Define an administrative distance\n" | |
6499 | "OSPF Administrative distance\n" | |
6500 | "Inter-area routes\n" | |
6501 | "Distance for inter-area routes\n" | |
6502 | "Intra-area routes\n" | |
6503 | "Distance for intra-area routes\n") | |
6504 | { | |
68980084 | 6505 | struct ospf *ospf = vty->index; |
6506 | ||
6507 | ospf->distance_inter = atoi (argv[0]); | |
6508 | ospf->distance_intra = atoi (argv[1]); | |
6509 | ||
718e3744 | 6510 | return CMD_SUCCESS; |
6511 | } | |
6512 | ||
6513 | DEFUN (ospf_distance_ospf_inter_external, | |
6514 | ospf_distance_ospf_inter_external_cmd, | |
6515 | "distance ospf inter-area <1-255> external <1-255>", | |
6516 | "Define an administrative distance\n" | |
6517 | "OSPF Administrative distance\n" | |
6518 | "Inter-area routes\n" | |
6519 | "Distance for inter-area routes\n" | |
6520 | "External routes\n" | |
6521 | "Distance for external routes\n") | |
6522 | { | |
68980084 | 6523 | struct ospf *ospf = vty->index; |
6524 | ||
6525 | ospf->distance_inter = atoi (argv[0]); | |
6526 | ospf->distance_external = atoi (argv[1]); | |
6527 | ||
718e3744 | 6528 | return CMD_SUCCESS; |
6529 | } | |
6530 | ||
6531 | DEFUN (ospf_distance_ospf_inter_intra_external, | |
6532 | ospf_distance_ospf_inter_intra_external_cmd, | |
6533 | "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", | |
6534 | "Define an administrative distance\n" | |
6535 | "OSPF Administrative distance\n" | |
6536 | "Inter-area routes\n" | |
6537 | "Distance for inter-area routes\n" | |
6538 | "Intra-area routes\n" | |
6539 | "Distance for intra-area routes\n" | |
6540 | "External routes\n" | |
6541 | "Distance for external routes\n") | |
6542 | { | |
68980084 | 6543 | struct ospf *ospf = vty->index; |
6544 | ||
6545 | ospf->distance_inter = atoi (argv[0]); | |
6546 | ospf->distance_intra = atoi (argv[1]); | |
6547 | ospf->distance_external = atoi (argv[2]); | |
6548 | ||
718e3744 | 6549 | return CMD_SUCCESS; |
6550 | } | |
6551 | ||
6552 | DEFUN (ospf_distance_ospf_inter_external_intra, | |
6553 | ospf_distance_ospf_inter_external_intra_cmd, | |
6554 | "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>", | |
6555 | "Define an administrative distance\n" | |
6556 | "OSPF Administrative distance\n" | |
6557 | "Inter-area routes\n" | |
6558 | "Distance for inter-area routes\n" | |
6559 | "External routes\n" | |
6560 | "Distance for external routes\n" | |
6561 | "Intra-area routes\n" | |
6562 | "Distance for intra-area routes\n") | |
6563 | { | |
68980084 | 6564 | struct ospf *ospf = vty->index; |
6565 | ||
6566 | ospf->distance_inter = atoi (argv[0]); | |
6567 | ospf->distance_external = atoi (argv[1]); | |
6568 | ospf->distance_intra = atoi (argv[2]); | |
6569 | ||
718e3744 | 6570 | return CMD_SUCCESS; |
6571 | } | |
6572 | ||
6573 | DEFUN (ospf_distance_ospf_external, | |
6574 | ospf_distance_ospf_external_cmd, | |
6575 | "distance ospf external <1-255>", | |
6576 | "Define an administrative distance\n" | |
6577 | "OSPF Administrative distance\n" | |
6578 | "External routes\n" | |
6579 | "Distance for external routes\n") | |
6580 | { | |
68980084 | 6581 | struct ospf *ospf = vty->index; |
6582 | ||
6583 | ospf->distance_external = atoi (argv[0]); | |
6584 | ||
718e3744 | 6585 | return CMD_SUCCESS; |
6586 | } | |
6587 | ||
6588 | DEFUN (ospf_distance_ospf_external_intra, | |
6589 | ospf_distance_ospf_external_intra_cmd, | |
6590 | "distance ospf external <1-255> intra-area <1-255>", | |
6591 | "Define an administrative distance\n" | |
6592 | "OSPF Administrative distance\n" | |
6593 | "External routes\n" | |
6594 | "Distance for external routes\n" | |
6595 | "Intra-area routes\n" | |
6596 | "Distance for intra-area routes\n") | |
6597 | { | |
68980084 | 6598 | struct ospf *ospf = vty->index; |
6599 | ||
6600 | ospf->distance_external = atoi (argv[0]); | |
6601 | ospf->distance_intra = atoi (argv[1]); | |
6602 | ||
718e3744 | 6603 | return CMD_SUCCESS; |
6604 | } | |
6605 | ||
6606 | DEFUN (ospf_distance_ospf_external_inter, | |
6607 | ospf_distance_ospf_external_inter_cmd, | |
6608 | "distance ospf external <1-255> inter-area <1-255>", | |
6609 | "Define an administrative distance\n" | |
6610 | "OSPF Administrative distance\n" | |
6611 | "External routes\n" | |
6612 | "Distance for external routes\n" | |
6613 | "Inter-area routes\n" | |
6614 | "Distance for inter-area routes\n") | |
6615 | { | |
68980084 | 6616 | struct ospf *ospf = vty->index; |
6617 | ||
6618 | ospf->distance_external = atoi (argv[0]); | |
6619 | ospf->distance_inter = atoi (argv[1]); | |
6620 | ||
718e3744 | 6621 | return CMD_SUCCESS; |
6622 | } | |
6623 | ||
6624 | DEFUN (ospf_distance_ospf_external_intra_inter, | |
6625 | ospf_distance_ospf_external_intra_inter_cmd, | |
6626 | "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>", | |
6627 | "Define an administrative distance\n" | |
6628 | "OSPF Administrative distance\n" | |
6629 | "External routes\n" | |
6630 | "Distance for external routes\n" | |
6631 | "Intra-area routes\n" | |
6632 | "Distance for intra-area routes\n" | |
6633 | "Inter-area routes\n" | |
6634 | "Distance for inter-area routes\n") | |
6635 | { | |
68980084 | 6636 | struct ospf *ospf = vty->index; |
6637 | ||
6638 | ospf->distance_external = atoi (argv[0]); | |
6639 | ospf->distance_intra = atoi (argv[1]); | |
6640 | ospf->distance_inter = atoi (argv[2]); | |
6641 | ||
718e3744 | 6642 | return CMD_SUCCESS; |
6643 | } | |
6644 | ||
6645 | DEFUN (ospf_distance_ospf_external_inter_intra, | |
6646 | ospf_distance_ospf_external_inter_intra_cmd, | |
6647 | "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>", | |
6648 | "Define an administrative distance\n" | |
6649 | "OSPF Administrative distance\n" | |
6650 | "External routes\n" | |
6651 | "Distance for external routes\n" | |
6652 | "Inter-area routes\n" | |
6653 | "Distance for inter-area routes\n" | |
6654 | "Intra-area routes\n" | |
6655 | "Distance for intra-area routes\n") | |
6656 | { | |
68980084 | 6657 | struct ospf *ospf = vty->index; |
6658 | ||
6659 | ospf->distance_external = atoi (argv[0]); | |
6660 | ospf->distance_inter = atoi (argv[1]); | |
6661 | ospf->distance_intra = atoi (argv[2]); | |
6662 | ||
718e3744 | 6663 | return CMD_SUCCESS; |
6664 | } | |
6665 | ||
6666 | DEFUN (ospf_distance_source, | |
6667 | ospf_distance_source_cmd, | |
6668 | "distance <1-255> A.B.C.D/M", | |
6669 | "Administrative distance\n" | |
6670 | "Distance value\n" | |
6671 | "IP source prefix\n") | |
6672 | { | |
020709f9 | 6673 | struct ospf *ospf = vty->index; |
6674 | ||
6675 | ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); | |
68980084 | 6676 | |
718e3744 | 6677 | return CMD_SUCCESS; |
6678 | } | |
6679 | ||
6680 | DEFUN (no_ospf_distance_source, | |
6681 | no_ospf_distance_source_cmd, | |
6682 | "no distance <1-255> A.B.C.D/M", | |
6683 | NO_STR | |
6684 | "Administrative distance\n" | |
6685 | "Distance value\n" | |
6686 | "IP source prefix\n") | |
6687 | { | |
020709f9 | 6688 | struct ospf *ospf = vty->index; |
6689 | ||
6690 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); | |
6691 | ||
718e3744 | 6692 | return CMD_SUCCESS; |
6693 | } | |
6694 | ||
6695 | DEFUN (ospf_distance_source_access_list, | |
6696 | ospf_distance_source_access_list_cmd, | |
6697 | "distance <1-255> A.B.C.D/M WORD", | |
6698 | "Administrative distance\n" | |
6699 | "Distance value\n" | |
6700 | "IP source prefix\n" | |
6701 | "Access list name\n") | |
6702 | { | |
020709f9 | 6703 | struct ospf *ospf = vty->index; |
6704 | ||
6705 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); | |
6706 | ||
718e3744 | 6707 | return CMD_SUCCESS; |
6708 | } | |
6709 | ||
6710 | DEFUN (no_ospf_distance_source_access_list, | |
6711 | no_ospf_distance_source_access_list_cmd, | |
6712 | "no distance <1-255> A.B.C.D/M WORD", | |
6713 | NO_STR | |
6714 | "Administrative distance\n" | |
6715 | "Distance value\n" | |
6716 | "IP source prefix\n" | |
6717 | "Access list name\n") | |
6718 | { | |
020709f9 | 6719 | struct ospf *ospf = vty->index; |
6720 | ||
6721 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); | |
6722 | ||
718e3744 | 6723 | return CMD_SUCCESS; |
6724 | } | |
6725 | ||
ba682537 | 6726 | DEFUN (ip_ospf_mtu_ignore, |
6727 | ip_ospf_mtu_ignore_addr_cmd, | |
6728 | "ip ospf mtu-ignore A.B.C.D", | |
6729 | "IP Information\n" | |
6730 | "OSPF interface commands\n" | |
6731 | "Disable mtu mismatch detection\n" | |
6732 | "Address of interface") | |
6733 | { | |
6734 | struct interface *ifp = vty->index; | |
6735 | struct in_addr addr; | |
6736 | int ret; | |
6737 | ||
6738 | struct ospf_if_params *params; | |
6739 | params = IF_DEF_PARAMS (ifp); | |
6740 | ||
6741 | if (argc == 1) | |
6742 | { | |
6743 | ret = inet_aton(argv[0], &addr); | |
6744 | if (!ret) | |
6745 | { | |
6746 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
6747 | VTY_NEWLINE); | |
6748 | return CMD_WARNING; | |
6749 | } | |
6750 | params = ospf_get_if_params (ifp, addr); | |
6751 | ospf_if_update_params (ifp, addr); | |
6752 | } | |
6753 | params->mtu_ignore = 1; | |
6754 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) | |
6755 | SET_IF_PARAM (params, mtu_ignore); | |
6756 | else | |
6757 | { | |
6758 | UNSET_IF_PARAM (params, mtu_ignore); | |
6759 | if (params != IF_DEF_PARAMS (ifp)) | |
6760 | { | |
6761 | ospf_free_if_params (ifp, addr); | |
6762 | ospf_if_update_params (ifp, addr); | |
6763 | } | |
6764 | } | |
6765 | return CMD_SUCCESS; | |
6766 | } | |
6767 | ||
6768 | ALIAS (ip_ospf_mtu_ignore, | |
6769 | ip_ospf_mtu_ignore_cmd, | |
6770 | "ip ospf mtu-ignore", | |
6771 | "IP Information\n" | |
6772 | "OSPF interface commands\n" | |
6773 | "Disable mtu mismatch detection\n") | |
6774 | ||
6775 | ||
6776 | DEFUN (no_ip_ospf_mtu_ignore, | |
6777 | no_ip_ospf_mtu_ignore_addr_cmd, | |
6778 | "no ip ospf mtu-ignore A.B.C.D", | |
6779 | "IP Information\n" | |
6780 | "OSPF interface commands\n" | |
6781 | "Disable mtu mismatch detection\n" | |
6782 | "Address of interface") | |
6783 | { | |
6784 | struct interface *ifp = vty->index; | |
6785 | struct in_addr addr; | |
6786 | int ret; | |
6787 | ||
6788 | struct ospf_if_params *params; | |
6789 | params = IF_DEF_PARAMS (ifp); | |
6790 | ||
6791 | if (argc == 1) | |
6792 | { | |
6793 | ret = inet_aton(argv[0], &addr); | |
6794 | if (!ret) | |
6795 | { | |
6796 | vty_out (vty, "Please specify interface address by A.B.C.D%s", | |
6797 | VTY_NEWLINE); | |
6798 | return CMD_WARNING; | |
6799 | } | |
6800 | params = ospf_get_if_params (ifp, addr); | |
6801 | ospf_if_update_params (ifp, addr); | |
6802 | } | |
6803 | params->mtu_ignore = 0; | |
6804 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) | |
6805 | SET_IF_PARAM (params, mtu_ignore); | |
6806 | else | |
6807 | { | |
6808 | UNSET_IF_PARAM (params, mtu_ignore); | |
6809 | if (params != IF_DEF_PARAMS (ifp)) | |
6810 | { | |
6811 | ospf_free_if_params (ifp, addr); | |
6812 | ospf_if_update_params (ifp, addr); | |
6813 | } | |
6814 | } | |
6815 | return CMD_SUCCESS; | |
6816 | } | |
6817 | ||
6818 | ALIAS (no_ip_ospf_mtu_ignore, | |
6819 | no_ip_ospf_mtu_ignore_cmd, | |
6820 | "no ip ospf mtu-ignore", | |
6821 | "IP Information\n" | |
6822 | "OSPF interface commands\n" | |
6823 | "Disable mtu mismatch detection\n") | |
88d6cf37 | 6824 | \f |
6825 | DEFUN (ospf_max_metric_router_lsa_admin, | |
6826 | ospf_max_metric_router_lsa_admin_cmd, | |
6827 | "max-metric router-lsa administrative", | |
6828 | "OSPF maximum / infinite-distance metric\n" | |
6829 | "Advertise own Router-LSA with infinite distance (stub router)\n" | |
6830 | "Administratively applied, for an indefinite period\n") | |
6831 | { | |
6832 | struct listnode *ln; | |
6833 | struct ospf_area *area; | |
6834 | struct ospf *ospf = vty->index; | |
ba682537 | 6835 | |
88d6cf37 | 6836 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
6837 | { | |
6838 | SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); | |
6839 | ||
6840 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) | |
6841 | ospf_router_lsa_timer_add (area); | |
6842 | } | |
6843 | return CMD_SUCCESS; | |
6844 | } | |
6845 | ||
6846 | DEFUN (no_ospf_max_metric_router_lsa_admin, | |
6847 | no_ospf_max_metric_router_lsa_admin_cmd, | |
6848 | "no max-metric router-lsa administrative", | |
6849 | NO_STR | |
6850 | "OSPF maximum / infinite-distance metric\n" | |
6851 | "Advertise own Router-LSA with infinite distance (stub router)\n" | |
6852 | "Administratively applied, for an indefinite period\n") | |
6853 | { | |
6854 | struct listnode *ln; | |
6855 | struct ospf_area *area; | |
6856 | struct ospf *ospf = vty->index; | |
6857 | ||
6858 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) | |
6859 | { | |
6860 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); | |
6861 | ||
6862 | /* Don't trample on the start-up stub timer */ | |
6863 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED) | |
6864 | && !area->t_stub_router) | |
6865 | { | |
6866 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); | |
6867 | ospf_router_lsa_timer_add (area); | |
6868 | } | |
6869 | } | |
6870 | return CMD_SUCCESS; | |
6871 | } | |
6872 | ||
6873 | DEFUN (ospf_max_metric_router_lsa_startup, | |
6874 | ospf_max_metric_router_lsa_startup_cmd, | |
6875 | "max-metric router-lsa on-startup <5-86400>", | |
6876 | "OSPF maximum / infinite-distance metric\n" | |
6877 | "Advertise own Router-LSA with infinite distance (stub router)\n" | |
6878 | "Automatically advertise stub Router-LSA on startup of OSPF\n" | |
6879 | "Time (seconds) to advertise self as stub-router\n") | |
6880 | { | |
6881 | unsigned int seconds; | |
6882 | struct ospf *ospf = vty->index; | |
6883 | ||
6884 | if (argc != 1) | |
6885 | { | |
6886 | vty_out (vty, "%% Must supply stub-router period"); | |
6887 | return CMD_WARNING; | |
6888 | } | |
6889 | ||
6890 | VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); | |
6891 | ||
6892 | ospf->stub_router_startup_time = seconds; | |
6893 | ||
6894 | return CMD_SUCCESS; | |
6895 | } | |
6896 | ||
6897 | DEFUN (no_ospf_max_metric_router_lsa_startup, | |
6898 | no_ospf_max_metric_router_lsa_startup_cmd, | |
6899 | "no max-metric router-lsa on-startup", | |
6900 | NO_STR | |
6901 | "OSPF maximum / infinite-distance metric\n" | |
6902 | "Advertise own Router-LSA with infinite distance (stub router)\n" | |
6903 | "Automatically advertise stub Router-LSA on startup of OSPF\n") | |
6904 | { | |
6905 | struct listnode *ln; | |
6906 | struct ospf_area *area; | |
6907 | struct ospf *ospf = vty->index; | |
6908 | ||
6909 | ospf->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED; | |
6910 | ||
6911 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) | |
6912 | { | |
6913 | SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED); | |
6914 | OSPF_TIMER_OFF (area->t_stub_router); | |
6915 | ||
6916 | /* Don't trample on admin stub routed */ | |
6917 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) | |
6918 | { | |
6919 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); | |
6920 | ospf_router_lsa_timer_add (area); | |
6921 | } | |
6922 | } | |
6923 | return CMD_SUCCESS; | |
6924 | } | |
6925 | ||
6926 | DEFUN (ospf_max_metric_router_lsa_shutdown, | |
6927 | ospf_max_metric_router_lsa_shutdown_cmd, | |
6928 | "max-metric router-lsa on-shutdown <5-86400>", | |
6929 | "OSPF maximum / infinite-distance metric\n" | |
6930 | "Advertise own Router-LSA with infinite distance (stub router)\n" | |
6931 | "Advertise stub-router prior to full shutdown of OSPF\n" | |
6932 | "Time (seconds) to wait till full shutdown\n") | |
6933 | { | |
6934 | unsigned int seconds; | |
6935 | struct ospf *ospf = vty->index; | |
6936 | ||
6937 | if (argc != 1) | |
6938 | { | |
6939 | vty_out (vty, "%% Must supply stub-router shutdown period"); | |
6940 | return CMD_WARNING; | |
6941 | } | |
6942 | ||
6943 | VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); | |
6944 | ||
6945 | ospf->stub_router_shutdown_time = seconds; | |
6946 | ||
6947 | return CMD_SUCCESS; | |
6948 | } | |
6949 | ||
6950 | DEFUN (no_ospf_max_metric_router_lsa_shutdown, | |
6951 | no_ospf_max_metric_router_lsa_shutdown_cmd, | |
6952 | "no max-metric router-lsa on-shutdown", | |
6953 | NO_STR | |
6954 | "OSPF maximum / infinite-distance metric\n" | |
6955 | "Advertise own Router-LSA with infinite distance (stub router)\n" | |
6956 | "Advertise stub-router prior to full shutdown of OSPF\n") | |
6957 | { | |
6958 | struct ospf *ospf = vty->index; | |
6959 | ||
6960 | ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; | |
6961 | ||
6962 | return CMD_SUCCESS; | |
6963 | } | |
6964 | ||
6965 | static void | |
6966 | config_write_stub_router (struct vty *vty, struct ospf *ospf) | |
6967 | { | |
6968 | struct listnode *ln; | |
6969 | struct ospf_area *area; | |
6970 | ||
6971 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) | |
6972 | vty_out (vty, " max-metric router-lsa on-startup %u%s", | |
6973 | ospf->stub_router_startup_time, VTY_NEWLINE); | |
6974 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) | |
6975 | vty_out (vty, " max-metric router-lsa on-shutdown %u%s", | |
6976 | ospf->stub_router_shutdown_time, VTY_NEWLINE); | |
6977 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) | |
6978 | { | |
6979 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) | |
6980 | { | |
6981 | vty_out (vty, " max-metric router-lsa administrative%s", | |
6982 | VTY_NEWLINE); | |
6983 | break; | |
6984 | } | |
6985 | } | |
6986 | return; | |
6987 | } | |
6988 | \f | |
4dadc291 | 6989 | static void |
718e3744 | 6990 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
6991 | { | |
6992 | struct route_node *rn; | |
6993 | struct ospf_route *or; | |
1eb8ef25 | 6994 | struct listnode *pnode, *pnnode; |
718e3744 | 6995 | struct ospf_path *path; |
6996 | ||
6997 | vty_out (vty, "============ OSPF network routing table ============%s", | |
6998 | VTY_NEWLINE); | |
6999 | ||
7000 | for (rn = route_top (rt); rn; rn = route_next (rn)) | |
7001 | if ((or = rn->info) != NULL) | |
7002 | { | |
7003 | char buf1[19]; | |
7004 | snprintf (buf1, 19, "%s/%d", | |
7005 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); | |
7006 | ||
7007 | switch (or->path_type) | |
7008 | { | |
7009 | case OSPF_PATH_INTER_AREA: | |
7010 | if (or->type == OSPF_DESTINATION_NETWORK) | |
7011 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, | |
7012 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); | |
7013 | else if (or->type == OSPF_DESTINATION_DISCARD) | |
7014 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); | |
7015 | break; | |
7016 | case OSPF_PATH_INTRA_AREA: | |
7017 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, | |
7018 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); | |
7019 | break; | |
7020 | default: | |
7021 | break; | |
7022 | } | |
7023 | ||
7024 | if (or->type == OSPF_DESTINATION_NETWORK) | |
1eb8ef25 | 7025 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
96735eea | 7026 | { |
54bedb55 | 7027 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
96735eea | 7028 | { |
7029 | if (path->nexthop.s_addr == 0) | |
7030 | vty_out (vty, "%24s directly attached to %s%s", | |
7031 | "", path->oi->ifp->name, VTY_NEWLINE); | |
7032 | else | |
7033 | vty_out (vty, "%24s via %s, %s%s", "", | |
7034 | inet_ntoa (path->nexthop), path->oi->ifp->name, | |
7035 | VTY_NEWLINE); | |
7036 | } | |
7037 | } | |
718e3744 | 7038 | } |
7039 | vty_out (vty, "%s", VTY_NEWLINE); | |
7040 | } | |
7041 | ||
4dadc291 | 7042 | static void |
718e3744 | 7043 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
7044 | { | |
7045 | struct route_node *rn; | |
7046 | struct ospf_route *or; | |
1eb8ef25 | 7047 | struct listnode *pnode; |
7048 | struct listnode *node; | |
718e3744 | 7049 | struct ospf_path *path; |
7050 | ||
7051 | vty_out (vty, "============ OSPF router routing table =============%s", | |
7052 | VTY_NEWLINE); | |
7053 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) | |
7054 | if (rn->info) | |
7055 | { | |
7056 | int flag = 0; | |
7057 | ||
7058 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); | |
7059 | ||
1eb8ef25 | 7060 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
7061 | { | |
7062 | if (flag++) | |
7063 | vty_out (vty, "%24s", ""); | |
7064 | ||
7065 | /* Show path. */ | |
7066 | vty_out (vty, "%s [%d] area: %s", | |
7067 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), | |
7068 | or->cost, inet_ntoa (or->u.std.area_id)); | |
7069 | /* Show flags. */ | |
7070 | vty_out (vty, "%s%s%s", | |
7071 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), | |
7072 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), | |
7073 | VTY_NEWLINE); | |
7074 | ||
7075 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) | |
7076 | { | |
54bedb55 | 7077 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
7078 | { | |
7079 | if (path->nexthop.s_addr == 0) | |
7080 | vty_out (vty, "%24s directly attached to %s%s", | |
7081 | "", path->oi->ifp->name, VTY_NEWLINE); | |
7082 | else | |
7083 | vty_out (vty, "%24s via %s, %s%s", "", | |
7084 | inet_ntoa (path->nexthop), | |
7085 | path->oi->ifp->name, VTY_NEWLINE); | |
7086 | } | |
1eb8ef25 | 7087 | } |
7088 | } | |
718e3744 | 7089 | } |
7090 | vty_out (vty, "%s", VTY_NEWLINE); | |
7091 | } | |
7092 | ||
4dadc291 | 7093 | static void |
718e3744 | 7094 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
7095 | { | |
7096 | struct route_node *rn; | |
7097 | struct ospf_route *er; | |
1eb8ef25 | 7098 | struct listnode *pnode, *pnnode; |
718e3744 | 7099 | struct ospf_path *path; |
7100 | ||
7101 | vty_out (vty, "============ OSPF external routing table ===========%s", | |
7102 | VTY_NEWLINE); | |
7103 | for (rn = route_top (rt); rn; rn = route_next (rn)) | |
7104 | if ((er = rn->info) != NULL) | |
7105 | { | |
7106 | char buf1[19]; | |
7107 | snprintf (buf1, 19, "%s/%d", | |
7108 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); | |
7109 | ||
7110 | switch (er->path_type) | |
7111 | { | |
7112 | case OSPF_PATH_TYPE1_EXTERNAL: | |
7113 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, | |
7114 | er->cost, er->u.ext.tag, VTY_NEWLINE); | |
7115 | break; | |
7116 | case OSPF_PATH_TYPE2_EXTERNAL: | |
7117 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, | |
7118 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); | |
7119 | break; | |
7120 | } | |
7121 | ||
1eb8ef25 | 7122 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
718e3744 | 7123 | { |
54bedb55 | 7124 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
718e3744 | 7125 | { |
7126 | if (path->nexthop.s_addr == 0) | |
96735eea | 7127 | vty_out (vty, "%24s directly attached to %s%s", |
7128 | "", path->oi->ifp->name, VTY_NEWLINE); | |
7129 | else | |
7130 | vty_out (vty, "%24s via %s, %s%s", "", | |
7131 | inet_ntoa (path->nexthop), path->oi->ifp->name, | |
7132 | VTY_NEWLINE); | |
718e3744 | 7133 | } |
7134 | } | |
7135 | } | |
7136 | vty_out (vty, "%s", VTY_NEWLINE); | |
7137 | } | |
7138 | ||
718e3744 | 7139 | DEFUN (show_ip_ospf_border_routers, |
7140 | show_ip_ospf_border_routers_cmd, | |
7141 | "show ip ospf border-routers", | |
7142 | SHOW_STR | |
7143 | IP_STR | |
7144 | "show all the ABR's and ASBR's\n" | |
7145 | "for this area\n") | |
7146 | { | |
020709f9 | 7147 | struct ospf *ospf; |
68980084 | 7148 | |
cac3b5c4 | 7149 | if ((ospf = ospf_lookup ()) == NULL) |
718e3744 | 7150 | { |
cac3b5c4 | 7151 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
718e3744 | 7152 | return CMD_SUCCESS; |
7153 | } | |
7154 | ||
68980084 | 7155 | if (ospf->new_table == NULL) |
718e3744 | 7156 | { |
7157 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); | |
7158 | return CMD_SUCCESS; | |
7159 | } | |
7160 | ||
7161 | /* Show Network routes. | |
020709f9 | 7162 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
718e3744 | 7163 | |
7164 | /* Show Router routes. */ | |
68980084 | 7165 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
718e3744 | 7166 | |
7167 | return CMD_SUCCESS; | |
7168 | } | |
718e3744 | 7169 | |
7170 | DEFUN (show_ip_ospf_route, | |
7171 | show_ip_ospf_route_cmd, | |
7172 | "show ip ospf route", | |
7173 | SHOW_STR | |
7174 | IP_STR | |
7175 | "OSPF information\n" | |
7176 | "OSPF routing table\n") | |
7177 | { | |
020709f9 | 7178 | struct ospf *ospf; |
68980084 | 7179 | |
cac3b5c4 | 7180 | if ((ospf = ospf_lookup ()) == NULL) |
718e3744 | 7181 | { |
cac3b5c4 | 7182 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
718e3744 | 7183 | return CMD_SUCCESS; |
7184 | } | |
7185 | ||
68980084 | 7186 | if (ospf->new_table == NULL) |
718e3744 | 7187 | { |
7188 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); | |
7189 | return CMD_SUCCESS; | |
7190 | } | |
7191 | ||
7192 | /* Show Network routes. */ | |
68980084 | 7193 | show_ip_ospf_route_network (vty, ospf->new_table); |
718e3744 | 7194 | |
7195 | /* Show Router routes. */ | |
68980084 | 7196 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
718e3744 | 7197 | |
7198 | /* Show AS External routes. */ | |
68980084 | 7199 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
718e3744 | 7200 | |
7201 | return CMD_SUCCESS; | |
7202 | } | |
7203 | ||
7204 | \f | |
eb1ce605 | 7205 | const char *ospf_abr_type_str[] = |
718e3744 | 7206 | { |
7207 | "unknown", | |
7208 | "standard", | |
7209 | "ibm", | |
7210 | "cisco", | |
7211 | "shortcut" | |
7212 | }; | |
7213 | ||
eb1ce605 | 7214 | const char *ospf_shortcut_mode_str[] = |
718e3744 | 7215 | { |
7216 | "default", | |
7217 | "enable", | |
7218 | "disable" | |
7219 | }; | |
7220 | ||
7221 | ||
4dadc291 | 7222 | static void |
718e3744 | 7223 | area_id2str (char *buf, int length, struct ospf_area *area) |
7224 | { | |
7225 | memset (buf, 0, length); | |
7226 | ||
7227 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) | |
7228 | strncpy (buf, inet_ntoa (area->area_id), length); | |
7229 | else | |
7230 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); | |
7231 | } | |
7232 | ||
7233 | \f | |
eb1ce605 | 7234 | const char *ospf_int_type_str[] = |
718e3744 | 7235 | { |
7236 | "unknown", /* should never be used. */ | |
7237 | "point-to-point", | |
7238 | "broadcast", | |
7239 | "non-broadcast", | |
7240 | "point-to-multipoint", | |
7241 | "virtual-link", /* should never be used. */ | |
7242 | "loopback" | |
7243 | }; | |
7244 | ||
7245 | /* Configuration write function for ospfd. */ | |
4dadc291 | 7246 | static int |
718e3744 | 7247 | config_write_interface (struct vty *vty) |
7248 | { | |
52dc7ee6 | 7249 | struct listnode *n1, *n2; |
718e3744 | 7250 | struct interface *ifp; |
7251 | struct crypt_key *ck; | |
7252 | int write = 0; | |
7253 | struct route_node *rn = NULL; | |
7254 | struct ospf_if_params *params; | |
7255 | ||
1eb8ef25 | 7256 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
718e3744 | 7257 | { |
718e3744 | 7258 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
7259 | continue; | |
7260 | ||
7261 | vty_out (vty, "!%s", VTY_NEWLINE); | |
7262 | vty_out (vty, "interface %s%s", ifp->name, | |
7263 | VTY_NEWLINE); | |
7264 | if (ifp->desc) | |
7265 | vty_out (vty, " description %s%s", ifp->desc, | |
7266 | VTY_NEWLINE); | |
7267 | ||
7268 | write++; | |
7269 | ||
7270 | params = IF_DEF_PARAMS (ifp); | |
7271 | ||
7272 | do { | |
7273 | /* Interface Network print. */ | |
7274 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && | |
718e3744 | 7275 | params->type != OSPF_IFTYPE_LOOPBACK) |
7276 | { | |
bc18d616 | 7277 | if (params->type != ospf_default_iftype(ifp)) |
7b90143f | 7278 | { |
7279 | vty_out (vty, " ip ospf network %s", | |
7280 | ospf_int_type_str[params->type]); | |
7281 | if (params != IF_DEF_PARAMS (ifp)) | |
7282 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7283 | vty_out (vty, "%s", VTY_NEWLINE); | |
7284 | } | |
718e3744 | 7285 | } |
7286 | ||
7287 | /* OSPF interface authentication print */ | |
7288 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && | |
7289 | params->auth_type != OSPF_AUTH_NOTSET) | |
7290 | { | |
eb1ce605 | 7291 | const char *auth_str; |
718e3744 | 7292 | |
7293 | /* Translation tables are not that much help here due to syntax | |
7294 | of the simple option */ | |
7295 | switch (params->auth_type) | |
7296 | { | |
7297 | ||
7298 | case OSPF_AUTH_NULL: | |
7299 | auth_str = " null"; | |
7300 | break; | |
7301 | ||
7302 | case OSPF_AUTH_SIMPLE: | |
7303 | auth_str = ""; | |
7304 | break; | |
7305 | ||
7306 | case OSPF_AUTH_CRYPTOGRAPHIC: | |
7307 | auth_str = " message-digest"; | |
7308 | break; | |
7309 | ||
7310 | default: | |
7311 | auth_str = ""; | |
7312 | break; | |
7313 | } | |
7314 | ||
7315 | vty_out (vty, " ip ospf authentication%s", auth_str); | |
7316 | if (params != IF_DEF_PARAMS (ifp)) | |
7317 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7318 | vty_out (vty, "%s", VTY_NEWLINE); | |
7319 | } | |
7320 | ||
7321 | /* Simple Authentication Password print. */ | |
7322 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && | |
7323 | params->auth_simple[0] != '\0') | |
7324 | { | |
7325 | vty_out (vty, " ip ospf authentication-key %s", | |
7326 | params->auth_simple); | |
7327 | if (params != IF_DEF_PARAMS (ifp)) | |
7328 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7329 | vty_out (vty, "%s", VTY_NEWLINE); | |
7330 | } | |
7331 | ||
7332 | /* Cryptographic Authentication Key print. */ | |
1eb8ef25 | 7333 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
718e3744 | 7334 | { |
718e3744 | 7335 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
7336 | ck->key_id, ck->auth_key); | |
7337 | if (params != IF_DEF_PARAMS (ifp)) | |
7338 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7339 | vty_out (vty, "%s", VTY_NEWLINE); | |
7340 | } | |
7341 | ||
7342 | /* Interface Output Cost print. */ | |
7343 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) | |
7344 | { | |
7345 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); | |
7346 | if (params != IF_DEF_PARAMS (ifp)) | |
7347 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7348 | vty_out (vty, "%s", VTY_NEWLINE); | |
7349 | } | |
7350 | ||
7351 | /* Hello Interval print. */ | |
7352 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && | |
7353 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) | |
7354 | { | |
7355 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); | |
7356 | if (params != IF_DEF_PARAMS (ifp)) | |
7357 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7358 | vty_out (vty, "%s", VTY_NEWLINE); | |
7359 | } | |
7360 | ||
7361 | ||
7362 | /* Router Dead Interval print. */ | |
7363 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && | |
7364 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) | |
7365 | { | |
f9ad937f | 7366 | vty_out (vty, " ip ospf dead-interval "); |
7367 | ||
7368 | /* fast hello ? */ | |
7369 | if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello)) | |
7370 | vty_out (vty, "minimal hello-multiplier %d", | |
7371 | params->fast_hello); | |
7372 | else | |
7373 | vty_out (vty, "%u", params->v_wait); | |
7374 | ||
718e3744 | 7375 | if (params != IF_DEF_PARAMS (ifp)) |
7376 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7377 | vty_out (vty, "%s", VTY_NEWLINE); | |
7378 | } | |
7379 | ||
7380 | /* Router Priority print. */ | |
7381 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && | |
7382 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) | |
7383 | { | |
7384 | vty_out (vty, " ip ospf priority %u", params->priority); | |
7385 | if (params != IF_DEF_PARAMS (ifp)) | |
7386 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7387 | vty_out (vty, "%s", VTY_NEWLINE); | |
7388 | } | |
7389 | ||
7390 | /* Retransmit Interval print. */ | |
7391 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && | |
7392 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) | |
7393 | { | |
7394 | vty_out (vty, " ip ospf retransmit-interval %u", | |
7395 | params->retransmit_interval); | |
7396 | if (params != IF_DEF_PARAMS (ifp)) | |
7397 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7398 | vty_out (vty, "%s", VTY_NEWLINE); | |
7399 | } | |
7400 | ||
7401 | /* Transmit Delay print. */ | |
7402 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && | |
7403 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) | |
7404 | { | |
7405 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); | |
7406 | if (params != IF_DEF_PARAMS (ifp)) | |
7407 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7408 | vty_out (vty, "%s", VTY_NEWLINE); | |
7409 | } | |
7410 | ||
ba682537 | 7411 | /* MTU ignore print. */ |
7412 | if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) && | |
7413 | params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) | |
7414 | { | |
7415 | if (params->mtu_ignore == 0) | |
7416 | vty_out (vty, " no ip ospf mtu-ignore"); | |
7417 | else | |
7418 | vty_out (vty, " ip ospf mtu-ignore"); | |
7419 | if (params != IF_DEF_PARAMS (ifp)) | |
7420 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); | |
7421 | vty_out (vty, "%s", VTY_NEWLINE); | |
7422 | } | |
7423 | ||
7424 | ||
718e3744 | 7425 | while (1) |
7426 | { | |
7427 | if (rn == NULL) | |
7428 | rn = route_top (IF_OIFS_PARAMS (ifp)); | |
7429 | else | |
7430 | rn = route_next (rn); | |
7431 | ||
7432 | if (rn == NULL) | |
7433 | break; | |
7434 | params = rn->info; | |
7435 | if (params != NULL) | |
7436 | break; | |
7437 | } | |
7438 | } while (rn); | |
7439 | ||
7440 | #ifdef HAVE_OPAQUE_LSA | |
7441 | ospf_opaque_config_write_if (vty, ifp); | |
7442 | #endif /* HAVE_OPAQUE_LSA */ | |
7443 | } | |
7444 | ||
7445 | return write; | |
7446 | } | |
7447 | ||
4dadc291 | 7448 | static int |
68980084 | 7449 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
718e3744 | 7450 | { |
7451 | struct route_node *rn; | |
7452 | u_char buf[INET_ADDRSTRLEN]; | |
7453 | ||
7454 | /* `network area' print. */ | |
68980084 | 7455 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
718e3744 | 7456 | if (rn->info) |
7457 | { | |
7458 | struct ospf_network *n = rn->info; | |
7459 | ||
7460 | memset (buf, 0, INET_ADDRSTRLEN); | |
7461 | ||
7462 | /* Create Area ID string by specified Area ID format. */ | |
7463 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) | |
c9e52be3 | 7464 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
718e3744 | 7465 | else |
c9e52be3 | 7466 | sprintf ((char *) buf, "%lu", |
718e3744 | 7467 | (unsigned long int) ntohl (n->area_id.s_addr)); |
7468 | ||
7469 | /* Network print. */ | |
7470 | vty_out (vty, " network %s/%d area %s%s", | |
7471 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, | |
7472 | buf, VTY_NEWLINE); | |
7473 | } | |
7474 | ||
7475 | return 0; | |
7476 | } | |
7477 | ||
4dadc291 | 7478 | static int |
68980084 | 7479 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
718e3744 | 7480 | { |
52dc7ee6 | 7481 | struct listnode *node; |
1eb8ef25 | 7482 | struct ospf_area *area; |
718e3744 | 7483 | u_char buf[INET_ADDRSTRLEN]; |
7484 | ||
7485 | /* Area configuration print. */ | |
1eb8ef25 | 7486 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
718e3744 | 7487 | { |
718e3744 | 7488 | struct route_node *rn1; |
7489 | ||
c9e52be3 | 7490 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
718e3744 | 7491 | |
7492 | if (area->auth_type != OSPF_AUTH_NULL) | |
7493 | { | |
7494 | if (area->auth_type == OSPF_AUTH_SIMPLE) | |
7495 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); | |
7496 | else | |
7497 | vty_out (vty, " area %s authentication message-digest%s", | |
7498 | buf, VTY_NEWLINE); | |
7499 | } | |
7500 | ||
7501 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) | |
7502 | vty_out (vty, " area %s shortcut %s%s", buf, | |
7503 | ospf_shortcut_mode_str[area->shortcut_configured], | |
7504 | VTY_NEWLINE); | |
7505 | ||
7506 | if ((area->external_routing == OSPF_AREA_STUB) | |
718e3744 | 7507 | || (area->external_routing == OSPF_AREA_NSSA) |
718e3744 | 7508 | ) |
7509 | { | |
b0a053be | 7510 | if (area->external_routing == OSPF_AREA_STUB) |
7511 | vty_out (vty, " area %s stub", buf); | |
b0a053be | 7512 | else if (area->external_routing == OSPF_AREA_NSSA) |
7513 | { | |
7514 | vty_out (vty, " area %s nssa", buf); | |
7515 | switch (area->NSSATranslatorRole) | |
7516 | { | |
7517 | case OSPF_NSSA_ROLE_NEVER: | |
7518 | vty_out (vty, " translate-never"); | |
7519 | break; | |
7520 | case OSPF_NSSA_ROLE_ALWAYS: | |
7521 | vty_out (vty, " translate-always"); | |
7522 | break; | |
7523 | case OSPF_NSSA_ROLE_CANDIDATE: | |
7524 | default: | |
7525 | vty_out (vty, " translate-candidate"); | |
7526 | } | |
7527 | } | |
718e3744 | 7528 | |
7529 | if (area->no_summary) | |
7530 | vty_out (vty, " no-summary"); | |
7531 | ||
7532 | vty_out (vty, "%s", VTY_NEWLINE); | |
7533 | ||
7534 | if (area->default_cost != 1) | |
7535 | vty_out (vty, " area %s default-cost %d%s", buf, | |
7536 | area->default_cost, VTY_NEWLINE); | |
7537 | } | |
7538 | ||
7539 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) | |
7540 | if (rn1->info) | |
7541 | { | |
7542 | struct ospf_area_range *range = rn1->info; | |
7543 | ||
7544 | vty_out (vty, " area %s range %s/%d", buf, | |
7545 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); | |
7546 | ||
6c835671 | 7547 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
718e3744 | 7548 | vty_out (vty, " cost %d", range->cost_config); |
7549 | ||
7550 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) | |
7551 | vty_out (vty, " not-advertise"); | |
7552 | ||
7553 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) | |
7554 | vty_out (vty, " substitute %s/%d", | |
7555 | inet_ntoa (range->subst_addr), range->subst_masklen); | |
7556 | ||
7557 | vty_out (vty, "%s", VTY_NEWLINE); | |
7558 | } | |
7559 | ||
7560 | if (EXPORT_NAME (area)) | |
7561 | vty_out (vty, " area %s export-list %s%s", buf, | |
7562 | EXPORT_NAME (area), VTY_NEWLINE); | |
7563 | ||
7564 | if (IMPORT_NAME (area)) | |
7565 | vty_out (vty, " area %s import-list %s%s", buf, | |
7566 | IMPORT_NAME (area), VTY_NEWLINE); | |
7567 | ||
7568 | if (PREFIX_NAME_IN (area)) | |
7569 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, | |
7570 | PREFIX_NAME_IN (area), VTY_NEWLINE); | |
7571 | ||
7572 | if (PREFIX_NAME_OUT (area)) | |
7573 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, | |
7574 | PREFIX_NAME_OUT (area), VTY_NEWLINE); | |
7575 | } | |
7576 | ||
7577 | return 0; | |
7578 | } | |
7579 | ||
4dadc291 | 7580 | static int |
68980084 | 7581 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
718e3744 | 7582 | { |
7583 | struct ospf_nbr_nbma *nbr_nbma; | |
7584 | struct route_node *rn; | |
7585 | ||
7586 | /* Static Neighbor configuration print. */ | |
68980084 | 7587 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
718e3744 | 7588 | if ((nbr_nbma = rn->info)) |
7589 | { | |
7590 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); | |
7591 | ||
7592 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) | |
7593 | vty_out (vty, " priority %d", nbr_nbma->priority); | |
7594 | ||
7595 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) | |
7596 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); | |
7597 | ||
7598 | vty_out (vty, "%s", VTY_NEWLINE); | |
7599 | } | |
7600 | ||
7601 | return 0; | |
7602 | } | |
7603 | ||
4dadc291 | 7604 | static int |
68980084 | 7605 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
718e3744 | 7606 | { |
52dc7ee6 | 7607 | struct listnode *node; |
1eb8ef25 | 7608 | struct ospf_vl_data *vl_data; |
718e3744 | 7609 | u_char buf[INET_ADDRSTRLEN]; |
7610 | ||
7611 | /* Virtual-Link print */ | |
1eb8ef25 | 7612 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
718e3744 | 7613 | { |
52dc7ee6 | 7614 | struct listnode *n2; |
718e3744 | 7615 | struct crypt_key *ck; |
718e3744 | 7616 | struct ospf_interface *oi; |
7617 | ||
7618 | if (vl_data != NULL) | |
7619 | { | |
7620 | memset (buf, 0, INET_ADDRSTRLEN); | |
7621 | ||
7622 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) | |
c9e52be3 | 7623 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
718e3744 | 7624 | else |
c9e52be3 | 7625 | sprintf ((char *) buf, "%lu", |
718e3744 | 7626 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
7627 | oi = vl_data->vl_oi; | |
7628 | ||
7629 | /* timers */ | |
7630 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || | |
7631 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || | |
7632 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || | |
7633 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) | |
7634 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", | |
7635 | buf, | |
7636 | inet_ntoa (vl_data->vl_peer), | |
7637 | OSPF_IF_PARAM (oi, v_hello), | |
7638 | OSPF_IF_PARAM (oi, retransmit_interval), | |
7639 | OSPF_IF_PARAM (oi, transmit_delay), | |
7640 | OSPF_IF_PARAM (oi, v_wait), | |
7641 | VTY_NEWLINE); | |
7642 | else | |
7643 | vty_out (vty, " area %s virtual-link %s%s", buf, | |
7644 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); | |
7645 | /* Auth key */ | |
7646 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') | |
7647 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", | |
7648 | buf, | |
7649 | inet_ntoa (vl_data->vl_peer), | |
7650 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, | |
7651 | VTY_NEWLINE); | |
7652 | /* md5 keys */ | |
1eb8ef25 | 7653 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
7654 | n2, ck)) | |
7655 | vty_out (vty, " area %s virtual-link %s" | |
7656 | " message-digest-key %d md5 %s%s", | |
7657 | buf, | |
7658 | inet_ntoa (vl_data->vl_peer), | |
7659 | ck->key_id, ck->auth_key, VTY_NEWLINE); | |
718e3744 | 7660 | |
7661 | } | |
7662 | } | |
7663 | ||
7664 | return 0; | |
7665 | } | |
7666 | ||
7667 | \f | |
4dadc291 | 7668 | static int |
68980084 | 7669 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
718e3744 | 7670 | { |
7671 | int type; | |
7672 | ||
7673 | /* redistribute print. */ | |
7674 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) | |
7675 | if (type != zclient->redist_default && zclient->redist[type]) | |
7676 | { | |
f52d13cb | 7677 | vty_out (vty, " redistribute %s", zebra_route_string(type)); |
68980084 | 7678 | if (ospf->dmetric[type].value >= 0) |
020709f9 | 7679 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
718e3744 | 7680 | |
68980084 | 7681 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
718e3744 | 7682 | vty_out (vty, " metric-type 1"); |
7683 | ||
020709f9 | 7684 | if (ROUTEMAP_NAME (ospf, type)) |
7685 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); | |
718e3744 | 7686 | |
7687 | vty_out (vty, "%s", VTY_NEWLINE); | |
7688 | } | |
7689 | ||
7690 | return 0; | |
7691 | } | |
7692 | ||
4dadc291 | 7693 | static int |
68980084 | 7694 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
718e3744 | 7695 | { |
68980084 | 7696 | if (ospf->default_metric != -1) |
7697 | vty_out (vty, " default-metric %d%s", ospf->default_metric, | |
718e3744 | 7698 | VTY_NEWLINE); |
7699 | return 0; | |
7700 | } | |
7701 | ||
4dadc291 | 7702 | static int |
68980084 | 7703 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
718e3744 | 7704 | { |
7705 | int type; | |
7706 | ||
68980084 | 7707 | if (ospf) |
718e3744 | 7708 | { |
7709 | /* distribute-list print. */ | |
7710 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) | |
68980084 | 7711 | if (ospf->dlist[type].name) |
718e3744 | 7712 | vty_out (vty, " distribute-list %s out %s%s", |
68980084 | 7713 | ospf->dlist[type].name, |
f52d13cb | 7714 | zebra_route_string(type), VTY_NEWLINE); |
718e3744 | 7715 | |
7716 | /* default-information print. */ | |
68980084 | 7717 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
718e3744 | 7718 | { |
c42c177d | 7719 | vty_out (vty, " default-information originate"); |
7720 | if (ospf->default_originate == DEFAULT_ORIGINATE_ALWAYS) | |
7721 | vty_out (vty, " always"); | |
718e3744 | 7722 | |
68980084 | 7723 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
718e3744 | 7724 | vty_out (vty, " metric %d", |
68980084 | 7725 | ospf->dmetric[DEFAULT_ROUTE].value); |
7726 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) | |
718e3744 | 7727 | vty_out (vty, " metric-type 1"); |
7728 | ||
020709f9 | 7729 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
7730 | vty_out (vty, " route-map %s", | |
7731 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); | |
718e3744 | 7732 | |
7733 | vty_out (vty, "%s", VTY_NEWLINE); | |
7734 | } | |
7735 | ||
7736 | } | |
7737 | ||
7738 | return 0; | |
7739 | } | |
7740 | ||
4dadc291 | 7741 | static int |
68980084 | 7742 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
718e3744 | 7743 | { |
7744 | struct route_node *rn; | |
7745 | struct ospf_distance *odistance; | |
7746 | ||
68980084 | 7747 | if (ospf->distance_all) |
7748 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); | |
718e3744 | 7749 | |
68980084 | 7750 | if (ospf->distance_intra |
7751 | || ospf->distance_inter | |
7752 | || ospf->distance_external) | |
718e3744 | 7753 | { |
7754 | vty_out (vty, " distance ospf"); | |
7755 | ||
68980084 | 7756 | if (ospf->distance_intra) |
7757 | vty_out (vty, " intra-area %d", ospf->distance_intra); | |
7758 | if (ospf->distance_inter) | |
7759 | vty_out (vty, " inter-area %d", ospf->distance_inter); | |
7760 | if (ospf->distance_external) | |
7761 | vty_out (vty, " external %d", ospf->distance_external); | |
718e3744 | 7762 | |
7763 | vty_out (vty, "%s", VTY_NEWLINE); | |
7764 | } | |
7765 | ||
68980084 | 7766 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
718e3744 | 7767 | if ((odistance = rn->info) != NULL) |
7768 | { | |
7769 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, | |
7770 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, | |
7771 | odistance->access_list ? odistance->access_list : "", | |
7772 | VTY_NEWLINE); | |
7773 | } | |
7774 | return 0; | |
7775 | } | |
7776 | ||
7777 | /* OSPF configuration write function. */ | |
4dadc291 | 7778 | static int |
718e3744 | 7779 | ospf_config_write (struct vty *vty) |
7780 | { | |
020709f9 | 7781 | struct ospf *ospf; |
1eb8ef25 | 7782 | struct interface *ifp; |
7783 | struct ospf_interface *oi; | |
52dc7ee6 | 7784 | struct listnode *node; |
718e3744 | 7785 | int write = 0; |
7786 | ||
020709f9 | 7787 | ospf = ospf_lookup (); |
68980084 | 7788 | if (ospf != NULL) |
718e3744 | 7789 | { |
7790 | /* `router ospf' print. */ | |
7791 | vty_out (vty, "router ospf%s", VTY_NEWLINE); | |
7792 | ||
7793 | write++; | |
7794 | ||
68980084 | 7795 | if (!ospf->networks) |
718e3744 | 7796 | return write; |
7797 | ||
7798 | /* Router ID print. */ | |
68980084 | 7799 | if (ospf->router_id_static.s_addr != 0) |
718e3744 | 7800 | vty_out (vty, " ospf router-id %s%s", |
68980084 | 7801 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
718e3744 | 7802 | |
7803 | /* ABR type print. */ | |
d57834f6 | 7804 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
718e3744 | 7805 | vty_out (vty, " ospf abr-type %s%s", |
68980084 | 7806 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
718e3744 | 7807 | |
7808 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ | |
68980084 | 7809 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
718e3744 | 7810 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
7811 | ||
7812 | /* auto-cost reference-bandwidth configuration. */ | |
68980084 | 7813 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
f9ad937f | 7814 | { |
7815 | vty_out (vty, "! Important: ensure reference bandwidth " | |
7816 | "is consistent across all routers%s", VTY_NEWLINE); | |
7817 | vty_out (vty, " auto-cost reference-bandwidth %d%s", | |
7818 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); | |
7819 | } | |
718e3744 | 7820 | |
7821 | /* SPF timers print. */ | |
68980084 | 7822 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
ea4ffc90 | 7823 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT || |
7824 | ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT) | |
7825 | vty_out (vty, " timers throttle spf %d %d %d%s", | |
88d6cf37 | 7826 | ospf->spf_delay, ospf->spf_holdtime, |
ea4ffc90 | 7827 | ospf->spf_max_holdtime, VTY_NEWLINE); |
88d6cf37 | 7828 | |
7829 | /* Max-metric router-lsa print */ | |
7830 | config_write_stub_router (vty, ospf); | |
7831 | ||
718e3744 | 7832 | /* SPF refresh parameters print. */ |
68980084 | 7833 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
718e3744 | 7834 | vty_out (vty, " refresh timer %d%s", |
68980084 | 7835 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
718e3744 | 7836 | |
7837 | /* Redistribute information print. */ | |
68980084 | 7838 | config_write_ospf_redistribute (vty, ospf); |
718e3744 | 7839 | |
7840 | /* passive-interface print. */ | |
1eb8ef25 | 7841 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
7842 | if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE) | |
7843 | vty_out (vty, " passive-interface %s%s", | |
7844 | ifp->name, VTY_NEWLINE); | |
7845 | ||
7846 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) | |
7847 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) && | |
7848 | oi->params->passive_interface == OSPF_IF_PASSIVE) | |
7849 | vty_out (vty, " passive-interface %s %s%s", | |
7850 | oi->ifp->name, | |
7851 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); | |
718e3744 | 7852 | |
7853 | /* Network area print. */ | |
68980084 | 7854 | config_write_network_area (vty, ospf); |
718e3744 | 7855 | |
7856 | /* Area config print. */ | |
68980084 | 7857 | config_write_ospf_area (vty, ospf); |
718e3744 | 7858 | |
7859 | /* static neighbor print. */ | |
68980084 | 7860 | config_write_ospf_nbr_nbma (vty, ospf); |
718e3744 | 7861 | |
7862 | /* Virtual-Link print. */ | |
68980084 | 7863 | config_write_virtual_link (vty, ospf); |
718e3744 | 7864 | |
7865 | /* Default metric configuration. */ | |
68980084 | 7866 | config_write_ospf_default_metric (vty, ospf); |
718e3744 | 7867 | |
7868 | /* Distribute-list and default-information print. */ | |
68980084 | 7869 | config_write_ospf_distribute (vty, ospf); |
718e3744 | 7870 | |
7871 | /* Distance configuration. */ | |
68980084 | 7872 | config_write_ospf_distance (vty, ospf); |
718e3744 | 7873 | |
7874 | #ifdef HAVE_OPAQUE_LSA | |
68980084 | 7875 | ospf_opaque_config_write_router (vty, ospf); |
718e3744 | 7876 | #endif /* HAVE_OPAQUE_LSA */ |
7877 | } | |
7878 | ||
7879 | return write; | |
7880 | } | |
7881 | ||
7882 | void | |
4dadc291 | 7883 | ospf_vty_show_init (void) |
718e3744 | 7884 | { |
7885 | /* "show ip ospf" commands. */ | |
7886 | install_element (VIEW_NODE, &show_ip_ospf_cmd); | |
7887 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); | |
7888 | ||
7889 | /* "show ip ospf database" commands. */ | |
7890 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); | |
7891 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); | |
7892 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); | |
7893 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); | |
7894 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); | |
7895 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); | |
7896 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); | |
7897 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); | |
7898 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); | |
7899 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); | |
7900 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); | |
7901 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); | |
7902 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); | |
7903 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); | |
7904 | ||
7905 | /* "show ip ospf interface" commands. */ | |
7906 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); | |
7907 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); | |
7908 | ||
7909 | /* "show ip ospf neighbor" commands. */ | |
7910 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); | |
7911 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); | |
7912 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); | |
7913 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); | |
7914 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); | |
7915 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); | |
7916 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); | |
7917 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); | |
7918 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); | |
7919 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); | |
7920 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); | |
7921 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); | |
7922 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); | |
7923 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); | |
7924 | ||
7925 | /* "show ip ospf route" commands. */ | |
7926 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); | |
7927 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); | |
718e3744 | 7928 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
7929 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); | |
718e3744 | 7930 | } |
7931 | ||
7932 | \f | |
7933 | /* ospfd's interface node. */ | |
7934 | struct cmd_node interface_node = | |
7935 | { | |
7936 | INTERFACE_NODE, | |
7937 | "%s(config-if)# ", | |
7938 | 1 | |
7939 | }; | |
7940 | ||
7941 | /* Initialization of OSPF interface. */ | |
4dadc291 | 7942 | static void |
7943 | ospf_vty_if_init (void) | |
718e3744 | 7944 | { |
7945 | /* Install interface node. */ | |
7946 | install_node (&interface_node, config_write_interface); | |
7947 | ||
7948 | install_element (CONFIG_NODE, &interface_cmd); | |
32d2463c | 7949 | install_element (CONFIG_NODE, &no_interface_cmd); |
718e3744 | 7950 | install_default (INTERFACE_NODE); |
7951 | ||
7952 | /* "description" commands. */ | |
7953 | install_element (INTERFACE_NODE, &interface_desc_cmd); | |
7954 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); | |
7955 | ||
7956 | /* "ip ospf authentication" commands. */ | |
7957 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); | |
7958 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); | |
7959 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); | |
7960 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); | |
7961 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); | |
7962 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); | |
7963 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); | |
7964 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); | |
7965 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); | |
7966 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); | |
7967 | ||
7968 | /* "ip ospf message-digest-key" commands. */ | |
7969 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); | |
7970 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); | |
7971 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); | |
7972 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); | |
7973 | ||
7974 | /* "ip ospf cost" commands. */ | |
7975 | install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd); | |
7976 | install_element (INTERFACE_NODE, &ip_ospf_cost_cmd); | |
7977 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd); | |
7978 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); | |
7979 | ||
ba682537 | 7980 | /* "ip ospf mtu-ignore" commands. */ |
7981 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); | |
7982 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); | |
7983 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); | |
7984 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); | |
7985 | ||
718e3744 | 7986 | /* "ip ospf dead-interval" commands. */ |
7987 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); | |
7988 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); | |
f9ad937f | 7989 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); |
7990 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); | |
718e3744 | 7991 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
7992 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); | |
f9ad937f | 7993 | |
718e3744 | 7994 | /* "ip ospf hello-interval" commands. */ |
7995 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); | |
7996 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); | |
7997 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); | |
7998 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); | |
7999 | ||
8000 | /* "ip ospf network" commands. */ | |
8001 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); | |
8002 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); | |
8003 | ||
8004 | /* "ip ospf priority" commands. */ | |
8005 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); | |
8006 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); | |
8007 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); | |
8008 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); | |
8009 | ||
8010 | /* "ip ospf retransmit-interval" commands. */ | |
8011 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); | |
8012 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); | |
8013 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); | |
8014 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); | |
8015 | ||
8016 | /* "ip ospf transmit-delay" commands. */ | |
8017 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); | |
8018 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); | |
8019 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); | |
8020 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); | |
8021 | ||
8022 | /* These commands are compatibitliy for previous version. */ | |
8023 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); | |
8024 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); | |
8025 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); | |
8026 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); | |
8027 | install_element (INTERFACE_NODE, &ospf_cost_cmd); | |
8028 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); | |
8029 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); | |
8030 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); | |
8031 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); | |
8032 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); | |
8033 | install_element (INTERFACE_NODE, &ospf_network_cmd); | |
8034 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); | |
8035 | install_element (INTERFACE_NODE, &ospf_priority_cmd); | |
8036 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); | |
8037 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); | |
8038 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); | |
8039 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); | |
8040 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); | |
8041 | } | |
8042 | ||
8043 | /* Zebra node structure. */ | |
8044 | struct cmd_node zebra_node = | |
8045 | { | |
8046 | ZEBRA_NODE, | |
8047 | "%s(config-router)#", | |
8048 | }; | |
8049 | ||
4dadc291 | 8050 | static void |
8051 | ospf_vty_zebra_init (void) | |
718e3744 | 8052 | { |
8053 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); | |
8054 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); | |
8055 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); | |
8056 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); | |
8057 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); | |
8058 | install_element (OSPF_NODE, | |
8059 | &ospf_redistribute_source_metric_type_routemap_cmd); | |
8060 | install_element (OSPF_NODE, | |
8061 | &ospf_redistribute_source_type_metric_routemap_cmd); | |
8062 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); | |
8063 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); | |
8064 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); | |
8065 | ||
8066 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); | |
8067 | ||
8068 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); | |
8069 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); | |
8070 | ||
8071 | install_element (OSPF_NODE, | |
8072 | &ospf_default_information_originate_metric_type_cmd); | |
8073 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); | |
8074 | install_element (OSPF_NODE, | |
8075 | &ospf_default_information_originate_type_metric_cmd); | |
8076 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); | |
8077 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); | |
8078 | install_element (OSPF_NODE, | |
8079 | &ospf_default_information_originate_always_metric_type_cmd); | |
8080 | install_element (OSPF_NODE, | |
8081 | &ospf_default_information_originate_always_metric_cmd); | |
8082 | install_element (OSPF_NODE, | |
8083 | &ospf_default_information_originate_always_cmd); | |
8084 | install_element (OSPF_NODE, | |
8085 | &ospf_default_information_originate_always_type_metric_cmd); | |
8086 | install_element (OSPF_NODE, | |
8087 | &ospf_default_information_originate_always_type_cmd); | |
8088 | ||
8089 | install_element (OSPF_NODE, | |
8090 | &ospf_default_information_originate_metric_type_routemap_cmd); | |
8091 | install_element (OSPF_NODE, | |
8092 | &ospf_default_information_originate_metric_routemap_cmd); | |
8093 | install_element (OSPF_NODE, | |
8094 | &ospf_default_information_originate_routemap_cmd); | |
8095 | install_element (OSPF_NODE, | |
8096 | &ospf_default_information_originate_type_metric_routemap_cmd); | |
8097 | install_element (OSPF_NODE, | |
8098 | &ospf_default_information_originate_type_routemap_cmd); | |
8099 | install_element (OSPF_NODE, | |
8100 | &ospf_default_information_originate_always_metric_type_routemap_cmd); | |
8101 | install_element (OSPF_NODE, | |
8102 | &ospf_default_information_originate_always_metric_routemap_cmd); | |
8103 | install_element (OSPF_NODE, | |
8104 | &ospf_default_information_originate_always_routemap_cmd); | |
8105 | install_element (OSPF_NODE, | |
8106 | &ospf_default_information_originate_always_type_metric_routemap_cmd); | |
8107 | install_element (OSPF_NODE, | |
8108 | &ospf_default_information_originate_always_type_routemap_cmd); | |
8109 | ||
8110 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); | |
8111 | ||
8112 | install_element (OSPF_NODE, &ospf_default_metric_cmd); | |
8113 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); | |
8114 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); | |
8115 | ||
8116 | install_element (OSPF_NODE, &ospf_distance_cmd); | |
8117 | install_element (OSPF_NODE, &no_ospf_distance_cmd); | |
8118 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); | |
8119 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); | |
8120 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); | |
8121 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); | |
8122 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); | |
8123 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); | |
8124 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); | |
8125 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); | |
8126 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); | |
8127 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); | |
8128 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); | |
8129 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); | |
8130 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); | |
8131 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); | |
8132 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); | |
8133 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); | |
8134 | #if 0 | |
8135 | install_element (OSPF_NODE, &ospf_distance_source_cmd); | |
8136 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); | |
8137 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); | |
8138 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); | |
8139 | #endif /* 0 */ | |
8140 | } | |
8141 | ||
8142 | struct cmd_node ospf_node = | |
8143 | { | |
8144 | OSPF_NODE, | |
8145 | "%s(config-router)# ", | |
8146 | 1 | |
8147 | }; | |
8148 | ||
8149 | \f | |
8150 | /* Install OSPF related vty commands. */ | |
8151 | void | |
4dadc291 | 8152 | ospf_vty_init (void) |
718e3744 | 8153 | { |
8154 | /* Install ospf top node. */ | |
8155 | install_node (&ospf_node, ospf_config_write); | |
8156 | ||
8157 | /* "router ospf" commands. */ | |
8158 | install_element (CONFIG_NODE, &router_ospf_cmd); | |
8159 | install_element (CONFIG_NODE, &no_router_ospf_cmd); | |
8160 | ||
8161 | install_default (OSPF_NODE); | |
8162 | ||
8163 | /* "ospf router-id" commands. */ | |
8164 | install_element (OSPF_NODE, &ospf_router_id_cmd); | |
8165 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); | |
a2c62831 | 8166 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
8167 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); | |
718e3744 | 8168 | |
8169 | /* "passive-interface" commands. */ | |
a2c62831 | 8170 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
8171 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); | |
8172 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); | |
8173 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); | |
718e3744 | 8174 | |
8175 | /* "ospf abr-type" commands. */ | |
8176 | install_element (OSPF_NODE, &ospf_abr_type_cmd); | |
8177 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); | |
8178 | ||
8179 | /* "ospf rfc1583-compatible" commands. */ | |
8180 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); | |
8181 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); | |
8182 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); | |
8183 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); | |
8184 | ||
8185 | /* "network area" commands. */ | |
a2c62831 | 8186 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
8187 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); | |
718e3744 | 8188 | |
8189 | /* "area authentication" commands. */ | |
a2c62831 | 8190 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
8191 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); | |
8192 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); | |
718e3744 | 8193 | |
8194 | /* "area range" commands. */ | |
a2c62831 | 8195 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
8196 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); | |
8197 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); | |
8198 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); | |
8199 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); | |
8200 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); | |
8201 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); | |
8202 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); | |
8203 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); | |
8204 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); | |
8205 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); | |
718e3744 | 8206 | |
8207 | /* "area virtual-link" commands. */ | |
a2c62831 | 8208 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
8209 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); | |
718e3744 | 8210 | |
a2c62831 | 8211 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
8212 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); | |
718e3744 | 8213 | |
a2c62831 | 8214 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
8215 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); | |
718e3744 | 8216 | |
a2c62831 | 8217 | install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); |
8218 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); | |
718e3744 | 8219 | |
a2c62831 | 8220 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
8221 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); | |
718e3744 | 8222 | |
a2c62831 | 8223 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
8224 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); | |
8225 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); | |
718e3744 | 8226 | |
a2c62831 | 8227 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
8228 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); | |
718e3744 | 8229 | |
a2c62831 | 8230 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
8231 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); | |
718e3744 | 8232 | |
a2c62831 | 8233 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
8234 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); | |
8235 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); | |
718e3744 | 8236 | |
a2c62831 | 8237 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
8238 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); | |
8239 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); | |
718e3744 | 8240 | |
8241 | /* "area stub" commands. */ | |
a2c62831 | 8242 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
8243 | install_element (OSPF_NODE, &ospf_area_stub_cmd); | |
8244 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); | |
8245 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); | |
718e3744 | 8246 | |
718e3744 | 8247 | /* "area nssa" commands. */ |
a2c62831 | 8248 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
8249 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); | |
8250 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); | |
8251 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); | |
8252 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); | |
8253 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); | |
718e3744 | 8254 | |
a2c62831 | 8255 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
8256 | install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); | |
718e3744 | 8257 | |
a2c62831 | 8258 | install_element (OSPF_NODE, &ospf_area_shortcut_cmd); |
8259 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); | |
718e3744 | 8260 | |
a2c62831 | 8261 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
8262 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); | |
718e3744 | 8263 | |
a2c62831 | 8264 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
8265 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); | |
718e3744 | 8266 | |
a2c62831 | 8267 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
8268 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); | |
88d6cf37 | 8269 | |
8270 | /* SPF timer commands */ | |
a2c62831 | 8271 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
8272 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); | |
d24f6e2a | 8273 | install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); |
8274 | install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); | |
8275 | ||
88d6cf37 | 8276 | /* refresh timer commands */ |
a2c62831 | 8277 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
8278 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); | |
8279 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); | |
718e3744 | 8280 | |
88d6cf37 | 8281 | /* max-metric commands */ |
8282 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd); | |
8283 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd); | |
8284 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd); | |
8285 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd); | |
8286 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd); | |
8287 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd); | |
8288 | ||
8289 | /* reference bandwidth commands */ | |
a2c62831 | 8290 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
8291 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); | |
718e3744 | 8292 | |
8293 | /* "neighbor" commands. */ | |
a2c62831 | 8294 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
8295 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); | |
8296 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); | |
8297 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); | |
8298 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); | |
8299 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); | |
8300 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); | |
8301 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); | |
718e3744 | 8302 | |
8303 | /* Init interface related vty commands. */ | |
8304 | ospf_vty_if_init (); | |
8305 | ||
8306 | /* Init zebra related vty commands. */ | |
8307 | ospf_vty_zebra_init (); | |
8308 | } |