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 | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 218 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 219 | if (ospf->t_router_id_update == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 220 | OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer, |
| 221 | OSPF_ROUTER_ID_UPDATE_DELAY); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 222 | |
| 223 | return CMD_SUCCESS; |
| 224 | } |
| 225 | |
| 226 | ALIAS (ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 227 | router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 228 | "router-id A.B.C.D", |
| 229 | "router-id for the OSPF process\n" |
| 230 | "OSPF router-id in IP address format\n") |
| 231 | |
| 232 | DEFUN (no_ospf_router_id, |
| 233 | no_ospf_router_id_cmd, |
| 234 | "no ospf router-id", |
| 235 | NO_STR |
| 236 | "OSPF specific commands\n" |
| 237 | "router-id for the OSPF process\n") |
| 238 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 239 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 240 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 241 | ospf->router_id_static.s_addr = 0; |
| 242 | |
| 243 | ospf_router_id_update (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 244 | |
| 245 | return CMD_SUCCESS; |
| 246 | } |
| 247 | |
| 248 | ALIAS (no_ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 249 | no_router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 250 | "no router-id", |
| 251 | NO_STR |
| 252 | "router-id for the OSPF process\n") |
| 253 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 254 | DEFUN (ospf_passive_interface, |
| 255 | ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 256 | "passive-interface IFNAME A.B.C.D", |
| 257 | "Suppress routing updates on an interface\n" |
| 258 | "Interface's name\n") |
| 259 | { |
| 260 | struct interface *ifp; |
| 261 | struct in_addr addr; |
| 262 | int ret; |
| 263 | struct ospf_if_params *params; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 264 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 265 | |
| 266 | ifp = if_lookup_by_name (argv[0]); |
| 267 | |
| 268 | if (ifp == NULL) |
| 269 | { |
| 270 | vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE); |
| 271 | return CMD_WARNING; |
| 272 | } |
| 273 | |
| 274 | params = IF_DEF_PARAMS (ifp); |
| 275 | |
| 276 | if (argc == 2) |
| 277 | { |
| 278 | ret = inet_aton(argv[1], &addr); |
| 279 | if (!ret) |
| 280 | { |
| 281 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 282 | VTY_NEWLINE); |
| 283 | return CMD_WARNING; |
| 284 | } |
| 285 | |
| 286 | params = ospf_get_if_params (ifp, addr); |
| 287 | ospf_if_update_params (ifp, addr); |
| 288 | } |
| 289 | |
| 290 | SET_IF_PARAM (params, passive_interface); |
| 291 | params->passive_interface = OSPF_IF_PASSIVE; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 292 | |
| 293 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 294 | * interfaces for which the passive property changed. It is too much |
| 295 | * work to determine this set, so we do this for every interface. |
| 296 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 297 | * record of joined groups to avoid systems calls if the desired |
| 298 | * memberships match the current memership. |
| 299 | */ |
| 300 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 301 | { |
| 302 | struct ospf_interface *oi = rn->info; |
| 303 | |
| 304 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) |
| 305 | ospf_if_set_multicast(oi); |
| 306 | } |
| 307 | /* |
| 308 | * XXX It is not clear what state transitions the interface needs to |
| 309 | * undergo when going from active to passive. Fixing this will |
| 310 | * require precise identification of interfaces having such a |
| 311 | * transition. |
| 312 | */ |
| 313 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 314 | return CMD_SUCCESS; |
| 315 | } |
| 316 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 317 | ALIAS (ospf_passive_interface, |
| 318 | ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 319 | "passive-interface IFNAME", |
| 320 | "Suppress routing updates on an interface\n" |
| 321 | "Interface's name\n") |
| 322 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 323 | DEFUN (no_ospf_passive_interface, |
| 324 | no_ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 325 | "no passive-interface IFNAME A.B.C.D", |
| 326 | NO_STR |
| 327 | "Allow routing updates on an interface\n" |
| 328 | "Interface's name\n") |
| 329 | { |
| 330 | struct interface *ifp; |
| 331 | struct in_addr addr; |
| 332 | struct ospf_if_params *params; |
| 333 | int ret; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 334 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 335 | |
| 336 | ifp = if_lookup_by_name (argv[0]); |
| 337 | |
| 338 | if (ifp == NULL) |
| 339 | { |
| 340 | vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE); |
| 341 | return CMD_WARNING; |
| 342 | } |
| 343 | |
| 344 | params = IF_DEF_PARAMS (ifp); |
| 345 | |
| 346 | if (argc == 2) |
| 347 | { |
| 348 | ret = inet_aton(argv[1], &addr); |
| 349 | if (!ret) |
| 350 | { |
| 351 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 352 | VTY_NEWLINE); |
| 353 | return CMD_WARNING; |
| 354 | } |
| 355 | |
| 356 | params = ospf_lookup_if_params (ifp, addr); |
| 357 | if (params == NULL) |
| 358 | return CMD_SUCCESS; |
| 359 | } |
| 360 | |
| 361 | UNSET_IF_PARAM (params, passive_interface); |
| 362 | params->passive_interface = OSPF_IF_ACTIVE; |
| 363 | |
| 364 | if (params != IF_DEF_PARAMS (ifp)) |
| 365 | { |
| 366 | ospf_free_if_params (ifp, addr); |
| 367 | ospf_if_update_params (ifp, addr); |
| 368 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 369 | |
| 370 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 371 | * interfaces for which the passive property changed. It is too much |
| 372 | * work to determine this set, so we do this for every interface. |
| 373 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 374 | * record of joined groups to avoid systems calls if the desired |
| 375 | * memberships match the current memership. |
| 376 | */ |
| 377 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 378 | { |
| 379 | struct ospf_interface *oi = rn->info; |
| 380 | |
| 381 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE)) |
| 382 | ospf_if_set_multicast(oi); |
| 383 | } |
| 384 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 385 | return CMD_SUCCESS; |
| 386 | } |
| 387 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 388 | ALIAS (no_ospf_passive_interface, |
| 389 | no_ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 390 | "no passive-interface IFNAME", |
| 391 | NO_STR |
| 392 | "Allow routing updates on an interface\n" |
| 393 | "Interface's name\n") |
| 394 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 395 | DEFUN (ospf_network_area, |
| 396 | ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 397 | "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 398 | "Enable routing on an IP network\n" |
| 399 | "OSPF network prefix\n" |
| 400 | "Set the OSPF area ID\n" |
| 401 | "OSPF area ID in IP address format\n" |
| 402 | "OSPF area ID as a decimal value\n") |
| 403 | { |
| 404 | struct ospf *ospf= vty->index; |
| 405 | struct prefix_ipv4 p; |
| 406 | struct in_addr area_id; |
| 407 | int ret, format; |
| 408 | |
| 409 | /* Get network prefix and Area ID. */ |
| 410 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 411 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 412 | |
| 413 | ret = ospf_network_set (ospf, &p, area_id); |
| 414 | if (ret == 0) |
| 415 | { |
| 416 | vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); |
| 417 | return CMD_WARNING; |
| 418 | } |
| 419 | |
| 420 | return CMD_SUCCESS; |
| 421 | } |
| 422 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 423 | DEFUN (no_ospf_network_area, |
| 424 | no_ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 425 | "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 426 | NO_STR |
| 427 | "Enable routing on an IP network\n" |
| 428 | "OSPF network prefix\n" |
| 429 | "Set the OSPF area ID\n" |
| 430 | "OSPF area ID in IP address format\n" |
| 431 | "OSPF area ID as a decimal value\n") |
| 432 | { |
| 433 | struct ospf *ospf = (struct ospf *) vty->index; |
| 434 | struct prefix_ipv4 p; |
| 435 | struct in_addr area_id; |
| 436 | int ret, format; |
| 437 | |
| 438 | /* Get network prefix and Area ID. */ |
| 439 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 440 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 441 | |
| 442 | ret = ospf_network_unset (ospf, &p, area_id); |
| 443 | if (ret == 0) |
| 444 | { |
| 445 | vty_out (vty, "Can't find specified network area configuration.%s", |
| 446 | VTY_NEWLINE); |
| 447 | return CMD_WARNING; |
| 448 | } |
| 449 | |
| 450 | return CMD_SUCCESS; |
| 451 | } |
| 452 | |
| 453 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 454 | DEFUN (ospf_area_range, |
| 455 | ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 456 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 457 | "OSPF area parameters\n" |
| 458 | "OSPF area ID in IP address format\n" |
| 459 | "OSPF area ID as a decimal value\n" |
| 460 | "Summarize routes matching address/mask (border routers only)\n" |
| 461 | "Area range prefix\n") |
| 462 | { |
| 463 | struct ospf *ospf = vty->index; |
| 464 | struct prefix_ipv4 p; |
| 465 | struct in_addr area_id; |
| 466 | int format; |
| 467 | u_int32_t cost; |
| 468 | |
| 469 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 470 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 471 | |
| 472 | ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); |
| 473 | if (argc > 2) |
| 474 | { |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 475 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 476 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
| 477 | } |
| 478 | |
| 479 | return CMD_SUCCESS; |
| 480 | } |
| 481 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 482 | ALIAS (ospf_area_range, |
| 483 | ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 484 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", |
| 485 | "OSPF area parameters\n" |
| 486 | "OSPF area ID in IP address format\n" |
| 487 | "OSPF area ID as a decimal value\n" |
| 488 | "OSPF area range for route advertise (default)\n" |
| 489 | "Area range prefix\n" |
| 490 | "Advertise this range (default)\n") |
| 491 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 492 | ALIAS (ospf_area_range, |
| 493 | ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 494 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 495 | "OSPF area parameters\n" |
| 496 | "OSPF area ID in IP address format\n" |
| 497 | "OSPF area ID as a decimal value\n" |
| 498 | "Summarize routes matching address/mask (border routers only)\n" |
| 499 | "Area range prefix\n" |
| 500 | "User specified metric for this range\n" |
| 501 | "Advertised metric for this range\n") |
| 502 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 503 | ALIAS (ospf_area_range, |
| 504 | ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 505 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 506 | "OSPF area parameters\n" |
| 507 | "OSPF area ID in IP address format\n" |
| 508 | "OSPF area ID as a decimal value\n" |
| 509 | "Summarize routes matching address/mask (border routers only)\n" |
| 510 | "Area range prefix\n" |
| 511 | "Advertise this range (default)\n" |
| 512 | "User specified metric for this range\n" |
| 513 | "Advertised metric for this range\n") |
| 514 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 515 | DEFUN (ospf_area_range_not_advertise, |
| 516 | ospf_area_range_not_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 517 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise", |
| 518 | "OSPF area parameters\n" |
| 519 | "OSPF area ID in IP address format\n" |
| 520 | "OSPF area ID as a decimal value\n" |
| 521 | "Summarize routes matching address/mask (border routers only)\n" |
| 522 | "Area range prefix\n" |
| 523 | "DoNotAdvertise this range\n") |
| 524 | { |
| 525 | struct ospf *ospf = vty->index; |
| 526 | struct prefix_ipv4 p; |
| 527 | struct in_addr area_id; |
| 528 | int format; |
| 529 | |
| 530 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 531 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 532 | |
| 533 | ospf_area_range_set (ospf, area_id, &p, 0); |
| 534 | |
| 535 | return CMD_SUCCESS; |
| 536 | } |
| 537 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 538 | DEFUN (no_ospf_area_range, |
| 539 | no_ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 540 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 541 | NO_STR |
| 542 | "OSPF area parameters\n" |
| 543 | "OSPF area ID in IP address format\n" |
| 544 | "OSPF area ID as a decimal value\n" |
| 545 | "Summarize routes matching address/mask (border routers only)\n" |
| 546 | "Area range prefix\n") |
| 547 | { |
| 548 | struct ospf *ospf = vty->index; |
| 549 | struct prefix_ipv4 p; |
| 550 | struct in_addr area_id; |
| 551 | int format; |
| 552 | |
| 553 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 554 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 555 | |
| 556 | ospf_area_range_unset (ospf, area_id, &p); |
| 557 | |
| 558 | return CMD_SUCCESS; |
| 559 | } |
| 560 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 561 | ALIAS (no_ospf_area_range, |
| 562 | no_ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 563 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", |
| 564 | NO_STR |
| 565 | "OSPF area parameters\n" |
| 566 | "OSPF area ID in IP address format\n" |
| 567 | "OSPF area ID as a decimal value\n" |
| 568 | "Summarize routes matching address/mask (border routers only)\n" |
| 569 | "Area range prefix\n" |
| 570 | "Advertise this range (default)\n" |
| 571 | "DoNotAdvertise this range\n") |
| 572 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 573 | ALIAS (no_ospf_area_range, |
| 574 | no_ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 575 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 576 | NO_STR |
| 577 | "OSPF area parameters\n" |
| 578 | "OSPF area ID in IP address format\n" |
| 579 | "OSPF area ID as a decimal value\n" |
| 580 | "Summarize routes matching address/mask (border routers only)\n" |
| 581 | "Area range prefix\n" |
| 582 | "User specified metric for this range\n" |
| 583 | "Advertised metric for this range\n") |
| 584 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 585 | ALIAS (no_ospf_area_range, |
| 586 | no_ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 587 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 588 | NO_STR |
| 589 | "OSPF area parameters\n" |
| 590 | "OSPF area ID in IP address format\n" |
| 591 | "OSPF area ID as a decimal value\n" |
| 592 | "Summarize routes matching address/mask (border routers only)\n" |
| 593 | "Area range prefix\n" |
| 594 | "Advertise this range (default)\n" |
| 595 | "User specified metric for this range\n" |
| 596 | "Advertised metric for this range\n") |
| 597 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 598 | DEFUN (ospf_area_range_substitute, |
| 599 | ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 600 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 601 | "OSPF area parameters\n" |
| 602 | "OSPF area ID in IP address format\n" |
| 603 | "OSPF area ID as a decimal value\n" |
| 604 | "Summarize routes matching address/mask (border routers only)\n" |
| 605 | "Area range prefix\n" |
| 606 | "Announce area range as another prefix\n" |
| 607 | "Network prefix to be announced instead of range\n") |
| 608 | { |
| 609 | struct ospf *ospf = vty->index; |
| 610 | struct prefix_ipv4 p, s; |
| 611 | struct in_addr area_id; |
| 612 | int format; |
| 613 | |
| 614 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 615 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 616 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 617 | |
| 618 | ospf_area_range_substitute_set (ospf, area_id, &p, &s); |
| 619 | |
| 620 | return CMD_SUCCESS; |
| 621 | } |
| 622 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 623 | DEFUN (no_ospf_area_range_substitute, |
| 624 | no_ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 625 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 626 | NO_STR |
| 627 | "OSPF area parameters\n" |
| 628 | "OSPF area ID in IP address format\n" |
| 629 | "OSPF area ID as a decimal value\n" |
| 630 | "Summarize routes matching address/mask (border routers only)\n" |
| 631 | "Area range prefix\n" |
| 632 | "Announce area range as another prefix\n" |
| 633 | "Network prefix to be announced instead of range\n") |
| 634 | { |
| 635 | struct ospf *ospf = vty->index; |
| 636 | struct prefix_ipv4 p, s; |
| 637 | struct in_addr area_id; |
| 638 | int format; |
| 639 | |
| 640 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 641 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 642 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 643 | |
| 644 | ospf_area_range_substitute_unset (ospf, area_id, &p); |
| 645 | |
| 646 | return CMD_SUCCESS; |
| 647 | } |
| 648 | |
| 649 | |
| 650 | /* Command Handler Logic in VLink stuff is delicate!! |
| 651 | |
| 652 | ALTER AT YOUR OWN RISK!!!! |
| 653 | |
| 654 | Various dummy values are used to represent 'NoChange' state for |
| 655 | VLink configuration NOT being changed by a VLink command, and |
| 656 | special syntax is used within the command strings so that the |
| 657 | typed in command verbs can be seen in the configuration command |
| 658 | bacckend handler. This is to drastically reduce the verbeage |
| 659 | required to coe up with a reasonably compatible Cisco VLink command |
| 660 | |
| 661 | - Matthew Grant <grantma@anathoth.gen.nz> |
| 662 | Wed, 21 Feb 2001 15:13:52 +1300 |
| 663 | */ |
| 664 | |
| 665 | |
| 666 | /* Configuration data for virtual links |
| 667 | */ |
| 668 | struct ospf_vl_config_data { |
| 669 | struct vty *vty; /* vty stuff */ |
| 670 | struct in_addr area_id; /* area ID from command line */ |
| 671 | int format; /* command line area ID format */ |
| 672 | struct in_addr vl_peer; /* command line vl_peer */ |
| 673 | int auth_type; /* Authehntication type, if given */ |
| 674 | char *auth_key; /* simple password if present */ |
| 675 | int crypto_key_id; /* Cryptographic key ID */ |
| 676 | char *md5_key; /* MD5 authentication key */ |
| 677 | int hello_interval; /* Obvious what these are... */ |
| 678 | int retransmit_interval; |
| 679 | int transmit_delay; |
| 680 | int dead_interval; |
| 681 | }; |
| 682 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 683 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 684 | ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, |
| 685 | struct vty *vty) |
| 686 | { |
| 687 | memset (vl_config, 0, sizeof (struct ospf_vl_config_data)); |
| 688 | vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN; |
| 689 | vl_config->vty = vty; |
| 690 | } |
| 691 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 692 | static struct ospf_vl_data * |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 693 | 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] | 694 | { |
| 695 | struct ospf_area *area; |
| 696 | struct ospf_vl_data *vl_data; |
| 697 | struct vty *vty; |
| 698 | struct in_addr area_id; |
| 699 | |
| 700 | vty = vl_config->vty; |
| 701 | area_id = vl_config->area_id; |
| 702 | |
| 703 | if (area_id.s_addr == OSPF_AREA_BACKBONE) |
| 704 | { |
| 705 | vty_out (vty, |
| 706 | "Configuring VLs over the backbone is not allowed%s", |
| 707 | VTY_NEWLINE); |
| 708 | return NULL; |
| 709 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 710 | area = ospf_area_get (ospf, area_id, vl_config->format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 711 | |
| 712 | if (area->external_routing != OSPF_AREA_DEFAULT) |
| 713 | { |
| 714 | if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 715 | vty_out (vty, "Area %s is %s%s", |
| 716 | inet_ntoa (area_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 717 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 718 | VTY_NEWLINE); |
| 719 | else |
| 720 | vty_out (vty, "Area %ld is %s%s", |
| 721 | (u_long)ntohl (area_id.s_addr), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 722 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 723 | VTY_NEWLINE); |
| 724 | return NULL; |
| 725 | } |
| 726 | |
| 727 | if ((vl_data = ospf_vl_lookup (area, vl_config->vl_peer)) == NULL) |
| 728 | { |
| 729 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); |
| 730 | if (vl_data->vl_oi == NULL) |
| 731 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 732 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
| 733 | ospf_vl_add (ospf, vl_data); |
| 734 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 735 | } |
| 736 | } |
| 737 | return vl_data; |
| 738 | } |
| 739 | |
| 740 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 741 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 742 | ospf_vl_set_security (struct ospf_vl_data *vl_data, |
| 743 | struct ospf_vl_config_data *vl_config) |
| 744 | { |
| 745 | struct crypt_key *ck; |
| 746 | struct vty *vty; |
| 747 | struct interface *ifp = vl_data->vl_oi->ifp; |
| 748 | |
| 749 | vty = vl_config->vty; |
| 750 | |
| 751 | if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN) |
| 752 | { |
| 753 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); |
| 754 | IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type; |
| 755 | } |
| 756 | |
| 757 | if (vl_config->auth_key) |
| 758 | { |
| 759 | memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 760 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 761 | OSPF_AUTH_SIMPLE_SIZE); |
| 762 | } |
| 763 | else if (vl_config->md5_key) |
| 764 | { |
| 765 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id) |
| 766 | != NULL) |
| 767 | { |
| 768 | vty_out (vty, "OSPF: Key %d already exists%s", |
| 769 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 770 | return CMD_WARNING; |
| 771 | } |
| 772 | ck = ospf_crypt_key_new (); |
| 773 | ck->key_id = vl_config->crypto_key_id; |
| 774 | memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 775 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 776 | |
| 777 | ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); |
| 778 | } |
| 779 | else if (vl_config->crypto_key_id != 0) |
| 780 | { |
| 781 | /* Delete a key */ |
| 782 | |
| 783 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, |
| 784 | vl_config->crypto_key_id) == NULL) |
| 785 | { |
| 786 | vty_out (vty, "OSPF: Key %d does not exist%s", |
| 787 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 788 | return CMD_WARNING; |
| 789 | } |
| 790 | |
| 791 | ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id); |
| 792 | |
| 793 | } |
| 794 | |
| 795 | return CMD_SUCCESS; |
| 796 | } |
| 797 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 798 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 799 | ospf_vl_set_timers (struct ospf_vl_data *vl_data, |
| 800 | struct ospf_vl_config_data *vl_config) |
| 801 | { |
| 802 | struct interface *ifp = ifp = vl_data->vl_oi->ifp; |
| 803 | /* Virtual Link data initialised to defaults, so only set |
| 804 | if a value given */ |
| 805 | if (vl_config->hello_interval) |
| 806 | { |
| 807 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); |
| 808 | IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval; |
| 809 | } |
| 810 | |
| 811 | if (vl_config->dead_interval) |
| 812 | { |
| 813 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait); |
| 814 | IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval; |
| 815 | } |
| 816 | |
| 817 | if (vl_config->retransmit_interval) |
| 818 | { |
| 819 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval); |
| 820 | IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval; |
| 821 | } |
| 822 | |
| 823 | if (vl_config->transmit_delay) |
| 824 | { |
| 825 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay); |
| 826 | IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay; |
| 827 | } |
| 828 | |
| 829 | return CMD_SUCCESS; |
| 830 | } |
| 831 | |
| 832 | |
| 833 | |
| 834 | /* The business end of all of the above */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 835 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 836 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 837 | { |
| 838 | struct ospf_vl_data *vl_data; |
| 839 | int ret; |
| 840 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 841 | vl_data = ospf_find_vl_data (ospf, vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 842 | if (!vl_data) |
| 843 | return CMD_WARNING; |
| 844 | |
| 845 | /* Process this one first as it can have a fatal result, which can |
| 846 | only logically occur if the virtual link exists already |
| 847 | Thus a command error does not result in a change to the |
| 848 | running configuration such as unexpectedly altered timer |
| 849 | values etc.*/ |
| 850 | ret = ospf_vl_set_security (vl_data, vl_config); |
| 851 | if (ret != CMD_SUCCESS) |
| 852 | return ret; |
| 853 | |
| 854 | /* Set any time based parameters, these area already range checked */ |
| 855 | |
| 856 | ret = ospf_vl_set_timers (vl_data, vl_config); |
| 857 | if (ret != CMD_SUCCESS) |
| 858 | return ret; |
| 859 | |
| 860 | return CMD_SUCCESS; |
| 861 | |
| 862 | } |
| 863 | |
| 864 | /* This stuff exists to make specifying all the alias commands A LOT simpler |
| 865 | */ |
| 866 | #define VLINK_HELPSTR_IPADDR \ |
| 867 | "OSPF area parameters\n" \ |
| 868 | "OSPF area ID in IP address format\n" \ |
| 869 | "OSPF area ID as a decimal value\n" \ |
| 870 | "Configure a virtual link\n" \ |
| 871 | "Router ID of the remote ABR\n" |
| 872 | |
| 873 | #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 874 | "Enable authentication on this virtual link\n" \ |
| 875 | "dummy string \n" |
| 876 | |
| 877 | #define VLINK_HELPSTR_AUTHTYPE_ALL \ |
| 878 | VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 879 | "Use null authentication\n" \ |
| 880 | "Use message-digest authentication\n" |
| 881 | |
| 882 | #define VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 883 | "Time between HELLO packets\n" \ |
| 884 | "Time between retransmitting lost link state advertisements\n" \ |
| 885 | "Link state transmit delay\n" \ |
| 886 | "Interval after which a neighbor is declared dead\n" |
| 887 | |
| 888 | #define VLINK_HELPSTR_TIME_PARAM \ |
| 889 | VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 890 | "Seconds\n" |
| 891 | |
| 892 | #define VLINK_HELPSTR_AUTH_SIMPLE \ |
| 893 | "Authentication password (key)\n" \ |
| 894 | "The OSPF password (key)" |
| 895 | |
| 896 | #define VLINK_HELPSTR_AUTH_MD5 \ |
| 897 | "Message digest authentication password (key)\n" \ |
| 898 | "dummy string \n" \ |
| 899 | "Key ID\n" \ |
| 900 | "Use MD5 algorithm\n" \ |
| 901 | "The OSPF password (key)" |
| 902 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 903 | DEFUN (ospf_area_vlink, |
| 904 | ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 905 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 906 | VLINK_HELPSTR_IPADDR) |
| 907 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 908 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 909 | struct ospf_vl_config_data vl_config; |
| 910 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 911 | char md5_key[OSPF_AUTH_MD5_SIZE+1]; |
| 912 | int i; |
| 913 | int ret; |
| 914 | |
| 915 | ospf_vl_config_data_init(&vl_config, vty); |
| 916 | |
| 917 | /* Read off first 2 parameters and check them */ |
| 918 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); |
| 919 | if (ret < 0) |
| 920 | { |
| 921 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 922 | return CMD_WARNING; |
| 923 | } |
| 924 | |
| 925 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 926 | if (! ret) |
| 927 | { |
| 928 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 929 | VTY_NEWLINE); |
| 930 | return CMD_WARNING; |
| 931 | } |
| 932 | |
| 933 | if (argc <=2) |
| 934 | { |
| 935 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 936 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 937 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 938 | } |
| 939 | |
| 940 | /* Deal with other parameters */ |
| 941 | for (i=2; i < argc; i++) |
| 942 | { |
| 943 | |
| 944 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 945 | |
| 946 | switch (argv[i][0]) |
| 947 | { |
| 948 | |
| 949 | case 'a': |
| 950 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 951 | { |
| 952 | /* authentication-key - this option can occur anywhere on |
| 953 | command line. At start of command line |
| 954 | must check for authentication option. */ |
| 955 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 956 | strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); |
| 957 | vl_config.auth_key = auth_key; |
| 958 | i++; |
| 959 | } |
| 960 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 961 | { |
| 962 | /* authentication - this option can only occur at start |
| 963 | of command line */ |
| 964 | vl_config.auth_type = OSPF_AUTH_SIMPLE; |
| 965 | if ((i+1) < argc) |
| 966 | { |
| 967 | if (strncmp (argv[i+1], "n", 1) == 0) |
| 968 | { |
| 969 | /* "authentication null" */ |
| 970 | vl_config.auth_type = OSPF_AUTH_NULL; |
| 971 | i++; |
| 972 | } |
| 973 | else if (strncmp (argv[i+1], "m", 1) == 0 |
| 974 | && strcmp (argv[i+1], "message-digest-") != 0) |
| 975 | { |
| 976 | /* "authentication message-digest" */ |
| 977 | vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 978 | i++; |
| 979 | } |
| 980 | } |
| 981 | } |
| 982 | break; |
| 983 | |
| 984 | case 'm': |
| 985 | /* message-digest-key */ |
| 986 | i++; |
| 987 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 988 | if (vl_config.crypto_key_id < 0) |
| 989 | return CMD_WARNING; |
| 990 | i++; |
| 991 | memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); |
| 992 | strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); |
| 993 | vl_config.md5_key = md5_key; |
| 994 | break; |
| 995 | |
| 996 | case 'h': |
| 997 | /* Hello interval */ |
| 998 | i++; |
| 999 | vl_config.hello_interval = strtol (argv[i], NULL, 10); |
| 1000 | if (vl_config.hello_interval < 0) |
| 1001 | return CMD_WARNING; |
| 1002 | break; |
| 1003 | |
| 1004 | case 'r': |
| 1005 | /* Retransmit Interval */ |
| 1006 | i++; |
| 1007 | vl_config.retransmit_interval = strtol (argv[i], NULL, 10); |
| 1008 | if (vl_config.retransmit_interval < 0) |
| 1009 | return CMD_WARNING; |
| 1010 | break; |
| 1011 | |
| 1012 | case 't': |
| 1013 | /* Transmit Delay */ |
| 1014 | i++; |
| 1015 | vl_config.transmit_delay = strtol (argv[i], NULL, 10); |
| 1016 | if (vl_config.transmit_delay < 0) |
| 1017 | return CMD_WARNING; |
| 1018 | break; |
| 1019 | |
| 1020 | case 'd': |
| 1021 | /* Dead Interval */ |
| 1022 | i++; |
| 1023 | vl_config.dead_interval = strtol (argv[i], NULL, 10); |
| 1024 | if (vl_config.dead_interval < 0) |
| 1025 | return CMD_WARNING; |
| 1026 | break; |
| 1027 | } |
| 1028 | } |
| 1029 | |
| 1030 | |
| 1031 | /* Action configuration */ |
| 1032 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1033 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1034 | |
| 1035 | } |
| 1036 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1037 | DEFUN (no_ospf_area_vlink, |
| 1038 | no_ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1039 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 1040 | NO_STR |
| 1041 | VLINK_HELPSTR_IPADDR) |
| 1042 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1043 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1044 | struct ospf_area *area; |
| 1045 | struct ospf_vl_config_data vl_config; |
| 1046 | struct ospf_vl_data *vl_data = NULL; |
| 1047 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 1048 | int i; |
| 1049 | int ret, format; |
| 1050 | |
| 1051 | ospf_vl_config_data_init(&vl_config, vty); |
| 1052 | |
| 1053 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); |
| 1054 | if (ret < 0) |
| 1055 | { |
| 1056 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 1057 | return CMD_WARNING; |
| 1058 | } |
| 1059 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1060 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1061 | if (!area) |
| 1062 | { |
| 1063 | vty_out (vty, "Area does not exist%s", VTY_NEWLINE); |
| 1064 | return CMD_WARNING; |
| 1065 | } |
| 1066 | |
| 1067 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 1068 | if (! ret) |
| 1069 | { |
| 1070 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 1071 | VTY_NEWLINE); |
| 1072 | return CMD_WARNING; |
| 1073 | } |
| 1074 | |
| 1075 | if (argc <=2) |
| 1076 | { |
| 1077 | /* Basic VLink no command */ |
| 1078 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 1079 | if ((vl_data = ospf_vl_lookup (area, vl_config.vl_peer))) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1080 | ospf_vl_delete (ospf, vl_data); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1081 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1082 | ospf_area_check_free (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1083 | |
| 1084 | return CMD_SUCCESS; |
| 1085 | } |
| 1086 | |
| 1087 | /* If we are down here, we are reseting parameters */ |
| 1088 | |
| 1089 | /* Deal with other parameters */ |
| 1090 | for (i=2; i < argc; i++) |
| 1091 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1092 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 1093 | |
| 1094 | switch (argv[i][0]) |
| 1095 | { |
| 1096 | |
| 1097 | case 'a': |
| 1098 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 1099 | { |
| 1100 | /* authentication-key - this option can occur anywhere on |
| 1101 | command line. At start of command line |
| 1102 | must check for authentication option. */ |
| 1103 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 1104 | vl_config.auth_key = auth_key; |
| 1105 | } |
| 1106 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1107 | { |
| 1108 | /* authentication - this option can only occur at start |
| 1109 | of command line */ |
| 1110 | vl_config.auth_type = OSPF_AUTH_NOTSET; |
| 1111 | } |
| 1112 | break; |
| 1113 | |
| 1114 | case 'm': |
| 1115 | /* message-digest-key */ |
| 1116 | /* Delete one key */ |
| 1117 | i++; |
| 1118 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1119 | if (vl_config.crypto_key_id < 0) |
| 1120 | return CMD_WARNING; |
| 1121 | vl_config.md5_key = NULL; |
| 1122 | break; |
| 1123 | |
| 1124 | case 'h': |
| 1125 | /* Hello interval */ |
| 1126 | vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; |
| 1127 | break; |
| 1128 | |
| 1129 | case 'r': |
| 1130 | /* Retransmit Interval */ |
| 1131 | vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 1132 | break; |
| 1133 | |
| 1134 | case 't': |
| 1135 | /* Transmit Delay */ |
| 1136 | vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 1137 | break; |
| 1138 | |
| 1139 | case 'd': |
| 1140 | /* Dead Interval */ |
| 1141 | i++; |
| 1142 | vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 1143 | break; |
| 1144 | } |
| 1145 | } |
| 1146 | |
| 1147 | |
| 1148 | /* Action configuration */ |
| 1149 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1150 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1151 | } |
| 1152 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1153 | ALIAS (ospf_area_vlink, |
| 1154 | ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1155 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1156 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1157 | VLINK_HELPSTR_IPADDR |
| 1158 | VLINK_HELPSTR_TIME_PARAM) |
| 1159 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1160 | ALIAS (no_ospf_area_vlink, |
| 1161 | no_ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1162 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1163 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1164 | NO_STR |
| 1165 | VLINK_HELPSTR_IPADDR |
| 1166 | VLINK_HELPSTR_TIME_PARAM) |
| 1167 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1168 | ALIAS (ospf_area_vlink, |
| 1169 | ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1170 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1171 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1172 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1173 | VLINK_HELPSTR_IPADDR |
| 1174 | VLINK_HELPSTR_TIME_PARAM |
| 1175 | VLINK_HELPSTR_TIME_PARAM) |
| 1176 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1177 | ALIAS (no_ospf_area_vlink, |
| 1178 | no_ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1179 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1180 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1181 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1182 | NO_STR |
| 1183 | VLINK_HELPSTR_IPADDR |
| 1184 | VLINK_HELPSTR_TIME_PARAM |
| 1185 | VLINK_HELPSTR_TIME_PARAM) |
| 1186 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1187 | ALIAS (ospf_area_vlink, |
| 1188 | ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1189 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1190 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1191 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1192 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1193 | VLINK_HELPSTR_IPADDR |
| 1194 | VLINK_HELPSTR_TIME_PARAM |
| 1195 | VLINK_HELPSTR_TIME_PARAM |
| 1196 | VLINK_HELPSTR_TIME_PARAM) |
| 1197 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1198 | ALIAS (no_ospf_area_vlink, |
| 1199 | no_ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1200 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1201 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1202 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1203 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1204 | NO_STR |
| 1205 | VLINK_HELPSTR_IPADDR |
| 1206 | VLINK_HELPSTR_TIME_PARAM |
| 1207 | VLINK_HELPSTR_TIME_PARAM |
| 1208 | VLINK_HELPSTR_TIME_PARAM) |
| 1209 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1210 | ALIAS (ospf_area_vlink, |
| 1211 | ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1212 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1213 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1214 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1215 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1216 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 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 (no_ospf_area_vlink, |
| 1224 | no_ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1225 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1226 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1227 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1228 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1229 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1230 | NO_STR |
| 1231 | VLINK_HELPSTR_IPADDR |
| 1232 | VLINK_HELPSTR_TIME_PARAM |
| 1233 | VLINK_HELPSTR_TIME_PARAM |
| 1234 | VLINK_HELPSTR_TIME_PARAM |
| 1235 | VLINK_HELPSTR_TIME_PARAM) |
| 1236 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1237 | ALIAS (ospf_area_vlink, |
| 1238 | ospf_area_vlink_authtype_args_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1239 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1240 | "(authentication|) (message-digest|null)", |
| 1241 | VLINK_HELPSTR_IPADDR |
| 1242 | VLINK_HELPSTR_AUTHTYPE_ALL) |
| 1243 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1244 | ALIAS (ospf_area_vlink, |
| 1245 | ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1246 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1247 | "(authentication|)", |
| 1248 | VLINK_HELPSTR_IPADDR |
| 1249 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1250 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1251 | ALIAS (no_ospf_area_vlink, |
| 1252 | no_ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1253 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1254 | "(authentication|)", |
| 1255 | NO_STR |
| 1256 | VLINK_HELPSTR_IPADDR |
| 1257 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1258 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1259 | ALIAS (ospf_area_vlink, |
| 1260 | ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1261 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1262 | "(message-digest-key|) <1-255> md5 KEY", |
| 1263 | VLINK_HELPSTR_IPADDR |
| 1264 | VLINK_HELPSTR_AUTH_MD5) |
| 1265 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1266 | ALIAS (no_ospf_area_vlink, |
| 1267 | no_ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1268 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1269 | "(message-digest-key|) <1-255>", |
| 1270 | NO_STR |
| 1271 | VLINK_HELPSTR_IPADDR |
| 1272 | VLINK_HELPSTR_AUTH_MD5) |
| 1273 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1274 | ALIAS (ospf_area_vlink, |
| 1275 | ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1276 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1277 | "(authentication-key|) AUTH_KEY", |
| 1278 | VLINK_HELPSTR_IPADDR |
| 1279 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1280 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1281 | ALIAS (no_ospf_area_vlink, |
| 1282 | no_ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1283 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1284 | "(authentication-key|)", |
| 1285 | NO_STR |
| 1286 | VLINK_HELPSTR_IPADDR |
| 1287 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1288 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1289 | ALIAS (ospf_area_vlink, |
| 1290 | ospf_area_vlink_authtype_args_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1291 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1292 | "(authentication|) (message-digest|null) " |
| 1293 | "(authentication-key|) AUTH_KEY", |
| 1294 | VLINK_HELPSTR_IPADDR |
| 1295 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1296 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1297 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1298 | ALIAS (ospf_area_vlink, |
| 1299 | ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1300 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1301 | "(authentication|) " |
| 1302 | "(authentication-key|) AUTH_KEY", |
| 1303 | VLINK_HELPSTR_IPADDR |
| 1304 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1305 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1306 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1307 | ALIAS (no_ospf_area_vlink, |
| 1308 | no_ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1309 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1310 | "(authentication|) " |
| 1311 | "(authentication-key|)", |
| 1312 | NO_STR |
| 1313 | VLINK_HELPSTR_IPADDR |
| 1314 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1315 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1316 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1317 | ALIAS (ospf_area_vlink, |
| 1318 | ospf_area_vlink_authtype_args_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1319 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1320 | "(authentication|) (message-digest|null) " |
| 1321 | "(message-digest-key|) <1-255> md5 KEY", |
| 1322 | VLINK_HELPSTR_IPADDR |
| 1323 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1324 | VLINK_HELPSTR_AUTH_MD5) |
| 1325 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1326 | ALIAS (ospf_area_vlink, |
| 1327 | ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1328 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1329 | "(authentication|) " |
| 1330 | "(message-digest-key|) <1-255> md5 KEY", |
| 1331 | VLINK_HELPSTR_IPADDR |
| 1332 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1333 | VLINK_HELPSTR_AUTH_MD5) |
| 1334 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1335 | ALIAS (no_ospf_area_vlink, |
| 1336 | no_ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1337 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1338 | "(authentication|) " |
| 1339 | "(message-digest-key|)", |
| 1340 | NO_STR |
| 1341 | VLINK_HELPSTR_IPADDR |
| 1342 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1343 | VLINK_HELPSTR_AUTH_MD5) |
| 1344 | |
| 1345 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1346 | DEFUN (ospf_area_shortcut, |
| 1347 | ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1348 | "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", |
| 1349 | "OSPF area parameters\n" |
| 1350 | "OSPF area ID in IP address format\n" |
| 1351 | "OSPF area ID as a decimal value\n" |
| 1352 | "Configure the area's shortcutting mode\n" |
| 1353 | "Set default shortcutting behavior\n" |
| 1354 | "Enable shortcutting through the area\n" |
| 1355 | "Disable shortcutting through the area\n") |
| 1356 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1357 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1358 | struct ospf_area *area; |
| 1359 | struct in_addr area_id; |
| 1360 | int mode; |
| 1361 | int format; |
| 1362 | |
| 1363 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1364 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1365 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1366 | |
| 1367 | if (strncmp (argv[1], "de", 2) == 0) |
| 1368 | mode = OSPF_SHORTCUT_DEFAULT; |
| 1369 | else if (strncmp (argv[1], "di", 2) == 0) |
| 1370 | mode = OSPF_SHORTCUT_DISABLE; |
| 1371 | else if (strncmp (argv[1], "e", 1) == 0) |
| 1372 | mode = OSPF_SHORTCUT_ENABLE; |
| 1373 | else |
| 1374 | return CMD_WARNING; |
| 1375 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1376 | ospf_area_shortcut_set (ospf, area, mode); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1377 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1378 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1379 | vty_out (vty, "Shortcut area setting will take effect " |
| 1380 | "only when the router is configured as Shortcut ABR%s", |
| 1381 | VTY_NEWLINE); |
| 1382 | |
| 1383 | return CMD_SUCCESS; |
| 1384 | } |
| 1385 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1386 | DEFUN (no_ospf_area_shortcut, |
| 1387 | no_ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1388 | "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", |
| 1389 | NO_STR |
| 1390 | "OSPF area parameters\n" |
| 1391 | "OSPF area ID in IP address format\n" |
| 1392 | "OSPF area ID as a decimal value\n" |
| 1393 | "Deconfigure the area's shortcutting mode\n" |
| 1394 | "Deconfigure enabled shortcutting through the area\n" |
| 1395 | "Deconfigure disabled shortcutting through the area\n") |
| 1396 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1397 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1398 | struct ospf_area *area; |
| 1399 | struct in_addr area_id; |
| 1400 | int format; |
| 1401 | |
| 1402 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1403 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1404 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1405 | if (!area) |
| 1406 | return CMD_SUCCESS; |
| 1407 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1408 | ospf_area_shortcut_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1409 | |
| 1410 | return CMD_SUCCESS; |
| 1411 | } |
| 1412 | |
| 1413 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1414 | DEFUN (ospf_area_stub, |
| 1415 | ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1416 | "area (A.B.C.D|<0-4294967295>) stub", |
| 1417 | "OSPF area parameters\n" |
| 1418 | "OSPF area ID in IP address format\n" |
| 1419 | "OSPF area ID as a decimal value\n" |
| 1420 | "Configure OSPF area as stub\n") |
| 1421 | { |
| 1422 | struct ospf *ospf = vty->index; |
| 1423 | struct in_addr area_id; |
| 1424 | int ret, format; |
| 1425 | |
| 1426 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1427 | |
| 1428 | ret = ospf_area_stub_set (ospf, area_id); |
| 1429 | if (ret == 0) |
| 1430 | { |
| 1431 | vty_out (vty, "First deconfigure all virtual link through this area%s", |
| 1432 | VTY_NEWLINE); |
| 1433 | return CMD_WARNING; |
| 1434 | } |
| 1435 | |
| 1436 | ospf_area_no_summary_unset (ospf, area_id); |
| 1437 | |
| 1438 | return CMD_SUCCESS; |
| 1439 | } |
| 1440 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1441 | DEFUN (ospf_area_stub_no_summary, |
| 1442 | ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1443 | "area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1444 | "OSPF stub parameters\n" |
| 1445 | "OSPF area ID in IP address format\n" |
| 1446 | "OSPF area ID as a decimal value\n" |
| 1447 | "Configure OSPF area as stub\n" |
| 1448 | "Do not inject inter-area routes into stub\n") |
| 1449 | { |
| 1450 | struct ospf *ospf = vty->index; |
| 1451 | struct in_addr area_id; |
| 1452 | int ret, format; |
| 1453 | |
| 1454 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1455 | |
| 1456 | ret = ospf_area_stub_set (ospf, area_id); |
| 1457 | if (ret == 0) |
| 1458 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1459 | 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] | 1460 | VTY_NEWLINE); |
| 1461 | return CMD_WARNING; |
| 1462 | } |
| 1463 | |
| 1464 | ospf_area_no_summary_set (ospf, area_id); |
| 1465 | |
| 1466 | return CMD_SUCCESS; |
| 1467 | } |
| 1468 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1469 | DEFUN (no_ospf_area_stub, |
| 1470 | no_ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1471 | "no area (A.B.C.D|<0-4294967295>) stub", |
| 1472 | NO_STR |
| 1473 | "OSPF area parameters\n" |
| 1474 | "OSPF area ID in IP address format\n" |
| 1475 | "OSPF area ID as a decimal value\n" |
| 1476 | "Configure OSPF area as stub\n") |
| 1477 | { |
| 1478 | struct ospf *ospf = vty->index; |
| 1479 | struct in_addr area_id; |
| 1480 | int format; |
| 1481 | |
| 1482 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1483 | |
| 1484 | ospf_area_stub_unset (ospf, area_id); |
| 1485 | ospf_area_no_summary_unset (ospf, area_id); |
| 1486 | |
| 1487 | return CMD_SUCCESS; |
| 1488 | } |
| 1489 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1490 | DEFUN (no_ospf_area_stub_no_summary, |
| 1491 | no_ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1492 | "no area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1493 | NO_STR |
| 1494 | "OSPF area parameters\n" |
| 1495 | "OSPF area ID in IP address format\n" |
| 1496 | "OSPF area ID as a decimal value\n" |
| 1497 | "Configure OSPF area as stub\n" |
| 1498 | "Do not inject inter-area routes into area\n") |
| 1499 | { |
| 1500 | struct ospf *ospf = vty->index; |
| 1501 | struct in_addr area_id; |
| 1502 | int format; |
| 1503 | |
| 1504 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1505 | ospf_area_no_summary_unset (ospf, area_id); |
| 1506 | |
| 1507 | return CMD_SUCCESS; |
| 1508 | } |
| 1509 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1510 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 1511 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
| 1512 | int nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1513 | { |
| 1514 | struct ospf *ospf = vty->index; |
| 1515 | struct in_addr area_id; |
| 1516 | int ret, format; |
| 1517 | |
| 1518 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1519 | |
| 1520 | ret = ospf_area_nssa_set (ospf, area_id); |
| 1521 | if (ret == 0) |
| 1522 | { |
| 1523 | vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", |
| 1524 | VTY_NEWLINE); |
| 1525 | return CMD_WARNING; |
| 1526 | } |
| 1527 | |
| 1528 | if (argc > 1) |
| 1529 | { |
| 1530 | if (strncmp (argv[1], "translate-c", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1531 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1532 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1533 | else if (strncmp (argv[1], "translate-n", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1534 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1535 | OSPF_NSSA_ROLE_NEVER); |
| 1536 | else if (strncmp (argv[1], "translate-a", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1537 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1538 | OSPF_NSSA_ROLE_ALWAYS); |
| 1539 | } |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1540 | else |
| 1541 | { |
| 1542 | ospf_area_nssa_translator_role_set (ospf, area_id, |
| 1543 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1544 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1545 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1546 | if (nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1547 | ospf_area_no_summary_set (ospf, area_id); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1548 | else |
| 1549 | ospf_area_no_summary_unset (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1550 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1551 | ospf_schedule_abr_task (ospf); |
| 1552 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1553 | return CMD_SUCCESS; |
| 1554 | } |
| 1555 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1556 | DEFUN (ospf_area_nssa_translate_no_summary, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1557 | ospf_area_nssa_translate_no_summary_cmd, |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1558 | "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] | 1559 | "OSPF area parameters\n" |
| 1560 | "OSPF area ID in IP address format\n" |
| 1561 | "OSPF area ID as a decimal value\n" |
| 1562 | "Configure OSPF area as nssa\n" |
| 1563 | "Configure NSSA-ABR for translate election (default)\n" |
| 1564 | "Configure NSSA-ABR to never translate\n" |
| 1565 | "Configure NSSA-ABR to always translate\n" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1566 | "Do not inject inter-area routes into nssa\n") |
| 1567 | { |
| 1568 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
| 1569 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1570 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1571 | DEFUN (ospf_area_nssa_translate, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1572 | ospf_area_nssa_translate_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1573 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", |
| 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 | "Configure NSSA-ABR for translate election (default)\n" |
| 1579 | "Configure NSSA-ABR to never translate\n" |
| 1580 | "Configure NSSA-ABR to always translate\n") |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1581 | { |
| 1582 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1583 | } |
| 1584 | |
| 1585 | DEFUN (ospf_area_nssa, |
| 1586 | ospf_area_nssa_cmd, |
| 1587 | "area (A.B.C.D|<0-4294967295>) nssa", |
| 1588 | "OSPF area parameters\n" |
| 1589 | "OSPF area ID in IP address format\n" |
| 1590 | "OSPF area ID as a decimal value\n" |
| 1591 | "Configure OSPF area as nssa\n") |
| 1592 | { |
| 1593 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1594 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1595 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1596 | DEFUN (ospf_area_nssa_no_summary, |
| 1597 | ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1598 | "area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1599 | "OSPF area parameters\n" |
| 1600 | "OSPF area ID in IP address format\n" |
| 1601 | "OSPF area ID as a decimal value\n" |
| 1602 | "Configure OSPF area as nssa\n" |
| 1603 | "Do not inject inter-area routes into nssa\n") |
| 1604 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1605 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1606 | } |
| 1607 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1608 | DEFUN (no_ospf_area_nssa, |
| 1609 | no_ospf_area_nssa_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1610 | "no area (A.B.C.D|<0-4294967295>) nssa", |
| 1611 | NO_STR |
| 1612 | "OSPF area parameters\n" |
| 1613 | "OSPF area ID in IP address format\n" |
| 1614 | "OSPF area ID as a decimal value\n" |
| 1615 | "Configure OSPF area as nssa\n") |
| 1616 | { |
| 1617 | struct ospf *ospf = vty->index; |
| 1618 | struct in_addr area_id; |
| 1619 | int format; |
| 1620 | |
| 1621 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1622 | |
| 1623 | ospf_area_nssa_unset (ospf, area_id); |
| 1624 | ospf_area_no_summary_unset (ospf, area_id); |
| 1625 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1626 | ospf_schedule_abr_task (ospf); |
| 1627 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1628 | return CMD_SUCCESS; |
| 1629 | } |
| 1630 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1631 | DEFUN (no_ospf_area_nssa_no_summary, |
| 1632 | no_ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1633 | "no area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1634 | NO_STR |
| 1635 | "OSPF area parameters\n" |
| 1636 | "OSPF area ID in IP address format\n" |
| 1637 | "OSPF area ID as a decimal value\n" |
| 1638 | "Configure OSPF area as nssa\n" |
| 1639 | "Do not inject inter-area routes into nssa\n") |
| 1640 | { |
| 1641 | struct ospf *ospf = vty->index; |
| 1642 | struct in_addr area_id; |
| 1643 | int format; |
| 1644 | |
| 1645 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1646 | ospf_area_no_summary_unset (ospf, area_id); |
| 1647 | |
| 1648 | return CMD_SUCCESS; |
| 1649 | } |
| 1650 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1651 | DEFUN (ospf_area_default_cost, |
| 1652 | ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1653 | "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1654 | "OSPF area parameters\n" |
| 1655 | "OSPF area ID in IP address format\n" |
| 1656 | "OSPF area ID as a decimal value\n" |
| 1657 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1658 | "Stub's advertised default summary cost\n") |
| 1659 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1660 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1661 | struct ospf_area *area; |
| 1662 | struct in_addr area_id; |
| 1663 | u_int32_t cost; |
| 1664 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1665 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1666 | |
| 1667 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1668 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1669 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1670 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1671 | |
| 1672 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1673 | { |
| 1674 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1675 | return CMD_WARNING; |
| 1676 | } |
| 1677 | |
| 1678 | area->default_cost = cost; |
| 1679 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1680 | p.family = AF_INET; |
| 1681 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1682 | p.prefixlen = 0; |
| 1683 | if (IS_DEBUG_OSPF_EVENT) |
| 1684 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1685 | "announcing 0.0.0.0/0 to area %s", |
| 1686 | inet_ntoa (area->area_id)); |
| 1687 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1688 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1689 | return CMD_SUCCESS; |
| 1690 | } |
| 1691 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1692 | DEFUN (no_ospf_area_default_cost, |
| 1693 | no_ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1694 | "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1695 | NO_STR |
| 1696 | "OSPF area parameters\n" |
| 1697 | "OSPF area ID in IP address format\n" |
| 1698 | "OSPF area ID as a decimal value\n" |
| 1699 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1700 | "Stub's advertised default summary cost\n") |
| 1701 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1702 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1703 | struct ospf_area *area; |
| 1704 | struct in_addr area_id; |
| 1705 | u_int32_t cost; |
| 1706 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1707 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1708 | |
| 1709 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1710 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1711 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1712 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1713 | if (area == NULL) |
| 1714 | return CMD_SUCCESS; |
| 1715 | |
| 1716 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1717 | { |
| 1718 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1719 | return CMD_WARNING; |
| 1720 | } |
| 1721 | |
| 1722 | area->default_cost = 1; |
| 1723 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1724 | p.family = AF_INET; |
| 1725 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1726 | p.prefixlen = 0; |
| 1727 | if (IS_DEBUG_OSPF_EVENT) |
| 1728 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1729 | "announcing 0.0.0.0/0 to area %s", |
| 1730 | inet_ntoa (area->area_id)); |
| 1731 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1732 | |
| 1733 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1734 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1735 | |
| 1736 | return CMD_SUCCESS; |
| 1737 | } |
| 1738 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1739 | DEFUN (ospf_area_export_list, |
| 1740 | ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1741 | "area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1742 | "OSPF area parameters\n" |
| 1743 | "OSPF area ID in IP address format\n" |
| 1744 | "OSPF area ID as a decimal value\n" |
| 1745 | "Set the filter for networks announced to other areas\n" |
| 1746 | "Name of the access-list\n") |
| 1747 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1748 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1749 | struct ospf_area *area; |
| 1750 | struct in_addr area_id; |
| 1751 | int format; |
| 1752 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1753 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1754 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1755 | area = ospf_area_get (ospf, area_id, format); |
| 1756 | ospf_area_export_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1757 | |
| 1758 | return CMD_SUCCESS; |
| 1759 | } |
| 1760 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1761 | DEFUN (no_ospf_area_export_list, |
| 1762 | no_ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1763 | "no area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1764 | NO_STR |
| 1765 | "OSPF area parameters\n" |
| 1766 | "OSPF area ID in IP address format\n" |
| 1767 | "OSPF area ID as a decimal value\n" |
| 1768 | "Unset the filter for networks announced to other areas\n" |
| 1769 | "Name of the access-list\n") |
| 1770 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1771 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1772 | struct ospf_area *area; |
| 1773 | struct in_addr area_id; |
| 1774 | int format; |
| 1775 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1776 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1777 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1778 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1779 | if (area == NULL) |
| 1780 | return CMD_SUCCESS; |
| 1781 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1782 | ospf_area_export_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1783 | |
| 1784 | return CMD_SUCCESS; |
| 1785 | } |
| 1786 | |
| 1787 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1788 | DEFUN (ospf_area_import_list, |
| 1789 | ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1790 | "area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1791 | "OSPF area parameters\n" |
| 1792 | "OSPF area ID in IP address format\n" |
| 1793 | "OSPF area ID as a decimal value\n" |
| 1794 | "Set the filter for networks from other areas announced to the specified one\n" |
| 1795 | "Name of the access-list\n") |
| 1796 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1797 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1798 | struct ospf_area *area; |
| 1799 | struct in_addr area_id; |
| 1800 | int format; |
| 1801 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1802 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1803 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1804 | area = ospf_area_get (ospf, area_id, format); |
| 1805 | ospf_area_import_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1806 | |
| 1807 | return CMD_SUCCESS; |
| 1808 | } |
| 1809 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1810 | DEFUN (no_ospf_area_import_list, |
| 1811 | no_ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1812 | "no area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1813 | NO_STR |
| 1814 | "OSPF area parameters\n" |
| 1815 | "OSPF area ID in IP address format\n" |
| 1816 | "OSPF area ID as a decimal value\n" |
| 1817 | "Unset the filter for networks announced to other areas\n" |
| 1818 | "Name of the access-list\n") |
| 1819 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1820 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1821 | struct ospf_area *area; |
| 1822 | struct in_addr area_id; |
| 1823 | int format; |
| 1824 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1825 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1826 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1827 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1828 | if (area == NULL) |
| 1829 | return CMD_SUCCESS; |
| 1830 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1831 | ospf_area_import_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1832 | |
| 1833 | return CMD_SUCCESS; |
| 1834 | } |
| 1835 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1836 | DEFUN (ospf_area_filter_list, |
| 1837 | ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1838 | "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1839 | "OSPF area parameters\n" |
| 1840 | "OSPF area ID in IP address format\n" |
| 1841 | "OSPF area ID as a decimal value\n" |
| 1842 | "Filter networks between OSPF areas\n" |
| 1843 | "Filter prefixes between OSPF areas\n" |
| 1844 | "Name of an IP prefix-list\n" |
| 1845 | "Filter networks sent to this area\n" |
| 1846 | "Filter networks sent from this area\n") |
| 1847 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1848 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1849 | struct ospf_area *area; |
| 1850 | struct in_addr area_id; |
| 1851 | struct prefix_list *plist; |
| 1852 | int format; |
| 1853 | |
| 1854 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1855 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1856 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1857 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1858 | if (strncmp (argv[2], "in", 2) == 0) |
| 1859 | { |
| 1860 | PREFIX_LIST_IN (area) = plist; |
| 1861 | if (PREFIX_NAME_IN (area)) |
| 1862 | free (PREFIX_NAME_IN (area)); |
| 1863 | |
| 1864 | PREFIX_NAME_IN (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1865 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1866 | } |
| 1867 | else |
| 1868 | { |
| 1869 | PREFIX_LIST_OUT (area) = plist; |
| 1870 | if (PREFIX_NAME_OUT (area)) |
| 1871 | free (PREFIX_NAME_OUT (area)); |
| 1872 | |
| 1873 | PREFIX_NAME_OUT (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1874 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1875 | } |
| 1876 | |
| 1877 | return CMD_SUCCESS; |
| 1878 | } |
| 1879 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1880 | DEFUN (no_ospf_area_filter_list, |
| 1881 | no_ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1882 | "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1883 | NO_STR |
| 1884 | "OSPF area parameters\n" |
| 1885 | "OSPF area ID in IP address format\n" |
| 1886 | "OSPF area ID as a decimal value\n" |
| 1887 | "Filter networks between OSPF areas\n" |
| 1888 | "Filter prefixes between OSPF areas\n" |
| 1889 | "Name of an IP prefix-list\n" |
| 1890 | "Filter networks sent to this area\n" |
| 1891 | "Filter networks sent from this area\n") |
| 1892 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1893 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1894 | struct ospf_area *area; |
| 1895 | struct in_addr area_id; |
| 1896 | struct prefix_list *plist; |
| 1897 | int format; |
| 1898 | |
| 1899 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1900 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1901 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1902 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1903 | if (strncmp (argv[2], "in", 2) == 0) |
| 1904 | { |
| 1905 | if (PREFIX_NAME_IN (area)) |
| 1906 | if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) |
| 1907 | return CMD_SUCCESS; |
| 1908 | |
| 1909 | PREFIX_LIST_IN (area) = NULL; |
| 1910 | if (PREFIX_NAME_IN (area)) |
| 1911 | free (PREFIX_NAME_IN (area)); |
| 1912 | |
| 1913 | PREFIX_NAME_IN (area) = NULL; |
| 1914 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1915 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1916 | } |
| 1917 | else |
| 1918 | { |
| 1919 | if (PREFIX_NAME_OUT (area)) |
| 1920 | if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) |
| 1921 | return CMD_SUCCESS; |
| 1922 | |
| 1923 | PREFIX_LIST_OUT (area) = NULL; |
| 1924 | if (PREFIX_NAME_OUT (area)) |
| 1925 | free (PREFIX_NAME_OUT (area)); |
| 1926 | |
| 1927 | PREFIX_NAME_OUT (area) = NULL; |
| 1928 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1929 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1930 | } |
| 1931 | |
| 1932 | return CMD_SUCCESS; |
| 1933 | } |
| 1934 | |
| 1935 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1936 | DEFUN (ospf_area_authentication_message_digest, |
| 1937 | ospf_area_authentication_message_digest_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1938 | "area (A.B.C.D|<0-4294967295>) authentication message-digest", |
| 1939 | "OSPF area parameters\n" |
| 1940 | "Enable authentication\n" |
| 1941 | "Use message-digest authentication\n") |
| 1942 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1943 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1944 | struct ospf_area *area; |
| 1945 | struct in_addr area_id; |
| 1946 | int format; |
| 1947 | |
| 1948 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1949 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1950 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1951 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1952 | |
| 1953 | return CMD_SUCCESS; |
| 1954 | } |
| 1955 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1956 | DEFUN (ospf_area_authentication, |
| 1957 | ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1958 | "area (A.B.C.D|<0-4294967295>) authentication", |
| 1959 | "OSPF area parameters\n" |
| 1960 | "OSPF area ID in IP address format\n" |
| 1961 | "OSPF area ID as a decimal value\n" |
| 1962 | "Enable authentication\n") |
| 1963 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1964 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1965 | struct ospf_area *area; |
| 1966 | struct in_addr area_id; |
| 1967 | int format; |
| 1968 | |
| 1969 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1970 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1971 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1972 | area->auth_type = OSPF_AUTH_SIMPLE; |
| 1973 | |
| 1974 | return CMD_SUCCESS; |
| 1975 | } |
| 1976 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1977 | DEFUN (no_ospf_area_authentication, |
| 1978 | no_ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1979 | "no area (A.B.C.D|<0-4294967295>) authentication", |
| 1980 | NO_STR |
| 1981 | "OSPF area parameters\n" |
| 1982 | "OSPF area ID in IP address format\n" |
| 1983 | "OSPF area ID as a decimal value\n" |
| 1984 | "Enable authentication\n") |
| 1985 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1986 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1987 | struct ospf_area *area; |
| 1988 | struct in_addr area_id; |
| 1989 | int format; |
| 1990 | |
| 1991 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1992 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1993 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1994 | if (area == NULL) |
| 1995 | return CMD_SUCCESS; |
| 1996 | |
| 1997 | area->auth_type = OSPF_AUTH_NULL; |
| 1998 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1999 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2000 | |
| 2001 | return CMD_SUCCESS; |
| 2002 | } |
| 2003 | |
| 2004 | |
| 2005 | DEFUN (ospf_abr_type, |
| 2006 | ospf_abr_type_cmd, |
| 2007 | "ospf abr-type (cisco|ibm|shortcut|standard)", |
| 2008 | "OSPF specific commands\n" |
| 2009 | "Set OSPF ABR type\n" |
| 2010 | "Alternative ABR, cisco implementation\n" |
| 2011 | "Alternative ABR, IBM implementation\n" |
| 2012 | "Shortcut ABR\n" |
| 2013 | "Standard behavior (RFC2328)\n") |
| 2014 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2015 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2016 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2017 | |
| 2018 | if (strncmp (argv[0], "c", 1) == 0) |
| 2019 | abr_type = OSPF_ABR_CISCO; |
| 2020 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2021 | abr_type = OSPF_ABR_IBM; |
| 2022 | else if (strncmp (argv[0], "sh", 2) == 0) |
| 2023 | abr_type = OSPF_ABR_SHORTCUT; |
| 2024 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2025 | abr_type = OSPF_ABR_STAND; |
| 2026 | else |
| 2027 | return CMD_WARNING; |
| 2028 | |
| 2029 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2030 | if (ospf->abr_type != abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2031 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2032 | ospf->abr_type = abr_type; |
| 2033 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2034 | } |
| 2035 | |
| 2036 | return CMD_SUCCESS; |
| 2037 | } |
| 2038 | |
| 2039 | DEFUN (no_ospf_abr_type, |
| 2040 | no_ospf_abr_type_cmd, |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2041 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2042 | NO_STR |
| 2043 | "OSPF specific commands\n" |
| 2044 | "Set OSPF ABR type\n" |
| 2045 | "Alternative ABR, cisco implementation\n" |
| 2046 | "Alternative ABR, IBM implementation\n" |
| 2047 | "Shortcut ABR\n") |
| 2048 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2049 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2050 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2051 | |
| 2052 | if (strncmp (argv[0], "c", 1) == 0) |
| 2053 | abr_type = OSPF_ABR_CISCO; |
| 2054 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2055 | abr_type = OSPF_ABR_IBM; |
| 2056 | else if (strncmp (argv[0], "s", 1) == 0) |
| 2057 | abr_type = OSPF_ABR_SHORTCUT; |
| 2058 | else |
| 2059 | return CMD_WARNING; |
| 2060 | |
| 2061 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2062 | if (ospf->abr_type == abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2063 | { |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2064 | ospf->abr_type = OSPF_ABR_DEFAULT; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2065 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2066 | } |
| 2067 | |
| 2068 | return CMD_SUCCESS; |
| 2069 | } |
| 2070 | |
| 2071 | DEFUN (ospf_compatible_rfc1583, |
| 2072 | ospf_compatible_rfc1583_cmd, |
| 2073 | "compatible rfc1583", |
| 2074 | "OSPF compatibility list\n" |
| 2075 | "compatible with RFC 1583\n") |
| 2076 | { |
| 2077 | struct ospf *ospf = vty->index; |
| 2078 | |
| 2079 | if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2080 | { |
| 2081 | SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2082 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2083 | } |
| 2084 | return CMD_SUCCESS; |
| 2085 | } |
| 2086 | |
| 2087 | DEFUN (no_ospf_compatible_rfc1583, |
| 2088 | no_ospf_compatible_rfc1583_cmd, |
| 2089 | "no compatible rfc1583", |
| 2090 | NO_STR |
| 2091 | "OSPF compatibility list\n" |
| 2092 | "compatible with RFC 1583\n") |
| 2093 | { |
| 2094 | struct ospf *ospf = vty->index; |
| 2095 | |
| 2096 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2097 | { |
| 2098 | UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2099 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2100 | } |
| 2101 | return CMD_SUCCESS; |
| 2102 | } |
| 2103 | |
| 2104 | ALIAS (ospf_compatible_rfc1583, |
| 2105 | ospf_rfc1583_flag_cmd, |
| 2106 | "ospf rfc1583compatibility", |
| 2107 | "OSPF specific commands\n" |
| 2108 | "Enable the RFC1583Compatibility flag\n") |
| 2109 | |
| 2110 | ALIAS (no_ospf_compatible_rfc1583, |
| 2111 | no_ospf_rfc1583_flag_cmd, |
| 2112 | "no ospf rfc1583compatibility", |
| 2113 | NO_STR |
| 2114 | "OSPF specific commands\n" |
| 2115 | "Disable the RFC1583Compatibility flag\n") |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2116 | |
| 2117 | static int |
| 2118 | ospf_timers_spf_set (struct vty *vty, unsigned int delay, |
| 2119 | unsigned int hold, |
| 2120 | unsigned int max) |
| 2121 | { |
| 2122 | struct ospf *ospf = vty->index; |
| 2123 | |
| 2124 | ospf->spf_delay = delay; |
| 2125 | ospf->spf_holdtime = hold; |
| 2126 | ospf->spf_max_holdtime = max; |
| 2127 | |
| 2128 | return CMD_SUCCESS; |
| 2129 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2130 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2131 | DEFUN (ospf_timers_throttle_spf, |
| 2132 | ospf_timers_throttle_spf_cmd, |
| 2133 | "timers throttle spf <0-600000> <0-600000> <0-600000>", |
| 2134 | "Adjust routing timers\n" |
| 2135 | "Throttling adaptive timer\n" |
| 2136 | "OSPF SPF timers\n" |
| 2137 | "Delay (msec) from first change received till SPF calculation\n" |
| 2138 | "Initial hold time (msec) between consecutive SPF calculations\n" |
| 2139 | "Maximum hold time (msec)\n") |
| 2140 | { |
| 2141 | unsigned int delay, hold, max; |
| 2142 | |
| 2143 | if (argc != 3) |
| 2144 | { |
| 2145 | vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); |
| 2146 | return CMD_WARNING; |
| 2147 | } |
| 2148 | |
| 2149 | VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); |
| 2150 | VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); |
| 2151 | VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); |
| 2152 | |
| 2153 | return ospf_timers_spf_set (vty, delay, hold, max); |
| 2154 | } |
| 2155 | |
| 2156 | DEFUN_DEPRECATED (ospf_timers_spf, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2157 | ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2158 | "timers spf <0-4294967295> <0-4294967295>", |
| 2159 | "Adjust routing timers\n" |
| 2160 | "OSPF SPF timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2161 | "Delay (s) between receiving a change to SPF calculation\n" |
| 2162 | "Hold time (s) between consecutive SPF calculations\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2163 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2164 | unsigned int delay, hold; |
| 2165 | |
| 2166 | if (argc != 2) |
| 2167 | { |
| 2168 | vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); |
| 2169 | return CMD_WARNING; |
| 2170 | } |
| 2171 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2172 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
| 2173 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2174 | |
| 2175 | /* truncate down the second values if they're greater than 600000ms */ |
| 2176 | if (delay > (600000 / 1000)) |
| 2177 | delay = 600000; |
| 2178 | else if (delay == 0) |
| 2179 | /* 0s delay was probably specified because of lack of ms resolution */ |
| 2180 | delay = OSPF_SPF_DELAY_DEFAULT; |
| 2181 | if (hold > (600000 / 1000)) |
| 2182 | hold = 600000; |
| 2183 | |
| 2184 | return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2185 | } |
| 2186 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2187 | DEFUN (no_ospf_timers_throttle_spf, |
| 2188 | no_ospf_timers_throttle_spf_cmd, |
| 2189 | "no timers throttle spf", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2190 | NO_STR |
| 2191 | "Adjust routing timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2192 | "Throttling adaptive timer\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2193 | "OSPF SPF timers\n") |
| 2194 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2195 | return ospf_timers_spf_set (vty, |
| 2196 | OSPF_SPF_DELAY_DEFAULT, |
| 2197 | OSPF_SPF_HOLDTIME_DEFAULT, |
| 2198 | OSPF_SPF_MAX_HOLDTIME_DEFAULT); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2199 | } |
| 2200 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2201 | ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, |
| 2202 | no_ospf_timers_spf_cmd, |
| 2203 | "no timers spf", |
| 2204 | NO_STR |
| 2205 | "Adjust routing timers\n" |
| 2206 | "OSPF SPF timers\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2207 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2208 | DEFUN (ospf_neighbor, |
| 2209 | ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2210 | "neighbor A.B.C.D", |
| 2211 | NEIGHBOR_STR |
| 2212 | "Neighbor IP address\n") |
| 2213 | { |
| 2214 | struct ospf *ospf = vty->index; |
| 2215 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2216 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2217 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2218 | |
| 2219 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2220 | |
| 2221 | if (argc > 1) |
| 2222 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); |
| 2223 | |
| 2224 | if (argc > 2) |
| 2225 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); |
| 2226 | |
| 2227 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2228 | if (argc > 1) |
| 2229 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2230 | if (argc > 2) |
| 2231 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); |
| 2232 | |
| 2233 | return CMD_SUCCESS; |
| 2234 | } |
| 2235 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2236 | ALIAS (ospf_neighbor, |
| 2237 | ospf_neighbor_priority_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2238 | "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2239 | NEIGHBOR_STR |
| 2240 | "Neighbor IP address\n" |
| 2241 | "Neighbor Priority\n" |
| 2242 | "Priority\n" |
| 2243 | "Dead Neighbor Polling interval\n" |
| 2244 | "Seconds\n") |
| 2245 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2246 | ALIAS (ospf_neighbor, |
| 2247 | ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2248 | "neighbor A.B.C.D priority <0-255>", |
| 2249 | NEIGHBOR_STR |
| 2250 | "Neighbor IP address\n" |
| 2251 | "Neighbor Priority\n" |
| 2252 | "Seconds\n") |
| 2253 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2254 | DEFUN (ospf_neighbor_poll_interval, |
| 2255 | ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2256 | "neighbor A.B.C.D poll-interval <1-65535>", |
| 2257 | NEIGHBOR_STR |
| 2258 | "Neighbor IP address\n" |
| 2259 | "Dead Neighbor Polling interval\n" |
| 2260 | "Seconds\n") |
| 2261 | { |
| 2262 | struct ospf *ospf = vty->index; |
| 2263 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2264 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2265 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2266 | |
| 2267 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2268 | |
| 2269 | if (argc > 1) |
| 2270 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); |
| 2271 | |
| 2272 | if (argc > 2) |
| 2273 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); |
| 2274 | |
| 2275 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2276 | if (argc > 1) |
| 2277 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); |
| 2278 | if (argc > 2) |
| 2279 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2280 | |
| 2281 | return CMD_SUCCESS; |
| 2282 | } |
| 2283 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2284 | ALIAS (ospf_neighbor_poll_interval, |
| 2285 | ospf_neighbor_poll_interval_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2286 | "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", |
| 2287 | NEIGHBOR_STR |
| 2288 | "Neighbor address\n" |
| 2289 | "OSPF dead-router polling interval\n" |
| 2290 | "Seconds\n" |
| 2291 | "OSPF priority of non-broadcast neighbor\n" |
| 2292 | "Priority\n") |
| 2293 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2294 | DEFUN (no_ospf_neighbor, |
| 2295 | no_ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2296 | "no neighbor A.B.C.D", |
| 2297 | NO_STR |
| 2298 | NEIGHBOR_STR |
| 2299 | "Neighbor IP address\n") |
| 2300 | { |
| 2301 | struct ospf *ospf = vty->index; |
| 2302 | struct in_addr nbr_addr; |
| 2303 | int ret; |
| 2304 | |
| 2305 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2306 | |
| 2307 | ret = ospf_nbr_nbma_unset (ospf, nbr_addr); |
| 2308 | |
| 2309 | return CMD_SUCCESS; |
| 2310 | } |
| 2311 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2312 | ALIAS (no_ospf_neighbor, |
| 2313 | no_ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2314 | "no neighbor A.B.C.D priority <0-255>", |
| 2315 | NO_STR |
| 2316 | NEIGHBOR_STR |
| 2317 | "Neighbor IP address\n" |
| 2318 | "Neighbor Priority\n" |
| 2319 | "Priority\n") |
| 2320 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2321 | ALIAS (no_ospf_neighbor, |
| 2322 | no_ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2323 | "no neighbor A.B.C.D poll-interval <1-65535>", |
| 2324 | NO_STR |
| 2325 | NEIGHBOR_STR |
| 2326 | "Neighbor IP address\n" |
| 2327 | "Dead Neighbor Polling interval\n" |
| 2328 | "Seconds\n") |
| 2329 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2330 | ALIAS (no_ospf_neighbor, |
| 2331 | no_ospf_neighbor_priority_pollinterval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2332 | "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2333 | NO_STR |
| 2334 | NEIGHBOR_STR |
| 2335 | "Neighbor IP address\n" |
| 2336 | "Neighbor Priority\n" |
| 2337 | "Priority\n" |
| 2338 | "Dead Neighbor Polling interval\n" |
| 2339 | "Seconds\n") |
| 2340 | |
| 2341 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2342 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2343 | "refresh timer <10-1800>", |
| 2344 | "Adjust refresh parameters\n" |
| 2345 | "Set refresh timer\n" |
| 2346 | "Timer value in seconds\n") |
| 2347 | { |
| 2348 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2349 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2350 | |
| 2351 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2352 | interval = (interval / 10) * 10; |
| 2353 | |
| 2354 | ospf_timers_refresh_set (ospf, interval); |
| 2355 | |
| 2356 | return CMD_SUCCESS; |
| 2357 | } |
| 2358 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2359 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2360 | "no refresh timer <10-1800>", |
| 2361 | "Adjust refresh parameters\n" |
| 2362 | "Unset refresh timer\n" |
| 2363 | "Timer value in seconds\n") |
| 2364 | { |
| 2365 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2366 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2367 | |
| 2368 | if (argc == 1) |
| 2369 | { |
| 2370 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2371 | |
| 2372 | if (ospf->lsa_refresh_interval != interval || |
| 2373 | interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
| 2374 | return CMD_SUCCESS; |
| 2375 | } |
| 2376 | |
| 2377 | ospf_timers_refresh_unset (ospf); |
| 2378 | |
| 2379 | return CMD_SUCCESS; |
| 2380 | } |
| 2381 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2382 | ALIAS (no_ospf_refresh_timer, |
| 2383 | no_ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2384 | "no refresh timer", |
| 2385 | "Adjust refresh parameters\n" |
| 2386 | "Unset refresh timer\n") |
| 2387 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2388 | DEFUN (ospf_auto_cost_reference_bandwidth, |
| 2389 | ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2390 | "auto-cost reference-bandwidth <1-4294967>", |
| 2391 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2392 | "Use reference bandwidth method to assign OSPF cost\n" |
| 2393 | "The reference bandwidth in terms of Mbits per second\n") |
| 2394 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2395 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2396 | u_int32_t refbw; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2397 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2398 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2399 | |
| 2400 | refbw = strtol (argv[0], NULL, 10); |
| 2401 | if (refbw < 1 || refbw > 4294967) |
| 2402 | { |
| 2403 | vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); |
| 2404 | return CMD_WARNING; |
| 2405 | } |
| 2406 | |
| 2407 | /* If reference bandwidth is changed. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2408 | if ((refbw * 1000) == ospf->ref_bandwidth) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2409 | return CMD_SUCCESS; |
| 2410 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2411 | ospf->ref_bandwidth = refbw * 1000; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2412 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 2413 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2414 | |
| 2415 | return CMD_SUCCESS; |
| 2416 | } |
| 2417 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2418 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
| 2419 | no_ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2420 | "no auto-cost reference-bandwidth", |
| 2421 | NO_STR |
| 2422 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2423 | "Use reference bandwidth method to assign OSPF cost\n") |
| 2424 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2425 | struct ospf *ospf = vty->index; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2426 | struct listnode *node, *nnode; |
| 2427 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2428 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2429 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2430 | return CMD_SUCCESS; |
| 2431 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2432 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2433 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
| 2434 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); |
| 2435 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2436 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
| 2437 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2438 | |
| 2439 | return CMD_SUCCESS; |
| 2440 | } |
| 2441 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2442 | const char *ospf_abr_type_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2443 | { |
| 2444 | "Unknown", |
| 2445 | "Standard (RFC2328)", |
| 2446 | "Alternative IBM", |
| 2447 | "Alternative Cisco", |
| 2448 | "Alternative Shortcut" |
| 2449 | }; |
| 2450 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2451 | const char *ospf_shortcut_mode_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2452 | { |
| 2453 | "Default", |
| 2454 | "Enabled", |
| 2455 | "Disabled" |
| 2456 | }; |
| 2457 | |
| 2458 | |
| 2459 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2460 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2461 | show_ip_ospf_area (struct vty *vty, struct ospf_area *area) |
| 2462 | { |
| 2463 | /* Show Area ID. */ |
| 2464 | vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); |
| 2465 | |
| 2466 | /* Show Area type/mode. */ |
| 2467 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 2468 | vty_out (vty, " (Backbone)%s", VTY_NEWLINE); |
| 2469 | else |
| 2470 | { |
| 2471 | if (area->external_routing == OSPF_AREA_STUB) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2472 | vty_out (vty, " (Stub%s%s)", |
| 2473 | area->no_summary ? ", no summary" : "", |
| 2474 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2475 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2476 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 2477 | vty_out (vty, " (NSSA%s%s)", |
| 2478 | area->no_summary ? ", no summary" : "", |
| 2479 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2480 | |
| 2481 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2482 | vty_out (vty, " Shortcutting mode: %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2483 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2484 | vty_out (vty, ", S-bit consensus: %s%s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2485 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2486 | } |
| 2487 | |
| 2488 | /* Show number of interfaces. */ |
| 2489 | vty_out (vty, " Number of interfaces in this area: Total: %d, " |
| 2490 | "Active: %d%s", listcount (area->oiflist), |
| 2491 | area->act_ints, VTY_NEWLINE); |
| 2492 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2493 | if (area->external_routing == OSPF_AREA_NSSA) |
| 2494 | { |
| 2495 | 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] | 2496 | if (! IS_OSPF_ABR (area->ospf)) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2497 | vty_out (vty, " It is not ABR, therefore not Translator. %s", |
| 2498 | VTY_NEWLINE); |
| 2499 | else if (area->NSSATranslatorState) |
| 2500 | { |
| 2501 | vty_out (vty, " We are an ABR and "); |
| 2502 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2503 | vty_out (vty, "the NSSA Elected Translator. %s", |
| 2504 | VTY_NEWLINE); |
| 2505 | else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) |
| 2506 | vty_out (vty, "always an NSSA Translator. %s", |
| 2507 | VTY_NEWLINE); |
| 2508 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2509 | else |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2510 | { |
| 2511 | vty_out (vty, " We are an ABR, but "); |
| 2512 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2513 | vty_out (vty, "not the NSSA Elected Translator. %s", |
| 2514 | VTY_NEWLINE); |
| 2515 | else |
hasso | c6b8781 | 2004-12-22 13:09:59 +0000 | [diff] [blame] | 2516 | vty_out (vty, "never an NSSA Translator. %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2517 | VTY_NEWLINE); |
| 2518 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2519 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2520 | |
| 2521 | /* Show number of fully adjacent neighbors. */ |
| 2522 | vty_out (vty, " Number of fully adjacent neighbors in this area:" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2523 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2524 | |
| 2525 | /* Show authentication type. */ |
| 2526 | vty_out (vty, " Area has "); |
| 2527 | if (area->auth_type == OSPF_AUTH_NULL) |
| 2528 | vty_out (vty, "no authentication%s", VTY_NEWLINE); |
| 2529 | else if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 2530 | vty_out (vty, "simple password authentication%s", VTY_NEWLINE); |
| 2531 | else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC) |
| 2532 | vty_out (vty, "message digest authentication%s", VTY_NEWLINE); |
| 2533 | |
| 2534 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 2535 | vty_out (vty, " Number of full virtual adjacencies going through" |
| 2536 | " this area: %d%s", area->full_vls, VTY_NEWLINE); |
| 2537 | |
| 2538 | /* Show SPF calculation times. */ |
| 2539 | vty_out (vty, " SPF algorithm executed %d times%s", |
| 2540 | area->spf_calculation, VTY_NEWLINE); |
| 2541 | |
| 2542 | /* Show number of LSA. */ |
| 2543 | vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE); |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2544 | vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s", |
| 2545 | ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA), |
| 2546 | ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE); |
| 2547 | vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s", |
| 2548 | ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA), |
| 2549 | ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE); |
| 2550 | vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2551 | ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA), |
| 2552 | ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE); |
| 2553 | vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2554 | ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA), |
| 2555 | ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE); |
| 2556 | vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s", |
| 2557 | ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA), |
| 2558 | ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE); |
| 2559 | #ifdef HAVE_OPAQUE_LSA |
| 2560 | vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s", |
| 2561 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA), |
| 2562 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE); |
| 2563 | vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s", |
| 2564 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA), |
| 2565 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE); |
| 2566 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2567 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2568 | } |
| 2569 | |
| 2570 | DEFUN (show_ip_ospf, |
| 2571 | show_ip_ospf_cmd, |
| 2572 | "show ip ospf", |
| 2573 | SHOW_STR |
| 2574 | IP_STR |
| 2575 | "OSPF information\n") |
| 2576 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2577 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2578 | struct ospf_area * area; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2579 | struct ospf *ospf; |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2580 | struct timeval result; |
| 2581 | char timebuf[13]; /* XX:XX:XX.XXX(nul) */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2582 | |
| 2583 | /* Check OSPF is enable. */ |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2584 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2585 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2586 | { |
| 2587 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2588 | return CMD_SUCCESS; |
| 2589 | } |
| 2590 | |
| 2591 | /* Show Router ID. */ |
| 2592 | vty_out (vty, " OSPF Routing Process, Router ID: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2593 | inet_ntoa (ospf->router_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2594 | VTY_NEWLINE); |
| 2595 | |
| 2596 | /* Show capability. */ |
| 2597 | vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE); |
| 2598 | vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE); |
| 2599 | vty_out (vty, " RFC1583Compatibility flag is %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2600 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2601 | "enabled" : "disabled", VTY_NEWLINE); |
| 2602 | #ifdef HAVE_OPAQUE_LSA |
| 2603 | vty_out (vty, " OpaqueCapability flag is %s%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2604 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2605 | "enabled" : "disabled", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2606 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2607 | " (origination blocked)" : "", |
| 2608 | VTY_NEWLINE); |
| 2609 | #endif /* HAVE_OPAQUE_LSA */ |
| 2610 | |
| 2611 | /* Show SPF timers. */ |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2612 | vty_out (vty, " Initial SPF scheduling delay %d millisec(s)%s" |
| 2613 | " Minimum hold time between consecutive SPFs %d millisec(s)%s" |
| 2614 | " Maximum hold time between consecutive SPFs %d millisec(s)%s" |
| 2615 | " Hold time multiplier is currently %d%s", |
| 2616 | ospf->spf_delay, VTY_NEWLINE, |
| 2617 | ospf->spf_holdtime, VTY_NEWLINE, |
| 2618 | ospf->spf_max_holdtime, VTY_NEWLINE, |
| 2619 | ospf->spf_hold_multiplier, VTY_NEWLINE); |
| 2620 | timersub (&recent_time, &ospf->ts_spf, &result); |
| 2621 | vty_out (vty, " SPF algorithm last executed %s ago%s", |
| 2622 | ospf_timeval_dump (&result, timebuf, sizeof (timebuf)), |
| 2623 | VTY_NEWLINE); |
| 2624 | vty_out (vty, " SPF timer %s%s%s", |
| 2625 | (ospf->t_spf_calc ? "due in " : "is "), |
| 2626 | ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)), |
| 2627 | VTY_NEWLINE); |
| 2628 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2629 | /* Show refresh parameters. */ |
| 2630 | vty_out (vty, " Refresh timer %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2631 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2632 | |
| 2633 | /* Show ABR/ASBR flags. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2634 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2635 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2636 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2637 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2638 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2639 | vty_out (vty, " This router is an ASBR " |
| 2640 | "(injecting external routing information)%s", VTY_NEWLINE); |
| 2641 | |
| 2642 | /* Show Number of AS-external-LSAs. */ |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2643 | vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s", |
| 2644 | ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), |
| 2645 | ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE); |
| 2646 | #ifdef HAVE_OPAQUE_LSA |
| 2647 | vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s", |
| 2648 | ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA), |
| 2649 | ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE); |
| 2650 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2651 | /* Show number of areas attached. */ |
| 2652 | vty_out (vty, " Number of areas attached to this router: %d%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2653 | listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2654 | |
| 2655 | /* Show each area status. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2656 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 2657 | show_ip_ospf_area (vty, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2658 | |
| 2659 | return CMD_SUCCESS; |
| 2660 | } |
| 2661 | |
| 2662 | |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2663 | static void |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2664 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
| 2665 | struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2666 | { |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2667 | int is_up; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2668 | struct ospf_neighbor *nbr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2669 | struct route_node *rn; |
| 2670 | char buf[9]; |
| 2671 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2672 | /* Is interface up? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2673 | vty_out (vty, "%s is %s%s", ifp->name, |
| 2674 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 2675 | vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s", |
| 2676 | ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), |
| 2677 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2678 | |
| 2679 | /* Is interface OSPF enabled? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2680 | if (ospf_oi_count(ifp) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2681 | { |
| 2682 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); |
| 2683 | return; |
| 2684 | } |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2685 | else if (!is_up) |
| 2686 | { |
| 2687 | vty_out (vty, " OSPF is enabled, but not running on this interface%s", |
| 2688 | VTY_NEWLINE); |
| 2689 | return; |
| 2690 | } |
| 2691 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2692 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 2693 | { |
| 2694 | struct ospf_interface *oi = rn->info; |
| 2695 | |
| 2696 | if (oi == NULL) |
| 2697 | continue; |
| 2698 | |
| 2699 | /* Show OSPF interface information. */ |
| 2700 | vty_out (vty, " Internet Address %s/%d,", |
| 2701 | inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen); |
| 2702 | |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 2703 | if (oi->connected->destination) |
| 2704 | vty_out (vty, " %s %s,", |
| 2705 | ((ifp->flags & IFF_POINTOPOINT) ? "Peer" : "Broadcast"), |
| 2706 | inet_ntoa (oi->connected->destination->u.prefix4)); |
| 2707 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2708 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
| 2709 | VTY_NEWLINE); |
| 2710 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2711 | vty_out (vty, " MTU mismatch detection:%s%s", |
| 2712 | OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE); |
| 2713 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2714 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2715 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2716 | oi->output_cost, VTY_NEWLINE); |
| 2717 | |
| 2718 | vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s", |
| 2719 | OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state), |
| 2720 | PRIORITY (oi), VTY_NEWLINE); |
| 2721 | |
| 2722 | /* Show DR information. */ |
| 2723 | if (DR (oi).s_addr == 0) |
| 2724 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2725 | else |
| 2726 | { |
| 2727 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi)); |
| 2728 | if (nbr == NULL) |
| 2729 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2730 | else |
| 2731 | { |
| 2732 | vty_out (vty, " Designated Router (ID) %s,", |
| 2733 | inet_ntoa (nbr->router_id)); |
| 2734 | vty_out (vty, " Interface Address %s%s", |
| 2735 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2736 | } |
| 2737 | } |
| 2738 | |
| 2739 | /* Show BDR information. */ |
| 2740 | if (BDR (oi).s_addr == 0) |
| 2741 | vty_out (vty, " No backup designated router on this network%s", |
| 2742 | VTY_NEWLINE); |
| 2743 | else |
| 2744 | { |
| 2745 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi)); |
| 2746 | if (nbr == NULL) |
| 2747 | vty_out (vty, " No backup designated router on this network%s", |
| 2748 | VTY_NEWLINE); |
| 2749 | else |
| 2750 | { |
| 2751 | vty_out (vty, " Backup Designated Router (ID) %s,", |
| 2752 | inet_ntoa (nbr->router_id)); |
| 2753 | vty_out (vty, " Interface Address %s%s", |
| 2754 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2755 | } |
| 2756 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2757 | |
| 2758 | vty_out (vty, " Multicast group memberships:"); |
| 2759 | if (CHECK_FLAG(oi->multicast_memberships, MEMBER_ALLROUTERS)) |
| 2760 | vty_out (vty, " OSPFAllRouters"); |
| 2761 | if (CHECK_FLAG(oi->multicast_memberships, MEMBER_DROUTERS)) |
| 2762 | vty_out (vty, " OSPFDesignatedRouters"); |
| 2763 | if (!CHECK_FLAG(oi->multicast_memberships, |
| 2764 | MEMBER_ALLROUTERS|MEMBER_DROUTERS)) |
| 2765 | vty_out (vty, " <None>"); |
| 2766 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2767 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2768 | vty_out (vty, " Timer intervals configured,"); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2769 | vty_out (vty, " Hello "); |
| 2770 | if (OSPF_IF_PARAM (oi, fast_hello) == 0) |
| 2771 | vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello)); |
| 2772 | else |
| 2773 | vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello)); |
| 2774 | vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s", |
| 2775 | OSPF_IF_PARAM (oi, v_wait), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2776 | OSPF_IF_PARAM (oi, v_wait), |
| 2777 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 2778 | VTY_NEWLINE); |
| 2779 | |
| 2780 | if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2781 | { |
| 2782 | int timer_slen = 9; /* length of "hh:mm:ss(nul)" */ |
| 2783 | |
| 2784 | /* for fast hello we also want to see the .XXXX ms part */ |
| 2785 | if (OSPF_IF_PARAM (oi, fast_hello)) |
| 2786 | timer_slen += 5; |
| 2787 | |
| 2788 | vty_out (vty, " Hello due in %s%s", |
| 2789 | ospf_timer_dump (oi->t_hello, buf, timer_slen), |
| 2790 | VTY_NEWLINE); |
| 2791 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2792 | else /* OSPF_IF_PASSIVE is set */ |
| 2793 | vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); |
| 2794 | |
| 2795 | vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2796 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2797 | VTY_NEWLINE); |
| 2798 | } |
| 2799 | } |
| 2800 | |
| 2801 | DEFUN (show_ip_ospf_interface, |
| 2802 | show_ip_ospf_interface_cmd, |
| 2803 | "show ip ospf interface [INTERFACE]", |
| 2804 | SHOW_STR |
| 2805 | IP_STR |
| 2806 | "OSPF information\n" |
| 2807 | "Interface information\n" |
| 2808 | "Interface name\n") |
| 2809 | { |
| 2810 | struct interface *ifp; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2811 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2812 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2813 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2814 | ospf = ospf_lookup (); |
| 2815 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2816 | /* Show All Interfaces. */ |
| 2817 | if (argc == 0) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2818 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 2819 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2820 | /* Interface name is specified. */ |
| 2821 | else |
| 2822 | { |
| 2823 | if ((ifp = if_lookup_by_name (argv[0])) == NULL) |
| 2824 | vty_out (vty, "No such interface name%s", VTY_NEWLINE); |
| 2825 | else |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2826 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2827 | } |
| 2828 | |
| 2829 | return CMD_SUCCESS; |
| 2830 | } |
| 2831 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2832 | static void |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2833 | show_ip_ospf_neighbour_header (struct vty *vty) |
| 2834 | { |
| 2835 | vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s", |
| 2836 | VTY_NEWLINE, |
| 2837 | "Neighbor ID", "Pri", "State", "Dead Time", |
| 2838 | "Address", "Interface", "RXmtL", "RqstL", "DBsmL", |
| 2839 | VTY_NEWLINE); |
| 2840 | } |
| 2841 | |
| 2842 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2843 | show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) |
| 2844 | { |
| 2845 | struct route_node *rn; |
| 2846 | struct ospf_neighbor *nbr; |
| 2847 | char msgbuf[16]; |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2848 | char timebuf[14]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2849 | |
| 2850 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 2851 | if ((nbr = rn->info)) |
| 2852 | /* Do not show myself. */ |
| 2853 | if (nbr != oi->nbr_self) |
| 2854 | /* Down state is not shown. */ |
| 2855 | if (nbr->state != NSM_Down) |
| 2856 | { |
| 2857 | ospf_nbr_state_message (nbr, msgbuf, 16); |
| 2858 | |
| 2859 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2860 | vty_out (vty, "%-15s %3d %-15s ", |
| 2861 | "-", nbr->priority, |
| 2862 | msgbuf); |
| 2863 | else |
| 2864 | vty_out (vty, "%-15s %3d %-15s ", |
| 2865 | inet_ntoa (nbr->router_id), nbr->priority, |
| 2866 | msgbuf); |
| 2867 | |
| 2868 | vty_out (vty, "%9s ", |
| 2869 | ospf_timer_dump (nbr->t_inactivity, timebuf, |
| 2870 | sizeof(timebuf))); |
| 2871 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2872 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2873 | vty_out (vty, "%-20s %5ld %5ld %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2874 | IF_NAME (oi), ospf_ls_retransmit_count (nbr), |
| 2875 | ospf_ls_request_count (nbr), ospf_db_summary_count (nbr), |
| 2876 | VTY_NEWLINE); |
| 2877 | } |
| 2878 | } |
| 2879 | |
| 2880 | DEFUN (show_ip_ospf_neighbor, |
| 2881 | show_ip_ospf_neighbor_cmd, |
| 2882 | "show ip ospf neighbor", |
| 2883 | SHOW_STR |
| 2884 | IP_STR |
| 2885 | "OSPF information\n" |
| 2886 | "Neighbor list\n") |
| 2887 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2888 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2889 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2890 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2891 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2892 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2893 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2894 | { |
| 2895 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2896 | return CMD_SUCCESS; |
| 2897 | } |
| 2898 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2899 | show_ip_ospf_neighbour_header (vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2900 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2901 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 2902 | show_ip_ospf_neighbor_sub (vty, oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2903 | |
| 2904 | return CMD_SUCCESS; |
| 2905 | } |
| 2906 | |
| 2907 | DEFUN (show_ip_ospf_neighbor_all, |
| 2908 | show_ip_ospf_neighbor_all_cmd, |
| 2909 | "show ip ospf neighbor all", |
| 2910 | SHOW_STR |
| 2911 | IP_STR |
| 2912 | "OSPF information\n" |
| 2913 | "Neighbor list\n" |
| 2914 | "include down status neighbor\n") |
| 2915 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2916 | struct ospf *ospf = vty->index; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2917 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2918 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2919 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2920 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2921 | { |
| 2922 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2923 | return CMD_SUCCESS; |
| 2924 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2925 | |
| 2926 | show_ip_ospf_neighbour_header (vty); |
| 2927 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2928 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2929 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2930 | struct listnode *nbr_node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2931 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2932 | |
| 2933 | show_ip_ospf_neighbor_sub (vty, oi); |
| 2934 | |
| 2935 | /* print Down neighbor status */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2936 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2937 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2938 | if (nbr_nbma->nbr == NULL |
| 2939 | || nbr_nbma->nbr->state == NSM_Down) |
| 2940 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2941 | vty_out (vty, "%-15s %3d %-15s %9s ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2942 | "-", nbr_nbma->priority, "Down", "-"); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2943 | vty_out (vty, "%-15s %-20s %5d %5d %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2944 | inet_ntoa (nbr_nbma->addr), IF_NAME (oi), |
| 2945 | 0, 0, 0, VTY_NEWLINE); |
| 2946 | } |
| 2947 | } |
| 2948 | } |
| 2949 | |
| 2950 | return CMD_SUCCESS; |
| 2951 | } |
| 2952 | |
| 2953 | DEFUN (show_ip_ospf_neighbor_int, |
| 2954 | show_ip_ospf_neighbor_int_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2955 | "show ip ospf neighbor IFNAME", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2956 | SHOW_STR |
| 2957 | IP_STR |
| 2958 | "OSPF information\n" |
| 2959 | "Neighbor list\n" |
| 2960 | "Interface name\n") |
| 2961 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2962 | struct ospf *ospf; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2963 | struct interface *ifp; |
| 2964 | struct route_node *rn; |
| 2965 | |
| 2966 | ifp = if_lookup_by_name (argv[0]); |
| 2967 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2968 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2969 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2970 | return CMD_WARNING; |
| 2971 | } |
| 2972 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2973 | ospf = ospf_lookup (); |
| 2974 | if (ospf == NULL) |
| 2975 | { |
| 2976 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2977 | return CMD_SUCCESS; |
| 2978 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 2979 | |
| 2980 | show_ip_ospf_neighbour_header (vty); |
| 2981 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2982 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2983 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2984 | struct ospf_interface *oi = rn->info; |
| 2985 | |
| 2986 | if (oi == NULL) |
| 2987 | continue; |
| 2988 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2989 | show_ip_ospf_neighbor_sub (vty, oi); |
| 2990 | } |
| 2991 | |
| 2992 | return CMD_SUCCESS; |
| 2993 | } |
| 2994 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2995 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2996 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 2997 | struct ospf_nbr_nbma *nbr_nbma) |
| 2998 | { |
| 2999 | char timebuf[9]; |
| 3000 | |
| 3001 | /* Show neighbor ID. */ |
| 3002 | vty_out (vty, " Neighbor %s,", "-"); |
| 3003 | |
| 3004 | /* Show interface address. */ |
| 3005 | vty_out (vty, " interface address %s%s", |
| 3006 | inet_ntoa (nbr_nbma->addr), VTY_NEWLINE); |
| 3007 | /* Show Area ID. */ |
| 3008 | vty_out (vty, " In the area %s via interface %s%s", |
| 3009 | ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE); |
| 3010 | /* Show neighbor priority and state. */ |
| 3011 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3012 | nbr_nbma->priority, "Down"); |
| 3013 | /* Show state changes. */ |
| 3014 | vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE); |
| 3015 | |
| 3016 | /* Show PollInterval */ |
| 3017 | vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE); |
| 3018 | |
| 3019 | /* Show poll-interval timer. */ |
| 3020 | vty_out (vty, " Poll timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 3021 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)), |
| 3022 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3023 | |
| 3024 | /* Show poll-interval timer thread. */ |
| 3025 | vty_out (vty, " Thread Poll Timer %s%s", |
| 3026 | nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); |
| 3027 | } |
| 3028 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3029 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3030 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3031 | struct ospf_neighbor *nbr) |
| 3032 | { |
| 3033 | char timebuf[9]; |
| 3034 | |
| 3035 | /* Show neighbor ID. */ |
| 3036 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
| 3037 | vty_out (vty, " Neighbor %s,", "-"); |
| 3038 | else |
| 3039 | vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id)); |
| 3040 | |
| 3041 | /* Show interface address. */ |
| 3042 | vty_out (vty, " interface address %s%s", |
| 3043 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 3044 | /* Show Area ID. */ |
| 3045 | vty_out (vty, " In the area %s via interface %s%s", |
| 3046 | ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE); |
| 3047 | /* Show neighbor priority and state. */ |
| 3048 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3049 | nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state)); |
| 3050 | /* Show state changes. */ |
| 3051 | vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE); |
| 3052 | |
| 3053 | /* Show Designated Rotuer ID. */ |
| 3054 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); |
| 3055 | /* Show Backup Designated Rotuer ID. */ |
| 3056 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); |
| 3057 | /* Show options. */ |
| 3058 | vty_out (vty, " Options %d %s%s", nbr->options, |
| 3059 | ospf_options_dump (nbr->options), VTY_NEWLINE); |
| 3060 | /* Show Router Dead interval timer. */ |
| 3061 | vty_out (vty, " Dead timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 3062 | ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)), |
| 3063 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3064 | /* Show Database Summary list. */ |
| 3065 | vty_out (vty, " Database Summary List %d%s", |
| 3066 | ospf_db_summary_count (nbr), VTY_NEWLINE); |
| 3067 | /* Show Link State Request list. */ |
| 3068 | vty_out (vty, " Link State Request List %ld%s", |
| 3069 | ospf_ls_request_count (nbr), VTY_NEWLINE); |
| 3070 | /* Show Link State Retransmission list. */ |
| 3071 | vty_out (vty, " Link State Retransmission List %ld%s", |
| 3072 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); |
| 3073 | /* Show inactivity timer thread. */ |
| 3074 | vty_out (vty, " Thread Inactivity Timer %s%s", |
| 3075 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); |
| 3076 | /* Show Database Description retransmission thread. */ |
| 3077 | vty_out (vty, " Thread Database Description Retransmision %s%s", |
| 3078 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); |
| 3079 | /* Show Link State Request Retransmission thread. */ |
| 3080 | vty_out (vty, " Thread Link State Request Retransmission %s%s", |
| 3081 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); |
| 3082 | /* Show Link State Update Retransmission thread. */ |
| 3083 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", |
| 3084 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); |
| 3085 | } |
| 3086 | |
| 3087 | DEFUN (show_ip_ospf_neighbor_id, |
| 3088 | show_ip_ospf_neighbor_id_cmd, |
| 3089 | "show ip ospf neighbor A.B.C.D", |
| 3090 | SHOW_STR |
| 3091 | IP_STR |
| 3092 | "OSPF information\n" |
| 3093 | "Neighbor list\n" |
| 3094 | "Neighbor ID\n") |
| 3095 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3096 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3097 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3098 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3099 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3100 | struct in_addr router_id; |
| 3101 | int ret; |
| 3102 | |
| 3103 | ret = inet_aton (argv[0], &router_id); |
| 3104 | if (!ret) |
| 3105 | { |
| 3106 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); |
| 3107 | return CMD_WARNING; |
| 3108 | } |
| 3109 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3110 | ospf = ospf_lookup (); |
| 3111 | if (ospf == NULL) |
| 3112 | { |
| 3113 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3114 | return CMD_SUCCESS; |
| 3115 | } |
| 3116 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3117 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3118 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) |
| 3119 | { |
| 3120 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3121 | return CMD_SUCCESS; |
| 3122 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3123 | |
| 3124 | /* Nothing to show. */ |
| 3125 | return CMD_SUCCESS; |
| 3126 | } |
| 3127 | |
| 3128 | DEFUN (show_ip_ospf_neighbor_detail, |
| 3129 | show_ip_ospf_neighbor_detail_cmd, |
| 3130 | "show ip ospf neighbor detail", |
| 3131 | SHOW_STR |
| 3132 | IP_STR |
| 3133 | "OSPF information\n" |
| 3134 | "Neighbor list\n" |
| 3135 | "detail of all neighbors\n") |
| 3136 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3137 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3138 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3139 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3140 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3141 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3142 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3143 | { |
| 3144 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3145 | return CMD_SUCCESS; |
| 3146 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3147 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3148 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3149 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3150 | struct route_node *rn; |
| 3151 | struct ospf_neighbor *nbr; |
| 3152 | |
| 3153 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3154 | if ((nbr = rn->info)) |
| 3155 | if (nbr != oi->nbr_self) |
| 3156 | if (nbr->state != NSM_Down) |
| 3157 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3158 | } |
| 3159 | |
| 3160 | return CMD_SUCCESS; |
| 3161 | } |
| 3162 | |
| 3163 | DEFUN (show_ip_ospf_neighbor_detail_all, |
| 3164 | show_ip_ospf_neighbor_detail_all_cmd, |
| 3165 | "show ip ospf neighbor detail all", |
| 3166 | SHOW_STR |
| 3167 | IP_STR |
| 3168 | "OSPF information\n" |
| 3169 | "Neighbor list\n" |
| 3170 | "detail of all neighbors\n" |
| 3171 | "include down status neighbor\n") |
| 3172 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3173 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3174 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3175 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3176 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3177 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3178 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3179 | { |
| 3180 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3181 | return CMD_SUCCESS; |
| 3182 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3183 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3184 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3185 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3186 | struct route_node *rn; |
| 3187 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3188 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3189 | |
| 3190 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3191 | if ((nbr = rn->info)) |
| 3192 | if (nbr != oi->nbr_self) |
| 3193 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) |
| 3194 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); |
| 3195 | |
| 3196 | if (oi->type == OSPF_IFTYPE_NBMA) |
| 3197 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3198 | struct listnode *nd; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3199 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3200 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
| 3201 | if (nbr_nbma->nbr == NULL |
| 3202 | || nbr_nbma->nbr->state == NSM_Down) |
| 3203 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3204 | } |
| 3205 | } |
| 3206 | |
| 3207 | return CMD_SUCCESS; |
| 3208 | } |
| 3209 | |
| 3210 | DEFUN (show_ip_ospf_neighbor_int_detail, |
| 3211 | show_ip_ospf_neighbor_int_detail_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3212 | "show ip ospf neighbor IFNAME detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3213 | SHOW_STR |
| 3214 | IP_STR |
| 3215 | "OSPF information\n" |
| 3216 | "Neighbor list\n" |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3217 | "Interface name\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3218 | "detail of all neighbors") |
| 3219 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3220 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3221 | struct ospf_interface *oi; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3222 | struct interface *ifp; |
| 3223 | struct route_node *rn, *nrn; |
| 3224 | struct ospf_neighbor *nbr; |
| 3225 | |
| 3226 | ifp = if_lookup_by_name (argv[0]); |
| 3227 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3228 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3229 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3230 | return CMD_WARNING; |
| 3231 | } |
| 3232 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3233 | ospf = ospf_lookup (); |
| 3234 | if (ospf == NULL) |
| 3235 | { |
| 3236 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3237 | return CMD_SUCCESS; |
| 3238 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3239 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3240 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3241 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 3242 | if ((oi = rn->info)) |
| 3243 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) |
| 3244 | if ((nbr = nrn->info)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3245 | if (nbr != oi->nbr_self) |
| 3246 | if (nbr->state != NSM_Down) |
| 3247 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3248 | |
| 3249 | return CMD_SUCCESS; |
| 3250 | } |
| 3251 | |
| 3252 | |
| 3253 | /* Show functions */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3254 | static int |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3255 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3256 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3257 | struct router_lsa *rl; |
| 3258 | struct summary_lsa *sl; |
| 3259 | struct as_external_lsa *asel; |
| 3260 | struct prefix_ipv4 p; |
| 3261 | |
| 3262 | if (lsa != NULL) |
| 3263 | /* If self option is set, check LSA self flag. */ |
| 3264 | if (self == 0 || IS_LSA_SELF (lsa)) |
| 3265 | { |
| 3266 | /* LSA common part show. */ |
| 3267 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); |
| 3268 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", |
| 3269 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), |
| 3270 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); |
| 3271 | /* LSA specific part show. */ |
| 3272 | switch (lsa->data->type) |
| 3273 | { |
| 3274 | case OSPF_ROUTER_LSA: |
| 3275 | rl = (struct router_lsa *) lsa->data; |
| 3276 | vty_out (vty, " %-d", ntohs (rl->links)); |
| 3277 | break; |
| 3278 | case OSPF_SUMMARY_LSA: |
| 3279 | sl = (struct summary_lsa *) lsa->data; |
| 3280 | |
| 3281 | p.family = AF_INET; |
| 3282 | p.prefix = sl->header.id; |
| 3283 | p.prefixlen = ip_masklen (sl->mask); |
| 3284 | apply_mask_ipv4 (&p); |
| 3285 | |
| 3286 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); |
| 3287 | break; |
| 3288 | case OSPF_AS_EXTERNAL_LSA: |
paul | 551a897 | 2003-05-18 15:22:55 +0000 | [diff] [blame] | 3289 | case OSPF_AS_NSSA_LSA: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3290 | asel = (struct as_external_lsa *) lsa->data; |
| 3291 | |
| 3292 | p.family = AF_INET; |
| 3293 | p.prefix = asel->header.id; |
| 3294 | p.prefixlen = ip_masklen (asel->mask); |
| 3295 | apply_mask_ipv4 (&p); |
| 3296 | |
| 3297 | vty_out (vty, " %s %s/%d [0x%lx]", |
| 3298 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", |
| 3299 | inet_ntoa (p.prefix), p.prefixlen, |
| 3300 | (u_long)ntohl (asel->e[0].route_tag)); |
| 3301 | break; |
| 3302 | case OSPF_NETWORK_LSA: |
| 3303 | case OSPF_ASBR_SUMMARY_LSA: |
| 3304 | #ifdef HAVE_OPAQUE_LSA |
| 3305 | case OSPF_OPAQUE_LINK_LSA: |
| 3306 | case OSPF_OPAQUE_AREA_LSA: |
| 3307 | case OSPF_OPAQUE_AS_LSA: |
| 3308 | #endif /* HAVE_OPAQUE_LSA */ |
| 3309 | default: |
| 3310 | break; |
| 3311 | } |
| 3312 | vty_out (vty, VTY_NEWLINE); |
| 3313 | } |
| 3314 | |
| 3315 | return 0; |
| 3316 | } |
| 3317 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3318 | const char *show_database_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3319 | { |
| 3320 | "unknown", |
| 3321 | "Router Link States", |
| 3322 | "Net Link States", |
| 3323 | "Summary Link States", |
| 3324 | "ASBR-Summary Link States", |
| 3325 | "AS External Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3326 | "Group Membership LSA", |
| 3327 | "NSSA-external Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3328 | #ifdef HAVE_OPAQUE_LSA |
| 3329 | "Type-8 LSA", |
| 3330 | "Link-Local Opaque-LSA", |
| 3331 | "Area-Local Opaque-LSA", |
| 3332 | "AS-external Opaque-LSA", |
| 3333 | #endif /* HAVE_OPAQUE_LSA */ |
| 3334 | }; |
| 3335 | |
| 3336 | #define SHOW_OSPF_COMMON_HEADER \ |
| 3337 | "Link ID ADV Router Age Seq# CkSum" |
| 3338 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3339 | const char *show_database_header[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3340 | { |
| 3341 | "", |
| 3342 | "Link ID ADV Router Age Seq# CkSum Link count", |
| 3343 | "Link ID ADV Router Age Seq# CkSum", |
| 3344 | "Link ID ADV Router Age Seq# CkSum Route", |
| 3345 | "Link ID ADV Router Age Seq# CkSum", |
| 3346 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3347 | " --- header for Group Member ----", |
| 3348 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3349 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3350 | " --- type-8 ---", |
| 3351 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3352 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3353 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3354 | #endif /* HAVE_OPAQUE_LSA */ |
| 3355 | }; |
| 3356 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3357 | const char *show_lsa_flags[] = |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3358 | { |
| 3359 | "Self-originated", |
| 3360 | "Checked", |
| 3361 | "Received", |
| 3362 | "Approved", |
| 3363 | "Discard", |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3364 | "Translated", |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3365 | }; |
| 3366 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3367 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3368 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
| 3369 | { |
| 3370 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3371 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3372 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3373 | vty_out (vty, " Options: 0x%-2x : %s%s", |
| 3374 | lsa->data->options, |
| 3375 | ospf_options_dump(lsa->data->options), |
| 3376 | VTY_NEWLINE); |
| 3377 | vty_out (vty, " LS Flags: 0x%-2x %s%s", |
paul | 9d52603 | 2003-06-30 22:46:14 +0000 | [diff] [blame] | 3378 | lsa->flags, |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3379 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
| 3380 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3381 | |
| 3382 | if (lsa->data->type == OSPF_ROUTER_LSA) |
| 3383 | { |
| 3384 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); |
| 3385 | |
| 3386 | if (rlsa->flags) |
| 3387 | vty_out (vty, " :%s%s%s%s", |
| 3388 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", |
| 3389 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", |
| 3390 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", |
| 3391 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); |
| 3392 | |
| 3393 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3394 | } |
| 3395 | vty_out (vty, " LS Type: %s%s", |
| 3396 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3397 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), |
| 3398 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3399 | vty_out (vty, " Advertising Router: %s%s", |
| 3400 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3401 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), |
| 3402 | VTY_NEWLINE); |
| 3403 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), |
| 3404 | VTY_NEWLINE); |
| 3405 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); |
| 3406 | } |
| 3407 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3408 | const char *link_type_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3409 | { |
| 3410 | "(null)", |
| 3411 | "another Router (point-to-point)", |
| 3412 | "a Transit Network", |
| 3413 | "Stub Network", |
| 3414 | "a Virtual Link", |
| 3415 | }; |
| 3416 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3417 | const char *link_id_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3418 | { |
| 3419 | "(null)", |
| 3420 | "Neighboring Router ID", |
| 3421 | "Designated Router address", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3422 | "Net", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3423 | "Neighboring Router ID", |
| 3424 | }; |
| 3425 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3426 | const char *link_data_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3427 | { |
| 3428 | "(null)", |
| 3429 | "Router Interface address", |
| 3430 | "Router Interface address", |
| 3431 | "Network Mask", |
| 3432 | "Router Interface address", |
| 3433 | }; |
| 3434 | |
| 3435 | /* Show router-LSA each Link information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3436 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3437 | show_ip_ospf_database_router_links (struct vty *vty, |
| 3438 | struct router_lsa *rl) |
| 3439 | { |
| 3440 | int len, i, type; |
| 3441 | |
| 3442 | len = ntohs (rl->header.length) - 4; |
| 3443 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) |
| 3444 | { |
| 3445 | type = rl->link[i].type; |
| 3446 | |
| 3447 | vty_out (vty, " Link connected to: %s%s", |
| 3448 | link_type_desc[type], VTY_NEWLINE); |
| 3449 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], |
| 3450 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); |
| 3451 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], |
| 3452 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); |
| 3453 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); |
| 3454 | vty_out (vty, " TOS 0 Metric: %d%s", |
| 3455 | ntohs (rl->link[i].metric), VTY_NEWLINE); |
| 3456 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3457 | } |
| 3458 | } |
| 3459 | |
| 3460 | /* Show router-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3461 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3462 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3463 | { |
| 3464 | if (lsa != NULL) |
| 3465 | { |
| 3466 | struct router_lsa *rl = (struct router_lsa *) lsa->data; |
| 3467 | |
| 3468 | show_ip_ospf_database_header (vty, lsa); |
| 3469 | |
| 3470 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), |
| 3471 | VTY_NEWLINE, VTY_NEWLINE); |
| 3472 | |
| 3473 | show_ip_ospf_database_router_links (vty, rl); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3474 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3475 | } |
| 3476 | |
| 3477 | return 0; |
| 3478 | } |
| 3479 | |
| 3480 | /* Show network-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3481 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3482 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3483 | { |
| 3484 | int length, i; |
| 3485 | |
| 3486 | if (lsa != NULL) |
| 3487 | { |
| 3488 | struct network_lsa *nl = (struct network_lsa *) lsa->data; |
| 3489 | |
| 3490 | show_ip_ospf_database_header (vty, lsa); |
| 3491 | |
| 3492 | vty_out (vty, " Network Mask: /%d%s", |
| 3493 | ip_masklen (nl->mask), VTY_NEWLINE); |
| 3494 | |
| 3495 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; |
| 3496 | |
| 3497 | for (i = 0; length > 0; i++, length -= 4) |
| 3498 | vty_out (vty, " Attached Router: %s%s", |
| 3499 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); |
| 3500 | |
| 3501 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3502 | } |
| 3503 | |
| 3504 | return 0; |
| 3505 | } |
| 3506 | |
| 3507 | /* Show summary-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3508 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3509 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3510 | { |
| 3511 | if (lsa != NULL) |
| 3512 | { |
| 3513 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3514 | |
| 3515 | show_ip_ospf_database_header (vty, lsa); |
| 3516 | |
| 3517 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), |
| 3518 | VTY_NEWLINE); |
| 3519 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3520 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3521 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3522 | } |
| 3523 | |
| 3524 | return 0; |
| 3525 | } |
| 3526 | |
| 3527 | /* Show summary-ASBR-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3528 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3529 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3530 | { |
| 3531 | if (lsa != NULL) |
| 3532 | { |
| 3533 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3534 | |
| 3535 | show_ip_ospf_database_header (vty, lsa); |
| 3536 | |
| 3537 | vty_out (vty, " Network Mask: /%d%s", |
| 3538 | ip_masklen (sl->mask), VTY_NEWLINE); |
| 3539 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3540 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3541 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3542 | } |
| 3543 | |
| 3544 | return 0; |
| 3545 | } |
| 3546 | |
| 3547 | /* Show AS-external-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3548 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3549 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3550 | { |
| 3551 | if (lsa != NULL) |
| 3552 | { |
| 3553 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3554 | |
| 3555 | show_ip_ospf_database_header (vty, lsa); |
| 3556 | |
| 3557 | vty_out (vty, " Network Mask: /%d%s", |
| 3558 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3559 | vty_out (vty, " Metric Type: %s%s", |
| 3560 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3561 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3562 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3563 | vty_out (vty, " Metric: %d%s", |
| 3564 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3565 | vty_out (vty, " Forward Address: %s%s", |
| 3566 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3567 | |
| 3568 | vty_out (vty, " External Route Tag: %lu%s%s", |
| 3569 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3570 | } |
| 3571 | |
| 3572 | return 0; |
| 3573 | } |
| 3574 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3575 | /* N.B. This function currently seems to be unused. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3576 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3577 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
| 3578 | { |
| 3579 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3580 | |
| 3581 | /* show_ip_ospf_database_header (vty, lsa); */ |
| 3582 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3583 | zlog_debug( " Network Mask: /%d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3584 | ip_masklen (al->mask), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3585 | zlog_debug( " Metric Type: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3586 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3587 | "2 (Larger than any link state path)" : "1", "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3588 | zlog_debug( " TOS: 0%s", "\n"); |
| 3589 | zlog_debug( " Metric: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3590 | GET_METRIC (al->e[0].metric), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3591 | zlog_debug( " Forward Address: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3592 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
| 3593 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3594 | zlog_debug( " External Route Tag: %u%s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3595 | ntohl (al->e[0].route_tag), "\n", "\n"); |
| 3596 | |
| 3597 | return 0; |
| 3598 | } |
| 3599 | |
| 3600 | /* Show AS-NSSA-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3601 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3602 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3603 | { |
| 3604 | if (lsa != NULL) |
| 3605 | { |
| 3606 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3607 | |
| 3608 | show_ip_ospf_database_header (vty, lsa); |
| 3609 | |
| 3610 | vty_out (vty, " Network Mask: /%d%s", |
| 3611 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3612 | vty_out (vty, " Metric Type: %s%s", |
| 3613 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3614 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3615 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3616 | vty_out (vty, " Metric: %d%s", |
| 3617 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3618 | vty_out (vty, " NSSA: Forward Address: %s%s", |
| 3619 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3620 | |
| 3621 | vty_out (vty, " External Route Tag: %u%s%s", |
| 3622 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3623 | } |
| 3624 | |
| 3625 | return 0; |
| 3626 | } |
| 3627 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3628 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3629 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
| 3630 | { |
| 3631 | return 0; |
| 3632 | } |
| 3633 | |
| 3634 | #ifdef HAVE_OPAQUE_LSA |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3635 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3636 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3637 | { |
| 3638 | if (lsa != NULL) |
| 3639 | { |
| 3640 | show_ip_ospf_database_header (vty, lsa); |
| 3641 | show_opaque_info_detail (vty, lsa); |
| 3642 | |
| 3643 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3644 | } |
| 3645 | return 0; |
| 3646 | } |
| 3647 | #endif /* HAVE_OPAQUE_LSA */ |
| 3648 | |
| 3649 | int (*show_function[])(struct vty *, struct ospf_lsa *) = |
| 3650 | { |
| 3651 | NULL, |
| 3652 | show_router_lsa_detail, |
| 3653 | show_network_lsa_detail, |
| 3654 | show_summary_lsa_detail, |
| 3655 | show_summary_asbr_lsa_detail, |
| 3656 | show_as_external_lsa_detail, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3657 | show_func_dummy, |
| 3658 | show_as_nssa_lsa_detail, /* almost same as external */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3659 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3660 | NULL, /* type-8 */ |
| 3661 | show_opaque_lsa_detail, |
| 3662 | show_opaque_lsa_detail, |
| 3663 | show_opaque_lsa_detail, |
| 3664 | #endif /* HAVE_OPAQUE_LSA */ |
| 3665 | }; |
| 3666 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3667 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3668 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
| 3669 | struct in_addr *adv_router) |
| 3670 | { |
| 3671 | memset (lp, 0, sizeof (struct prefix_ls)); |
| 3672 | lp->family = 0; |
| 3673 | if (id == NULL) |
| 3674 | lp->prefixlen = 0; |
| 3675 | else if (adv_router == NULL) |
| 3676 | { |
| 3677 | lp->prefixlen = 32; |
| 3678 | lp->id = *id; |
| 3679 | } |
| 3680 | else |
| 3681 | { |
| 3682 | lp->prefixlen = 64; |
| 3683 | lp->id = *id; |
| 3684 | lp->adv_router = *adv_router; |
| 3685 | } |
| 3686 | } |
| 3687 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3688 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3689 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
| 3690 | struct in_addr *id, struct in_addr *adv_router) |
| 3691 | { |
| 3692 | struct prefix_ls lp; |
| 3693 | struct route_node *rn, *start; |
| 3694 | struct ospf_lsa *lsa; |
| 3695 | |
| 3696 | show_lsa_prefix_set (vty, &lp, id, adv_router); |
| 3697 | start = route_node_get (rt, (struct prefix *) &lp); |
| 3698 | if (start) |
| 3699 | { |
| 3700 | route_lock_node (start); |
| 3701 | for (rn = start; rn; rn = route_next_until (rn, start)) |
| 3702 | if ((lsa = rn->info)) |
| 3703 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3704 | if (show_function[lsa->data->type] != NULL) |
| 3705 | show_function[lsa->data->type] (vty, lsa); |
| 3706 | } |
| 3707 | route_unlock_node (start); |
| 3708 | } |
| 3709 | } |
| 3710 | |
| 3711 | /* Show detail LSA information |
| 3712 | -- if id is NULL then show all LSAs. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3713 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3714 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3715 | struct in_addr *id, struct in_addr *adv_router) |
| 3716 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3717 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3718 | struct ospf_area *area; |
| 3719 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3720 | switch (type) |
| 3721 | { |
| 3722 | case OSPF_AS_EXTERNAL_LSA: |
| 3723 | #ifdef HAVE_OPAQUE_LSA |
| 3724 | case OSPF_OPAQUE_AS_LSA: |
| 3725 | #endif /* HAVE_OPAQUE_LSA */ |
| 3726 | vty_out (vty, " %s %s%s", |
| 3727 | show_database_desc[type], |
| 3728 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3729 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3730 | break; |
| 3731 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3732 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3733 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3734 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3735 | VTY_NEWLINE, show_database_desc[type], |
| 3736 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3737 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); |
| 3738 | } |
| 3739 | break; |
| 3740 | } |
| 3741 | } |
| 3742 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3743 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3744 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
| 3745 | struct in_addr *adv_router) |
| 3746 | { |
| 3747 | struct route_node *rn; |
| 3748 | struct ospf_lsa *lsa; |
| 3749 | |
| 3750 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 3751 | if ((lsa = rn->info)) |
| 3752 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) |
| 3753 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3754 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
| 3755 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3756 | if (show_function[lsa->data->type] != NULL) |
| 3757 | show_function[lsa->data->type] (vty, lsa); |
| 3758 | } |
| 3759 | } |
| 3760 | |
| 3761 | /* Show detail LSA information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3762 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3763 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3764 | struct in_addr *adv_router) |
| 3765 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3766 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3767 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3768 | |
| 3769 | switch (type) |
| 3770 | { |
| 3771 | case OSPF_AS_EXTERNAL_LSA: |
| 3772 | #ifdef HAVE_OPAQUE_LSA |
| 3773 | case OSPF_OPAQUE_AS_LSA: |
| 3774 | #endif /* HAVE_OPAQUE_LSA */ |
| 3775 | vty_out (vty, " %s %s%s", |
| 3776 | show_database_desc[type], |
| 3777 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3778 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3779 | adv_router); |
| 3780 | break; |
| 3781 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3782 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3783 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3784 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3785 | VTY_NEWLINE, show_database_desc[type], |
| 3786 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3787 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), |
| 3788 | adv_router); |
| 3789 | } |
| 3790 | break; |
| 3791 | } |
| 3792 | } |
| 3793 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3794 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3795 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3796 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3797 | struct ospf_lsa *lsa; |
| 3798 | struct route_node *rn; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3799 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3800 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3801 | int type; |
| 3802 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3803 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3804 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3805 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3806 | { |
| 3807 | switch (type) |
| 3808 | { |
| 3809 | case OSPF_AS_EXTERNAL_LSA: |
| 3810 | #ifdef HAVE_OPAQUE_LSA |
| 3811 | case OSPF_OPAQUE_AS_LSA: |
| 3812 | #endif /* HAVE_OPAQUE_LSA */ |
| 3813 | continue; |
| 3814 | default: |
| 3815 | break; |
| 3816 | } |
| 3817 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || |
| 3818 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) |
| 3819 | { |
| 3820 | vty_out (vty, " %s (Area %s)%s%s", |
| 3821 | show_database_desc[type], |
| 3822 | ospf_area_desc_string (area), |
| 3823 | VTY_NEWLINE, VTY_NEWLINE); |
| 3824 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); |
| 3825 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3826 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
| 3827 | show_lsa_summary (vty, lsa, self); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3828 | |
| 3829 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3830 | } |
| 3831 | } |
| 3832 | } |
| 3833 | |
| 3834 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3835 | { |
| 3836 | switch (type) |
| 3837 | { |
| 3838 | case OSPF_AS_EXTERNAL_LSA: |
| 3839 | #ifdef HAVE_OPAQUE_LSA |
| 3840 | case OSPF_OPAQUE_AS_LSA: |
| 3841 | #endif /* HAVE_OPAQUE_LSA */ |
| 3842 | break;; |
| 3843 | default: |
| 3844 | continue; |
| 3845 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3846 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
| 3847 | (!self && ospf_lsdb_count (ospf->lsdb, type))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3848 | { |
| 3849 | vty_out (vty, " %s%s%s", |
| 3850 | show_database_desc[type], |
| 3851 | VTY_NEWLINE, VTY_NEWLINE); |
| 3852 | vty_out (vty, "%s%s", show_database_header[type], |
| 3853 | VTY_NEWLINE); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3854 | |
| 3855 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) |
| 3856 | show_lsa_summary (vty, lsa, self); |
| 3857 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3858 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3859 | } |
| 3860 | } |
| 3861 | |
| 3862 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3863 | } |
| 3864 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3865 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3866 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3867 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3868 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3869 | struct ospf_lsa *lsa; |
| 3870 | |
| 3871 | vty_out (vty, "%s MaxAge Link States:%s%s", |
| 3872 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); |
| 3873 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3874 | for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) |
| 3875 | { |
| 3876 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); |
| 3877 | vty_out (vty, "Link State ID: %s%s", |
| 3878 | inet_ntoa (lsa->data->id), VTY_NEWLINE); |
| 3879 | vty_out (vty, "Advertising Router: %s%s", |
| 3880 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3881 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); |
| 3882 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3883 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3884 | } |
| 3885 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3886 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
| 3887 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3888 | |
| 3889 | #ifdef HAVE_OPAQUE_LSA |
| 3890 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" |
| 3891 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" |
| 3892 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" |
| 3893 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" |
| 3894 | #else /* HAVE_OPAQUE_LSA */ |
| 3895 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" |
| 3896 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" |
| 3897 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" |
| 3898 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" |
| 3899 | #endif /* HAVE_OPAQUE_LSA */ |
| 3900 | |
| 3901 | #define OSPF_LSA_TYPES_CMD_STR \ |
| 3902 | "asbr-summary|external|network|router|summary" \ |
| 3903 | OSPF_LSA_TYPE_NSSA_CMD_STR \ |
| 3904 | OSPF_LSA_TYPE_OPAQUE_CMD_STR |
| 3905 | |
| 3906 | #define OSPF_LSA_TYPES_DESC \ |
| 3907 | "ASBR summary link states\n" \ |
| 3908 | "External link states\n" \ |
| 3909 | "Network link states\n" \ |
| 3910 | "Router link states\n" \ |
| 3911 | "Network summary link states\n" \ |
| 3912 | OSPF_LSA_TYPE_NSSA_DESC \ |
| 3913 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ |
| 3914 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ |
| 3915 | OSPF_LSA_TYPE_OPAQUE_AS_DESC |
| 3916 | |
| 3917 | DEFUN (show_ip_ospf_database, |
| 3918 | show_ip_ospf_database_cmd, |
| 3919 | "show ip ospf database", |
| 3920 | SHOW_STR |
| 3921 | IP_STR |
| 3922 | "OSPF information\n" |
| 3923 | "Database summary\n") |
| 3924 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3925 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3926 | int type, ret; |
| 3927 | struct in_addr id, adv_router; |
| 3928 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3929 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3930 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3931 | return CMD_SUCCESS; |
| 3932 | |
| 3933 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3934 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3935 | |
| 3936 | /* Show all LSA. */ |
| 3937 | if (argc == 0) |
| 3938 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3939 | show_ip_ospf_database_summary (vty, ospf, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3940 | return CMD_SUCCESS; |
| 3941 | } |
| 3942 | |
| 3943 | /* Set database type to show. */ |
| 3944 | if (strncmp (argv[0], "r", 1) == 0) |
| 3945 | type = OSPF_ROUTER_LSA; |
| 3946 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 3947 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3948 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 3949 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3950 | else if (strncmp (argv[0], "su", 2) == 0) |
| 3951 | type = OSPF_SUMMARY_LSA; |
| 3952 | else if (strncmp (argv[0], "a", 1) == 0) |
| 3953 | type = OSPF_ASBR_SUMMARY_LSA; |
| 3954 | else if (strncmp (argv[0], "e", 1) == 0) |
| 3955 | type = OSPF_AS_EXTERNAL_LSA; |
| 3956 | else if (strncmp (argv[0], "se", 2) == 0) |
| 3957 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3958 | show_ip_ospf_database_summary (vty, ospf, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3959 | return CMD_SUCCESS; |
| 3960 | } |
| 3961 | else if (strncmp (argv[0], "m", 1) == 0) |
| 3962 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3963 | show_ip_ospf_database_maxage (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3964 | return CMD_SUCCESS; |
| 3965 | } |
| 3966 | #ifdef HAVE_OPAQUE_LSA |
| 3967 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 3968 | type = OSPF_OPAQUE_LINK_LSA; |
| 3969 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 3970 | type = OSPF_OPAQUE_AREA_LSA; |
| 3971 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 3972 | type = OSPF_OPAQUE_AS_LSA; |
| 3973 | #endif /* HAVE_OPAQUE_LSA */ |
| 3974 | else |
| 3975 | return CMD_WARNING; |
| 3976 | |
| 3977 | /* `show ip ospf database LSA'. */ |
| 3978 | if (argc == 1) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3979 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3980 | else if (argc >= 2) |
| 3981 | { |
| 3982 | ret = inet_aton (argv[1], &id); |
| 3983 | if (!ret) |
| 3984 | return CMD_WARNING; |
| 3985 | |
| 3986 | /* `show ip ospf database LSA ID'. */ |
| 3987 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3988 | show_lsa_detail (vty, ospf, type, &id, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3989 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
| 3990 | else if (argc == 3) |
| 3991 | { |
| 3992 | if (strncmp (argv[2], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3993 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3994 | else |
| 3995 | { |
| 3996 | ret = inet_aton (argv[2], &adv_router); |
| 3997 | if (!ret) |
| 3998 | return CMD_WARNING; |
| 3999 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4000 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4001 | } |
| 4002 | } |
| 4003 | |
| 4004 | return CMD_SUCCESS; |
| 4005 | } |
| 4006 | |
| 4007 | ALIAS (show_ip_ospf_database, |
| 4008 | show_ip_ospf_database_type_cmd, |
| 4009 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", |
| 4010 | SHOW_STR |
| 4011 | IP_STR |
| 4012 | "OSPF information\n" |
| 4013 | "Database summary\n" |
| 4014 | OSPF_LSA_TYPES_DESC |
| 4015 | "LSAs in MaxAge list\n" |
| 4016 | "Self-originated link states\n") |
| 4017 | |
| 4018 | ALIAS (show_ip_ospf_database, |
| 4019 | show_ip_ospf_database_type_id_cmd, |
| 4020 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", |
| 4021 | SHOW_STR |
| 4022 | IP_STR |
| 4023 | "OSPF information\n" |
| 4024 | "Database summary\n" |
| 4025 | OSPF_LSA_TYPES_DESC |
| 4026 | "Link State ID (as an IP address)\n") |
| 4027 | |
| 4028 | ALIAS (show_ip_ospf_database, |
| 4029 | show_ip_ospf_database_type_id_adv_router_cmd, |
| 4030 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", |
| 4031 | SHOW_STR |
| 4032 | IP_STR |
| 4033 | "OSPF information\n" |
| 4034 | "Database summary\n" |
| 4035 | OSPF_LSA_TYPES_DESC |
| 4036 | "Link State ID (as an IP address)\n" |
| 4037 | "Advertising Router link states\n" |
| 4038 | "Advertising Router (as an IP address)\n") |
| 4039 | |
| 4040 | ALIAS (show_ip_ospf_database, |
| 4041 | show_ip_ospf_database_type_id_self_cmd, |
| 4042 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", |
| 4043 | SHOW_STR |
| 4044 | IP_STR |
| 4045 | "OSPF information\n" |
| 4046 | "Database summary\n" |
| 4047 | OSPF_LSA_TYPES_DESC |
| 4048 | "Link State ID (as an IP address)\n" |
| 4049 | "Self-originated link states\n" |
| 4050 | "\n") |
| 4051 | |
| 4052 | DEFUN (show_ip_ospf_database_type_adv_router, |
| 4053 | show_ip_ospf_database_type_adv_router_cmd, |
| 4054 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", |
| 4055 | SHOW_STR |
| 4056 | IP_STR |
| 4057 | "OSPF information\n" |
| 4058 | "Database summary\n" |
| 4059 | OSPF_LSA_TYPES_DESC |
| 4060 | "Advertising Router link states\n" |
| 4061 | "Advertising Router (as an IP address)\n") |
| 4062 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4063 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4064 | int type, ret; |
| 4065 | struct in_addr adv_router; |
| 4066 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4067 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4068 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4069 | return CMD_SUCCESS; |
| 4070 | |
| 4071 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4072 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4073 | |
| 4074 | if (argc != 2) |
| 4075 | return CMD_WARNING; |
| 4076 | |
| 4077 | /* Set database type to show. */ |
| 4078 | if (strncmp (argv[0], "r", 1) == 0) |
| 4079 | type = OSPF_ROUTER_LSA; |
| 4080 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4081 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4082 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4083 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4084 | else if (strncmp (argv[0], "s", 1) == 0) |
| 4085 | type = OSPF_SUMMARY_LSA; |
| 4086 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4087 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4088 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4089 | type = OSPF_AS_EXTERNAL_LSA; |
| 4090 | #ifdef HAVE_OPAQUE_LSA |
| 4091 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4092 | type = OSPF_OPAQUE_LINK_LSA; |
| 4093 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4094 | type = OSPF_OPAQUE_AREA_LSA; |
| 4095 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4096 | type = OSPF_OPAQUE_AS_LSA; |
| 4097 | #endif /* HAVE_OPAQUE_LSA */ |
| 4098 | else |
| 4099 | return CMD_WARNING; |
| 4100 | |
| 4101 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ |
| 4102 | if (strncmp (argv[1], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4103 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4104 | else |
| 4105 | { |
| 4106 | ret = inet_aton (argv[1], &adv_router); |
| 4107 | if (!ret) |
| 4108 | return CMD_WARNING; |
| 4109 | } |
| 4110 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4111 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4112 | |
| 4113 | return CMD_SUCCESS; |
| 4114 | } |
| 4115 | |
| 4116 | ALIAS (show_ip_ospf_database_type_adv_router, |
| 4117 | show_ip_ospf_database_type_self_cmd, |
| 4118 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", |
| 4119 | SHOW_STR |
| 4120 | IP_STR |
| 4121 | "OSPF information\n" |
| 4122 | "Database summary\n" |
| 4123 | OSPF_LSA_TYPES_DESC |
| 4124 | "Self-originated link states\n") |
| 4125 | |
| 4126 | |
| 4127 | DEFUN (ip_ospf_authentication_args, |
| 4128 | ip_ospf_authentication_args_addr_cmd, |
| 4129 | "ip ospf authentication (null|message-digest) A.B.C.D", |
| 4130 | "IP Information\n" |
| 4131 | "OSPF interface commands\n" |
| 4132 | "Enable authentication on this interface\n" |
| 4133 | "Use null authentication\n" |
| 4134 | "Use message-digest authentication\n" |
| 4135 | "Address of interface") |
| 4136 | { |
| 4137 | struct interface *ifp; |
| 4138 | struct in_addr addr; |
| 4139 | int ret; |
| 4140 | struct ospf_if_params *params; |
| 4141 | |
| 4142 | ifp = vty->index; |
| 4143 | params = IF_DEF_PARAMS (ifp); |
| 4144 | |
| 4145 | if (argc == 2) |
| 4146 | { |
| 4147 | ret = inet_aton(argv[1], &addr); |
| 4148 | if (!ret) |
| 4149 | { |
| 4150 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4151 | VTY_NEWLINE); |
| 4152 | return CMD_WARNING; |
| 4153 | } |
| 4154 | |
| 4155 | params = ospf_get_if_params (ifp, addr); |
| 4156 | ospf_if_update_params (ifp, addr); |
| 4157 | } |
| 4158 | |
| 4159 | /* Handle null authentication */ |
| 4160 | if ( argv[0][0] == 'n' ) |
| 4161 | { |
| 4162 | SET_IF_PARAM (params, auth_type); |
| 4163 | params->auth_type = OSPF_AUTH_NULL; |
| 4164 | return CMD_SUCCESS; |
| 4165 | } |
| 4166 | |
| 4167 | /* Handle message-digest authentication */ |
| 4168 | if ( argv[0][0] == 'm' ) |
| 4169 | { |
| 4170 | SET_IF_PARAM (params, auth_type); |
| 4171 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 4172 | return CMD_SUCCESS; |
| 4173 | } |
| 4174 | |
| 4175 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); |
| 4176 | return CMD_WARNING; |
| 4177 | } |
| 4178 | |
| 4179 | ALIAS (ip_ospf_authentication_args, |
| 4180 | ip_ospf_authentication_args_cmd, |
| 4181 | "ip ospf authentication (null|message-digest)", |
| 4182 | "IP Information\n" |
| 4183 | "OSPF interface commands\n" |
| 4184 | "Enable authentication on this interface\n" |
| 4185 | "Use null authentication\n" |
| 4186 | "Use message-digest authentication\n") |
| 4187 | |
| 4188 | DEFUN (ip_ospf_authentication, |
| 4189 | ip_ospf_authentication_addr_cmd, |
| 4190 | "ip ospf authentication A.B.C.D", |
| 4191 | "IP Information\n" |
| 4192 | "OSPF interface commands\n" |
| 4193 | "Enable authentication on this interface\n" |
| 4194 | "Address of interface") |
| 4195 | { |
| 4196 | struct interface *ifp; |
| 4197 | struct in_addr addr; |
| 4198 | int ret; |
| 4199 | struct ospf_if_params *params; |
| 4200 | |
| 4201 | ifp = vty->index; |
| 4202 | params = IF_DEF_PARAMS (ifp); |
| 4203 | |
| 4204 | if (argc == 1) |
| 4205 | { |
| 4206 | ret = inet_aton(argv[1], &addr); |
| 4207 | if (!ret) |
| 4208 | { |
| 4209 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4210 | VTY_NEWLINE); |
| 4211 | return CMD_WARNING; |
| 4212 | } |
| 4213 | |
| 4214 | params = ospf_get_if_params (ifp, addr); |
| 4215 | ospf_if_update_params (ifp, addr); |
| 4216 | } |
| 4217 | |
| 4218 | SET_IF_PARAM (params, auth_type); |
| 4219 | params->auth_type = OSPF_AUTH_SIMPLE; |
| 4220 | |
| 4221 | return CMD_SUCCESS; |
| 4222 | } |
| 4223 | |
| 4224 | ALIAS (ip_ospf_authentication, |
| 4225 | ip_ospf_authentication_cmd, |
| 4226 | "ip ospf authentication", |
| 4227 | "IP Information\n" |
| 4228 | "OSPF interface commands\n" |
| 4229 | "Enable authentication on this interface\n") |
| 4230 | |
| 4231 | DEFUN (no_ip_ospf_authentication, |
| 4232 | no_ip_ospf_authentication_addr_cmd, |
| 4233 | "no ip ospf authentication A.B.C.D", |
| 4234 | NO_STR |
| 4235 | "IP Information\n" |
| 4236 | "OSPF interface commands\n" |
| 4237 | "Enable authentication on this interface\n" |
| 4238 | "Address of interface") |
| 4239 | { |
| 4240 | struct interface *ifp; |
| 4241 | struct in_addr addr; |
| 4242 | int ret; |
| 4243 | struct ospf_if_params *params; |
| 4244 | |
| 4245 | ifp = vty->index; |
| 4246 | params = IF_DEF_PARAMS (ifp); |
| 4247 | |
| 4248 | if (argc == 1) |
| 4249 | { |
| 4250 | ret = inet_aton(argv[1], &addr); |
| 4251 | if (!ret) |
| 4252 | { |
| 4253 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4254 | VTY_NEWLINE); |
| 4255 | return CMD_WARNING; |
| 4256 | } |
| 4257 | |
| 4258 | params = ospf_lookup_if_params (ifp, addr); |
| 4259 | if (params == NULL) |
| 4260 | return CMD_SUCCESS; |
| 4261 | } |
| 4262 | |
| 4263 | params->auth_type = OSPF_AUTH_NOTSET; |
| 4264 | UNSET_IF_PARAM (params, auth_type); |
| 4265 | |
| 4266 | if (params != IF_DEF_PARAMS (ifp)) |
| 4267 | { |
| 4268 | ospf_free_if_params (ifp, addr); |
| 4269 | ospf_if_update_params (ifp, addr); |
| 4270 | } |
| 4271 | |
| 4272 | return CMD_SUCCESS; |
| 4273 | } |
| 4274 | |
| 4275 | ALIAS (no_ip_ospf_authentication, |
| 4276 | no_ip_ospf_authentication_cmd, |
| 4277 | "no ip ospf authentication", |
| 4278 | NO_STR |
| 4279 | "IP Information\n" |
| 4280 | "OSPF interface commands\n" |
| 4281 | "Enable authentication on this interface\n") |
| 4282 | |
| 4283 | DEFUN (ip_ospf_authentication_key, |
| 4284 | ip_ospf_authentication_key_addr_cmd, |
| 4285 | "ip ospf authentication-key AUTH_KEY A.B.C.D", |
| 4286 | "IP Information\n" |
| 4287 | "OSPF interface commands\n" |
| 4288 | "Authentication password (key)\n" |
| 4289 | "The OSPF password (key)\n" |
| 4290 | "Address of interface") |
| 4291 | { |
| 4292 | struct interface *ifp; |
| 4293 | struct in_addr addr; |
| 4294 | int ret; |
| 4295 | struct ospf_if_params *params; |
| 4296 | |
| 4297 | ifp = vty->index; |
| 4298 | params = IF_DEF_PARAMS (ifp); |
| 4299 | |
| 4300 | if (argc == 2) |
| 4301 | { |
| 4302 | ret = inet_aton(argv[1], &addr); |
| 4303 | if (!ret) |
| 4304 | { |
| 4305 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4306 | VTY_NEWLINE); |
| 4307 | return CMD_WARNING; |
| 4308 | } |
| 4309 | |
| 4310 | params = ospf_get_if_params (ifp, addr); |
| 4311 | ospf_if_update_params (ifp, addr); |
| 4312 | } |
| 4313 | |
| 4314 | |
| 4315 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4316 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4317 | SET_IF_PARAM (params, auth_simple); |
| 4318 | |
| 4319 | return CMD_SUCCESS; |
| 4320 | } |
| 4321 | |
| 4322 | ALIAS (ip_ospf_authentication_key, |
| 4323 | ip_ospf_authentication_key_cmd, |
| 4324 | "ip ospf authentication-key AUTH_KEY", |
| 4325 | "IP Information\n" |
| 4326 | "OSPF interface commands\n" |
| 4327 | "Authentication password (key)\n" |
| 4328 | "The OSPF password (key)") |
| 4329 | |
| 4330 | ALIAS (ip_ospf_authentication_key, |
| 4331 | ospf_authentication_key_cmd, |
| 4332 | "ospf authentication-key AUTH_KEY", |
| 4333 | "OSPF interface commands\n" |
| 4334 | "Authentication password (key)\n" |
| 4335 | "The OSPF password (key)") |
| 4336 | |
| 4337 | DEFUN (no_ip_ospf_authentication_key, |
| 4338 | no_ip_ospf_authentication_key_addr_cmd, |
| 4339 | "no ip ospf authentication-key A.B.C.D", |
| 4340 | NO_STR |
| 4341 | "IP Information\n" |
| 4342 | "OSPF interface commands\n" |
| 4343 | "Authentication password (key)\n" |
| 4344 | "Address of interface") |
| 4345 | { |
| 4346 | struct interface *ifp; |
| 4347 | struct in_addr addr; |
| 4348 | int ret; |
| 4349 | struct ospf_if_params *params; |
| 4350 | |
| 4351 | ifp = vty->index; |
| 4352 | params = IF_DEF_PARAMS (ifp); |
| 4353 | |
| 4354 | if (argc == 2) |
| 4355 | { |
| 4356 | ret = inet_aton(argv[1], &addr); |
| 4357 | if (!ret) |
| 4358 | { |
| 4359 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4360 | VTY_NEWLINE); |
| 4361 | return CMD_WARNING; |
| 4362 | } |
| 4363 | |
| 4364 | params = ospf_lookup_if_params (ifp, addr); |
| 4365 | if (params == NULL) |
| 4366 | return CMD_SUCCESS; |
| 4367 | } |
| 4368 | |
| 4369 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); |
| 4370 | UNSET_IF_PARAM (params, auth_simple); |
| 4371 | |
| 4372 | if (params != IF_DEF_PARAMS (ifp)) |
| 4373 | { |
| 4374 | ospf_free_if_params (ifp, addr); |
| 4375 | ospf_if_update_params (ifp, addr); |
| 4376 | } |
| 4377 | |
| 4378 | return CMD_SUCCESS; |
| 4379 | } |
| 4380 | |
| 4381 | ALIAS (no_ip_ospf_authentication_key, |
| 4382 | no_ip_ospf_authentication_key_cmd, |
| 4383 | "no ip ospf authentication-key", |
| 4384 | NO_STR |
| 4385 | "IP Information\n" |
| 4386 | "OSPF interface commands\n" |
| 4387 | "Authentication password (key)\n") |
| 4388 | |
| 4389 | ALIAS (no_ip_ospf_authentication_key, |
| 4390 | no_ospf_authentication_key_cmd, |
| 4391 | "no ospf authentication-key", |
| 4392 | NO_STR |
| 4393 | "OSPF interface commands\n" |
| 4394 | "Authentication password (key)\n") |
| 4395 | |
| 4396 | DEFUN (ip_ospf_message_digest_key, |
| 4397 | ip_ospf_message_digest_key_addr_cmd, |
| 4398 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", |
| 4399 | "IP Information\n" |
| 4400 | "OSPF interface commands\n" |
| 4401 | "Message digest authentication password (key)\n" |
| 4402 | "Key ID\n" |
| 4403 | "Use MD5 algorithm\n" |
| 4404 | "The OSPF password (key)" |
| 4405 | "Address of interface") |
| 4406 | { |
| 4407 | struct interface *ifp; |
| 4408 | struct crypt_key *ck; |
| 4409 | u_char key_id; |
| 4410 | struct in_addr addr; |
| 4411 | int ret; |
| 4412 | struct ospf_if_params *params; |
| 4413 | |
| 4414 | ifp = vty->index; |
| 4415 | params = IF_DEF_PARAMS (ifp); |
| 4416 | |
| 4417 | if (argc == 3) |
| 4418 | { |
| 4419 | ret = inet_aton(argv[2], &addr); |
| 4420 | if (!ret) |
| 4421 | { |
| 4422 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4423 | VTY_NEWLINE); |
| 4424 | return CMD_WARNING; |
| 4425 | } |
| 4426 | |
| 4427 | params = ospf_get_if_params (ifp, addr); |
| 4428 | ospf_if_update_params (ifp, addr); |
| 4429 | } |
| 4430 | |
| 4431 | key_id = strtol (argv[0], NULL, 10); |
| 4432 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) |
| 4433 | { |
| 4434 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); |
| 4435 | return CMD_WARNING; |
| 4436 | } |
| 4437 | |
| 4438 | ck = ospf_crypt_key_new (); |
| 4439 | ck->key_id = (u_char) key_id; |
| 4440 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4441 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4442 | |
| 4443 | ospf_crypt_key_add (params->auth_crypt, ck); |
| 4444 | SET_IF_PARAM (params, auth_crypt); |
| 4445 | |
| 4446 | return CMD_SUCCESS; |
| 4447 | } |
| 4448 | |
| 4449 | ALIAS (ip_ospf_message_digest_key, |
| 4450 | ip_ospf_message_digest_key_cmd, |
| 4451 | "ip ospf message-digest-key <1-255> md5 KEY", |
| 4452 | "IP Information\n" |
| 4453 | "OSPF interface commands\n" |
| 4454 | "Message digest authentication password (key)\n" |
| 4455 | "Key ID\n" |
| 4456 | "Use MD5 algorithm\n" |
| 4457 | "The OSPF password (key)") |
| 4458 | |
| 4459 | ALIAS (ip_ospf_message_digest_key, |
| 4460 | ospf_message_digest_key_cmd, |
| 4461 | "ospf message-digest-key <1-255> md5 KEY", |
| 4462 | "OSPF interface commands\n" |
| 4463 | "Message digest authentication password (key)\n" |
| 4464 | "Key ID\n" |
| 4465 | "Use MD5 algorithm\n" |
| 4466 | "The OSPF password (key)") |
| 4467 | |
| 4468 | DEFUN (no_ip_ospf_message_digest_key, |
| 4469 | no_ip_ospf_message_digest_key_addr_cmd, |
| 4470 | "no ip ospf message-digest-key <1-255> A.B.C.D", |
| 4471 | NO_STR |
| 4472 | "IP Information\n" |
| 4473 | "OSPF interface commands\n" |
| 4474 | "Message digest authentication password (key)\n" |
| 4475 | "Key ID\n" |
| 4476 | "Address of interface") |
| 4477 | { |
| 4478 | struct interface *ifp; |
| 4479 | struct crypt_key *ck; |
| 4480 | int key_id; |
| 4481 | struct in_addr addr; |
| 4482 | int ret; |
| 4483 | struct ospf_if_params *params; |
| 4484 | |
| 4485 | ifp = vty->index; |
| 4486 | params = IF_DEF_PARAMS (ifp); |
| 4487 | |
| 4488 | if (argc == 2) |
| 4489 | { |
| 4490 | ret = inet_aton(argv[1], &addr); |
| 4491 | if (!ret) |
| 4492 | { |
| 4493 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4494 | VTY_NEWLINE); |
| 4495 | return CMD_WARNING; |
| 4496 | } |
| 4497 | |
| 4498 | params = ospf_lookup_if_params (ifp, addr); |
| 4499 | if (params == NULL) |
| 4500 | return CMD_SUCCESS; |
| 4501 | } |
| 4502 | |
| 4503 | key_id = strtol (argv[0], NULL, 10); |
| 4504 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); |
| 4505 | if (ck == NULL) |
| 4506 | { |
| 4507 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); |
| 4508 | return CMD_WARNING; |
| 4509 | } |
| 4510 | |
| 4511 | ospf_crypt_key_delete (params->auth_crypt, key_id); |
| 4512 | |
| 4513 | if (params != IF_DEF_PARAMS (ifp)) |
| 4514 | { |
| 4515 | ospf_free_if_params (ifp, addr); |
| 4516 | ospf_if_update_params (ifp, addr); |
| 4517 | } |
| 4518 | |
| 4519 | return CMD_SUCCESS; |
| 4520 | } |
| 4521 | |
| 4522 | ALIAS (no_ip_ospf_message_digest_key, |
| 4523 | no_ip_ospf_message_digest_key_cmd, |
| 4524 | "no ip ospf message-digest-key <1-255>", |
| 4525 | NO_STR |
| 4526 | "IP Information\n" |
| 4527 | "OSPF interface commands\n" |
| 4528 | "Message digest authentication password (key)\n" |
| 4529 | "Key ID\n") |
| 4530 | |
| 4531 | ALIAS (no_ip_ospf_message_digest_key, |
| 4532 | no_ospf_message_digest_key_cmd, |
| 4533 | "no ospf message-digest-key <1-255>", |
| 4534 | NO_STR |
| 4535 | "OSPF interface commands\n" |
| 4536 | "Message digest authentication password (key)\n" |
| 4537 | "Key ID\n") |
| 4538 | |
| 4539 | DEFUN (ip_ospf_cost, |
| 4540 | ip_ospf_cost_addr_cmd, |
| 4541 | "ip ospf cost <1-65535> A.B.C.D", |
| 4542 | "IP Information\n" |
| 4543 | "OSPF interface commands\n" |
| 4544 | "Interface cost\n" |
| 4545 | "Cost\n" |
| 4546 | "Address of interface") |
| 4547 | { |
| 4548 | struct interface *ifp = vty->index; |
| 4549 | u_int32_t cost; |
| 4550 | struct in_addr addr; |
| 4551 | int ret; |
| 4552 | struct ospf_if_params *params; |
| 4553 | |
| 4554 | params = IF_DEF_PARAMS (ifp); |
| 4555 | |
| 4556 | cost = strtol (argv[0], NULL, 10); |
| 4557 | |
| 4558 | /* cost range is <1-65535>. */ |
| 4559 | if (cost < 1 || cost > 65535) |
| 4560 | { |
| 4561 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4562 | return CMD_WARNING; |
| 4563 | } |
| 4564 | |
| 4565 | if (argc == 2) |
| 4566 | { |
| 4567 | ret = inet_aton(argv[1], &addr); |
| 4568 | if (!ret) |
| 4569 | { |
| 4570 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4571 | VTY_NEWLINE); |
| 4572 | return CMD_WARNING; |
| 4573 | } |
| 4574 | |
| 4575 | params = ospf_get_if_params (ifp, addr); |
| 4576 | ospf_if_update_params (ifp, addr); |
| 4577 | } |
| 4578 | |
| 4579 | SET_IF_PARAM (params, output_cost_cmd); |
| 4580 | params->output_cost_cmd = cost; |
| 4581 | |
| 4582 | ospf_if_recalculate_output_cost (ifp); |
| 4583 | |
| 4584 | return CMD_SUCCESS; |
| 4585 | } |
| 4586 | |
| 4587 | ALIAS (ip_ospf_cost, |
| 4588 | ip_ospf_cost_cmd, |
| 4589 | "ip ospf cost <1-65535>", |
| 4590 | "IP Information\n" |
| 4591 | "OSPF interface commands\n" |
| 4592 | "Interface cost\n" |
| 4593 | "Cost") |
| 4594 | |
| 4595 | ALIAS (ip_ospf_cost, |
| 4596 | ospf_cost_cmd, |
| 4597 | "ospf cost <1-65535>", |
| 4598 | "OSPF interface commands\n" |
| 4599 | "Interface cost\n" |
| 4600 | "Cost") |
| 4601 | |
| 4602 | DEFUN (no_ip_ospf_cost, |
| 4603 | no_ip_ospf_cost_addr_cmd, |
| 4604 | "no ip ospf cost A.B.C.D", |
| 4605 | NO_STR |
| 4606 | "IP Information\n" |
| 4607 | "OSPF interface commands\n" |
| 4608 | "Interface cost\n" |
| 4609 | "Address of interface") |
| 4610 | { |
| 4611 | struct interface *ifp = vty->index; |
| 4612 | struct in_addr addr; |
| 4613 | int ret; |
| 4614 | struct ospf_if_params *params; |
| 4615 | |
| 4616 | ifp = vty->index; |
| 4617 | params = IF_DEF_PARAMS (ifp); |
| 4618 | |
| 4619 | if (argc == 1) |
| 4620 | { |
| 4621 | ret = inet_aton(argv[0], &addr); |
| 4622 | if (!ret) |
| 4623 | { |
| 4624 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4625 | VTY_NEWLINE); |
| 4626 | return CMD_WARNING; |
| 4627 | } |
| 4628 | |
| 4629 | params = ospf_lookup_if_params (ifp, addr); |
| 4630 | if (params == NULL) |
| 4631 | return CMD_SUCCESS; |
| 4632 | } |
| 4633 | |
| 4634 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4635 | |
| 4636 | if (params != IF_DEF_PARAMS (ifp)) |
| 4637 | { |
| 4638 | ospf_free_if_params (ifp, addr); |
| 4639 | ospf_if_update_params (ifp, addr); |
| 4640 | } |
| 4641 | |
| 4642 | ospf_if_recalculate_output_cost (ifp); |
| 4643 | |
| 4644 | return CMD_SUCCESS; |
| 4645 | } |
| 4646 | |
| 4647 | ALIAS (no_ip_ospf_cost, |
| 4648 | no_ip_ospf_cost_cmd, |
| 4649 | "no ip ospf cost", |
| 4650 | NO_STR |
| 4651 | "IP Information\n" |
| 4652 | "OSPF interface commands\n" |
| 4653 | "Interface cost\n") |
| 4654 | |
| 4655 | ALIAS (no_ip_ospf_cost, |
| 4656 | no_ospf_cost_cmd, |
| 4657 | "no ospf cost", |
| 4658 | NO_STR |
| 4659 | "OSPF interface commands\n" |
| 4660 | "Interface cost\n") |
| 4661 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4662 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4663 | ospf_nbr_timer_update (struct ospf_interface *oi) |
| 4664 | { |
| 4665 | struct route_node *rn; |
| 4666 | struct ospf_neighbor *nbr; |
| 4667 | |
| 4668 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 4669 | if ((nbr = rn->info)) |
| 4670 | { |
| 4671 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); |
| 4672 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4673 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4674 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4675 | } |
| 4676 | } |
| 4677 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4678 | static int |
| 4679 | ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, |
| 4680 | const char *nbr_str, |
| 4681 | const char *fast_hello_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4682 | { |
| 4683 | struct interface *ifp = vty->index; |
| 4684 | u_int32_t seconds; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4685 | u_char hellomult; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4686 | struct in_addr addr; |
| 4687 | int ret; |
| 4688 | struct ospf_if_params *params; |
| 4689 | struct ospf_interface *oi; |
| 4690 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4691 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4692 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4693 | ospf = ospf_lookup (); |
| 4694 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4695 | params = IF_DEF_PARAMS (ifp); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4696 | |
| 4697 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4698 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4699 | ret = inet_aton(nbr_str, &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4700 | if (!ret) |
| 4701 | { |
| 4702 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4703 | VTY_NEWLINE); |
| 4704 | return CMD_WARNING; |
| 4705 | } |
| 4706 | |
| 4707 | params = ospf_get_if_params (ifp, addr); |
| 4708 | ospf_if_update_params (ifp, addr); |
| 4709 | } |
| 4710 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4711 | if (interval_str) |
| 4712 | { |
| 4713 | VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str, |
| 4714 | 1, 65535); |
| 4715 | |
| 4716 | /* reset fast_hello too, just to be sure */ |
| 4717 | UNSET_IF_PARAM (params, fast_hello); |
| 4718 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 4719 | } |
| 4720 | else if (fast_hello_str) |
| 4721 | { |
| 4722 | VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str, |
| 4723 | 1, 10); |
| 4724 | /* 1s dead-interval with sub-second hellos desired */ |
| 4725 | seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL; |
| 4726 | SET_IF_PARAM (params, fast_hello); |
| 4727 | params->fast_hello = hellomult; |
| 4728 | } |
| 4729 | else |
| 4730 | { |
| 4731 | vty_out (vty, "Please specify dead-interval or hello-multiplier%s", |
| 4732 | VTY_NEWLINE); |
| 4733 | return CMD_WARNING; |
| 4734 | } |
| 4735 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4736 | SET_IF_PARAM (params, v_wait); |
| 4737 | params->v_wait = seconds; |
| 4738 | |
| 4739 | /* Update timer values in neighbor structure. */ |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4740 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4741 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4742 | if (ospf) |
| 4743 | { |
| 4744 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 4745 | if (oi) |
| 4746 | ospf_nbr_timer_update (oi); |
| 4747 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4748 | } |
| 4749 | else |
| 4750 | { |
| 4751 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4752 | if ((oi = rn->info)) |
| 4753 | ospf_nbr_timer_update (oi); |
| 4754 | } |
| 4755 | |
| 4756 | return CMD_SUCCESS; |
| 4757 | } |
| 4758 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4759 | |
| 4760 | DEFUN (ip_ospf_dead_interval, |
| 4761 | ip_ospf_dead_interval_addr_cmd, |
| 4762 | "ip ospf dead-interval <1-65535> A.B.C.D", |
| 4763 | "IP Information\n" |
| 4764 | "OSPF interface commands\n" |
| 4765 | "Interval after which a neighbor is declared dead\n" |
| 4766 | "Seconds\n" |
| 4767 | "Address of interface\n") |
| 4768 | { |
| 4769 | if (argc == 2) |
| 4770 | return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); |
| 4771 | else |
| 4772 | return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); |
| 4773 | } |
| 4774 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4775 | ALIAS (ip_ospf_dead_interval, |
| 4776 | ip_ospf_dead_interval_cmd, |
| 4777 | "ip ospf dead-interval <1-65535>", |
| 4778 | "IP Information\n" |
| 4779 | "OSPF interface commands\n" |
| 4780 | "Interval after which a neighbor is declared dead\n" |
| 4781 | "Seconds\n") |
| 4782 | |
| 4783 | ALIAS (ip_ospf_dead_interval, |
| 4784 | ospf_dead_interval_cmd, |
| 4785 | "ospf dead-interval <1-65535>", |
| 4786 | "OSPF interface commands\n" |
| 4787 | "Interval after which a neighbor is declared dead\n" |
| 4788 | "Seconds\n") |
| 4789 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4790 | DEFUN (ip_ospf_dead_interval_minimal, |
| 4791 | ip_ospf_dead_interval_minimal_addr_cmd, |
| 4792 | "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", |
| 4793 | "IP Information\n" |
| 4794 | "OSPF interface commands\n" |
| 4795 | "Interval after which a neighbor is declared dead\n" |
| 4796 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 4797 | "Hello multiplier factor\n" |
| 4798 | "Number of Hellos to send each second\n" |
| 4799 | "Address of interface\n") |
| 4800 | { |
| 4801 | if (argc == 2) |
| 4802 | return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); |
| 4803 | else |
| 4804 | return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); |
| 4805 | } |
| 4806 | |
| 4807 | ALIAS (ip_ospf_dead_interval_minimal, |
| 4808 | ip_ospf_dead_interval_minimal_cmd, |
| 4809 | "ip ospf dead-interval minimal hello-multiplier <1-10>", |
| 4810 | "IP Information\n" |
| 4811 | "OSPF interface commands\n" |
| 4812 | "Interval after which a neighbor is declared dead\n" |
| 4813 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 4814 | "Hello multiplier factor\n" |
| 4815 | "Number of Hellos to send each second\n") |
| 4816 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4817 | DEFUN (no_ip_ospf_dead_interval, |
| 4818 | no_ip_ospf_dead_interval_addr_cmd, |
| 4819 | "no ip ospf dead-interval A.B.C.D", |
| 4820 | NO_STR |
| 4821 | "IP Information\n" |
| 4822 | "OSPF interface commands\n" |
| 4823 | "Interval after which a neighbor is declared dead\n" |
| 4824 | "Address of interface") |
| 4825 | { |
| 4826 | struct interface *ifp = vty->index; |
| 4827 | struct in_addr addr; |
| 4828 | int ret; |
| 4829 | struct ospf_if_params *params; |
| 4830 | struct ospf_interface *oi; |
| 4831 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4832 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4833 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4834 | ospf = ospf_lookup (); |
| 4835 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4836 | ifp = vty->index; |
| 4837 | params = IF_DEF_PARAMS (ifp); |
| 4838 | |
| 4839 | if (argc == 1) |
| 4840 | { |
| 4841 | ret = inet_aton(argv[0], &addr); |
| 4842 | if (!ret) |
| 4843 | { |
| 4844 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4845 | VTY_NEWLINE); |
| 4846 | return CMD_WARNING; |
| 4847 | } |
| 4848 | |
| 4849 | params = ospf_lookup_if_params (ifp, addr); |
| 4850 | if (params == NULL) |
| 4851 | return CMD_SUCCESS; |
| 4852 | } |
| 4853 | |
| 4854 | UNSET_IF_PARAM (params, v_wait); |
| 4855 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4856 | |
| 4857 | UNSET_IF_PARAM (params, fast_hello); |
| 4858 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 4859 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4860 | if (params != IF_DEF_PARAMS (ifp)) |
| 4861 | { |
| 4862 | ospf_free_if_params (ifp, addr); |
| 4863 | ospf_if_update_params (ifp, addr); |
| 4864 | } |
| 4865 | |
| 4866 | /* Update timer values in neighbor structure. */ |
| 4867 | if (argc == 1) |
| 4868 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4869 | if (ospf) |
| 4870 | { |
| 4871 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 4872 | if (oi) |
| 4873 | ospf_nbr_timer_update (oi); |
| 4874 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4875 | } |
| 4876 | else |
| 4877 | { |
| 4878 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4879 | if ((oi = rn->info)) |
| 4880 | ospf_nbr_timer_update (oi); |
| 4881 | } |
| 4882 | |
| 4883 | return CMD_SUCCESS; |
| 4884 | } |
| 4885 | |
| 4886 | ALIAS (no_ip_ospf_dead_interval, |
| 4887 | no_ip_ospf_dead_interval_cmd, |
| 4888 | "no ip ospf dead-interval", |
| 4889 | NO_STR |
| 4890 | "IP Information\n" |
| 4891 | "OSPF interface commands\n" |
| 4892 | "Interval after which a neighbor is declared dead\n") |
| 4893 | |
| 4894 | ALIAS (no_ip_ospf_dead_interval, |
| 4895 | no_ospf_dead_interval_cmd, |
| 4896 | "no ospf dead-interval", |
| 4897 | NO_STR |
| 4898 | "OSPF interface commands\n" |
| 4899 | "Interval after which a neighbor is declared dead\n") |
| 4900 | |
| 4901 | DEFUN (ip_ospf_hello_interval, |
| 4902 | ip_ospf_hello_interval_addr_cmd, |
| 4903 | "ip ospf hello-interval <1-65535> A.B.C.D", |
| 4904 | "IP Information\n" |
| 4905 | "OSPF interface commands\n" |
| 4906 | "Time between HELLO packets\n" |
| 4907 | "Seconds\n" |
| 4908 | "Address of interface") |
| 4909 | { |
| 4910 | struct interface *ifp = vty->index; |
| 4911 | u_int32_t seconds; |
| 4912 | struct in_addr addr; |
| 4913 | int ret; |
| 4914 | struct ospf_if_params *params; |
| 4915 | |
| 4916 | params = IF_DEF_PARAMS (ifp); |
| 4917 | |
| 4918 | seconds = strtol (argv[0], NULL, 10); |
| 4919 | |
| 4920 | /* HelloInterval range is <1-65535>. */ |
| 4921 | if (seconds < 1 || seconds > 65535) |
| 4922 | { |
| 4923 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); |
| 4924 | return CMD_WARNING; |
| 4925 | } |
| 4926 | |
| 4927 | if (argc == 2) |
| 4928 | { |
| 4929 | ret = inet_aton(argv[1], &addr); |
| 4930 | if (!ret) |
| 4931 | { |
| 4932 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4933 | VTY_NEWLINE); |
| 4934 | return CMD_WARNING; |
| 4935 | } |
| 4936 | |
| 4937 | params = ospf_get_if_params (ifp, addr); |
| 4938 | ospf_if_update_params (ifp, addr); |
| 4939 | } |
| 4940 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4941 | SET_IF_PARAM (params, v_hello); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4942 | params->v_hello = seconds; |
| 4943 | |
| 4944 | return CMD_SUCCESS; |
| 4945 | } |
| 4946 | |
| 4947 | ALIAS (ip_ospf_hello_interval, |
| 4948 | ip_ospf_hello_interval_cmd, |
| 4949 | "ip ospf hello-interval <1-65535>", |
| 4950 | "IP Information\n" |
| 4951 | "OSPF interface commands\n" |
| 4952 | "Time between HELLO packets\n" |
| 4953 | "Seconds\n") |
| 4954 | |
| 4955 | ALIAS (ip_ospf_hello_interval, |
| 4956 | ospf_hello_interval_cmd, |
| 4957 | "ospf hello-interval <1-65535>", |
| 4958 | "OSPF interface commands\n" |
| 4959 | "Time between HELLO packets\n" |
| 4960 | "Seconds\n") |
| 4961 | |
| 4962 | DEFUN (no_ip_ospf_hello_interval, |
| 4963 | no_ip_ospf_hello_interval_addr_cmd, |
| 4964 | "no ip ospf hello-interval A.B.C.D", |
| 4965 | NO_STR |
| 4966 | "IP Information\n" |
| 4967 | "OSPF interface commands\n" |
| 4968 | "Time between HELLO packets\n" |
| 4969 | "Address of interface") |
| 4970 | { |
| 4971 | struct interface *ifp = vty->index; |
| 4972 | struct in_addr addr; |
| 4973 | int ret; |
| 4974 | struct ospf_if_params *params; |
| 4975 | |
| 4976 | ifp = vty->index; |
| 4977 | params = IF_DEF_PARAMS (ifp); |
| 4978 | |
| 4979 | if (argc == 1) |
| 4980 | { |
| 4981 | ret = inet_aton(argv[0], &addr); |
| 4982 | if (!ret) |
| 4983 | { |
| 4984 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4985 | VTY_NEWLINE); |
| 4986 | return CMD_WARNING; |
| 4987 | } |
| 4988 | |
| 4989 | params = ospf_lookup_if_params (ifp, addr); |
| 4990 | if (params == NULL) |
| 4991 | return CMD_SUCCESS; |
| 4992 | } |
| 4993 | |
| 4994 | UNSET_IF_PARAM (params, v_hello); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4995 | params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4996 | |
| 4997 | if (params != IF_DEF_PARAMS (ifp)) |
| 4998 | { |
| 4999 | ospf_free_if_params (ifp, addr); |
| 5000 | ospf_if_update_params (ifp, addr); |
| 5001 | } |
| 5002 | |
| 5003 | return CMD_SUCCESS; |
| 5004 | } |
| 5005 | |
| 5006 | ALIAS (no_ip_ospf_hello_interval, |
| 5007 | no_ip_ospf_hello_interval_cmd, |
| 5008 | "no ip ospf hello-interval", |
| 5009 | NO_STR |
| 5010 | "IP Information\n" |
| 5011 | "OSPF interface commands\n" |
| 5012 | "Time between HELLO packets\n") |
| 5013 | |
| 5014 | ALIAS (no_ip_ospf_hello_interval, |
| 5015 | no_ospf_hello_interval_cmd, |
| 5016 | "no ospf hello-interval", |
| 5017 | NO_STR |
| 5018 | "OSPF interface commands\n" |
| 5019 | "Time between HELLO packets\n") |
| 5020 | |
| 5021 | DEFUN (ip_ospf_network, |
| 5022 | ip_ospf_network_cmd, |
| 5023 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5024 | "IP Information\n" |
| 5025 | "OSPF interface commands\n" |
| 5026 | "Network type\n" |
| 5027 | "Specify OSPF broadcast multi-access network\n" |
| 5028 | "Specify OSPF NBMA network\n" |
| 5029 | "Specify OSPF point-to-multipoint network\n" |
| 5030 | "Specify OSPF point-to-point network\n") |
| 5031 | { |
| 5032 | struct interface *ifp = vty->index; |
| 5033 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5034 | struct route_node *rn; |
| 5035 | |
| 5036 | if (strncmp (argv[0], "b", 1) == 0) |
| 5037 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; |
| 5038 | else if (strncmp (argv[0], "n", 1) == 0) |
| 5039 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; |
| 5040 | else if (strncmp (argv[0], "point-to-m", 10) == 0) |
| 5041 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; |
| 5042 | else if (strncmp (argv[0], "point-to-p", 10) == 0) |
| 5043 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; |
| 5044 | |
| 5045 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5046 | return CMD_SUCCESS; |
| 5047 | |
| 5048 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); |
| 5049 | |
| 5050 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5051 | { |
| 5052 | struct ospf_interface *oi = rn->info; |
| 5053 | |
| 5054 | if (!oi) |
| 5055 | continue; |
| 5056 | |
| 5057 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5058 | |
| 5059 | if (oi->state > ISM_Down) |
| 5060 | { |
| 5061 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5062 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5063 | } |
| 5064 | } |
| 5065 | |
| 5066 | return CMD_SUCCESS; |
| 5067 | } |
| 5068 | |
| 5069 | ALIAS (ip_ospf_network, |
| 5070 | ospf_network_cmd, |
| 5071 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5072 | "OSPF interface commands\n" |
| 5073 | "Network type\n" |
| 5074 | "Specify OSPF broadcast multi-access network\n" |
| 5075 | "Specify OSPF NBMA network\n" |
| 5076 | "Specify OSPF point-to-multipoint network\n" |
| 5077 | "Specify OSPF point-to-point network\n") |
| 5078 | |
| 5079 | DEFUN (no_ip_ospf_network, |
| 5080 | no_ip_ospf_network_cmd, |
| 5081 | "no ip ospf network", |
| 5082 | NO_STR |
| 5083 | "IP Information\n" |
| 5084 | "OSPF interface commands\n" |
| 5085 | "Network type\n") |
| 5086 | { |
| 5087 | struct interface *ifp = vty->index; |
| 5088 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5089 | struct route_node *rn; |
| 5090 | |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 5091 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5092 | |
| 5093 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5094 | return CMD_SUCCESS; |
| 5095 | |
| 5096 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5097 | { |
| 5098 | struct ospf_interface *oi = rn->info; |
| 5099 | |
| 5100 | if (!oi) |
| 5101 | continue; |
| 5102 | |
| 5103 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5104 | |
| 5105 | if (oi->state > ISM_Down) |
| 5106 | { |
| 5107 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5108 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5109 | } |
| 5110 | } |
| 5111 | |
| 5112 | return CMD_SUCCESS; |
| 5113 | } |
| 5114 | |
| 5115 | ALIAS (no_ip_ospf_network, |
| 5116 | no_ospf_network_cmd, |
| 5117 | "no ospf network", |
| 5118 | NO_STR |
| 5119 | "OSPF interface commands\n" |
| 5120 | "Network type\n") |
| 5121 | |
| 5122 | DEFUN (ip_ospf_priority, |
| 5123 | ip_ospf_priority_addr_cmd, |
| 5124 | "ip ospf priority <0-255> A.B.C.D", |
| 5125 | "IP Information\n" |
| 5126 | "OSPF interface commands\n" |
| 5127 | "Router priority\n" |
| 5128 | "Priority\n" |
| 5129 | "Address of interface") |
| 5130 | { |
| 5131 | struct interface *ifp = vty->index; |
| 5132 | u_int32_t priority; |
| 5133 | struct route_node *rn; |
| 5134 | struct in_addr addr; |
| 5135 | int ret; |
| 5136 | struct ospf_if_params *params; |
| 5137 | |
| 5138 | params = IF_DEF_PARAMS (ifp); |
| 5139 | |
| 5140 | priority = strtol (argv[0], NULL, 10); |
| 5141 | |
| 5142 | /* Router Priority range is <0-255>. */ |
| 5143 | if (priority < 0 || priority > 255) |
| 5144 | { |
| 5145 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); |
| 5146 | return CMD_WARNING; |
| 5147 | } |
| 5148 | |
| 5149 | if (argc == 2) |
| 5150 | { |
| 5151 | ret = inet_aton(argv[1], &addr); |
| 5152 | if (!ret) |
| 5153 | { |
| 5154 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5155 | VTY_NEWLINE); |
| 5156 | return CMD_WARNING; |
| 5157 | } |
| 5158 | |
| 5159 | params = ospf_get_if_params (ifp, addr); |
| 5160 | ospf_if_update_params (ifp, addr); |
| 5161 | } |
| 5162 | |
| 5163 | SET_IF_PARAM (params, priority); |
| 5164 | params->priority = priority; |
| 5165 | |
| 5166 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5167 | { |
| 5168 | struct ospf_interface *oi = rn->info; |
| 5169 | |
| 5170 | if (!oi) |
| 5171 | continue; |
| 5172 | |
| 5173 | |
| 5174 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5175 | { |
| 5176 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5177 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5178 | } |
| 5179 | } |
| 5180 | |
| 5181 | return CMD_SUCCESS; |
| 5182 | } |
| 5183 | |
| 5184 | ALIAS (ip_ospf_priority, |
| 5185 | ip_ospf_priority_cmd, |
| 5186 | "ip ospf priority <0-255>", |
| 5187 | "IP Information\n" |
| 5188 | "OSPF interface commands\n" |
| 5189 | "Router priority\n" |
| 5190 | "Priority\n") |
| 5191 | |
| 5192 | ALIAS (ip_ospf_priority, |
| 5193 | ospf_priority_cmd, |
| 5194 | "ospf priority <0-255>", |
| 5195 | "OSPF interface commands\n" |
| 5196 | "Router priority\n" |
| 5197 | "Priority\n") |
| 5198 | |
| 5199 | DEFUN (no_ip_ospf_priority, |
| 5200 | no_ip_ospf_priority_addr_cmd, |
| 5201 | "no ip ospf priority A.B.C.D", |
| 5202 | NO_STR |
| 5203 | "IP Information\n" |
| 5204 | "OSPF interface commands\n" |
| 5205 | "Router priority\n" |
| 5206 | "Address of interface") |
| 5207 | { |
| 5208 | struct interface *ifp = vty->index; |
| 5209 | struct route_node *rn; |
| 5210 | struct in_addr addr; |
| 5211 | int ret; |
| 5212 | struct ospf_if_params *params; |
| 5213 | |
| 5214 | ifp = vty->index; |
| 5215 | params = IF_DEF_PARAMS (ifp); |
| 5216 | |
| 5217 | if (argc == 1) |
| 5218 | { |
| 5219 | ret = inet_aton(argv[0], &addr); |
| 5220 | if (!ret) |
| 5221 | { |
| 5222 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5223 | VTY_NEWLINE); |
| 5224 | return CMD_WARNING; |
| 5225 | } |
| 5226 | |
| 5227 | params = ospf_lookup_if_params (ifp, addr); |
| 5228 | if (params == NULL) |
| 5229 | return CMD_SUCCESS; |
| 5230 | } |
| 5231 | |
| 5232 | UNSET_IF_PARAM (params, priority); |
| 5233 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; |
| 5234 | |
| 5235 | if (params != IF_DEF_PARAMS (ifp)) |
| 5236 | { |
| 5237 | ospf_free_if_params (ifp, addr); |
| 5238 | ospf_if_update_params (ifp, addr); |
| 5239 | } |
| 5240 | |
| 5241 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5242 | { |
| 5243 | struct ospf_interface *oi = rn->info; |
| 5244 | |
| 5245 | if (!oi) |
| 5246 | continue; |
| 5247 | |
| 5248 | |
| 5249 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5250 | { |
| 5251 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5252 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5253 | } |
| 5254 | } |
| 5255 | |
| 5256 | return CMD_SUCCESS; |
| 5257 | } |
| 5258 | |
| 5259 | ALIAS (no_ip_ospf_priority, |
| 5260 | no_ip_ospf_priority_cmd, |
| 5261 | "no ip ospf priority", |
| 5262 | NO_STR |
| 5263 | "IP Information\n" |
| 5264 | "OSPF interface commands\n" |
| 5265 | "Router priority\n") |
| 5266 | |
| 5267 | ALIAS (no_ip_ospf_priority, |
| 5268 | no_ospf_priority_cmd, |
| 5269 | "no ospf priority", |
| 5270 | NO_STR |
| 5271 | "OSPF interface commands\n" |
| 5272 | "Router priority\n") |
| 5273 | |
| 5274 | DEFUN (ip_ospf_retransmit_interval, |
| 5275 | ip_ospf_retransmit_interval_addr_cmd, |
| 5276 | "ip ospf retransmit-interval <3-65535> A.B.C.D", |
| 5277 | "IP Information\n" |
| 5278 | "OSPF interface commands\n" |
| 5279 | "Time between retransmitting lost link state advertisements\n" |
| 5280 | "Seconds\n" |
| 5281 | "Address of interface") |
| 5282 | { |
| 5283 | struct interface *ifp = vty->index; |
| 5284 | u_int32_t seconds; |
| 5285 | struct in_addr addr; |
| 5286 | int ret; |
| 5287 | struct ospf_if_params *params; |
| 5288 | |
| 5289 | params = IF_DEF_PARAMS (ifp); |
| 5290 | seconds = strtol (argv[0], NULL, 10); |
| 5291 | |
| 5292 | /* Retransmit Interval range is <3-65535>. */ |
| 5293 | if (seconds < 3 || seconds > 65535) |
| 5294 | { |
| 5295 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); |
| 5296 | return CMD_WARNING; |
| 5297 | } |
| 5298 | |
| 5299 | |
| 5300 | if (argc == 2) |
| 5301 | { |
| 5302 | ret = inet_aton(argv[1], &addr); |
| 5303 | if (!ret) |
| 5304 | { |
| 5305 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5306 | VTY_NEWLINE); |
| 5307 | return CMD_WARNING; |
| 5308 | } |
| 5309 | |
| 5310 | params = ospf_get_if_params (ifp, addr); |
| 5311 | ospf_if_update_params (ifp, addr); |
| 5312 | } |
| 5313 | |
| 5314 | SET_IF_PARAM (params, retransmit_interval); |
| 5315 | params->retransmit_interval = seconds; |
| 5316 | |
| 5317 | return CMD_SUCCESS; |
| 5318 | } |
| 5319 | |
| 5320 | ALIAS (ip_ospf_retransmit_interval, |
| 5321 | ip_ospf_retransmit_interval_cmd, |
| 5322 | "ip ospf retransmit-interval <3-65535>", |
| 5323 | "IP Information\n" |
| 5324 | "OSPF interface commands\n" |
| 5325 | "Time between retransmitting lost link state advertisements\n" |
| 5326 | "Seconds\n") |
| 5327 | |
| 5328 | ALIAS (ip_ospf_retransmit_interval, |
| 5329 | ospf_retransmit_interval_cmd, |
| 5330 | "ospf retransmit-interval <3-65535>", |
| 5331 | "OSPF interface commands\n" |
| 5332 | "Time between retransmitting lost link state advertisements\n" |
| 5333 | "Seconds\n") |
| 5334 | |
| 5335 | DEFUN (no_ip_ospf_retransmit_interval, |
| 5336 | no_ip_ospf_retransmit_interval_addr_cmd, |
| 5337 | "no ip ospf retransmit-interval A.B.C.D", |
| 5338 | NO_STR |
| 5339 | "IP Information\n" |
| 5340 | "OSPF interface commands\n" |
| 5341 | "Time between retransmitting lost link state advertisements\n" |
| 5342 | "Address of interface") |
| 5343 | { |
| 5344 | struct interface *ifp = vty->index; |
| 5345 | struct in_addr addr; |
| 5346 | int ret; |
| 5347 | struct ospf_if_params *params; |
| 5348 | |
| 5349 | ifp = vty->index; |
| 5350 | params = IF_DEF_PARAMS (ifp); |
| 5351 | |
| 5352 | if (argc == 1) |
| 5353 | { |
| 5354 | ret = inet_aton(argv[0], &addr); |
| 5355 | if (!ret) |
| 5356 | { |
| 5357 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5358 | VTY_NEWLINE); |
| 5359 | return CMD_WARNING; |
| 5360 | } |
| 5361 | |
| 5362 | params = ospf_lookup_if_params (ifp, addr); |
| 5363 | if (params == NULL) |
| 5364 | return CMD_SUCCESS; |
| 5365 | } |
| 5366 | |
| 5367 | UNSET_IF_PARAM (params, retransmit_interval); |
| 5368 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 5369 | |
| 5370 | if (params != IF_DEF_PARAMS (ifp)) |
| 5371 | { |
| 5372 | ospf_free_if_params (ifp, addr); |
| 5373 | ospf_if_update_params (ifp, addr); |
| 5374 | } |
| 5375 | |
| 5376 | return CMD_SUCCESS; |
| 5377 | } |
| 5378 | |
| 5379 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5380 | no_ip_ospf_retransmit_interval_cmd, |
| 5381 | "no ip ospf retransmit-interval", |
| 5382 | NO_STR |
| 5383 | "IP Information\n" |
| 5384 | "OSPF interface commands\n" |
| 5385 | "Time between retransmitting lost link state advertisements\n") |
| 5386 | |
| 5387 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5388 | no_ospf_retransmit_interval_cmd, |
| 5389 | "no ospf retransmit-interval", |
| 5390 | NO_STR |
| 5391 | "OSPF interface commands\n" |
| 5392 | "Time between retransmitting lost link state advertisements\n") |
| 5393 | |
| 5394 | DEFUN (ip_ospf_transmit_delay, |
| 5395 | ip_ospf_transmit_delay_addr_cmd, |
| 5396 | "ip ospf transmit-delay <1-65535> A.B.C.D", |
| 5397 | "IP Information\n" |
| 5398 | "OSPF interface commands\n" |
| 5399 | "Link state transmit delay\n" |
| 5400 | "Seconds\n" |
| 5401 | "Address of interface") |
| 5402 | { |
| 5403 | struct interface *ifp = vty->index; |
| 5404 | u_int32_t seconds; |
| 5405 | struct in_addr addr; |
| 5406 | int ret; |
| 5407 | struct ospf_if_params *params; |
| 5408 | |
| 5409 | params = IF_DEF_PARAMS (ifp); |
| 5410 | seconds = strtol (argv[0], NULL, 10); |
| 5411 | |
| 5412 | /* Transmit Delay range is <1-65535>. */ |
| 5413 | if (seconds < 1 || seconds > 65535) |
| 5414 | { |
| 5415 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); |
| 5416 | return CMD_WARNING; |
| 5417 | } |
| 5418 | |
| 5419 | if (argc == 2) |
| 5420 | { |
| 5421 | ret = inet_aton(argv[1], &addr); |
| 5422 | if (!ret) |
| 5423 | { |
| 5424 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5425 | VTY_NEWLINE); |
| 5426 | return CMD_WARNING; |
| 5427 | } |
| 5428 | |
| 5429 | params = ospf_get_if_params (ifp, addr); |
| 5430 | ospf_if_update_params (ifp, addr); |
| 5431 | } |
| 5432 | |
| 5433 | SET_IF_PARAM (params, transmit_delay); |
| 5434 | params->transmit_delay = seconds; |
| 5435 | |
| 5436 | return CMD_SUCCESS; |
| 5437 | } |
| 5438 | |
| 5439 | ALIAS (ip_ospf_transmit_delay, |
| 5440 | ip_ospf_transmit_delay_cmd, |
| 5441 | "ip ospf transmit-delay <1-65535>", |
| 5442 | "IP Information\n" |
| 5443 | "OSPF interface commands\n" |
| 5444 | "Link state transmit delay\n" |
| 5445 | "Seconds\n") |
| 5446 | |
| 5447 | ALIAS (ip_ospf_transmit_delay, |
| 5448 | ospf_transmit_delay_cmd, |
| 5449 | "ospf transmit-delay <1-65535>", |
| 5450 | "OSPF interface commands\n" |
| 5451 | "Link state transmit delay\n" |
| 5452 | "Seconds\n") |
| 5453 | |
| 5454 | DEFUN (no_ip_ospf_transmit_delay, |
| 5455 | no_ip_ospf_transmit_delay_addr_cmd, |
| 5456 | "no ip ospf transmit-delay A.B.C.D", |
| 5457 | NO_STR |
| 5458 | "IP Information\n" |
| 5459 | "OSPF interface commands\n" |
| 5460 | "Link state transmit delay\n" |
| 5461 | "Address of interface") |
| 5462 | { |
| 5463 | struct interface *ifp = vty->index; |
| 5464 | struct in_addr addr; |
| 5465 | int ret; |
| 5466 | struct ospf_if_params *params; |
| 5467 | |
| 5468 | ifp = vty->index; |
| 5469 | params = IF_DEF_PARAMS (ifp); |
| 5470 | |
| 5471 | if (argc == 1) |
| 5472 | { |
| 5473 | ret = inet_aton(argv[0], &addr); |
| 5474 | if (!ret) |
| 5475 | { |
| 5476 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5477 | VTY_NEWLINE); |
| 5478 | return CMD_WARNING; |
| 5479 | } |
| 5480 | |
| 5481 | params = ospf_lookup_if_params (ifp, addr); |
| 5482 | if (params == NULL) |
| 5483 | return CMD_SUCCESS; |
| 5484 | } |
| 5485 | |
| 5486 | UNSET_IF_PARAM (params, transmit_delay); |
| 5487 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 5488 | |
| 5489 | if (params != IF_DEF_PARAMS (ifp)) |
| 5490 | { |
| 5491 | ospf_free_if_params (ifp, addr); |
| 5492 | ospf_if_update_params (ifp, addr); |
| 5493 | } |
| 5494 | |
| 5495 | return CMD_SUCCESS; |
| 5496 | } |
| 5497 | |
| 5498 | ALIAS (no_ip_ospf_transmit_delay, |
| 5499 | no_ip_ospf_transmit_delay_cmd, |
| 5500 | "no ip ospf transmit-delay", |
| 5501 | NO_STR |
| 5502 | "IP Information\n" |
| 5503 | "OSPF interface commands\n" |
| 5504 | "Link state transmit delay\n") |
| 5505 | |
| 5506 | ALIAS (no_ip_ospf_transmit_delay, |
| 5507 | no_ospf_transmit_delay_cmd, |
| 5508 | "no ospf transmit-delay", |
| 5509 | NO_STR |
| 5510 | "OSPF interface commands\n" |
| 5511 | "Link state transmit delay\n") |
| 5512 | |
| 5513 | |
| 5514 | DEFUN (ospf_redistribute_source_metric_type, |
| 5515 | ospf_redistribute_source_metric_type_routemap_cmd, |
| 5516 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5517 | "Redistribute information from another routing protocol\n" |
| 5518 | "Kernel routes\n" |
| 5519 | "Connected\n" |
| 5520 | "Static routes\n" |
| 5521 | "Routing Information Protocol (RIP)\n" |
| 5522 | "Border Gateway Protocol (BGP)\n" |
| 5523 | "Metric for redistributed routes\n" |
| 5524 | "OSPF default metric\n" |
| 5525 | "OSPF exterior metric type for redistributed routes\n" |
| 5526 | "Set OSPF External Type 1 metrics\n" |
| 5527 | "Set OSPF External Type 2 metrics\n" |
| 5528 | "Route map reference\n" |
| 5529 | "Pointer to route-map entries\n") |
| 5530 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5531 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5532 | int source; |
| 5533 | int type = -1; |
| 5534 | int metric = -1; |
| 5535 | |
| 5536 | /* Get distribute source. */ |
| 5537 | if (!str2distribute_source (argv[0], &source)) |
| 5538 | return CMD_WARNING; |
| 5539 | |
| 5540 | /* Get metric value. */ |
| 5541 | if (argc >= 2) |
| 5542 | if (!str2metric (argv[1], &metric)) |
| 5543 | return CMD_WARNING; |
| 5544 | |
| 5545 | /* Get metric type. */ |
| 5546 | if (argc >= 3) |
| 5547 | if (!str2metric_type (argv[2], &type)) |
| 5548 | return CMD_WARNING; |
| 5549 | |
| 5550 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5551 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5552 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5553 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5554 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5555 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5556 | } |
| 5557 | |
| 5558 | ALIAS (ospf_redistribute_source_metric_type, |
| 5559 | ospf_redistribute_source_metric_type_cmd, |
| 5560 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", |
| 5561 | "Redistribute information from another routing protocol\n" |
| 5562 | "Kernel routes\n" |
| 5563 | "Connected\n" |
| 5564 | "Static routes\n" |
| 5565 | "Routing Information Protocol (RIP)\n" |
| 5566 | "Border Gateway Protocol (BGP)\n" |
| 5567 | "Metric for redistributed routes\n" |
| 5568 | "OSPF default metric\n" |
| 5569 | "OSPF exterior metric type for redistributed routes\n" |
| 5570 | "Set OSPF External Type 1 metrics\n" |
| 5571 | "Set OSPF External Type 2 metrics\n") |
| 5572 | |
| 5573 | ALIAS (ospf_redistribute_source_metric_type, |
| 5574 | ospf_redistribute_source_metric_cmd, |
| 5575 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", |
| 5576 | "Redistribute information from another routing protocol\n" |
| 5577 | "Kernel routes\n" |
| 5578 | "Connected\n" |
| 5579 | "Static routes\n" |
| 5580 | "Routing Information Protocol (RIP)\n" |
| 5581 | "Border Gateway Protocol (BGP)\n" |
| 5582 | "Metric for redistributed routes\n" |
| 5583 | "OSPF default metric\n") |
| 5584 | |
| 5585 | DEFUN (ospf_redistribute_source_type_metric, |
| 5586 | ospf_redistribute_source_type_metric_routemap_cmd, |
| 5587 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5588 | "Redistribute information from another routing protocol\n" |
| 5589 | "Kernel routes\n" |
| 5590 | "Connected\n" |
| 5591 | "Static routes\n" |
| 5592 | "Routing Information Protocol (RIP)\n" |
| 5593 | "Border Gateway Protocol (BGP)\n" |
| 5594 | "OSPF exterior metric type for redistributed routes\n" |
| 5595 | "Set OSPF External Type 1 metrics\n" |
| 5596 | "Set OSPF External Type 2 metrics\n" |
| 5597 | "Metric for redistributed routes\n" |
| 5598 | "OSPF default metric\n" |
| 5599 | "Route map reference\n" |
| 5600 | "Pointer to route-map entries\n") |
| 5601 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5602 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5603 | int source; |
| 5604 | int type = -1; |
| 5605 | int metric = -1; |
| 5606 | |
| 5607 | /* Get distribute source. */ |
| 5608 | if (!str2distribute_source (argv[0], &source)) |
| 5609 | return CMD_WARNING; |
| 5610 | |
| 5611 | /* Get metric value. */ |
| 5612 | if (argc >= 2) |
| 5613 | if (!str2metric_type (argv[1], &type)) |
| 5614 | return CMD_WARNING; |
| 5615 | |
| 5616 | /* Get metric type. */ |
| 5617 | if (argc >= 3) |
| 5618 | if (!str2metric (argv[2], &metric)) |
| 5619 | return CMD_WARNING; |
| 5620 | |
| 5621 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5622 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5623 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5624 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5625 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5626 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5627 | } |
| 5628 | |
| 5629 | ALIAS (ospf_redistribute_source_type_metric, |
| 5630 | ospf_redistribute_source_type_metric_cmd, |
| 5631 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", |
| 5632 | "Redistribute information from another routing protocol\n" |
| 5633 | "Kernel routes\n" |
| 5634 | "Connected\n" |
| 5635 | "Static routes\n" |
| 5636 | "Routing Information Protocol (RIP)\n" |
| 5637 | "Border Gateway Protocol (BGP)\n" |
| 5638 | "OSPF exterior metric type for redistributed routes\n" |
| 5639 | "Set OSPF External Type 1 metrics\n" |
| 5640 | "Set OSPF External Type 2 metrics\n" |
| 5641 | "Metric for redistributed routes\n" |
| 5642 | "OSPF default metric\n") |
| 5643 | |
| 5644 | ALIAS (ospf_redistribute_source_type_metric, |
| 5645 | ospf_redistribute_source_type_cmd, |
| 5646 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", |
| 5647 | "Redistribute information from another routing protocol\n" |
| 5648 | "Kernel routes\n" |
| 5649 | "Connected\n" |
| 5650 | "Static routes\n" |
| 5651 | "Routing Information Protocol (RIP)\n" |
| 5652 | "Border Gateway Protocol (BGP)\n" |
| 5653 | "OSPF exterior metric type for redistributed routes\n" |
| 5654 | "Set OSPF External Type 1 metrics\n" |
| 5655 | "Set OSPF External Type 2 metrics\n") |
| 5656 | |
| 5657 | ALIAS (ospf_redistribute_source_type_metric, |
| 5658 | ospf_redistribute_source_cmd, |
| 5659 | "redistribute (kernel|connected|static|rip|bgp)", |
| 5660 | "Redistribute information from another routing protocol\n" |
| 5661 | "Kernel routes\n" |
| 5662 | "Connected\n" |
| 5663 | "Static routes\n" |
| 5664 | "Routing Information Protocol (RIP)\n" |
| 5665 | "Border Gateway Protocol (BGP)\n") |
| 5666 | |
| 5667 | DEFUN (ospf_redistribute_source_metric_routemap, |
| 5668 | ospf_redistribute_source_metric_routemap_cmd, |
| 5669 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", |
| 5670 | "Redistribute information from another routing protocol\n" |
| 5671 | "Kernel routes\n" |
| 5672 | "Connected\n" |
| 5673 | "Static routes\n" |
| 5674 | "Routing Information Protocol (RIP)\n" |
| 5675 | "Border Gateway Protocol (BGP)\n" |
| 5676 | "Metric for redistributed routes\n" |
| 5677 | "OSPF default metric\n" |
| 5678 | "Route map reference\n" |
| 5679 | "Pointer to route-map entries\n") |
| 5680 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5681 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5682 | int source; |
| 5683 | int metric = -1; |
| 5684 | |
| 5685 | /* Get distribute source. */ |
| 5686 | if (!str2distribute_source (argv[0], &source)) |
| 5687 | return CMD_WARNING; |
| 5688 | |
| 5689 | /* Get metric value. */ |
| 5690 | if (argc >= 2) |
| 5691 | if (!str2metric (argv[1], &metric)) |
| 5692 | return CMD_WARNING; |
| 5693 | |
| 5694 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5695 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5696 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5697 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5698 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5699 | return ospf_redistribute_set (ospf, source, -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5700 | } |
| 5701 | |
| 5702 | DEFUN (ospf_redistribute_source_type_routemap, |
| 5703 | ospf_redistribute_source_type_routemap_cmd, |
| 5704 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", |
| 5705 | "Redistribute information from another routing protocol\n" |
| 5706 | "Kernel routes\n" |
| 5707 | "Connected\n" |
| 5708 | "Static routes\n" |
| 5709 | "Routing Information Protocol (RIP)\n" |
| 5710 | "Border Gateway Protocol (BGP)\n" |
| 5711 | "OSPF exterior metric type for redistributed routes\n" |
| 5712 | "Set OSPF External Type 1 metrics\n" |
| 5713 | "Set OSPF External Type 2 metrics\n" |
| 5714 | "Route map reference\n" |
| 5715 | "Pointer to route-map entries\n") |
| 5716 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5717 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5718 | int source; |
| 5719 | int type = -1; |
| 5720 | |
| 5721 | /* Get distribute source. */ |
| 5722 | if (!str2distribute_source (argv[0], &source)) |
| 5723 | return CMD_WARNING; |
| 5724 | |
| 5725 | /* Get metric value. */ |
| 5726 | if (argc >= 2) |
| 5727 | if (!str2metric_type (argv[1], &type)) |
| 5728 | return CMD_WARNING; |
| 5729 | |
| 5730 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5731 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5732 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5733 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5734 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5735 | return ospf_redistribute_set (ospf, source, type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5736 | } |
| 5737 | |
| 5738 | DEFUN (ospf_redistribute_source_routemap, |
| 5739 | ospf_redistribute_source_routemap_cmd, |
| 5740 | "redistribute (kernel|connected|static|rip|bgp) route-map WORD", |
| 5741 | "Redistribute information from another routing protocol\n" |
| 5742 | "Kernel routes\n" |
| 5743 | "Connected\n" |
| 5744 | "Static routes\n" |
| 5745 | "Routing Information Protocol (RIP)\n" |
| 5746 | "Border Gateway Protocol (BGP)\n" |
| 5747 | "Route map reference\n" |
| 5748 | "Pointer to route-map entries\n") |
| 5749 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5750 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5751 | int source; |
| 5752 | |
| 5753 | /* Get distribute source. */ |
| 5754 | if (!str2distribute_source (argv[0], &source)) |
| 5755 | return CMD_WARNING; |
| 5756 | |
| 5757 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5758 | ospf_routemap_set (ospf, source, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5759 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5760 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5761 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5762 | return ospf_redistribute_set (ospf, source, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5763 | } |
| 5764 | |
| 5765 | DEFUN (no_ospf_redistribute_source, |
| 5766 | no_ospf_redistribute_source_cmd, |
| 5767 | "no redistribute (kernel|connected|static|rip|bgp)", |
| 5768 | NO_STR |
| 5769 | "Redistribute information from another routing protocol\n" |
| 5770 | "Kernel routes\n" |
| 5771 | "Connected\n" |
| 5772 | "Static routes\n" |
| 5773 | "Routing Information Protocol (RIP)\n" |
| 5774 | "Border Gateway Protocol (BGP)\n") |
| 5775 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5776 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5777 | int source; |
| 5778 | |
| 5779 | if (!str2distribute_source (argv[0], &source)) |
| 5780 | return CMD_WARNING; |
| 5781 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5782 | ospf_routemap_unset (ospf, source); |
| 5783 | return ospf_redistribute_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5784 | } |
| 5785 | |
| 5786 | DEFUN (ospf_distribute_list_out, |
| 5787 | ospf_distribute_list_out_cmd, |
| 5788 | "distribute-list WORD out (kernel|connected|static|rip|bgp)", |
| 5789 | "Filter networks in routing updates\n" |
| 5790 | "Access-list name\n" |
| 5791 | OUT_STR |
| 5792 | "Kernel routes\n" |
| 5793 | "Connected\n" |
| 5794 | "Static routes\n" |
| 5795 | "Routing Information Protocol (RIP)\n" |
| 5796 | "Border Gateway Protocol (BGP)\n") |
| 5797 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5798 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5799 | int source; |
| 5800 | |
| 5801 | /* Get distribute source. */ |
| 5802 | if (!str2distribute_source (argv[1], &source)) |
| 5803 | return CMD_WARNING; |
| 5804 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5805 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5806 | } |
| 5807 | |
| 5808 | DEFUN (no_ospf_distribute_list_out, |
| 5809 | no_ospf_distribute_list_out_cmd, |
| 5810 | "no distribute-list WORD out (kernel|connected|static|rip|bgp)", |
| 5811 | NO_STR |
| 5812 | "Filter networks in routing updates\n" |
| 5813 | "Access-list name\n" |
| 5814 | OUT_STR |
| 5815 | "Kernel routes\n" |
| 5816 | "Connected\n" |
| 5817 | "Static routes\n" |
| 5818 | "Routing Information Protocol (RIP)\n" |
| 5819 | "Border Gateway Protocol (BGP)\n") |
| 5820 | { |
paul | 6898008 | 2003-03-25 05:07:42 +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 | if (!str2distribute_source (argv[1], &source)) |
| 5825 | return CMD_WARNING; |
| 5826 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5827 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5828 | } |
| 5829 | |
| 5830 | /* Default information originate. */ |
| 5831 | DEFUN (ospf_default_information_originate_metric_type_routemap, |
| 5832 | ospf_default_information_originate_metric_type_routemap_cmd, |
| 5833 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5834 | "Control distribution of default information\n" |
| 5835 | "Distribute a default route\n" |
| 5836 | "OSPF default metric\n" |
| 5837 | "OSPF metric\n" |
| 5838 | "OSPF metric type for default routes\n" |
| 5839 | "Set OSPF External Type 1 metrics\n" |
| 5840 | "Set OSPF External Type 2 metrics\n" |
| 5841 | "Route map reference\n" |
| 5842 | "Pointer to route-map entries\n") |
| 5843 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5844 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5845 | int type = -1; |
| 5846 | int metric = -1; |
| 5847 | |
| 5848 | /* Get metric value. */ |
| 5849 | if (argc >= 1) |
| 5850 | if (!str2metric (argv[0], &metric)) |
| 5851 | return CMD_WARNING; |
| 5852 | |
| 5853 | /* Get metric type. */ |
| 5854 | if (argc >= 2) |
| 5855 | if (!str2metric_type (argv[1], &type)) |
| 5856 | return CMD_WARNING; |
| 5857 | |
| 5858 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5859 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5860 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5861 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5862 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5863 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5864 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5865 | } |
| 5866 | |
| 5867 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5868 | ospf_default_information_originate_metric_type_cmd, |
| 5869 | "default-information originate metric <0-16777214> metric-type (1|2)", |
| 5870 | "Control distribution of default information\n" |
| 5871 | "Distribute a default route\n" |
| 5872 | "OSPF default metric\n" |
| 5873 | "OSPF metric\n" |
| 5874 | "OSPF metric type for default routes\n" |
| 5875 | "Set OSPF External Type 1 metrics\n" |
| 5876 | "Set OSPF External Type 2 metrics\n") |
| 5877 | |
| 5878 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5879 | ospf_default_information_originate_metric_cmd, |
| 5880 | "default-information originate metric <0-16777214>", |
| 5881 | "Control distribution of default information\n" |
| 5882 | "Distribute a default route\n" |
| 5883 | "OSPF default metric\n" |
| 5884 | "OSPF metric\n") |
| 5885 | |
| 5886 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5887 | ospf_default_information_originate_cmd, |
| 5888 | "default-information originate", |
| 5889 | "Control distribution of default information\n" |
| 5890 | "Distribute a default route\n") |
| 5891 | |
| 5892 | /* Default information originate. */ |
| 5893 | DEFUN (ospf_default_information_originate_metric_routemap, |
| 5894 | ospf_default_information_originate_metric_routemap_cmd, |
| 5895 | "default-information originate metric <0-16777214> route-map WORD", |
| 5896 | "Control distribution of default information\n" |
| 5897 | "Distribute a default route\n" |
| 5898 | "OSPF default metric\n" |
| 5899 | "OSPF metric\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 metric = -1; |
| 5905 | |
| 5906 | /* Get metric value. */ |
| 5907 | if (argc >= 1) |
| 5908 | if (!str2metric (argv[0], &metric)) |
| 5909 | return CMD_WARNING; |
| 5910 | |
| 5911 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5912 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5913 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5914 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5915 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5916 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5917 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5918 | } |
| 5919 | |
| 5920 | /* Default information originate. */ |
| 5921 | DEFUN (ospf_default_information_originate_routemap, |
| 5922 | ospf_default_information_originate_routemap_cmd, |
| 5923 | "default-information originate route-map WORD", |
| 5924 | "Control distribution of default information\n" |
| 5925 | "Distribute a default route\n" |
| 5926 | "Route map reference\n" |
| 5927 | "Pointer to route-map entries\n") |
| 5928 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5929 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5930 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5931 | if (argc == 1) |
| 5932 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 5933 | else |
| 5934 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 5935 | |
| 5936 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5937 | } |
| 5938 | |
| 5939 | DEFUN (ospf_default_information_originate_type_metric_routemap, |
| 5940 | ospf_default_information_originate_type_metric_routemap_cmd, |
| 5941 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5942 | "Control distribution of default information\n" |
| 5943 | "Distribute a default route\n" |
| 5944 | "OSPF metric type for default routes\n" |
| 5945 | "Set OSPF External Type 1 metrics\n" |
| 5946 | "Set OSPF External Type 2 metrics\n" |
| 5947 | "OSPF default metric\n" |
| 5948 | "OSPF metric\n" |
| 5949 | "Route map reference\n" |
| 5950 | "Pointer to route-map entries\n") |
| 5951 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5952 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5953 | int type = -1; |
| 5954 | int metric = -1; |
| 5955 | |
| 5956 | /* Get metric type. */ |
| 5957 | if (argc >= 1) |
| 5958 | if (!str2metric_type (argv[0], &type)) |
| 5959 | return CMD_WARNING; |
| 5960 | |
| 5961 | /* Get metric value. */ |
| 5962 | if (argc >= 2) |
| 5963 | if (!str2metric (argv[1], &metric)) |
| 5964 | return CMD_WARNING; |
| 5965 | |
| 5966 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5967 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5968 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5969 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5970 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5971 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5972 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5973 | } |
| 5974 | |
| 5975 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 5976 | ospf_default_information_originate_type_metric_cmd, |
| 5977 | "default-information originate metric-type (1|2) metric <0-16777214>", |
| 5978 | "Control distribution of default information\n" |
| 5979 | "Distribute a default route\n" |
| 5980 | "OSPF metric type for default routes\n" |
| 5981 | "Set OSPF External Type 1 metrics\n" |
| 5982 | "Set OSPF External Type 2 metrics\n" |
| 5983 | "OSPF default metric\n" |
| 5984 | "OSPF metric\n") |
| 5985 | |
| 5986 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 5987 | ospf_default_information_originate_type_cmd, |
| 5988 | "default-information originate metric-type (1|2)", |
| 5989 | "Control distribution of default information\n" |
| 5990 | "Distribute a default route\n" |
| 5991 | "OSPF metric type for default routes\n" |
| 5992 | "Set OSPF External Type 1 metrics\n" |
| 5993 | "Set OSPF External Type 2 metrics\n") |
| 5994 | |
| 5995 | DEFUN (ospf_default_information_originate_type_routemap, |
| 5996 | ospf_default_information_originate_type_routemap_cmd, |
| 5997 | "default-information originate metric-type (1|2) route-map WORD", |
| 5998 | "Control distribution of default information\n" |
| 5999 | "Distribute a default route\n" |
| 6000 | "OSPF metric type for default routes\n" |
| 6001 | "Set OSPF External Type 1 metrics\n" |
| 6002 | "Set OSPF External Type 2 metrics\n" |
| 6003 | "Route map reference\n" |
| 6004 | "Pointer to route-map entries\n") |
| 6005 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6006 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6007 | int type = -1; |
| 6008 | |
| 6009 | /* Get metric type. */ |
| 6010 | if (argc >= 1) |
| 6011 | if (!str2metric_type (argv[0], &type)) |
| 6012 | return CMD_WARNING; |
| 6013 | |
| 6014 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6015 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6016 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6017 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6018 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6019 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6020 | type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6021 | } |
| 6022 | |
| 6023 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, |
| 6024 | ospf_default_information_originate_always_metric_type_routemap_cmd, |
| 6025 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6026 | "Control distribution of default information\n" |
| 6027 | "Distribute a default route\n" |
| 6028 | "Always advertise default route\n" |
| 6029 | "OSPF default metric\n" |
| 6030 | "OSPF metric\n" |
| 6031 | "OSPF metric type for default routes\n" |
| 6032 | "Set OSPF External Type 1 metrics\n" |
| 6033 | "Set OSPF External Type 2 metrics\n" |
| 6034 | "Route map reference\n" |
| 6035 | "Pointer to route-map entries\n") |
| 6036 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6037 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6038 | int type = -1; |
| 6039 | int metric = -1; |
| 6040 | |
| 6041 | /* Get metric value. */ |
| 6042 | if (argc >= 1) |
| 6043 | if (!str2metric (argv[0], &metric)) |
| 6044 | return CMD_WARNING; |
| 6045 | |
| 6046 | /* Get metric type. */ |
| 6047 | if (argc >= 2) |
| 6048 | if (!str2metric_type (argv[1], &type)) |
| 6049 | return CMD_WARNING; |
| 6050 | |
| 6051 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6052 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6053 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6054 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6055 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6056 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6057 | type, metric); |
| 6058 | } |
| 6059 | |
| 6060 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6061 | ospf_default_information_originate_always_metric_type_cmd, |
| 6062 | "default-information originate always metric <0-16777214> metric-type (1|2)", |
| 6063 | "Control distribution of default information\n" |
| 6064 | "Distribute a default route\n" |
| 6065 | "Always advertise default route\n" |
| 6066 | "OSPF default metric\n" |
| 6067 | "OSPF metric\n" |
| 6068 | "OSPF metric type for default routes\n" |
| 6069 | "Set OSPF External Type 1 metrics\n" |
| 6070 | "Set OSPF External Type 2 metrics\n") |
| 6071 | |
| 6072 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6073 | ospf_default_information_originate_always_metric_cmd, |
| 6074 | "default-information originate always metric <0-16777214>", |
| 6075 | "Control distribution of default information\n" |
| 6076 | "Distribute a default route\n" |
| 6077 | "Always advertise default route\n" |
| 6078 | "OSPF default metric\n" |
| 6079 | "OSPF metric\n" |
| 6080 | "OSPF metric type for default routes\n") |
| 6081 | |
| 6082 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6083 | ospf_default_information_originate_always_cmd, |
| 6084 | "default-information originate always", |
| 6085 | "Control distribution of default information\n" |
| 6086 | "Distribute a default route\n" |
| 6087 | "Always advertise default route\n") |
| 6088 | |
| 6089 | DEFUN (ospf_default_information_originate_always_metric_routemap, |
| 6090 | ospf_default_information_originate_always_metric_routemap_cmd, |
| 6091 | "default-information originate always metric <0-16777214> route-map WORD", |
| 6092 | "Control distribution of default information\n" |
| 6093 | "Distribute a default route\n" |
| 6094 | "Always advertise default route\n" |
| 6095 | "OSPF default metric\n" |
| 6096 | "OSPF metric\n" |
| 6097 | "Route map reference\n" |
| 6098 | "Pointer to route-map entries\n") |
| 6099 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6100 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6101 | int metric = -1; |
| 6102 | |
| 6103 | /* Get metric value. */ |
| 6104 | if (argc >= 1) |
| 6105 | if (!str2metric (argv[0], &metric)) |
| 6106 | return CMD_WARNING; |
| 6107 | |
| 6108 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6109 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6110 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6111 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6112 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6113 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
| 6114 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6115 | } |
| 6116 | |
| 6117 | DEFUN (ospf_default_information_originate_always_routemap, |
| 6118 | ospf_default_information_originate_always_routemap_cmd, |
| 6119 | "default-information originate always route-map WORD", |
| 6120 | "Control distribution of default information\n" |
| 6121 | "Distribute a default route\n" |
| 6122 | "Always advertise default route\n" |
| 6123 | "Route map reference\n" |
| 6124 | "Pointer to route-map entries\n") |
| 6125 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6126 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6127 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6128 | if (argc == 1) |
| 6129 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6130 | else |
| 6131 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6132 | |
| 6133 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6134 | } |
| 6135 | |
| 6136 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, |
| 6137 | ospf_default_information_originate_always_type_metric_routemap_cmd, |
| 6138 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6139 | "Control distribution of default information\n" |
| 6140 | "Distribute a default route\n" |
| 6141 | "Always advertise default route\n" |
| 6142 | "OSPF metric type for default routes\n" |
| 6143 | "Set OSPF External Type 1 metrics\n" |
| 6144 | "Set OSPF External Type 2 metrics\n" |
| 6145 | "OSPF default metric\n" |
| 6146 | "OSPF metric\n" |
| 6147 | "Route map reference\n" |
| 6148 | "Pointer to route-map entries\n") |
| 6149 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6150 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6151 | int type = -1; |
| 6152 | int metric = -1; |
| 6153 | |
| 6154 | /* Get metric type. */ |
| 6155 | if (argc >= 1) |
| 6156 | if (!str2metric_type (argv[0], &type)) |
| 6157 | return CMD_WARNING; |
| 6158 | |
| 6159 | /* Get metric value. */ |
| 6160 | if (argc >= 2) |
| 6161 | if (!str2metric (argv[1], &metric)) |
| 6162 | return CMD_WARNING; |
| 6163 | |
| 6164 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6165 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6166 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6167 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6168 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6169 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6170 | type, metric); |
| 6171 | } |
| 6172 | |
| 6173 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6174 | ospf_default_information_originate_always_type_metric_cmd, |
| 6175 | "default-information originate always metric-type (1|2) metric <0-16777214>", |
| 6176 | "Control distribution of default information\n" |
| 6177 | "Distribute a default route\n" |
| 6178 | "Always advertise default route\n" |
| 6179 | "OSPF metric type for default routes\n" |
| 6180 | "Set OSPF External Type 1 metrics\n" |
| 6181 | "Set OSPF External Type 2 metrics\n" |
| 6182 | "OSPF default metric\n" |
| 6183 | "OSPF metric\n") |
| 6184 | |
| 6185 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6186 | ospf_default_information_originate_always_type_cmd, |
| 6187 | "default-information originate always metric-type (1|2)", |
| 6188 | "Control distribution of default information\n" |
| 6189 | "Distribute a default route\n" |
| 6190 | "Always advertise default route\n" |
| 6191 | "OSPF metric type for default routes\n" |
| 6192 | "Set OSPF External Type 1 metrics\n" |
| 6193 | "Set OSPF External Type 2 metrics\n") |
| 6194 | |
| 6195 | DEFUN (ospf_default_information_originate_always_type_routemap, |
| 6196 | ospf_default_information_originate_always_type_routemap_cmd, |
| 6197 | "default-information originate always metric-type (1|2) 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 | "Route map reference\n" |
| 6205 | "Pointer to route-map entries\n") |
| 6206 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6207 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6208 | int type = -1; |
| 6209 | |
| 6210 | /* Get metric type. */ |
| 6211 | if (argc >= 1) |
| 6212 | if (!str2metric_type (argv[0], &type)) |
| 6213 | return CMD_WARNING; |
| 6214 | |
| 6215 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6216 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6217 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6218 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6219 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6220 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6221 | type, -1); |
| 6222 | } |
| 6223 | |
| 6224 | DEFUN (no_ospf_default_information_originate, |
| 6225 | no_ospf_default_information_originate_cmd, |
| 6226 | "no default-information originate", |
| 6227 | NO_STR |
| 6228 | "Control distribution of default information\n" |
| 6229 | "Distribute a default route\n") |
| 6230 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6231 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6232 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6233 | |
| 6234 | p.family = AF_INET; |
| 6235 | p.prefix.s_addr = 0; |
| 6236 | p.prefixlen = 0; |
| 6237 | |
ajs | 5339cfd | 2005-09-19 13:28:05 +0000 | [diff] [blame] | 6238 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6239 | |
| 6240 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { |
| 6241 | ospf_external_info_delete (DEFAULT_ROUTE, p); |
| 6242 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); |
| 6243 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; |
| 6244 | } |
| 6245 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6246 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6247 | return ospf_redistribute_default_unset (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6248 | } |
| 6249 | |
| 6250 | DEFUN (ospf_default_metric, |
| 6251 | ospf_default_metric_cmd, |
| 6252 | "default-metric <0-16777214>", |
| 6253 | "Set metric of redistributed routes\n" |
| 6254 | "Default metric\n") |
| 6255 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6256 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6257 | int metric = -1; |
| 6258 | |
| 6259 | if (!str2metric (argv[0], &metric)) |
| 6260 | return CMD_WARNING; |
| 6261 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6262 | ospf->default_metric = metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6263 | |
| 6264 | return CMD_SUCCESS; |
| 6265 | } |
| 6266 | |
| 6267 | DEFUN (no_ospf_default_metric, |
| 6268 | no_ospf_default_metric_cmd, |
| 6269 | "no default-metric", |
| 6270 | NO_STR |
| 6271 | "Set metric of redistributed routes\n") |
| 6272 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6273 | struct ospf *ospf = vty->index; |
| 6274 | |
| 6275 | ospf->default_metric = -1; |
| 6276 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6277 | return CMD_SUCCESS; |
| 6278 | } |
| 6279 | |
| 6280 | ALIAS (no_ospf_default_metric, |
| 6281 | no_ospf_default_metric_val_cmd, |
| 6282 | "no default-metric <0-16777214>", |
| 6283 | NO_STR |
| 6284 | "Set metric of redistributed routes\n" |
| 6285 | "Default metric\n") |
| 6286 | |
| 6287 | DEFUN (ospf_distance, |
| 6288 | ospf_distance_cmd, |
| 6289 | "distance <1-255>", |
| 6290 | "Define an administrative distance\n" |
| 6291 | "OSPF Administrative distance\n") |
| 6292 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6293 | struct ospf *ospf = vty->index; |
| 6294 | |
| 6295 | ospf->distance_all = atoi (argv[0]); |
| 6296 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6297 | return CMD_SUCCESS; |
| 6298 | } |
| 6299 | |
| 6300 | DEFUN (no_ospf_distance, |
| 6301 | no_ospf_distance_cmd, |
| 6302 | "no distance <1-255>", |
| 6303 | NO_STR |
| 6304 | "Define an administrative distance\n" |
| 6305 | "OSPF Administrative distance\n") |
| 6306 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6307 | struct ospf *ospf = vty->index; |
| 6308 | |
| 6309 | ospf->distance_all = 0; |
| 6310 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6311 | return CMD_SUCCESS; |
| 6312 | } |
| 6313 | |
| 6314 | DEFUN (no_ospf_distance_ospf, |
| 6315 | no_ospf_distance_ospf_cmd, |
| 6316 | "no distance ospf", |
| 6317 | NO_STR |
| 6318 | "Define an administrative distance\n" |
| 6319 | "OSPF Administrative distance\n" |
| 6320 | "OSPF Distance\n") |
| 6321 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6322 | struct ospf *ospf = vty->index; |
| 6323 | |
| 6324 | ospf->distance_intra = 0; |
| 6325 | ospf->distance_inter = 0; |
| 6326 | ospf->distance_external = 0; |
| 6327 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6328 | return CMD_SUCCESS; |
| 6329 | } |
| 6330 | |
| 6331 | DEFUN (ospf_distance_ospf_intra, |
| 6332 | ospf_distance_ospf_intra_cmd, |
| 6333 | "distance ospf intra-area <1-255>", |
| 6334 | "Define an administrative distance\n" |
| 6335 | "OSPF Administrative distance\n" |
| 6336 | "Intra-area routes\n" |
| 6337 | "Distance for intra-area routes\n") |
| 6338 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6339 | struct ospf *ospf = vty->index; |
| 6340 | |
| 6341 | ospf->distance_intra = atoi (argv[0]); |
| 6342 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6343 | return CMD_SUCCESS; |
| 6344 | } |
| 6345 | |
| 6346 | DEFUN (ospf_distance_ospf_intra_inter, |
| 6347 | ospf_distance_ospf_intra_inter_cmd, |
| 6348 | "distance ospf intra-area <1-255> inter-area <1-255>", |
| 6349 | "Define an administrative distance\n" |
| 6350 | "OSPF Administrative distance\n" |
| 6351 | "Intra-area routes\n" |
| 6352 | "Distance for intra-area routes\n" |
| 6353 | "Inter-area routes\n" |
| 6354 | "Distance for inter-area routes\n") |
| 6355 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6356 | struct ospf *ospf = vty->index; |
| 6357 | |
| 6358 | ospf->distance_intra = atoi (argv[0]); |
| 6359 | ospf->distance_inter = atoi (argv[1]); |
| 6360 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6361 | return CMD_SUCCESS; |
| 6362 | } |
| 6363 | |
| 6364 | DEFUN (ospf_distance_ospf_intra_external, |
| 6365 | ospf_distance_ospf_intra_external_cmd, |
| 6366 | "distance ospf intra-area <1-255> external <1-255>", |
| 6367 | "Define an administrative distance\n" |
| 6368 | "OSPF Administrative distance\n" |
| 6369 | "Intra-area routes\n" |
| 6370 | "Distance for intra-area routes\n" |
| 6371 | "External routes\n" |
| 6372 | "Distance for external routes\n") |
| 6373 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6374 | struct ospf *ospf = vty->index; |
| 6375 | |
| 6376 | ospf->distance_intra = atoi (argv[0]); |
| 6377 | ospf->distance_external = atoi (argv[1]); |
| 6378 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6379 | return CMD_SUCCESS; |
| 6380 | } |
| 6381 | |
| 6382 | DEFUN (ospf_distance_ospf_intra_inter_external, |
| 6383 | ospf_distance_ospf_intra_inter_external_cmd, |
| 6384 | "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>", |
| 6385 | "Define an administrative distance\n" |
| 6386 | "OSPF Administrative distance\n" |
| 6387 | "Intra-area routes\n" |
| 6388 | "Distance for intra-area routes\n" |
| 6389 | "Inter-area routes\n" |
| 6390 | "Distance for inter-area routes\n" |
| 6391 | "External routes\n" |
| 6392 | "Distance for external routes\n") |
| 6393 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6394 | struct ospf *ospf = vty->index; |
| 6395 | |
| 6396 | ospf->distance_intra = atoi (argv[0]); |
| 6397 | ospf->distance_inter = atoi (argv[1]); |
| 6398 | ospf->distance_external = atoi (argv[2]); |
| 6399 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6400 | return CMD_SUCCESS; |
| 6401 | } |
| 6402 | |
| 6403 | DEFUN (ospf_distance_ospf_intra_external_inter, |
| 6404 | ospf_distance_ospf_intra_external_inter_cmd, |
| 6405 | "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>", |
| 6406 | "Define an administrative distance\n" |
| 6407 | "OSPF Administrative distance\n" |
| 6408 | "Intra-area routes\n" |
| 6409 | "Distance for intra-area routes\n" |
| 6410 | "External routes\n" |
| 6411 | "Distance for external 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_external = atoi (argv[1]); |
| 6419 | ospf->distance_inter = atoi (argv[2]); |
| 6420 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6421 | return CMD_SUCCESS; |
| 6422 | } |
| 6423 | |
| 6424 | DEFUN (ospf_distance_ospf_inter, |
| 6425 | ospf_distance_ospf_inter_cmd, |
| 6426 | "distance ospf inter-area <1-255>", |
| 6427 | "Define an administrative distance\n" |
| 6428 | "OSPF Administrative distance\n" |
| 6429 | "Inter-area routes\n" |
| 6430 | "Distance for inter-area routes\n") |
| 6431 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6432 | struct ospf *ospf = vty->index; |
| 6433 | |
| 6434 | ospf->distance_inter = atoi (argv[0]); |
| 6435 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6436 | return CMD_SUCCESS; |
| 6437 | } |
| 6438 | |
| 6439 | DEFUN (ospf_distance_ospf_inter_intra, |
| 6440 | ospf_distance_ospf_inter_intra_cmd, |
| 6441 | "distance ospf inter-area <1-255> intra-area <1-255>", |
| 6442 | "Define an administrative distance\n" |
| 6443 | "OSPF Administrative distance\n" |
| 6444 | "Inter-area routes\n" |
| 6445 | "Distance for inter-area routes\n" |
| 6446 | "Intra-area routes\n" |
| 6447 | "Distance for intra-area routes\n") |
| 6448 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6449 | struct ospf *ospf = vty->index; |
| 6450 | |
| 6451 | ospf->distance_inter = atoi (argv[0]); |
| 6452 | ospf->distance_intra = atoi (argv[1]); |
| 6453 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6454 | return CMD_SUCCESS; |
| 6455 | } |
| 6456 | |
| 6457 | DEFUN (ospf_distance_ospf_inter_external, |
| 6458 | ospf_distance_ospf_inter_external_cmd, |
| 6459 | "distance ospf inter-area <1-255> external <1-255>", |
| 6460 | "Define an administrative distance\n" |
| 6461 | "OSPF Administrative distance\n" |
| 6462 | "Inter-area routes\n" |
| 6463 | "Distance for inter-area routes\n" |
| 6464 | "External routes\n" |
| 6465 | "Distance for external routes\n") |
| 6466 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6467 | struct ospf *ospf = vty->index; |
| 6468 | |
| 6469 | ospf->distance_inter = atoi (argv[0]); |
| 6470 | ospf->distance_external = atoi (argv[1]); |
| 6471 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6472 | return CMD_SUCCESS; |
| 6473 | } |
| 6474 | |
| 6475 | DEFUN (ospf_distance_ospf_inter_intra_external, |
| 6476 | ospf_distance_ospf_inter_intra_external_cmd, |
| 6477 | "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", |
| 6478 | "Define an administrative distance\n" |
| 6479 | "OSPF Administrative distance\n" |
| 6480 | "Inter-area routes\n" |
| 6481 | "Distance for inter-area routes\n" |
| 6482 | "Intra-area routes\n" |
| 6483 | "Distance for intra-area routes\n" |
| 6484 | "External routes\n" |
| 6485 | "Distance for external routes\n") |
| 6486 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6487 | struct ospf *ospf = vty->index; |
| 6488 | |
| 6489 | ospf->distance_inter = atoi (argv[0]); |
| 6490 | ospf->distance_intra = atoi (argv[1]); |
| 6491 | ospf->distance_external = atoi (argv[2]); |
| 6492 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6493 | return CMD_SUCCESS; |
| 6494 | } |
| 6495 | |
| 6496 | DEFUN (ospf_distance_ospf_inter_external_intra, |
| 6497 | ospf_distance_ospf_inter_external_intra_cmd, |
| 6498 | "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>", |
| 6499 | "Define an administrative distance\n" |
| 6500 | "OSPF Administrative distance\n" |
| 6501 | "Inter-area routes\n" |
| 6502 | "Distance for inter-area routes\n" |
| 6503 | "External routes\n" |
| 6504 | "Distance for external 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_external = atoi (argv[1]); |
| 6512 | ospf->distance_intra = atoi (argv[2]); |
| 6513 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6514 | return CMD_SUCCESS; |
| 6515 | } |
| 6516 | |
| 6517 | DEFUN (ospf_distance_ospf_external, |
| 6518 | ospf_distance_ospf_external_cmd, |
| 6519 | "distance ospf external <1-255>", |
| 6520 | "Define an administrative distance\n" |
| 6521 | "OSPF Administrative distance\n" |
| 6522 | "External routes\n" |
| 6523 | "Distance for external routes\n") |
| 6524 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6525 | struct ospf *ospf = vty->index; |
| 6526 | |
| 6527 | ospf->distance_external = atoi (argv[0]); |
| 6528 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6529 | return CMD_SUCCESS; |
| 6530 | } |
| 6531 | |
| 6532 | DEFUN (ospf_distance_ospf_external_intra, |
| 6533 | ospf_distance_ospf_external_intra_cmd, |
| 6534 | "distance ospf external <1-255> intra-area <1-255>", |
| 6535 | "Define an administrative distance\n" |
| 6536 | "OSPF Administrative distance\n" |
| 6537 | "External routes\n" |
| 6538 | "Distance for external routes\n" |
| 6539 | "Intra-area routes\n" |
| 6540 | "Distance for intra-area routes\n") |
| 6541 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6542 | struct ospf *ospf = vty->index; |
| 6543 | |
| 6544 | ospf->distance_external = atoi (argv[0]); |
| 6545 | ospf->distance_intra = atoi (argv[1]); |
| 6546 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6547 | return CMD_SUCCESS; |
| 6548 | } |
| 6549 | |
| 6550 | DEFUN (ospf_distance_ospf_external_inter, |
| 6551 | ospf_distance_ospf_external_inter_cmd, |
| 6552 | "distance ospf external <1-255> inter-area <1-255>", |
| 6553 | "Define an administrative distance\n" |
| 6554 | "OSPF Administrative distance\n" |
| 6555 | "External routes\n" |
| 6556 | "Distance for external routes\n" |
| 6557 | "Inter-area routes\n" |
| 6558 | "Distance for inter-area routes\n") |
| 6559 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6560 | struct ospf *ospf = vty->index; |
| 6561 | |
| 6562 | ospf->distance_external = atoi (argv[0]); |
| 6563 | ospf->distance_inter = atoi (argv[1]); |
| 6564 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6565 | return CMD_SUCCESS; |
| 6566 | } |
| 6567 | |
| 6568 | DEFUN (ospf_distance_ospf_external_intra_inter, |
| 6569 | ospf_distance_ospf_external_intra_inter_cmd, |
| 6570 | "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>", |
| 6571 | "Define an administrative distance\n" |
| 6572 | "OSPF Administrative distance\n" |
| 6573 | "External routes\n" |
| 6574 | "Distance for external routes\n" |
| 6575 | "Intra-area routes\n" |
| 6576 | "Distance for intra-area routes\n" |
| 6577 | "Inter-area routes\n" |
| 6578 | "Distance for inter-area routes\n") |
| 6579 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6580 | struct ospf *ospf = vty->index; |
| 6581 | |
| 6582 | ospf->distance_external = atoi (argv[0]); |
| 6583 | ospf->distance_intra = atoi (argv[1]); |
| 6584 | ospf->distance_inter = atoi (argv[2]); |
| 6585 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6586 | return CMD_SUCCESS; |
| 6587 | } |
| 6588 | |
| 6589 | DEFUN (ospf_distance_ospf_external_inter_intra, |
| 6590 | ospf_distance_ospf_external_inter_intra_cmd, |
| 6591 | "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>", |
| 6592 | "Define an administrative distance\n" |
| 6593 | "OSPF Administrative distance\n" |
| 6594 | "External routes\n" |
| 6595 | "Distance for external routes\n" |
| 6596 | "Inter-area routes\n" |
| 6597 | "Distance for inter-area 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_inter = atoi (argv[1]); |
| 6605 | ospf->distance_intra = atoi (argv[2]); |
| 6606 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6607 | return CMD_SUCCESS; |
| 6608 | } |
| 6609 | |
| 6610 | DEFUN (ospf_distance_source, |
| 6611 | ospf_distance_source_cmd, |
| 6612 | "distance <1-255> A.B.C.D/M", |
| 6613 | "Administrative distance\n" |
| 6614 | "Distance value\n" |
| 6615 | "IP source prefix\n") |
| 6616 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6617 | struct ospf *ospf = vty->index; |
| 6618 | |
| 6619 | ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6620 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6621 | return CMD_SUCCESS; |
| 6622 | } |
| 6623 | |
| 6624 | DEFUN (no_ospf_distance_source, |
| 6625 | no_ospf_distance_source_cmd, |
| 6626 | "no distance <1-255> A.B.C.D/M", |
| 6627 | NO_STR |
| 6628 | "Administrative distance\n" |
| 6629 | "Distance value\n" |
| 6630 | "IP source prefix\n") |
| 6631 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6632 | struct ospf *ospf = vty->index; |
| 6633 | |
| 6634 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); |
| 6635 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6636 | return CMD_SUCCESS; |
| 6637 | } |
| 6638 | |
| 6639 | DEFUN (ospf_distance_source_access_list, |
| 6640 | ospf_distance_source_access_list_cmd, |
| 6641 | "distance <1-255> A.B.C.D/M WORD", |
| 6642 | "Administrative distance\n" |
| 6643 | "Distance value\n" |
| 6644 | "IP source prefix\n" |
| 6645 | "Access list name\n") |
| 6646 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6647 | struct ospf *ospf = vty->index; |
| 6648 | |
| 6649 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); |
| 6650 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6651 | return CMD_SUCCESS; |
| 6652 | } |
| 6653 | |
| 6654 | DEFUN (no_ospf_distance_source_access_list, |
| 6655 | no_ospf_distance_source_access_list_cmd, |
| 6656 | "no distance <1-255> A.B.C.D/M WORD", |
| 6657 | NO_STR |
| 6658 | "Administrative distance\n" |
| 6659 | "Distance value\n" |
| 6660 | "IP source prefix\n" |
| 6661 | "Access list name\n") |
| 6662 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6663 | struct ospf *ospf = vty->index; |
| 6664 | |
| 6665 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); |
| 6666 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6667 | return CMD_SUCCESS; |
| 6668 | } |
| 6669 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 6670 | DEFUN (ip_ospf_mtu_ignore, |
| 6671 | ip_ospf_mtu_ignore_addr_cmd, |
| 6672 | "ip ospf mtu-ignore A.B.C.D", |
| 6673 | "IP Information\n" |
| 6674 | "OSPF interface commands\n" |
| 6675 | "Disable mtu mismatch detection\n" |
| 6676 | "Address of interface") |
| 6677 | { |
| 6678 | struct interface *ifp = vty->index; |
| 6679 | struct in_addr addr; |
| 6680 | int ret; |
| 6681 | |
| 6682 | struct ospf_if_params *params; |
| 6683 | params = IF_DEF_PARAMS (ifp); |
| 6684 | |
| 6685 | if (argc == 1) |
| 6686 | { |
| 6687 | ret = inet_aton(argv[0], &addr); |
| 6688 | if (!ret) |
| 6689 | { |
| 6690 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6691 | VTY_NEWLINE); |
| 6692 | return CMD_WARNING; |
| 6693 | } |
| 6694 | params = ospf_get_if_params (ifp, addr); |
| 6695 | ospf_if_update_params (ifp, addr); |
| 6696 | } |
| 6697 | params->mtu_ignore = 1; |
| 6698 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6699 | SET_IF_PARAM (params, mtu_ignore); |
| 6700 | else |
| 6701 | { |
| 6702 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6703 | if (params != IF_DEF_PARAMS (ifp)) |
| 6704 | { |
| 6705 | ospf_free_if_params (ifp, addr); |
| 6706 | ospf_if_update_params (ifp, addr); |
| 6707 | } |
| 6708 | } |
| 6709 | return CMD_SUCCESS; |
| 6710 | } |
| 6711 | |
| 6712 | ALIAS (ip_ospf_mtu_ignore, |
| 6713 | ip_ospf_mtu_ignore_cmd, |
| 6714 | "ip ospf mtu-ignore", |
| 6715 | "IP Information\n" |
| 6716 | "OSPF interface commands\n" |
| 6717 | "Disable mtu mismatch detection\n") |
| 6718 | |
| 6719 | |
| 6720 | DEFUN (no_ip_ospf_mtu_ignore, |
| 6721 | no_ip_ospf_mtu_ignore_addr_cmd, |
| 6722 | "no ip ospf mtu-ignore A.B.C.D", |
| 6723 | "IP Information\n" |
| 6724 | "OSPF interface commands\n" |
| 6725 | "Disable mtu mismatch detection\n" |
| 6726 | "Address of interface") |
| 6727 | { |
| 6728 | struct interface *ifp = vty->index; |
| 6729 | struct in_addr addr; |
| 6730 | int ret; |
| 6731 | |
| 6732 | struct ospf_if_params *params; |
| 6733 | params = IF_DEF_PARAMS (ifp); |
| 6734 | |
| 6735 | if (argc == 1) |
| 6736 | { |
| 6737 | ret = inet_aton(argv[0], &addr); |
| 6738 | if (!ret) |
| 6739 | { |
| 6740 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6741 | VTY_NEWLINE); |
| 6742 | return CMD_WARNING; |
| 6743 | } |
| 6744 | params = ospf_get_if_params (ifp, addr); |
| 6745 | ospf_if_update_params (ifp, addr); |
| 6746 | } |
| 6747 | params->mtu_ignore = 0; |
| 6748 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6749 | SET_IF_PARAM (params, mtu_ignore); |
| 6750 | else |
| 6751 | { |
| 6752 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6753 | if (params != IF_DEF_PARAMS (ifp)) |
| 6754 | { |
| 6755 | ospf_free_if_params (ifp, addr); |
| 6756 | ospf_if_update_params (ifp, addr); |
| 6757 | } |
| 6758 | } |
| 6759 | return CMD_SUCCESS; |
| 6760 | } |
| 6761 | |
| 6762 | ALIAS (no_ip_ospf_mtu_ignore, |
| 6763 | no_ip_ospf_mtu_ignore_cmd, |
| 6764 | "no ip ospf mtu-ignore", |
| 6765 | "IP Information\n" |
| 6766 | "OSPF interface commands\n" |
| 6767 | "Disable mtu mismatch detection\n") |
| 6768 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6769 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6770 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
| 6771 | { |
| 6772 | struct route_node *rn; |
| 6773 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6774 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6775 | struct ospf_path *path; |
| 6776 | |
| 6777 | vty_out (vty, "============ OSPF network routing table ============%s", |
| 6778 | VTY_NEWLINE); |
| 6779 | |
| 6780 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 6781 | if ((or = rn->info) != NULL) |
| 6782 | { |
| 6783 | char buf1[19]; |
| 6784 | snprintf (buf1, 19, "%s/%d", |
| 6785 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 6786 | |
| 6787 | switch (or->path_type) |
| 6788 | { |
| 6789 | case OSPF_PATH_INTER_AREA: |
| 6790 | if (or->type == OSPF_DESTINATION_NETWORK) |
| 6791 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, |
| 6792 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 6793 | else if (or->type == OSPF_DESTINATION_DISCARD) |
| 6794 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); |
| 6795 | break; |
| 6796 | case OSPF_PATH_INTRA_AREA: |
| 6797 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, |
| 6798 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 6799 | break; |
| 6800 | default: |
| 6801 | break; |
| 6802 | } |
| 6803 | |
| 6804 | if (or->type == OSPF_DESTINATION_NETWORK) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6805 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 6806 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 6807 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 6808 | { |
| 6809 | if (path->nexthop.s_addr == 0) |
| 6810 | vty_out (vty, "%24s directly attached to %s%s", |
| 6811 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 6812 | else |
| 6813 | vty_out (vty, "%24s via %s, %s%s", "", |
| 6814 | inet_ntoa (path->nexthop), path->oi->ifp->name, |
| 6815 | VTY_NEWLINE); |
| 6816 | } |
| 6817 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6818 | } |
| 6819 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6820 | } |
| 6821 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6822 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6823 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
| 6824 | { |
| 6825 | struct route_node *rn; |
| 6826 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6827 | struct listnode *pnode; |
| 6828 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6829 | struct ospf_path *path; |
| 6830 | |
| 6831 | vty_out (vty, "============ OSPF router routing table =============%s", |
| 6832 | VTY_NEWLINE); |
| 6833 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) |
| 6834 | if (rn->info) |
| 6835 | { |
| 6836 | int flag = 0; |
| 6837 | |
| 6838 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); |
| 6839 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6840 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
| 6841 | { |
| 6842 | if (flag++) |
| 6843 | vty_out (vty, "%24s", ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6844 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6845 | /* Show path. */ |
| 6846 | vty_out (vty, "%s [%d] area: %s", |
| 6847 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), |
| 6848 | or->cost, inet_ntoa (or->u.std.area_id)); |
| 6849 | /* Show flags. */ |
| 6850 | vty_out (vty, "%s%s%s", |
| 6851 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), |
| 6852 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), |
| 6853 | VTY_NEWLINE); |
| 6854 | |
| 6855 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) |
| 6856 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 6857 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
| 6858 | { |
| 6859 | if (path->nexthop.s_addr == 0) |
| 6860 | vty_out (vty, "%24s directly attached to %s%s", |
| 6861 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 6862 | else |
| 6863 | vty_out (vty, "%24s via %s, %s%s", "", |
| 6864 | inet_ntoa (path->nexthop), |
| 6865 | path->oi->ifp->name, VTY_NEWLINE); |
| 6866 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6867 | } |
| 6868 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6869 | } |
| 6870 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6871 | } |
| 6872 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6873 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6874 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
| 6875 | { |
| 6876 | struct route_node *rn; |
| 6877 | struct ospf_route *er; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6878 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6879 | struct ospf_path *path; |
| 6880 | |
| 6881 | vty_out (vty, "============ OSPF external routing table ===========%s", |
| 6882 | VTY_NEWLINE); |
| 6883 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 6884 | if ((er = rn->info) != NULL) |
| 6885 | { |
| 6886 | char buf1[19]; |
| 6887 | snprintf (buf1, 19, "%s/%d", |
| 6888 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 6889 | |
| 6890 | switch (er->path_type) |
| 6891 | { |
| 6892 | case OSPF_PATH_TYPE1_EXTERNAL: |
| 6893 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, |
| 6894 | er->cost, er->u.ext.tag, VTY_NEWLINE); |
| 6895 | break; |
| 6896 | case OSPF_PATH_TYPE2_EXTERNAL: |
| 6897 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, |
| 6898 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); |
| 6899 | break; |
| 6900 | } |
| 6901 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6902 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6903 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 6904 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6905 | { |
| 6906 | if (path->nexthop.s_addr == 0) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 6907 | vty_out (vty, "%24s directly attached to %s%s", |
| 6908 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 6909 | else |
| 6910 | vty_out (vty, "%24s via %s, %s%s", "", |
| 6911 | inet_ntoa (path->nexthop), path->oi->ifp->name, |
| 6912 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6913 | } |
| 6914 | } |
| 6915 | } |
| 6916 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6917 | } |
| 6918 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6919 | DEFUN (show_ip_ospf_border_routers, |
| 6920 | show_ip_ospf_border_routers_cmd, |
| 6921 | "show ip ospf border-routers", |
| 6922 | SHOW_STR |
| 6923 | IP_STR |
| 6924 | "show all the ABR's and ASBR's\n" |
| 6925 | "for this area\n") |
| 6926 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6927 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6928 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6929 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6930 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6931 | { |
| 6932 | vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE); |
| 6933 | return CMD_SUCCESS; |
| 6934 | } |
| 6935 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6936 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6937 | { |
| 6938 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 6939 | return CMD_SUCCESS; |
| 6940 | } |
| 6941 | |
| 6942 | /* Show Network routes. |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6943 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6944 | |
| 6945 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6946 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6947 | |
| 6948 | return CMD_SUCCESS; |
| 6949 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6950 | |
| 6951 | DEFUN (show_ip_ospf_route, |
| 6952 | show_ip_ospf_route_cmd, |
| 6953 | "show ip ospf route", |
| 6954 | SHOW_STR |
| 6955 | IP_STR |
| 6956 | "OSPF information\n" |
| 6957 | "OSPF routing table\n") |
| 6958 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6959 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6960 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6961 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6962 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6963 | { |
| 6964 | vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE); |
| 6965 | return CMD_SUCCESS; |
| 6966 | } |
| 6967 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6968 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6969 | { |
| 6970 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 6971 | return CMD_SUCCESS; |
| 6972 | } |
| 6973 | |
| 6974 | /* Show Network routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6975 | show_ip_ospf_route_network (vty, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6976 | |
| 6977 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6978 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6979 | |
| 6980 | /* Show AS External routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6981 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6982 | |
| 6983 | return CMD_SUCCESS; |
| 6984 | } |
| 6985 | |
| 6986 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 6987 | const char *ospf_abr_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6988 | { |
| 6989 | "unknown", |
| 6990 | "standard", |
| 6991 | "ibm", |
| 6992 | "cisco", |
| 6993 | "shortcut" |
| 6994 | }; |
| 6995 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 6996 | const char *ospf_shortcut_mode_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6997 | { |
| 6998 | "default", |
| 6999 | "enable", |
| 7000 | "disable" |
| 7001 | }; |
| 7002 | |
| 7003 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7004 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7005 | area_id2str (char *buf, int length, struct ospf_area *area) |
| 7006 | { |
| 7007 | memset (buf, 0, length); |
| 7008 | |
| 7009 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 7010 | strncpy (buf, inet_ntoa (area->area_id), length); |
| 7011 | else |
| 7012 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); |
| 7013 | } |
| 7014 | |
| 7015 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7016 | const char *ospf_int_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7017 | { |
| 7018 | "unknown", /* should never be used. */ |
| 7019 | "point-to-point", |
| 7020 | "broadcast", |
| 7021 | "non-broadcast", |
| 7022 | "point-to-multipoint", |
| 7023 | "virtual-link", /* should never be used. */ |
| 7024 | "loopback" |
| 7025 | }; |
| 7026 | |
| 7027 | /* Configuration write function for ospfd. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7028 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7029 | config_write_interface (struct vty *vty) |
| 7030 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7031 | struct listnode *n1, *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7032 | struct interface *ifp; |
| 7033 | struct crypt_key *ck; |
| 7034 | int write = 0; |
| 7035 | struct route_node *rn = NULL; |
| 7036 | struct ospf_if_params *params; |
| 7037 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7038 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7039 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7040 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
| 7041 | continue; |
| 7042 | |
| 7043 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 7044 | vty_out (vty, "interface %s%s", ifp->name, |
| 7045 | VTY_NEWLINE); |
| 7046 | if (ifp->desc) |
| 7047 | vty_out (vty, " description %s%s", ifp->desc, |
| 7048 | VTY_NEWLINE); |
| 7049 | |
| 7050 | write++; |
| 7051 | |
| 7052 | params = IF_DEF_PARAMS (ifp); |
| 7053 | |
| 7054 | do { |
| 7055 | /* Interface Network print. */ |
| 7056 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7057 | params->type != OSPF_IFTYPE_LOOPBACK) |
| 7058 | { |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 7059 | if (params->type != ospf_default_iftype(ifp)) |
hasso | 7b90143 | 2004-08-31 13:37:42 +0000 | [diff] [blame] | 7060 | { |
| 7061 | vty_out (vty, " ip ospf network %s", |
| 7062 | ospf_int_type_str[params->type]); |
| 7063 | if (params != IF_DEF_PARAMS (ifp)) |
| 7064 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7065 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7066 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7067 | } |
| 7068 | |
| 7069 | /* OSPF interface authentication print */ |
| 7070 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && |
| 7071 | params->auth_type != OSPF_AUTH_NOTSET) |
| 7072 | { |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7073 | const char *auth_str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7074 | |
| 7075 | /* Translation tables are not that much help here due to syntax |
| 7076 | of the simple option */ |
| 7077 | switch (params->auth_type) |
| 7078 | { |
| 7079 | |
| 7080 | case OSPF_AUTH_NULL: |
| 7081 | auth_str = " null"; |
| 7082 | break; |
| 7083 | |
| 7084 | case OSPF_AUTH_SIMPLE: |
| 7085 | auth_str = ""; |
| 7086 | break; |
| 7087 | |
| 7088 | case OSPF_AUTH_CRYPTOGRAPHIC: |
| 7089 | auth_str = " message-digest"; |
| 7090 | break; |
| 7091 | |
| 7092 | default: |
| 7093 | auth_str = ""; |
| 7094 | break; |
| 7095 | } |
| 7096 | |
| 7097 | vty_out (vty, " ip ospf authentication%s", auth_str); |
| 7098 | if (params != IF_DEF_PARAMS (ifp)) |
| 7099 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7100 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7101 | } |
| 7102 | |
| 7103 | /* Simple Authentication Password print. */ |
| 7104 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && |
| 7105 | params->auth_simple[0] != '\0') |
| 7106 | { |
| 7107 | vty_out (vty, " ip ospf authentication-key %s", |
| 7108 | params->auth_simple); |
| 7109 | if (params != IF_DEF_PARAMS (ifp)) |
| 7110 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7111 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7112 | } |
| 7113 | |
| 7114 | /* Cryptographic Authentication Key print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7115 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7116 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7117 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
| 7118 | ck->key_id, ck->auth_key); |
| 7119 | if (params != IF_DEF_PARAMS (ifp)) |
| 7120 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7121 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7122 | } |
| 7123 | |
| 7124 | /* Interface Output Cost print. */ |
| 7125 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) |
| 7126 | { |
| 7127 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); |
| 7128 | if (params != IF_DEF_PARAMS (ifp)) |
| 7129 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7130 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7131 | } |
| 7132 | |
| 7133 | /* Hello Interval print. */ |
| 7134 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && |
| 7135 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) |
| 7136 | { |
| 7137 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); |
| 7138 | if (params != IF_DEF_PARAMS (ifp)) |
| 7139 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7140 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7141 | } |
| 7142 | |
| 7143 | |
| 7144 | /* Router Dead Interval print. */ |
| 7145 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && |
| 7146 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) |
| 7147 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7148 | vty_out (vty, " ip ospf dead-interval "); |
| 7149 | |
| 7150 | /* fast hello ? */ |
| 7151 | if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello)) |
| 7152 | vty_out (vty, "minimal hello-multiplier %d", |
| 7153 | params->fast_hello); |
| 7154 | else |
| 7155 | vty_out (vty, "%u", params->v_wait); |
| 7156 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7157 | if (params != IF_DEF_PARAMS (ifp)) |
| 7158 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7159 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7160 | } |
| 7161 | |
| 7162 | /* Router Priority print. */ |
| 7163 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && |
| 7164 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) |
| 7165 | { |
| 7166 | vty_out (vty, " ip ospf priority %u", params->priority); |
| 7167 | if (params != IF_DEF_PARAMS (ifp)) |
| 7168 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7169 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7170 | } |
| 7171 | |
| 7172 | /* Retransmit Interval print. */ |
| 7173 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && |
| 7174 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) |
| 7175 | { |
| 7176 | vty_out (vty, " ip ospf retransmit-interval %u", |
| 7177 | params->retransmit_interval); |
| 7178 | if (params != IF_DEF_PARAMS (ifp)) |
| 7179 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7180 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7181 | } |
| 7182 | |
| 7183 | /* Transmit Delay print. */ |
| 7184 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && |
| 7185 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7186 | { |
| 7187 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); |
| 7188 | if (params != IF_DEF_PARAMS (ifp)) |
| 7189 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7190 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7191 | } |
| 7192 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7193 | /* MTU ignore print. */ |
| 7194 | if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) && |
| 7195 | params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 7196 | { |
| 7197 | if (params->mtu_ignore == 0) |
| 7198 | vty_out (vty, " no ip ospf mtu-ignore"); |
| 7199 | else |
| 7200 | vty_out (vty, " ip ospf mtu-ignore"); |
| 7201 | if (params != IF_DEF_PARAMS (ifp)) |
| 7202 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7203 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7204 | } |
| 7205 | |
| 7206 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7207 | while (1) |
| 7208 | { |
| 7209 | if (rn == NULL) |
| 7210 | rn = route_top (IF_OIFS_PARAMS (ifp)); |
| 7211 | else |
| 7212 | rn = route_next (rn); |
| 7213 | |
| 7214 | if (rn == NULL) |
| 7215 | break; |
| 7216 | params = rn->info; |
| 7217 | if (params != NULL) |
| 7218 | break; |
| 7219 | } |
| 7220 | } while (rn); |
| 7221 | |
| 7222 | #ifdef HAVE_OPAQUE_LSA |
| 7223 | ospf_opaque_config_write_if (vty, ifp); |
| 7224 | #endif /* HAVE_OPAQUE_LSA */ |
| 7225 | } |
| 7226 | |
| 7227 | return write; |
| 7228 | } |
| 7229 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7230 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7231 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7232 | { |
| 7233 | struct route_node *rn; |
| 7234 | u_char buf[INET_ADDRSTRLEN]; |
| 7235 | |
| 7236 | /* `network area' print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7237 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7238 | if (rn->info) |
| 7239 | { |
| 7240 | struct ospf_network *n = rn->info; |
| 7241 | |
| 7242 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7243 | |
| 7244 | /* Create Area ID string by specified Area ID format. */ |
| 7245 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7246 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7247 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7248 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7249 | (unsigned long int) ntohl (n->area_id.s_addr)); |
| 7250 | |
| 7251 | /* Network print. */ |
| 7252 | vty_out (vty, " network %s/%d area %s%s", |
| 7253 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7254 | buf, VTY_NEWLINE); |
| 7255 | } |
| 7256 | |
| 7257 | return 0; |
| 7258 | } |
| 7259 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7260 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7261 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7262 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7263 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7264 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7265 | u_char buf[INET_ADDRSTRLEN]; |
| 7266 | |
| 7267 | /* Area configuration print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7268 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7269 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7270 | struct route_node *rn1; |
| 7271 | |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7272 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7273 | |
| 7274 | if (area->auth_type != OSPF_AUTH_NULL) |
| 7275 | { |
| 7276 | if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 7277 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); |
| 7278 | else |
| 7279 | vty_out (vty, " area %s authentication message-digest%s", |
| 7280 | buf, VTY_NEWLINE); |
| 7281 | } |
| 7282 | |
| 7283 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) |
| 7284 | vty_out (vty, " area %s shortcut %s%s", buf, |
| 7285 | ospf_shortcut_mode_str[area->shortcut_configured], |
| 7286 | VTY_NEWLINE); |
| 7287 | |
| 7288 | if ((area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7289 | || (area->external_routing == OSPF_AREA_NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7290 | ) |
| 7291 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7292 | if (area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7293 | vty_out (vty, " area %s stub", buf); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7294 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 7295 | { |
| 7296 | vty_out (vty, " area %s nssa", buf); |
| 7297 | switch (area->NSSATranslatorRole) |
| 7298 | { |
| 7299 | case OSPF_NSSA_ROLE_NEVER: |
| 7300 | vty_out (vty, " translate-never"); |
| 7301 | break; |
| 7302 | case OSPF_NSSA_ROLE_ALWAYS: |
| 7303 | vty_out (vty, " translate-always"); |
| 7304 | break; |
| 7305 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 7306 | default: |
| 7307 | vty_out (vty, " translate-candidate"); |
| 7308 | } |
| 7309 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7310 | |
| 7311 | if (area->no_summary) |
| 7312 | vty_out (vty, " no-summary"); |
| 7313 | |
| 7314 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7315 | |
| 7316 | if (area->default_cost != 1) |
| 7317 | vty_out (vty, " area %s default-cost %d%s", buf, |
| 7318 | area->default_cost, VTY_NEWLINE); |
| 7319 | } |
| 7320 | |
| 7321 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) |
| 7322 | if (rn1->info) |
| 7323 | { |
| 7324 | struct ospf_area_range *range = rn1->info; |
| 7325 | |
| 7326 | vty_out (vty, " area %s range %s/%d", buf, |
| 7327 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); |
| 7328 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 7329 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7330 | vty_out (vty, " cost %d", range->cost_config); |
| 7331 | |
| 7332 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 7333 | vty_out (vty, " not-advertise"); |
| 7334 | |
| 7335 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 7336 | vty_out (vty, " substitute %s/%d", |
| 7337 | inet_ntoa (range->subst_addr), range->subst_masklen); |
| 7338 | |
| 7339 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7340 | } |
| 7341 | |
| 7342 | if (EXPORT_NAME (area)) |
| 7343 | vty_out (vty, " area %s export-list %s%s", buf, |
| 7344 | EXPORT_NAME (area), VTY_NEWLINE); |
| 7345 | |
| 7346 | if (IMPORT_NAME (area)) |
| 7347 | vty_out (vty, " area %s import-list %s%s", buf, |
| 7348 | IMPORT_NAME (area), VTY_NEWLINE); |
| 7349 | |
| 7350 | if (PREFIX_NAME_IN (area)) |
| 7351 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, |
| 7352 | PREFIX_NAME_IN (area), VTY_NEWLINE); |
| 7353 | |
| 7354 | if (PREFIX_NAME_OUT (area)) |
| 7355 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, |
| 7356 | PREFIX_NAME_OUT (area), VTY_NEWLINE); |
| 7357 | } |
| 7358 | |
| 7359 | return 0; |
| 7360 | } |
| 7361 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7362 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7363 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7364 | { |
| 7365 | struct ospf_nbr_nbma *nbr_nbma; |
| 7366 | struct route_node *rn; |
| 7367 | |
| 7368 | /* Static Neighbor configuration print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7369 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7370 | if ((nbr_nbma = rn->info)) |
| 7371 | { |
| 7372 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); |
| 7373 | |
| 7374 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) |
| 7375 | vty_out (vty, " priority %d", nbr_nbma->priority); |
| 7376 | |
| 7377 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) |
| 7378 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); |
| 7379 | |
| 7380 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7381 | } |
| 7382 | |
| 7383 | return 0; |
| 7384 | } |
| 7385 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7386 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7387 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7388 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7389 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7390 | struct ospf_vl_data *vl_data; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7391 | u_char buf[INET_ADDRSTRLEN]; |
| 7392 | |
| 7393 | /* Virtual-Link print */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7394 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7395 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7396 | struct listnode *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7397 | struct crypt_key *ck; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7398 | struct ospf_interface *oi; |
| 7399 | |
| 7400 | if (vl_data != NULL) |
| 7401 | { |
| 7402 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7403 | |
| 7404 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7405 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7406 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7407 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7408 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
| 7409 | oi = vl_data->vl_oi; |
| 7410 | |
| 7411 | /* timers */ |
| 7412 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || |
| 7413 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || |
| 7414 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || |
| 7415 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7416 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", |
| 7417 | buf, |
| 7418 | inet_ntoa (vl_data->vl_peer), |
| 7419 | OSPF_IF_PARAM (oi, v_hello), |
| 7420 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 7421 | OSPF_IF_PARAM (oi, transmit_delay), |
| 7422 | OSPF_IF_PARAM (oi, v_wait), |
| 7423 | VTY_NEWLINE); |
| 7424 | else |
| 7425 | vty_out (vty, " area %s virtual-link %s%s", buf, |
| 7426 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); |
| 7427 | /* Auth key */ |
| 7428 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') |
| 7429 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", |
| 7430 | buf, |
| 7431 | inet_ntoa (vl_data->vl_peer), |
| 7432 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, |
| 7433 | VTY_NEWLINE); |
| 7434 | /* md5 keys */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7435 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
| 7436 | n2, ck)) |
| 7437 | vty_out (vty, " area %s virtual-link %s" |
| 7438 | " message-digest-key %d md5 %s%s", |
| 7439 | buf, |
| 7440 | inet_ntoa (vl_data->vl_peer), |
| 7441 | ck->key_id, ck->auth_key, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7442 | |
| 7443 | } |
| 7444 | } |
| 7445 | |
| 7446 | return 0; |
| 7447 | } |
| 7448 | |
| 7449 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7450 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7451 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7452 | { |
| 7453 | int type; |
| 7454 | |
| 7455 | /* redistribute print. */ |
| 7456 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
| 7457 | if (type != zclient->redist_default && zclient->redist[type]) |
| 7458 | { |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7459 | vty_out (vty, " redistribute %s", zebra_route_string(type)); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7460 | if (ospf->dmetric[type].value >= 0) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7461 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7462 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7463 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7464 | vty_out (vty, " metric-type 1"); |
| 7465 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7466 | if (ROUTEMAP_NAME (ospf, type)) |
| 7467 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7468 | |
| 7469 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7470 | } |
| 7471 | |
| 7472 | return 0; |
| 7473 | } |
| 7474 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7475 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7476 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7477 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7478 | if (ospf->default_metric != -1) |
| 7479 | vty_out (vty, " default-metric %d%s", ospf->default_metric, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7480 | VTY_NEWLINE); |
| 7481 | return 0; |
| 7482 | } |
| 7483 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7484 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7485 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7486 | { |
| 7487 | int type; |
| 7488 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7489 | if (ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7490 | { |
| 7491 | /* distribute-list print. */ |
| 7492 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7493 | if (ospf->dlist[type].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7494 | vty_out (vty, " distribute-list %s out %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7495 | ospf->dlist[type].name, |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7496 | zebra_route_string(type), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7497 | |
| 7498 | /* default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7499 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7500 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7501 | if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7502 | vty_out (vty, " default-information originate"); |
| 7503 | else |
| 7504 | vty_out (vty, " default-information originate always"); |
| 7505 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7506 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7507 | vty_out (vty, " metric %d", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7508 | ospf->dmetric[DEFAULT_ROUTE].value); |
| 7509 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7510 | vty_out (vty, " metric-type 1"); |
| 7511 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7512 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
| 7513 | vty_out (vty, " route-map %s", |
| 7514 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7515 | |
| 7516 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7517 | } |
| 7518 | |
| 7519 | } |
| 7520 | |
| 7521 | return 0; |
| 7522 | } |
| 7523 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7524 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7525 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7526 | { |
| 7527 | struct route_node *rn; |
| 7528 | struct ospf_distance *odistance; |
| 7529 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7530 | if (ospf->distance_all) |
| 7531 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7532 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7533 | if (ospf->distance_intra |
| 7534 | || ospf->distance_inter |
| 7535 | || ospf->distance_external) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7536 | { |
| 7537 | vty_out (vty, " distance ospf"); |
| 7538 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7539 | if (ospf->distance_intra) |
| 7540 | vty_out (vty, " intra-area %d", ospf->distance_intra); |
| 7541 | if (ospf->distance_inter) |
| 7542 | vty_out (vty, " inter-area %d", ospf->distance_inter); |
| 7543 | if (ospf->distance_external) |
| 7544 | vty_out (vty, " external %d", ospf->distance_external); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7545 | |
| 7546 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7547 | } |
| 7548 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7549 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7550 | if ((odistance = rn->info) != NULL) |
| 7551 | { |
| 7552 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, |
| 7553 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7554 | odistance->access_list ? odistance->access_list : "", |
| 7555 | VTY_NEWLINE); |
| 7556 | } |
| 7557 | return 0; |
| 7558 | } |
| 7559 | |
| 7560 | /* OSPF configuration write function. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7561 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7562 | ospf_config_write (struct vty *vty) |
| 7563 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7564 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7565 | struct interface *ifp; |
| 7566 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7567 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7568 | int write = 0; |
| 7569 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7570 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7571 | if (ospf != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7572 | { |
| 7573 | /* `router ospf' print. */ |
| 7574 | vty_out (vty, "router ospf%s", VTY_NEWLINE); |
| 7575 | |
| 7576 | write++; |
| 7577 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7578 | if (!ospf->networks) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7579 | return write; |
| 7580 | |
| 7581 | /* Router ID print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7582 | if (ospf->router_id_static.s_addr != 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7583 | vty_out (vty, " ospf router-id %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7584 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7585 | |
| 7586 | /* ABR type print. */ |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 7587 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7588 | vty_out (vty, " ospf abr-type %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7589 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7590 | |
| 7591 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7592 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7593 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
| 7594 | |
| 7595 | /* auto-cost reference-bandwidth configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7596 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7597 | { |
| 7598 | vty_out (vty, "! Important: ensure reference bandwidth " |
| 7599 | "is consistent across all routers%s", VTY_NEWLINE); |
| 7600 | vty_out (vty, " auto-cost reference-bandwidth %d%s", |
| 7601 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); |
| 7602 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7603 | |
| 7604 | /* SPF timers print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7605 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
| 7606 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7607 | vty_out (vty, " timers spf %d %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7608 | ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7609 | |
| 7610 | /* SPF refresh parameters print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7611 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7612 | vty_out (vty, " refresh timer %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7613 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7614 | |
| 7615 | /* Redistribute information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7616 | config_write_ospf_redistribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7617 | |
| 7618 | /* passive-interface print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7619 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 7620 | if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE) |
| 7621 | vty_out (vty, " passive-interface %s%s", |
| 7622 | ifp->name, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7623 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7624 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 7625 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) && |
| 7626 | oi->params->passive_interface == OSPF_IF_PASSIVE) |
| 7627 | vty_out (vty, " passive-interface %s %s%s", |
| 7628 | oi->ifp->name, |
| 7629 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7630 | |
| 7631 | /* Network area print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7632 | config_write_network_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7633 | |
| 7634 | /* Area config print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7635 | config_write_ospf_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7636 | |
| 7637 | /* static neighbor print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7638 | config_write_ospf_nbr_nbma (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7639 | |
| 7640 | /* Virtual-Link print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7641 | config_write_virtual_link (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7642 | |
| 7643 | /* Default metric configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7644 | config_write_ospf_default_metric (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7645 | |
| 7646 | /* Distribute-list and default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7647 | config_write_ospf_distribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7648 | |
| 7649 | /* Distance configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7650 | config_write_ospf_distance (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7651 | |
| 7652 | #ifdef HAVE_OPAQUE_LSA |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7653 | ospf_opaque_config_write_router (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7654 | #endif /* HAVE_OPAQUE_LSA */ |
| 7655 | } |
| 7656 | |
| 7657 | return write; |
| 7658 | } |
| 7659 | |
| 7660 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7661 | ospf_vty_show_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7662 | { |
| 7663 | /* "show ip ospf" commands. */ |
| 7664 | install_element (VIEW_NODE, &show_ip_ospf_cmd); |
| 7665 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); |
| 7666 | |
| 7667 | /* "show ip ospf database" commands. */ |
| 7668 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); |
| 7669 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); |
| 7670 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 7671 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 7672 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 7673 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); |
| 7674 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); |
| 7675 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); |
| 7676 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); |
| 7677 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 7678 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 7679 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 7680 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); |
| 7681 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); |
| 7682 | |
| 7683 | /* "show ip ospf interface" commands. */ |
| 7684 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); |
| 7685 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); |
| 7686 | |
| 7687 | /* "show ip ospf neighbor" commands. */ |
| 7688 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 7689 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 7690 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 7691 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 7692 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 7693 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); |
| 7694 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 7695 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 7696 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 7697 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 7698 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 7699 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 7700 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); |
| 7701 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 7702 | |
| 7703 | /* "show ip ospf route" commands. */ |
| 7704 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); |
| 7705 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7706 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
| 7707 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7708 | } |
| 7709 | |
| 7710 | |
| 7711 | /* ospfd's interface node. */ |
| 7712 | struct cmd_node interface_node = |
| 7713 | { |
| 7714 | INTERFACE_NODE, |
| 7715 | "%s(config-if)# ", |
| 7716 | 1 |
| 7717 | }; |
| 7718 | |
| 7719 | /* Initialization of OSPF interface. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7720 | static void |
| 7721 | ospf_vty_if_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7722 | { |
| 7723 | /* Install interface node. */ |
| 7724 | install_node (&interface_node, config_write_interface); |
| 7725 | |
| 7726 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 7727 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7728 | install_default (INTERFACE_NODE); |
| 7729 | |
| 7730 | /* "description" commands. */ |
| 7731 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 7732 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 7733 | |
| 7734 | /* "ip ospf authentication" commands. */ |
| 7735 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); |
| 7736 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); |
| 7737 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); |
| 7738 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); |
| 7739 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); |
| 7740 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); |
| 7741 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); |
| 7742 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); |
| 7743 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); |
| 7744 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); |
| 7745 | |
| 7746 | /* "ip ospf message-digest-key" commands. */ |
| 7747 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); |
| 7748 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); |
| 7749 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); |
| 7750 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); |
| 7751 | |
| 7752 | /* "ip ospf cost" commands. */ |
| 7753 | install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd); |
| 7754 | install_element (INTERFACE_NODE, &ip_ospf_cost_cmd); |
| 7755 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd); |
| 7756 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); |
| 7757 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7758 | /* "ip ospf mtu-ignore" commands. */ |
| 7759 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); |
| 7760 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); |
| 7761 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); |
| 7762 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); |
| 7763 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7764 | /* "ip ospf dead-interval" commands. */ |
| 7765 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); |
| 7766 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7767 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); |
| 7768 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7769 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
| 7770 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7771 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7772 | /* "ip ospf hello-interval" commands. */ |
| 7773 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); |
| 7774 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); |
| 7775 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); |
| 7776 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); |
| 7777 | |
| 7778 | /* "ip ospf network" commands. */ |
| 7779 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); |
| 7780 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); |
| 7781 | |
| 7782 | /* "ip ospf priority" commands. */ |
| 7783 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); |
| 7784 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); |
| 7785 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); |
| 7786 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); |
| 7787 | |
| 7788 | /* "ip ospf retransmit-interval" commands. */ |
| 7789 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); |
| 7790 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); |
| 7791 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); |
| 7792 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); |
| 7793 | |
| 7794 | /* "ip ospf transmit-delay" commands. */ |
| 7795 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); |
| 7796 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); |
| 7797 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); |
| 7798 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); |
| 7799 | |
| 7800 | /* These commands are compatibitliy for previous version. */ |
| 7801 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); |
| 7802 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); |
| 7803 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); |
| 7804 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); |
| 7805 | install_element (INTERFACE_NODE, &ospf_cost_cmd); |
| 7806 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); |
| 7807 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); |
| 7808 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); |
| 7809 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); |
| 7810 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); |
| 7811 | install_element (INTERFACE_NODE, &ospf_network_cmd); |
| 7812 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); |
| 7813 | install_element (INTERFACE_NODE, &ospf_priority_cmd); |
| 7814 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); |
| 7815 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); |
| 7816 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); |
| 7817 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); |
| 7818 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); |
| 7819 | } |
| 7820 | |
| 7821 | /* Zebra node structure. */ |
| 7822 | struct cmd_node zebra_node = |
| 7823 | { |
| 7824 | ZEBRA_NODE, |
| 7825 | "%s(config-router)#", |
| 7826 | }; |
| 7827 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7828 | static void |
| 7829 | ospf_vty_zebra_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7830 | { |
| 7831 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); |
| 7832 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); |
| 7833 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); |
| 7834 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); |
| 7835 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); |
| 7836 | install_element (OSPF_NODE, |
| 7837 | &ospf_redistribute_source_metric_type_routemap_cmd); |
| 7838 | install_element (OSPF_NODE, |
| 7839 | &ospf_redistribute_source_type_metric_routemap_cmd); |
| 7840 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); |
| 7841 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); |
| 7842 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); |
| 7843 | |
| 7844 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); |
| 7845 | |
| 7846 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); |
| 7847 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); |
| 7848 | |
| 7849 | install_element (OSPF_NODE, |
| 7850 | &ospf_default_information_originate_metric_type_cmd); |
| 7851 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); |
| 7852 | install_element (OSPF_NODE, |
| 7853 | &ospf_default_information_originate_type_metric_cmd); |
| 7854 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); |
| 7855 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); |
| 7856 | install_element (OSPF_NODE, |
| 7857 | &ospf_default_information_originate_always_metric_type_cmd); |
| 7858 | install_element (OSPF_NODE, |
| 7859 | &ospf_default_information_originate_always_metric_cmd); |
| 7860 | install_element (OSPF_NODE, |
| 7861 | &ospf_default_information_originate_always_cmd); |
| 7862 | install_element (OSPF_NODE, |
| 7863 | &ospf_default_information_originate_always_type_metric_cmd); |
| 7864 | install_element (OSPF_NODE, |
| 7865 | &ospf_default_information_originate_always_type_cmd); |
| 7866 | |
| 7867 | install_element (OSPF_NODE, |
| 7868 | &ospf_default_information_originate_metric_type_routemap_cmd); |
| 7869 | install_element (OSPF_NODE, |
| 7870 | &ospf_default_information_originate_metric_routemap_cmd); |
| 7871 | install_element (OSPF_NODE, |
| 7872 | &ospf_default_information_originate_routemap_cmd); |
| 7873 | install_element (OSPF_NODE, |
| 7874 | &ospf_default_information_originate_type_metric_routemap_cmd); |
| 7875 | install_element (OSPF_NODE, |
| 7876 | &ospf_default_information_originate_type_routemap_cmd); |
| 7877 | install_element (OSPF_NODE, |
| 7878 | &ospf_default_information_originate_always_metric_type_routemap_cmd); |
| 7879 | install_element (OSPF_NODE, |
| 7880 | &ospf_default_information_originate_always_metric_routemap_cmd); |
| 7881 | install_element (OSPF_NODE, |
| 7882 | &ospf_default_information_originate_always_routemap_cmd); |
| 7883 | install_element (OSPF_NODE, |
| 7884 | &ospf_default_information_originate_always_type_metric_routemap_cmd); |
| 7885 | install_element (OSPF_NODE, |
| 7886 | &ospf_default_information_originate_always_type_routemap_cmd); |
| 7887 | |
| 7888 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); |
| 7889 | |
| 7890 | install_element (OSPF_NODE, &ospf_default_metric_cmd); |
| 7891 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); |
| 7892 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); |
| 7893 | |
| 7894 | install_element (OSPF_NODE, &ospf_distance_cmd); |
| 7895 | install_element (OSPF_NODE, &no_ospf_distance_cmd); |
| 7896 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); |
| 7897 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); |
| 7898 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); |
| 7899 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); |
| 7900 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); |
| 7901 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); |
| 7902 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); |
| 7903 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); |
| 7904 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); |
| 7905 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); |
| 7906 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); |
| 7907 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); |
| 7908 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); |
| 7909 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); |
| 7910 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); |
| 7911 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); |
| 7912 | #if 0 |
| 7913 | install_element (OSPF_NODE, &ospf_distance_source_cmd); |
| 7914 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); |
| 7915 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); |
| 7916 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); |
| 7917 | #endif /* 0 */ |
| 7918 | } |
| 7919 | |
| 7920 | struct cmd_node ospf_node = |
| 7921 | { |
| 7922 | OSPF_NODE, |
| 7923 | "%s(config-router)# ", |
| 7924 | 1 |
| 7925 | }; |
| 7926 | |
| 7927 | |
| 7928 | /* Install OSPF related vty commands. */ |
| 7929 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7930 | ospf_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7931 | { |
| 7932 | /* Install ospf top node. */ |
| 7933 | install_node (&ospf_node, ospf_config_write); |
| 7934 | |
| 7935 | /* "router ospf" commands. */ |
| 7936 | install_element (CONFIG_NODE, &router_ospf_cmd); |
| 7937 | install_element (CONFIG_NODE, &no_router_ospf_cmd); |
| 7938 | |
| 7939 | install_default (OSPF_NODE); |
| 7940 | |
| 7941 | /* "ospf router-id" commands. */ |
| 7942 | install_element (OSPF_NODE, &ospf_router_id_cmd); |
| 7943 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7944 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
| 7945 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7946 | |
| 7947 | /* "passive-interface" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7948 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
| 7949 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); |
| 7950 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); |
| 7951 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7952 | |
| 7953 | /* "ospf abr-type" commands. */ |
| 7954 | install_element (OSPF_NODE, &ospf_abr_type_cmd); |
| 7955 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); |
| 7956 | |
| 7957 | /* "ospf rfc1583-compatible" commands. */ |
| 7958 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); |
| 7959 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); |
| 7960 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); |
| 7961 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); |
| 7962 | |
| 7963 | /* "network area" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7964 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
| 7965 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7966 | |
| 7967 | /* "area authentication" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7968 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
| 7969 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); |
| 7970 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7971 | |
| 7972 | /* "area range" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7973 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
| 7974 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); |
| 7975 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); |
| 7976 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); |
| 7977 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); |
| 7978 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); |
| 7979 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); |
| 7980 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); |
| 7981 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); |
| 7982 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); |
| 7983 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7984 | |
| 7985 | /* "area virtual-link" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7986 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
| 7987 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7988 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7989 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
| 7990 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7991 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7992 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
| 7993 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7994 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7995 | install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); |
| 7996 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7997 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7998 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
| 7999 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8000 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8001 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
| 8002 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); |
| 8003 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8004 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8005 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
| 8006 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8007 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8008 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
| 8009 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8010 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8011 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
| 8012 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); |
| 8013 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8014 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8015 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
| 8016 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); |
| 8017 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8018 | |
| 8019 | /* "area stub" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8020 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
| 8021 | install_element (OSPF_NODE, &ospf_area_stub_cmd); |
| 8022 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); |
| 8023 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8024 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8025 | /* "area nssa" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8026 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
| 8027 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); |
| 8028 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); |
| 8029 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); |
| 8030 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); |
| 8031 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8032 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8033 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
| 8034 | install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8035 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8036 | install_element (OSPF_NODE, &ospf_area_shortcut_cmd); |
| 8037 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8038 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8039 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
| 8040 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8041 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8042 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
| 8043 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8044 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8045 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
| 8046 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8047 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8048 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
| 8049 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame^] | 8050 | install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); |
| 8051 | install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); |
| 8052 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8053 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
| 8054 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); |
| 8055 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8056 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8057 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
| 8058 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8059 | |
| 8060 | /* "neighbor" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8061 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
| 8062 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); |
| 8063 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); |
| 8064 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); |
| 8065 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); |
| 8066 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); |
| 8067 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); |
| 8068 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8069 | |
| 8070 | /* Init interface related vty commands. */ |
| 8071 | ospf_vty_if_init (); |
| 8072 | |
| 8073 | /* Init zebra related vty commands. */ |
| 8074 | ospf_vty_zebra_init (); |
| 8075 | } |