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