paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* OSPF VTY interface. |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2 | * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com> |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 53 | const static char *ospf_network_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 54 | { |
| 55 | "Null", |
| 56 | "POINTOPOINT", |
| 57 | "BROADCAST", |
| 58 | "NBMA", |
| 59 | "POINTOMULTIPOINT", |
| 60 | "VIRTUALLINK", |
| 61 | "LOOPBACK" |
| 62 | }; |
| 63 | |
| 64 | |
| 65 | /* Utility functions. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 66 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 67 | ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 95 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 96 | str2distribute_source (const char *str, int *source) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 118 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 119 | str2metric (const char *str, int *metric) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 135 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 136 | str2metric_type (const char *str, int *metric_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
| 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 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 185 | struct ospf *ospf; |
| 186 | |
| 187 | ospf = ospf_lookup (); |
| 188 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 189 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 190 | vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 191 | return CMD_WARNING; |
| 192 | } |
| 193 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 194 | ospf_finish (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 206 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 207 | struct in_addr router_id; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 208 | int ret; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 217 | ospf->router_id_static = router_id; |
paul | b29800a | 2005-11-20 14:50:45 +0000 | [diff] [blame] | 218 | |
| 219 | ospf_router_id_update (ospf); |
| 220 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 221 | return CMD_SUCCESS; |
| 222 | } |
| 223 | |
| 224 | ALIAS (ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 225 | router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 237 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 238 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 239 | ospf->router_id_static.s_addr = 0; |
| 240 | |
| 241 | ospf_router_id_update (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 242 | |
| 243 | return CMD_SUCCESS; |
| 244 | } |
| 245 | |
| 246 | ALIAS (no_ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 247 | no_router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 248 | "no router-id", |
| 249 | NO_STR |
| 250 | "router-id for the OSPF process\n") |
| 251 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 252 | DEFUN (ospf_passive_interface, |
| 253 | ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 262 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 263 | |
Andrew J. Schorr | 6e72cb6 | 2006-06-18 00:45:48 +0000 | [diff] [blame] | 264 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 306 | return CMD_SUCCESS; |
| 307 | } |
| 308 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 309 | ALIAS (ospf_passive_interface, |
| 310 | ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 311 | "passive-interface IFNAME", |
| 312 | "Suppress routing updates on an interface\n" |
| 313 | "Interface's name\n") |
| 314 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 315 | DEFUN (no_ospf_passive_interface, |
| 316 | no_ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 326 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 327 | |
Andrew J. Schorr | 6e72cb6 | 2006-06-18 00:45:48 +0000 | [diff] [blame] | 328 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 371 | return CMD_SUCCESS; |
| 372 | } |
| 373 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 374 | ALIAS (no_ospf_passive_interface, |
| 375 | no_ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 376 | "no passive-interface IFNAME", |
| 377 | NO_STR |
| 378 | "Allow routing updates on an interface\n" |
| 379 | "Interface's name\n") |
| 380 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 381 | DEFUN (ospf_network_area, |
| 382 | ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 409 | DEFUN (no_ospf_network_area, |
| 410 | no_ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 440 | DEFUN (ospf_area_range, |
| 441 | ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 461 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 462 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
| 463 | } |
| 464 | |
| 465 | return CMD_SUCCESS; |
| 466 | } |
| 467 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 468 | ALIAS (ospf_area_range, |
| 469 | ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 478 | ALIAS (ospf_area_range, |
| 479 | ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 489 | ALIAS (ospf_area_range, |
| 490 | ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 501 | DEFUN (ospf_area_range_not_advertise, |
| 502 | ospf_area_range_not_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 524 | DEFUN (no_ospf_area_range, |
| 525 | no_ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 547 | ALIAS (no_ospf_area_range, |
| 548 | no_ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 559 | ALIAS (no_ospf_area_range, |
| 560 | no_ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 571 | ALIAS (no_ospf_area_range, |
| 572 | no_ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 584 | DEFUN (ospf_area_range_substitute, |
| 585 | ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 609 | DEFUN (no_ospf_area_range_substitute, |
| 610 | no_ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
| 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 669 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 678 | static struct ospf_vl_data * |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 679 | ospf_find_vl_data (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 696 | area = ospf_area_get (ospf, area_id, vl_config->format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 703 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 704 | VTY_NEWLINE); |
| 705 | else |
| 706 | vty_out (vty, "Area %ld is %s%s", |
| 707 | (u_long)ntohl (area_id.s_addr), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 708 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 709 | VTY_NEWLINE); |
| 710 | return NULL; |
| 711 | } |
| 712 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 713 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config->vl_peer)) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 714 | { |
| 715 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); |
| 716 | if (vl_data->vl_oi == NULL) |
| 717 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 718 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
| 719 | ospf_vl_add (ospf, vl_data); |
| 720 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 721 | } |
| 722 | } |
| 723 | return vl_data; |
| 724 | } |
| 725 | |
| 726 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 727 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 746 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 761 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 784 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 821 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 822 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 823 | { |
| 824 | struct ospf_vl_data *vl_data; |
| 825 | int ret; |
| 826 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 827 | vl_data = ospf_find_vl_data (ospf, vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 889 | DEFUN (ospf_area_vlink, |
| 890 | ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 891 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 892 | VLINK_HELPSTR_IPADDR) |
| 893 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 894 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 923 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1019 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1020 | |
| 1021 | } |
| 1022 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1023 | DEFUN (no_ospf_area_vlink, |
| 1024 | no_ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1025 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 1026 | NO_STR |
| 1027 | VLINK_HELPSTR_IPADDR) |
| 1028 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1029 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1046 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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!!!*/ |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 1065 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1066 | ospf_vl_delete (ospf, vl_data); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1067 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1068 | ospf_area_check_free (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1136 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1137 | } |
| 1138 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1139 | ALIAS (ospf_area_vlink, |
| 1140 | ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1146 | ALIAS (no_ospf_area_vlink, |
| 1147 | no_ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1154 | ALIAS (ospf_area_vlink, |
| 1155 | ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1163 | ALIAS (no_ospf_area_vlink, |
| 1164 | no_ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1173 | ALIAS (ospf_area_vlink, |
| 1174 | ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1184 | ALIAS (no_ospf_area_vlink, |
| 1185 | no_ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1196 | ALIAS (ospf_area_vlink, |
| 1197 | ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1209 | ALIAS (no_ospf_area_vlink, |
| 1210 | no_ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1223 | ALIAS (ospf_area_vlink, |
| 1224 | ospf_area_vlink_authtype_args_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1230 | ALIAS (ospf_area_vlink, |
| 1231 | ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1237 | ALIAS (no_ospf_area_vlink, |
| 1238 | no_ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1245 | ALIAS (ospf_area_vlink, |
| 1246 | ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1252 | ALIAS (no_ospf_area_vlink, |
| 1253 | no_ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1260 | ALIAS (ospf_area_vlink, |
| 1261 | ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1267 | ALIAS (no_ospf_area_vlink, |
| 1268 | no_ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1275 | ALIAS (ospf_area_vlink, |
| 1276 | ospf_area_vlink_authtype_args_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1284 | ALIAS (ospf_area_vlink, |
| 1285 | ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1293 | ALIAS (no_ospf_area_vlink, |
| 1294 | no_ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1303 | ALIAS (ospf_area_vlink, |
| 1304 | ospf_area_vlink_authtype_args_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1312 | ALIAS (ospf_area_vlink, |
| 1313 | ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1321 | ALIAS (no_ospf_area_vlink, |
| 1322 | no_ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1332 | DEFUN (ospf_area_shortcut, |
| 1333 | ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1343 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1351 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1362 | ospf_area_shortcut_set (ospf, area, mode); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1363 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1364 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1372 | DEFUN (no_ospf_area_shortcut, |
| 1373 | no_ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1383 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1390 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1391 | if (!area) |
| 1392 | return CMD_SUCCESS; |
| 1393 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1394 | ospf_area_shortcut_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1395 | |
| 1396 | return CMD_SUCCESS; |
| 1397 | } |
| 1398 | |
| 1399 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1400 | DEFUN (ospf_area_stub, |
| 1401 | ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1427 | DEFUN (ospf_area_stub_no_summary, |
| 1428 | ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1445 | vty_out (vty, "%% Area cannot be stub as it contains a virtual link%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1455 | DEFUN (no_ospf_area_stub, |
| 1456 | no_ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1476 | DEFUN (no_ospf_area_stub_no_summary, |
| 1477 | no_ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1496 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 1497 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
| 1498 | int nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1517 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1518 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1519 | else if (strncmp (argv[1], "translate-n", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1520 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1521 | OSPF_NSSA_ROLE_NEVER); |
| 1522 | else if (strncmp (argv[1], "translate-a", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1523 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1524 | OSPF_NSSA_ROLE_ALWAYS); |
| 1525 | } |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1526 | else |
| 1527 | { |
| 1528 | ospf_area_nssa_translator_role_set (ospf, area_id, |
| 1529 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1530 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1531 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1532 | if (nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1533 | ospf_area_no_summary_set (ospf, area_id); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1534 | else |
| 1535 | ospf_area_no_summary_unset (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1536 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1537 | ospf_schedule_abr_task (ospf); |
| 1538 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1539 | return CMD_SUCCESS; |
| 1540 | } |
| 1541 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1542 | DEFUN (ospf_area_nssa_translate_no_summary, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1543 | ospf_area_nssa_translate_no_summary_cmd, |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1544 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always) no-summary", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1552 | "Do not inject inter-area routes into nssa\n") |
| 1553 | { |
| 1554 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
| 1555 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1556 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1557 | DEFUN (ospf_area_nssa_translate, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1558 | ospf_area_nssa_translate_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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") |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 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 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1581 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1582 | DEFUN (ospf_area_nssa_no_summary, |
| 1583 | ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1591 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1592 | } |
| 1593 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1594 | DEFUN (no_ospf_area_nssa, |
| 1595 | no_ospf_area_nssa_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1612 | ospf_schedule_abr_task (ospf); |
| 1613 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1614 | return CMD_SUCCESS; |
| 1615 | } |
| 1616 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1617 | DEFUN (no_ospf_area_nssa_no_summary, |
| 1618 | no_ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1637 | DEFUN (ospf_area_default_cost, |
| 1638 | ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1646 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1647 | struct ospf_area *area; |
| 1648 | struct in_addr area_id; |
| 1649 | u_int32_t cost; |
| 1650 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1651 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1656 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1675 | return CMD_SUCCESS; |
| 1676 | } |
| 1677 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1678 | DEFUN (no_ospf_area_default_cost, |
| 1679 | no_ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1688 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1689 | struct ospf_area *area; |
| 1690 | struct in_addr area_id; |
| 1691 | u_int32_t cost; |
| 1692 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1693 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1698 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1720 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1721 | |
| 1722 | return CMD_SUCCESS; |
| 1723 | } |
| 1724 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1725 | DEFUN (ospf_area_export_list, |
| 1726 | ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1734 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1735 | struct ospf_area *area; |
| 1736 | struct in_addr area_id; |
| 1737 | int format; |
| 1738 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1739 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1740 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1741 | area = ospf_area_get (ospf, area_id, format); |
| 1742 | ospf_area_export_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1743 | |
| 1744 | return CMD_SUCCESS; |
| 1745 | } |
| 1746 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1747 | DEFUN (no_ospf_area_export_list, |
| 1748 | no_ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1757 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1758 | struct ospf_area *area; |
| 1759 | struct in_addr area_id; |
| 1760 | int format; |
| 1761 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1762 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1763 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1764 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1765 | if (area == NULL) |
| 1766 | return CMD_SUCCESS; |
| 1767 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1768 | ospf_area_export_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1769 | |
| 1770 | return CMD_SUCCESS; |
| 1771 | } |
| 1772 | |
| 1773 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1774 | DEFUN (ospf_area_import_list, |
| 1775 | ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1783 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1784 | struct ospf_area *area; |
| 1785 | struct in_addr area_id; |
| 1786 | int format; |
| 1787 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1788 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1789 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1790 | area = ospf_area_get (ospf, area_id, format); |
| 1791 | ospf_area_import_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1792 | |
| 1793 | return CMD_SUCCESS; |
| 1794 | } |
| 1795 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1796 | DEFUN (no_ospf_area_import_list, |
| 1797 | no_ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1806 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1807 | struct ospf_area *area; |
| 1808 | struct in_addr area_id; |
| 1809 | int format; |
| 1810 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1811 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1812 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1813 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1814 | if (area == NULL) |
| 1815 | return CMD_SUCCESS; |
| 1816 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1817 | ospf_area_import_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1818 | |
| 1819 | return CMD_SUCCESS; |
| 1820 | } |
| 1821 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1822 | DEFUN (ospf_area_filter_list, |
| 1823 | ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1834 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1842 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1851 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1860 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1861 | } |
| 1862 | |
| 1863 | return CMD_SUCCESS; |
| 1864 | } |
| 1865 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1866 | DEFUN (no_ospf_area_filter_list, |
| 1867 | no_ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1879 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
Paul Jakma | 1a8ec2b | 2006-05-11 13:34:08 +0000 | [diff] [blame] | 1887 | if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) |
| 1888 | return CMD_SUCCESS; |
| 1889 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1903 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1917 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1918 | } |
| 1919 | |
| 1920 | return CMD_SUCCESS; |
| 1921 | } |
| 1922 | |
| 1923 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1924 | DEFUN (ospf_area_authentication_message_digest, |
| 1925 | ospf_area_authentication_message_digest_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1931 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1938 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1939 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1940 | |
| 1941 | return CMD_SUCCESS; |
| 1942 | } |
| 1943 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1944 | DEFUN (ospf_area_authentication, |
| 1945 | ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1952 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1959 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1960 | area->auth_type = OSPF_AUTH_SIMPLE; |
| 1961 | |
| 1962 | return CMD_SUCCESS; |
| 1963 | } |
| 1964 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1965 | DEFUN (no_ospf_area_authentication, |
| 1966 | no_ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1974 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1981 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1982 | if (area == NULL) |
| 1983 | return CMD_SUCCESS; |
| 1984 | |
| 1985 | area->auth_type = OSPF_AUTH_NULL; |
| 1986 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1987 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1988 | |
| 1989 | return CMD_SUCCESS; |
| 1990 | } |
| 1991 | |
| 1992 | |
| 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2003 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2018 | if (ospf->abr_type != abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2019 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2020 | ospf->abr_type = abr_type; |
| 2021 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2022 | } |
| 2023 | |
| 2024 | return CMD_SUCCESS; |
| 2025 | } |
| 2026 | |
| 2027 | DEFUN (no_ospf_abr_type, |
| 2028 | no_ospf_abr_type_cmd, |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2029 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2037 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2050 | if (ospf->abr_type == abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2051 | { |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2052 | ospf->abr_type = OSPF_ABR_DEFAULT; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2053 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2054 | } |
| 2055 | |
| 2056 | return CMD_SUCCESS; |
| 2057 | } |
| 2058 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2120 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2137 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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") |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2154 | |
| 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 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2168 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2195 | ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2196 | "timers spf <0-4294967295> <0-4294967295>", |
| 2197 | "Adjust routing timers\n" |
| 2198 | "OSPF SPF timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2199 | "Delay (s) between receiving a change to SPF calculation\n" |
| 2200 | "Hold time (s) between consecutive SPF calculations\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2201 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2210 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
| 2211 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2223 | } |
| 2224 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2225 | DEFUN (no_ospf_timers_throttle_spf, |
| 2226 | no_ospf_timers_throttle_spf_cmd, |
| 2227 | "no timers throttle spf", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2228 | NO_STR |
| 2229 | "Adjust routing timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2230 | "Throttling adaptive timer\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2231 | "OSPF SPF timers\n") |
| 2232 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2233 | return ospf_timers_spf_set (vty, |
| 2234 | OSPF_SPF_DELAY_DEFAULT, |
| 2235 | OSPF_SPF_HOLDTIME_DEFAULT, |
| 2236 | OSPF_SPF_MAX_HOLDTIME_DEFAULT); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2237 | } |
| 2238 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2245 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2246 | DEFUN (ospf_neighbor, |
| 2247 | ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2254 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2255 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2274 | ALIAS (ospf_neighbor, |
| 2275 | ospf_neighbor_priority_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2284 | ALIAS (ospf_neighbor, |
| 2285 | ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2292 | DEFUN (ospf_neighbor_poll_interval, |
| 2293 | ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2302 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2303 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2322 | ALIAS (ospf_neighbor_poll_interval, |
| 2323 | ospf_neighbor_poll_interval_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2332 | DEFUN (no_ospf_neighbor, |
| 2333 | no_ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2350 | ALIAS (no_ospf_neighbor, |
| 2351 | no_ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2359 | ALIAS (no_ospf_neighbor, |
| 2360 | no_ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2368 | ALIAS (no_ospf_neighbor, |
| 2369 | no_ospf_neighbor_priority_pollinterval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2380 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2387 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2397 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2404 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2420 | ALIAS (no_ospf_refresh_timer, |
| 2421 | no_ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2422 | "no refresh timer", |
| 2423 | "Adjust refresh parameters\n" |
| 2424 | "Unset refresh timer\n") |
| 2425 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2426 | DEFUN (ospf_auto_cost_reference_bandwidth, |
| 2427 | ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2433 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2434 | u_int32_t refbw; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2435 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2436 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2446 | if ((refbw * 1000) == ospf->ref_bandwidth) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2447 | return CMD_SUCCESS; |
| 2448 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2449 | ospf->ref_bandwidth = refbw * 1000; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2450 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 2451 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2452 | |
| 2453 | return CMD_SUCCESS; |
| 2454 | } |
| 2455 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2456 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
| 2457 | no_ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2463 | struct ospf *ospf = vty->index; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2464 | struct listnode *node, *nnode; |
| 2465 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2466 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2467 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2468 | return CMD_SUCCESS; |
| 2469 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2470 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2474 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
| 2475 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2476 | |
| 2477 | return CMD_SUCCESS; |
| 2478 | } |
| 2479 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2480 | const char *ospf_abr_type_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2481 | { |
| 2482 | "Unknown", |
| 2483 | "Standard (RFC2328)", |
| 2484 | "Alternative IBM", |
| 2485 | "Alternative Cisco", |
| 2486 | "Alternative Shortcut" |
| 2487 | }; |
| 2488 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2489 | const char *ospf_shortcut_mode_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2490 | { |
| 2491 | "Default", |
| 2492 | "Enabled", |
| 2493 | "Disabled" |
| 2494 | }; |
| 2495 | |
| 2496 | |
| 2497 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2498 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2510 | vty_out (vty, " (Stub%s%s)", |
| 2511 | area->no_summary ? ", no summary" : "", |
| 2512 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2513 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 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 ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2518 | |
| 2519 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2520 | vty_out (vty, " Shortcutting mode: %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2521 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2522 | vty_out (vty, ", S-bit consensus: %s%s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2523 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2534 | if (! IS_OSPF_ABR (area->ospf)) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 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 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2547 | else |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 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 |
hasso | c6b8781 | 2004-12-22 13:09:59 +0000 | [diff] [blame] | 2554 | vty_out (vty, "never an NSSA Translator. %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2555 | VTY_NEWLINE); |
| 2556 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2557 | } |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2558 | /* Stub-router state for this area */ |
| 2559 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
| 2560 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2561 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2573 | /* Show number of fully adjacent neighbors. */ |
| 2574 | vty_out (vty, " Number of fully adjacent neighbors in this area:" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2575 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 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 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2629 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2630 | struct ospf_area * area; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2631 | struct ospf *ospf; |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2632 | struct timeval result; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2633 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2634 | |
| 2635 | /* Check OSPF is enable. */ |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2636 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2637 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2645 | inet_ntoa (ospf->router_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2646 | VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2647 | |
| 2648 | /* Graceful shutdown */ |
paul | c9c93d5 | 2005-11-26 13:31:11 +0000 | [diff] [blame] | 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, |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2652 | timebuf, sizeof (timebuf)), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2657 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2658 | "enabled" : "disabled", VTY_NEWLINE); |
| 2659 | #ifdef HAVE_OPAQUE_LSA |
| 2660 | vty_out (vty, " OpaqueCapability flag is %s%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2661 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2662 | "enabled" : "disabled", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2663 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2664 | " (origination blocked)" : "", |
| 2665 | VTY_NEWLINE); |
| 2666 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2682 | /* Show SPF timers. */ |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2691 | vty_out (vty, " SPF algorithm "); |
| 2692 | if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec) |
| 2693 | { |
paul | c8c1521 | 2005-11-04 12:31:39 +0000 | [diff] [blame] | 2694 | result = tv_sub (recent_time, ospf->ts_spf); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 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); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2706 | /* Show refresh parameters. */ |
| 2707 | vty_out (vty, " Refresh timer %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2708 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2709 | |
| 2710 | /* Show ABR/ASBR flags. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2711 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2712 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2713 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2714 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2715 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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. */ |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 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 */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2728 | /* Show number of areas attached. */ |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 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); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2741 | |
| 2742 | /* Show each area status. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2743 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 2744 | show_ip_ospf_area (vty, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2745 | |
| 2746 | return CMD_SUCCESS; |
| 2747 | } |
| 2748 | |
| 2749 | |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2750 | static void |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2751 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
| 2752 | struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2753 | { |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2754 | int is_up; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2755 | struct ospf_neighbor *nbr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2756 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2757 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2758 | /* Is interface up? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2759 | vty_out (vty, "%s is %s%s", ifp->name, |
| 2760 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 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); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2764 | |
| 2765 | /* Is interface OSPF enabled? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2766 | if (ospf_oi_count(ifp) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2767 | { |
| 2768 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); |
| 2769 | return; |
| 2770 | } |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 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 | } |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 2810 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2811 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
| 2812 | VTY_NEWLINE); |
| 2813 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2814 | vty_out (vty, " MTU mismatch detection:%s%s", |
| 2815 | OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE); |
| 2816 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2817 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2818 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2860 | |
| 2861 | vty_out (vty, " Multicast group memberships:"); |
Paul Jakma | 429ac78 | 2006-06-15 18:40:49 +0000 | [diff] [blame] | 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 |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2871 | vty_out (vty, " <None>"); |
| 2872 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2873 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2874 | vty_out (vty, " Timer intervals configured,"); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 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), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2887 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2888 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2889 | vty_out (vty, " Hello due in %s%s", |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2890 | ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)), |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2891 | VTY_NEWLINE); |
| 2892 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2897 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2912 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2913 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2914 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2915 | ospf = ospf_lookup (); |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 2916 | if (ospf == NULL) |
| 2917 | { |
| 2918 | vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2919 | return CMD_SUCCESS; |
| 2920 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2921 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2922 | /* Show All Interfaces. */ |
| 2923 | if (argc == 0) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2924 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 2925 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2932 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2933 | } |
| 2934 | |
| 2935 | return CMD_SUCCESS; |
| 2936 | } |
| 2937 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2938 | static void |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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 | |
| 2948 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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]; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2954 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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) |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 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 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2978 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2979 | vty_out (vty, "%-20s %5ld %5ld %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2994 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2995 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2996 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2997 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2998 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2999 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3000 | { |
| 3001 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3002 | return CMD_SUCCESS; |
| 3003 | } |
| 3004 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3005 | show_ip_ospf_neighbour_header (vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3006 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3007 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3008 | show_ip_ospf_neighbor_sub (vty, oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3022 | struct ospf *ospf = vty->index; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3023 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3024 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3025 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3026 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3027 | { |
| 3028 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3029 | return CMD_SUCCESS; |
| 3030 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3031 | |
| 3032 | show_ip_ospf_neighbour_header (vty); |
| 3033 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3034 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3035 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3036 | struct listnode *nbr_node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3037 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3038 | |
| 3039 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3040 | |
| 3041 | /* print Down neighbor status */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3042 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3043 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3044 | if (nbr_nbma->nbr == NULL |
| 3045 | || nbr_nbma->nbr->state == NSM_Down) |
| 3046 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3047 | vty_out (vty, "%-15s %3d %-15s %9s ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3048 | "-", nbr_nbma->priority, "Down", "-"); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3049 | vty_out (vty, "%-15s %-20s %5d %5d %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3061 | "show ip ospf neighbor IFNAME", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3062 | SHOW_STR |
| 3063 | IP_STR |
| 3064 | "OSPF information\n" |
| 3065 | "Neighbor list\n" |
| 3066 | "Interface name\n") |
| 3067 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3068 | struct ospf *ospf; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3069 | struct interface *ifp; |
| 3070 | struct route_node *rn; |
| 3071 | |
| 3072 | ifp = if_lookup_by_name (argv[0]); |
| 3073 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3074 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3075 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3076 | return CMD_WARNING; |
| 3077 | } |
| 3078 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 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 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3085 | |
| 3086 | show_ip_ospf_neighbour_header (vty); |
| 3087 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3088 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3089 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3090 | struct ospf_interface *oi = rn->info; |
| 3091 | |
| 3092 | if (oi == NULL) |
| 3093 | continue; |
| 3094 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3095 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3096 | } |
| 3097 | |
| 3098 | return CMD_SUCCESS; |
| 3099 | } |
| 3100 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3101 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3102 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3103 | struct ospf_nbr_nbma *nbr_nbma) |
| 3104 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3105 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3127 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)), |
| 3128 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3135 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3136 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3137 | struct ospf_neighbor *nbr) |
| 3138 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3139 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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); |
| 3158 | |
| 3159 | /* Show Designated Rotuer ID. */ |
| 3160 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); |
| 3161 | /* Show Backup Designated Rotuer ID. */ |
| 3162 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); |
| 3163 | /* Show options. */ |
| 3164 | vty_out (vty, " Options %d %s%s", nbr->options, |
| 3165 | ospf_options_dump (nbr->options), VTY_NEWLINE); |
| 3166 | /* Show Router Dead interval timer. */ |
| 3167 | vty_out (vty, " Dead timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3168 | ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)), |
| 3169 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3170 | /* Show Database Summary list. */ |
| 3171 | vty_out (vty, " Database Summary List %d%s", |
| 3172 | ospf_db_summary_count (nbr), VTY_NEWLINE); |
| 3173 | /* Show Link State Request list. */ |
| 3174 | vty_out (vty, " Link State Request List %ld%s", |
| 3175 | ospf_ls_request_count (nbr), VTY_NEWLINE); |
| 3176 | /* Show Link State Retransmission list. */ |
| 3177 | vty_out (vty, " Link State Retransmission List %ld%s", |
| 3178 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); |
| 3179 | /* Show inactivity timer thread. */ |
| 3180 | vty_out (vty, " Thread Inactivity Timer %s%s", |
| 3181 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); |
| 3182 | /* Show Database Description retransmission thread. */ |
| 3183 | vty_out (vty, " Thread Database Description Retransmision %s%s", |
| 3184 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); |
| 3185 | /* Show Link State Request Retransmission thread. */ |
| 3186 | vty_out (vty, " Thread Link State Request Retransmission %s%s", |
| 3187 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); |
| 3188 | /* Show Link State Update Retransmission thread. */ |
| 3189 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", |
| 3190 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); |
| 3191 | } |
| 3192 | |
| 3193 | DEFUN (show_ip_ospf_neighbor_id, |
| 3194 | show_ip_ospf_neighbor_id_cmd, |
| 3195 | "show ip ospf neighbor A.B.C.D", |
| 3196 | SHOW_STR |
| 3197 | IP_STR |
| 3198 | "OSPF information\n" |
| 3199 | "Neighbor list\n" |
| 3200 | "Neighbor ID\n") |
| 3201 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3202 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3203 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3204 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3205 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3206 | struct in_addr router_id; |
| 3207 | int ret; |
| 3208 | |
| 3209 | ret = inet_aton (argv[0], &router_id); |
| 3210 | if (!ret) |
| 3211 | { |
| 3212 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); |
| 3213 | return CMD_WARNING; |
| 3214 | } |
| 3215 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3216 | ospf = ospf_lookup (); |
| 3217 | if (ospf == NULL) |
| 3218 | { |
| 3219 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3220 | return CMD_SUCCESS; |
| 3221 | } |
| 3222 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3223 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3224 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) |
Andrew J. Schorr | 1c066bf | 2006-06-30 16:53:47 +0000 | [diff] [blame] | 3225 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3226 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3227 | return CMD_SUCCESS; |
| 3228 | } |
| 3229 | |
| 3230 | DEFUN (show_ip_ospf_neighbor_detail, |
| 3231 | show_ip_ospf_neighbor_detail_cmd, |
| 3232 | "show ip ospf neighbor detail", |
| 3233 | SHOW_STR |
| 3234 | IP_STR |
| 3235 | "OSPF information\n" |
| 3236 | "Neighbor list\n" |
| 3237 | "detail of all neighbors\n") |
| 3238 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3239 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3240 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3241 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3242 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3243 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3244 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3245 | { |
| 3246 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3247 | return CMD_SUCCESS; |
| 3248 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3249 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3250 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3251 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3252 | struct route_node *rn; |
| 3253 | struct ospf_neighbor *nbr; |
| 3254 | |
| 3255 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3256 | if ((nbr = rn->info)) |
| 3257 | if (nbr != oi->nbr_self) |
| 3258 | if (nbr->state != NSM_Down) |
| 3259 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3260 | } |
| 3261 | |
| 3262 | return CMD_SUCCESS; |
| 3263 | } |
| 3264 | |
| 3265 | DEFUN (show_ip_ospf_neighbor_detail_all, |
| 3266 | show_ip_ospf_neighbor_detail_all_cmd, |
| 3267 | "show ip ospf neighbor detail all", |
| 3268 | SHOW_STR |
| 3269 | IP_STR |
| 3270 | "OSPF information\n" |
| 3271 | "Neighbor list\n" |
| 3272 | "detail of all neighbors\n" |
| 3273 | "include down status neighbor\n") |
| 3274 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3275 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3276 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3277 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3278 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3279 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3280 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3281 | { |
| 3282 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3283 | return CMD_SUCCESS; |
| 3284 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3285 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3286 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3287 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3288 | struct route_node *rn; |
| 3289 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3290 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3291 | |
| 3292 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3293 | if ((nbr = rn->info)) |
| 3294 | if (nbr != oi->nbr_self) |
| 3295 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) |
| 3296 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); |
| 3297 | |
| 3298 | if (oi->type == OSPF_IFTYPE_NBMA) |
| 3299 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3300 | struct listnode *nd; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3301 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3302 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
| 3303 | if (nbr_nbma->nbr == NULL |
| 3304 | || nbr_nbma->nbr->state == NSM_Down) |
| 3305 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3306 | } |
| 3307 | } |
| 3308 | |
| 3309 | return CMD_SUCCESS; |
| 3310 | } |
| 3311 | |
| 3312 | DEFUN (show_ip_ospf_neighbor_int_detail, |
| 3313 | show_ip_ospf_neighbor_int_detail_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3314 | "show ip ospf neighbor IFNAME detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3315 | SHOW_STR |
| 3316 | IP_STR |
| 3317 | "OSPF information\n" |
| 3318 | "Neighbor list\n" |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3319 | "Interface name\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3320 | "detail of all neighbors") |
| 3321 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3322 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3323 | struct ospf_interface *oi; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3324 | struct interface *ifp; |
| 3325 | struct route_node *rn, *nrn; |
| 3326 | struct ospf_neighbor *nbr; |
| 3327 | |
| 3328 | ifp = if_lookup_by_name (argv[0]); |
| 3329 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3330 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3331 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3332 | return CMD_WARNING; |
| 3333 | } |
| 3334 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3335 | ospf = ospf_lookup (); |
| 3336 | if (ospf == NULL) |
| 3337 | { |
| 3338 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3339 | return CMD_SUCCESS; |
| 3340 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3341 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3342 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3343 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 3344 | if ((oi = rn->info)) |
| 3345 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) |
| 3346 | if ((nbr = nrn->info)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3347 | if (nbr != oi->nbr_self) |
| 3348 | if (nbr->state != NSM_Down) |
| 3349 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3350 | |
| 3351 | return CMD_SUCCESS; |
| 3352 | } |
| 3353 | |
| 3354 | |
| 3355 | /* Show functions */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3356 | static int |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3357 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3358 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3359 | struct router_lsa *rl; |
| 3360 | struct summary_lsa *sl; |
| 3361 | struct as_external_lsa *asel; |
| 3362 | struct prefix_ipv4 p; |
| 3363 | |
| 3364 | if (lsa != NULL) |
| 3365 | /* If self option is set, check LSA self flag. */ |
| 3366 | if (self == 0 || IS_LSA_SELF (lsa)) |
| 3367 | { |
| 3368 | /* LSA common part show. */ |
| 3369 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); |
| 3370 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", |
| 3371 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), |
| 3372 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); |
| 3373 | /* LSA specific part show. */ |
| 3374 | switch (lsa->data->type) |
| 3375 | { |
| 3376 | case OSPF_ROUTER_LSA: |
| 3377 | rl = (struct router_lsa *) lsa->data; |
| 3378 | vty_out (vty, " %-d", ntohs (rl->links)); |
| 3379 | break; |
| 3380 | case OSPF_SUMMARY_LSA: |
| 3381 | sl = (struct summary_lsa *) lsa->data; |
| 3382 | |
| 3383 | p.family = AF_INET; |
| 3384 | p.prefix = sl->header.id; |
| 3385 | p.prefixlen = ip_masklen (sl->mask); |
| 3386 | apply_mask_ipv4 (&p); |
| 3387 | |
| 3388 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); |
| 3389 | break; |
| 3390 | case OSPF_AS_EXTERNAL_LSA: |
paul | 551a897 | 2003-05-18 15:22:55 +0000 | [diff] [blame] | 3391 | case OSPF_AS_NSSA_LSA: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3392 | asel = (struct as_external_lsa *) lsa->data; |
| 3393 | |
| 3394 | p.family = AF_INET; |
| 3395 | p.prefix = asel->header.id; |
| 3396 | p.prefixlen = ip_masklen (asel->mask); |
| 3397 | apply_mask_ipv4 (&p); |
| 3398 | |
| 3399 | vty_out (vty, " %s %s/%d [0x%lx]", |
| 3400 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", |
| 3401 | inet_ntoa (p.prefix), p.prefixlen, |
| 3402 | (u_long)ntohl (asel->e[0].route_tag)); |
| 3403 | break; |
| 3404 | case OSPF_NETWORK_LSA: |
| 3405 | case OSPF_ASBR_SUMMARY_LSA: |
| 3406 | #ifdef HAVE_OPAQUE_LSA |
| 3407 | case OSPF_OPAQUE_LINK_LSA: |
| 3408 | case OSPF_OPAQUE_AREA_LSA: |
| 3409 | case OSPF_OPAQUE_AS_LSA: |
| 3410 | #endif /* HAVE_OPAQUE_LSA */ |
| 3411 | default: |
| 3412 | break; |
| 3413 | } |
| 3414 | vty_out (vty, VTY_NEWLINE); |
| 3415 | } |
| 3416 | |
| 3417 | return 0; |
| 3418 | } |
| 3419 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3420 | const char *show_database_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3421 | { |
| 3422 | "unknown", |
| 3423 | "Router Link States", |
| 3424 | "Net Link States", |
| 3425 | "Summary Link States", |
| 3426 | "ASBR-Summary Link States", |
| 3427 | "AS External Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3428 | "Group Membership LSA", |
| 3429 | "NSSA-external Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3430 | #ifdef HAVE_OPAQUE_LSA |
| 3431 | "Type-8 LSA", |
| 3432 | "Link-Local Opaque-LSA", |
| 3433 | "Area-Local Opaque-LSA", |
| 3434 | "AS-external Opaque-LSA", |
| 3435 | #endif /* HAVE_OPAQUE_LSA */ |
| 3436 | }; |
| 3437 | |
| 3438 | #define SHOW_OSPF_COMMON_HEADER \ |
| 3439 | "Link ID ADV Router Age Seq# CkSum" |
| 3440 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3441 | const char *show_database_header[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3442 | { |
| 3443 | "", |
| 3444 | "Link ID ADV Router Age Seq# CkSum Link count", |
| 3445 | "Link ID ADV Router Age Seq# CkSum", |
| 3446 | "Link ID ADV Router Age Seq# CkSum Route", |
| 3447 | "Link ID ADV Router Age Seq# CkSum", |
| 3448 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3449 | " --- header for Group Member ----", |
| 3450 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3451 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3452 | " --- type-8 ---", |
| 3453 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3454 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3455 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3456 | #endif /* HAVE_OPAQUE_LSA */ |
| 3457 | }; |
| 3458 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3459 | const char *show_lsa_flags[] = |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3460 | { |
| 3461 | "Self-originated", |
| 3462 | "Checked", |
| 3463 | "Received", |
| 3464 | "Approved", |
| 3465 | "Discard", |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3466 | "Translated", |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3467 | }; |
| 3468 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3469 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3470 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
| 3471 | { |
| 3472 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3473 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3474 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3475 | vty_out (vty, " Options: 0x%-2x : %s%s", |
| 3476 | lsa->data->options, |
| 3477 | ospf_options_dump(lsa->data->options), |
| 3478 | VTY_NEWLINE); |
| 3479 | vty_out (vty, " LS Flags: 0x%-2x %s%s", |
paul | 9d52603 | 2003-06-30 22:46:14 +0000 | [diff] [blame] | 3480 | lsa->flags, |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3481 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
| 3482 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3483 | |
| 3484 | if (lsa->data->type == OSPF_ROUTER_LSA) |
| 3485 | { |
| 3486 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); |
| 3487 | |
| 3488 | if (rlsa->flags) |
| 3489 | vty_out (vty, " :%s%s%s%s", |
| 3490 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", |
| 3491 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", |
| 3492 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", |
| 3493 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); |
| 3494 | |
| 3495 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3496 | } |
| 3497 | vty_out (vty, " LS Type: %s%s", |
| 3498 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3499 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), |
| 3500 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3501 | vty_out (vty, " Advertising Router: %s%s", |
| 3502 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3503 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), |
| 3504 | VTY_NEWLINE); |
| 3505 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), |
| 3506 | VTY_NEWLINE); |
| 3507 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); |
| 3508 | } |
| 3509 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3510 | const char *link_type_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3511 | { |
| 3512 | "(null)", |
| 3513 | "another Router (point-to-point)", |
| 3514 | "a Transit Network", |
| 3515 | "Stub Network", |
| 3516 | "a Virtual Link", |
| 3517 | }; |
| 3518 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3519 | const char *link_id_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3520 | { |
| 3521 | "(null)", |
| 3522 | "Neighboring Router ID", |
| 3523 | "Designated Router address", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3524 | "Net", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3525 | "Neighboring Router ID", |
| 3526 | }; |
| 3527 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3528 | const char *link_data_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3529 | { |
| 3530 | "(null)", |
| 3531 | "Router Interface address", |
| 3532 | "Router Interface address", |
| 3533 | "Network Mask", |
| 3534 | "Router Interface address", |
| 3535 | }; |
| 3536 | |
| 3537 | /* Show router-LSA each Link information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3538 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3539 | show_ip_ospf_database_router_links (struct vty *vty, |
| 3540 | struct router_lsa *rl) |
| 3541 | { |
| 3542 | int len, i, type; |
| 3543 | |
| 3544 | len = ntohs (rl->header.length) - 4; |
| 3545 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) |
| 3546 | { |
| 3547 | type = rl->link[i].type; |
| 3548 | |
| 3549 | vty_out (vty, " Link connected to: %s%s", |
| 3550 | link_type_desc[type], VTY_NEWLINE); |
| 3551 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], |
| 3552 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); |
| 3553 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], |
| 3554 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); |
| 3555 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); |
| 3556 | vty_out (vty, " TOS 0 Metric: %d%s", |
| 3557 | ntohs (rl->link[i].metric), VTY_NEWLINE); |
| 3558 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3559 | } |
| 3560 | } |
| 3561 | |
| 3562 | /* Show router-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3563 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3564 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3565 | { |
| 3566 | if (lsa != NULL) |
| 3567 | { |
| 3568 | struct router_lsa *rl = (struct router_lsa *) lsa->data; |
| 3569 | |
| 3570 | show_ip_ospf_database_header (vty, lsa); |
| 3571 | |
| 3572 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), |
| 3573 | VTY_NEWLINE, VTY_NEWLINE); |
| 3574 | |
| 3575 | show_ip_ospf_database_router_links (vty, rl); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3576 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3577 | } |
| 3578 | |
| 3579 | return 0; |
| 3580 | } |
| 3581 | |
| 3582 | /* Show network-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3583 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3584 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3585 | { |
| 3586 | int length, i; |
| 3587 | |
| 3588 | if (lsa != NULL) |
| 3589 | { |
| 3590 | struct network_lsa *nl = (struct network_lsa *) lsa->data; |
| 3591 | |
| 3592 | show_ip_ospf_database_header (vty, lsa); |
| 3593 | |
| 3594 | vty_out (vty, " Network Mask: /%d%s", |
| 3595 | ip_masklen (nl->mask), VTY_NEWLINE); |
| 3596 | |
| 3597 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; |
| 3598 | |
| 3599 | for (i = 0; length > 0; i++, length -= 4) |
| 3600 | vty_out (vty, " Attached Router: %s%s", |
| 3601 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); |
| 3602 | |
| 3603 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3604 | } |
| 3605 | |
| 3606 | return 0; |
| 3607 | } |
| 3608 | |
| 3609 | /* Show summary-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3610 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3611 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3612 | { |
| 3613 | if (lsa != NULL) |
| 3614 | { |
| 3615 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3616 | |
| 3617 | show_ip_ospf_database_header (vty, lsa); |
| 3618 | |
| 3619 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), |
| 3620 | VTY_NEWLINE); |
| 3621 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3622 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3623 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3624 | } |
| 3625 | |
| 3626 | return 0; |
| 3627 | } |
| 3628 | |
| 3629 | /* Show summary-ASBR-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3630 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3631 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3632 | { |
| 3633 | if (lsa != NULL) |
| 3634 | { |
| 3635 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3636 | |
| 3637 | show_ip_ospf_database_header (vty, lsa); |
| 3638 | |
| 3639 | vty_out (vty, " Network Mask: /%d%s", |
| 3640 | ip_masklen (sl->mask), VTY_NEWLINE); |
| 3641 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3642 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3643 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3644 | } |
| 3645 | |
| 3646 | return 0; |
| 3647 | } |
| 3648 | |
| 3649 | /* Show AS-external-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3650 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3651 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3652 | { |
| 3653 | if (lsa != NULL) |
| 3654 | { |
| 3655 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3656 | |
| 3657 | show_ip_ospf_database_header (vty, lsa); |
| 3658 | |
| 3659 | vty_out (vty, " Network Mask: /%d%s", |
| 3660 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3661 | vty_out (vty, " Metric Type: %s%s", |
| 3662 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3663 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3664 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3665 | vty_out (vty, " Metric: %d%s", |
| 3666 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3667 | vty_out (vty, " Forward Address: %s%s", |
| 3668 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3669 | |
| 3670 | vty_out (vty, " External Route Tag: %lu%s%s", |
| 3671 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3672 | } |
| 3673 | |
| 3674 | return 0; |
| 3675 | } |
| 3676 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3677 | /* N.B. This function currently seems to be unused. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3678 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3679 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
| 3680 | { |
| 3681 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3682 | |
| 3683 | /* show_ip_ospf_database_header (vty, lsa); */ |
| 3684 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3685 | zlog_debug( " Network Mask: /%d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3686 | ip_masklen (al->mask), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3687 | zlog_debug( " Metric Type: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3688 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3689 | "2 (Larger than any link state path)" : "1", "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3690 | zlog_debug( " TOS: 0%s", "\n"); |
| 3691 | zlog_debug( " Metric: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3692 | GET_METRIC (al->e[0].metric), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3693 | zlog_debug( " Forward Address: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3694 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
| 3695 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3696 | zlog_debug( " External Route Tag: %u%s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3697 | ntohl (al->e[0].route_tag), "\n", "\n"); |
| 3698 | |
| 3699 | return 0; |
| 3700 | } |
| 3701 | |
| 3702 | /* Show AS-NSSA-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3703 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3704 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3705 | { |
| 3706 | if (lsa != NULL) |
| 3707 | { |
| 3708 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3709 | |
| 3710 | show_ip_ospf_database_header (vty, lsa); |
| 3711 | |
| 3712 | vty_out (vty, " Network Mask: /%d%s", |
| 3713 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3714 | vty_out (vty, " Metric Type: %s%s", |
| 3715 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3716 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3717 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3718 | vty_out (vty, " Metric: %d%s", |
| 3719 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3720 | vty_out (vty, " NSSA: Forward Address: %s%s", |
| 3721 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3722 | |
| 3723 | vty_out (vty, " External Route Tag: %u%s%s", |
| 3724 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3725 | } |
| 3726 | |
| 3727 | return 0; |
| 3728 | } |
| 3729 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3730 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3731 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
| 3732 | { |
| 3733 | return 0; |
| 3734 | } |
| 3735 | |
| 3736 | #ifdef HAVE_OPAQUE_LSA |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3737 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3738 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3739 | { |
| 3740 | if (lsa != NULL) |
| 3741 | { |
| 3742 | show_ip_ospf_database_header (vty, lsa); |
| 3743 | show_opaque_info_detail (vty, lsa); |
| 3744 | |
| 3745 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3746 | } |
| 3747 | return 0; |
| 3748 | } |
| 3749 | #endif /* HAVE_OPAQUE_LSA */ |
| 3750 | |
| 3751 | int (*show_function[])(struct vty *, struct ospf_lsa *) = |
| 3752 | { |
| 3753 | NULL, |
| 3754 | show_router_lsa_detail, |
| 3755 | show_network_lsa_detail, |
| 3756 | show_summary_lsa_detail, |
| 3757 | show_summary_asbr_lsa_detail, |
| 3758 | show_as_external_lsa_detail, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3759 | show_func_dummy, |
| 3760 | show_as_nssa_lsa_detail, /* almost same as external */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3761 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3762 | NULL, /* type-8 */ |
| 3763 | show_opaque_lsa_detail, |
| 3764 | show_opaque_lsa_detail, |
| 3765 | show_opaque_lsa_detail, |
| 3766 | #endif /* HAVE_OPAQUE_LSA */ |
| 3767 | }; |
| 3768 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3769 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3770 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
| 3771 | struct in_addr *adv_router) |
| 3772 | { |
| 3773 | memset (lp, 0, sizeof (struct prefix_ls)); |
| 3774 | lp->family = 0; |
| 3775 | if (id == NULL) |
| 3776 | lp->prefixlen = 0; |
| 3777 | else if (adv_router == NULL) |
| 3778 | { |
| 3779 | lp->prefixlen = 32; |
| 3780 | lp->id = *id; |
| 3781 | } |
| 3782 | else |
| 3783 | { |
| 3784 | lp->prefixlen = 64; |
| 3785 | lp->id = *id; |
| 3786 | lp->adv_router = *adv_router; |
| 3787 | } |
| 3788 | } |
| 3789 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3790 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3791 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
| 3792 | struct in_addr *id, struct in_addr *adv_router) |
| 3793 | { |
| 3794 | struct prefix_ls lp; |
| 3795 | struct route_node *rn, *start; |
| 3796 | struct ospf_lsa *lsa; |
| 3797 | |
| 3798 | show_lsa_prefix_set (vty, &lp, id, adv_router); |
| 3799 | start = route_node_get (rt, (struct prefix *) &lp); |
| 3800 | if (start) |
| 3801 | { |
| 3802 | route_lock_node (start); |
| 3803 | for (rn = start; rn; rn = route_next_until (rn, start)) |
| 3804 | if ((lsa = rn->info)) |
| 3805 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3806 | if (show_function[lsa->data->type] != NULL) |
| 3807 | show_function[lsa->data->type] (vty, lsa); |
| 3808 | } |
| 3809 | route_unlock_node (start); |
| 3810 | } |
| 3811 | } |
| 3812 | |
| 3813 | /* Show detail LSA information |
| 3814 | -- if id is NULL then show all LSAs. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3815 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3816 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3817 | struct in_addr *id, struct in_addr *adv_router) |
| 3818 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3819 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3820 | struct ospf_area *area; |
| 3821 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3822 | switch (type) |
| 3823 | { |
| 3824 | case OSPF_AS_EXTERNAL_LSA: |
| 3825 | #ifdef HAVE_OPAQUE_LSA |
| 3826 | case OSPF_OPAQUE_AS_LSA: |
| 3827 | #endif /* HAVE_OPAQUE_LSA */ |
| 3828 | vty_out (vty, " %s %s%s", |
| 3829 | show_database_desc[type], |
| 3830 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3831 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3832 | break; |
| 3833 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3834 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3835 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3836 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3837 | VTY_NEWLINE, show_database_desc[type], |
| 3838 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3839 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); |
| 3840 | } |
| 3841 | break; |
| 3842 | } |
| 3843 | } |
| 3844 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3845 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3846 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
| 3847 | struct in_addr *adv_router) |
| 3848 | { |
| 3849 | struct route_node *rn; |
| 3850 | struct ospf_lsa *lsa; |
| 3851 | |
| 3852 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 3853 | if ((lsa = rn->info)) |
| 3854 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) |
| 3855 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3856 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
| 3857 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3858 | if (show_function[lsa->data->type] != NULL) |
| 3859 | show_function[lsa->data->type] (vty, lsa); |
| 3860 | } |
| 3861 | } |
| 3862 | |
| 3863 | /* Show detail LSA information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3864 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3865 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3866 | struct in_addr *adv_router) |
| 3867 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3868 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3869 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3870 | |
| 3871 | switch (type) |
| 3872 | { |
| 3873 | case OSPF_AS_EXTERNAL_LSA: |
| 3874 | #ifdef HAVE_OPAQUE_LSA |
| 3875 | case OSPF_OPAQUE_AS_LSA: |
| 3876 | #endif /* HAVE_OPAQUE_LSA */ |
| 3877 | vty_out (vty, " %s %s%s", |
| 3878 | show_database_desc[type], |
| 3879 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3880 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3881 | adv_router); |
| 3882 | break; |
| 3883 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3884 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3885 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3886 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3887 | VTY_NEWLINE, show_database_desc[type], |
| 3888 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3889 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), |
| 3890 | adv_router); |
| 3891 | } |
| 3892 | break; |
| 3893 | } |
| 3894 | } |
| 3895 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3896 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3897 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3898 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3899 | struct ospf_lsa *lsa; |
| 3900 | struct route_node *rn; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3901 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3902 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3903 | int type; |
| 3904 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3905 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3906 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3907 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3908 | { |
| 3909 | switch (type) |
| 3910 | { |
| 3911 | case OSPF_AS_EXTERNAL_LSA: |
| 3912 | #ifdef HAVE_OPAQUE_LSA |
| 3913 | case OSPF_OPAQUE_AS_LSA: |
| 3914 | #endif /* HAVE_OPAQUE_LSA */ |
| 3915 | continue; |
| 3916 | default: |
| 3917 | break; |
| 3918 | } |
| 3919 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || |
| 3920 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) |
| 3921 | { |
| 3922 | vty_out (vty, " %s (Area %s)%s%s", |
| 3923 | show_database_desc[type], |
| 3924 | ospf_area_desc_string (area), |
| 3925 | VTY_NEWLINE, VTY_NEWLINE); |
| 3926 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); |
| 3927 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3928 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
| 3929 | show_lsa_summary (vty, lsa, self); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3930 | |
| 3931 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3932 | } |
| 3933 | } |
| 3934 | } |
| 3935 | |
| 3936 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3937 | { |
| 3938 | switch (type) |
| 3939 | { |
| 3940 | case OSPF_AS_EXTERNAL_LSA: |
| 3941 | #ifdef HAVE_OPAQUE_LSA |
| 3942 | case OSPF_OPAQUE_AS_LSA: |
| 3943 | #endif /* HAVE_OPAQUE_LSA */ |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 3944 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3945 | default: |
| 3946 | continue; |
| 3947 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3948 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
| 3949 | (!self && ospf_lsdb_count (ospf->lsdb, type))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3950 | { |
| 3951 | vty_out (vty, " %s%s%s", |
| 3952 | show_database_desc[type], |
| 3953 | VTY_NEWLINE, VTY_NEWLINE); |
| 3954 | vty_out (vty, "%s%s", show_database_header[type], |
| 3955 | VTY_NEWLINE); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3956 | |
| 3957 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) |
| 3958 | show_lsa_summary (vty, lsa, self); |
| 3959 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3960 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3961 | } |
| 3962 | } |
| 3963 | |
| 3964 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3965 | } |
| 3966 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3967 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3968 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3969 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3970 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3971 | struct ospf_lsa *lsa; |
| 3972 | |
| 3973 | vty_out (vty, "%s MaxAge Link States:%s%s", |
| 3974 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); |
| 3975 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3976 | for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) |
| 3977 | { |
| 3978 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); |
| 3979 | vty_out (vty, "Link State ID: %s%s", |
| 3980 | inet_ntoa (lsa->data->id), VTY_NEWLINE); |
| 3981 | vty_out (vty, "Advertising Router: %s%s", |
| 3982 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3983 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); |
| 3984 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3985 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3986 | } |
| 3987 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3988 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
| 3989 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3990 | |
| 3991 | #ifdef HAVE_OPAQUE_LSA |
| 3992 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" |
| 3993 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" |
| 3994 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" |
| 3995 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" |
| 3996 | #else /* HAVE_OPAQUE_LSA */ |
| 3997 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" |
| 3998 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" |
| 3999 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" |
| 4000 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" |
| 4001 | #endif /* HAVE_OPAQUE_LSA */ |
| 4002 | |
| 4003 | #define OSPF_LSA_TYPES_CMD_STR \ |
| 4004 | "asbr-summary|external|network|router|summary" \ |
| 4005 | OSPF_LSA_TYPE_NSSA_CMD_STR \ |
| 4006 | OSPF_LSA_TYPE_OPAQUE_CMD_STR |
| 4007 | |
| 4008 | #define OSPF_LSA_TYPES_DESC \ |
| 4009 | "ASBR summary link states\n" \ |
| 4010 | "External link states\n" \ |
| 4011 | "Network link states\n" \ |
| 4012 | "Router link states\n" \ |
| 4013 | "Network summary link states\n" \ |
| 4014 | OSPF_LSA_TYPE_NSSA_DESC \ |
| 4015 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ |
| 4016 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ |
| 4017 | OSPF_LSA_TYPE_OPAQUE_AS_DESC |
| 4018 | |
| 4019 | DEFUN (show_ip_ospf_database, |
| 4020 | show_ip_ospf_database_cmd, |
| 4021 | "show ip ospf database", |
| 4022 | SHOW_STR |
| 4023 | IP_STR |
| 4024 | "OSPF information\n" |
| 4025 | "Database summary\n") |
| 4026 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4027 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4028 | int type, ret; |
| 4029 | struct in_addr id, adv_router; |
| 4030 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4031 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4032 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4033 | { |
| 4034 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4035 | return CMD_SUCCESS; |
| 4036 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4037 | |
| 4038 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4039 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4040 | |
| 4041 | /* Show all LSA. */ |
| 4042 | if (argc == 0) |
| 4043 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4044 | show_ip_ospf_database_summary (vty, ospf, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4045 | return CMD_SUCCESS; |
| 4046 | } |
| 4047 | |
| 4048 | /* Set database type to show. */ |
| 4049 | if (strncmp (argv[0], "r", 1) == 0) |
| 4050 | type = OSPF_ROUTER_LSA; |
| 4051 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4052 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4053 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4054 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4055 | else if (strncmp (argv[0], "su", 2) == 0) |
| 4056 | type = OSPF_SUMMARY_LSA; |
| 4057 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4058 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4059 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4060 | type = OSPF_AS_EXTERNAL_LSA; |
| 4061 | else if (strncmp (argv[0], "se", 2) == 0) |
| 4062 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4063 | show_ip_ospf_database_summary (vty, ospf, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4064 | return CMD_SUCCESS; |
| 4065 | } |
| 4066 | else if (strncmp (argv[0], "m", 1) == 0) |
| 4067 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4068 | show_ip_ospf_database_maxage (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4069 | return CMD_SUCCESS; |
| 4070 | } |
| 4071 | #ifdef HAVE_OPAQUE_LSA |
| 4072 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4073 | type = OSPF_OPAQUE_LINK_LSA; |
| 4074 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4075 | type = OSPF_OPAQUE_AREA_LSA; |
| 4076 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4077 | type = OSPF_OPAQUE_AS_LSA; |
| 4078 | #endif /* HAVE_OPAQUE_LSA */ |
| 4079 | else |
| 4080 | return CMD_WARNING; |
| 4081 | |
| 4082 | /* `show ip ospf database LSA'. */ |
| 4083 | if (argc == 1) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4084 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4085 | else if (argc >= 2) |
| 4086 | { |
| 4087 | ret = inet_aton (argv[1], &id); |
| 4088 | if (!ret) |
| 4089 | return CMD_WARNING; |
| 4090 | |
| 4091 | /* `show ip ospf database LSA ID'. */ |
| 4092 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4093 | show_lsa_detail (vty, ospf, type, &id, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4094 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
| 4095 | else if (argc == 3) |
| 4096 | { |
| 4097 | if (strncmp (argv[2], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4098 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4099 | else |
| 4100 | { |
| 4101 | ret = inet_aton (argv[2], &adv_router); |
| 4102 | if (!ret) |
| 4103 | return CMD_WARNING; |
| 4104 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4105 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4106 | } |
| 4107 | } |
| 4108 | |
| 4109 | return CMD_SUCCESS; |
| 4110 | } |
| 4111 | |
| 4112 | ALIAS (show_ip_ospf_database, |
| 4113 | show_ip_ospf_database_type_cmd, |
| 4114 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", |
| 4115 | SHOW_STR |
| 4116 | IP_STR |
| 4117 | "OSPF information\n" |
| 4118 | "Database summary\n" |
| 4119 | OSPF_LSA_TYPES_DESC |
| 4120 | "LSAs in MaxAge list\n" |
| 4121 | "Self-originated link states\n") |
| 4122 | |
| 4123 | ALIAS (show_ip_ospf_database, |
| 4124 | show_ip_ospf_database_type_id_cmd, |
| 4125 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", |
| 4126 | SHOW_STR |
| 4127 | IP_STR |
| 4128 | "OSPF information\n" |
| 4129 | "Database summary\n" |
| 4130 | OSPF_LSA_TYPES_DESC |
| 4131 | "Link State ID (as an IP address)\n") |
| 4132 | |
| 4133 | ALIAS (show_ip_ospf_database, |
| 4134 | show_ip_ospf_database_type_id_adv_router_cmd, |
| 4135 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", |
| 4136 | SHOW_STR |
| 4137 | IP_STR |
| 4138 | "OSPF information\n" |
| 4139 | "Database summary\n" |
| 4140 | OSPF_LSA_TYPES_DESC |
| 4141 | "Link State ID (as an IP address)\n" |
| 4142 | "Advertising Router link states\n" |
| 4143 | "Advertising Router (as an IP address)\n") |
| 4144 | |
| 4145 | ALIAS (show_ip_ospf_database, |
| 4146 | show_ip_ospf_database_type_id_self_cmd, |
| 4147 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", |
| 4148 | SHOW_STR |
| 4149 | IP_STR |
| 4150 | "OSPF information\n" |
| 4151 | "Database summary\n" |
| 4152 | OSPF_LSA_TYPES_DESC |
| 4153 | "Link State ID (as an IP address)\n" |
| 4154 | "Self-originated link states\n" |
| 4155 | "\n") |
| 4156 | |
| 4157 | DEFUN (show_ip_ospf_database_type_adv_router, |
| 4158 | show_ip_ospf_database_type_adv_router_cmd, |
| 4159 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", |
| 4160 | SHOW_STR |
| 4161 | IP_STR |
| 4162 | "OSPF information\n" |
| 4163 | "Database summary\n" |
| 4164 | OSPF_LSA_TYPES_DESC |
| 4165 | "Advertising Router link states\n" |
| 4166 | "Advertising Router (as an IP address)\n") |
| 4167 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4168 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4169 | int type, ret; |
| 4170 | struct in_addr adv_router; |
| 4171 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4172 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4173 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4174 | { |
| 4175 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4176 | return CMD_SUCCESS; |
| 4177 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4178 | |
| 4179 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4180 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4181 | |
| 4182 | if (argc != 2) |
| 4183 | return CMD_WARNING; |
| 4184 | |
| 4185 | /* Set database type to show. */ |
| 4186 | if (strncmp (argv[0], "r", 1) == 0) |
| 4187 | type = OSPF_ROUTER_LSA; |
| 4188 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4189 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4190 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4191 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4192 | else if (strncmp (argv[0], "s", 1) == 0) |
| 4193 | type = OSPF_SUMMARY_LSA; |
| 4194 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4195 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4196 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4197 | type = OSPF_AS_EXTERNAL_LSA; |
| 4198 | #ifdef HAVE_OPAQUE_LSA |
| 4199 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4200 | type = OSPF_OPAQUE_LINK_LSA; |
| 4201 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4202 | type = OSPF_OPAQUE_AREA_LSA; |
| 4203 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4204 | type = OSPF_OPAQUE_AS_LSA; |
| 4205 | #endif /* HAVE_OPAQUE_LSA */ |
| 4206 | else |
| 4207 | return CMD_WARNING; |
| 4208 | |
| 4209 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ |
| 4210 | if (strncmp (argv[1], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4211 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4212 | else |
| 4213 | { |
| 4214 | ret = inet_aton (argv[1], &adv_router); |
| 4215 | if (!ret) |
| 4216 | return CMD_WARNING; |
| 4217 | } |
| 4218 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4219 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4220 | |
| 4221 | return CMD_SUCCESS; |
| 4222 | } |
| 4223 | |
| 4224 | ALIAS (show_ip_ospf_database_type_adv_router, |
| 4225 | show_ip_ospf_database_type_self_cmd, |
| 4226 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", |
| 4227 | SHOW_STR |
| 4228 | IP_STR |
| 4229 | "OSPF information\n" |
| 4230 | "Database summary\n" |
| 4231 | OSPF_LSA_TYPES_DESC |
| 4232 | "Self-originated link states\n") |
| 4233 | |
| 4234 | |
| 4235 | DEFUN (ip_ospf_authentication_args, |
| 4236 | ip_ospf_authentication_args_addr_cmd, |
| 4237 | "ip ospf authentication (null|message-digest) A.B.C.D", |
| 4238 | "IP Information\n" |
| 4239 | "OSPF interface commands\n" |
| 4240 | "Enable authentication on this interface\n" |
| 4241 | "Use null authentication\n" |
| 4242 | "Use message-digest authentication\n" |
| 4243 | "Address of interface") |
| 4244 | { |
| 4245 | struct interface *ifp; |
| 4246 | struct in_addr addr; |
| 4247 | int ret; |
| 4248 | struct ospf_if_params *params; |
| 4249 | |
| 4250 | ifp = vty->index; |
| 4251 | params = IF_DEF_PARAMS (ifp); |
| 4252 | |
| 4253 | if (argc == 2) |
| 4254 | { |
| 4255 | ret = inet_aton(argv[1], &addr); |
| 4256 | if (!ret) |
| 4257 | { |
| 4258 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4259 | VTY_NEWLINE); |
| 4260 | return CMD_WARNING; |
| 4261 | } |
| 4262 | |
| 4263 | params = ospf_get_if_params (ifp, addr); |
| 4264 | ospf_if_update_params (ifp, addr); |
| 4265 | } |
| 4266 | |
| 4267 | /* Handle null authentication */ |
| 4268 | if ( argv[0][0] == 'n' ) |
| 4269 | { |
| 4270 | SET_IF_PARAM (params, auth_type); |
| 4271 | params->auth_type = OSPF_AUTH_NULL; |
| 4272 | return CMD_SUCCESS; |
| 4273 | } |
| 4274 | |
| 4275 | /* Handle message-digest authentication */ |
| 4276 | if ( argv[0][0] == 'm' ) |
| 4277 | { |
| 4278 | SET_IF_PARAM (params, auth_type); |
| 4279 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 4280 | return CMD_SUCCESS; |
| 4281 | } |
| 4282 | |
| 4283 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); |
| 4284 | return CMD_WARNING; |
| 4285 | } |
| 4286 | |
| 4287 | ALIAS (ip_ospf_authentication_args, |
| 4288 | ip_ospf_authentication_args_cmd, |
| 4289 | "ip ospf authentication (null|message-digest)", |
| 4290 | "IP Information\n" |
| 4291 | "OSPF interface commands\n" |
| 4292 | "Enable authentication on this interface\n" |
| 4293 | "Use null authentication\n" |
| 4294 | "Use message-digest authentication\n") |
| 4295 | |
| 4296 | DEFUN (ip_ospf_authentication, |
| 4297 | ip_ospf_authentication_addr_cmd, |
| 4298 | "ip ospf authentication A.B.C.D", |
| 4299 | "IP Information\n" |
| 4300 | "OSPF interface commands\n" |
| 4301 | "Enable authentication on this interface\n" |
| 4302 | "Address of interface") |
| 4303 | { |
| 4304 | struct interface *ifp; |
| 4305 | struct in_addr addr; |
| 4306 | int ret; |
| 4307 | struct ospf_if_params *params; |
| 4308 | |
| 4309 | ifp = vty->index; |
| 4310 | params = IF_DEF_PARAMS (ifp); |
| 4311 | |
| 4312 | if (argc == 1) |
| 4313 | { |
| 4314 | ret = inet_aton(argv[1], &addr); |
| 4315 | if (!ret) |
| 4316 | { |
| 4317 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4318 | VTY_NEWLINE); |
| 4319 | return CMD_WARNING; |
| 4320 | } |
| 4321 | |
| 4322 | params = ospf_get_if_params (ifp, addr); |
| 4323 | ospf_if_update_params (ifp, addr); |
| 4324 | } |
| 4325 | |
| 4326 | SET_IF_PARAM (params, auth_type); |
| 4327 | params->auth_type = OSPF_AUTH_SIMPLE; |
| 4328 | |
| 4329 | return CMD_SUCCESS; |
| 4330 | } |
| 4331 | |
| 4332 | ALIAS (ip_ospf_authentication, |
| 4333 | ip_ospf_authentication_cmd, |
| 4334 | "ip ospf authentication", |
| 4335 | "IP Information\n" |
| 4336 | "OSPF interface commands\n" |
| 4337 | "Enable authentication on this interface\n") |
| 4338 | |
| 4339 | DEFUN (no_ip_ospf_authentication, |
| 4340 | no_ip_ospf_authentication_addr_cmd, |
| 4341 | "no ip ospf authentication A.B.C.D", |
| 4342 | NO_STR |
| 4343 | "IP Information\n" |
| 4344 | "OSPF interface commands\n" |
| 4345 | "Enable authentication on this interface\n" |
| 4346 | "Address of interface") |
| 4347 | { |
| 4348 | struct interface *ifp; |
| 4349 | struct in_addr addr; |
| 4350 | int ret; |
| 4351 | struct ospf_if_params *params; |
| 4352 | |
| 4353 | ifp = vty->index; |
| 4354 | params = IF_DEF_PARAMS (ifp); |
| 4355 | |
| 4356 | if (argc == 1) |
| 4357 | { |
| 4358 | ret = inet_aton(argv[1], &addr); |
| 4359 | if (!ret) |
| 4360 | { |
| 4361 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4362 | VTY_NEWLINE); |
| 4363 | return CMD_WARNING; |
| 4364 | } |
| 4365 | |
| 4366 | params = ospf_lookup_if_params (ifp, addr); |
| 4367 | if (params == NULL) |
| 4368 | return CMD_SUCCESS; |
| 4369 | } |
| 4370 | |
| 4371 | params->auth_type = OSPF_AUTH_NOTSET; |
| 4372 | UNSET_IF_PARAM (params, auth_type); |
| 4373 | |
| 4374 | if (params != IF_DEF_PARAMS (ifp)) |
| 4375 | { |
| 4376 | ospf_free_if_params (ifp, addr); |
| 4377 | ospf_if_update_params (ifp, addr); |
| 4378 | } |
| 4379 | |
| 4380 | return CMD_SUCCESS; |
| 4381 | } |
| 4382 | |
| 4383 | ALIAS (no_ip_ospf_authentication, |
| 4384 | no_ip_ospf_authentication_cmd, |
| 4385 | "no ip ospf authentication", |
| 4386 | NO_STR |
| 4387 | "IP Information\n" |
| 4388 | "OSPF interface commands\n" |
| 4389 | "Enable authentication on this interface\n") |
| 4390 | |
| 4391 | DEFUN (ip_ospf_authentication_key, |
| 4392 | ip_ospf_authentication_key_addr_cmd, |
| 4393 | "ip ospf authentication-key AUTH_KEY A.B.C.D", |
| 4394 | "IP Information\n" |
| 4395 | "OSPF interface commands\n" |
| 4396 | "Authentication password (key)\n" |
| 4397 | "The OSPF password (key)\n" |
| 4398 | "Address of interface") |
| 4399 | { |
| 4400 | struct interface *ifp; |
| 4401 | struct in_addr addr; |
| 4402 | int ret; |
| 4403 | struct ospf_if_params *params; |
| 4404 | |
| 4405 | ifp = vty->index; |
| 4406 | params = IF_DEF_PARAMS (ifp); |
| 4407 | |
| 4408 | if (argc == 2) |
| 4409 | { |
| 4410 | ret = inet_aton(argv[1], &addr); |
| 4411 | if (!ret) |
| 4412 | { |
| 4413 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4414 | VTY_NEWLINE); |
| 4415 | return CMD_WARNING; |
| 4416 | } |
| 4417 | |
| 4418 | params = ospf_get_if_params (ifp, addr); |
| 4419 | ospf_if_update_params (ifp, addr); |
| 4420 | } |
| 4421 | |
| 4422 | |
| 4423 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4424 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4425 | SET_IF_PARAM (params, auth_simple); |
| 4426 | |
| 4427 | return CMD_SUCCESS; |
| 4428 | } |
| 4429 | |
| 4430 | ALIAS (ip_ospf_authentication_key, |
| 4431 | ip_ospf_authentication_key_cmd, |
| 4432 | "ip ospf authentication-key AUTH_KEY", |
| 4433 | "IP Information\n" |
| 4434 | "OSPF interface commands\n" |
| 4435 | "Authentication password (key)\n" |
| 4436 | "The OSPF password (key)") |
| 4437 | |
| 4438 | ALIAS (ip_ospf_authentication_key, |
| 4439 | ospf_authentication_key_cmd, |
| 4440 | "ospf authentication-key AUTH_KEY", |
| 4441 | "OSPF interface commands\n" |
| 4442 | "Authentication password (key)\n" |
| 4443 | "The OSPF password (key)") |
| 4444 | |
| 4445 | DEFUN (no_ip_ospf_authentication_key, |
| 4446 | no_ip_ospf_authentication_key_addr_cmd, |
| 4447 | "no ip ospf authentication-key A.B.C.D", |
| 4448 | NO_STR |
| 4449 | "IP Information\n" |
| 4450 | "OSPF interface commands\n" |
| 4451 | "Authentication password (key)\n" |
| 4452 | "Address of interface") |
| 4453 | { |
| 4454 | struct interface *ifp; |
| 4455 | struct in_addr addr; |
| 4456 | int ret; |
| 4457 | struct ospf_if_params *params; |
| 4458 | |
| 4459 | ifp = vty->index; |
| 4460 | params = IF_DEF_PARAMS (ifp); |
| 4461 | |
| 4462 | if (argc == 2) |
| 4463 | { |
| 4464 | ret = inet_aton(argv[1], &addr); |
| 4465 | if (!ret) |
| 4466 | { |
| 4467 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4468 | VTY_NEWLINE); |
| 4469 | return CMD_WARNING; |
| 4470 | } |
| 4471 | |
| 4472 | params = ospf_lookup_if_params (ifp, addr); |
| 4473 | if (params == NULL) |
| 4474 | return CMD_SUCCESS; |
| 4475 | } |
| 4476 | |
| 4477 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); |
| 4478 | UNSET_IF_PARAM (params, auth_simple); |
| 4479 | |
| 4480 | if (params != IF_DEF_PARAMS (ifp)) |
| 4481 | { |
| 4482 | ospf_free_if_params (ifp, addr); |
| 4483 | ospf_if_update_params (ifp, addr); |
| 4484 | } |
| 4485 | |
| 4486 | return CMD_SUCCESS; |
| 4487 | } |
| 4488 | |
| 4489 | ALIAS (no_ip_ospf_authentication_key, |
| 4490 | no_ip_ospf_authentication_key_cmd, |
| 4491 | "no ip ospf authentication-key", |
| 4492 | NO_STR |
| 4493 | "IP Information\n" |
| 4494 | "OSPF interface commands\n" |
| 4495 | "Authentication password (key)\n") |
| 4496 | |
| 4497 | ALIAS (no_ip_ospf_authentication_key, |
| 4498 | no_ospf_authentication_key_cmd, |
| 4499 | "no ospf authentication-key", |
| 4500 | NO_STR |
| 4501 | "OSPF interface commands\n" |
| 4502 | "Authentication password (key)\n") |
| 4503 | |
| 4504 | DEFUN (ip_ospf_message_digest_key, |
| 4505 | ip_ospf_message_digest_key_addr_cmd, |
| 4506 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", |
| 4507 | "IP Information\n" |
| 4508 | "OSPF interface commands\n" |
| 4509 | "Message digest authentication password (key)\n" |
| 4510 | "Key ID\n" |
| 4511 | "Use MD5 algorithm\n" |
| 4512 | "The OSPF password (key)" |
| 4513 | "Address of interface") |
| 4514 | { |
| 4515 | struct interface *ifp; |
| 4516 | struct crypt_key *ck; |
| 4517 | u_char key_id; |
| 4518 | struct in_addr addr; |
| 4519 | int ret; |
| 4520 | struct ospf_if_params *params; |
| 4521 | |
| 4522 | ifp = vty->index; |
| 4523 | params = IF_DEF_PARAMS (ifp); |
| 4524 | |
| 4525 | if (argc == 3) |
| 4526 | { |
| 4527 | ret = inet_aton(argv[2], &addr); |
| 4528 | if (!ret) |
| 4529 | { |
| 4530 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4531 | VTY_NEWLINE); |
| 4532 | return CMD_WARNING; |
| 4533 | } |
| 4534 | |
| 4535 | params = ospf_get_if_params (ifp, addr); |
| 4536 | ospf_if_update_params (ifp, addr); |
| 4537 | } |
| 4538 | |
| 4539 | key_id = strtol (argv[0], NULL, 10); |
| 4540 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) |
| 4541 | { |
| 4542 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); |
| 4543 | return CMD_WARNING; |
| 4544 | } |
| 4545 | |
| 4546 | ck = ospf_crypt_key_new (); |
| 4547 | ck->key_id = (u_char) key_id; |
| 4548 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4549 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4550 | |
| 4551 | ospf_crypt_key_add (params->auth_crypt, ck); |
| 4552 | SET_IF_PARAM (params, auth_crypt); |
| 4553 | |
| 4554 | return CMD_SUCCESS; |
| 4555 | } |
| 4556 | |
| 4557 | ALIAS (ip_ospf_message_digest_key, |
| 4558 | ip_ospf_message_digest_key_cmd, |
| 4559 | "ip ospf message-digest-key <1-255> md5 KEY", |
| 4560 | "IP Information\n" |
| 4561 | "OSPF interface commands\n" |
| 4562 | "Message digest authentication password (key)\n" |
| 4563 | "Key ID\n" |
| 4564 | "Use MD5 algorithm\n" |
| 4565 | "The OSPF password (key)") |
| 4566 | |
| 4567 | ALIAS (ip_ospf_message_digest_key, |
| 4568 | ospf_message_digest_key_cmd, |
| 4569 | "ospf message-digest-key <1-255> md5 KEY", |
| 4570 | "OSPF interface commands\n" |
| 4571 | "Message digest authentication password (key)\n" |
| 4572 | "Key ID\n" |
| 4573 | "Use MD5 algorithm\n" |
| 4574 | "The OSPF password (key)") |
| 4575 | |
| 4576 | DEFUN (no_ip_ospf_message_digest_key, |
| 4577 | no_ip_ospf_message_digest_key_addr_cmd, |
| 4578 | "no ip ospf message-digest-key <1-255> A.B.C.D", |
| 4579 | NO_STR |
| 4580 | "IP Information\n" |
| 4581 | "OSPF interface commands\n" |
| 4582 | "Message digest authentication password (key)\n" |
| 4583 | "Key ID\n" |
| 4584 | "Address of interface") |
| 4585 | { |
| 4586 | struct interface *ifp; |
| 4587 | struct crypt_key *ck; |
| 4588 | int key_id; |
| 4589 | struct in_addr addr; |
| 4590 | int ret; |
| 4591 | struct ospf_if_params *params; |
| 4592 | |
| 4593 | ifp = vty->index; |
| 4594 | params = IF_DEF_PARAMS (ifp); |
| 4595 | |
| 4596 | if (argc == 2) |
| 4597 | { |
| 4598 | ret = inet_aton(argv[1], &addr); |
| 4599 | if (!ret) |
| 4600 | { |
| 4601 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4602 | VTY_NEWLINE); |
| 4603 | return CMD_WARNING; |
| 4604 | } |
| 4605 | |
| 4606 | params = ospf_lookup_if_params (ifp, addr); |
| 4607 | if (params == NULL) |
| 4608 | return CMD_SUCCESS; |
| 4609 | } |
| 4610 | |
| 4611 | key_id = strtol (argv[0], NULL, 10); |
| 4612 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); |
| 4613 | if (ck == NULL) |
| 4614 | { |
| 4615 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); |
| 4616 | return CMD_WARNING; |
| 4617 | } |
| 4618 | |
| 4619 | ospf_crypt_key_delete (params->auth_crypt, key_id); |
| 4620 | |
| 4621 | if (params != IF_DEF_PARAMS (ifp)) |
| 4622 | { |
| 4623 | ospf_free_if_params (ifp, addr); |
| 4624 | ospf_if_update_params (ifp, addr); |
| 4625 | } |
| 4626 | |
| 4627 | return CMD_SUCCESS; |
| 4628 | } |
| 4629 | |
| 4630 | ALIAS (no_ip_ospf_message_digest_key, |
| 4631 | no_ip_ospf_message_digest_key_cmd, |
| 4632 | "no ip ospf message-digest-key <1-255>", |
| 4633 | NO_STR |
| 4634 | "IP Information\n" |
| 4635 | "OSPF interface commands\n" |
| 4636 | "Message digest authentication password (key)\n" |
| 4637 | "Key ID\n") |
| 4638 | |
| 4639 | ALIAS (no_ip_ospf_message_digest_key, |
| 4640 | no_ospf_message_digest_key_cmd, |
| 4641 | "no ospf message-digest-key <1-255>", |
| 4642 | NO_STR |
| 4643 | "OSPF interface commands\n" |
| 4644 | "Message digest authentication password (key)\n" |
| 4645 | "Key ID\n") |
| 4646 | |
| 4647 | DEFUN (ip_ospf_cost, |
| 4648 | ip_ospf_cost_addr_cmd, |
| 4649 | "ip ospf cost <1-65535> A.B.C.D", |
| 4650 | "IP Information\n" |
| 4651 | "OSPF interface commands\n" |
| 4652 | "Interface cost\n" |
| 4653 | "Cost\n" |
| 4654 | "Address of interface") |
| 4655 | { |
| 4656 | struct interface *ifp = vty->index; |
| 4657 | u_int32_t cost; |
| 4658 | struct in_addr addr; |
| 4659 | int ret; |
| 4660 | struct ospf_if_params *params; |
| 4661 | |
| 4662 | params = IF_DEF_PARAMS (ifp); |
| 4663 | |
| 4664 | cost = strtol (argv[0], NULL, 10); |
| 4665 | |
| 4666 | /* cost range is <1-65535>. */ |
| 4667 | if (cost < 1 || cost > 65535) |
| 4668 | { |
| 4669 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4670 | return CMD_WARNING; |
| 4671 | } |
| 4672 | |
| 4673 | if (argc == 2) |
| 4674 | { |
| 4675 | ret = inet_aton(argv[1], &addr); |
| 4676 | if (!ret) |
| 4677 | { |
| 4678 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4679 | VTY_NEWLINE); |
| 4680 | return CMD_WARNING; |
| 4681 | } |
| 4682 | |
| 4683 | params = ospf_get_if_params (ifp, addr); |
| 4684 | ospf_if_update_params (ifp, addr); |
| 4685 | } |
| 4686 | |
| 4687 | SET_IF_PARAM (params, output_cost_cmd); |
| 4688 | params->output_cost_cmd = cost; |
| 4689 | |
| 4690 | ospf_if_recalculate_output_cost (ifp); |
| 4691 | |
| 4692 | return CMD_SUCCESS; |
| 4693 | } |
| 4694 | |
| 4695 | ALIAS (ip_ospf_cost, |
| 4696 | ip_ospf_cost_cmd, |
| 4697 | "ip ospf cost <1-65535>", |
| 4698 | "IP Information\n" |
| 4699 | "OSPF interface commands\n" |
| 4700 | "Interface cost\n" |
| 4701 | "Cost") |
| 4702 | |
| 4703 | ALIAS (ip_ospf_cost, |
| 4704 | ospf_cost_cmd, |
| 4705 | "ospf cost <1-65535>", |
| 4706 | "OSPF interface commands\n" |
| 4707 | "Interface cost\n" |
| 4708 | "Cost") |
| 4709 | |
| 4710 | DEFUN (no_ip_ospf_cost, |
| 4711 | no_ip_ospf_cost_addr_cmd, |
| 4712 | "no ip ospf cost A.B.C.D", |
| 4713 | NO_STR |
| 4714 | "IP Information\n" |
| 4715 | "OSPF interface commands\n" |
| 4716 | "Interface cost\n" |
| 4717 | "Address of interface") |
| 4718 | { |
| 4719 | struct interface *ifp = vty->index; |
| 4720 | struct in_addr addr; |
| 4721 | int ret; |
| 4722 | struct ospf_if_params *params; |
| 4723 | |
| 4724 | ifp = vty->index; |
| 4725 | params = IF_DEF_PARAMS (ifp); |
| 4726 | |
| 4727 | if (argc == 1) |
| 4728 | { |
| 4729 | ret = inet_aton(argv[0], &addr); |
| 4730 | if (!ret) |
| 4731 | { |
| 4732 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4733 | VTY_NEWLINE); |
| 4734 | return CMD_WARNING; |
| 4735 | } |
| 4736 | |
| 4737 | params = ospf_lookup_if_params (ifp, addr); |
| 4738 | if (params == NULL) |
| 4739 | return CMD_SUCCESS; |
| 4740 | } |
| 4741 | |
| 4742 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4743 | |
| 4744 | if (params != IF_DEF_PARAMS (ifp)) |
| 4745 | { |
| 4746 | ospf_free_if_params (ifp, addr); |
| 4747 | ospf_if_update_params (ifp, addr); |
| 4748 | } |
| 4749 | |
| 4750 | ospf_if_recalculate_output_cost (ifp); |
| 4751 | |
| 4752 | return CMD_SUCCESS; |
| 4753 | } |
| 4754 | |
| 4755 | ALIAS (no_ip_ospf_cost, |
| 4756 | no_ip_ospf_cost_cmd, |
| 4757 | "no ip ospf cost", |
| 4758 | NO_STR |
| 4759 | "IP Information\n" |
| 4760 | "OSPF interface commands\n" |
| 4761 | "Interface cost\n") |
| 4762 | |
| 4763 | ALIAS (no_ip_ospf_cost, |
| 4764 | no_ospf_cost_cmd, |
| 4765 | "no ospf cost", |
| 4766 | NO_STR |
| 4767 | "OSPF interface commands\n" |
| 4768 | "Interface cost\n") |
| 4769 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4770 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4771 | ospf_nbr_timer_update (struct ospf_interface *oi) |
| 4772 | { |
| 4773 | struct route_node *rn; |
| 4774 | struct ospf_neighbor *nbr; |
| 4775 | |
| 4776 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 4777 | if ((nbr = rn->info)) |
| 4778 | { |
| 4779 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); |
| 4780 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4781 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4782 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4783 | } |
| 4784 | } |
| 4785 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4786 | static int |
| 4787 | ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, |
| 4788 | const char *nbr_str, |
| 4789 | const char *fast_hello_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4790 | { |
| 4791 | struct interface *ifp = vty->index; |
| 4792 | u_int32_t seconds; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4793 | u_char hellomult; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4794 | struct in_addr addr; |
| 4795 | int ret; |
| 4796 | struct ospf_if_params *params; |
| 4797 | struct ospf_interface *oi; |
| 4798 | struct route_node *rn; |
| 4799 | |
| 4800 | params = IF_DEF_PARAMS (ifp); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4801 | |
| 4802 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4803 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4804 | ret = inet_aton(nbr_str, &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4805 | if (!ret) |
| 4806 | { |
| 4807 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4808 | VTY_NEWLINE); |
| 4809 | return CMD_WARNING; |
| 4810 | } |
| 4811 | |
| 4812 | params = ospf_get_if_params (ifp, addr); |
| 4813 | ospf_if_update_params (ifp, addr); |
| 4814 | } |
| 4815 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4816 | if (interval_str) |
| 4817 | { |
| 4818 | VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str, |
| 4819 | 1, 65535); |
| 4820 | |
| 4821 | /* reset fast_hello too, just to be sure */ |
| 4822 | UNSET_IF_PARAM (params, fast_hello); |
| 4823 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 4824 | } |
| 4825 | else if (fast_hello_str) |
| 4826 | { |
| 4827 | VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str, |
| 4828 | 1, 10); |
| 4829 | /* 1s dead-interval with sub-second hellos desired */ |
| 4830 | seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL; |
| 4831 | SET_IF_PARAM (params, fast_hello); |
| 4832 | params->fast_hello = hellomult; |
| 4833 | } |
| 4834 | else |
| 4835 | { |
| 4836 | vty_out (vty, "Please specify dead-interval or hello-multiplier%s", |
| 4837 | VTY_NEWLINE); |
| 4838 | return CMD_WARNING; |
| 4839 | } |
| 4840 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4841 | SET_IF_PARAM (params, v_wait); |
| 4842 | params->v_wait = seconds; |
| 4843 | |
| 4844 | /* Update timer values in neighbor structure. */ |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4845 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4846 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4847 | struct ospf *ospf; |
| 4848 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4849 | { |
| 4850 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 4851 | if (oi) |
| 4852 | ospf_nbr_timer_update (oi); |
| 4853 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4854 | } |
| 4855 | else |
| 4856 | { |
| 4857 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4858 | if ((oi = rn->info)) |
| 4859 | ospf_nbr_timer_update (oi); |
| 4860 | } |
| 4861 | |
| 4862 | return CMD_SUCCESS; |
| 4863 | } |
| 4864 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4865 | |
| 4866 | DEFUN (ip_ospf_dead_interval, |
| 4867 | ip_ospf_dead_interval_addr_cmd, |
| 4868 | "ip ospf dead-interval <1-65535> A.B.C.D", |
| 4869 | "IP Information\n" |
| 4870 | "OSPF interface commands\n" |
| 4871 | "Interval after which a neighbor is declared dead\n" |
| 4872 | "Seconds\n" |
| 4873 | "Address of interface\n") |
| 4874 | { |
| 4875 | if (argc == 2) |
| 4876 | return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); |
| 4877 | else |
| 4878 | return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); |
| 4879 | } |
| 4880 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4881 | ALIAS (ip_ospf_dead_interval, |
| 4882 | ip_ospf_dead_interval_cmd, |
| 4883 | "ip ospf dead-interval <1-65535>", |
| 4884 | "IP Information\n" |
| 4885 | "OSPF interface commands\n" |
| 4886 | "Interval after which a neighbor is declared dead\n" |
| 4887 | "Seconds\n") |
| 4888 | |
| 4889 | ALIAS (ip_ospf_dead_interval, |
| 4890 | ospf_dead_interval_cmd, |
| 4891 | "ospf dead-interval <1-65535>", |
| 4892 | "OSPF interface commands\n" |
| 4893 | "Interval after which a neighbor is declared dead\n" |
| 4894 | "Seconds\n") |
| 4895 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4896 | DEFUN (ip_ospf_dead_interval_minimal, |
| 4897 | ip_ospf_dead_interval_minimal_addr_cmd, |
| 4898 | "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", |
| 4899 | "IP Information\n" |
| 4900 | "OSPF interface commands\n" |
| 4901 | "Interval after which a neighbor is declared dead\n" |
| 4902 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 4903 | "Hello multiplier factor\n" |
| 4904 | "Number of Hellos to send each second\n" |
| 4905 | "Address of interface\n") |
| 4906 | { |
| 4907 | if (argc == 2) |
| 4908 | return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); |
| 4909 | else |
| 4910 | return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); |
| 4911 | } |
| 4912 | |
| 4913 | ALIAS (ip_ospf_dead_interval_minimal, |
| 4914 | ip_ospf_dead_interval_minimal_cmd, |
| 4915 | "ip ospf dead-interval minimal hello-multiplier <1-10>", |
| 4916 | "IP Information\n" |
| 4917 | "OSPF interface commands\n" |
| 4918 | "Interval after which a neighbor is declared dead\n" |
| 4919 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 4920 | "Hello multiplier factor\n" |
| 4921 | "Number of Hellos to send each second\n") |
| 4922 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4923 | DEFUN (no_ip_ospf_dead_interval, |
| 4924 | no_ip_ospf_dead_interval_addr_cmd, |
| 4925 | "no ip ospf dead-interval A.B.C.D", |
| 4926 | NO_STR |
| 4927 | "IP Information\n" |
| 4928 | "OSPF interface commands\n" |
| 4929 | "Interval after which a neighbor is declared dead\n" |
| 4930 | "Address of interface") |
| 4931 | { |
| 4932 | struct interface *ifp = vty->index; |
| 4933 | struct in_addr addr; |
| 4934 | int ret; |
| 4935 | struct ospf_if_params *params; |
| 4936 | struct ospf_interface *oi; |
| 4937 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4938 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4939 | ifp = vty->index; |
| 4940 | params = IF_DEF_PARAMS (ifp); |
| 4941 | |
| 4942 | if (argc == 1) |
| 4943 | { |
| 4944 | ret = inet_aton(argv[0], &addr); |
| 4945 | if (!ret) |
| 4946 | { |
| 4947 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4948 | VTY_NEWLINE); |
| 4949 | return CMD_WARNING; |
| 4950 | } |
| 4951 | |
| 4952 | params = ospf_lookup_if_params (ifp, addr); |
| 4953 | if (params == NULL) |
| 4954 | return CMD_SUCCESS; |
| 4955 | } |
| 4956 | |
| 4957 | UNSET_IF_PARAM (params, v_wait); |
| 4958 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4959 | |
| 4960 | UNSET_IF_PARAM (params, fast_hello); |
| 4961 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 4962 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4963 | if (params != IF_DEF_PARAMS (ifp)) |
| 4964 | { |
| 4965 | ospf_free_if_params (ifp, addr); |
| 4966 | ospf_if_update_params (ifp, addr); |
| 4967 | } |
| 4968 | |
| 4969 | /* Update timer values in neighbor structure. */ |
| 4970 | if (argc == 1) |
| 4971 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4972 | struct ospf *ospf; |
| 4973 | |
| 4974 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4975 | { |
| 4976 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 4977 | if (oi) |
| 4978 | ospf_nbr_timer_update (oi); |
| 4979 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4980 | } |
| 4981 | else |
| 4982 | { |
| 4983 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4984 | if ((oi = rn->info)) |
| 4985 | ospf_nbr_timer_update (oi); |
| 4986 | } |
| 4987 | |
| 4988 | return CMD_SUCCESS; |
| 4989 | } |
| 4990 | |
| 4991 | ALIAS (no_ip_ospf_dead_interval, |
| 4992 | no_ip_ospf_dead_interval_cmd, |
| 4993 | "no ip ospf dead-interval", |
| 4994 | NO_STR |
| 4995 | "IP Information\n" |
| 4996 | "OSPF interface commands\n" |
| 4997 | "Interval after which a neighbor is declared dead\n") |
| 4998 | |
| 4999 | ALIAS (no_ip_ospf_dead_interval, |
| 5000 | no_ospf_dead_interval_cmd, |
| 5001 | "no ospf dead-interval", |
| 5002 | NO_STR |
| 5003 | "OSPF interface commands\n" |
| 5004 | "Interval after which a neighbor is declared dead\n") |
| 5005 | |
| 5006 | DEFUN (ip_ospf_hello_interval, |
| 5007 | ip_ospf_hello_interval_addr_cmd, |
| 5008 | "ip ospf hello-interval <1-65535> A.B.C.D", |
| 5009 | "IP Information\n" |
| 5010 | "OSPF interface commands\n" |
| 5011 | "Time between HELLO packets\n" |
| 5012 | "Seconds\n" |
| 5013 | "Address of interface") |
| 5014 | { |
| 5015 | struct interface *ifp = vty->index; |
| 5016 | u_int32_t seconds; |
| 5017 | struct in_addr addr; |
| 5018 | int ret; |
| 5019 | struct ospf_if_params *params; |
| 5020 | |
| 5021 | params = IF_DEF_PARAMS (ifp); |
| 5022 | |
| 5023 | seconds = strtol (argv[0], NULL, 10); |
| 5024 | |
| 5025 | /* HelloInterval range is <1-65535>. */ |
| 5026 | if (seconds < 1 || seconds > 65535) |
| 5027 | { |
| 5028 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); |
| 5029 | return CMD_WARNING; |
| 5030 | } |
| 5031 | |
| 5032 | if (argc == 2) |
| 5033 | { |
| 5034 | ret = inet_aton(argv[1], &addr); |
| 5035 | if (!ret) |
| 5036 | { |
| 5037 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5038 | VTY_NEWLINE); |
| 5039 | return CMD_WARNING; |
| 5040 | } |
| 5041 | |
| 5042 | params = ospf_get_if_params (ifp, addr); |
| 5043 | ospf_if_update_params (ifp, addr); |
| 5044 | } |
| 5045 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5046 | SET_IF_PARAM (params, v_hello); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5047 | params->v_hello = seconds; |
| 5048 | |
| 5049 | return CMD_SUCCESS; |
| 5050 | } |
| 5051 | |
| 5052 | ALIAS (ip_ospf_hello_interval, |
| 5053 | ip_ospf_hello_interval_cmd, |
| 5054 | "ip ospf hello-interval <1-65535>", |
| 5055 | "IP Information\n" |
| 5056 | "OSPF interface commands\n" |
| 5057 | "Time between HELLO packets\n" |
| 5058 | "Seconds\n") |
| 5059 | |
| 5060 | ALIAS (ip_ospf_hello_interval, |
| 5061 | ospf_hello_interval_cmd, |
| 5062 | "ospf hello-interval <1-65535>", |
| 5063 | "OSPF interface commands\n" |
| 5064 | "Time between HELLO packets\n" |
| 5065 | "Seconds\n") |
| 5066 | |
| 5067 | DEFUN (no_ip_ospf_hello_interval, |
| 5068 | no_ip_ospf_hello_interval_addr_cmd, |
| 5069 | "no ip ospf hello-interval A.B.C.D", |
| 5070 | NO_STR |
| 5071 | "IP Information\n" |
| 5072 | "OSPF interface commands\n" |
| 5073 | "Time between HELLO packets\n" |
| 5074 | "Address of interface") |
| 5075 | { |
| 5076 | struct interface *ifp = vty->index; |
| 5077 | struct in_addr addr; |
| 5078 | int ret; |
| 5079 | struct ospf_if_params *params; |
| 5080 | |
| 5081 | ifp = vty->index; |
| 5082 | params = IF_DEF_PARAMS (ifp); |
| 5083 | |
| 5084 | if (argc == 1) |
| 5085 | { |
| 5086 | ret = inet_aton(argv[0], &addr); |
| 5087 | if (!ret) |
| 5088 | { |
| 5089 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5090 | VTY_NEWLINE); |
| 5091 | return CMD_WARNING; |
| 5092 | } |
| 5093 | |
| 5094 | params = ospf_lookup_if_params (ifp, addr); |
| 5095 | if (params == NULL) |
| 5096 | return CMD_SUCCESS; |
| 5097 | } |
| 5098 | |
| 5099 | UNSET_IF_PARAM (params, v_hello); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5100 | params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5101 | |
| 5102 | if (params != IF_DEF_PARAMS (ifp)) |
| 5103 | { |
| 5104 | ospf_free_if_params (ifp, addr); |
| 5105 | ospf_if_update_params (ifp, addr); |
| 5106 | } |
| 5107 | |
| 5108 | return CMD_SUCCESS; |
| 5109 | } |
| 5110 | |
| 5111 | ALIAS (no_ip_ospf_hello_interval, |
| 5112 | no_ip_ospf_hello_interval_cmd, |
| 5113 | "no ip ospf hello-interval", |
| 5114 | NO_STR |
| 5115 | "IP Information\n" |
| 5116 | "OSPF interface commands\n" |
| 5117 | "Time between HELLO packets\n") |
| 5118 | |
| 5119 | ALIAS (no_ip_ospf_hello_interval, |
| 5120 | no_ospf_hello_interval_cmd, |
| 5121 | "no ospf hello-interval", |
| 5122 | NO_STR |
| 5123 | "OSPF interface commands\n" |
| 5124 | "Time between HELLO packets\n") |
| 5125 | |
| 5126 | DEFUN (ip_ospf_network, |
| 5127 | ip_ospf_network_cmd, |
| 5128 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5129 | "IP Information\n" |
| 5130 | "OSPF interface commands\n" |
| 5131 | "Network type\n" |
| 5132 | "Specify OSPF broadcast multi-access network\n" |
| 5133 | "Specify OSPF NBMA network\n" |
| 5134 | "Specify OSPF point-to-multipoint network\n" |
| 5135 | "Specify OSPF point-to-point network\n") |
| 5136 | { |
| 5137 | struct interface *ifp = vty->index; |
| 5138 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5139 | struct route_node *rn; |
| 5140 | |
| 5141 | if (strncmp (argv[0], "b", 1) == 0) |
| 5142 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; |
| 5143 | else if (strncmp (argv[0], "n", 1) == 0) |
| 5144 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; |
| 5145 | else if (strncmp (argv[0], "point-to-m", 10) == 0) |
| 5146 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; |
| 5147 | else if (strncmp (argv[0], "point-to-p", 10) == 0) |
| 5148 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; |
| 5149 | |
| 5150 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5151 | return CMD_SUCCESS; |
| 5152 | |
| 5153 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); |
| 5154 | |
| 5155 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5156 | { |
| 5157 | struct ospf_interface *oi = rn->info; |
| 5158 | |
| 5159 | if (!oi) |
| 5160 | continue; |
| 5161 | |
| 5162 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5163 | |
| 5164 | if (oi->state > ISM_Down) |
| 5165 | { |
| 5166 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5167 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5168 | } |
| 5169 | } |
| 5170 | |
| 5171 | return CMD_SUCCESS; |
| 5172 | } |
| 5173 | |
| 5174 | ALIAS (ip_ospf_network, |
| 5175 | ospf_network_cmd, |
| 5176 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5177 | "OSPF interface commands\n" |
| 5178 | "Network type\n" |
| 5179 | "Specify OSPF broadcast multi-access network\n" |
| 5180 | "Specify OSPF NBMA network\n" |
| 5181 | "Specify OSPF point-to-multipoint network\n" |
| 5182 | "Specify OSPF point-to-point network\n") |
| 5183 | |
| 5184 | DEFUN (no_ip_ospf_network, |
| 5185 | no_ip_ospf_network_cmd, |
| 5186 | "no ip ospf network", |
| 5187 | NO_STR |
| 5188 | "IP Information\n" |
| 5189 | "OSPF interface commands\n" |
| 5190 | "Network type\n") |
| 5191 | { |
| 5192 | struct interface *ifp = vty->index; |
| 5193 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5194 | struct route_node *rn; |
| 5195 | |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 5196 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5197 | |
| 5198 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5199 | return CMD_SUCCESS; |
| 5200 | |
| 5201 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5202 | { |
| 5203 | struct ospf_interface *oi = rn->info; |
| 5204 | |
| 5205 | if (!oi) |
| 5206 | continue; |
| 5207 | |
| 5208 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5209 | |
| 5210 | if (oi->state > ISM_Down) |
| 5211 | { |
| 5212 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5213 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5214 | } |
| 5215 | } |
| 5216 | |
| 5217 | return CMD_SUCCESS; |
| 5218 | } |
| 5219 | |
| 5220 | ALIAS (no_ip_ospf_network, |
| 5221 | no_ospf_network_cmd, |
| 5222 | "no ospf network", |
| 5223 | NO_STR |
| 5224 | "OSPF interface commands\n" |
| 5225 | "Network type\n") |
| 5226 | |
| 5227 | DEFUN (ip_ospf_priority, |
| 5228 | ip_ospf_priority_addr_cmd, |
| 5229 | "ip ospf priority <0-255> A.B.C.D", |
| 5230 | "IP Information\n" |
| 5231 | "OSPF interface commands\n" |
| 5232 | "Router priority\n" |
| 5233 | "Priority\n" |
| 5234 | "Address of interface") |
| 5235 | { |
| 5236 | struct interface *ifp = vty->index; |
| 5237 | u_int32_t priority; |
| 5238 | struct route_node *rn; |
| 5239 | struct in_addr addr; |
| 5240 | int ret; |
| 5241 | struct ospf_if_params *params; |
| 5242 | |
| 5243 | params = IF_DEF_PARAMS (ifp); |
| 5244 | |
| 5245 | priority = strtol (argv[0], NULL, 10); |
| 5246 | |
| 5247 | /* Router Priority range is <0-255>. */ |
| 5248 | if (priority < 0 || priority > 255) |
| 5249 | { |
| 5250 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); |
| 5251 | return CMD_WARNING; |
| 5252 | } |
| 5253 | |
| 5254 | if (argc == 2) |
| 5255 | { |
| 5256 | ret = inet_aton(argv[1], &addr); |
| 5257 | if (!ret) |
| 5258 | { |
| 5259 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5260 | VTY_NEWLINE); |
| 5261 | return CMD_WARNING; |
| 5262 | } |
| 5263 | |
| 5264 | params = ospf_get_if_params (ifp, addr); |
| 5265 | ospf_if_update_params (ifp, addr); |
| 5266 | } |
| 5267 | |
| 5268 | SET_IF_PARAM (params, priority); |
| 5269 | params->priority = priority; |
| 5270 | |
| 5271 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5272 | { |
| 5273 | struct ospf_interface *oi = rn->info; |
| 5274 | |
| 5275 | if (!oi) |
| 5276 | continue; |
| 5277 | |
| 5278 | |
| 5279 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5280 | { |
| 5281 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5282 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5283 | } |
| 5284 | } |
| 5285 | |
| 5286 | return CMD_SUCCESS; |
| 5287 | } |
| 5288 | |
| 5289 | ALIAS (ip_ospf_priority, |
| 5290 | ip_ospf_priority_cmd, |
| 5291 | "ip ospf priority <0-255>", |
| 5292 | "IP Information\n" |
| 5293 | "OSPF interface commands\n" |
| 5294 | "Router priority\n" |
| 5295 | "Priority\n") |
| 5296 | |
| 5297 | ALIAS (ip_ospf_priority, |
| 5298 | ospf_priority_cmd, |
| 5299 | "ospf priority <0-255>", |
| 5300 | "OSPF interface commands\n" |
| 5301 | "Router priority\n" |
| 5302 | "Priority\n") |
| 5303 | |
| 5304 | DEFUN (no_ip_ospf_priority, |
| 5305 | no_ip_ospf_priority_addr_cmd, |
| 5306 | "no ip ospf priority A.B.C.D", |
| 5307 | NO_STR |
| 5308 | "IP Information\n" |
| 5309 | "OSPF interface commands\n" |
| 5310 | "Router priority\n" |
| 5311 | "Address of interface") |
| 5312 | { |
| 5313 | struct interface *ifp = vty->index; |
| 5314 | struct route_node *rn; |
| 5315 | struct in_addr addr; |
| 5316 | int ret; |
| 5317 | struct ospf_if_params *params; |
| 5318 | |
| 5319 | ifp = vty->index; |
| 5320 | params = IF_DEF_PARAMS (ifp); |
| 5321 | |
| 5322 | if (argc == 1) |
| 5323 | { |
| 5324 | ret = inet_aton(argv[0], &addr); |
| 5325 | if (!ret) |
| 5326 | { |
| 5327 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5328 | VTY_NEWLINE); |
| 5329 | return CMD_WARNING; |
| 5330 | } |
| 5331 | |
| 5332 | params = ospf_lookup_if_params (ifp, addr); |
| 5333 | if (params == NULL) |
| 5334 | return CMD_SUCCESS; |
| 5335 | } |
| 5336 | |
| 5337 | UNSET_IF_PARAM (params, priority); |
| 5338 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; |
| 5339 | |
| 5340 | if (params != IF_DEF_PARAMS (ifp)) |
| 5341 | { |
| 5342 | ospf_free_if_params (ifp, addr); |
| 5343 | ospf_if_update_params (ifp, addr); |
| 5344 | } |
| 5345 | |
| 5346 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5347 | { |
| 5348 | struct ospf_interface *oi = rn->info; |
| 5349 | |
| 5350 | if (!oi) |
| 5351 | continue; |
| 5352 | |
| 5353 | |
| 5354 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5355 | { |
| 5356 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5357 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5358 | } |
| 5359 | } |
| 5360 | |
| 5361 | return CMD_SUCCESS; |
| 5362 | } |
| 5363 | |
| 5364 | ALIAS (no_ip_ospf_priority, |
| 5365 | no_ip_ospf_priority_cmd, |
| 5366 | "no ip ospf priority", |
| 5367 | NO_STR |
| 5368 | "IP Information\n" |
| 5369 | "OSPF interface commands\n" |
| 5370 | "Router priority\n") |
| 5371 | |
| 5372 | ALIAS (no_ip_ospf_priority, |
| 5373 | no_ospf_priority_cmd, |
| 5374 | "no ospf priority", |
| 5375 | NO_STR |
| 5376 | "OSPF interface commands\n" |
| 5377 | "Router priority\n") |
| 5378 | |
| 5379 | DEFUN (ip_ospf_retransmit_interval, |
| 5380 | ip_ospf_retransmit_interval_addr_cmd, |
| 5381 | "ip ospf retransmit-interval <3-65535> A.B.C.D", |
| 5382 | "IP Information\n" |
| 5383 | "OSPF interface commands\n" |
| 5384 | "Time between retransmitting lost link state advertisements\n" |
| 5385 | "Seconds\n" |
| 5386 | "Address of interface") |
| 5387 | { |
| 5388 | struct interface *ifp = vty->index; |
| 5389 | u_int32_t seconds; |
| 5390 | struct in_addr addr; |
| 5391 | int ret; |
| 5392 | struct ospf_if_params *params; |
| 5393 | |
| 5394 | params = IF_DEF_PARAMS (ifp); |
| 5395 | seconds = strtol (argv[0], NULL, 10); |
| 5396 | |
| 5397 | /* Retransmit Interval range is <3-65535>. */ |
| 5398 | if (seconds < 3 || seconds > 65535) |
| 5399 | { |
| 5400 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); |
| 5401 | return CMD_WARNING; |
| 5402 | } |
| 5403 | |
| 5404 | |
| 5405 | if (argc == 2) |
| 5406 | { |
| 5407 | ret = inet_aton(argv[1], &addr); |
| 5408 | if (!ret) |
| 5409 | { |
| 5410 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5411 | VTY_NEWLINE); |
| 5412 | return CMD_WARNING; |
| 5413 | } |
| 5414 | |
| 5415 | params = ospf_get_if_params (ifp, addr); |
| 5416 | ospf_if_update_params (ifp, addr); |
| 5417 | } |
| 5418 | |
| 5419 | SET_IF_PARAM (params, retransmit_interval); |
| 5420 | params->retransmit_interval = seconds; |
| 5421 | |
| 5422 | return CMD_SUCCESS; |
| 5423 | } |
| 5424 | |
| 5425 | ALIAS (ip_ospf_retransmit_interval, |
| 5426 | ip_ospf_retransmit_interval_cmd, |
| 5427 | "ip ospf retransmit-interval <3-65535>", |
| 5428 | "IP Information\n" |
| 5429 | "OSPF interface commands\n" |
| 5430 | "Time between retransmitting lost link state advertisements\n" |
| 5431 | "Seconds\n") |
| 5432 | |
| 5433 | ALIAS (ip_ospf_retransmit_interval, |
| 5434 | ospf_retransmit_interval_cmd, |
| 5435 | "ospf retransmit-interval <3-65535>", |
| 5436 | "OSPF interface commands\n" |
| 5437 | "Time between retransmitting lost link state advertisements\n" |
| 5438 | "Seconds\n") |
| 5439 | |
| 5440 | DEFUN (no_ip_ospf_retransmit_interval, |
| 5441 | no_ip_ospf_retransmit_interval_addr_cmd, |
| 5442 | "no ip ospf retransmit-interval A.B.C.D", |
| 5443 | NO_STR |
| 5444 | "IP Information\n" |
| 5445 | "OSPF interface commands\n" |
| 5446 | "Time between retransmitting lost link state advertisements\n" |
| 5447 | "Address of interface") |
| 5448 | { |
| 5449 | struct interface *ifp = vty->index; |
| 5450 | struct in_addr addr; |
| 5451 | int ret; |
| 5452 | struct ospf_if_params *params; |
| 5453 | |
| 5454 | ifp = vty->index; |
| 5455 | params = IF_DEF_PARAMS (ifp); |
| 5456 | |
| 5457 | if (argc == 1) |
| 5458 | { |
| 5459 | ret = inet_aton(argv[0], &addr); |
| 5460 | if (!ret) |
| 5461 | { |
| 5462 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5463 | VTY_NEWLINE); |
| 5464 | return CMD_WARNING; |
| 5465 | } |
| 5466 | |
| 5467 | params = ospf_lookup_if_params (ifp, addr); |
| 5468 | if (params == NULL) |
| 5469 | return CMD_SUCCESS; |
| 5470 | } |
| 5471 | |
| 5472 | UNSET_IF_PARAM (params, retransmit_interval); |
| 5473 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 5474 | |
| 5475 | if (params != IF_DEF_PARAMS (ifp)) |
| 5476 | { |
| 5477 | ospf_free_if_params (ifp, addr); |
| 5478 | ospf_if_update_params (ifp, addr); |
| 5479 | } |
| 5480 | |
| 5481 | return CMD_SUCCESS; |
| 5482 | } |
| 5483 | |
| 5484 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5485 | no_ip_ospf_retransmit_interval_cmd, |
| 5486 | "no ip ospf retransmit-interval", |
| 5487 | NO_STR |
| 5488 | "IP Information\n" |
| 5489 | "OSPF interface commands\n" |
| 5490 | "Time between retransmitting lost link state advertisements\n") |
| 5491 | |
| 5492 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5493 | no_ospf_retransmit_interval_cmd, |
| 5494 | "no ospf retransmit-interval", |
| 5495 | NO_STR |
| 5496 | "OSPF interface commands\n" |
| 5497 | "Time between retransmitting lost link state advertisements\n") |
| 5498 | |
| 5499 | DEFUN (ip_ospf_transmit_delay, |
| 5500 | ip_ospf_transmit_delay_addr_cmd, |
| 5501 | "ip ospf transmit-delay <1-65535> A.B.C.D", |
| 5502 | "IP Information\n" |
| 5503 | "OSPF interface commands\n" |
| 5504 | "Link state transmit delay\n" |
| 5505 | "Seconds\n" |
| 5506 | "Address of interface") |
| 5507 | { |
| 5508 | struct interface *ifp = vty->index; |
| 5509 | u_int32_t seconds; |
| 5510 | struct in_addr addr; |
| 5511 | int ret; |
| 5512 | struct ospf_if_params *params; |
| 5513 | |
| 5514 | params = IF_DEF_PARAMS (ifp); |
| 5515 | seconds = strtol (argv[0], NULL, 10); |
| 5516 | |
| 5517 | /* Transmit Delay range is <1-65535>. */ |
| 5518 | if (seconds < 1 || seconds > 65535) |
| 5519 | { |
| 5520 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); |
| 5521 | return CMD_WARNING; |
| 5522 | } |
| 5523 | |
| 5524 | if (argc == 2) |
| 5525 | { |
| 5526 | ret = inet_aton(argv[1], &addr); |
| 5527 | if (!ret) |
| 5528 | { |
| 5529 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5530 | VTY_NEWLINE); |
| 5531 | return CMD_WARNING; |
| 5532 | } |
| 5533 | |
| 5534 | params = ospf_get_if_params (ifp, addr); |
| 5535 | ospf_if_update_params (ifp, addr); |
| 5536 | } |
| 5537 | |
| 5538 | SET_IF_PARAM (params, transmit_delay); |
| 5539 | params->transmit_delay = seconds; |
| 5540 | |
| 5541 | return CMD_SUCCESS; |
| 5542 | } |
| 5543 | |
| 5544 | ALIAS (ip_ospf_transmit_delay, |
| 5545 | ip_ospf_transmit_delay_cmd, |
| 5546 | "ip ospf transmit-delay <1-65535>", |
| 5547 | "IP Information\n" |
| 5548 | "OSPF interface commands\n" |
| 5549 | "Link state transmit delay\n" |
| 5550 | "Seconds\n") |
| 5551 | |
| 5552 | ALIAS (ip_ospf_transmit_delay, |
| 5553 | ospf_transmit_delay_cmd, |
| 5554 | "ospf transmit-delay <1-65535>", |
| 5555 | "OSPF interface commands\n" |
| 5556 | "Link state transmit delay\n" |
| 5557 | "Seconds\n") |
| 5558 | |
| 5559 | DEFUN (no_ip_ospf_transmit_delay, |
| 5560 | no_ip_ospf_transmit_delay_addr_cmd, |
| 5561 | "no ip ospf transmit-delay A.B.C.D", |
| 5562 | NO_STR |
| 5563 | "IP Information\n" |
| 5564 | "OSPF interface commands\n" |
| 5565 | "Link state transmit delay\n" |
| 5566 | "Address of interface") |
| 5567 | { |
| 5568 | struct interface *ifp = vty->index; |
| 5569 | struct in_addr addr; |
| 5570 | int ret; |
| 5571 | struct ospf_if_params *params; |
| 5572 | |
| 5573 | ifp = vty->index; |
| 5574 | params = IF_DEF_PARAMS (ifp); |
| 5575 | |
| 5576 | if (argc == 1) |
| 5577 | { |
| 5578 | ret = inet_aton(argv[0], &addr); |
| 5579 | if (!ret) |
| 5580 | { |
| 5581 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5582 | VTY_NEWLINE); |
| 5583 | return CMD_WARNING; |
| 5584 | } |
| 5585 | |
| 5586 | params = ospf_lookup_if_params (ifp, addr); |
| 5587 | if (params == NULL) |
| 5588 | return CMD_SUCCESS; |
| 5589 | } |
| 5590 | |
| 5591 | UNSET_IF_PARAM (params, transmit_delay); |
| 5592 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 5593 | |
| 5594 | if (params != IF_DEF_PARAMS (ifp)) |
| 5595 | { |
| 5596 | ospf_free_if_params (ifp, addr); |
| 5597 | ospf_if_update_params (ifp, addr); |
| 5598 | } |
| 5599 | |
| 5600 | return CMD_SUCCESS; |
| 5601 | } |
| 5602 | |
| 5603 | ALIAS (no_ip_ospf_transmit_delay, |
| 5604 | no_ip_ospf_transmit_delay_cmd, |
| 5605 | "no ip ospf transmit-delay", |
| 5606 | NO_STR |
| 5607 | "IP Information\n" |
| 5608 | "OSPF interface commands\n" |
| 5609 | "Link state transmit delay\n") |
| 5610 | |
| 5611 | ALIAS (no_ip_ospf_transmit_delay, |
| 5612 | no_ospf_transmit_delay_cmd, |
| 5613 | "no ospf transmit-delay", |
| 5614 | NO_STR |
| 5615 | "OSPF interface commands\n" |
| 5616 | "Link state transmit delay\n") |
| 5617 | |
| 5618 | |
| 5619 | DEFUN (ospf_redistribute_source_metric_type, |
| 5620 | ospf_redistribute_source_metric_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5621 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5622 | " metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5623 | REDIST_STR |
| 5624 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5625 | "Metric for redistributed routes\n" |
| 5626 | "OSPF default metric\n" |
| 5627 | "OSPF exterior metric type for redistributed routes\n" |
| 5628 | "Set OSPF External Type 1 metrics\n" |
| 5629 | "Set OSPF External Type 2 metrics\n" |
| 5630 | "Route map reference\n" |
| 5631 | "Pointer to route-map entries\n") |
| 5632 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5633 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5634 | int source; |
| 5635 | int type = -1; |
| 5636 | int metric = -1; |
| 5637 | |
| 5638 | /* Get distribute source. */ |
| 5639 | if (!str2distribute_source (argv[0], &source)) |
| 5640 | return CMD_WARNING; |
| 5641 | |
| 5642 | /* Get metric value. */ |
| 5643 | if (argc >= 2) |
| 5644 | if (!str2metric (argv[1], &metric)) |
| 5645 | return CMD_WARNING; |
| 5646 | |
| 5647 | /* Get metric type. */ |
| 5648 | if (argc >= 3) |
| 5649 | if (!str2metric_type (argv[2], &type)) |
| 5650 | return CMD_WARNING; |
| 5651 | |
| 5652 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5653 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5654 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5655 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5656 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5657 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5658 | } |
| 5659 | |
| 5660 | ALIAS (ospf_redistribute_source_metric_type, |
| 5661 | ospf_redistribute_source_metric_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5662 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5663 | " metric <0-16777214> metric-type (1|2)", |
| 5664 | REDIST_STR |
| 5665 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5666 | "Metric for redistributed routes\n" |
| 5667 | "OSPF default metric\n" |
| 5668 | "OSPF exterior metric type for redistributed routes\n" |
| 5669 | "Set OSPF External Type 1 metrics\n" |
| 5670 | "Set OSPF External Type 2 metrics\n") |
| 5671 | |
| 5672 | ALIAS (ospf_redistribute_source_metric_type, |
| 5673 | ospf_redistribute_source_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5674 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric <0-16777214>", |
| 5675 | REDIST_STR |
| 5676 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5677 | "Metric for redistributed routes\n" |
| 5678 | "OSPF default metric\n") |
| 5679 | |
| 5680 | DEFUN (ospf_redistribute_source_type_metric, |
| 5681 | ospf_redistribute_source_type_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5682 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5683 | " metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5684 | REDIST_STR |
| 5685 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 | "Metric for redistributed routes\n" |
| 5690 | "OSPF default metric\n" |
| 5691 | "Route map reference\n" |
| 5692 | "Pointer to route-map entries\n") |
| 5693 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5694 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5695 | int source; |
| 5696 | int type = -1; |
| 5697 | int metric = -1; |
| 5698 | |
| 5699 | /* Get distribute source. */ |
| 5700 | if (!str2distribute_source (argv[0], &source)) |
| 5701 | return CMD_WARNING; |
| 5702 | |
| 5703 | /* Get metric value. */ |
| 5704 | if (argc >= 2) |
| 5705 | if (!str2metric_type (argv[1], &type)) |
| 5706 | return CMD_WARNING; |
| 5707 | |
| 5708 | /* Get metric type. */ |
| 5709 | if (argc >= 3) |
| 5710 | if (!str2metric (argv[2], &metric)) |
| 5711 | return CMD_WARNING; |
| 5712 | |
| 5713 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5714 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5715 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5716 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5717 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5718 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5719 | } |
| 5720 | |
| 5721 | ALIAS (ospf_redistribute_source_type_metric, |
| 5722 | ospf_redistribute_source_type_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5723 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5724 | " metric-type (1|2) metric <0-16777214>", |
| 5725 | REDIST_STR |
| 5726 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5727 | "OSPF exterior metric type for redistributed routes\n" |
| 5728 | "Set OSPF External Type 1 metrics\n" |
| 5729 | "Set OSPF External Type 2 metrics\n" |
| 5730 | "Metric for redistributed routes\n" |
| 5731 | "OSPF default metric\n") |
| 5732 | |
| 5733 | ALIAS (ospf_redistribute_source_type_metric, |
| 5734 | ospf_redistribute_source_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5735 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric-type (1|2)", |
| 5736 | REDIST_STR |
| 5737 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5738 | "OSPF exterior metric type for redistributed routes\n" |
| 5739 | "Set OSPF External Type 1 metrics\n" |
| 5740 | "Set OSPF External Type 2 metrics\n") |
| 5741 | |
| 5742 | ALIAS (ospf_redistribute_source_type_metric, |
| 5743 | ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5744 | "redistribute " QUAGGA_REDIST_STR_OSPFD, |
| 5745 | REDIST_STR |
| 5746 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5747 | |
| 5748 | DEFUN (ospf_redistribute_source_metric_routemap, |
| 5749 | ospf_redistribute_source_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5750 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5751 | " metric <0-16777214> route-map WORD", |
| 5752 | REDIST_STR |
| 5753 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5754 | "Metric for redistributed routes\n" |
| 5755 | "OSPF default metric\n" |
| 5756 | "Route map reference\n" |
| 5757 | "Pointer to route-map entries\n") |
| 5758 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5759 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5760 | int source; |
| 5761 | int metric = -1; |
| 5762 | |
| 5763 | /* Get distribute source. */ |
| 5764 | if (!str2distribute_source (argv[0], &source)) |
| 5765 | return CMD_WARNING; |
| 5766 | |
| 5767 | /* Get metric value. */ |
| 5768 | if (argc >= 2) |
| 5769 | if (!str2metric (argv[1], &metric)) |
| 5770 | return CMD_WARNING; |
| 5771 | |
| 5772 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5773 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5774 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5775 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5776 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5777 | return ospf_redistribute_set (ospf, source, -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5778 | } |
| 5779 | |
| 5780 | DEFUN (ospf_redistribute_source_type_routemap, |
| 5781 | ospf_redistribute_source_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5782 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5783 | " metric-type (1|2) route-map WORD", |
| 5784 | REDIST_STR |
| 5785 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5786 | "OSPF exterior metric type for redistributed routes\n" |
| 5787 | "Set OSPF External Type 1 metrics\n" |
| 5788 | "Set OSPF External Type 2 metrics\n" |
| 5789 | "Route map reference\n" |
| 5790 | "Pointer to route-map entries\n") |
| 5791 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5792 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5793 | int source; |
| 5794 | int type = -1; |
| 5795 | |
| 5796 | /* Get distribute source. */ |
| 5797 | if (!str2distribute_source (argv[0], &source)) |
| 5798 | return CMD_WARNING; |
| 5799 | |
| 5800 | /* Get metric value. */ |
| 5801 | if (argc >= 2) |
| 5802 | if (!str2metric_type (argv[1], &type)) |
| 5803 | return CMD_WARNING; |
| 5804 | |
| 5805 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5806 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5807 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5808 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5809 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5810 | return ospf_redistribute_set (ospf, source, type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5811 | } |
| 5812 | |
| 5813 | DEFUN (ospf_redistribute_source_routemap, |
| 5814 | ospf_redistribute_source_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5815 | "redistribute " QUAGGA_REDIST_STR_OSPFD " route-map WORD", |
| 5816 | REDIST_STR |
| 5817 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5818 | "Route map reference\n" |
| 5819 | "Pointer to route-map entries\n") |
| 5820 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5821 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5822 | int source; |
| 5823 | |
| 5824 | /* Get distribute source. */ |
| 5825 | if (!str2distribute_source (argv[0], &source)) |
| 5826 | return CMD_WARNING; |
| 5827 | |
| 5828 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5829 | ospf_routemap_set (ospf, source, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5830 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5831 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5832 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5833 | return ospf_redistribute_set (ospf, source, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5834 | } |
| 5835 | |
| 5836 | DEFUN (no_ospf_redistribute_source, |
| 5837 | no_ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5838 | "no redistribute " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5839 | NO_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5840 | REDIST_STR |
| 5841 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5842 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5843 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5844 | int source; |
| 5845 | |
| 5846 | if (!str2distribute_source (argv[0], &source)) |
| 5847 | return CMD_WARNING; |
| 5848 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5849 | ospf_routemap_unset (ospf, source); |
| 5850 | return ospf_redistribute_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5851 | } |
| 5852 | |
| 5853 | DEFUN (ospf_distribute_list_out, |
| 5854 | ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5855 | "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5856 | "Filter networks in routing updates\n" |
| 5857 | "Access-list name\n" |
| 5858 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5859 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5860 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5861 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5862 | int source; |
| 5863 | |
| 5864 | /* Get distribute source. */ |
| 5865 | if (!str2distribute_source (argv[1], &source)) |
| 5866 | return CMD_WARNING; |
| 5867 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5868 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5869 | } |
| 5870 | |
| 5871 | DEFUN (no_ospf_distribute_list_out, |
| 5872 | no_ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5873 | "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5874 | NO_STR |
| 5875 | "Filter networks in routing updates\n" |
| 5876 | "Access-list name\n" |
| 5877 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5878 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5879 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5880 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5881 | int source; |
| 5882 | |
| 5883 | if (!str2distribute_source (argv[1], &source)) |
| 5884 | return CMD_WARNING; |
| 5885 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5886 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5887 | } |
| 5888 | |
| 5889 | /* Default information originate. */ |
| 5890 | DEFUN (ospf_default_information_originate_metric_type_routemap, |
| 5891 | ospf_default_information_originate_metric_type_routemap_cmd, |
| 5892 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5893 | "Control distribution of default information\n" |
| 5894 | "Distribute a default route\n" |
| 5895 | "OSPF default metric\n" |
| 5896 | "OSPF metric\n" |
| 5897 | "OSPF metric type for default routes\n" |
| 5898 | "Set OSPF External Type 1 metrics\n" |
| 5899 | "Set OSPF External Type 2 metrics\n" |
| 5900 | "Route map reference\n" |
| 5901 | "Pointer to route-map entries\n") |
| 5902 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5903 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5904 | int type = -1; |
| 5905 | int metric = -1; |
| 5906 | |
| 5907 | /* Get metric value. */ |
| 5908 | if (argc >= 1) |
| 5909 | if (!str2metric (argv[0], &metric)) |
| 5910 | return CMD_WARNING; |
| 5911 | |
| 5912 | /* Get metric type. */ |
| 5913 | if (argc >= 2) |
| 5914 | if (!str2metric_type (argv[1], &type)) |
| 5915 | return CMD_WARNING; |
| 5916 | |
| 5917 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5918 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5919 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5920 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5921 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5922 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5923 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5924 | } |
| 5925 | |
| 5926 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5927 | ospf_default_information_originate_metric_type_cmd, |
| 5928 | "default-information originate metric <0-16777214> metric-type (1|2)", |
| 5929 | "Control distribution of default information\n" |
| 5930 | "Distribute a default route\n" |
| 5931 | "OSPF default metric\n" |
| 5932 | "OSPF metric\n" |
| 5933 | "OSPF metric type for default routes\n" |
| 5934 | "Set OSPF External Type 1 metrics\n" |
| 5935 | "Set OSPF External Type 2 metrics\n") |
| 5936 | |
| 5937 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5938 | ospf_default_information_originate_metric_cmd, |
| 5939 | "default-information originate metric <0-16777214>", |
| 5940 | "Control distribution of default information\n" |
| 5941 | "Distribute a default route\n" |
| 5942 | "OSPF default metric\n" |
| 5943 | "OSPF metric\n") |
| 5944 | |
| 5945 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5946 | ospf_default_information_originate_cmd, |
| 5947 | "default-information originate", |
| 5948 | "Control distribution of default information\n" |
| 5949 | "Distribute a default route\n") |
| 5950 | |
| 5951 | /* Default information originate. */ |
| 5952 | DEFUN (ospf_default_information_originate_metric_routemap, |
| 5953 | ospf_default_information_originate_metric_routemap_cmd, |
| 5954 | "default-information originate metric <0-16777214> route-map WORD", |
| 5955 | "Control distribution of default information\n" |
| 5956 | "Distribute a default route\n" |
| 5957 | "OSPF default metric\n" |
| 5958 | "OSPF metric\n" |
| 5959 | "Route map reference\n" |
| 5960 | "Pointer to route-map entries\n") |
| 5961 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5962 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5963 | int metric = -1; |
| 5964 | |
| 5965 | /* Get metric value. */ |
| 5966 | if (argc >= 1) |
| 5967 | if (!str2metric (argv[0], &metric)) |
| 5968 | return CMD_WARNING; |
| 5969 | |
| 5970 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5971 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5972 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5973 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5974 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5975 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5976 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5977 | } |
| 5978 | |
| 5979 | /* Default information originate. */ |
| 5980 | DEFUN (ospf_default_information_originate_routemap, |
| 5981 | ospf_default_information_originate_routemap_cmd, |
| 5982 | "default-information originate route-map WORD", |
| 5983 | "Control distribution of default information\n" |
| 5984 | "Distribute a default route\n" |
| 5985 | "Route map reference\n" |
| 5986 | "Pointer to route-map entries\n") |
| 5987 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5988 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5989 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5990 | if (argc == 1) |
| 5991 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 5992 | else |
| 5993 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 5994 | |
| 5995 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5996 | } |
| 5997 | |
| 5998 | DEFUN (ospf_default_information_originate_type_metric_routemap, |
| 5999 | ospf_default_information_originate_type_metric_routemap_cmd, |
| 6000 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6001 | "Control distribution of default information\n" |
| 6002 | "Distribute a default route\n" |
| 6003 | "OSPF metric type for default routes\n" |
| 6004 | "Set OSPF External Type 1 metrics\n" |
| 6005 | "Set OSPF External Type 2 metrics\n" |
| 6006 | "OSPF default metric\n" |
| 6007 | "OSPF metric\n" |
| 6008 | "Route map reference\n" |
| 6009 | "Pointer to route-map entries\n") |
| 6010 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6011 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6012 | int type = -1; |
| 6013 | int metric = -1; |
| 6014 | |
| 6015 | /* Get metric type. */ |
| 6016 | if (argc >= 1) |
| 6017 | if (!str2metric_type (argv[0], &type)) |
| 6018 | return CMD_WARNING; |
| 6019 | |
| 6020 | /* Get metric value. */ |
| 6021 | if (argc >= 2) |
| 6022 | if (!str2metric (argv[1], &metric)) |
| 6023 | return CMD_WARNING; |
| 6024 | |
| 6025 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6026 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6027 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6028 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6029 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6030 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6031 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6032 | } |
| 6033 | |
| 6034 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6035 | ospf_default_information_originate_type_metric_cmd, |
| 6036 | "default-information originate metric-type (1|2) metric <0-16777214>", |
| 6037 | "Control distribution of default information\n" |
| 6038 | "Distribute a default route\n" |
| 6039 | "OSPF metric type for default routes\n" |
| 6040 | "Set OSPF External Type 1 metrics\n" |
| 6041 | "Set OSPF External Type 2 metrics\n" |
| 6042 | "OSPF default metric\n" |
| 6043 | "OSPF metric\n") |
| 6044 | |
| 6045 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6046 | ospf_default_information_originate_type_cmd, |
| 6047 | "default-information originate metric-type (1|2)", |
| 6048 | "Control distribution of default information\n" |
| 6049 | "Distribute a default route\n" |
| 6050 | "OSPF metric type for default routes\n" |
| 6051 | "Set OSPF External Type 1 metrics\n" |
| 6052 | "Set OSPF External Type 2 metrics\n") |
| 6053 | |
| 6054 | DEFUN (ospf_default_information_originate_type_routemap, |
| 6055 | ospf_default_information_originate_type_routemap_cmd, |
| 6056 | "default-information originate metric-type (1|2) route-map WORD", |
| 6057 | "Control distribution of default information\n" |
| 6058 | "Distribute a default route\n" |
| 6059 | "OSPF metric type for default routes\n" |
| 6060 | "Set OSPF External Type 1 metrics\n" |
| 6061 | "Set OSPF External Type 2 metrics\n" |
| 6062 | "Route map reference\n" |
| 6063 | "Pointer to route-map entries\n") |
| 6064 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6065 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6066 | int type = -1; |
| 6067 | |
| 6068 | /* Get metric type. */ |
| 6069 | if (argc >= 1) |
| 6070 | if (!str2metric_type (argv[0], &type)) |
| 6071 | return CMD_WARNING; |
| 6072 | |
| 6073 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6074 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6075 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6076 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6077 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6078 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6079 | type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6080 | } |
| 6081 | |
| 6082 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, |
| 6083 | ospf_default_information_originate_always_metric_type_routemap_cmd, |
| 6084 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6085 | "Control distribution of default information\n" |
| 6086 | "Distribute a default route\n" |
| 6087 | "Always advertise default route\n" |
| 6088 | "OSPF default metric\n" |
| 6089 | "OSPF metric\n" |
| 6090 | "OSPF metric type for default routes\n" |
| 6091 | "Set OSPF External Type 1 metrics\n" |
| 6092 | "Set OSPF External Type 2 metrics\n" |
| 6093 | "Route map reference\n" |
| 6094 | "Pointer to route-map entries\n") |
| 6095 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6096 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6097 | int type = -1; |
| 6098 | int metric = -1; |
| 6099 | |
| 6100 | /* Get metric value. */ |
| 6101 | if (argc >= 1) |
| 6102 | if (!str2metric (argv[0], &metric)) |
| 6103 | return CMD_WARNING; |
| 6104 | |
| 6105 | /* Get metric type. */ |
| 6106 | if (argc >= 2) |
| 6107 | if (!str2metric_type (argv[1], &type)) |
| 6108 | return CMD_WARNING; |
| 6109 | |
| 6110 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6111 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6112 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6113 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6114 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6115 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6116 | type, metric); |
| 6117 | } |
| 6118 | |
| 6119 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6120 | ospf_default_information_originate_always_metric_type_cmd, |
| 6121 | "default-information originate always metric <0-16777214> metric-type (1|2)", |
| 6122 | "Control distribution of default information\n" |
| 6123 | "Distribute a default route\n" |
| 6124 | "Always advertise default route\n" |
| 6125 | "OSPF default metric\n" |
| 6126 | "OSPF metric\n" |
| 6127 | "OSPF metric type for default routes\n" |
| 6128 | "Set OSPF External Type 1 metrics\n" |
| 6129 | "Set OSPF External Type 2 metrics\n") |
| 6130 | |
| 6131 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6132 | ospf_default_information_originate_always_metric_cmd, |
| 6133 | "default-information originate always metric <0-16777214>", |
| 6134 | "Control distribution of default information\n" |
| 6135 | "Distribute a default route\n" |
| 6136 | "Always advertise default route\n" |
| 6137 | "OSPF default metric\n" |
| 6138 | "OSPF metric\n" |
| 6139 | "OSPF metric type for default routes\n") |
| 6140 | |
| 6141 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6142 | ospf_default_information_originate_always_cmd, |
| 6143 | "default-information originate always", |
| 6144 | "Control distribution of default information\n" |
| 6145 | "Distribute a default route\n" |
| 6146 | "Always advertise default route\n") |
| 6147 | |
| 6148 | DEFUN (ospf_default_information_originate_always_metric_routemap, |
| 6149 | ospf_default_information_originate_always_metric_routemap_cmd, |
| 6150 | "default-information originate always metric <0-16777214> route-map WORD", |
| 6151 | "Control distribution of default information\n" |
| 6152 | "Distribute a default route\n" |
| 6153 | "Always advertise default route\n" |
| 6154 | "OSPF default metric\n" |
| 6155 | "OSPF metric\n" |
| 6156 | "Route map reference\n" |
| 6157 | "Pointer to route-map entries\n") |
| 6158 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6159 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6160 | int metric = -1; |
| 6161 | |
| 6162 | /* Get metric value. */ |
| 6163 | if (argc >= 1) |
| 6164 | if (!str2metric (argv[0], &metric)) |
| 6165 | return CMD_WARNING; |
| 6166 | |
| 6167 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6168 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6169 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6170 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6171 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6172 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
| 6173 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6174 | } |
| 6175 | |
| 6176 | DEFUN (ospf_default_information_originate_always_routemap, |
| 6177 | ospf_default_information_originate_always_routemap_cmd, |
| 6178 | "default-information originate always route-map WORD", |
| 6179 | "Control distribution of default information\n" |
| 6180 | "Distribute a default route\n" |
| 6181 | "Always advertise default route\n" |
| 6182 | "Route map reference\n" |
| 6183 | "Pointer to route-map entries\n") |
| 6184 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6185 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6186 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6187 | if (argc == 1) |
| 6188 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6189 | else |
| 6190 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6191 | |
| 6192 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6193 | } |
| 6194 | |
| 6195 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, |
| 6196 | ospf_default_information_originate_always_type_metric_routemap_cmd, |
| 6197 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6198 | "Control distribution of default information\n" |
| 6199 | "Distribute a default route\n" |
| 6200 | "Always advertise default route\n" |
| 6201 | "OSPF metric type for default routes\n" |
| 6202 | "Set OSPF External Type 1 metrics\n" |
| 6203 | "Set OSPF External Type 2 metrics\n" |
| 6204 | "OSPF default metric\n" |
| 6205 | "OSPF metric\n" |
| 6206 | "Route map reference\n" |
| 6207 | "Pointer to route-map entries\n") |
| 6208 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6209 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6210 | int type = -1; |
| 6211 | int metric = -1; |
| 6212 | |
| 6213 | /* Get metric type. */ |
| 6214 | if (argc >= 1) |
| 6215 | if (!str2metric_type (argv[0], &type)) |
| 6216 | return CMD_WARNING; |
| 6217 | |
| 6218 | /* Get metric value. */ |
| 6219 | if (argc >= 2) |
| 6220 | if (!str2metric (argv[1], &metric)) |
| 6221 | return CMD_WARNING; |
| 6222 | |
| 6223 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6224 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6225 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6226 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6227 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6228 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6229 | type, metric); |
| 6230 | } |
| 6231 | |
| 6232 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6233 | ospf_default_information_originate_always_type_metric_cmd, |
| 6234 | "default-information originate always metric-type (1|2) metric <0-16777214>", |
| 6235 | "Control distribution of default information\n" |
| 6236 | "Distribute a default route\n" |
| 6237 | "Always advertise default route\n" |
| 6238 | "OSPF metric type for default routes\n" |
| 6239 | "Set OSPF External Type 1 metrics\n" |
| 6240 | "Set OSPF External Type 2 metrics\n" |
| 6241 | "OSPF default metric\n" |
| 6242 | "OSPF metric\n") |
| 6243 | |
| 6244 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6245 | ospf_default_information_originate_always_type_cmd, |
| 6246 | "default-information originate always metric-type (1|2)", |
| 6247 | "Control distribution of default information\n" |
| 6248 | "Distribute a default route\n" |
| 6249 | "Always advertise default route\n" |
| 6250 | "OSPF metric type for default routes\n" |
| 6251 | "Set OSPF External Type 1 metrics\n" |
| 6252 | "Set OSPF External Type 2 metrics\n") |
| 6253 | |
| 6254 | DEFUN (ospf_default_information_originate_always_type_routemap, |
| 6255 | ospf_default_information_originate_always_type_routemap_cmd, |
| 6256 | "default-information originate always metric-type (1|2) route-map WORD", |
| 6257 | "Control distribution of default information\n" |
| 6258 | "Distribute a default route\n" |
| 6259 | "Always advertise default route\n" |
| 6260 | "OSPF metric type for default routes\n" |
| 6261 | "Set OSPF External Type 1 metrics\n" |
| 6262 | "Set OSPF External Type 2 metrics\n" |
| 6263 | "Route map reference\n" |
| 6264 | "Pointer to route-map entries\n") |
| 6265 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6266 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6267 | int type = -1; |
| 6268 | |
| 6269 | /* Get metric type. */ |
| 6270 | if (argc >= 1) |
| 6271 | if (!str2metric_type (argv[0], &type)) |
| 6272 | return CMD_WARNING; |
| 6273 | |
| 6274 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6275 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6276 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6277 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6278 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6279 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6280 | type, -1); |
| 6281 | } |
| 6282 | |
| 6283 | DEFUN (no_ospf_default_information_originate, |
| 6284 | no_ospf_default_information_originate_cmd, |
| 6285 | "no default-information originate", |
| 6286 | NO_STR |
| 6287 | "Control distribution of default information\n" |
| 6288 | "Distribute a default route\n") |
| 6289 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6290 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6291 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6292 | |
| 6293 | p.family = AF_INET; |
| 6294 | p.prefix.s_addr = 0; |
| 6295 | p.prefixlen = 0; |
| 6296 | |
ajs | 5339cfd | 2005-09-19 13:28:05 +0000 | [diff] [blame] | 6297 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6298 | |
| 6299 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { |
| 6300 | ospf_external_info_delete (DEFAULT_ROUTE, p); |
| 6301 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); |
| 6302 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; |
| 6303 | } |
| 6304 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6305 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6306 | return ospf_redistribute_default_unset (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6307 | } |
| 6308 | |
| 6309 | DEFUN (ospf_default_metric, |
| 6310 | ospf_default_metric_cmd, |
| 6311 | "default-metric <0-16777214>", |
| 6312 | "Set metric of redistributed routes\n" |
| 6313 | "Default metric\n") |
| 6314 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6315 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6316 | int metric = -1; |
| 6317 | |
| 6318 | if (!str2metric (argv[0], &metric)) |
| 6319 | return CMD_WARNING; |
| 6320 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6321 | ospf->default_metric = metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6322 | |
| 6323 | return CMD_SUCCESS; |
| 6324 | } |
| 6325 | |
| 6326 | DEFUN (no_ospf_default_metric, |
| 6327 | no_ospf_default_metric_cmd, |
| 6328 | "no default-metric", |
| 6329 | NO_STR |
| 6330 | "Set metric of redistributed routes\n") |
| 6331 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6332 | struct ospf *ospf = vty->index; |
| 6333 | |
| 6334 | ospf->default_metric = -1; |
| 6335 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6336 | return CMD_SUCCESS; |
| 6337 | } |
| 6338 | |
| 6339 | ALIAS (no_ospf_default_metric, |
| 6340 | no_ospf_default_metric_val_cmd, |
| 6341 | "no default-metric <0-16777214>", |
| 6342 | NO_STR |
| 6343 | "Set metric of redistributed routes\n" |
| 6344 | "Default metric\n") |
| 6345 | |
| 6346 | DEFUN (ospf_distance, |
| 6347 | ospf_distance_cmd, |
| 6348 | "distance <1-255>", |
| 6349 | "Define an administrative distance\n" |
| 6350 | "OSPF Administrative distance\n") |
| 6351 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6352 | struct ospf *ospf = vty->index; |
| 6353 | |
| 6354 | ospf->distance_all = atoi (argv[0]); |
| 6355 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6356 | return CMD_SUCCESS; |
| 6357 | } |
| 6358 | |
| 6359 | DEFUN (no_ospf_distance, |
| 6360 | no_ospf_distance_cmd, |
| 6361 | "no distance <1-255>", |
| 6362 | NO_STR |
| 6363 | "Define an administrative distance\n" |
| 6364 | "OSPF Administrative distance\n") |
| 6365 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6366 | struct ospf *ospf = vty->index; |
| 6367 | |
| 6368 | ospf->distance_all = 0; |
| 6369 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6370 | return CMD_SUCCESS; |
| 6371 | } |
| 6372 | |
| 6373 | DEFUN (no_ospf_distance_ospf, |
| 6374 | no_ospf_distance_ospf_cmd, |
| 6375 | "no distance ospf", |
| 6376 | NO_STR |
| 6377 | "Define an administrative distance\n" |
| 6378 | "OSPF Administrative distance\n" |
| 6379 | "OSPF Distance\n") |
| 6380 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6381 | struct ospf *ospf = vty->index; |
| 6382 | |
| 6383 | ospf->distance_intra = 0; |
| 6384 | ospf->distance_inter = 0; |
| 6385 | ospf->distance_external = 0; |
| 6386 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6387 | return CMD_SUCCESS; |
| 6388 | } |
| 6389 | |
| 6390 | DEFUN (ospf_distance_ospf_intra, |
| 6391 | ospf_distance_ospf_intra_cmd, |
| 6392 | "distance ospf intra-area <1-255>", |
| 6393 | "Define an administrative distance\n" |
| 6394 | "OSPF Administrative distance\n" |
| 6395 | "Intra-area routes\n" |
| 6396 | "Distance for intra-area routes\n") |
| 6397 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6398 | struct ospf *ospf = vty->index; |
| 6399 | |
| 6400 | ospf->distance_intra = atoi (argv[0]); |
| 6401 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6402 | return CMD_SUCCESS; |
| 6403 | } |
| 6404 | |
| 6405 | DEFUN (ospf_distance_ospf_intra_inter, |
| 6406 | ospf_distance_ospf_intra_inter_cmd, |
| 6407 | "distance ospf intra-area <1-255> inter-area <1-255>", |
| 6408 | "Define an administrative distance\n" |
| 6409 | "OSPF Administrative distance\n" |
| 6410 | "Intra-area routes\n" |
| 6411 | "Distance for intra-area routes\n" |
| 6412 | "Inter-area routes\n" |
| 6413 | "Distance for inter-area routes\n") |
| 6414 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6415 | struct ospf *ospf = vty->index; |
| 6416 | |
| 6417 | ospf->distance_intra = atoi (argv[0]); |
| 6418 | ospf->distance_inter = atoi (argv[1]); |
| 6419 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6420 | return CMD_SUCCESS; |
| 6421 | } |
| 6422 | |
| 6423 | DEFUN (ospf_distance_ospf_intra_external, |
| 6424 | ospf_distance_ospf_intra_external_cmd, |
| 6425 | "distance ospf intra-area <1-255> external <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 | "External routes\n" |
| 6431 | "Distance for external routes\n") |
| 6432 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6433 | struct ospf *ospf = vty->index; |
| 6434 | |
| 6435 | ospf->distance_intra = atoi (argv[0]); |
| 6436 | ospf->distance_external = atoi (argv[1]); |
| 6437 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6438 | return CMD_SUCCESS; |
| 6439 | } |
| 6440 | |
| 6441 | DEFUN (ospf_distance_ospf_intra_inter_external, |
| 6442 | ospf_distance_ospf_intra_inter_external_cmd, |
| 6443 | "distance ospf intra-area <1-255> inter-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 | "Inter-area routes\n" |
| 6449 | "Distance for inter-area routes\n" |
| 6450 | "External routes\n" |
| 6451 | "Distance for external routes\n") |
| 6452 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6453 | struct ospf *ospf = vty->index; |
| 6454 | |
| 6455 | ospf->distance_intra = atoi (argv[0]); |
| 6456 | ospf->distance_inter = atoi (argv[1]); |
| 6457 | ospf->distance_external = atoi (argv[2]); |
| 6458 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6459 | return CMD_SUCCESS; |
| 6460 | } |
| 6461 | |
| 6462 | DEFUN (ospf_distance_ospf_intra_external_inter, |
| 6463 | ospf_distance_ospf_intra_external_inter_cmd, |
| 6464 | "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>", |
| 6465 | "Define an administrative distance\n" |
| 6466 | "OSPF Administrative distance\n" |
| 6467 | "Intra-area routes\n" |
| 6468 | "Distance for intra-area routes\n" |
| 6469 | "External routes\n" |
| 6470 | "Distance for external routes\n" |
| 6471 | "Inter-area routes\n" |
| 6472 | "Distance for inter-area routes\n") |
| 6473 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6474 | struct ospf *ospf = vty->index; |
| 6475 | |
| 6476 | ospf->distance_intra = atoi (argv[0]); |
| 6477 | ospf->distance_external = atoi (argv[1]); |
| 6478 | ospf->distance_inter = atoi (argv[2]); |
| 6479 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6480 | return CMD_SUCCESS; |
| 6481 | } |
| 6482 | |
| 6483 | DEFUN (ospf_distance_ospf_inter, |
| 6484 | ospf_distance_ospf_inter_cmd, |
| 6485 | "distance ospf inter-area <1-255>", |
| 6486 | "Define an administrative distance\n" |
| 6487 | "OSPF Administrative distance\n" |
| 6488 | "Inter-area routes\n" |
| 6489 | "Distance for inter-area routes\n") |
| 6490 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6491 | struct ospf *ospf = vty->index; |
| 6492 | |
| 6493 | ospf->distance_inter = atoi (argv[0]); |
| 6494 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6495 | return CMD_SUCCESS; |
| 6496 | } |
| 6497 | |
| 6498 | DEFUN (ospf_distance_ospf_inter_intra, |
| 6499 | ospf_distance_ospf_inter_intra_cmd, |
| 6500 | "distance ospf inter-area <1-255> intra-area <1-255>", |
| 6501 | "Define an administrative distance\n" |
| 6502 | "OSPF Administrative distance\n" |
| 6503 | "Inter-area routes\n" |
| 6504 | "Distance for inter-area routes\n" |
| 6505 | "Intra-area routes\n" |
| 6506 | "Distance for intra-area routes\n") |
| 6507 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6508 | struct ospf *ospf = vty->index; |
| 6509 | |
| 6510 | ospf->distance_inter = atoi (argv[0]); |
| 6511 | ospf->distance_intra = atoi (argv[1]); |
| 6512 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6513 | return CMD_SUCCESS; |
| 6514 | } |
| 6515 | |
| 6516 | DEFUN (ospf_distance_ospf_inter_external, |
| 6517 | ospf_distance_ospf_inter_external_cmd, |
| 6518 | "distance ospf inter-area <1-255> external <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 | "External routes\n" |
| 6524 | "Distance for external routes\n") |
| 6525 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6526 | struct ospf *ospf = vty->index; |
| 6527 | |
| 6528 | ospf->distance_inter = atoi (argv[0]); |
| 6529 | ospf->distance_external = atoi (argv[1]); |
| 6530 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6531 | return CMD_SUCCESS; |
| 6532 | } |
| 6533 | |
| 6534 | DEFUN (ospf_distance_ospf_inter_intra_external, |
| 6535 | ospf_distance_ospf_inter_intra_external_cmd, |
| 6536 | "distance ospf inter-area <1-255> intra-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 | "Intra-area routes\n" |
| 6542 | "Distance for intra-area routes\n" |
| 6543 | "External routes\n" |
| 6544 | "Distance for external routes\n") |
| 6545 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6546 | struct ospf *ospf = vty->index; |
| 6547 | |
| 6548 | ospf->distance_inter = atoi (argv[0]); |
| 6549 | ospf->distance_intra = atoi (argv[1]); |
| 6550 | ospf->distance_external = atoi (argv[2]); |
| 6551 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6552 | return CMD_SUCCESS; |
| 6553 | } |
| 6554 | |
| 6555 | DEFUN (ospf_distance_ospf_inter_external_intra, |
| 6556 | ospf_distance_ospf_inter_external_intra_cmd, |
| 6557 | "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>", |
| 6558 | "Define an administrative distance\n" |
| 6559 | "OSPF Administrative distance\n" |
| 6560 | "Inter-area routes\n" |
| 6561 | "Distance for inter-area routes\n" |
| 6562 | "External routes\n" |
| 6563 | "Distance for external routes\n" |
| 6564 | "Intra-area routes\n" |
| 6565 | "Distance for intra-area routes\n") |
| 6566 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6567 | struct ospf *ospf = vty->index; |
| 6568 | |
| 6569 | ospf->distance_inter = atoi (argv[0]); |
| 6570 | ospf->distance_external = atoi (argv[1]); |
| 6571 | ospf->distance_intra = atoi (argv[2]); |
| 6572 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6573 | return CMD_SUCCESS; |
| 6574 | } |
| 6575 | |
| 6576 | DEFUN (ospf_distance_ospf_external, |
| 6577 | ospf_distance_ospf_external_cmd, |
| 6578 | "distance ospf external <1-255>", |
| 6579 | "Define an administrative distance\n" |
| 6580 | "OSPF Administrative distance\n" |
| 6581 | "External routes\n" |
| 6582 | "Distance for external routes\n") |
| 6583 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6584 | struct ospf *ospf = vty->index; |
| 6585 | |
| 6586 | ospf->distance_external = atoi (argv[0]); |
| 6587 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6588 | return CMD_SUCCESS; |
| 6589 | } |
| 6590 | |
| 6591 | DEFUN (ospf_distance_ospf_external_intra, |
| 6592 | ospf_distance_ospf_external_intra_cmd, |
| 6593 | "distance ospf external <1-255> intra-area <1-255>", |
| 6594 | "Define an administrative distance\n" |
| 6595 | "OSPF Administrative distance\n" |
| 6596 | "External routes\n" |
| 6597 | "Distance for external routes\n" |
| 6598 | "Intra-area routes\n" |
| 6599 | "Distance for intra-area routes\n") |
| 6600 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6601 | struct ospf *ospf = vty->index; |
| 6602 | |
| 6603 | ospf->distance_external = atoi (argv[0]); |
| 6604 | ospf->distance_intra = atoi (argv[1]); |
| 6605 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6606 | return CMD_SUCCESS; |
| 6607 | } |
| 6608 | |
| 6609 | DEFUN (ospf_distance_ospf_external_inter, |
| 6610 | ospf_distance_ospf_external_inter_cmd, |
| 6611 | "distance ospf external <1-255> inter-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 | "Inter-area routes\n" |
| 6617 | "Distance for inter-area routes\n") |
| 6618 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6619 | struct ospf *ospf = vty->index; |
| 6620 | |
| 6621 | ospf->distance_external = atoi (argv[0]); |
| 6622 | ospf->distance_inter = atoi (argv[1]); |
| 6623 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6624 | return CMD_SUCCESS; |
| 6625 | } |
| 6626 | |
| 6627 | DEFUN (ospf_distance_ospf_external_intra_inter, |
| 6628 | ospf_distance_ospf_external_intra_inter_cmd, |
| 6629 | "distance ospf external <1-255> intra-area <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 | "Intra-area routes\n" |
| 6635 | "Distance for intra-area routes\n" |
| 6636 | "Inter-area routes\n" |
| 6637 | "Distance for inter-area routes\n") |
| 6638 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6639 | struct ospf *ospf = vty->index; |
| 6640 | |
| 6641 | ospf->distance_external = atoi (argv[0]); |
| 6642 | ospf->distance_intra = atoi (argv[1]); |
| 6643 | ospf->distance_inter = atoi (argv[2]); |
| 6644 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6645 | return CMD_SUCCESS; |
| 6646 | } |
| 6647 | |
| 6648 | DEFUN (ospf_distance_ospf_external_inter_intra, |
| 6649 | ospf_distance_ospf_external_inter_intra_cmd, |
| 6650 | "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>", |
| 6651 | "Define an administrative distance\n" |
| 6652 | "OSPF Administrative distance\n" |
| 6653 | "External routes\n" |
| 6654 | "Distance for external routes\n" |
| 6655 | "Inter-area routes\n" |
| 6656 | "Distance for inter-area routes\n" |
| 6657 | "Intra-area routes\n" |
| 6658 | "Distance for intra-area routes\n") |
| 6659 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6660 | struct ospf *ospf = vty->index; |
| 6661 | |
| 6662 | ospf->distance_external = atoi (argv[0]); |
| 6663 | ospf->distance_inter = atoi (argv[1]); |
| 6664 | ospf->distance_intra = atoi (argv[2]); |
| 6665 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6666 | return CMD_SUCCESS; |
| 6667 | } |
| 6668 | |
| 6669 | DEFUN (ospf_distance_source, |
| 6670 | ospf_distance_source_cmd, |
| 6671 | "distance <1-255> A.B.C.D/M", |
| 6672 | "Administrative distance\n" |
| 6673 | "Distance value\n" |
| 6674 | "IP source prefix\n") |
| 6675 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6676 | struct ospf *ospf = vty->index; |
| 6677 | |
| 6678 | ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6679 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6680 | return CMD_SUCCESS; |
| 6681 | } |
| 6682 | |
| 6683 | DEFUN (no_ospf_distance_source, |
| 6684 | no_ospf_distance_source_cmd, |
| 6685 | "no distance <1-255> A.B.C.D/M", |
| 6686 | NO_STR |
| 6687 | "Administrative distance\n" |
| 6688 | "Distance value\n" |
| 6689 | "IP source prefix\n") |
| 6690 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6691 | struct ospf *ospf = vty->index; |
| 6692 | |
| 6693 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); |
| 6694 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6695 | return CMD_SUCCESS; |
| 6696 | } |
| 6697 | |
| 6698 | DEFUN (ospf_distance_source_access_list, |
| 6699 | ospf_distance_source_access_list_cmd, |
| 6700 | "distance <1-255> A.B.C.D/M WORD", |
| 6701 | "Administrative distance\n" |
| 6702 | "Distance value\n" |
| 6703 | "IP source prefix\n" |
| 6704 | "Access list name\n") |
| 6705 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6706 | struct ospf *ospf = vty->index; |
| 6707 | |
| 6708 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); |
| 6709 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6710 | return CMD_SUCCESS; |
| 6711 | } |
| 6712 | |
| 6713 | DEFUN (no_ospf_distance_source_access_list, |
| 6714 | no_ospf_distance_source_access_list_cmd, |
| 6715 | "no distance <1-255> A.B.C.D/M WORD", |
| 6716 | NO_STR |
| 6717 | "Administrative distance\n" |
| 6718 | "Distance value\n" |
| 6719 | "IP source prefix\n" |
| 6720 | "Access list name\n") |
| 6721 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6722 | struct ospf *ospf = vty->index; |
| 6723 | |
| 6724 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); |
| 6725 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6726 | return CMD_SUCCESS; |
| 6727 | } |
| 6728 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 6729 | DEFUN (ip_ospf_mtu_ignore, |
| 6730 | ip_ospf_mtu_ignore_addr_cmd, |
| 6731 | "ip ospf mtu-ignore A.B.C.D", |
| 6732 | "IP Information\n" |
| 6733 | "OSPF interface commands\n" |
| 6734 | "Disable mtu mismatch detection\n" |
| 6735 | "Address of interface") |
| 6736 | { |
| 6737 | struct interface *ifp = vty->index; |
| 6738 | struct in_addr addr; |
| 6739 | int ret; |
| 6740 | |
| 6741 | struct ospf_if_params *params; |
| 6742 | params = IF_DEF_PARAMS (ifp); |
| 6743 | |
| 6744 | if (argc == 1) |
| 6745 | { |
| 6746 | ret = inet_aton(argv[0], &addr); |
| 6747 | if (!ret) |
| 6748 | { |
| 6749 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6750 | VTY_NEWLINE); |
| 6751 | return CMD_WARNING; |
| 6752 | } |
| 6753 | params = ospf_get_if_params (ifp, addr); |
| 6754 | ospf_if_update_params (ifp, addr); |
| 6755 | } |
| 6756 | params->mtu_ignore = 1; |
| 6757 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6758 | SET_IF_PARAM (params, mtu_ignore); |
| 6759 | else |
| 6760 | { |
| 6761 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6762 | if (params != IF_DEF_PARAMS (ifp)) |
| 6763 | { |
| 6764 | ospf_free_if_params (ifp, addr); |
| 6765 | ospf_if_update_params (ifp, addr); |
| 6766 | } |
| 6767 | } |
| 6768 | return CMD_SUCCESS; |
| 6769 | } |
| 6770 | |
| 6771 | ALIAS (ip_ospf_mtu_ignore, |
| 6772 | ip_ospf_mtu_ignore_cmd, |
| 6773 | "ip ospf mtu-ignore", |
| 6774 | "IP Information\n" |
| 6775 | "OSPF interface commands\n" |
| 6776 | "Disable mtu mismatch detection\n") |
| 6777 | |
| 6778 | |
| 6779 | DEFUN (no_ip_ospf_mtu_ignore, |
| 6780 | no_ip_ospf_mtu_ignore_addr_cmd, |
| 6781 | "no ip ospf mtu-ignore A.B.C.D", |
| 6782 | "IP Information\n" |
| 6783 | "OSPF interface commands\n" |
| 6784 | "Disable mtu mismatch detection\n" |
| 6785 | "Address of interface") |
| 6786 | { |
| 6787 | struct interface *ifp = vty->index; |
| 6788 | struct in_addr addr; |
| 6789 | int ret; |
| 6790 | |
| 6791 | struct ospf_if_params *params; |
| 6792 | params = IF_DEF_PARAMS (ifp); |
| 6793 | |
| 6794 | if (argc == 1) |
| 6795 | { |
| 6796 | ret = inet_aton(argv[0], &addr); |
| 6797 | if (!ret) |
| 6798 | { |
| 6799 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6800 | VTY_NEWLINE); |
| 6801 | return CMD_WARNING; |
| 6802 | } |
| 6803 | params = ospf_get_if_params (ifp, addr); |
| 6804 | ospf_if_update_params (ifp, addr); |
| 6805 | } |
| 6806 | params->mtu_ignore = 0; |
| 6807 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6808 | SET_IF_PARAM (params, mtu_ignore); |
| 6809 | else |
| 6810 | { |
| 6811 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6812 | if (params != IF_DEF_PARAMS (ifp)) |
| 6813 | { |
| 6814 | ospf_free_if_params (ifp, addr); |
| 6815 | ospf_if_update_params (ifp, addr); |
| 6816 | } |
| 6817 | } |
| 6818 | return CMD_SUCCESS; |
| 6819 | } |
| 6820 | |
| 6821 | ALIAS (no_ip_ospf_mtu_ignore, |
| 6822 | no_ip_ospf_mtu_ignore_cmd, |
| 6823 | "no ip ospf mtu-ignore", |
| 6824 | "IP Information\n" |
| 6825 | "OSPF interface commands\n" |
| 6826 | "Disable mtu mismatch detection\n") |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 6827 | |
| 6828 | DEFUN (ospf_max_metric_router_lsa_admin, |
| 6829 | ospf_max_metric_router_lsa_admin_cmd, |
| 6830 | "max-metric router-lsa administrative", |
| 6831 | "OSPF maximum / infinite-distance metric\n" |
| 6832 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 6833 | "Administratively applied, for an indefinite period\n") |
| 6834 | { |
| 6835 | struct listnode *ln; |
| 6836 | struct ospf_area *area; |
| 6837 | struct ospf *ospf = vty->index; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 6838 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 6839 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 6840 | { |
| 6841 | SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 6842 | |
| 6843 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
| 6844 | ospf_router_lsa_timer_add (area); |
| 6845 | } |
| 6846 | return CMD_SUCCESS; |
| 6847 | } |
| 6848 | |
| 6849 | DEFUN (no_ospf_max_metric_router_lsa_admin, |
| 6850 | no_ospf_max_metric_router_lsa_admin_cmd, |
| 6851 | "no max-metric router-lsa administrative", |
| 6852 | NO_STR |
| 6853 | "OSPF maximum / infinite-distance metric\n" |
| 6854 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 6855 | "Administratively applied, for an indefinite period\n") |
| 6856 | { |
| 6857 | struct listnode *ln; |
| 6858 | struct ospf_area *area; |
| 6859 | struct ospf *ospf = vty->index; |
| 6860 | |
| 6861 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 6862 | { |
| 6863 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 6864 | |
| 6865 | /* Don't trample on the start-up stub timer */ |
| 6866 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED) |
| 6867 | && !area->t_stub_router) |
| 6868 | { |
| 6869 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
| 6870 | ospf_router_lsa_timer_add (area); |
| 6871 | } |
| 6872 | } |
| 6873 | return CMD_SUCCESS; |
| 6874 | } |
| 6875 | |
| 6876 | DEFUN (ospf_max_metric_router_lsa_startup, |
| 6877 | ospf_max_metric_router_lsa_startup_cmd, |
| 6878 | "max-metric router-lsa on-startup <5-86400>", |
| 6879 | "OSPF maximum / infinite-distance metric\n" |
| 6880 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 6881 | "Automatically advertise stub Router-LSA on startup of OSPF\n" |
| 6882 | "Time (seconds) to advertise self as stub-router\n") |
| 6883 | { |
| 6884 | unsigned int seconds; |
| 6885 | struct ospf *ospf = vty->index; |
| 6886 | |
| 6887 | if (argc != 1) |
| 6888 | { |
| 6889 | vty_out (vty, "%% Must supply stub-router period"); |
| 6890 | return CMD_WARNING; |
| 6891 | } |
| 6892 | |
| 6893 | VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); |
| 6894 | |
| 6895 | ospf->stub_router_startup_time = seconds; |
| 6896 | |
| 6897 | return CMD_SUCCESS; |
| 6898 | } |
| 6899 | |
| 6900 | DEFUN (no_ospf_max_metric_router_lsa_startup, |
| 6901 | no_ospf_max_metric_router_lsa_startup_cmd, |
| 6902 | "no max-metric router-lsa on-startup", |
| 6903 | NO_STR |
| 6904 | "OSPF maximum / infinite-distance metric\n" |
| 6905 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 6906 | "Automatically advertise stub Router-LSA on startup of OSPF\n") |
| 6907 | { |
| 6908 | struct listnode *ln; |
| 6909 | struct ospf_area *area; |
| 6910 | struct ospf *ospf = vty->index; |
| 6911 | |
| 6912 | ospf->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 6913 | |
| 6914 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 6915 | { |
| 6916 | SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED); |
| 6917 | OSPF_TIMER_OFF (area->t_stub_router); |
| 6918 | |
| 6919 | /* Don't trample on admin stub routed */ |
| 6920 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 6921 | { |
| 6922 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
| 6923 | ospf_router_lsa_timer_add (area); |
| 6924 | } |
| 6925 | } |
| 6926 | return CMD_SUCCESS; |
| 6927 | } |
| 6928 | |
| 6929 | DEFUN (ospf_max_metric_router_lsa_shutdown, |
| 6930 | ospf_max_metric_router_lsa_shutdown_cmd, |
| 6931 | "max-metric router-lsa on-shutdown <5-86400>", |
| 6932 | "OSPF maximum / infinite-distance metric\n" |
| 6933 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 6934 | "Advertise stub-router prior to full shutdown of OSPF\n" |
| 6935 | "Time (seconds) to wait till full shutdown\n") |
| 6936 | { |
| 6937 | unsigned int seconds; |
| 6938 | struct ospf *ospf = vty->index; |
| 6939 | |
| 6940 | if (argc != 1) |
| 6941 | { |
| 6942 | vty_out (vty, "%% Must supply stub-router shutdown period"); |
| 6943 | return CMD_WARNING; |
| 6944 | } |
| 6945 | |
| 6946 | VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); |
| 6947 | |
| 6948 | ospf->stub_router_shutdown_time = seconds; |
| 6949 | |
| 6950 | return CMD_SUCCESS; |
| 6951 | } |
| 6952 | |
| 6953 | DEFUN (no_ospf_max_metric_router_lsa_shutdown, |
| 6954 | no_ospf_max_metric_router_lsa_shutdown_cmd, |
| 6955 | "no max-metric router-lsa on-shutdown", |
| 6956 | NO_STR |
| 6957 | "OSPF maximum / infinite-distance metric\n" |
| 6958 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 6959 | "Advertise stub-router prior to full shutdown of OSPF\n") |
| 6960 | { |
| 6961 | struct ospf *ospf = vty->index; |
| 6962 | |
| 6963 | ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 6964 | |
| 6965 | return CMD_SUCCESS; |
| 6966 | } |
| 6967 | |
| 6968 | static void |
| 6969 | config_write_stub_router (struct vty *vty, struct ospf *ospf) |
| 6970 | { |
| 6971 | struct listnode *ln; |
| 6972 | struct ospf_area *area; |
| 6973 | |
| 6974 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 6975 | vty_out (vty, " max-metric router-lsa on-startup %u%s", |
| 6976 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 6977 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 6978 | vty_out (vty, " max-metric router-lsa on-shutdown %u%s", |
| 6979 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 6980 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 6981 | { |
| 6982 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 6983 | { |
| 6984 | vty_out (vty, " max-metric router-lsa administrative%s", |
| 6985 | VTY_NEWLINE); |
| 6986 | break; |
| 6987 | } |
| 6988 | } |
| 6989 | return; |
| 6990 | } |
| 6991 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6992 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6993 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
| 6994 | { |
| 6995 | struct route_node *rn; |
| 6996 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6997 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6998 | struct ospf_path *path; |
| 6999 | |
| 7000 | vty_out (vty, "============ OSPF network routing table ============%s", |
| 7001 | VTY_NEWLINE); |
| 7002 | |
| 7003 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7004 | if ((or = rn->info) != NULL) |
| 7005 | { |
| 7006 | char buf1[19]; |
| 7007 | snprintf (buf1, 19, "%s/%d", |
| 7008 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7009 | |
| 7010 | switch (or->path_type) |
| 7011 | { |
| 7012 | case OSPF_PATH_INTER_AREA: |
| 7013 | if (or->type == OSPF_DESTINATION_NETWORK) |
| 7014 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, |
| 7015 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7016 | else if (or->type == OSPF_DESTINATION_DISCARD) |
| 7017 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); |
| 7018 | break; |
| 7019 | case OSPF_PATH_INTRA_AREA: |
| 7020 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, |
| 7021 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7022 | break; |
| 7023 | default: |
| 7024 | break; |
| 7025 | } |
| 7026 | |
| 7027 | if (or->type == OSPF_DESTINATION_NETWORK) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7028 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7029 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7030 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7031 | { |
| 7032 | if (path->nexthop.s_addr == 0) |
| 7033 | vty_out (vty, "%24s directly attached to %s%s", |
| 7034 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 7035 | else |
| 7036 | vty_out (vty, "%24s via %s, %s%s", "", |
| 7037 | inet_ntoa (path->nexthop), path->oi->ifp->name, |
| 7038 | VTY_NEWLINE); |
| 7039 | } |
| 7040 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7041 | } |
| 7042 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7043 | } |
| 7044 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7045 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7046 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
| 7047 | { |
| 7048 | struct route_node *rn; |
| 7049 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7050 | struct listnode *pnode; |
| 7051 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7052 | struct ospf_path *path; |
| 7053 | |
| 7054 | vty_out (vty, "============ OSPF router routing table =============%s", |
| 7055 | VTY_NEWLINE); |
| 7056 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) |
| 7057 | if (rn->info) |
| 7058 | { |
| 7059 | int flag = 0; |
| 7060 | |
| 7061 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); |
| 7062 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7063 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
| 7064 | { |
| 7065 | if (flag++) |
| 7066 | vty_out (vty, "%24s", ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7067 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7068 | /* Show path. */ |
| 7069 | vty_out (vty, "%s [%d] area: %s", |
| 7070 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), |
| 7071 | or->cost, inet_ntoa (or->u.std.area_id)); |
| 7072 | /* Show flags. */ |
| 7073 | vty_out (vty, "%s%s%s", |
| 7074 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), |
| 7075 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), |
| 7076 | VTY_NEWLINE); |
| 7077 | |
| 7078 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) |
| 7079 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7080 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
| 7081 | { |
| 7082 | if (path->nexthop.s_addr == 0) |
| 7083 | vty_out (vty, "%24s directly attached to %s%s", |
| 7084 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 7085 | else |
| 7086 | vty_out (vty, "%24s via %s, %s%s", "", |
| 7087 | inet_ntoa (path->nexthop), |
| 7088 | path->oi->ifp->name, VTY_NEWLINE); |
| 7089 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7090 | } |
| 7091 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7092 | } |
| 7093 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7094 | } |
| 7095 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7096 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7097 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
| 7098 | { |
| 7099 | struct route_node *rn; |
| 7100 | struct ospf_route *er; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7101 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7102 | struct ospf_path *path; |
| 7103 | |
| 7104 | vty_out (vty, "============ OSPF external routing table ===========%s", |
| 7105 | VTY_NEWLINE); |
| 7106 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7107 | if ((er = rn->info) != NULL) |
| 7108 | { |
| 7109 | char buf1[19]; |
| 7110 | snprintf (buf1, 19, "%s/%d", |
| 7111 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7112 | |
| 7113 | switch (er->path_type) |
| 7114 | { |
| 7115 | case OSPF_PATH_TYPE1_EXTERNAL: |
| 7116 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, |
| 7117 | er->cost, er->u.ext.tag, VTY_NEWLINE); |
| 7118 | break; |
| 7119 | case OSPF_PATH_TYPE2_EXTERNAL: |
| 7120 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, |
| 7121 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); |
| 7122 | break; |
| 7123 | } |
| 7124 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7125 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7126 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7127 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7128 | { |
| 7129 | if (path->nexthop.s_addr == 0) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7130 | vty_out (vty, "%24s directly attached to %s%s", |
| 7131 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 7132 | else |
| 7133 | vty_out (vty, "%24s via %s, %s%s", "", |
| 7134 | inet_ntoa (path->nexthop), path->oi->ifp->name, |
| 7135 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7136 | } |
| 7137 | } |
| 7138 | } |
| 7139 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7140 | } |
| 7141 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7142 | DEFUN (show_ip_ospf_border_routers, |
| 7143 | show_ip_ospf_border_routers_cmd, |
| 7144 | "show ip ospf border-routers", |
| 7145 | SHOW_STR |
| 7146 | IP_STR |
| 7147 | "show all the ABR's and ASBR's\n" |
| 7148 | "for this area\n") |
| 7149 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7150 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7151 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7152 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7153 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7154 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7155 | return CMD_SUCCESS; |
| 7156 | } |
| 7157 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7158 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7159 | { |
| 7160 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7161 | return CMD_SUCCESS; |
| 7162 | } |
| 7163 | |
| 7164 | /* Show Network routes. |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7165 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7166 | |
| 7167 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7168 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7169 | |
| 7170 | return CMD_SUCCESS; |
| 7171 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7172 | |
| 7173 | DEFUN (show_ip_ospf_route, |
| 7174 | show_ip_ospf_route_cmd, |
| 7175 | "show ip ospf route", |
| 7176 | SHOW_STR |
| 7177 | IP_STR |
| 7178 | "OSPF information\n" |
| 7179 | "OSPF routing table\n") |
| 7180 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7181 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7182 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7183 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7184 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7185 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7186 | return CMD_SUCCESS; |
| 7187 | } |
| 7188 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7189 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7190 | { |
| 7191 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7192 | return CMD_SUCCESS; |
| 7193 | } |
| 7194 | |
| 7195 | /* Show Network routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7196 | show_ip_ospf_route_network (vty, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7197 | |
| 7198 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7199 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7200 | |
| 7201 | /* Show AS External routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7202 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7203 | |
| 7204 | return CMD_SUCCESS; |
| 7205 | } |
| 7206 | |
| 7207 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7208 | const char *ospf_abr_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7209 | { |
| 7210 | "unknown", |
| 7211 | "standard", |
| 7212 | "ibm", |
| 7213 | "cisco", |
| 7214 | "shortcut" |
| 7215 | }; |
| 7216 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7217 | const char *ospf_shortcut_mode_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7218 | { |
| 7219 | "default", |
| 7220 | "enable", |
| 7221 | "disable" |
| 7222 | }; |
| 7223 | |
| 7224 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7225 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7226 | area_id2str (char *buf, int length, struct ospf_area *area) |
| 7227 | { |
| 7228 | memset (buf, 0, length); |
| 7229 | |
| 7230 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 7231 | strncpy (buf, inet_ntoa (area->area_id), length); |
| 7232 | else |
| 7233 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); |
| 7234 | } |
| 7235 | |
| 7236 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7237 | const char *ospf_int_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7238 | { |
| 7239 | "unknown", /* should never be used. */ |
| 7240 | "point-to-point", |
| 7241 | "broadcast", |
| 7242 | "non-broadcast", |
| 7243 | "point-to-multipoint", |
| 7244 | "virtual-link", /* should never be used. */ |
| 7245 | "loopback" |
| 7246 | }; |
| 7247 | |
| 7248 | /* Configuration write function for ospfd. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7249 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7250 | config_write_interface (struct vty *vty) |
| 7251 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7252 | struct listnode *n1, *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7253 | struct interface *ifp; |
| 7254 | struct crypt_key *ck; |
| 7255 | int write = 0; |
| 7256 | struct route_node *rn = NULL; |
| 7257 | struct ospf_if_params *params; |
| 7258 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7259 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7260 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7261 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
| 7262 | continue; |
| 7263 | |
| 7264 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 7265 | vty_out (vty, "interface %s%s", ifp->name, |
| 7266 | VTY_NEWLINE); |
| 7267 | if (ifp->desc) |
| 7268 | vty_out (vty, " description %s%s", ifp->desc, |
| 7269 | VTY_NEWLINE); |
| 7270 | |
| 7271 | write++; |
| 7272 | |
| 7273 | params = IF_DEF_PARAMS (ifp); |
| 7274 | |
| 7275 | do { |
| 7276 | /* Interface Network print. */ |
| 7277 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7278 | params->type != OSPF_IFTYPE_LOOPBACK) |
| 7279 | { |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 7280 | if (params->type != ospf_default_iftype(ifp)) |
hasso | 7b90143 | 2004-08-31 13:37:42 +0000 | [diff] [blame] | 7281 | { |
| 7282 | vty_out (vty, " ip ospf network %s", |
| 7283 | ospf_int_type_str[params->type]); |
| 7284 | if (params != IF_DEF_PARAMS (ifp)) |
| 7285 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7286 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7287 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7288 | } |
| 7289 | |
| 7290 | /* OSPF interface authentication print */ |
| 7291 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && |
| 7292 | params->auth_type != OSPF_AUTH_NOTSET) |
| 7293 | { |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7294 | const char *auth_str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7295 | |
| 7296 | /* Translation tables are not that much help here due to syntax |
| 7297 | of the simple option */ |
| 7298 | switch (params->auth_type) |
| 7299 | { |
| 7300 | |
| 7301 | case OSPF_AUTH_NULL: |
| 7302 | auth_str = " null"; |
| 7303 | break; |
| 7304 | |
| 7305 | case OSPF_AUTH_SIMPLE: |
| 7306 | auth_str = ""; |
| 7307 | break; |
| 7308 | |
| 7309 | case OSPF_AUTH_CRYPTOGRAPHIC: |
| 7310 | auth_str = " message-digest"; |
| 7311 | break; |
| 7312 | |
| 7313 | default: |
| 7314 | auth_str = ""; |
| 7315 | break; |
| 7316 | } |
| 7317 | |
| 7318 | vty_out (vty, " ip ospf authentication%s", auth_str); |
| 7319 | if (params != IF_DEF_PARAMS (ifp)) |
| 7320 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7321 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7322 | } |
| 7323 | |
| 7324 | /* Simple Authentication Password print. */ |
| 7325 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && |
| 7326 | params->auth_simple[0] != '\0') |
| 7327 | { |
| 7328 | vty_out (vty, " ip ospf authentication-key %s", |
| 7329 | params->auth_simple); |
| 7330 | if (params != IF_DEF_PARAMS (ifp)) |
| 7331 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7332 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7333 | } |
| 7334 | |
| 7335 | /* Cryptographic Authentication Key print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7336 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7337 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7338 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
| 7339 | ck->key_id, ck->auth_key); |
| 7340 | if (params != IF_DEF_PARAMS (ifp)) |
| 7341 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7342 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7343 | } |
| 7344 | |
| 7345 | /* Interface Output Cost print. */ |
| 7346 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) |
| 7347 | { |
| 7348 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); |
| 7349 | if (params != IF_DEF_PARAMS (ifp)) |
| 7350 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7351 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7352 | } |
| 7353 | |
| 7354 | /* Hello Interval print. */ |
| 7355 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && |
| 7356 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) |
| 7357 | { |
| 7358 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); |
| 7359 | if (params != IF_DEF_PARAMS (ifp)) |
| 7360 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7361 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7362 | } |
| 7363 | |
| 7364 | |
| 7365 | /* Router Dead Interval print. */ |
| 7366 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && |
| 7367 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) |
| 7368 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7369 | vty_out (vty, " ip ospf dead-interval "); |
| 7370 | |
| 7371 | /* fast hello ? */ |
| 7372 | if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello)) |
| 7373 | vty_out (vty, "minimal hello-multiplier %d", |
| 7374 | params->fast_hello); |
| 7375 | else |
| 7376 | vty_out (vty, "%u", params->v_wait); |
| 7377 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7378 | if (params != IF_DEF_PARAMS (ifp)) |
| 7379 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7380 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7381 | } |
| 7382 | |
| 7383 | /* Router Priority print. */ |
| 7384 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && |
| 7385 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) |
| 7386 | { |
| 7387 | vty_out (vty, " ip ospf priority %u", params->priority); |
| 7388 | if (params != IF_DEF_PARAMS (ifp)) |
| 7389 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7390 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7391 | } |
| 7392 | |
| 7393 | /* Retransmit Interval print. */ |
| 7394 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && |
| 7395 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) |
| 7396 | { |
| 7397 | vty_out (vty, " ip ospf retransmit-interval %u", |
| 7398 | params->retransmit_interval); |
| 7399 | if (params != IF_DEF_PARAMS (ifp)) |
| 7400 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7401 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7402 | } |
| 7403 | |
| 7404 | /* Transmit Delay print. */ |
| 7405 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && |
| 7406 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7407 | { |
| 7408 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); |
| 7409 | if (params != IF_DEF_PARAMS (ifp)) |
| 7410 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7411 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7412 | } |
| 7413 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7414 | /* MTU ignore print. */ |
| 7415 | if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) && |
| 7416 | params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 7417 | { |
| 7418 | if (params->mtu_ignore == 0) |
| 7419 | vty_out (vty, " no ip ospf mtu-ignore"); |
| 7420 | else |
| 7421 | vty_out (vty, " ip ospf mtu-ignore"); |
| 7422 | if (params != IF_DEF_PARAMS (ifp)) |
| 7423 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7424 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7425 | } |
| 7426 | |
| 7427 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7428 | while (1) |
| 7429 | { |
| 7430 | if (rn == NULL) |
| 7431 | rn = route_top (IF_OIFS_PARAMS (ifp)); |
| 7432 | else |
| 7433 | rn = route_next (rn); |
| 7434 | |
| 7435 | if (rn == NULL) |
| 7436 | break; |
| 7437 | params = rn->info; |
| 7438 | if (params != NULL) |
| 7439 | break; |
| 7440 | } |
| 7441 | } while (rn); |
| 7442 | |
| 7443 | #ifdef HAVE_OPAQUE_LSA |
| 7444 | ospf_opaque_config_write_if (vty, ifp); |
| 7445 | #endif /* HAVE_OPAQUE_LSA */ |
| 7446 | } |
| 7447 | |
| 7448 | return write; |
| 7449 | } |
| 7450 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7451 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7452 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7453 | { |
| 7454 | struct route_node *rn; |
| 7455 | u_char buf[INET_ADDRSTRLEN]; |
| 7456 | |
| 7457 | /* `network area' print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7458 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7459 | if (rn->info) |
| 7460 | { |
| 7461 | struct ospf_network *n = rn->info; |
| 7462 | |
| 7463 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7464 | |
| 7465 | /* Create Area ID string by specified Area ID format. */ |
| 7466 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7467 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7468 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7469 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7470 | (unsigned long int) ntohl (n->area_id.s_addr)); |
| 7471 | |
| 7472 | /* Network print. */ |
| 7473 | vty_out (vty, " network %s/%d area %s%s", |
| 7474 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7475 | buf, VTY_NEWLINE); |
| 7476 | } |
| 7477 | |
| 7478 | return 0; |
| 7479 | } |
| 7480 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7481 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7482 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7483 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7484 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7485 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7486 | u_char buf[INET_ADDRSTRLEN]; |
| 7487 | |
| 7488 | /* Area configuration print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7489 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7490 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7491 | struct route_node *rn1; |
| 7492 | |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7493 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7494 | |
| 7495 | if (area->auth_type != OSPF_AUTH_NULL) |
| 7496 | { |
| 7497 | if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 7498 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); |
| 7499 | else |
| 7500 | vty_out (vty, " area %s authentication message-digest%s", |
| 7501 | buf, VTY_NEWLINE); |
| 7502 | } |
| 7503 | |
| 7504 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) |
| 7505 | vty_out (vty, " area %s shortcut %s%s", buf, |
| 7506 | ospf_shortcut_mode_str[area->shortcut_configured], |
| 7507 | VTY_NEWLINE); |
| 7508 | |
| 7509 | if ((area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7510 | || (area->external_routing == OSPF_AREA_NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7511 | ) |
| 7512 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7513 | if (area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7514 | vty_out (vty, " area %s stub", buf); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7515 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 7516 | { |
| 7517 | vty_out (vty, " area %s nssa", buf); |
| 7518 | switch (area->NSSATranslatorRole) |
| 7519 | { |
| 7520 | case OSPF_NSSA_ROLE_NEVER: |
| 7521 | vty_out (vty, " translate-never"); |
| 7522 | break; |
| 7523 | case OSPF_NSSA_ROLE_ALWAYS: |
| 7524 | vty_out (vty, " translate-always"); |
| 7525 | break; |
| 7526 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 7527 | default: |
| 7528 | vty_out (vty, " translate-candidate"); |
| 7529 | } |
| 7530 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7531 | |
| 7532 | if (area->no_summary) |
| 7533 | vty_out (vty, " no-summary"); |
| 7534 | |
| 7535 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7536 | |
| 7537 | if (area->default_cost != 1) |
| 7538 | vty_out (vty, " area %s default-cost %d%s", buf, |
| 7539 | area->default_cost, VTY_NEWLINE); |
| 7540 | } |
| 7541 | |
| 7542 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) |
| 7543 | if (rn1->info) |
| 7544 | { |
| 7545 | struct ospf_area_range *range = rn1->info; |
| 7546 | |
| 7547 | vty_out (vty, " area %s range %s/%d", buf, |
| 7548 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); |
| 7549 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 7550 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7551 | vty_out (vty, " cost %d", range->cost_config); |
| 7552 | |
| 7553 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 7554 | vty_out (vty, " not-advertise"); |
| 7555 | |
| 7556 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 7557 | vty_out (vty, " substitute %s/%d", |
| 7558 | inet_ntoa (range->subst_addr), range->subst_masklen); |
| 7559 | |
| 7560 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7561 | } |
| 7562 | |
| 7563 | if (EXPORT_NAME (area)) |
| 7564 | vty_out (vty, " area %s export-list %s%s", buf, |
| 7565 | EXPORT_NAME (area), VTY_NEWLINE); |
| 7566 | |
| 7567 | if (IMPORT_NAME (area)) |
| 7568 | vty_out (vty, " area %s import-list %s%s", buf, |
| 7569 | IMPORT_NAME (area), VTY_NEWLINE); |
| 7570 | |
| 7571 | if (PREFIX_NAME_IN (area)) |
| 7572 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, |
| 7573 | PREFIX_NAME_IN (area), VTY_NEWLINE); |
| 7574 | |
| 7575 | if (PREFIX_NAME_OUT (area)) |
| 7576 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, |
| 7577 | PREFIX_NAME_OUT (area), VTY_NEWLINE); |
| 7578 | } |
| 7579 | |
| 7580 | return 0; |
| 7581 | } |
| 7582 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7583 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7584 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7585 | { |
| 7586 | struct ospf_nbr_nbma *nbr_nbma; |
| 7587 | struct route_node *rn; |
| 7588 | |
| 7589 | /* Static Neighbor configuration print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7590 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7591 | if ((nbr_nbma = rn->info)) |
| 7592 | { |
| 7593 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); |
| 7594 | |
| 7595 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) |
| 7596 | vty_out (vty, " priority %d", nbr_nbma->priority); |
| 7597 | |
| 7598 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) |
| 7599 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); |
| 7600 | |
| 7601 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7602 | } |
| 7603 | |
| 7604 | return 0; |
| 7605 | } |
| 7606 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7607 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7608 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7609 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7610 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7611 | struct ospf_vl_data *vl_data; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7612 | u_char buf[INET_ADDRSTRLEN]; |
| 7613 | |
| 7614 | /* Virtual-Link print */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7615 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7616 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7617 | struct listnode *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7618 | struct crypt_key *ck; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7619 | struct ospf_interface *oi; |
| 7620 | |
| 7621 | if (vl_data != NULL) |
| 7622 | { |
| 7623 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7624 | |
| 7625 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7626 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7627 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7628 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7629 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
| 7630 | oi = vl_data->vl_oi; |
| 7631 | |
| 7632 | /* timers */ |
| 7633 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || |
| 7634 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || |
| 7635 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || |
| 7636 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7637 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", |
| 7638 | buf, |
| 7639 | inet_ntoa (vl_data->vl_peer), |
| 7640 | OSPF_IF_PARAM (oi, v_hello), |
| 7641 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 7642 | OSPF_IF_PARAM (oi, transmit_delay), |
| 7643 | OSPF_IF_PARAM (oi, v_wait), |
| 7644 | VTY_NEWLINE); |
| 7645 | else |
| 7646 | vty_out (vty, " area %s virtual-link %s%s", buf, |
| 7647 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); |
| 7648 | /* Auth key */ |
| 7649 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') |
| 7650 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", |
| 7651 | buf, |
| 7652 | inet_ntoa (vl_data->vl_peer), |
| 7653 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, |
| 7654 | VTY_NEWLINE); |
| 7655 | /* md5 keys */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7656 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
| 7657 | n2, ck)) |
| 7658 | vty_out (vty, " area %s virtual-link %s" |
| 7659 | " message-digest-key %d md5 %s%s", |
| 7660 | buf, |
| 7661 | inet_ntoa (vl_data->vl_peer), |
| 7662 | ck->key_id, ck->auth_key, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7663 | |
| 7664 | } |
| 7665 | } |
| 7666 | |
| 7667 | return 0; |
| 7668 | } |
| 7669 | |
| 7670 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7671 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7672 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7673 | { |
| 7674 | int type; |
| 7675 | |
| 7676 | /* redistribute print. */ |
| 7677 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
| 7678 | if (type != zclient->redist_default && zclient->redist[type]) |
| 7679 | { |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7680 | vty_out (vty, " redistribute %s", zebra_route_string(type)); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7681 | if (ospf->dmetric[type].value >= 0) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7682 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7683 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7684 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7685 | vty_out (vty, " metric-type 1"); |
| 7686 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7687 | if (ROUTEMAP_NAME (ospf, type)) |
| 7688 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7689 | |
| 7690 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7691 | } |
| 7692 | |
| 7693 | return 0; |
| 7694 | } |
| 7695 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7696 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7697 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7698 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7699 | if (ospf->default_metric != -1) |
| 7700 | vty_out (vty, " default-metric %d%s", ospf->default_metric, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7701 | VTY_NEWLINE); |
| 7702 | return 0; |
| 7703 | } |
| 7704 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7705 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7706 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7707 | { |
| 7708 | int type; |
| 7709 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7710 | if (ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7711 | { |
| 7712 | /* distribute-list print. */ |
| 7713 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7714 | if (ospf->dlist[type].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7715 | vty_out (vty, " distribute-list %s out %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7716 | ospf->dlist[type].name, |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7717 | zebra_route_string(type), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7718 | |
| 7719 | /* default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7720 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7721 | { |
paul | c42c177 | 2006-01-10 20:36:49 +0000 | [diff] [blame] | 7722 | vty_out (vty, " default-information originate"); |
| 7723 | if (ospf->default_originate == DEFAULT_ORIGINATE_ALWAYS) |
| 7724 | vty_out (vty, " always"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7725 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7726 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7727 | vty_out (vty, " metric %d", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7728 | ospf->dmetric[DEFAULT_ROUTE].value); |
| 7729 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7730 | vty_out (vty, " metric-type 1"); |
| 7731 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7732 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
| 7733 | vty_out (vty, " route-map %s", |
| 7734 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7735 | |
| 7736 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7737 | } |
| 7738 | |
| 7739 | } |
| 7740 | |
| 7741 | return 0; |
| 7742 | } |
| 7743 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7744 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7745 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7746 | { |
| 7747 | struct route_node *rn; |
| 7748 | struct ospf_distance *odistance; |
| 7749 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7750 | if (ospf->distance_all) |
| 7751 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7752 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7753 | if (ospf->distance_intra |
| 7754 | || ospf->distance_inter |
| 7755 | || ospf->distance_external) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7756 | { |
| 7757 | vty_out (vty, " distance ospf"); |
| 7758 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7759 | if (ospf->distance_intra) |
| 7760 | vty_out (vty, " intra-area %d", ospf->distance_intra); |
| 7761 | if (ospf->distance_inter) |
| 7762 | vty_out (vty, " inter-area %d", ospf->distance_inter); |
| 7763 | if (ospf->distance_external) |
| 7764 | vty_out (vty, " external %d", ospf->distance_external); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7765 | |
| 7766 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7767 | } |
| 7768 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7769 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7770 | if ((odistance = rn->info) != NULL) |
| 7771 | { |
| 7772 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, |
| 7773 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7774 | odistance->access_list ? odistance->access_list : "", |
| 7775 | VTY_NEWLINE); |
| 7776 | } |
| 7777 | return 0; |
| 7778 | } |
| 7779 | |
| 7780 | /* OSPF configuration write function. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7781 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7782 | ospf_config_write (struct vty *vty) |
| 7783 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7784 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7785 | struct interface *ifp; |
| 7786 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7787 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7788 | int write = 0; |
| 7789 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7790 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7791 | if (ospf != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7792 | { |
| 7793 | /* `router ospf' print. */ |
| 7794 | vty_out (vty, "router ospf%s", VTY_NEWLINE); |
| 7795 | |
| 7796 | write++; |
| 7797 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7798 | if (!ospf->networks) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7799 | return write; |
| 7800 | |
| 7801 | /* Router ID print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7802 | if (ospf->router_id_static.s_addr != 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7803 | vty_out (vty, " ospf router-id %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7804 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7805 | |
| 7806 | /* ABR type print. */ |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 7807 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7808 | vty_out (vty, " ospf abr-type %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7809 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7810 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 7811 | /* log-adjacency-changes flag print. */ |
| 7812 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 7813 | { |
| 7814 | vty_out(vty, " log-adjacency-changes"); |
| 7815 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 7816 | vty_out(vty, " detail"); |
| 7817 | vty_out(vty, "%s", VTY_NEWLINE); |
| 7818 | } |
| 7819 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7820 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7821 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7822 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
| 7823 | |
| 7824 | /* auto-cost reference-bandwidth configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7825 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7826 | { |
| 7827 | vty_out (vty, "! Important: ensure reference bandwidth " |
| 7828 | "is consistent across all routers%s", VTY_NEWLINE); |
| 7829 | vty_out (vty, " auto-cost reference-bandwidth %d%s", |
| 7830 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); |
| 7831 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7832 | |
| 7833 | /* SPF timers print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7834 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 7835 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT || |
| 7836 | ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT) |
| 7837 | vty_out (vty, " timers throttle spf %d %d %d%s", |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7838 | ospf->spf_delay, ospf->spf_holdtime, |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 7839 | ospf->spf_max_holdtime, VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7840 | |
| 7841 | /* Max-metric router-lsa print */ |
| 7842 | config_write_stub_router (vty, ospf); |
| 7843 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7844 | /* SPF refresh parameters print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7845 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7846 | vty_out (vty, " refresh timer %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7847 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7848 | |
| 7849 | /* Redistribute information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7850 | config_write_ospf_redistribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7851 | |
| 7852 | /* passive-interface print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7853 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 7854 | if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE) |
| 7855 | vty_out (vty, " passive-interface %s%s", |
| 7856 | ifp->name, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7857 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7858 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 7859 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) && |
| 7860 | oi->params->passive_interface == OSPF_IF_PASSIVE) |
| 7861 | vty_out (vty, " passive-interface %s %s%s", |
| 7862 | oi->ifp->name, |
| 7863 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7864 | |
| 7865 | /* Network area print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7866 | config_write_network_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7867 | |
| 7868 | /* Area config print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7869 | config_write_ospf_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7870 | |
| 7871 | /* static neighbor print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7872 | config_write_ospf_nbr_nbma (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7873 | |
| 7874 | /* Virtual-Link print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7875 | config_write_virtual_link (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7876 | |
| 7877 | /* Default metric configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7878 | config_write_ospf_default_metric (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7879 | |
| 7880 | /* Distribute-list and default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7881 | config_write_ospf_distribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7882 | |
| 7883 | /* Distance configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7884 | config_write_ospf_distance (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7885 | |
| 7886 | #ifdef HAVE_OPAQUE_LSA |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7887 | ospf_opaque_config_write_router (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7888 | #endif /* HAVE_OPAQUE_LSA */ |
| 7889 | } |
| 7890 | |
| 7891 | return write; |
| 7892 | } |
| 7893 | |
| 7894 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7895 | ospf_vty_show_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7896 | { |
| 7897 | /* "show ip ospf" commands. */ |
| 7898 | install_element (VIEW_NODE, &show_ip_ospf_cmd); |
| 7899 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); |
| 7900 | |
| 7901 | /* "show ip ospf database" commands. */ |
| 7902 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); |
| 7903 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); |
| 7904 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 7905 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 7906 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 7907 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); |
| 7908 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); |
| 7909 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); |
| 7910 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); |
| 7911 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 7912 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 7913 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 7914 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); |
| 7915 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); |
| 7916 | |
| 7917 | /* "show ip ospf interface" commands. */ |
| 7918 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); |
| 7919 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); |
| 7920 | |
| 7921 | /* "show ip ospf neighbor" commands. */ |
| 7922 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 7923 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 7924 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 7925 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 7926 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 7927 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); |
| 7928 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 7929 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 7930 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 7931 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 7932 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 7933 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 7934 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); |
| 7935 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 7936 | |
| 7937 | /* "show ip ospf route" commands. */ |
| 7938 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); |
| 7939 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7940 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
| 7941 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7942 | } |
| 7943 | |
| 7944 | |
| 7945 | /* ospfd's interface node. */ |
| 7946 | struct cmd_node interface_node = |
| 7947 | { |
| 7948 | INTERFACE_NODE, |
| 7949 | "%s(config-if)# ", |
| 7950 | 1 |
| 7951 | }; |
| 7952 | |
| 7953 | /* Initialization of OSPF interface. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7954 | static void |
| 7955 | ospf_vty_if_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7956 | { |
| 7957 | /* Install interface node. */ |
| 7958 | install_node (&interface_node, config_write_interface); |
| 7959 | |
| 7960 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 7961 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7962 | install_default (INTERFACE_NODE); |
| 7963 | |
| 7964 | /* "description" commands. */ |
| 7965 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 7966 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 7967 | |
| 7968 | /* "ip ospf authentication" commands. */ |
| 7969 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); |
| 7970 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); |
| 7971 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); |
| 7972 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); |
| 7973 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); |
| 7974 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); |
| 7975 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); |
| 7976 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); |
| 7977 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); |
| 7978 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); |
| 7979 | |
| 7980 | /* "ip ospf message-digest-key" commands. */ |
| 7981 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); |
| 7982 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); |
| 7983 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); |
| 7984 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); |
| 7985 | |
| 7986 | /* "ip ospf cost" commands. */ |
| 7987 | install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd); |
| 7988 | install_element (INTERFACE_NODE, &ip_ospf_cost_cmd); |
| 7989 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd); |
| 7990 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); |
| 7991 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7992 | /* "ip ospf mtu-ignore" commands. */ |
| 7993 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); |
| 7994 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); |
| 7995 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); |
| 7996 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); |
| 7997 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7998 | /* "ip ospf dead-interval" commands. */ |
| 7999 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); |
| 8000 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8001 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); |
| 8002 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8003 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
| 8004 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8005 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8006 | /* "ip ospf hello-interval" commands. */ |
| 8007 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); |
| 8008 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); |
| 8009 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); |
| 8010 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); |
| 8011 | |
| 8012 | /* "ip ospf network" commands. */ |
| 8013 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); |
| 8014 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); |
| 8015 | |
| 8016 | /* "ip ospf priority" commands. */ |
| 8017 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); |
| 8018 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); |
| 8019 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); |
| 8020 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); |
| 8021 | |
| 8022 | /* "ip ospf retransmit-interval" commands. */ |
| 8023 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); |
| 8024 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); |
| 8025 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); |
| 8026 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); |
| 8027 | |
| 8028 | /* "ip ospf transmit-delay" commands. */ |
| 8029 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); |
| 8030 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); |
| 8031 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); |
| 8032 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); |
| 8033 | |
| 8034 | /* These commands are compatibitliy for previous version. */ |
| 8035 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); |
| 8036 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); |
| 8037 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); |
| 8038 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); |
| 8039 | install_element (INTERFACE_NODE, &ospf_cost_cmd); |
| 8040 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); |
| 8041 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); |
| 8042 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); |
| 8043 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); |
| 8044 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); |
| 8045 | install_element (INTERFACE_NODE, &ospf_network_cmd); |
| 8046 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); |
| 8047 | install_element (INTERFACE_NODE, &ospf_priority_cmd); |
| 8048 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); |
| 8049 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); |
| 8050 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); |
| 8051 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); |
| 8052 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); |
| 8053 | } |
| 8054 | |
| 8055 | /* Zebra node structure. */ |
| 8056 | struct cmd_node zebra_node = |
| 8057 | { |
| 8058 | ZEBRA_NODE, |
| 8059 | "%s(config-router)#", |
| 8060 | }; |
| 8061 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8062 | static void |
| 8063 | ospf_vty_zebra_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8064 | { |
| 8065 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); |
| 8066 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); |
| 8067 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); |
| 8068 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); |
| 8069 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); |
| 8070 | install_element (OSPF_NODE, |
| 8071 | &ospf_redistribute_source_metric_type_routemap_cmd); |
| 8072 | install_element (OSPF_NODE, |
| 8073 | &ospf_redistribute_source_type_metric_routemap_cmd); |
| 8074 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); |
| 8075 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); |
| 8076 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); |
| 8077 | |
| 8078 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); |
| 8079 | |
| 8080 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); |
| 8081 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); |
| 8082 | |
| 8083 | install_element (OSPF_NODE, |
| 8084 | &ospf_default_information_originate_metric_type_cmd); |
| 8085 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); |
| 8086 | install_element (OSPF_NODE, |
| 8087 | &ospf_default_information_originate_type_metric_cmd); |
| 8088 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); |
| 8089 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); |
| 8090 | install_element (OSPF_NODE, |
| 8091 | &ospf_default_information_originate_always_metric_type_cmd); |
| 8092 | install_element (OSPF_NODE, |
| 8093 | &ospf_default_information_originate_always_metric_cmd); |
| 8094 | install_element (OSPF_NODE, |
| 8095 | &ospf_default_information_originate_always_cmd); |
| 8096 | install_element (OSPF_NODE, |
| 8097 | &ospf_default_information_originate_always_type_metric_cmd); |
| 8098 | install_element (OSPF_NODE, |
| 8099 | &ospf_default_information_originate_always_type_cmd); |
| 8100 | |
| 8101 | install_element (OSPF_NODE, |
| 8102 | &ospf_default_information_originate_metric_type_routemap_cmd); |
| 8103 | install_element (OSPF_NODE, |
| 8104 | &ospf_default_information_originate_metric_routemap_cmd); |
| 8105 | install_element (OSPF_NODE, |
| 8106 | &ospf_default_information_originate_routemap_cmd); |
| 8107 | install_element (OSPF_NODE, |
| 8108 | &ospf_default_information_originate_type_metric_routemap_cmd); |
| 8109 | install_element (OSPF_NODE, |
| 8110 | &ospf_default_information_originate_type_routemap_cmd); |
| 8111 | install_element (OSPF_NODE, |
| 8112 | &ospf_default_information_originate_always_metric_type_routemap_cmd); |
| 8113 | install_element (OSPF_NODE, |
| 8114 | &ospf_default_information_originate_always_metric_routemap_cmd); |
| 8115 | install_element (OSPF_NODE, |
| 8116 | &ospf_default_information_originate_always_routemap_cmd); |
| 8117 | install_element (OSPF_NODE, |
| 8118 | &ospf_default_information_originate_always_type_metric_routemap_cmd); |
| 8119 | install_element (OSPF_NODE, |
| 8120 | &ospf_default_information_originate_always_type_routemap_cmd); |
| 8121 | |
| 8122 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); |
| 8123 | |
| 8124 | install_element (OSPF_NODE, &ospf_default_metric_cmd); |
| 8125 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); |
| 8126 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); |
| 8127 | |
| 8128 | install_element (OSPF_NODE, &ospf_distance_cmd); |
| 8129 | install_element (OSPF_NODE, &no_ospf_distance_cmd); |
| 8130 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); |
| 8131 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); |
| 8132 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); |
| 8133 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); |
| 8134 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); |
| 8135 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); |
| 8136 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); |
| 8137 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); |
| 8138 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); |
| 8139 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); |
| 8140 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); |
| 8141 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); |
| 8142 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); |
| 8143 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); |
| 8144 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); |
| 8145 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); |
| 8146 | #if 0 |
| 8147 | install_element (OSPF_NODE, &ospf_distance_source_cmd); |
| 8148 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); |
| 8149 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); |
| 8150 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); |
| 8151 | #endif /* 0 */ |
| 8152 | } |
| 8153 | |
| 8154 | struct cmd_node ospf_node = |
| 8155 | { |
| 8156 | OSPF_NODE, |
| 8157 | "%s(config-router)# ", |
| 8158 | 1 |
| 8159 | }; |
| 8160 | |
| 8161 | |
| 8162 | /* Install OSPF related vty commands. */ |
| 8163 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8164 | ospf_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8165 | { |
| 8166 | /* Install ospf top node. */ |
| 8167 | install_node (&ospf_node, ospf_config_write); |
| 8168 | |
| 8169 | /* "router ospf" commands. */ |
| 8170 | install_element (CONFIG_NODE, &router_ospf_cmd); |
| 8171 | install_element (CONFIG_NODE, &no_router_ospf_cmd); |
| 8172 | |
| 8173 | install_default (OSPF_NODE); |
| 8174 | |
| 8175 | /* "ospf router-id" commands. */ |
| 8176 | install_element (OSPF_NODE, &ospf_router_id_cmd); |
| 8177 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8178 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
| 8179 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8180 | |
| 8181 | /* "passive-interface" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8182 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
| 8183 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); |
| 8184 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); |
| 8185 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8186 | |
| 8187 | /* "ospf abr-type" commands. */ |
| 8188 | install_element (OSPF_NODE, &ospf_abr_type_cmd); |
| 8189 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); |
| 8190 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 8191 | /* "ospf log-adjacency-changes" commands. */ |
| 8192 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_cmd); |
| 8193 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_detail_cmd); |
| 8194 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_cmd); |
| 8195 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_detail_cmd); |
| 8196 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8197 | /* "ospf rfc1583-compatible" commands. */ |
| 8198 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); |
| 8199 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); |
| 8200 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); |
| 8201 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); |
| 8202 | |
| 8203 | /* "network area" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8204 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
| 8205 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8206 | |
| 8207 | /* "area authentication" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8208 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
| 8209 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); |
| 8210 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8211 | |
| 8212 | /* "area range" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8213 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
| 8214 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); |
| 8215 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); |
| 8216 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); |
| 8217 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); |
| 8218 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); |
| 8219 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); |
| 8220 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); |
| 8221 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); |
| 8222 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); |
| 8223 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8224 | |
| 8225 | /* "area virtual-link" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8226 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
| 8227 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8228 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8229 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
| 8230 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8231 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8232 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
| 8233 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8234 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8235 | install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); |
| 8236 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8237 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8238 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
| 8239 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8240 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8241 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
| 8242 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); |
| 8243 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8244 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8245 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
| 8246 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8247 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8248 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
| 8249 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8250 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8251 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
| 8252 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); |
| 8253 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8254 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8255 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
| 8256 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); |
| 8257 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8258 | |
| 8259 | /* "area stub" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8260 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
| 8261 | install_element (OSPF_NODE, &ospf_area_stub_cmd); |
| 8262 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); |
| 8263 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8264 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8265 | /* "area nssa" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8266 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
| 8267 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); |
| 8268 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); |
| 8269 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); |
| 8270 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); |
| 8271 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8272 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8273 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
| 8274 | install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8275 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8276 | install_element (OSPF_NODE, &ospf_area_shortcut_cmd); |
| 8277 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8278 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8279 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
| 8280 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8281 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8282 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
| 8283 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8284 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8285 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
| 8286 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8287 | |
| 8288 | /* SPF timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8289 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
| 8290 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 8291 | install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); |
| 8292 | install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); |
| 8293 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8294 | /* refresh timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8295 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
| 8296 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); |
| 8297 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8298 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8299 | /* max-metric commands */ |
| 8300 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd); |
| 8301 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd); |
| 8302 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd); |
| 8303 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd); |
| 8304 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd); |
| 8305 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd); |
| 8306 | |
| 8307 | /* reference bandwidth commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8308 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
| 8309 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8310 | |
| 8311 | /* "neighbor" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8312 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
| 8313 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); |
| 8314 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); |
| 8315 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); |
| 8316 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); |
| 8317 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); |
| 8318 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); |
| 8319 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8320 | |
| 8321 | /* Init interface related vty commands. */ |
| 8322 | ospf_vty_if_init (); |
| 8323 | |
| 8324 | /* Init zebra related vty commands. */ |
| 8325 | ospf_vty_zebra_init (); |
| 8326 | } |