paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* OSPF VTY interface. |
| 2 | * Copyright (C) 2000 Toshiaki Takada |
| 3 | * |
| 4 | * This file is part of GNU Zebra. |
| 5 | * |
| 6 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 7 | * under the terms of the GNU General Public License as published by the |
| 8 | * Free Software Foundation; either version 2, or (at your option) any |
| 9 | * later version. |
| 10 | * |
| 11 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 12 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 13 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 14 | * General Public License for more details. |
| 15 | * |
| 16 | * You should have received a copy of the GNU General Public License |
| 17 | * along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 18 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 19 | * 02111-1307, USA. |
| 20 | */ |
| 21 | |
| 22 | #include <zebra.h> |
| 23 | |
| 24 | #include "memory.h" |
| 25 | #include "thread.h" |
| 26 | #include "prefix.h" |
| 27 | #include "table.h" |
| 28 | #include "vty.h" |
| 29 | #include "command.h" |
| 30 | #include "plist.h" |
| 31 | #include "log.h" |
| 32 | #include "zclient.h" |
| 33 | |
| 34 | #include "ospfd/ospfd.h" |
| 35 | #include "ospfd/ospf_asbr.h" |
| 36 | #include "ospfd/ospf_lsa.h" |
| 37 | #include "ospfd/ospf_lsdb.h" |
| 38 | #include "ospfd/ospf_ism.h" |
| 39 | #include "ospfd/ospf_interface.h" |
| 40 | #include "ospfd/ospf_nsm.h" |
| 41 | #include "ospfd/ospf_neighbor.h" |
| 42 | #include "ospfd/ospf_flood.h" |
| 43 | #include "ospfd/ospf_abr.h" |
| 44 | #include "ospfd/ospf_spf.h" |
| 45 | #include "ospfd/ospf_route.h" |
| 46 | #include "ospfd/ospf_zebra.h" |
| 47 | /*#include "ospfd/ospf_routemap.h" */ |
| 48 | #include "ospfd/ospf_vty.h" |
| 49 | #include "ospfd/ospf_dump.h" |
| 50 | |
| 51 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 52 | const static char *ospf_network_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 53 | { |
| 54 | "Null", |
| 55 | "POINTOPOINT", |
| 56 | "BROADCAST", |
| 57 | "NBMA", |
| 58 | "POINTOMULTIPOINT", |
| 59 | "VIRTUALLINK", |
| 60 | "LOOPBACK" |
| 61 | }; |
| 62 | |
| 63 | |
| 64 | /* Utility functions. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 65 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 66 | ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 67 | { |
| 68 | char *endptr = NULL; |
| 69 | unsigned long ret; |
| 70 | |
| 71 | /* match "A.B.C.D". */ |
| 72 | if (strchr (str, '.') != NULL) |
| 73 | { |
| 74 | ret = inet_aton (str, area_id); |
| 75 | if (!ret) |
| 76 | return -1; |
| 77 | *format = OSPF_AREA_ID_FORMAT_ADDRESS; |
| 78 | } |
| 79 | /* match "<0-4294967295>". */ |
| 80 | else |
| 81 | { |
| 82 | ret = strtoul (str, &endptr, 10); |
| 83 | if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE)) |
| 84 | return -1; |
| 85 | |
| 86 | area_id->s_addr = htonl (ret); |
| 87 | *format = OSPF_AREA_ID_FORMAT_DECIMAL; |
| 88 | } |
| 89 | |
| 90 | return 0; |
| 91 | } |
| 92 | |
| 93 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 94 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 95 | str2distribute_source (const char *str, int *source) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 96 | { |
| 97 | /* Sanity check. */ |
| 98 | if (str == NULL) |
| 99 | return 0; |
| 100 | |
| 101 | if (strncmp (str, "k", 1) == 0) |
| 102 | *source = ZEBRA_ROUTE_KERNEL; |
| 103 | else if (strncmp (str, "c", 1) == 0) |
| 104 | *source = ZEBRA_ROUTE_CONNECT; |
| 105 | else if (strncmp (str, "s", 1) == 0) |
| 106 | *source = ZEBRA_ROUTE_STATIC; |
| 107 | else if (strncmp (str, "r", 1) == 0) |
| 108 | *source = ZEBRA_ROUTE_RIP; |
| 109 | else if (strncmp (str, "b", 1) == 0) |
| 110 | *source = ZEBRA_ROUTE_BGP; |
| 111 | else |
| 112 | return 0; |
| 113 | |
| 114 | return 1; |
| 115 | } |
| 116 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 117 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 118 | str2metric (const char *str, int *metric) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 119 | { |
| 120 | /* Sanity check. */ |
| 121 | if (str == NULL) |
| 122 | return 0; |
| 123 | |
| 124 | *metric = strtol (str, NULL, 10); |
| 125 | if (*metric < 0 && *metric > 16777214) |
| 126 | { |
| 127 | /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */ |
| 128 | return 0; |
| 129 | } |
| 130 | |
| 131 | return 1; |
| 132 | } |
| 133 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 134 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 135 | str2metric_type (const char *str, int *metric_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 136 | { |
| 137 | /* Sanity check. */ |
| 138 | if (str == NULL) |
| 139 | return 0; |
| 140 | |
| 141 | if (strncmp (str, "1", 1) == 0) |
| 142 | *metric_type = EXTERNAL_METRIC_TYPE_1; |
| 143 | else if (strncmp (str, "2", 1) == 0) |
| 144 | *metric_type = EXTERNAL_METRIC_TYPE_2; |
| 145 | else |
| 146 | return 0; |
| 147 | |
| 148 | return 1; |
| 149 | } |
| 150 | |
| 151 | int |
| 152 | ospf_oi_count (struct interface *ifp) |
| 153 | { |
| 154 | struct route_node *rn; |
| 155 | int i = 0; |
| 156 | |
| 157 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 158 | if (rn->info) |
| 159 | i++; |
| 160 | |
| 161 | return i; |
| 162 | } |
| 163 | |
| 164 | |
| 165 | DEFUN (router_ospf, |
| 166 | router_ospf_cmd, |
| 167 | "router ospf", |
| 168 | "Enable a routing process\n" |
| 169 | "Start OSPF configuration\n") |
| 170 | { |
| 171 | vty->node = OSPF_NODE; |
| 172 | vty->index = ospf_get (); |
| 173 | |
| 174 | return CMD_SUCCESS; |
| 175 | } |
| 176 | |
| 177 | DEFUN (no_router_ospf, |
| 178 | no_router_ospf_cmd, |
| 179 | "no router ospf", |
| 180 | NO_STR |
| 181 | "Enable a routing process\n" |
| 182 | "Start OSPF configuration\n") |
| 183 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 184 | struct ospf *ospf; |
| 185 | |
| 186 | ospf = ospf_lookup (); |
| 187 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 188 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 189 | vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 190 | return CMD_WARNING; |
| 191 | } |
| 192 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 193 | ospf_finish (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 194 | |
| 195 | return CMD_SUCCESS; |
| 196 | } |
| 197 | |
| 198 | DEFUN (ospf_router_id, |
| 199 | ospf_router_id_cmd, |
| 200 | "ospf router-id A.B.C.D", |
| 201 | "OSPF specific commands\n" |
| 202 | "router-id for the OSPF process\n" |
| 203 | "OSPF router-id in IP address format\n") |
| 204 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 205 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 206 | struct in_addr router_id; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 207 | int ret; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 208 | |
| 209 | ret = inet_aton (argv[0], &router_id); |
| 210 | if (!ret) |
| 211 | { |
| 212 | vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); |
| 213 | return CMD_WARNING; |
| 214 | } |
| 215 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 216 | ospf->router_id_static = router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 217 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 218 | if (ospf->t_router_id_update == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 219 | OSPF_TIMER_ON (ospf->t_router_id_update, ospf_router_id_update_timer, |
| 220 | OSPF_ROUTER_ID_UPDATE_DELAY); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 221 | |
| 222 | return CMD_SUCCESS; |
| 223 | } |
| 224 | |
| 225 | ALIAS (ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 226 | router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 227 | "router-id A.B.C.D", |
| 228 | "router-id for the OSPF process\n" |
| 229 | "OSPF router-id in IP address format\n") |
| 230 | |
| 231 | DEFUN (no_ospf_router_id, |
| 232 | no_ospf_router_id_cmd, |
| 233 | "no ospf router-id", |
| 234 | NO_STR |
| 235 | "OSPF specific commands\n" |
| 236 | "router-id for the OSPF process\n") |
| 237 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 238 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 239 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 240 | ospf->router_id_static.s_addr = 0; |
| 241 | |
| 242 | ospf_router_id_update (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 243 | |
| 244 | return CMD_SUCCESS; |
| 245 | } |
| 246 | |
| 247 | ALIAS (no_ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 248 | no_router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 249 | "no router-id", |
| 250 | NO_STR |
| 251 | "router-id for the OSPF process\n") |
| 252 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 253 | DEFUN (ospf_passive_interface, |
| 254 | ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 255 | "passive-interface IFNAME A.B.C.D", |
| 256 | "Suppress routing updates on an interface\n" |
| 257 | "Interface's name\n") |
| 258 | { |
| 259 | struct interface *ifp; |
| 260 | struct in_addr addr; |
| 261 | int ret; |
| 262 | struct ospf_if_params *params; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 263 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 264 | |
| 265 | ifp = if_lookup_by_name (argv[0]); |
| 266 | |
| 267 | if (ifp == NULL) |
| 268 | { |
| 269 | vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE); |
| 270 | return CMD_WARNING; |
| 271 | } |
| 272 | |
| 273 | params = IF_DEF_PARAMS (ifp); |
| 274 | |
| 275 | if (argc == 2) |
| 276 | { |
| 277 | ret = inet_aton(argv[1], &addr); |
| 278 | if (!ret) |
| 279 | { |
| 280 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 281 | VTY_NEWLINE); |
| 282 | return CMD_WARNING; |
| 283 | } |
| 284 | |
| 285 | params = ospf_get_if_params (ifp, addr); |
| 286 | ospf_if_update_params (ifp, addr); |
| 287 | } |
| 288 | |
| 289 | SET_IF_PARAM (params, passive_interface); |
| 290 | params->passive_interface = OSPF_IF_PASSIVE; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 291 | |
| 292 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 293 | * interfaces for which the passive property changed. It is too much |
| 294 | * work to determine this set, so we do this for every interface. |
| 295 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 296 | * record of joined groups to avoid systems calls if the desired |
| 297 | * memberships match the current memership. |
| 298 | */ |
| 299 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 300 | { |
| 301 | struct ospf_interface *oi = rn->info; |
| 302 | |
| 303 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) |
| 304 | ospf_if_set_multicast(oi); |
| 305 | } |
| 306 | /* |
| 307 | * XXX It is not clear what state transitions the interface needs to |
| 308 | * undergo when going from active to passive. Fixing this will |
| 309 | * require precise identification of interfaces having such a |
| 310 | * transition. |
| 311 | */ |
| 312 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 313 | return CMD_SUCCESS; |
| 314 | } |
| 315 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 316 | ALIAS (ospf_passive_interface, |
| 317 | ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 318 | "passive-interface IFNAME", |
| 319 | "Suppress routing updates on an interface\n" |
| 320 | "Interface's name\n") |
| 321 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 322 | DEFUN (no_ospf_passive_interface, |
| 323 | no_ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 324 | "no passive-interface IFNAME A.B.C.D", |
| 325 | NO_STR |
| 326 | "Allow routing updates on an interface\n" |
| 327 | "Interface's name\n") |
| 328 | { |
| 329 | struct interface *ifp; |
| 330 | struct in_addr addr; |
| 331 | struct ospf_if_params *params; |
| 332 | int ret; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 333 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 334 | |
| 335 | ifp = if_lookup_by_name (argv[0]); |
| 336 | |
| 337 | if (ifp == NULL) |
| 338 | { |
| 339 | vty_out (vty, "Please specify an existing interface%s", VTY_NEWLINE); |
| 340 | return CMD_WARNING; |
| 341 | } |
| 342 | |
| 343 | params = IF_DEF_PARAMS (ifp); |
| 344 | |
| 345 | if (argc == 2) |
| 346 | { |
| 347 | ret = inet_aton(argv[1], &addr); |
| 348 | if (!ret) |
| 349 | { |
| 350 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 351 | VTY_NEWLINE); |
| 352 | return CMD_WARNING; |
| 353 | } |
| 354 | |
| 355 | params = ospf_lookup_if_params (ifp, addr); |
| 356 | if (params == NULL) |
| 357 | return CMD_SUCCESS; |
| 358 | } |
| 359 | |
| 360 | UNSET_IF_PARAM (params, passive_interface); |
| 361 | params->passive_interface = OSPF_IF_ACTIVE; |
| 362 | |
| 363 | if (params != IF_DEF_PARAMS (ifp)) |
| 364 | { |
| 365 | ospf_free_if_params (ifp, addr); |
| 366 | ospf_if_update_params (ifp, addr); |
| 367 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 368 | |
| 369 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 370 | * interfaces for which the passive property changed. It is too much |
| 371 | * work to determine this set, so we do this for every interface. |
| 372 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 373 | * record of joined groups to avoid systems calls if the desired |
| 374 | * memberships match the current memership. |
| 375 | */ |
| 376 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 377 | { |
| 378 | struct ospf_interface *oi = rn->info; |
| 379 | |
| 380 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE)) |
| 381 | ospf_if_set_multicast(oi); |
| 382 | } |
| 383 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 384 | return CMD_SUCCESS; |
| 385 | } |
| 386 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 387 | ALIAS (no_ospf_passive_interface, |
| 388 | no_ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 389 | "no passive-interface IFNAME", |
| 390 | NO_STR |
| 391 | "Allow routing updates on an interface\n" |
| 392 | "Interface's name\n") |
| 393 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 394 | DEFUN (ospf_network_area, |
| 395 | ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 396 | "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 397 | "Enable routing on an IP network\n" |
| 398 | "OSPF network prefix\n" |
| 399 | "Set the OSPF area ID\n" |
| 400 | "OSPF area ID in IP address format\n" |
| 401 | "OSPF area ID as a decimal value\n") |
| 402 | { |
| 403 | struct ospf *ospf= vty->index; |
| 404 | struct prefix_ipv4 p; |
| 405 | struct in_addr area_id; |
| 406 | int ret, format; |
| 407 | |
| 408 | /* Get network prefix and Area ID. */ |
| 409 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 410 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 411 | |
| 412 | ret = ospf_network_set (ospf, &p, area_id); |
| 413 | if (ret == 0) |
| 414 | { |
| 415 | vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); |
| 416 | return CMD_WARNING; |
| 417 | } |
| 418 | |
| 419 | return CMD_SUCCESS; |
| 420 | } |
| 421 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 422 | DEFUN (no_ospf_network_area, |
| 423 | no_ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 424 | "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 425 | NO_STR |
| 426 | "Enable routing on an IP network\n" |
| 427 | "OSPF network prefix\n" |
| 428 | "Set the OSPF area ID\n" |
| 429 | "OSPF area ID in IP address format\n" |
| 430 | "OSPF area ID as a decimal value\n") |
| 431 | { |
| 432 | struct ospf *ospf = (struct ospf *) vty->index; |
| 433 | struct prefix_ipv4 p; |
| 434 | struct in_addr area_id; |
| 435 | int ret, format; |
| 436 | |
| 437 | /* Get network prefix and Area ID. */ |
| 438 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 439 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 440 | |
| 441 | ret = ospf_network_unset (ospf, &p, area_id); |
| 442 | if (ret == 0) |
| 443 | { |
| 444 | vty_out (vty, "Can't find specified network area configuration.%s", |
| 445 | VTY_NEWLINE); |
| 446 | return CMD_WARNING; |
| 447 | } |
| 448 | |
| 449 | return CMD_SUCCESS; |
| 450 | } |
| 451 | |
| 452 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 453 | DEFUN (ospf_area_range, |
| 454 | ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 455 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 456 | "OSPF area parameters\n" |
| 457 | "OSPF area ID in IP address format\n" |
| 458 | "OSPF area ID as a decimal value\n" |
| 459 | "Summarize routes matching address/mask (border routers only)\n" |
| 460 | "Area range prefix\n") |
| 461 | { |
| 462 | struct ospf *ospf = vty->index; |
| 463 | struct prefix_ipv4 p; |
| 464 | struct in_addr area_id; |
| 465 | int format; |
| 466 | u_int32_t cost; |
| 467 | |
| 468 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 469 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 470 | |
| 471 | ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); |
| 472 | if (argc > 2) |
| 473 | { |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 474 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 475 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
| 476 | } |
| 477 | |
| 478 | return CMD_SUCCESS; |
| 479 | } |
| 480 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 481 | ALIAS (ospf_area_range, |
| 482 | ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 483 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", |
| 484 | "OSPF area parameters\n" |
| 485 | "OSPF area ID in IP address format\n" |
| 486 | "OSPF area ID as a decimal value\n" |
| 487 | "OSPF area range for route advertise (default)\n" |
| 488 | "Area range prefix\n" |
| 489 | "Advertise this range (default)\n") |
| 490 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 491 | ALIAS (ospf_area_range, |
| 492 | ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 493 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 494 | "OSPF area parameters\n" |
| 495 | "OSPF area ID in IP address format\n" |
| 496 | "OSPF area ID as a decimal value\n" |
| 497 | "Summarize routes matching address/mask (border routers only)\n" |
| 498 | "Area range prefix\n" |
| 499 | "User specified metric for this range\n" |
| 500 | "Advertised metric for this range\n") |
| 501 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 502 | ALIAS (ospf_area_range, |
| 503 | ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 504 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 505 | "OSPF area parameters\n" |
| 506 | "OSPF area ID in IP address format\n" |
| 507 | "OSPF area ID as a decimal value\n" |
| 508 | "Summarize routes matching address/mask (border routers only)\n" |
| 509 | "Area range prefix\n" |
| 510 | "Advertise this range (default)\n" |
| 511 | "User specified metric for this range\n" |
| 512 | "Advertised metric for this range\n") |
| 513 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 514 | DEFUN (ospf_area_range_not_advertise, |
| 515 | ospf_area_range_not_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 516 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise", |
| 517 | "OSPF area parameters\n" |
| 518 | "OSPF area ID in IP address format\n" |
| 519 | "OSPF area ID as a decimal value\n" |
| 520 | "Summarize routes matching address/mask (border routers only)\n" |
| 521 | "Area range prefix\n" |
| 522 | "DoNotAdvertise this range\n") |
| 523 | { |
| 524 | struct ospf *ospf = vty->index; |
| 525 | struct prefix_ipv4 p; |
| 526 | struct in_addr area_id; |
| 527 | int format; |
| 528 | |
| 529 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 530 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 531 | |
| 532 | ospf_area_range_set (ospf, area_id, &p, 0); |
| 533 | |
| 534 | return CMD_SUCCESS; |
| 535 | } |
| 536 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 537 | DEFUN (no_ospf_area_range, |
| 538 | no_ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 539 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 540 | NO_STR |
| 541 | "OSPF area parameters\n" |
| 542 | "OSPF area ID in IP address format\n" |
| 543 | "OSPF area ID as a decimal value\n" |
| 544 | "Summarize routes matching address/mask (border routers only)\n" |
| 545 | "Area range prefix\n") |
| 546 | { |
| 547 | struct ospf *ospf = vty->index; |
| 548 | struct prefix_ipv4 p; |
| 549 | struct in_addr area_id; |
| 550 | int format; |
| 551 | |
| 552 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 553 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 554 | |
| 555 | ospf_area_range_unset (ospf, area_id, &p); |
| 556 | |
| 557 | return CMD_SUCCESS; |
| 558 | } |
| 559 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 560 | ALIAS (no_ospf_area_range, |
| 561 | no_ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 562 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", |
| 563 | NO_STR |
| 564 | "OSPF area parameters\n" |
| 565 | "OSPF area ID in IP address format\n" |
| 566 | "OSPF area ID as a decimal value\n" |
| 567 | "Summarize routes matching address/mask (border routers only)\n" |
| 568 | "Area range prefix\n" |
| 569 | "Advertise this range (default)\n" |
| 570 | "DoNotAdvertise this range\n") |
| 571 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 572 | ALIAS (no_ospf_area_range, |
| 573 | no_ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 574 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 575 | NO_STR |
| 576 | "OSPF area parameters\n" |
| 577 | "OSPF area ID in IP address format\n" |
| 578 | "OSPF area ID as a decimal value\n" |
| 579 | "Summarize routes matching address/mask (border routers only)\n" |
| 580 | "Area range prefix\n" |
| 581 | "User specified metric for this range\n" |
| 582 | "Advertised metric for this range\n") |
| 583 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 584 | ALIAS (no_ospf_area_range, |
| 585 | no_ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 586 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 587 | NO_STR |
| 588 | "OSPF area parameters\n" |
| 589 | "OSPF area ID in IP address format\n" |
| 590 | "OSPF area ID as a decimal value\n" |
| 591 | "Summarize routes matching address/mask (border routers only)\n" |
| 592 | "Area range prefix\n" |
| 593 | "Advertise this range (default)\n" |
| 594 | "User specified metric for this range\n" |
| 595 | "Advertised metric for this range\n") |
| 596 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 597 | DEFUN (ospf_area_range_substitute, |
| 598 | ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 599 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 600 | "OSPF area parameters\n" |
| 601 | "OSPF area ID in IP address format\n" |
| 602 | "OSPF area ID as a decimal value\n" |
| 603 | "Summarize routes matching address/mask (border routers only)\n" |
| 604 | "Area range prefix\n" |
| 605 | "Announce area range as another prefix\n" |
| 606 | "Network prefix to be announced instead of range\n") |
| 607 | { |
| 608 | struct ospf *ospf = vty->index; |
| 609 | struct prefix_ipv4 p, s; |
| 610 | struct in_addr area_id; |
| 611 | int format; |
| 612 | |
| 613 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 614 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 615 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 616 | |
| 617 | ospf_area_range_substitute_set (ospf, area_id, &p, &s); |
| 618 | |
| 619 | return CMD_SUCCESS; |
| 620 | } |
| 621 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 622 | DEFUN (no_ospf_area_range_substitute, |
| 623 | no_ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 624 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 625 | NO_STR |
| 626 | "OSPF area parameters\n" |
| 627 | "OSPF area ID in IP address format\n" |
| 628 | "OSPF area ID as a decimal value\n" |
| 629 | "Summarize routes matching address/mask (border routers only)\n" |
| 630 | "Area range prefix\n" |
| 631 | "Announce area range as another prefix\n" |
| 632 | "Network prefix to be announced instead of range\n") |
| 633 | { |
| 634 | struct ospf *ospf = vty->index; |
| 635 | struct prefix_ipv4 p, s; |
| 636 | struct in_addr area_id; |
| 637 | int format; |
| 638 | |
| 639 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 640 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 641 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 642 | |
| 643 | ospf_area_range_substitute_unset (ospf, area_id, &p); |
| 644 | |
| 645 | return CMD_SUCCESS; |
| 646 | } |
| 647 | |
| 648 | |
| 649 | /* Command Handler Logic in VLink stuff is delicate!! |
| 650 | |
| 651 | ALTER AT YOUR OWN RISK!!!! |
| 652 | |
| 653 | Various dummy values are used to represent 'NoChange' state for |
| 654 | VLink configuration NOT being changed by a VLink command, and |
| 655 | special syntax is used within the command strings so that the |
| 656 | typed in command verbs can be seen in the configuration command |
| 657 | bacckend handler. This is to drastically reduce the verbeage |
| 658 | required to coe up with a reasonably compatible Cisco VLink command |
| 659 | |
| 660 | - Matthew Grant <grantma@anathoth.gen.nz> |
| 661 | Wed, 21 Feb 2001 15:13:52 +1300 |
| 662 | */ |
| 663 | |
| 664 | |
| 665 | /* Configuration data for virtual links |
| 666 | */ |
| 667 | struct ospf_vl_config_data { |
| 668 | struct vty *vty; /* vty stuff */ |
| 669 | struct in_addr area_id; /* area ID from command line */ |
| 670 | int format; /* command line area ID format */ |
| 671 | struct in_addr vl_peer; /* command line vl_peer */ |
| 672 | int auth_type; /* Authehntication type, if given */ |
| 673 | char *auth_key; /* simple password if present */ |
| 674 | int crypto_key_id; /* Cryptographic key ID */ |
| 675 | char *md5_key; /* MD5 authentication key */ |
| 676 | int hello_interval; /* Obvious what these are... */ |
| 677 | int retransmit_interval; |
| 678 | int transmit_delay; |
| 679 | int dead_interval; |
| 680 | }; |
| 681 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 682 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 683 | ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, |
| 684 | struct vty *vty) |
| 685 | { |
| 686 | memset (vl_config, 0, sizeof (struct ospf_vl_config_data)); |
| 687 | vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN; |
| 688 | vl_config->vty = vty; |
| 689 | } |
| 690 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 691 | static struct ospf_vl_data * |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 692 | 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] | 693 | { |
| 694 | struct ospf_area *area; |
| 695 | struct ospf_vl_data *vl_data; |
| 696 | struct vty *vty; |
| 697 | struct in_addr area_id; |
| 698 | |
| 699 | vty = vl_config->vty; |
| 700 | area_id = vl_config->area_id; |
| 701 | |
| 702 | if (area_id.s_addr == OSPF_AREA_BACKBONE) |
| 703 | { |
| 704 | vty_out (vty, |
| 705 | "Configuring VLs over the backbone is not allowed%s", |
| 706 | VTY_NEWLINE); |
| 707 | return NULL; |
| 708 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 709 | area = ospf_area_get (ospf, area_id, vl_config->format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 710 | |
| 711 | if (area->external_routing != OSPF_AREA_DEFAULT) |
| 712 | { |
| 713 | if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 714 | vty_out (vty, "Area %s is %s%s", |
| 715 | inet_ntoa (area_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 716 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 717 | VTY_NEWLINE); |
| 718 | else |
| 719 | vty_out (vty, "Area %ld is %s%s", |
| 720 | (u_long)ntohl (area_id.s_addr), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 721 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 722 | VTY_NEWLINE); |
| 723 | return NULL; |
| 724 | } |
| 725 | |
| 726 | if ((vl_data = ospf_vl_lookup (area, vl_config->vl_peer)) == NULL) |
| 727 | { |
| 728 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); |
| 729 | if (vl_data->vl_oi == NULL) |
| 730 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 731 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
| 732 | ospf_vl_add (ospf, vl_data); |
| 733 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 734 | } |
| 735 | } |
| 736 | return vl_data; |
| 737 | } |
| 738 | |
| 739 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 740 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 741 | ospf_vl_set_security (struct ospf_vl_data *vl_data, |
| 742 | struct ospf_vl_config_data *vl_config) |
| 743 | { |
| 744 | struct crypt_key *ck; |
| 745 | struct vty *vty; |
| 746 | struct interface *ifp = vl_data->vl_oi->ifp; |
| 747 | |
| 748 | vty = vl_config->vty; |
| 749 | |
| 750 | if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN) |
| 751 | { |
| 752 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); |
| 753 | IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type; |
| 754 | } |
| 755 | |
| 756 | if (vl_config->auth_key) |
| 757 | { |
| 758 | memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 759 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 760 | OSPF_AUTH_SIMPLE_SIZE); |
| 761 | } |
| 762 | else if (vl_config->md5_key) |
| 763 | { |
| 764 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id) |
| 765 | != NULL) |
| 766 | { |
| 767 | vty_out (vty, "OSPF: Key %d already exists%s", |
| 768 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 769 | return CMD_WARNING; |
| 770 | } |
| 771 | ck = ospf_crypt_key_new (); |
| 772 | ck->key_id = vl_config->crypto_key_id; |
| 773 | memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 774 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 775 | |
| 776 | ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); |
| 777 | } |
| 778 | else if (vl_config->crypto_key_id != 0) |
| 779 | { |
| 780 | /* Delete a key */ |
| 781 | |
| 782 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, |
| 783 | vl_config->crypto_key_id) == NULL) |
| 784 | { |
| 785 | vty_out (vty, "OSPF: Key %d does not exist%s", |
| 786 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 787 | return CMD_WARNING; |
| 788 | } |
| 789 | |
| 790 | ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id); |
| 791 | |
| 792 | } |
| 793 | |
| 794 | return CMD_SUCCESS; |
| 795 | } |
| 796 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 797 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 798 | ospf_vl_set_timers (struct ospf_vl_data *vl_data, |
| 799 | struct ospf_vl_config_data *vl_config) |
| 800 | { |
| 801 | struct interface *ifp = ifp = vl_data->vl_oi->ifp; |
| 802 | /* Virtual Link data initialised to defaults, so only set |
| 803 | if a value given */ |
| 804 | if (vl_config->hello_interval) |
| 805 | { |
| 806 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); |
| 807 | IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval; |
| 808 | } |
| 809 | |
| 810 | if (vl_config->dead_interval) |
| 811 | { |
| 812 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait); |
| 813 | IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval; |
| 814 | } |
| 815 | |
| 816 | if (vl_config->retransmit_interval) |
| 817 | { |
| 818 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval); |
| 819 | IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval; |
| 820 | } |
| 821 | |
| 822 | if (vl_config->transmit_delay) |
| 823 | { |
| 824 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay); |
| 825 | IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay; |
| 826 | } |
| 827 | |
| 828 | return CMD_SUCCESS; |
| 829 | } |
| 830 | |
| 831 | |
| 832 | |
| 833 | /* The business end of all of the above */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 834 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 835 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 836 | { |
| 837 | struct ospf_vl_data *vl_data; |
| 838 | int ret; |
| 839 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 840 | vl_data = ospf_find_vl_data (ospf, vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 841 | if (!vl_data) |
| 842 | return CMD_WARNING; |
| 843 | |
| 844 | /* Process this one first as it can have a fatal result, which can |
| 845 | only logically occur if the virtual link exists already |
| 846 | Thus a command error does not result in a change to the |
| 847 | running configuration such as unexpectedly altered timer |
| 848 | values etc.*/ |
| 849 | ret = ospf_vl_set_security (vl_data, vl_config); |
| 850 | if (ret != CMD_SUCCESS) |
| 851 | return ret; |
| 852 | |
| 853 | /* Set any time based parameters, these area already range checked */ |
| 854 | |
| 855 | ret = ospf_vl_set_timers (vl_data, vl_config); |
| 856 | if (ret != CMD_SUCCESS) |
| 857 | return ret; |
| 858 | |
| 859 | return CMD_SUCCESS; |
| 860 | |
| 861 | } |
| 862 | |
| 863 | /* This stuff exists to make specifying all the alias commands A LOT simpler |
| 864 | */ |
| 865 | #define VLINK_HELPSTR_IPADDR \ |
| 866 | "OSPF area parameters\n" \ |
| 867 | "OSPF area ID in IP address format\n" \ |
| 868 | "OSPF area ID as a decimal value\n" \ |
| 869 | "Configure a virtual link\n" \ |
| 870 | "Router ID of the remote ABR\n" |
| 871 | |
| 872 | #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 873 | "Enable authentication on this virtual link\n" \ |
| 874 | "dummy string \n" |
| 875 | |
| 876 | #define VLINK_HELPSTR_AUTHTYPE_ALL \ |
| 877 | VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 878 | "Use null authentication\n" \ |
| 879 | "Use message-digest authentication\n" |
| 880 | |
| 881 | #define VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 882 | "Time between HELLO packets\n" \ |
| 883 | "Time between retransmitting lost link state advertisements\n" \ |
| 884 | "Link state transmit delay\n" \ |
| 885 | "Interval after which a neighbor is declared dead\n" |
| 886 | |
| 887 | #define VLINK_HELPSTR_TIME_PARAM \ |
| 888 | VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 889 | "Seconds\n" |
| 890 | |
| 891 | #define VLINK_HELPSTR_AUTH_SIMPLE \ |
| 892 | "Authentication password (key)\n" \ |
| 893 | "The OSPF password (key)" |
| 894 | |
| 895 | #define VLINK_HELPSTR_AUTH_MD5 \ |
| 896 | "Message digest authentication password (key)\n" \ |
| 897 | "dummy string \n" \ |
| 898 | "Key ID\n" \ |
| 899 | "Use MD5 algorithm\n" \ |
| 900 | "The OSPF password (key)" |
| 901 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 902 | DEFUN (ospf_area_vlink, |
| 903 | ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 904 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 905 | VLINK_HELPSTR_IPADDR) |
| 906 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 907 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 908 | struct ospf_vl_config_data vl_config; |
| 909 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 910 | char md5_key[OSPF_AUTH_MD5_SIZE+1]; |
| 911 | int i; |
| 912 | int ret; |
| 913 | |
| 914 | ospf_vl_config_data_init(&vl_config, vty); |
| 915 | |
| 916 | /* Read off first 2 parameters and check them */ |
| 917 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); |
| 918 | if (ret < 0) |
| 919 | { |
| 920 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 921 | return CMD_WARNING; |
| 922 | } |
| 923 | |
| 924 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 925 | if (! ret) |
| 926 | { |
| 927 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 928 | VTY_NEWLINE); |
| 929 | return CMD_WARNING; |
| 930 | } |
| 931 | |
| 932 | if (argc <=2) |
| 933 | { |
| 934 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 935 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 936 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 937 | } |
| 938 | |
| 939 | /* Deal with other parameters */ |
| 940 | for (i=2; i < argc; i++) |
| 941 | { |
| 942 | |
| 943 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 944 | |
| 945 | switch (argv[i][0]) |
| 946 | { |
| 947 | |
| 948 | case 'a': |
| 949 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 950 | { |
| 951 | /* authentication-key - this option can occur anywhere on |
| 952 | command line. At start of command line |
| 953 | must check for authentication option. */ |
| 954 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 955 | strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); |
| 956 | vl_config.auth_key = auth_key; |
| 957 | i++; |
| 958 | } |
| 959 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 960 | { |
| 961 | /* authentication - this option can only occur at start |
| 962 | of command line */ |
| 963 | vl_config.auth_type = OSPF_AUTH_SIMPLE; |
| 964 | if ((i+1) < argc) |
| 965 | { |
| 966 | if (strncmp (argv[i+1], "n", 1) == 0) |
| 967 | { |
| 968 | /* "authentication null" */ |
| 969 | vl_config.auth_type = OSPF_AUTH_NULL; |
| 970 | i++; |
| 971 | } |
| 972 | else if (strncmp (argv[i+1], "m", 1) == 0 |
| 973 | && strcmp (argv[i+1], "message-digest-") != 0) |
| 974 | { |
| 975 | /* "authentication message-digest" */ |
| 976 | vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 977 | i++; |
| 978 | } |
| 979 | } |
| 980 | } |
| 981 | break; |
| 982 | |
| 983 | case 'm': |
| 984 | /* message-digest-key */ |
| 985 | i++; |
| 986 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 987 | if (vl_config.crypto_key_id < 0) |
| 988 | return CMD_WARNING; |
| 989 | i++; |
| 990 | memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); |
| 991 | strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); |
| 992 | vl_config.md5_key = md5_key; |
| 993 | break; |
| 994 | |
| 995 | case 'h': |
| 996 | /* Hello interval */ |
| 997 | i++; |
| 998 | vl_config.hello_interval = strtol (argv[i], NULL, 10); |
| 999 | if (vl_config.hello_interval < 0) |
| 1000 | return CMD_WARNING; |
| 1001 | break; |
| 1002 | |
| 1003 | case 'r': |
| 1004 | /* Retransmit Interval */ |
| 1005 | i++; |
| 1006 | vl_config.retransmit_interval = strtol (argv[i], NULL, 10); |
| 1007 | if (vl_config.retransmit_interval < 0) |
| 1008 | return CMD_WARNING; |
| 1009 | break; |
| 1010 | |
| 1011 | case 't': |
| 1012 | /* Transmit Delay */ |
| 1013 | i++; |
| 1014 | vl_config.transmit_delay = strtol (argv[i], NULL, 10); |
| 1015 | if (vl_config.transmit_delay < 0) |
| 1016 | return CMD_WARNING; |
| 1017 | break; |
| 1018 | |
| 1019 | case 'd': |
| 1020 | /* Dead Interval */ |
| 1021 | i++; |
| 1022 | vl_config.dead_interval = strtol (argv[i], NULL, 10); |
| 1023 | if (vl_config.dead_interval < 0) |
| 1024 | return CMD_WARNING; |
| 1025 | break; |
| 1026 | } |
| 1027 | } |
| 1028 | |
| 1029 | |
| 1030 | /* Action configuration */ |
| 1031 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1032 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1033 | |
| 1034 | } |
| 1035 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1036 | DEFUN (no_ospf_area_vlink, |
| 1037 | no_ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1038 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 1039 | NO_STR |
| 1040 | VLINK_HELPSTR_IPADDR) |
| 1041 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1042 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1043 | struct ospf_area *area; |
| 1044 | struct ospf_vl_config_data vl_config; |
| 1045 | struct ospf_vl_data *vl_data = NULL; |
| 1046 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 1047 | int i; |
| 1048 | int ret, format; |
| 1049 | |
| 1050 | ospf_vl_config_data_init(&vl_config, vty); |
| 1051 | |
| 1052 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); |
| 1053 | if (ret < 0) |
| 1054 | { |
| 1055 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 1056 | return CMD_WARNING; |
| 1057 | } |
| 1058 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1059 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1060 | if (!area) |
| 1061 | { |
| 1062 | vty_out (vty, "Area does not exist%s", VTY_NEWLINE); |
| 1063 | return CMD_WARNING; |
| 1064 | } |
| 1065 | |
| 1066 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 1067 | if (! ret) |
| 1068 | { |
| 1069 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 1070 | VTY_NEWLINE); |
| 1071 | return CMD_WARNING; |
| 1072 | } |
| 1073 | |
| 1074 | if (argc <=2) |
| 1075 | { |
| 1076 | /* Basic VLink no command */ |
| 1077 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 1078 | if ((vl_data = ospf_vl_lookup (area, vl_config.vl_peer))) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1079 | ospf_vl_delete (ospf, vl_data); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1080 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1081 | ospf_area_check_free (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1082 | |
| 1083 | return CMD_SUCCESS; |
| 1084 | } |
| 1085 | |
| 1086 | /* If we are down here, we are reseting parameters */ |
| 1087 | |
| 1088 | /* Deal with other parameters */ |
| 1089 | for (i=2; i < argc; i++) |
| 1090 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1091 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 1092 | |
| 1093 | switch (argv[i][0]) |
| 1094 | { |
| 1095 | |
| 1096 | case 'a': |
| 1097 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 1098 | { |
| 1099 | /* authentication-key - this option can occur anywhere on |
| 1100 | command line. At start of command line |
| 1101 | must check for authentication option. */ |
| 1102 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 1103 | vl_config.auth_key = auth_key; |
| 1104 | } |
| 1105 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1106 | { |
| 1107 | /* authentication - this option can only occur at start |
| 1108 | of command line */ |
| 1109 | vl_config.auth_type = OSPF_AUTH_NOTSET; |
| 1110 | } |
| 1111 | break; |
| 1112 | |
| 1113 | case 'm': |
| 1114 | /* message-digest-key */ |
| 1115 | /* Delete one key */ |
| 1116 | i++; |
| 1117 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1118 | if (vl_config.crypto_key_id < 0) |
| 1119 | return CMD_WARNING; |
| 1120 | vl_config.md5_key = NULL; |
| 1121 | break; |
| 1122 | |
| 1123 | case 'h': |
| 1124 | /* Hello interval */ |
| 1125 | vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; |
| 1126 | break; |
| 1127 | |
| 1128 | case 'r': |
| 1129 | /* Retransmit Interval */ |
| 1130 | vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 1131 | break; |
| 1132 | |
| 1133 | case 't': |
| 1134 | /* Transmit Delay */ |
| 1135 | vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 1136 | break; |
| 1137 | |
| 1138 | case 'd': |
| 1139 | /* Dead Interval */ |
| 1140 | i++; |
| 1141 | vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 1142 | break; |
| 1143 | } |
| 1144 | } |
| 1145 | |
| 1146 | |
| 1147 | /* Action configuration */ |
| 1148 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1149 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1150 | } |
| 1151 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1152 | ALIAS (ospf_area_vlink, |
| 1153 | ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1154 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1155 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1156 | VLINK_HELPSTR_IPADDR |
| 1157 | VLINK_HELPSTR_TIME_PARAM) |
| 1158 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1159 | ALIAS (no_ospf_area_vlink, |
| 1160 | no_ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1161 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1162 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1163 | NO_STR |
| 1164 | VLINK_HELPSTR_IPADDR |
| 1165 | VLINK_HELPSTR_TIME_PARAM) |
| 1166 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1167 | ALIAS (ospf_area_vlink, |
| 1168 | ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1169 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1170 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1171 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1172 | VLINK_HELPSTR_IPADDR |
| 1173 | VLINK_HELPSTR_TIME_PARAM |
| 1174 | VLINK_HELPSTR_TIME_PARAM) |
| 1175 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1176 | ALIAS (no_ospf_area_vlink, |
| 1177 | no_ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1178 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1179 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1180 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1181 | NO_STR |
| 1182 | VLINK_HELPSTR_IPADDR |
| 1183 | VLINK_HELPSTR_TIME_PARAM |
| 1184 | VLINK_HELPSTR_TIME_PARAM) |
| 1185 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1186 | ALIAS (ospf_area_vlink, |
| 1187 | ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1188 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1189 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1190 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1191 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1192 | VLINK_HELPSTR_IPADDR |
| 1193 | VLINK_HELPSTR_TIME_PARAM |
| 1194 | VLINK_HELPSTR_TIME_PARAM |
| 1195 | VLINK_HELPSTR_TIME_PARAM) |
| 1196 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1197 | ALIAS (no_ospf_area_vlink, |
| 1198 | no_ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1199 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1200 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1201 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1202 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1203 | NO_STR |
| 1204 | VLINK_HELPSTR_IPADDR |
| 1205 | VLINK_HELPSTR_TIME_PARAM |
| 1206 | VLINK_HELPSTR_TIME_PARAM |
| 1207 | VLINK_HELPSTR_TIME_PARAM) |
| 1208 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1209 | ALIAS (ospf_area_vlink, |
| 1210 | ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1211 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1212 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1213 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1214 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1215 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1216 | VLINK_HELPSTR_IPADDR |
| 1217 | VLINK_HELPSTR_TIME_PARAM |
| 1218 | VLINK_HELPSTR_TIME_PARAM |
| 1219 | VLINK_HELPSTR_TIME_PARAM |
| 1220 | VLINK_HELPSTR_TIME_PARAM) |
| 1221 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1222 | ALIAS (no_ospf_area_vlink, |
| 1223 | no_ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1224 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1225 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1226 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1227 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1228 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1229 | NO_STR |
| 1230 | VLINK_HELPSTR_IPADDR |
| 1231 | VLINK_HELPSTR_TIME_PARAM |
| 1232 | VLINK_HELPSTR_TIME_PARAM |
| 1233 | VLINK_HELPSTR_TIME_PARAM |
| 1234 | VLINK_HELPSTR_TIME_PARAM) |
| 1235 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1236 | ALIAS (ospf_area_vlink, |
| 1237 | ospf_area_vlink_authtype_args_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1238 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1239 | "(authentication|) (message-digest|null)", |
| 1240 | VLINK_HELPSTR_IPADDR |
| 1241 | VLINK_HELPSTR_AUTHTYPE_ALL) |
| 1242 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1243 | ALIAS (ospf_area_vlink, |
| 1244 | ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1245 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1246 | "(authentication|)", |
| 1247 | VLINK_HELPSTR_IPADDR |
| 1248 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1249 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1250 | ALIAS (no_ospf_area_vlink, |
| 1251 | no_ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1252 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1253 | "(authentication|)", |
| 1254 | NO_STR |
| 1255 | VLINK_HELPSTR_IPADDR |
| 1256 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1257 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1258 | ALIAS (ospf_area_vlink, |
| 1259 | ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1260 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1261 | "(message-digest-key|) <1-255> md5 KEY", |
| 1262 | VLINK_HELPSTR_IPADDR |
| 1263 | VLINK_HELPSTR_AUTH_MD5) |
| 1264 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1265 | ALIAS (no_ospf_area_vlink, |
| 1266 | no_ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1267 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1268 | "(message-digest-key|) <1-255>", |
| 1269 | NO_STR |
| 1270 | VLINK_HELPSTR_IPADDR |
| 1271 | VLINK_HELPSTR_AUTH_MD5) |
| 1272 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1273 | ALIAS (ospf_area_vlink, |
| 1274 | ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1275 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1276 | "(authentication-key|) AUTH_KEY", |
| 1277 | VLINK_HELPSTR_IPADDR |
| 1278 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1279 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1280 | ALIAS (no_ospf_area_vlink, |
| 1281 | no_ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1282 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1283 | "(authentication-key|)", |
| 1284 | NO_STR |
| 1285 | VLINK_HELPSTR_IPADDR |
| 1286 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1287 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1288 | ALIAS (ospf_area_vlink, |
| 1289 | ospf_area_vlink_authtype_args_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1290 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1291 | "(authentication|) (message-digest|null) " |
| 1292 | "(authentication-key|) AUTH_KEY", |
| 1293 | VLINK_HELPSTR_IPADDR |
| 1294 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1295 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1296 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1297 | ALIAS (ospf_area_vlink, |
| 1298 | ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1299 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1300 | "(authentication|) " |
| 1301 | "(authentication-key|) AUTH_KEY", |
| 1302 | VLINK_HELPSTR_IPADDR |
| 1303 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1304 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1305 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1306 | ALIAS (no_ospf_area_vlink, |
| 1307 | no_ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1308 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1309 | "(authentication|) " |
| 1310 | "(authentication-key|)", |
| 1311 | NO_STR |
| 1312 | VLINK_HELPSTR_IPADDR |
| 1313 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1314 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1315 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1316 | ALIAS (ospf_area_vlink, |
| 1317 | ospf_area_vlink_authtype_args_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1318 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1319 | "(authentication|) (message-digest|null) " |
| 1320 | "(message-digest-key|) <1-255> md5 KEY", |
| 1321 | VLINK_HELPSTR_IPADDR |
| 1322 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1323 | VLINK_HELPSTR_AUTH_MD5) |
| 1324 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1325 | ALIAS (ospf_area_vlink, |
| 1326 | ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1327 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1328 | "(authentication|) " |
| 1329 | "(message-digest-key|) <1-255> md5 KEY", |
| 1330 | VLINK_HELPSTR_IPADDR |
| 1331 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1332 | VLINK_HELPSTR_AUTH_MD5) |
| 1333 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1334 | ALIAS (no_ospf_area_vlink, |
| 1335 | no_ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1336 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1337 | "(authentication|) " |
| 1338 | "(message-digest-key|)", |
| 1339 | NO_STR |
| 1340 | VLINK_HELPSTR_IPADDR |
| 1341 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1342 | VLINK_HELPSTR_AUTH_MD5) |
| 1343 | |
| 1344 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1345 | DEFUN (ospf_area_shortcut, |
| 1346 | ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1347 | "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", |
| 1348 | "OSPF area parameters\n" |
| 1349 | "OSPF area ID in IP address format\n" |
| 1350 | "OSPF area ID as a decimal value\n" |
| 1351 | "Configure the area's shortcutting mode\n" |
| 1352 | "Set default shortcutting behavior\n" |
| 1353 | "Enable shortcutting through the area\n" |
| 1354 | "Disable shortcutting through the area\n") |
| 1355 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1356 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1357 | struct ospf_area *area; |
| 1358 | struct in_addr area_id; |
| 1359 | int mode; |
| 1360 | int format; |
| 1361 | |
| 1362 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1363 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1364 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1365 | |
| 1366 | if (strncmp (argv[1], "de", 2) == 0) |
| 1367 | mode = OSPF_SHORTCUT_DEFAULT; |
| 1368 | else if (strncmp (argv[1], "di", 2) == 0) |
| 1369 | mode = OSPF_SHORTCUT_DISABLE; |
| 1370 | else if (strncmp (argv[1], "e", 1) == 0) |
| 1371 | mode = OSPF_SHORTCUT_ENABLE; |
| 1372 | else |
| 1373 | return CMD_WARNING; |
| 1374 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1375 | ospf_area_shortcut_set (ospf, area, mode); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1376 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1377 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1378 | vty_out (vty, "Shortcut area setting will take effect " |
| 1379 | "only when the router is configured as Shortcut ABR%s", |
| 1380 | VTY_NEWLINE); |
| 1381 | |
| 1382 | return CMD_SUCCESS; |
| 1383 | } |
| 1384 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1385 | DEFUN (no_ospf_area_shortcut, |
| 1386 | no_ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1387 | "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", |
| 1388 | NO_STR |
| 1389 | "OSPF area parameters\n" |
| 1390 | "OSPF area ID in IP address format\n" |
| 1391 | "OSPF area ID as a decimal value\n" |
| 1392 | "Deconfigure the area's shortcutting mode\n" |
| 1393 | "Deconfigure enabled shortcutting through the area\n" |
| 1394 | "Deconfigure disabled shortcutting through the area\n") |
| 1395 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1396 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1397 | struct ospf_area *area; |
| 1398 | struct in_addr area_id; |
| 1399 | int format; |
| 1400 | |
| 1401 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1402 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1403 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1404 | if (!area) |
| 1405 | return CMD_SUCCESS; |
| 1406 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1407 | ospf_area_shortcut_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1408 | |
| 1409 | return CMD_SUCCESS; |
| 1410 | } |
| 1411 | |
| 1412 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1413 | DEFUN (ospf_area_stub, |
| 1414 | ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1415 | "area (A.B.C.D|<0-4294967295>) stub", |
| 1416 | "OSPF area parameters\n" |
| 1417 | "OSPF area ID in IP address format\n" |
| 1418 | "OSPF area ID as a decimal value\n" |
| 1419 | "Configure OSPF area as stub\n") |
| 1420 | { |
| 1421 | struct ospf *ospf = vty->index; |
| 1422 | struct in_addr area_id; |
| 1423 | int ret, format; |
| 1424 | |
| 1425 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1426 | |
| 1427 | ret = ospf_area_stub_set (ospf, area_id); |
| 1428 | if (ret == 0) |
| 1429 | { |
| 1430 | vty_out (vty, "First deconfigure all virtual link through this area%s", |
| 1431 | VTY_NEWLINE); |
| 1432 | return CMD_WARNING; |
| 1433 | } |
| 1434 | |
| 1435 | ospf_area_no_summary_unset (ospf, area_id); |
| 1436 | |
| 1437 | return CMD_SUCCESS; |
| 1438 | } |
| 1439 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1440 | DEFUN (ospf_area_stub_no_summary, |
| 1441 | ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1442 | "area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1443 | "OSPF stub parameters\n" |
| 1444 | "OSPF area ID in IP address format\n" |
| 1445 | "OSPF area ID as a decimal value\n" |
| 1446 | "Configure OSPF area as stub\n" |
| 1447 | "Do not inject inter-area routes into stub\n") |
| 1448 | { |
| 1449 | struct ospf *ospf = vty->index; |
| 1450 | struct in_addr area_id; |
| 1451 | int ret, format; |
| 1452 | |
| 1453 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1454 | |
| 1455 | ret = ospf_area_stub_set (ospf, area_id); |
| 1456 | if (ret == 0) |
| 1457 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1458 | 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] | 1459 | VTY_NEWLINE); |
| 1460 | return CMD_WARNING; |
| 1461 | } |
| 1462 | |
| 1463 | ospf_area_no_summary_set (ospf, area_id); |
| 1464 | |
| 1465 | return CMD_SUCCESS; |
| 1466 | } |
| 1467 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1468 | DEFUN (no_ospf_area_stub, |
| 1469 | no_ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1470 | "no area (A.B.C.D|<0-4294967295>) stub", |
| 1471 | NO_STR |
| 1472 | "OSPF area parameters\n" |
| 1473 | "OSPF area ID in IP address format\n" |
| 1474 | "OSPF area ID as a decimal value\n" |
| 1475 | "Configure OSPF area as stub\n") |
| 1476 | { |
| 1477 | struct ospf *ospf = vty->index; |
| 1478 | struct in_addr area_id; |
| 1479 | int format; |
| 1480 | |
| 1481 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1482 | |
| 1483 | ospf_area_stub_unset (ospf, area_id); |
| 1484 | ospf_area_no_summary_unset (ospf, area_id); |
| 1485 | |
| 1486 | return CMD_SUCCESS; |
| 1487 | } |
| 1488 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1489 | DEFUN (no_ospf_area_stub_no_summary, |
| 1490 | no_ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1491 | "no area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1492 | NO_STR |
| 1493 | "OSPF area parameters\n" |
| 1494 | "OSPF area ID in IP address format\n" |
| 1495 | "OSPF area ID as a decimal value\n" |
| 1496 | "Configure OSPF area as stub\n" |
| 1497 | "Do not inject inter-area routes into area\n") |
| 1498 | { |
| 1499 | struct ospf *ospf = vty->index; |
| 1500 | struct in_addr area_id; |
| 1501 | int format; |
| 1502 | |
| 1503 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1504 | ospf_area_no_summary_unset (ospf, area_id); |
| 1505 | |
| 1506 | return CMD_SUCCESS; |
| 1507 | } |
| 1508 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1509 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 1510 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
| 1511 | int nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1512 | { |
| 1513 | struct ospf *ospf = vty->index; |
| 1514 | struct in_addr area_id; |
| 1515 | int ret, format; |
| 1516 | |
| 1517 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1518 | |
| 1519 | ret = ospf_area_nssa_set (ospf, area_id); |
| 1520 | if (ret == 0) |
| 1521 | { |
| 1522 | vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", |
| 1523 | VTY_NEWLINE); |
| 1524 | return CMD_WARNING; |
| 1525 | } |
| 1526 | |
| 1527 | if (argc > 1) |
| 1528 | { |
| 1529 | if (strncmp (argv[1], "translate-c", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1530 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1531 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1532 | else if (strncmp (argv[1], "translate-n", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1533 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1534 | OSPF_NSSA_ROLE_NEVER); |
| 1535 | else if (strncmp (argv[1], "translate-a", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1536 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1537 | OSPF_NSSA_ROLE_ALWAYS); |
| 1538 | } |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1539 | else |
| 1540 | { |
| 1541 | ospf_area_nssa_translator_role_set (ospf, area_id, |
| 1542 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1543 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1544 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1545 | if (nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1546 | ospf_area_no_summary_set (ospf, area_id); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1547 | else |
| 1548 | ospf_area_no_summary_unset (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1549 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1550 | ospf_schedule_abr_task (ospf); |
| 1551 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1552 | return CMD_SUCCESS; |
| 1553 | } |
| 1554 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1555 | DEFUN (ospf_area_nssa_translate_no_summary, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1556 | ospf_area_nssa_translate_no_summary_cmd, |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1557 | "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] | 1558 | "OSPF area parameters\n" |
| 1559 | "OSPF area ID in IP address format\n" |
| 1560 | "OSPF area ID as a decimal value\n" |
| 1561 | "Configure OSPF area as nssa\n" |
| 1562 | "Configure NSSA-ABR for translate election (default)\n" |
| 1563 | "Configure NSSA-ABR to never translate\n" |
| 1564 | "Configure NSSA-ABR to always translate\n" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1565 | "Do not inject inter-area routes into nssa\n") |
| 1566 | { |
| 1567 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
| 1568 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1569 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1570 | DEFUN (ospf_area_nssa_translate, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1571 | ospf_area_nssa_translate_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1572 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", |
| 1573 | "OSPF area parameters\n" |
| 1574 | "OSPF area ID in IP address format\n" |
| 1575 | "OSPF area ID as a decimal value\n" |
| 1576 | "Configure OSPF area as nssa\n" |
| 1577 | "Configure NSSA-ABR for translate election (default)\n" |
| 1578 | "Configure NSSA-ABR to never translate\n" |
| 1579 | "Configure NSSA-ABR to always translate\n") |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1580 | { |
| 1581 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1582 | } |
| 1583 | |
| 1584 | DEFUN (ospf_area_nssa, |
| 1585 | ospf_area_nssa_cmd, |
| 1586 | "area (A.B.C.D|<0-4294967295>) nssa", |
| 1587 | "OSPF area parameters\n" |
| 1588 | "OSPF area ID in IP address format\n" |
| 1589 | "OSPF area ID as a decimal value\n" |
| 1590 | "Configure OSPF area as nssa\n") |
| 1591 | { |
| 1592 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1593 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1594 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1595 | DEFUN (ospf_area_nssa_no_summary, |
| 1596 | ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1597 | "area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1598 | "OSPF area parameters\n" |
| 1599 | "OSPF area ID in IP address format\n" |
| 1600 | "OSPF area ID as a decimal value\n" |
| 1601 | "Configure OSPF area as nssa\n" |
| 1602 | "Do not inject inter-area routes into nssa\n") |
| 1603 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1604 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1605 | } |
| 1606 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1607 | DEFUN (no_ospf_area_nssa, |
| 1608 | no_ospf_area_nssa_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1609 | "no area (A.B.C.D|<0-4294967295>) nssa", |
| 1610 | NO_STR |
| 1611 | "OSPF area parameters\n" |
| 1612 | "OSPF area ID in IP address format\n" |
| 1613 | "OSPF area ID as a decimal value\n" |
| 1614 | "Configure OSPF area as nssa\n") |
| 1615 | { |
| 1616 | struct ospf *ospf = vty->index; |
| 1617 | struct in_addr area_id; |
| 1618 | int format; |
| 1619 | |
| 1620 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1621 | |
| 1622 | ospf_area_nssa_unset (ospf, area_id); |
| 1623 | ospf_area_no_summary_unset (ospf, area_id); |
| 1624 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1625 | ospf_schedule_abr_task (ospf); |
| 1626 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1627 | return CMD_SUCCESS; |
| 1628 | } |
| 1629 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1630 | DEFUN (no_ospf_area_nssa_no_summary, |
| 1631 | no_ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1632 | "no area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1633 | NO_STR |
| 1634 | "OSPF area parameters\n" |
| 1635 | "OSPF area ID in IP address format\n" |
| 1636 | "OSPF area ID as a decimal value\n" |
| 1637 | "Configure OSPF area as nssa\n" |
| 1638 | "Do not inject inter-area routes into nssa\n") |
| 1639 | { |
| 1640 | struct ospf *ospf = vty->index; |
| 1641 | struct in_addr area_id; |
| 1642 | int format; |
| 1643 | |
| 1644 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1645 | ospf_area_no_summary_unset (ospf, area_id); |
| 1646 | |
| 1647 | return CMD_SUCCESS; |
| 1648 | } |
| 1649 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1650 | DEFUN (ospf_area_default_cost, |
| 1651 | ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1652 | "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1653 | "OSPF area parameters\n" |
| 1654 | "OSPF area ID in IP address format\n" |
| 1655 | "OSPF area ID as a decimal value\n" |
| 1656 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1657 | "Stub's advertised default summary cost\n") |
| 1658 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1659 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1660 | struct ospf_area *area; |
| 1661 | struct in_addr area_id; |
| 1662 | u_int32_t cost; |
| 1663 | int format; |
| 1664 | |
| 1665 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1666 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1667 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1668 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1669 | |
| 1670 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1671 | { |
| 1672 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1673 | return CMD_WARNING; |
| 1674 | } |
| 1675 | |
| 1676 | area->default_cost = cost; |
| 1677 | |
| 1678 | return CMD_SUCCESS; |
| 1679 | } |
| 1680 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1681 | DEFUN (no_ospf_area_default_cost, |
| 1682 | no_ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1683 | "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1684 | NO_STR |
| 1685 | "OSPF area parameters\n" |
| 1686 | "OSPF area ID in IP address format\n" |
| 1687 | "OSPF area ID as a decimal value\n" |
| 1688 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1689 | "Stub's advertised default summary cost\n") |
| 1690 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1691 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1692 | struct ospf_area *area; |
| 1693 | struct in_addr area_id; |
| 1694 | u_int32_t cost; |
| 1695 | int format; |
| 1696 | |
| 1697 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1698 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1699 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1700 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1701 | if (area == NULL) |
| 1702 | return CMD_SUCCESS; |
| 1703 | |
| 1704 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1705 | { |
| 1706 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1707 | return CMD_WARNING; |
| 1708 | } |
| 1709 | |
| 1710 | area->default_cost = 1; |
| 1711 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1712 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1713 | |
| 1714 | return CMD_SUCCESS; |
| 1715 | } |
| 1716 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1717 | DEFUN (ospf_area_export_list, |
| 1718 | ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1719 | "area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1720 | "OSPF area parameters\n" |
| 1721 | "OSPF area ID in IP address format\n" |
| 1722 | "OSPF area ID as a decimal value\n" |
| 1723 | "Set the filter for networks announced to other areas\n" |
| 1724 | "Name of the access-list\n") |
| 1725 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1726 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1727 | struct ospf_area *area; |
| 1728 | struct in_addr area_id; |
| 1729 | int format; |
| 1730 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1731 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1732 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1733 | area = ospf_area_get (ospf, area_id, format); |
| 1734 | ospf_area_export_list_set (ospf, area, argv[1]); |
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 (no_ospf_area_export_list, |
| 1740 | no_ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1741 | "no area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1742 | NO_STR |
| 1743 | "OSPF area parameters\n" |
| 1744 | "OSPF area ID in IP address format\n" |
| 1745 | "OSPF area ID as a decimal value\n" |
| 1746 | "Unset the filter for networks announced to other areas\n" |
| 1747 | "Name of the access-list\n") |
| 1748 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1749 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1750 | struct ospf_area *area; |
| 1751 | struct in_addr area_id; |
| 1752 | int format; |
| 1753 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1754 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1755 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1756 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1757 | if (area == NULL) |
| 1758 | return CMD_SUCCESS; |
| 1759 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1760 | ospf_area_export_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1761 | |
| 1762 | return CMD_SUCCESS; |
| 1763 | } |
| 1764 | |
| 1765 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1766 | DEFUN (ospf_area_import_list, |
| 1767 | ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1768 | "area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1769 | "OSPF area parameters\n" |
| 1770 | "OSPF area ID in IP address format\n" |
| 1771 | "OSPF area ID as a decimal value\n" |
| 1772 | "Set the filter for networks from other areas announced to the specified one\n" |
| 1773 | "Name of the access-list\n") |
| 1774 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1775 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1776 | struct ospf_area *area; |
| 1777 | struct in_addr area_id; |
| 1778 | int format; |
| 1779 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1780 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1781 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1782 | area = ospf_area_get (ospf, area_id, format); |
| 1783 | ospf_area_import_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1784 | |
| 1785 | return CMD_SUCCESS; |
| 1786 | } |
| 1787 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1788 | DEFUN (no_ospf_area_import_list, |
| 1789 | no_ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1790 | "no area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1791 | NO_STR |
| 1792 | "OSPF area parameters\n" |
| 1793 | "OSPF area ID in IP address format\n" |
| 1794 | "OSPF area ID as a decimal value\n" |
| 1795 | "Unset the filter for networks announced to other areas\n" |
| 1796 | "Name of the access-list\n") |
| 1797 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1798 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1799 | struct ospf_area *area; |
| 1800 | struct in_addr area_id; |
| 1801 | int format; |
| 1802 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1803 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1804 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1805 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1806 | if (area == NULL) |
| 1807 | return CMD_SUCCESS; |
| 1808 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1809 | ospf_area_import_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1810 | |
| 1811 | return CMD_SUCCESS; |
| 1812 | } |
| 1813 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1814 | DEFUN (ospf_area_filter_list, |
| 1815 | ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1816 | "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1817 | "OSPF area parameters\n" |
| 1818 | "OSPF area ID in IP address format\n" |
| 1819 | "OSPF area ID as a decimal value\n" |
| 1820 | "Filter networks between OSPF areas\n" |
| 1821 | "Filter prefixes between OSPF areas\n" |
| 1822 | "Name of an IP prefix-list\n" |
| 1823 | "Filter networks sent to this area\n" |
| 1824 | "Filter networks sent from this area\n") |
| 1825 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1826 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1827 | struct ospf_area *area; |
| 1828 | struct in_addr area_id; |
| 1829 | struct prefix_list *plist; |
| 1830 | int format; |
| 1831 | |
| 1832 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1833 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1834 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1835 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1836 | if (strncmp (argv[2], "in", 2) == 0) |
| 1837 | { |
| 1838 | PREFIX_LIST_IN (area) = plist; |
| 1839 | if (PREFIX_NAME_IN (area)) |
| 1840 | free (PREFIX_NAME_IN (area)); |
| 1841 | |
| 1842 | PREFIX_NAME_IN (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1843 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1844 | } |
| 1845 | else |
| 1846 | { |
| 1847 | PREFIX_LIST_OUT (area) = plist; |
| 1848 | if (PREFIX_NAME_OUT (area)) |
| 1849 | free (PREFIX_NAME_OUT (area)); |
| 1850 | |
| 1851 | PREFIX_NAME_OUT (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1852 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1853 | } |
| 1854 | |
| 1855 | return CMD_SUCCESS; |
| 1856 | } |
| 1857 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1858 | DEFUN (no_ospf_area_filter_list, |
| 1859 | no_ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1860 | "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1861 | NO_STR |
| 1862 | "OSPF area parameters\n" |
| 1863 | "OSPF area ID in IP address format\n" |
| 1864 | "OSPF area ID as a decimal value\n" |
| 1865 | "Filter networks between OSPF areas\n" |
| 1866 | "Filter prefixes between OSPF areas\n" |
| 1867 | "Name of an IP prefix-list\n" |
| 1868 | "Filter networks sent to this area\n" |
| 1869 | "Filter networks sent from this area\n") |
| 1870 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1871 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1872 | struct ospf_area *area; |
| 1873 | struct in_addr area_id; |
| 1874 | struct prefix_list *plist; |
| 1875 | int format; |
| 1876 | |
| 1877 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1878 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1879 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1880 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1881 | if (strncmp (argv[2], "in", 2) == 0) |
| 1882 | { |
| 1883 | if (PREFIX_NAME_IN (area)) |
| 1884 | if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) |
| 1885 | return CMD_SUCCESS; |
| 1886 | |
| 1887 | PREFIX_LIST_IN (area) = NULL; |
| 1888 | if (PREFIX_NAME_IN (area)) |
| 1889 | free (PREFIX_NAME_IN (area)); |
| 1890 | |
| 1891 | PREFIX_NAME_IN (area) = NULL; |
| 1892 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1893 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1894 | } |
| 1895 | else |
| 1896 | { |
| 1897 | if (PREFIX_NAME_OUT (area)) |
| 1898 | if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) |
| 1899 | return CMD_SUCCESS; |
| 1900 | |
| 1901 | PREFIX_LIST_OUT (area) = NULL; |
| 1902 | if (PREFIX_NAME_OUT (area)) |
| 1903 | free (PREFIX_NAME_OUT (area)); |
| 1904 | |
| 1905 | PREFIX_NAME_OUT (area) = NULL; |
| 1906 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1907 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1908 | } |
| 1909 | |
| 1910 | return CMD_SUCCESS; |
| 1911 | } |
| 1912 | |
| 1913 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1914 | DEFUN (ospf_area_authentication_message_digest, |
| 1915 | ospf_area_authentication_message_digest_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1916 | "area (A.B.C.D|<0-4294967295>) authentication message-digest", |
| 1917 | "OSPF area parameters\n" |
| 1918 | "Enable authentication\n" |
| 1919 | "Use message-digest authentication\n") |
| 1920 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1921 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1922 | struct ospf_area *area; |
| 1923 | struct in_addr area_id; |
| 1924 | int format; |
| 1925 | |
| 1926 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1927 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1928 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1929 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1930 | |
| 1931 | return CMD_SUCCESS; |
| 1932 | } |
| 1933 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1934 | DEFUN (ospf_area_authentication, |
| 1935 | ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1936 | "area (A.B.C.D|<0-4294967295>) authentication", |
| 1937 | "OSPF area parameters\n" |
| 1938 | "OSPF area ID in IP address format\n" |
| 1939 | "OSPF area ID as a decimal value\n" |
| 1940 | "Enable authentication\n") |
| 1941 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1942 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1943 | struct ospf_area *area; |
| 1944 | struct in_addr area_id; |
| 1945 | int format; |
| 1946 | |
| 1947 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1948 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1949 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1950 | area->auth_type = OSPF_AUTH_SIMPLE; |
| 1951 | |
| 1952 | return CMD_SUCCESS; |
| 1953 | } |
| 1954 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1955 | DEFUN (no_ospf_area_authentication, |
| 1956 | no_ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1957 | "no area (A.B.C.D|<0-4294967295>) authentication", |
| 1958 | NO_STR |
| 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_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1972 | if (area == NULL) |
| 1973 | return CMD_SUCCESS; |
| 1974 | |
| 1975 | area->auth_type = OSPF_AUTH_NULL; |
| 1976 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1977 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1978 | |
| 1979 | return CMD_SUCCESS; |
| 1980 | } |
| 1981 | |
| 1982 | |
| 1983 | DEFUN (ospf_abr_type, |
| 1984 | ospf_abr_type_cmd, |
| 1985 | "ospf abr-type (cisco|ibm|shortcut|standard)", |
| 1986 | "OSPF specific commands\n" |
| 1987 | "Set OSPF ABR type\n" |
| 1988 | "Alternative ABR, cisco implementation\n" |
| 1989 | "Alternative ABR, IBM implementation\n" |
| 1990 | "Shortcut ABR\n" |
| 1991 | "Standard behavior (RFC2328)\n") |
| 1992 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1993 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1994 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 1995 | |
| 1996 | if (strncmp (argv[0], "c", 1) == 0) |
| 1997 | abr_type = OSPF_ABR_CISCO; |
| 1998 | else if (strncmp (argv[0], "i", 1) == 0) |
| 1999 | abr_type = OSPF_ABR_IBM; |
| 2000 | else if (strncmp (argv[0], "sh", 2) == 0) |
| 2001 | abr_type = OSPF_ABR_SHORTCUT; |
| 2002 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2003 | abr_type = OSPF_ABR_STAND; |
| 2004 | else |
| 2005 | return CMD_WARNING; |
| 2006 | |
| 2007 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2008 | if (ospf->abr_type != abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2009 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2010 | ospf->abr_type = abr_type; |
| 2011 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2012 | } |
| 2013 | |
| 2014 | return CMD_SUCCESS; |
| 2015 | } |
| 2016 | |
| 2017 | DEFUN (no_ospf_abr_type, |
| 2018 | no_ospf_abr_type_cmd, |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2019 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2020 | NO_STR |
| 2021 | "OSPF specific commands\n" |
| 2022 | "Set OSPF ABR type\n" |
| 2023 | "Alternative ABR, cisco implementation\n" |
| 2024 | "Alternative ABR, IBM implementation\n" |
| 2025 | "Shortcut ABR\n") |
| 2026 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2027 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2028 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2029 | |
| 2030 | if (strncmp (argv[0], "c", 1) == 0) |
| 2031 | abr_type = OSPF_ABR_CISCO; |
| 2032 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2033 | abr_type = OSPF_ABR_IBM; |
| 2034 | else if (strncmp (argv[0], "s", 1) == 0) |
| 2035 | abr_type = OSPF_ABR_SHORTCUT; |
| 2036 | else |
| 2037 | return CMD_WARNING; |
| 2038 | |
| 2039 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2040 | if (ospf->abr_type == abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2041 | { |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2042 | ospf->abr_type = OSPF_ABR_DEFAULT; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2043 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2044 | } |
| 2045 | |
| 2046 | return CMD_SUCCESS; |
| 2047 | } |
| 2048 | |
| 2049 | DEFUN (ospf_compatible_rfc1583, |
| 2050 | ospf_compatible_rfc1583_cmd, |
| 2051 | "compatible rfc1583", |
| 2052 | "OSPF compatibility list\n" |
| 2053 | "compatible with RFC 1583\n") |
| 2054 | { |
| 2055 | struct ospf *ospf = vty->index; |
| 2056 | |
| 2057 | if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2058 | { |
| 2059 | SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2060 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2061 | } |
| 2062 | return CMD_SUCCESS; |
| 2063 | } |
| 2064 | |
| 2065 | DEFUN (no_ospf_compatible_rfc1583, |
| 2066 | no_ospf_compatible_rfc1583_cmd, |
| 2067 | "no compatible rfc1583", |
| 2068 | NO_STR |
| 2069 | "OSPF compatibility list\n" |
| 2070 | "compatible with RFC 1583\n") |
| 2071 | { |
| 2072 | struct ospf *ospf = vty->index; |
| 2073 | |
| 2074 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2075 | { |
| 2076 | UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2077 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2078 | } |
| 2079 | return CMD_SUCCESS; |
| 2080 | } |
| 2081 | |
| 2082 | ALIAS (ospf_compatible_rfc1583, |
| 2083 | ospf_rfc1583_flag_cmd, |
| 2084 | "ospf rfc1583compatibility", |
| 2085 | "OSPF specific commands\n" |
| 2086 | "Enable the RFC1583Compatibility flag\n") |
| 2087 | |
| 2088 | ALIAS (no_ospf_compatible_rfc1583, |
| 2089 | no_ospf_rfc1583_flag_cmd, |
| 2090 | "no ospf rfc1583compatibility", |
| 2091 | NO_STR |
| 2092 | "OSPF specific commands\n" |
| 2093 | "Disable the RFC1583Compatibility flag\n") |
| 2094 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2095 | DEFUN (ospf_timers_spf, |
| 2096 | ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2097 | "timers spf <0-4294967295> <0-4294967295>", |
| 2098 | "Adjust routing timers\n" |
| 2099 | "OSPF SPF timers\n" |
| 2100 | "Delay between receiving a change to SPF calculation\n" |
| 2101 | "Hold time between consecutive SPF calculations\n") |
| 2102 | { |
| 2103 | struct ospf *ospf = vty->index; |
| 2104 | u_int32_t delay, hold; |
| 2105 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2106 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
| 2107 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2108 | |
| 2109 | ospf_timers_spf_set (ospf, delay, hold); |
| 2110 | |
| 2111 | return CMD_SUCCESS; |
| 2112 | } |
| 2113 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2114 | DEFUN (no_ospf_timers_spf, |
| 2115 | no_ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2116 | "no timers spf", |
| 2117 | NO_STR |
| 2118 | "Adjust routing timers\n" |
| 2119 | "OSPF SPF timers\n") |
| 2120 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2121 | struct ospf *ospf = vty->index; |
| 2122 | |
| 2123 | ospf->spf_delay = OSPF_SPF_DELAY_DEFAULT; |
| 2124 | ospf->spf_holdtime = OSPF_SPF_HOLDTIME_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2125 | |
| 2126 | return CMD_SUCCESS; |
| 2127 | } |
| 2128 | |
| 2129 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2130 | DEFUN (ospf_neighbor, |
| 2131 | ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2132 | "neighbor A.B.C.D", |
| 2133 | NEIGHBOR_STR |
| 2134 | "Neighbor IP address\n") |
| 2135 | { |
| 2136 | struct ospf *ospf = vty->index; |
| 2137 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2138 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2139 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2140 | |
| 2141 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2142 | |
| 2143 | if (argc > 1) |
| 2144 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); |
| 2145 | |
| 2146 | if (argc > 2) |
| 2147 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); |
| 2148 | |
| 2149 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2150 | if (argc > 1) |
| 2151 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2152 | if (argc > 2) |
| 2153 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); |
| 2154 | |
| 2155 | return CMD_SUCCESS; |
| 2156 | } |
| 2157 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2158 | ALIAS (ospf_neighbor, |
| 2159 | ospf_neighbor_priority_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2160 | "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2161 | NEIGHBOR_STR |
| 2162 | "Neighbor IP address\n" |
| 2163 | "Neighbor Priority\n" |
| 2164 | "Priority\n" |
| 2165 | "Dead Neighbor Polling interval\n" |
| 2166 | "Seconds\n") |
| 2167 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2168 | ALIAS (ospf_neighbor, |
| 2169 | ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2170 | "neighbor A.B.C.D priority <0-255>", |
| 2171 | NEIGHBOR_STR |
| 2172 | "Neighbor IP address\n" |
| 2173 | "Neighbor Priority\n" |
| 2174 | "Seconds\n") |
| 2175 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2176 | DEFUN (ospf_neighbor_poll_interval, |
| 2177 | ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2178 | "neighbor A.B.C.D poll-interval <1-65535>", |
| 2179 | NEIGHBOR_STR |
| 2180 | "Neighbor IP address\n" |
| 2181 | "Dead Neighbor Polling interval\n" |
| 2182 | "Seconds\n") |
| 2183 | { |
| 2184 | struct ospf *ospf = vty->index; |
| 2185 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2186 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2187 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2188 | |
| 2189 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2190 | |
| 2191 | if (argc > 1) |
| 2192 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); |
| 2193 | |
| 2194 | if (argc > 2) |
| 2195 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); |
| 2196 | |
| 2197 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2198 | if (argc > 1) |
| 2199 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); |
| 2200 | if (argc > 2) |
| 2201 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2202 | |
| 2203 | return CMD_SUCCESS; |
| 2204 | } |
| 2205 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2206 | ALIAS (ospf_neighbor_poll_interval, |
| 2207 | ospf_neighbor_poll_interval_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2208 | "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", |
| 2209 | NEIGHBOR_STR |
| 2210 | "Neighbor address\n" |
| 2211 | "OSPF dead-router polling interval\n" |
| 2212 | "Seconds\n" |
| 2213 | "OSPF priority of non-broadcast neighbor\n" |
| 2214 | "Priority\n") |
| 2215 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2216 | DEFUN (no_ospf_neighbor, |
| 2217 | no_ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2218 | "no neighbor A.B.C.D", |
| 2219 | NO_STR |
| 2220 | NEIGHBOR_STR |
| 2221 | "Neighbor IP address\n") |
| 2222 | { |
| 2223 | struct ospf *ospf = vty->index; |
| 2224 | struct in_addr nbr_addr; |
| 2225 | int ret; |
| 2226 | |
| 2227 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2228 | |
| 2229 | ret = ospf_nbr_nbma_unset (ospf, nbr_addr); |
| 2230 | |
| 2231 | return CMD_SUCCESS; |
| 2232 | } |
| 2233 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2234 | ALIAS (no_ospf_neighbor, |
| 2235 | no_ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2236 | "no neighbor A.B.C.D priority <0-255>", |
| 2237 | NO_STR |
| 2238 | NEIGHBOR_STR |
| 2239 | "Neighbor IP address\n" |
| 2240 | "Neighbor Priority\n" |
| 2241 | "Priority\n") |
| 2242 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2243 | ALIAS (no_ospf_neighbor, |
| 2244 | no_ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2245 | "no neighbor A.B.C.D poll-interval <1-65535>", |
| 2246 | NO_STR |
| 2247 | NEIGHBOR_STR |
| 2248 | "Neighbor IP address\n" |
| 2249 | "Dead Neighbor Polling interval\n" |
| 2250 | "Seconds\n") |
| 2251 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2252 | ALIAS (no_ospf_neighbor, |
| 2253 | no_ospf_neighbor_priority_pollinterval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2254 | "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2255 | NO_STR |
| 2256 | NEIGHBOR_STR |
| 2257 | "Neighbor IP address\n" |
| 2258 | "Neighbor Priority\n" |
| 2259 | "Priority\n" |
| 2260 | "Dead Neighbor Polling interval\n" |
| 2261 | "Seconds\n") |
| 2262 | |
| 2263 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2264 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2265 | "refresh timer <10-1800>", |
| 2266 | "Adjust refresh parameters\n" |
| 2267 | "Set refresh timer\n" |
| 2268 | "Timer value in seconds\n") |
| 2269 | { |
| 2270 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2271 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2272 | |
| 2273 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2274 | interval = (interval / 10) * 10; |
| 2275 | |
| 2276 | ospf_timers_refresh_set (ospf, interval); |
| 2277 | |
| 2278 | return CMD_SUCCESS; |
| 2279 | } |
| 2280 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2281 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2282 | "no refresh timer <10-1800>", |
| 2283 | "Adjust refresh parameters\n" |
| 2284 | "Unset refresh timer\n" |
| 2285 | "Timer value in seconds\n") |
| 2286 | { |
| 2287 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2288 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2289 | |
| 2290 | if (argc == 1) |
| 2291 | { |
| 2292 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2293 | |
| 2294 | if (ospf->lsa_refresh_interval != interval || |
| 2295 | interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
| 2296 | return CMD_SUCCESS; |
| 2297 | } |
| 2298 | |
| 2299 | ospf_timers_refresh_unset (ospf); |
| 2300 | |
| 2301 | return CMD_SUCCESS; |
| 2302 | } |
| 2303 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2304 | ALIAS (no_ospf_refresh_timer, |
| 2305 | no_ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2306 | "no refresh timer", |
| 2307 | "Adjust refresh parameters\n" |
| 2308 | "Unset refresh timer\n") |
| 2309 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2310 | DEFUN (ospf_auto_cost_reference_bandwidth, |
| 2311 | ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2312 | "auto-cost reference-bandwidth <1-4294967>", |
| 2313 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2314 | "Use reference bandwidth method to assign OSPF cost\n" |
| 2315 | "The reference bandwidth in terms of Mbits per second\n") |
| 2316 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2317 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2318 | u_int32_t refbw; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2319 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2320 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2321 | |
| 2322 | refbw = strtol (argv[0], NULL, 10); |
| 2323 | if (refbw < 1 || refbw > 4294967) |
| 2324 | { |
| 2325 | vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); |
| 2326 | return CMD_WARNING; |
| 2327 | } |
| 2328 | |
| 2329 | /* If reference bandwidth is changed. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2330 | if ((refbw * 1000) == ospf->ref_bandwidth) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2331 | return CMD_SUCCESS; |
| 2332 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2333 | ospf->ref_bandwidth = refbw * 1000; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2334 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
| 2335 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); |
| 2336 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2337 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 2338 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2339 | |
| 2340 | return CMD_SUCCESS; |
| 2341 | } |
| 2342 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2343 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
| 2344 | no_ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2345 | "no auto-cost reference-bandwidth", |
| 2346 | NO_STR |
| 2347 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2348 | "Use reference bandwidth method to assign OSPF cost\n") |
| 2349 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2350 | struct ospf *ospf = vty->index; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2351 | struct listnode *node, *nnode; |
| 2352 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2353 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2354 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2355 | return CMD_SUCCESS; |
| 2356 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2357 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2358 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
| 2359 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); |
| 2360 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2361 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
| 2362 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2363 | |
| 2364 | return CMD_SUCCESS; |
| 2365 | } |
| 2366 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2367 | const char *ospf_abr_type_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2368 | { |
| 2369 | "Unknown", |
| 2370 | "Standard (RFC2328)", |
| 2371 | "Alternative IBM", |
| 2372 | "Alternative Cisco", |
| 2373 | "Alternative Shortcut" |
| 2374 | }; |
| 2375 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2376 | const char *ospf_shortcut_mode_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2377 | { |
| 2378 | "Default", |
| 2379 | "Enabled", |
| 2380 | "Disabled" |
| 2381 | }; |
| 2382 | |
| 2383 | |
| 2384 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2385 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2386 | show_ip_ospf_area (struct vty *vty, struct ospf_area *area) |
| 2387 | { |
| 2388 | /* Show Area ID. */ |
| 2389 | vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); |
| 2390 | |
| 2391 | /* Show Area type/mode. */ |
| 2392 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 2393 | vty_out (vty, " (Backbone)%s", VTY_NEWLINE); |
| 2394 | else |
| 2395 | { |
| 2396 | if (area->external_routing == OSPF_AREA_STUB) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2397 | vty_out (vty, " (Stub%s%s)", |
| 2398 | area->no_summary ? ", no summary" : "", |
| 2399 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2400 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2401 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 2402 | vty_out (vty, " (NSSA%s%s)", |
| 2403 | area->no_summary ? ", no summary" : "", |
| 2404 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2405 | |
| 2406 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2407 | vty_out (vty, " Shortcutting mode: %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2408 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2409 | vty_out (vty, ", S-bit consensus: %s%s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2410 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2411 | } |
| 2412 | |
| 2413 | /* Show number of interfaces. */ |
| 2414 | vty_out (vty, " Number of interfaces in this area: Total: %d, " |
| 2415 | "Active: %d%s", listcount (area->oiflist), |
| 2416 | area->act_ints, VTY_NEWLINE); |
| 2417 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2418 | if (area->external_routing == OSPF_AREA_NSSA) |
| 2419 | { |
| 2420 | 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] | 2421 | if (! IS_OSPF_ABR (area->ospf)) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2422 | vty_out (vty, " It is not ABR, therefore not Translator. %s", |
| 2423 | VTY_NEWLINE); |
| 2424 | else if (area->NSSATranslatorState) |
| 2425 | { |
| 2426 | vty_out (vty, " We are an ABR and "); |
| 2427 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2428 | vty_out (vty, "the NSSA Elected Translator. %s", |
| 2429 | VTY_NEWLINE); |
| 2430 | else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) |
| 2431 | vty_out (vty, "always an NSSA Translator. %s", |
| 2432 | VTY_NEWLINE); |
| 2433 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2434 | else |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2435 | { |
| 2436 | vty_out (vty, " We are an ABR, but "); |
| 2437 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2438 | vty_out (vty, "not the NSSA Elected Translator. %s", |
| 2439 | VTY_NEWLINE); |
| 2440 | else |
hasso | c6b8781 | 2004-12-22 13:09:59 +0000 | [diff] [blame] | 2441 | vty_out (vty, "never an NSSA Translator. %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2442 | VTY_NEWLINE); |
| 2443 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2444 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2445 | |
| 2446 | /* Show number of fully adjacent neighbors. */ |
| 2447 | vty_out (vty, " Number of fully adjacent neighbors in this area:" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2448 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2449 | |
| 2450 | /* Show authentication type. */ |
| 2451 | vty_out (vty, " Area has "); |
| 2452 | if (area->auth_type == OSPF_AUTH_NULL) |
| 2453 | vty_out (vty, "no authentication%s", VTY_NEWLINE); |
| 2454 | else if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 2455 | vty_out (vty, "simple password authentication%s", VTY_NEWLINE); |
| 2456 | else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC) |
| 2457 | vty_out (vty, "message digest authentication%s", VTY_NEWLINE); |
| 2458 | |
| 2459 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 2460 | vty_out (vty, " Number of full virtual adjacencies going through" |
| 2461 | " this area: %d%s", area->full_vls, VTY_NEWLINE); |
| 2462 | |
| 2463 | /* Show SPF calculation times. */ |
| 2464 | vty_out (vty, " SPF algorithm executed %d times%s", |
| 2465 | area->spf_calculation, VTY_NEWLINE); |
| 2466 | |
| 2467 | /* Show number of LSA. */ |
| 2468 | vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE); |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2469 | vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s", |
| 2470 | ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA), |
| 2471 | ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE); |
| 2472 | vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s", |
| 2473 | ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA), |
| 2474 | ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE); |
| 2475 | vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2476 | ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA), |
| 2477 | ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE); |
| 2478 | vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2479 | ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA), |
| 2480 | ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE); |
| 2481 | vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s", |
| 2482 | ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA), |
| 2483 | ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE); |
| 2484 | #ifdef HAVE_OPAQUE_LSA |
| 2485 | vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s", |
| 2486 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA), |
| 2487 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE); |
| 2488 | vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s", |
| 2489 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA), |
| 2490 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE); |
| 2491 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2492 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2493 | } |
| 2494 | |
| 2495 | DEFUN (show_ip_ospf, |
| 2496 | show_ip_ospf_cmd, |
| 2497 | "show ip ospf", |
| 2498 | SHOW_STR |
| 2499 | IP_STR |
| 2500 | "OSPF information\n") |
| 2501 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2502 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2503 | struct ospf_area * area; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2504 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2505 | |
| 2506 | /* Check OSPF is enable. */ |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2507 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2508 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2509 | { |
| 2510 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2511 | return CMD_SUCCESS; |
| 2512 | } |
| 2513 | |
| 2514 | /* Show Router ID. */ |
| 2515 | vty_out (vty, " OSPF Routing Process, Router ID: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2516 | inet_ntoa (ospf->router_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2517 | VTY_NEWLINE); |
| 2518 | |
| 2519 | /* Show capability. */ |
| 2520 | vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE); |
| 2521 | vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE); |
| 2522 | vty_out (vty, " RFC1583Compatibility flag is %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2523 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2524 | "enabled" : "disabled", VTY_NEWLINE); |
| 2525 | #ifdef HAVE_OPAQUE_LSA |
| 2526 | vty_out (vty, " OpaqueCapability flag is %s%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2527 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2528 | "enabled" : "disabled", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2529 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2530 | " (origination blocked)" : "", |
| 2531 | VTY_NEWLINE); |
| 2532 | #endif /* HAVE_OPAQUE_LSA */ |
| 2533 | |
| 2534 | /* Show SPF timers. */ |
| 2535 | vty_out (vty, " SPF schedule delay %d secs, Hold time between two SPFs %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2536 | ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2537 | |
| 2538 | /* Show refresh parameters. */ |
| 2539 | vty_out (vty, " Refresh timer %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2540 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2541 | |
| 2542 | /* Show ABR/ASBR flags. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2543 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2544 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2545 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2546 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2547 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2548 | vty_out (vty, " This router is an ASBR " |
| 2549 | "(injecting external routing information)%s", VTY_NEWLINE); |
| 2550 | |
| 2551 | /* Show Number of AS-external-LSAs. */ |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2552 | vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s", |
| 2553 | ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), |
| 2554 | ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE); |
| 2555 | #ifdef HAVE_OPAQUE_LSA |
| 2556 | vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s", |
| 2557 | ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA), |
| 2558 | ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE); |
| 2559 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2560 | /* Show number of areas attached. */ |
| 2561 | vty_out (vty, " Number of areas attached to this router: %d%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2562 | listcount (ospf->areas), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2563 | |
| 2564 | /* Show each area status. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2565 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 2566 | show_ip_ospf_area (vty, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2567 | |
| 2568 | return CMD_SUCCESS; |
| 2569 | } |
| 2570 | |
| 2571 | |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2572 | static void |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2573 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
| 2574 | struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2575 | { |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2576 | int is_up; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2577 | struct ospf_neighbor *nbr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2578 | struct route_node *rn; |
| 2579 | char buf[9]; |
| 2580 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2581 | /* Is interface up? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2582 | vty_out (vty, "%s is %s%s", ifp->name, |
| 2583 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 2584 | vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s", |
| 2585 | ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), |
| 2586 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2587 | |
| 2588 | /* Is interface OSPF enabled? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2589 | if (ospf_oi_count(ifp) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2590 | { |
| 2591 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); |
| 2592 | return; |
| 2593 | } |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2594 | else if (!is_up) |
| 2595 | { |
| 2596 | vty_out (vty, " OSPF is enabled, but not running on this interface%s", |
| 2597 | VTY_NEWLINE); |
| 2598 | return; |
| 2599 | } |
| 2600 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2601 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 2602 | { |
| 2603 | struct ospf_interface *oi = rn->info; |
| 2604 | |
| 2605 | if (oi == NULL) |
| 2606 | continue; |
| 2607 | |
| 2608 | /* Show OSPF interface information. */ |
| 2609 | vty_out (vty, " Internet Address %s/%d,", |
| 2610 | inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen); |
| 2611 | |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 2612 | if (oi->connected->destination) |
| 2613 | vty_out (vty, " %s %s,", |
| 2614 | ((ifp->flags & IFF_POINTOPOINT) ? "Peer" : "Broadcast"), |
| 2615 | inet_ntoa (oi->connected->destination->u.prefix4)); |
| 2616 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2617 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
| 2618 | VTY_NEWLINE); |
| 2619 | |
| 2620 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2621 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2622 | oi->output_cost, VTY_NEWLINE); |
| 2623 | |
| 2624 | vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s", |
| 2625 | OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state), |
| 2626 | PRIORITY (oi), VTY_NEWLINE); |
| 2627 | |
| 2628 | /* Show DR information. */ |
| 2629 | if (DR (oi).s_addr == 0) |
| 2630 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2631 | else |
| 2632 | { |
| 2633 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi)); |
| 2634 | if (nbr == NULL) |
| 2635 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2636 | else |
| 2637 | { |
| 2638 | vty_out (vty, " Designated Router (ID) %s,", |
| 2639 | inet_ntoa (nbr->router_id)); |
| 2640 | vty_out (vty, " Interface Address %s%s", |
| 2641 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2642 | } |
| 2643 | } |
| 2644 | |
| 2645 | /* Show BDR information. */ |
| 2646 | if (BDR (oi).s_addr == 0) |
| 2647 | vty_out (vty, " No backup designated router on this network%s", |
| 2648 | VTY_NEWLINE); |
| 2649 | else |
| 2650 | { |
| 2651 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi)); |
| 2652 | if (nbr == NULL) |
| 2653 | vty_out (vty, " No backup designated router on this network%s", |
| 2654 | VTY_NEWLINE); |
| 2655 | else |
| 2656 | { |
| 2657 | vty_out (vty, " Backup Designated Router (ID) %s,", |
| 2658 | inet_ntoa (nbr->router_id)); |
| 2659 | vty_out (vty, " Interface Address %s%s", |
| 2660 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2661 | } |
| 2662 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2663 | |
| 2664 | vty_out (vty, " Multicast group memberships:"); |
| 2665 | if (CHECK_FLAG(oi->multicast_memberships, MEMBER_ALLROUTERS)) |
| 2666 | vty_out (vty, " OSPFAllRouters"); |
| 2667 | if (CHECK_FLAG(oi->multicast_memberships, MEMBER_DROUTERS)) |
| 2668 | vty_out (vty, " OSPFDesignatedRouters"); |
| 2669 | if (!CHECK_FLAG(oi->multicast_memberships, |
| 2670 | MEMBER_ALLROUTERS|MEMBER_DROUTERS)) |
| 2671 | vty_out (vty, " <None>"); |
| 2672 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2673 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2674 | vty_out (vty, " Timer intervals configured,"); |
| 2675 | vty_out (vty, " Hello %d, Dead %d, Wait %d, Retransmit %d%s", |
| 2676 | OSPF_IF_PARAM (oi, v_hello), OSPF_IF_PARAM (oi, v_wait), |
| 2677 | OSPF_IF_PARAM (oi, v_wait), |
| 2678 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 2679 | VTY_NEWLINE); |
| 2680 | |
| 2681 | if (OSPF_IF_PARAM (oi, passive_interface) == OSPF_IF_ACTIVE) |
| 2682 | vty_out (vty, " Hello due in %s%s", |
| 2683 | ospf_timer_dump (oi->t_hello, buf, 9), VTY_NEWLINE); |
| 2684 | else /* OSPF_IF_PASSIVE is set */ |
| 2685 | vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); |
| 2686 | |
| 2687 | vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2688 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2689 | VTY_NEWLINE); |
| 2690 | } |
| 2691 | } |
| 2692 | |
| 2693 | DEFUN (show_ip_ospf_interface, |
| 2694 | show_ip_ospf_interface_cmd, |
| 2695 | "show ip ospf interface [INTERFACE]", |
| 2696 | SHOW_STR |
| 2697 | IP_STR |
| 2698 | "OSPF information\n" |
| 2699 | "Interface information\n" |
| 2700 | "Interface name\n") |
| 2701 | { |
| 2702 | struct interface *ifp; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2703 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2704 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2705 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2706 | ospf = ospf_lookup (); |
| 2707 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2708 | /* Show All Interfaces. */ |
| 2709 | if (argc == 0) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2710 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 2711 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2712 | /* Interface name is specified. */ |
| 2713 | else |
| 2714 | { |
| 2715 | if ((ifp = if_lookup_by_name (argv[0])) == NULL) |
| 2716 | vty_out (vty, "No such interface name%s", VTY_NEWLINE); |
| 2717 | else |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2718 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2719 | } |
| 2720 | |
| 2721 | return CMD_SUCCESS; |
| 2722 | } |
| 2723 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2724 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2725 | show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) |
| 2726 | { |
| 2727 | struct route_node *rn; |
| 2728 | struct ospf_neighbor *nbr; |
| 2729 | char msgbuf[16]; |
| 2730 | char timebuf[9]; |
| 2731 | |
| 2732 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 2733 | if ((nbr = rn->info)) |
| 2734 | /* Do not show myself. */ |
| 2735 | if (nbr != oi->nbr_self) |
| 2736 | /* Down state is not shown. */ |
| 2737 | if (nbr->state != NSM_Down) |
| 2738 | { |
| 2739 | ospf_nbr_state_message (nbr, msgbuf, 16); |
| 2740 | |
| 2741 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
| 2742 | vty_out (vty, "%-15s %3d %-15s %8s ", |
| 2743 | "-", nbr->priority, |
| 2744 | msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9)); |
| 2745 | else |
| 2746 | vty_out (vty, "%-15s %3d %-15s %8s ", |
| 2747 | inet_ntoa (nbr->router_id), nbr->priority, |
| 2748 | msgbuf, ospf_timer_dump (nbr->t_inactivity, timebuf, 9)); |
| 2749 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
| 2750 | vty_out (vty, "%-15s %5ld %5ld %5d%s", |
| 2751 | IF_NAME (oi), ospf_ls_retransmit_count (nbr), |
| 2752 | ospf_ls_request_count (nbr), ospf_db_summary_count (nbr), |
| 2753 | VTY_NEWLINE); |
| 2754 | } |
| 2755 | } |
| 2756 | |
| 2757 | DEFUN (show_ip_ospf_neighbor, |
| 2758 | show_ip_ospf_neighbor_cmd, |
| 2759 | "show ip ospf neighbor", |
| 2760 | SHOW_STR |
| 2761 | IP_STR |
| 2762 | "OSPF information\n" |
| 2763 | "Neighbor list\n") |
| 2764 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2765 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2766 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2767 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2768 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2769 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2770 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2771 | { |
| 2772 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2773 | return CMD_SUCCESS; |
| 2774 | } |
| 2775 | |
| 2776 | /* Show All neighbors. */ |
| 2777 | vty_out (vty, "%sNeighbor ID Pri State Dead " |
| 2778 | "Time Address Interface RXmtL " |
| 2779 | "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE); |
| 2780 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2781 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 2782 | show_ip_ospf_neighbor_sub (vty, oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2783 | |
| 2784 | return CMD_SUCCESS; |
| 2785 | } |
| 2786 | |
| 2787 | DEFUN (show_ip_ospf_neighbor_all, |
| 2788 | show_ip_ospf_neighbor_all_cmd, |
| 2789 | "show ip ospf neighbor all", |
| 2790 | SHOW_STR |
| 2791 | IP_STR |
| 2792 | "OSPF information\n" |
| 2793 | "Neighbor list\n" |
| 2794 | "include down status neighbor\n") |
| 2795 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2796 | struct ospf *ospf = vty->index; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2797 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2798 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2799 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2800 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2801 | { |
| 2802 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2803 | return CMD_SUCCESS; |
| 2804 | } |
| 2805 | |
| 2806 | /* Show All neighbors. */ |
| 2807 | vty_out (vty, "%sNeighbor ID Pri State Dead " |
| 2808 | "Time Address Interface RXmtL " |
| 2809 | "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE); |
| 2810 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2811 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2812 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2813 | struct listnode *nbr_node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2814 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2815 | |
| 2816 | show_ip_ospf_neighbor_sub (vty, oi); |
| 2817 | |
| 2818 | /* print Down neighbor status */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2819 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2820 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2821 | if (nbr_nbma->nbr == NULL |
| 2822 | || nbr_nbma->nbr->state == NSM_Down) |
| 2823 | { |
| 2824 | vty_out (vty, "%-15s %3d %-15s %8s ", |
| 2825 | "-", nbr_nbma->priority, "Down", "-"); |
| 2826 | vty_out (vty, "%-15s %-15s %5d %5d %5d%s", |
| 2827 | inet_ntoa (nbr_nbma->addr), IF_NAME (oi), |
| 2828 | 0, 0, 0, VTY_NEWLINE); |
| 2829 | } |
| 2830 | } |
| 2831 | } |
| 2832 | |
| 2833 | return CMD_SUCCESS; |
| 2834 | } |
| 2835 | |
| 2836 | DEFUN (show_ip_ospf_neighbor_int, |
| 2837 | show_ip_ospf_neighbor_int_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2838 | "show ip ospf neighbor IFNAME", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2839 | SHOW_STR |
| 2840 | IP_STR |
| 2841 | "OSPF information\n" |
| 2842 | "Neighbor list\n" |
| 2843 | "Interface name\n") |
| 2844 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2845 | struct ospf *ospf; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2846 | struct interface *ifp; |
| 2847 | struct route_node *rn; |
| 2848 | |
| 2849 | ifp = if_lookup_by_name (argv[0]); |
| 2850 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2851 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2852 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2853 | return CMD_WARNING; |
| 2854 | } |
| 2855 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2856 | ospf = ospf_lookup (); |
| 2857 | if (ospf == NULL) |
| 2858 | { |
| 2859 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2860 | return CMD_SUCCESS; |
| 2861 | } |
| 2862 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2863 | vty_out (vty, "%sNeighbor ID Pri State Dead " |
| 2864 | "Time Address Interface RXmtL " |
| 2865 | "RqstL DBsmL%s", VTY_NEWLINE, VTY_NEWLINE); |
| 2866 | |
| 2867 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2868 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 2869 | struct ospf_interface *oi = rn->info; |
| 2870 | |
| 2871 | if (oi == NULL) |
| 2872 | continue; |
| 2873 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2874 | show_ip_ospf_neighbor_sub (vty, oi); |
| 2875 | } |
| 2876 | |
| 2877 | return CMD_SUCCESS; |
| 2878 | } |
| 2879 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2880 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2881 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 2882 | struct ospf_nbr_nbma *nbr_nbma) |
| 2883 | { |
| 2884 | char timebuf[9]; |
| 2885 | |
| 2886 | /* Show neighbor ID. */ |
| 2887 | vty_out (vty, " Neighbor %s,", "-"); |
| 2888 | |
| 2889 | /* Show interface address. */ |
| 2890 | vty_out (vty, " interface address %s%s", |
| 2891 | inet_ntoa (nbr_nbma->addr), VTY_NEWLINE); |
| 2892 | /* Show Area ID. */ |
| 2893 | vty_out (vty, " In the area %s via interface %s%s", |
| 2894 | ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE); |
| 2895 | /* Show neighbor priority and state. */ |
| 2896 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 2897 | nbr_nbma->priority, "Down"); |
| 2898 | /* Show state changes. */ |
| 2899 | vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE); |
| 2900 | |
| 2901 | /* Show PollInterval */ |
| 2902 | vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE); |
| 2903 | |
| 2904 | /* Show poll-interval timer. */ |
| 2905 | vty_out (vty, " Poll timer due in %s%s", |
| 2906 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, 9), VTY_NEWLINE); |
| 2907 | |
| 2908 | /* Show poll-interval timer thread. */ |
| 2909 | vty_out (vty, " Thread Poll Timer %s%s", |
| 2910 | nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); |
| 2911 | } |
| 2912 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2913 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2914 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 2915 | struct ospf_neighbor *nbr) |
| 2916 | { |
| 2917 | char timebuf[9]; |
| 2918 | |
| 2919 | /* Show neighbor ID. */ |
| 2920 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
| 2921 | vty_out (vty, " Neighbor %s,", "-"); |
| 2922 | else |
| 2923 | vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id)); |
| 2924 | |
| 2925 | /* Show interface address. */ |
| 2926 | vty_out (vty, " interface address %s%s", |
| 2927 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2928 | /* Show Area ID. */ |
| 2929 | vty_out (vty, " In the area %s via interface %s%s", |
| 2930 | ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE); |
| 2931 | /* Show neighbor priority and state. */ |
| 2932 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 2933 | nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state)); |
| 2934 | /* Show state changes. */ |
| 2935 | vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE); |
| 2936 | |
| 2937 | /* Show Designated Rotuer ID. */ |
| 2938 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); |
| 2939 | /* Show Backup Designated Rotuer ID. */ |
| 2940 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); |
| 2941 | /* Show options. */ |
| 2942 | vty_out (vty, " Options %d %s%s", nbr->options, |
| 2943 | ospf_options_dump (nbr->options), VTY_NEWLINE); |
| 2944 | /* Show Router Dead interval timer. */ |
| 2945 | vty_out (vty, " Dead timer due in %s%s", |
| 2946 | ospf_timer_dump (nbr->t_inactivity, timebuf, 9), VTY_NEWLINE); |
| 2947 | /* Show Database Summary list. */ |
| 2948 | vty_out (vty, " Database Summary List %d%s", |
| 2949 | ospf_db_summary_count (nbr), VTY_NEWLINE); |
| 2950 | /* Show Link State Request list. */ |
| 2951 | vty_out (vty, " Link State Request List %ld%s", |
| 2952 | ospf_ls_request_count (nbr), VTY_NEWLINE); |
| 2953 | /* Show Link State Retransmission list. */ |
| 2954 | vty_out (vty, " Link State Retransmission List %ld%s", |
| 2955 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); |
| 2956 | /* Show inactivity timer thread. */ |
| 2957 | vty_out (vty, " Thread Inactivity Timer %s%s", |
| 2958 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); |
| 2959 | /* Show Database Description retransmission thread. */ |
| 2960 | vty_out (vty, " Thread Database Description Retransmision %s%s", |
| 2961 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); |
| 2962 | /* Show Link State Request Retransmission thread. */ |
| 2963 | vty_out (vty, " Thread Link State Request Retransmission %s%s", |
| 2964 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); |
| 2965 | /* Show Link State Update Retransmission thread. */ |
| 2966 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", |
| 2967 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); |
| 2968 | } |
| 2969 | |
| 2970 | DEFUN (show_ip_ospf_neighbor_id, |
| 2971 | show_ip_ospf_neighbor_id_cmd, |
| 2972 | "show ip ospf neighbor A.B.C.D", |
| 2973 | SHOW_STR |
| 2974 | IP_STR |
| 2975 | "OSPF information\n" |
| 2976 | "Neighbor list\n" |
| 2977 | "Neighbor ID\n") |
| 2978 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2979 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2980 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2981 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2982 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2983 | struct in_addr router_id; |
| 2984 | int ret; |
| 2985 | |
| 2986 | ret = inet_aton (argv[0], &router_id); |
| 2987 | if (!ret) |
| 2988 | { |
| 2989 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); |
| 2990 | return CMD_WARNING; |
| 2991 | } |
| 2992 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2993 | ospf = ospf_lookup (); |
| 2994 | if (ospf == NULL) |
| 2995 | { |
| 2996 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2997 | return CMD_SUCCESS; |
| 2998 | } |
| 2999 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3000 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3001 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) |
| 3002 | { |
| 3003 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3004 | return CMD_SUCCESS; |
| 3005 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3006 | |
| 3007 | /* Nothing to show. */ |
| 3008 | return CMD_SUCCESS; |
| 3009 | } |
| 3010 | |
| 3011 | DEFUN (show_ip_ospf_neighbor_detail, |
| 3012 | show_ip_ospf_neighbor_detail_cmd, |
| 3013 | "show ip ospf neighbor detail", |
| 3014 | SHOW_STR |
| 3015 | IP_STR |
| 3016 | "OSPF information\n" |
| 3017 | "Neighbor list\n" |
| 3018 | "detail of all neighbors\n") |
| 3019 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3020 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3021 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3022 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3023 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3024 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3025 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3026 | { |
| 3027 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3028 | return CMD_SUCCESS; |
| 3029 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3030 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3031 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3032 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3033 | struct route_node *rn; |
| 3034 | struct ospf_neighbor *nbr; |
| 3035 | |
| 3036 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3037 | if ((nbr = rn->info)) |
| 3038 | if (nbr != oi->nbr_self) |
| 3039 | if (nbr->state != NSM_Down) |
| 3040 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3041 | } |
| 3042 | |
| 3043 | return CMD_SUCCESS; |
| 3044 | } |
| 3045 | |
| 3046 | DEFUN (show_ip_ospf_neighbor_detail_all, |
| 3047 | show_ip_ospf_neighbor_detail_all_cmd, |
| 3048 | "show ip ospf neighbor detail all", |
| 3049 | SHOW_STR |
| 3050 | IP_STR |
| 3051 | "OSPF information\n" |
| 3052 | "Neighbor list\n" |
| 3053 | "detail of all neighbors\n" |
| 3054 | "include down status neighbor\n") |
| 3055 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3056 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3057 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3058 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3059 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3060 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3061 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3062 | { |
| 3063 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3064 | return CMD_SUCCESS; |
| 3065 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3066 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3067 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3068 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3069 | struct route_node *rn; |
| 3070 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3071 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3072 | |
| 3073 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3074 | if ((nbr = rn->info)) |
| 3075 | if (nbr != oi->nbr_self) |
| 3076 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) |
| 3077 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); |
| 3078 | |
| 3079 | if (oi->type == OSPF_IFTYPE_NBMA) |
| 3080 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3081 | struct listnode *nd; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3082 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3083 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
| 3084 | if (nbr_nbma->nbr == NULL |
| 3085 | || nbr_nbma->nbr->state == NSM_Down) |
| 3086 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3087 | } |
| 3088 | } |
| 3089 | |
| 3090 | return CMD_SUCCESS; |
| 3091 | } |
| 3092 | |
| 3093 | DEFUN (show_ip_ospf_neighbor_int_detail, |
| 3094 | show_ip_ospf_neighbor_int_detail_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3095 | "show ip ospf neighbor IFNAME detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3096 | SHOW_STR |
| 3097 | IP_STR |
| 3098 | "OSPF information\n" |
| 3099 | "Neighbor list\n" |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3100 | "Interface name\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3101 | "detail of all neighbors") |
| 3102 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3103 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3104 | struct ospf_interface *oi; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3105 | struct interface *ifp; |
| 3106 | struct route_node *rn, *nrn; |
| 3107 | struct ospf_neighbor *nbr; |
| 3108 | |
| 3109 | ifp = if_lookup_by_name (argv[0]); |
| 3110 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3111 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3112 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3113 | return CMD_WARNING; |
| 3114 | } |
| 3115 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3116 | ospf = ospf_lookup (); |
| 3117 | if (ospf == NULL) |
| 3118 | { |
| 3119 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3120 | return CMD_SUCCESS; |
| 3121 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3122 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3123 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3124 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 3125 | if ((oi = rn->info)) |
| 3126 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) |
| 3127 | if ((nbr = nrn->info)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3128 | if (nbr != oi->nbr_self) |
| 3129 | if (nbr->state != NSM_Down) |
| 3130 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3131 | |
| 3132 | return CMD_SUCCESS; |
| 3133 | } |
| 3134 | |
| 3135 | |
| 3136 | /* Show functions */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3137 | static int |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3138 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3139 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3140 | struct router_lsa *rl; |
| 3141 | struct summary_lsa *sl; |
| 3142 | struct as_external_lsa *asel; |
| 3143 | struct prefix_ipv4 p; |
| 3144 | |
| 3145 | if (lsa != NULL) |
| 3146 | /* If self option is set, check LSA self flag. */ |
| 3147 | if (self == 0 || IS_LSA_SELF (lsa)) |
| 3148 | { |
| 3149 | /* LSA common part show. */ |
| 3150 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); |
| 3151 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", |
| 3152 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), |
| 3153 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); |
| 3154 | /* LSA specific part show. */ |
| 3155 | switch (lsa->data->type) |
| 3156 | { |
| 3157 | case OSPF_ROUTER_LSA: |
| 3158 | rl = (struct router_lsa *) lsa->data; |
| 3159 | vty_out (vty, " %-d", ntohs (rl->links)); |
| 3160 | break; |
| 3161 | case OSPF_SUMMARY_LSA: |
| 3162 | sl = (struct summary_lsa *) lsa->data; |
| 3163 | |
| 3164 | p.family = AF_INET; |
| 3165 | p.prefix = sl->header.id; |
| 3166 | p.prefixlen = ip_masklen (sl->mask); |
| 3167 | apply_mask_ipv4 (&p); |
| 3168 | |
| 3169 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); |
| 3170 | break; |
| 3171 | case OSPF_AS_EXTERNAL_LSA: |
paul | 551a897 | 2003-05-18 15:22:55 +0000 | [diff] [blame] | 3172 | case OSPF_AS_NSSA_LSA: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3173 | asel = (struct as_external_lsa *) lsa->data; |
| 3174 | |
| 3175 | p.family = AF_INET; |
| 3176 | p.prefix = asel->header.id; |
| 3177 | p.prefixlen = ip_masklen (asel->mask); |
| 3178 | apply_mask_ipv4 (&p); |
| 3179 | |
| 3180 | vty_out (vty, " %s %s/%d [0x%lx]", |
| 3181 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", |
| 3182 | inet_ntoa (p.prefix), p.prefixlen, |
| 3183 | (u_long)ntohl (asel->e[0].route_tag)); |
| 3184 | break; |
| 3185 | case OSPF_NETWORK_LSA: |
| 3186 | case OSPF_ASBR_SUMMARY_LSA: |
| 3187 | #ifdef HAVE_OPAQUE_LSA |
| 3188 | case OSPF_OPAQUE_LINK_LSA: |
| 3189 | case OSPF_OPAQUE_AREA_LSA: |
| 3190 | case OSPF_OPAQUE_AS_LSA: |
| 3191 | #endif /* HAVE_OPAQUE_LSA */ |
| 3192 | default: |
| 3193 | break; |
| 3194 | } |
| 3195 | vty_out (vty, VTY_NEWLINE); |
| 3196 | } |
| 3197 | |
| 3198 | return 0; |
| 3199 | } |
| 3200 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3201 | const char *show_database_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3202 | { |
| 3203 | "unknown", |
| 3204 | "Router Link States", |
| 3205 | "Net Link States", |
| 3206 | "Summary Link States", |
| 3207 | "ASBR-Summary Link States", |
| 3208 | "AS External Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3209 | "Group Membership LSA", |
| 3210 | "NSSA-external Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3211 | #ifdef HAVE_OPAQUE_LSA |
| 3212 | "Type-8 LSA", |
| 3213 | "Link-Local Opaque-LSA", |
| 3214 | "Area-Local Opaque-LSA", |
| 3215 | "AS-external Opaque-LSA", |
| 3216 | #endif /* HAVE_OPAQUE_LSA */ |
| 3217 | }; |
| 3218 | |
| 3219 | #define SHOW_OSPF_COMMON_HEADER \ |
| 3220 | "Link ID ADV Router Age Seq# CkSum" |
| 3221 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3222 | const char *show_database_header[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3223 | { |
| 3224 | "", |
| 3225 | "Link ID ADV Router Age Seq# CkSum Link count", |
| 3226 | "Link ID ADV Router Age Seq# CkSum", |
| 3227 | "Link ID ADV Router Age Seq# CkSum Route", |
| 3228 | "Link ID ADV Router Age Seq# CkSum", |
| 3229 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3230 | " --- header for Group Member ----", |
| 3231 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3232 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3233 | " --- type-8 ---", |
| 3234 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3235 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3236 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3237 | #endif /* HAVE_OPAQUE_LSA */ |
| 3238 | }; |
| 3239 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3240 | const char *show_lsa_flags[] = |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3241 | { |
| 3242 | "Self-originated", |
| 3243 | "Checked", |
| 3244 | "Received", |
| 3245 | "Approved", |
| 3246 | "Discard", |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3247 | "Translated", |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3248 | }; |
| 3249 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3250 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3251 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
| 3252 | { |
| 3253 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3254 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3255 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3256 | vty_out (vty, " Options: 0x%-2x : %s%s", |
| 3257 | lsa->data->options, |
| 3258 | ospf_options_dump(lsa->data->options), |
| 3259 | VTY_NEWLINE); |
| 3260 | vty_out (vty, " LS Flags: 0x%-2x %s%s", |
paul | 9d52603 | 2003-06-30 22:46:14 +0000 | [diff] [blame] | 3261 | lsa->flags, |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3262 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
| 3263 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3264 | |
| 3265 | if (lsa->data->type == OSPF_ROUTER_LSA) |
| 3266 | { |
| 3267 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); |
| 3268 | |
| 3269 | if (rlsa->flags) |
| 3270 | vty_out (vty, " :%s%s%s%s", |
| 3271 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", |
| 3272 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", |
| 3273 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", |
| 3274 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); |
| 3275 | |
| 3276 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3277 | } |
| 3278 | vty_out (vty, " LS Type: %s%s", |
| 3279 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3280 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), |
| 3281 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3282 | vty_out (vty, " Advertising Router: %s%s", |
| 3283 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3284 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), |
| 3285 | VTY_NEWLINE); |
| 3286 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), |
| 3287 | VTY_NEWLINE); |
| 3288 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); |
| 3289 | } |
| 3290 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3291 | const char *link_type_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3292 | { |
| 3293 | "(null)", |
| 3294 | "another Router (point-to-point)", |
| 3295 | "a Transit Network", |
| 3296 | "Stub Network", |
| 3297 | "a Virtual Link", |
| 3298 | }; |
| 3299 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3300 | const char *link_id_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3301 | { |
| 3302 | "(null)", |
| 3303 | "Neighboring Router ID", |
| 3304 | "Designated Router address", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3305 | "Net", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3306 | "Neighboring Router ID", |
| 3307 | }; |
| 3308 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3309 | const char *link_data_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3310 | { |
| 3311 | "(null)", |
| 3312 | "Router Interface address", |
| 3313 | "Router Interface address", |
| 3314 | "Network Mask", |
| 3315 | "Router Interface address", |
| 3316 | }; |
| 3317 | |
| 3318 | /* Show router-LSA each Link information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3319 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3320 | show_ip_ospf_database_router_links (struct vty *vty, |
| 3321 | struct router_lsa *rl) |
| 3322 | { |
| 3323 | int len, i, type; |
| 3324 | |
| 3325 | len = ntohs (rl->header.length) - 4; |
| 3326 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) |
| 3327 | { |
| 3328 | type = rl->link[i].type; |
| 3329 | |
| 3330 | vty_out (vty, " Link connected to: %s%s", |
| 3331 | link_type_desc[type], VTY_NEWLINE); |
| 3332 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], |
| 3333 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); |
| 3334 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], |
| 3335 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); |
| 3336 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); |
| 3337 | vty_out (vty, " TOS 0 Metric: %d%s", |
| 3338 | ntohs (rl->link[i].metric), VTY_NEWLINE); |
| 3339 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3340 | } |
| 3341 | } |
| 3342 | |
| 3343 | /* Show router-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3344 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3345 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3346 | { |
| 3347 | if (lsa != NULL) |
| 3348 | { |
| 3349 | struct router_lsa *rl = (struct router_lsa *) lsa->data; |
| 3350 | |
| 3351 | show_ip_ospf_database_header (vty, lsa); |
| 3352 | |
| 3353 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), |
| 3354 | VTY_NEWLINE, VTY_NEWLINE); |
| 3355 | |
| 3356 | show_ip_ospf_database_router_links (vty, rl); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3357 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3358 | } |
| 3359 | |
| 3360 | return 0; |
| 3361 | } |
| 3362 | |
| 3363 | /* Show network-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3364 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3365 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3366 | { |
| 3367 | int length, i; |
| 3368 | |
| 3369 | if (lsa != NULL) |
| 3370 | { |
| 3371 | struct network_lsa *nl = (struct network_lsa *) lsa->data; |
| 3372 | |
| 3373 | show_ip_ospf_database_header (vty, lsa); |
| 3374 | |
| 3375 | vty_out (vty, " Network Mask: /%d%s", |
| 3376 | ip_masklen (nl->mask), VTY_NEWLINE); |
| 3377 | |
| 3378 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; |
| 3379 | |
| 3380 | for (i = 0; length > 0; i++, length -= 4) |
| 3381 | vty_out (vty, " Attached Router: %s%s", |
| 3382 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); |
| 3383 | |
| 3384 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3385 | } |
| 3386 | |
| 3387 | return 0; |
| 3388 | } |
| 3389 | |
| 3390 | /* Show summary-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3391 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3392 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3393 | { |
| 3394 | if (lsa != NULL) |
| 3395 | { |
| 3396 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3397 | |
| 3398 | show_ip_ospf_database_header (vty, lsa); |
| 3399 | |
| 3400 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), |
| 3401 | VTY_NEWLINE); |
| 3402 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3403 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3404 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3405 | } |
| 3406 | |
| 3407 | return 0; |
| 3408 | } |
| 3409 | |
| 3410 | /* Show summary-ASBR-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3411 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3412 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3413 | { |
| 3414 | if (lsa != NULL) |
| 3415 | { |
| 3416 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3417 | |
| 3418 | show_ip_ospf_database_header (vty, lsa); |
| 3419 | |
| 3420 | vty_out (vty, " Network Mask: /%d%s", |
| 3421 | ip_masklen (sl->mask), VTY_NEWLINE); |
| 3422 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3423 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3424 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3425 | } |
| 3426 | |
| 3427 | return 0; |
| 3428 | } |
| 3429 | |
| 3430 | /* Show AS-external-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3431 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3432 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3433 | { |
| 3434 | if (lsa != NULL) |
| 3435 | { |
| 3436 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3437 | |
| 3438 | show_ip_ospf_database_header (vty, lsa); |
| 3439 | |
| 3440 | vty_out (vty, " Network Mask: /%d%s", |
| 3441 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3442 | vty_out (vty, " Metric Type: %s%s", |
| 3443 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3444 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3445 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3446 | vty_out (vty, " Metric: %d%s", |
| 3447 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3448 | vty_out (vty, " Forward Address: %s%s", |
| 3449 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3450 | |
| 3451 | vty_out (vty, " External Route Tag: %lu%s%s", |
| 3452 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3453 | } |
| 3454 | |
| 3455 | return 0; |
| 3456 | } |
| 3457 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3458 | /* N.B. This function currently seems to be unused. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3459 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3460 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
| 3461 | { |
| 3462 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3463 | |
| 3464 | /* show_ip_ospf_database_header (vty, lsa); */ |
| 3465 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3466 | zlog_debug( " Network Mask: /%d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3467 | ip_masklen (al->mask), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3468 | zlog_debug( " Metric Type: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3469 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3470 | "2 (Larger than any link state path)" : "1", "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3471 | zlog_debug( " TOS: 0%s", "\n"); |
| 3472 | zlog_debug( " Metric: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3473 | GET_METRIC (al->e[0].metric), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3474 | zlog_debug( " Forward Address: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3475 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
| 3476 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3477 | zlog_debug( " External Route Tag: %u%s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3478 | ntohl (al->e[0].route_tag), "\n", "\n"); |
| 3479 | |
| 3480 | return 0; |
| 3481 | } |
| 3482 | |
| 3483 | /* Show AS-NSSA-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3484 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3485 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3486 | { |
| 3487 | if (lsa != NULL) |
| 3488 | { |
| 3489 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3490 | |
| 3491 | show_ip_ospf_database_header (vty, lsa); |
| 3492 | |
| 3493 | vty_out (vty, " Network Mask: /%d%s", |
| 3494 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3495 | vty_out (vty, " Metric Type: %s%s", |
| 3496 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3497 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3498 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3499 | vty_out (vty, " Metric: %d%s", |
| 3500 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3501 | vty_out (vty, " NSSA: Forward Address: %s%s", |
| 3502 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3503 | |
| 3504 | vty_out (vty, " External Route Tag: %u%s%s", |
| 3505 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3506 | } |
| 3507 | |
| 3508 | return 0; |
| 3509 | } |
| 3510 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3511 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3512 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
| 3513 | { |
| 3514 | return 0; |
| 3515 | } |
| 3516 | |
| 3517 | #ifdef HAVE_OPAQUE_LSA |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3518 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3519 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3520 | { |
| 3521 | if (lsa != NULL) |
| 3522 | { |
| 3523 | show_ip_ospf_database_header (vty, lsa); |
| 3524 | show_opaque_info_detail (vty, lsa); |
| 3525 | |
| 3526 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3527 | } |
| 3528 | return 0; |
| 3529 | } |
| 3530 | #endif /* HAVE_OPAQUE_LSA */ |
| 3531 | |
| 3532 | int (*show_function[])(struct vty *, struct ospf_lsa *) = |
| 3533 | { |
| 3534 | NULL, |
| 3535 | show_router_lsa_detail, |
| 3536 | show_network_lsa_detail, |
| 3537 | show_summary_lsa_detail, |
| 3538 | show_summary_asbr_lsa_detail, |
| 3539 | show_as_external_lsa_detail, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3540 | show_func_dummy, |
| 3541 | show_as_nssa_lsa_detail, /* almost same as external */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3542 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3543 | NULL, /* type-8 */ |
| 3544 | show_opaque_lsa_detail, |
| 3545 | show_opaque_lsa_detail, |
| 3546 | show_opaque_lsa_detail, |
| 3547 | #endif /* HAVE_OPAQUE_LSA */ |
| 3548 | }; |
| 3549 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3550 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3551 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
| 3552 | struct in_addr *adv_router) |
| 3553 | { |
| 3554 | memset (lp, 0, sizeof (struct prefix_ls)); |
| 3555 | lp->family = 0; |
| 3556 | if (id == NULL) |
| 3557 | lp->prefixlen = 0; |
| 3558 | else if (adv_router == NULL) |
| 3559 | { |
| 3560 | lp->prefixlen = 32; |
| 3561 | lp->id = *id; |
| 3562 | } |
| 3563 | else |
| 3564 | { |
| 3565 | lp->prefixlen = 64; |
| 3566 | lp->id = *id; |
| 3567 | lp->adv_router = *adv_router; |
| 3568 | } |
| 3569 | } |
| 3570 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3571 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3572 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
| 3573 | struct in_addr *id, struct in_addr *adv_router) |
| 3574 | { |
| 3575 | struct prefix_ls lp; |
| 3576 | struct route_node *rn, *start; |
| 3577 | struct ospf_lsa *lsa; |
| 3578 | |
| 3579 | show_lsa_prefix_set (vty, &lp, id, adv_router); |
| 3580 | start = route_node_get (rt, (struct prefix *) &lp); |
| 3581 | if (start) |
| 3582 | { |
| 3583 | route_lock_node (start); |
| 3584 | for (rn = start; rn; rn = route_next_until (rn, start)) |
| 3585 | if ((lsa = rn->info)) |
| 3586 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3587 | if (show_function[lsa->data->type] != NULL) |
| 3588 | show_function[lsa->data->type] (vty, lsa); |
| 3589 | } |
| 3590 | route_unlock_node (start); |
| 3591 | } |
| 3592 | } |
| 3593 | |
| 3594 | /* Show detail LSA information |
| 3595 | -- if id is NULL then show all LSAs. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3596 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3597 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3598 | struct in_addr *id, struct in_addr *adv_router) |
| 3599 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3600 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3601 | struct ospf_area *area; |
| 3602 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3603 | switch (type) |
| 3604 | { |
| 3605 | case OSPF_AS_EXTERNAL_LSA: |
| 3606 | #ifdef HAVE_OPAQUE_LSA |
| 3607 | case OSPF_OPAQUE_AS_LSA: |
| 3608 | #endif /* HAVE_OPAQUE_LSA */ |
| 3609 | vty_out (vty, " %s %s%s", |
| 3610 | show_database_desc[type], |
| 3611 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3612 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3613 | break; |
| 3614 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3615 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3616 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3617 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3618 | VTY_NEWLINE, show_database_desc[type], |
| 3619 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3620 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); |
| 3621 | } |
| 3622 | break; |
| 3623 | } |
| 3624 | } |
| 3625 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3626 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3627 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
| 3628 | struct in_addr *adv_router) |
| 3629 | { |
| 3630 | struct route_node *rn; |
| 3631 | struct ospf_lsa *lsa; |
| 3632 | |
| 3633 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 3634 | if ((lsa = rn->info)) |
| 3635 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) |
| 3636 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3637 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
| 3638 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3639 | if (show_function[lsa->data->type] != NULL) |
| 3640 | show_function[lsa->data->type] (vty, lsa); |
| 3641 | } |
| 3642 | } |
| 3643 | |
| 3644 | /* Show detail LSA information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3645 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3646 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3647 | struct in_addr *adv_router) |
| 3648 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3649 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3650 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3651 | |
| 3652 | switch (type) |
| 3653 | { |
| 3654 | case OSPF_AS_EXTERNAL_LSA: |
| 3655 | #ifdef HAVE_OPAQUE_LSA |
| 3656 | case OSPF_OPAQUE_AS_LSA: |
| 3657 | #endif /* HAVE_OPAQUE_LSA */ |
| 3658 | vty_out (vty, " %s %s%s", |
| 3659 | show_database_desc[type], |
| 3660 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3661 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3662 | adv_router); |
| 3663 | break; |
| 3664 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3665 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3666 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3667 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3668 | VTY_NEWLINE, show_database_desc[type], |
| 3669 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3670 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), |
| 3671 | adv_router); |
| 3672 | } |
| 3673 | break; |
| 3674 | } |
| 3675 | } |
| 3676 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3677 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3678 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3679 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3680 | struct ospf_lsa *lsa; |
| 3681 | struct route_node *rn; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3682 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3683 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3684 | int type; |
| 3685 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3686 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3687 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3688 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3689 | { |
| 3690 | switch (type) |
| 3691 | { |
| 3692 | case OSPF_AS_EXTERNAL_LSA: |
| 3693 | #ifdef HAVE_OPAQUE_LSA |
| 3694 | case OSPF_OPAQUE_AS_LSA: |
| 3695 | #endif /* HAVE_OPAQUE_LSA */ |
| 3696 | continue; |
| 3697 | default: |
| 3698 | break; |
| 3699 | } |
| 3700 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || |
| 3701 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) |
| 3702 | { |
| 3703 | vty_out (vty, " %s (Area %s)%s%s", |
| 3704 | show_database_desc[type], |
| 3705 | ospf_area_desc_string (area), |
| 3706 | VTY_NEWLINE, VTY_NEWLINE); |
| 3707 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); |
| 3708 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3709 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
| 3710 | show_lsa_summary (vty, lsa, self); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3711 | |
| 3712 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3713 | } |
| 3714 | } |
| 3715 | } |
| 3716 | |
| 3717 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3718 | { |
| 3719 | switch (type) |
| 3720 | { |
| 3721 | case OSPF_AS_EXTERNAL_LSA: |
| 3722 | #ifdef HAVE_OPAQUE_LSA |
| 3723 | case OSPF_OPAQUE_AS_LSA: |
| 3724 | #endif /* HAVE_OPAQUE_LSA */ |
| 3725 | break;; |
| 3726 | default: |
| 3727 | continue; |
| 3728 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3729 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
| 3730 | (!self && ospf_lsdb_count (ospf->lsdb, type))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3731 | { |
| 3732 | vty_out (vty, " %s%s%s", |
| 3733 | show_database_desc[type], |
| 3734 | VTY_NEWLINE, VTY_NEWLINE); |
| 3735 | vty_out (vty, "%s%s", show_database_header[type], |
| 3736 | VTY_NEWLINE); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3737 | |
| 3738 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) |
| 3739 | show_lsa_summary (vty, lsa, self); |
| 3740 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3741 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3742 | } |
| 3743 | } |
| 3744 | |
| 3745 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3746 | } |
| 3747 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3748 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3749 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3750 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3751 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3752 | struct ospf_lsa *lsa; |
| 3753 | |
| 3754 | vty_out (vty, "%s MaxAge Link States:%s%s", |
| 3755 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); |
| 3756 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3757 | for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) |
| 3758 | { |
| 3759 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); |
| 3760 | vty_out (vty, "Link State ID: %s%s", |
| 3761 | inet_ntoa (lsa->data->id), VTY_NEWLINE); |
| 3762 | vty_out (vty, "Advertising Router: %s%s", |
| 3763 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3764 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); |
| 3765 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3766 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3767 | } |
| 3768 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3769 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
| 3770 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3771 | |
| 3772 | #ifdef HAVE_OPAQUE_LSA |
| 3773 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" |
| 3774 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" |
| 3775 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" |
| 3776 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" |
| 3777 | #else /* HAVE_OPAQUE_LSA */ |
| 3778 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" |
| 3779 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" |
| 3780 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" |
| 3781 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" |
| 3782 | #endif /* HAVE_OPAQUE_LSA */ |
| 3783 | |
| 3784 | #define OSPF_LSA_TYPES_CMD_STR \ |
| 3785 | "asbr-summary|external|network|router|summary" \ |
| 3786 | OSPF_LSA_TYPE_NSSA_CMD_STR \ |
| 3787 | OSPF_LSA_TYPE_OPAQUE_CMD_STR |
| 3788 | |
| 3789 | #define OSPF_LSA_TYPES_DESC \ |
| 3790 | "ASBR summary link states\n" \ |
| 3791 | "External link states\n" \ |
| 3792 | "Network link states\n" \ |
| 3793 | "Router link states\n" \ |
| 3794 | "Network summary link states\n" \ |
| 3795 | OSPF_LSA_TYPE_NSSA_DESC \ |
| 3796 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ |
| 3797 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ |
| 3798 | OSPF_LSA_TYPE_OPAQUE_AS_DESC |
| 3799 | |
| 3800 | DEFUN (show_ip_ospf_database, |
| 3801 | show_ip_ospf_database_cmd, |
| 3802 | "show ip ospf database", |
| 3803 | SHOW_STR |
| 3804 | IP_STR |
| 3805 | "OSPF information\n" |
| 3806 | "Database summary\n") |
| 3807 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3808 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3809 | int type, ret; |
| 3810 | struct in_addr id, adv_router; |
| 3811 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3812 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3813 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3814 | return CMD_SUCCESS; |
| 3815 | |
| 3816 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3817 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3818 | |
| 3819 | /* Show all LSA. */ |
| 3820 | if (argc == 0) |
| 3821 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3822 | show_ip_ospf_database_summary (vty, ospf, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3823 | return CMD_SUCCESS; |
| 3824 | } |
| 3825 | |
| 3826 | /* Set database type to show. */ |
| 3827 | if (strncmp (argv[0], "r", 1) == 0) |
| 3828 | type = OSPF_ROUTER_LSA; |
| 3829 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 3830 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3831 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 3832 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3833 | else if (strncmp (argv[0], "su", 2) == 0) |
| 3834 | type = OSPF_SUMMARY_LSA; |
| 3835 | else if (strncmp (argv[0], "a", 1) == 0) |
| 3836 | type = OSPF_ASBR_SUMMARY_LSA; |
| 3837 | else if (strncmp (argv[0], "e", 1) == 0) |
| 3838 | type = OSPF_AS_EXTERNAL_LSA; |
| 3839 | else if (strncmp (argv[0], "se", 2) == 0) |
| 3840 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3841 | show_ip_ospf_database_summary (vty, ospf, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3842 | return CMD_SUCCESS; |
| 3843 | } |
| 3844 | else if (strncmp (argv[0], "m", 1) == 0) |
| 3845 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3846 | show_ip_ospf_database_maxage (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3847 | return CMD_SUCCESS; |
| 3848 | } |
| 3849 | #ifdef HAVE_OPAQUE_LSA |
| 3850 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 3851 | type = OSPF_OPAQUE_LINK_LSA; |
| 3852 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 3853 | type = OSPF_OPAQUE_AREA_LSA; |
| 3854 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 3855 | type = OSPF_OPAQUE_AS_LSA; |
| 3856 | #endif /* HAVE_OPAQUE_LSA */ |
| 3857 | else |
| 3858 | return CMD_WARNING; |
| 3859 | |
| 3860 | /* `show ip ospf database LSA'. */ |
| 3861 | if (argc == 1) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3862 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3863 | else if (argc >= 2) |
| 3864 | { |
| 3865 | ret = inet_aton (argv[1], &id); |
| 3866 | if (!ret) |
| 3867 | return CMD_WARNING; |
| 3868 | |
| 3869 | /* `show ip ospf database LSA ID'. */ |
| 3870 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3871 | show_lsa_detail (vty, ospf, type, &id, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3872 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
| 3873 | else if (argc == 3) |
| 3874 | { |
| 3875 | if (strncmp (argv[2], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3876 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3877 | else |
| 3878 | { |
| 3879 | ret = inet_aton (argv[2], &adv_router); |
| 3880 | if (!ret) |
| 3881 | return CMD_WARNING; |
| 3882 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3883 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3884 | } |
| 3885 | } |
| 3886 | |
| 3887 | return CMD_SUCCESS; |
| 3888 | } |
| 3889 | |
| 3890 | ALIAS (show_ip_ospf_database, |
| 3891 | show_ip_ospf_database_type_cmd, |
| 3892 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", |
| 3893 | SHOW_STR |
| 3894 | IP_STR |
| 3895 | "OSPF information\n" |
| 3896 | "Database summary\n" |
| 3897 | OSPF_LSA_TYPES_DESC |
| 3898 | "LSAs in MaxAge list\n" |
| 3899 | "Self-originated link states\n") |
| 3900 | |
| 3901 | ALIAS (show_ip_ospf_database, |
| 3902 | show_ip_ospf_database_type_id_cmd, |
| 3903 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", |
| 3904 | SHOW_STR |
| 3905 | IP_STR |
| 3906 | "OSPF information\n" |
| 3907 | "Database summary\n" |
| 3908 | OSPF_LSA_TYPES_DESC |
| 3909 | "Link State ID (as an IP address)\n") |
| 3910 | |
| 3911 | ALIAS (show_ip_ospf_database, |
| 3912 | show_ip_ospf_database_type_id_adv_router_cmd, |
| 3913 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", |
| 3914 | SHOW_STR |
| 3915 | IP_STR |
| 3916 | "OSPF information\n" |
| 3917 | "Database summary\n" |
| 3918 | OSPF_LSA_TYPES_DESC |
| 3919 | "Link State ID (as an IP address)\n" |
| 3920 | "Advertising Router link states\n" |
| 3921 | "Advertising Router (as an IP address)\n") |
| 3922 | |
| 3923 | ALIAS (show_ip_ospf_database, |
| 3924 | show_ip_ospf_database_type_id_self_cmd, |
| 3925 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", |
| 3926 | SHOW_STR |
| 3927 | IP_STR |
| 3928 | "OSPF information\n" |
| 3929 | "Database summary\n" |
| 3930 | OSPF_LSA_TYPES_DESC |
| 3931 | "Link State ID (as an IP address)\n" |
| 3932 | "Self-originated link states\n" |
| 3933 | "\n") |
| 3934 | |
| 3935 | DEFUN (show_ip_ospf_database_type_adv_router, |
| 3936 | show_ip_ospf_database_type_adv_router_cmd, |
| 3937 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", |
| 3938 | SHOW_STR |
| 3939 | IP_STR |
| 3940 | "OSPF information\n" |
| 3941 | "Database summary\n" |
| 3942 | OSPF_LSA_TYPES_DESC |
| 3943 | "Advertising Router link states\n" |
| 3944 | "Advertising Router (as an IP address)\n") |
| 3945 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3946 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3947 | int type, ret; |
| 3948 | struct in_addr adv_router; |
| 3949 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3950 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3951 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3952 | return CMD_SUCCESS; |
| 3953 | |
| 3954 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3955 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3956 | |
| 3957 | if (argc != 2) |
| 3958 | return CMD_WARNING; |
| 3959 | |
| 3960 | /* Set database type to show. */ |
| 3961 | if (strncmp (argv[0], "r", 1) == 0) |
| 3962 | type = OSPF_ROUTER_LSA; |
| 3963 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 3964 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3965 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 3966 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3967 | else if (strncmp (argv[0], "s", 1) == 0) |
| 3968 | type = OSPF_SUMMARY_LSA; |
| 3969 | else if (strncmp (argv[0], "a", 1) == 0) |
| 3970 | type = OSPF_ASBR_SUMMARY_LSA; |
| 3971 | else if (strncmp (argv[0], "e", 1) == 0) |
| 3972 | type = OSPF_AS_EXTERNAL_LSA; |
| 3973 | #ifdef HAVE_OPAQUE_LSA |
| 3974 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 3975 | type = OSPF_OPAQUE_LINK_LSA; |
| 3976 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 3977 | type = OSPF_OPAQUE_AREA_LSA; |
| 3978 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 3979 | type = OSPF_OPAQUE_AS_LSA; |
| 3980 | #endif /* HAVE_OPAQUE_LSA */ |
| 3981 | else |
| 3982 | return CMD_WARNING; |
| 3983 | |
| 3984 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ |
| 3985 | if (strncmp (argv[1], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3986 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3987 | else |
| 3988 | { |
| 3989 | ret = inet_aton (argv[1], &adv_router); |
| 3990 | if (!ret) |
| 3991 | return CMD_WARNING; |
| 3992 | } |
| 3993 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3994 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3995 | |
| 3996 | return CMD_SUCCESS; |
| 3997 | } |
| 3998 | |
| 3999 | ALIAS (show_ip_ospf_database_type_adv_router, |
| 4000 | show_ip_ospf_database_type_self_cmd, |
| 4001 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", |
| 4002 | SHOW_STR |
| 4003 | IP_STR |
| 4004 | "OSPF information\n" |
| 4005 | "Database summary\n" |
| 4006 | OSPF_LSA_TYPES_DESC |
| 4007 | "Self-originated link states\n") |
| 4008 | |
| 4009 | |
| 4010 | DEFUN (ip_ospf_authentication_args, |
| 4011 | ip_ospf_authentication_args_addr_cmd, |
| 4012 | "ip ospf authentication (null|message-digest) A.B.C.D", |
| 4013 | "IP Information\n" |
| 4014 | "OSPF interface commands\n" |
| 4015 | "Enable authentication on this interface\n" |
| 4016 | "Use null authentication\n" |
| 4017 | "Use message-digest authentication\n" |
| 4018 | "Address of interface") |
| 4019 | { |
| 4020 | struct interface *ifp; |
| 4021 | struct in_addr addr; |
| 4022 | int ret; |
| 4023 | struct ospf_if_params *params; |
| 4024 | |
| 4025 | ifp = vty->index; |
| 4026 | params = IF_DEF_PARAMS (ifp); |
| 4027 | |
| 4028 | if (argc == 2) |
| 4029 | { |
| 4030 | ret = inet_aton(argv[1], &addr); |
| 4031 | if (!ret) |
| 4032 | { |
| 4033 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4034 | VTY_NEWLINE); |
| 4035 | return CMD_WARNING; |
| 4036 | } |
| 4037 | |
| 4038 | params = ospf_get_if_params (ifp, addr); |
| 4039 | ospf_if_update_params (ifp, addr); |
| 4040 | } |
| 4041 | |
| 4042 | /* Handle null authentication */ |
| 4043 | if ( argv[0][0] == 'n' ) |
| 4044 | { |
| 4045 | SET_IF_PARAM (params, auth_type); |
| 4046 | params->auth_type = OSPF_AUTH_NULL; |
| 4047 | return CMD_SUCCESS; |
| 4048 | } |
| 4049 | |
| 4050 | /* Handle message-digest authentication */ |
| 4051 | if ( argv[0][0] == 'm' ) |
| 4052 | { |
| 4053 | SET_IF_PARAM (params, auth_type); |
| 4054 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 4055 | return CMD_SUCCESS; |
| 4056 | } |
| 4057 | |
| 4058 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); |
| 4059 | return CMD_WARNING; |
| 4060 | } |
| 4061 | |
| 4062 | ALIAS (ip_ospf_authentication_args, |
| 4063 | ip_ospf_authentication_args_cmd, |
| 4064 | "ip ospf authentication (null|message-digest)", |
| 4065 | "IP Information\n" |
| 4066 | "OSPF interface commands\n" |
| 4067 | "Enable authentication on this interface\n" |
| 4068 | "Use null authentication\n" |
| 4069 | "Use message-digest authentication\n") |
| 4070 | |
| 4071 | DEFUN (ip_ospf_authentication, |
| 4072 | ip_ospf_authentication_addr_cmd, |
| 4073 | "ip ospf authentication A.B.C.D", |
| 4074 | "IP Information\n" |
| 4075 | "OSPF interface commands\n" |
| 4076 | "Enable authentication on this interface\n" |
| 4077 | "Address of interface") |
| 4078 | { |
| 4079 | struct interface *ifp; |
| 4080 | struct in_addr addr; |
| 4081 | int ret; |
| 4082 | struct ospf_if_params *params; |
| 4083 | |
| 4084 | ifp = vty->index; |
| 4085 | params = IF_DEF_PARAMS (ifp); |
| 4086 | |
| 4087 | if (argc == 1) |
| 4088 | { |
| 4089 | ret = inet_aton(argv[1], &addr); |
| 4090 | if (!ret) |
| 4091 | { |
| 4092 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4093 | VTY_NEWLINE); |
| 4094 | return CMD_WARNING; |
| 4095 | } |
| 4096 | |
| 4097 | params = ospf_get_if_params (ifp, addr); |
| 4098 | ospf_if_update_params (ifp, addr); |
| 4099 | } |
| 4100 | |
| 4101 | SET_IF_PARAM (params, auth_type); |
| 4102 | params->auth_type = OSPF_AUTH_SIMPLE; |
| 4103 | |
| 4104 | return CMD_SUCCESS; |
| 4105 | } |
| 4106 | |
| 4107 | ALIAS (ip_ospf_authentication, |
| 4108 | ip_ospf_authentication_cmd, |
| 4109 | "ip ospf authentication", |
| 4110 | "IP Information\n" |
| 4111 | "OSPF interface commands\n" |
| 4112 | "Enable authentication on this interface\n") |
| 4113 | |
| 4114 | DEFUN (no_ip_ospf_authentication, |
| 4115 | no_ip_ospf_authentication_addr_cmd, |
| 4116 | "no ip ospf authentication A.B.C.D", |
| 4117 | NO_STR |
| 4118 | "IP Information\n" |
| 4119 | "OSPF interface commands\n" |
| 4120 | "Enable authentication on this interface\n" |
| 4121 | "Address of interface") |
| 4122 | { |
| 4123 | struct interface *ifp; |
| 4124 | struct in_addr addr; |
| 4125 | int ret; |
| 4126 | struct ospf_if_params *params; |
| 4127 | |
| 4128 | ifp = vty->index; |
| 4129 | params = IF_DEF_PARAMS (ifp); |
| 4130 | |
| 4131 | if (argc == 1) |
| 4132 | { |
| 4133 | ret = inet_aton(argv[1], &addr); |
| 4134 | if (!ret) |
| 4135 | { |
| 4136 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4137 | VTY_NEWLINE); |
| 4138 | return CMD_WARNING; |
| 4139 | } |
| 4140 | |
| 4141 | params = ospf_lookup_if_params (ifp, addr); |
| 4142 | if (params == NULL) |
| 4143 | return CMD_SUCCESS; |
| 4144 | } |
| 4145 | |
| 4146 | params->auth_type = OSPF_AUTH_NOTSET; |
| 4147 | UNSET_IF_PARAM (params, auth_type); |
| 4148 | |
| 4149 | if (params != IF_DEF_PARAMS (ifp)) |
| 4150 | { |
| 4151 | ospf_free_if_params (ifp, addr); |
| 4152 | ospf_if_update_params (ifp, addr); |
| 4153 | } |
| 4154 | |
| 4155 | return CMD_SUCCESS; |
| 4156 | } |
| 4157 | |
| 4158 | ALIAS (no_ip_ospf_authentication, |
| 4159 | no_ip_ospf_authentication_cmd, |
| 4160 | "no ip ospf authentication", |
| 4161 | NO_STR |
| 4162 | "IP Information\n" |
| 4163 | "OSPF interface commands\n" |
| 4164 | "Enable authentication on this interface\n") |
| 4165 | |
| 4166 | DEFUN (ip_ospf_authentication_key, |
| 4167 | ip_ospf_authentication_key_addr_cmd, |
| 4168 | "ip ospf authentication-key AUTH_KEY A.B.C.D", |
| 4169 | "IP Information\n" |
| 4170 | "OSPF interface commands\n" |
| 4171 | "Authentication password (key)\n" |
| 4172 | "The OSPF password (key)\n" |
| 4173 | "Address of interface") |
| 4174 | { |
| 4175 | struct interface *ifp; |
| 4176 | struct in_addr addr; |
| 4177 | int ret; |
| 4178 | struct ospf_if_params *params; |
| 4179 | |
| 4180 | ifp = vty->index; |
| 4181 | params = IF_DEF_PARAMS (ifp); |
| 4182 | |
| 4183 | if (argc == 2) |
| 4184 | { |
| 4185 | ret = inet_aton(argv[1], &addr); |
| 4186 | if (!ret) |
| 4187 | { |
| 4188 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4189 | VTY_NEWLINE); |
| 4190 | return CMD_WARNING; |
| 4191 | } |
| 4192 | |
| 4193 | params = ospf_get_if_params (ifp, addr); |
| 4194 | ospf_if_update_params (ifp, addr); |
| 4195 | } |
| 4196 | |
| 4197 | |
| 4198 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4199 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4200 | SET_IF_PARAM (params, auth_simple); |
| 4201 | |
| 4202 | return CMD_SUCCESS; |
| 4203 | } |
| 4204 | |
| 4205 | ALIAS (ip_ospf_authentication_key, |
| 4206 | ip_ospf_authentication_key_cmd, |
| 4207 | "ip ospf authentication-key AUTH_KEY", |
| 4208 | "IP Information\n" |
| 4209 | "OSPF interface commands\n" |
| 4210 | "Authentication password (key)\n" |
| 4211 | "The OSPF password (key)") |
| 4212 | |
| 4213 | ALIAS (ip_ospf_authentication_key, |
| 4214 | ospf_authentication_key_cmd, |
| 4215 | "ospf authentication-key AUTH_KEY", |
| 4216 | "OSPF interface commands\n" |
| 4217 | "Authentication password (key)\n" |
| 4218 | "The OSPF password (key)") |
| 4219 | |
| 4220 | DEFUN (no_ip_ospf_authentication_key, |
| 4221 | no_ip_ospf_authentication_key_addr_cmd, |
| 4222 | "no ip ospf authentication-key A.B.C.D", |
| 4223 | NO_STR |
| 4224 | "IP Information\n" |
| 4225 | "OSPF interface commands\n" |
| 4226 | "Authentication password (key)\n" |
| 4227 | "Address of interface") |
| 4228 | { |
| 4229 | struct interface *ifp; |
| 4230 | struct in_addr addr; |
| 4231 | int ret; |
| 4232 | struct ospf_if_params *params; |
| 4233 | |
| 4234 | ifp = vty->index; |
| 4235 | params = IF_DEF_PARAMS (ifp); |
| 4236 | |
| 4237 | if (argc == 2) |
| 4238 | { |
| 4239 | ret = inet_aton(argv[1], &addr); |
| 4240 | if (!ret) |
| 4241 | { |
| 4242 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4243 | VTY_NEWLINE); |
| 4244 | return CMD_WARNING; |
| 4245 | } |
| 4246 | |
| 4247 | params = ospf_lookup_if_params (ifp, addr); |
| 4248 | if (params == NULL) |
| 4249 | return CMD_SUCCESS; |
| 4250 | } |
| 4251 | |
| 4252 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); |
| 4253 | UNSET_IF_PARAM (params, auth_simple); |
| 4254 | |
| 4255 | if (params != IF_DEF_PARAMS (ifp)) |
| 4256 | { |
| 4257 | ospf_free_if_params (ifp, addr); |
| 4258 | ospf_if_update_params (ifp, addr); |
| 4259 | } |
| 4260 | |
| 4261 | return CMD_SUCCESS; |
| 4262 | } |
| 4263 | |
| 4264 | ALIAS (no_ip_ospf_authentication_key, |
| 4265 | no_ip_ospf_authentication_key_cmd, |
| 4266 | "no ip ospf authentication-key", |
| 4267 | NO_STR |
| 4268 | "IP Information\n" |
| 4269 | "OSPF interface commands\n" |
| 4270 | "Authentication password (key)\n") |
| 4271 | |
| 4272 | ALIAS (no_ip_ospf_authentication_key, |
| 4273 | no_ospf_authentication_key_cmd, |
| 4274 | "no ospf authentication-key", |
| 4275 | NO_STR |
| 4276 | "OSPF interface commands\n" |
| 4277 | "Authentication password (key)\n") |
| 4278 | |
| 4279 | DEFUN (ip_ospf_message_digest_key, |
| 4280 | ip_ospf_message_digest_key_addr_cmd, |
| 4281 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", |
| 4282 | "IP Information\n" |
| 4283 | "OSPF interface commands\n" |
| 4284 | "Message digest authentication password (key)\n" |
| 4285 | "Key ID\n" |
| 4286 | "Use MD5 algorithm\n" |
| 4287 | "The OSPF password (key)" |
| 4288 | "Address of interface") |
| 4289 | { |
| 4290 | struct interface *ifp; |
| 4291 | struct crypt_key *ck; |
| 4292 | u_char key_id; |
| 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 == 3) |
| 4301 | { |
| 4302 | ret = inet_aton(argv[2], &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 | key_id = strtol (argv[0], NULL, 10); |
| 4315 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) |
| 4316 | { |
| 4317 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); |
| 4318 | return CMD_WARNING; |
| 4319 | } |
| 4320 | |
| 4321 | ck = ospf_crypt_key_new (); |
| 4322 | ck->key_id = (u_char) key_id; |
| 4323 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4324 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4325 | |
| 4326 | ospf_crypt_key_add (params->auth_crypt, ck); |
| 4327 | SET_IF_PARAM (params, auth_crypt); |
| 4328 | |
| 4329 | return CMD_SUCCESS; |
| 4330 | } |
| 4331 | |
| 4332 | ALIAS (ip_ospf_message_digest_key, |
| 4333 | ip_ospf_message_digest_key_cmd, |
| 4334 | "ip ospf message-digest-key <1-255> md5 KEY", |
| 4335 | "IP Information\n" |
| 4336 | "OSPF interface commands\n" |
| 4337 | "Message digest authentication password (key)\n" |
| 4338 | "Key ID\n" |
| 4339 | "Use MD5 algorithm\n" |
| 4340 | "The OSPF password (key)") |
| 4341 | |
| 4342 | ALIAS (ip_ospf_message_digest_key, |
| 4343 | ospf_message_digest_key_cmd, |
| 4344 | "ospf message-digest-key <1-255> md5 KEY", |
| 4345 | "OSPF interface commands\n" |
| 4346 | "Message digest authentication password (key)\n" |
| 4347 | "Key ID\n" |
| 4348 | "Use MD5 algorithm\n" |
| 4349 | "The OSPF password (key)") |
| 4350 | |
| 4351 | DEFUN (no_ip_ospf_message_digest_key, |
| 4352 | no_ip_ospf_message_digest_key_addr_cmd, |
| 4353 | "no ip ospf message-digest-key <1-255> A.B.C.D", |
| 4354 | NO_STR |
| 4355 | "IP Information\n" |
| 4356 | "OSPF interface commands\n" |
| 4357 | "Message digest authentication password (key)\n" |
| 4358 | "Key ID\n" |
| 4359 | "Address of interface") |
| 4360 | { |
| 4361 | struct interface *ifp; |
| 4362 | struct crypt_key *ck; |
| 4363 | int key_id; |
| 4364 | struct in_addr addr; |
| 4365 | int ret; |
| 4366 | struct ospf_if_params *params; |
| 4367 | |
| 4368 | ifp = vty->index; |
| 4369 | params = IF_DEF_PARAMS (ifp); |
| 4370 | |
| 4371 | if (argc == 2) |
| 4372 | { |
| 4373 | ret = inet_aton(argv[1], &addr); |
| 4374 | if (!ret) |
| 4375 | { |
| 4376 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4377 | VTY_NEWLINE); |
| 4378 | return CMD_WARNING; |
| 4379 | } |
| 4380 | |
| 4381 | params = ospf_lookup_if_params (ifp, addr); |
| 4382 | if (params == NULL) |
| 4383 | return CMD_SUCCESS; |
| 4384 | } |
| 4385 | |
| 4386 | key_id = strtol (argv[0], NULL, 10); |
| 4387 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); |
| 4388 | if (ck == NULL) |
| 4389 | { |
| 4390 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); |
| 4391 | return CMD_WARNING; |
| 4392 | } |
| 4393 | |
| 4394 | ospf_crypt_key_delete (params->auth_crypt, key_id); |
| 4395 | |
| 4396 | if (params != IF_DEF_PARAMS (ifp)) |
| 4397 | { |
| 4398 | ospf_free_if_params (ifp, addr); |
| 4399 | ospf_if_update_params (ifp, addr); |
| 4400 | } |
| 4401 | |
| 4402 | return CMD_SUCCESS; |
| 4403 | } |
| 4404 | |
| 4405 | ALIAS (no_ip_ospf_message_digest_key, |
| 4406 | no_ip_ospf_message_digest_key_cmd, |
| 4407 | "no ip ospf message-digest-key <1-255>", |
| 4408 | NO_STR |
| 4409 | "IP Information\n" |
| 4410 | "OSPF interface commands\n" |
| 4411 | "Message digest authentication password (key)\n" |
| 4412 | "Key ID\n") |
| 4413 | |
| 4414 | ALIAS (no_ip_ospf_message_digest_key, |
| 4415 | no_ospf_message_digest_key_cmd, |
| 4416 | "no ospf message-digest-key <1-255>", |
| 4417 | NO_STR |
| 4418 | "OSPF interface commands\n" |
| 4419 | "Message digest authentication password (key)\n" |
| 4420 | "Key ID\n") |
| 4421 | |
| 4422 | DEFUN (ip_ospf_cost, |
| 4423 | ip_ospf_cost_addr_cmd, |
| 4424 | "ip ospf cost <1-65535> A.B.C.D", |
| 4425 | "IP Information\n" |
| 4426 | "OSPF interface commands\n" |
| 4427 | "Interface cost\n" |
| 4428 | "Cost\n" |
| 4429 | "Address of interface") |
| 4430 | { |
| 4431 | struct interface *ifp = vty->index; |
| 4432 | u_int32_t cost; |
| 4433 | struct in_addr addr; |
| 4434 | int ret; |
| 4435 | struct ospf_if_params *params; |
| 4436 | |
| 4437 | params = IF_DEF_PARAMS (ifp); |
| 4438 | |
| 4439 | cost = strtol (argv[0], NULL, 10); |
| 4440 | |
| 4441 | /* cost range is <1-65535>. */ |
| 4442 | if (cost < 1 || cost > 65535) |
| 4443 | { |
| 4444 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4445 | return CMD_WARNING; |
| 4446 | } |
| 4447 | |
| 4448 | if (argc == 2) |
| 4449 | { |
| 4450 | ret = inet_aton(argv[1], &addr); |
| 4451 | if (!ret) |
| 4452 | { |
| 4453 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4454 | VTY_NEWLINE); |
| 4455 | return CMD_WARNING; |
| 4456 | } |
| 4457 | |
| 4458 | params = ospf_get_if_params (ifp, addr); |
| 4459 | ospf_if_update_params (ifp, addr); |
| 4460 | } |
| 4461 | |
| 4462 | SET_IF_PARAM (params, output_cost_cmd); |
| 4463 | params->output_cost_cmd = cost; |
| 4464 | |
| 4465 | ospf_if_recalculate_output_cost (ifp); |
| 4466 | |
| 4467 | return CMD_SUCCESS; |
| 4468 | } |
| 4469 | |
| 4470 | ALIAS (ip_ospf_cost, |
| 4471 | ip_ospf_cost_cmd, |
| 4472 | "ip ospf cost <1-65535>", |
| 4473 | "IP Information\n" |
| 4474 | "OSPF interface commands\n" |
| 4475 | "Interface cost\n" |
| 4476 | "Cost") |
| 4477 | |
| 4478 | ALIAS (ip_ospf_cost, |
| 4479 | ospf_cost_cmd, |
| 4480 | "ospf cost <1-65535>", |
| 4481 | "OSPF interface commands\n" |
| 4482 | "Interface cost\n" |
| 4483 | "Cost") |
| 4484 | |
| 4485 | DEFUN (no_ip_ospf_cost, |
| 4486 | no_ip_ospf_cost_addr_cmd, |
| 4487 | "no ip ospf cost A.B.C.D", |
| 4488 | NO_STR |
| 4489 | "IP Information\n" |
| 4490 | "OSPF interface commands\n" |
| 4491 | "Interface cost\n" |
| 4492 | "Address of interface") |
| 4493 | { |
| 4494 | struct interface *ifp = vty->index; |
| 4495 | struct in_addr addr; |
| 4496 | int ret; |
| 4497 | struct ospf_if_params *params; |
| 4498 | |
| 4499 | ifp = vty->index; |
| 4500 | params = IF_DEF_PARAMS (ifp); |
| 4501 | |
| 4502 | if (argc == 1) |
| 4503 | { |
| 4504 | ret = inet_aton(argv[0], &addr); |
| 4505 | if (!ret) |
| 4506 | { |
| 4507 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4508 | VTY_NEWLINE); |
| 4509 | return CMD_WARNING; |
| 4510 | } |
| 4511 | |
| 4512 | params = ospf_lookup_if_params (ifp, addr); |
| 4513 | if (params == NULL) |
| 4514 | return CMD_SUCCESS; |
| 4515 | } |
| 4516 | |
| 4517 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4518 | |
| 4519 | if (params != IF_DEF_PARAMS (ifp)) |
| 4520 | { |
| 4521 | ospf_free_if_params (ifp, addr); |
| 4522 | ospf_if_update_params (ifp, addr); |
| 4523 | } |
| 4524 | |
| 4525 | ospf_if_recalculate_output_cost (ifp); |
| 4526 | |
| 4527 | return CMD_SUCCESS; |
| 4528 | } |
| 4529 | |
| 4530 | ALIAS (no_ip_ospf_cost, |
| 4531 | no_ip_ospf_cost_cmd, |
| 4532 | "no ip ospf cost", |
| 4533 | NO_STR |
| 4534 | "IP Information\n" |
| 4535 | "OSPF interface commands\n" |
| 4536 | "Interface cost\n") |
| 4537 | |
| 4538 | ALIAS (no_ip_ospf_cost, |
| 4539 | no_ospf_cost_cmd, |
| 4540 | "no ospf cost", |
| 4541 | NO_STR |
| 4542 | "OSPF interface commands\n" |
| 4543 | "Interface cost\n") |
| 4544 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4545 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4546 | ospf_nbr_timer_update (struct ospf_interface *oi) |
| 4547 | { |
| 4548 | struct route_node *rn; |
| 4549 | struct ospf_neighbor *nbr; |
| 4550 | |
| 4551 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 4552 | if ((nbr = rn->info)) |
| 4553 | { |
| 4554 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); |
| 4555 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4556 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4557 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4558 | } |
| 4559 | } |
| 4560 | |
| 4561 | DEFUN (ip_ospf_dead_interval, |
| 4562 | ip_ospf_dead_interval_addr_cmd, |
| 4563 | "ip ospf dead-interval <1-65535> A.B.C.D", |
| 4564 | "IP Information\n" |
| 4565 | "OSPF interface commands\n" |
| 4566 | "Interval after which a neighbor is declared dead\n" |
| 4567 | "Seconds\n" |
| 4568 | "Address of interface") |
| 4569 | { |
| 4570 | struct interface *ifp = vty->index; |
| 4571 | u_int32_t seconds; |
| 4572 | struct in_addr addr; |
| 4573 | int ret; |
| 4574 | struct ospf_if_params *params; |
| 4575 | struct ospf_interface *oi; |
| 4576 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4577 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4578 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4579 | ospf = ospf_lookup (); |
| 4580 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4581 | params = IF_DEF_PARAMS (ifp); |
| 4582 | |
| 4583 | seconds = strtol (argv[0], NULL, 10); |
| 4584 | |
| 4585 | /* dead_interval range is <1-65535>. */ |
| 4586 | if (seconds < 1 || seconds > 65535) |
| 4587 | { |
| 4588 | vty_out (vty, "Router Dead Interval is invalid%s", VTY_NEWLINE); |
| 4589 | return CMD_WARNING; |
| 4590 | } |
| 4591 | |
| 4592 | if (argc == 2) |
| 4593 | { |
| 4594 | ret = inet_aton(argv[1], &addr); |
| 4595 | if (!ret) |
| 4596 | { |
| 4597 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4598 | VTY_NEWLINE); |
| 4599 | return CMD_WARNING; |
| 4600 | } |
| 4601 | |
| 4602 | params = ospf_get_if_params (ifp, addr); |
| 4603 | ospf_if_update_params (ifp, addr); |
| 4604 | } |
| 4605 | |
| 4606 | SET_IF_PARAM (params, v_wait); |
| 4607 | params->v_wait = seconds; |
| 4608 | |
| 4609 | /* Update timer values in neighbor structure. */ |
| 4610 | if (argc == 2) |
| 4611 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4612 | if (ospf) |
| 4613 | { |
| 4614 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 4615 | if (oi) |
| 4616 | ospf_nbr_timer_update (oi); |
| 4617 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4618 | } |
| 4619 | else |
| 4620 | { |
| 4621 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4622 | if ((oi = rn->info)) |
| 4623 | ospf_nbr_timer_update (oi); |
| 4624 | } |
| 4625 | |
| 4626 | return CMD_SUCCESS; |
| 4627 | } |
| 4628 | |
| 4629 | ALIAS (ip_ospf_dead_interval, |
| 4630 | ip_ospf_dead_interval_cmd, |
| 4631 | "ip ospf dead-interval <1-65535>", |
| 4632 | "IP Information\n" |
| 4633 | "OSPF interface commands\n" |
| 4634 | "Interval after which a neighbor is declared dead\n" |
| 4635 | "Seconds\n") |
| 4636 | |
| 4637 | ALIAS (ip_ospf_dead_interval, |
| 4638 | ospf_dead_interval_cmd, |
| 4639 | "ospf dead-interval <1-65535>", |
| 4640 | "OSPF interface commands\n" |
| 4641 | "Interval after which a neighbor is declared dead\n" |
| 4642 | "Seconds\n") |
| 4643 | |
| 4644 | DEFUN (no_ip_ospf_dead_interval, |
| 4645 | no_ip_ospf_dead_interval_addr_cmd, |
| 4646 | "no ip ospf dead-interval A.B.C.D", |
| 4647 | NO_STR |
| 4648 | "IP Information\n" |
| 4649 | "OSPF interface commands\n" |
| 4650 | "Interval after which a neighbor is declared dead\n" |
| 4651 | "Address of interface") |
| 4652 | { |
| 4653 | struct interface *ifp = vty->index; |
| 4654 | struct in_addr addr; |
| 4655 | int ret; |
| 4656 | struct ospf_if_params *params; |
| 4657 | struct ospf_interface *oi; |
| 4658 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4659 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4660 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4661 | ospf = ospf_lookup (); |
| 4662 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4663 | ifp = vty->index; |
| 4664 | params = IF_DEF_PARAMS (ifp); |
| 4665 | |
| 4666 | if (argc == 1) |
| 4667 | { |
| 4668 | ret = inet_aton(argv[0], &addr); |
| 4669 | if (!ret) |
| 4670 | { |
| 4671 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4672 | VTY_NEWLINE); |
| 4673 | return CMD_WARNING; |
| 4674 | } |
| 4675 | |
| 4676 | params = ospf_lookup_if_params (ifp, addr); |
| 4677 | if (params == NULL) |
| 4678 | return CMD_SUCCESS; |
| 4679 | } |
| 4680 | |
| 4681 | UNSET_IF_PARAM (params, v_wait); |
| 4682 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 4683 | |
| 4684 | if (params != IF_DEF_PARAMS (ifp)) |
| 4685 | { |
| 4686 | ospf_free_if_params (ifp, addr); |
| 4687 | ospf_if_update_params (ifp, addr); |
| 4688 | } |
| 4689 | |
| 4690 | /* Update timer values in neighbor structure. */ |
| 4691 | if (argc == 1) |
| 4692 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4693 | if (ospf) |
| 4694 | { |
| 4695 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 4696 | if (oi) |
| 4697 | ospf_nbr_timer_update (oi); |
| 4698 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4699 | } |
| 4700 | else |
| 4701 | { |
| 4702 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4703 | if ((oi = rn->info)) |
| 4704 | ospf_nbr_timer_update (oi); |
| 4705 | } |
| 4706 | |
| 4707 | return CMD_SUCCESS; |
| 4708 | } |
| 4709 | |
| 4710 | ALIAS (no_ip_ospf_dead_interval, |
| 4711 | no_ip_ospf_dead_interval_cmd, |
| 4712 | "no ip ospf dead-interval", |
| 4713 | NO_STR |
| 4714 | "IP Information\n" |
| 4715 | "OSPF interface commands\n" |
| 4716 | "Interval after which a neighbor is declared dead\n") |
| 4717 | |
| 4718 | ALIAS (no_ip_ospf_dead_interval, |
| 4719 | no_ospf_dead_interval_cmd, |
| 4720 | "no ospf dead-interval", |
| 4721 | NO_STR |
| 4722 | "OSPF interface commands\n" |
| 4723 | "Interval after which a neighbor is declared dead\n") |
| 4724 | |
| 4725 | DEFUN (ip_ospf_hello_interval, |
| 4726 | ip_ospf_hello_interval_addr_cmd, |
| 4727 | "ip ospf hello-interval <1-65535> A.B.C.D", |
| 4728 | "IP Information\n" |
| 4729 | "OSPF interface commands\n" |
| 4730 | "Time between HELLO packets\n" |
| 4731 | "Seconds\n" |
| 4732 | "Address of interface") |
| 4733 | { |
| 4734 | struct interface *ifp = vty->index; |
| 4735 | u_int32_t seconds; |
| 4736 | struct in_addr addr; |
| 4737 | int ret; |
| 4738 | struct ospf_if_params *params; |
| 4739 | |
| 4740 | params = IF_DEF_PARAMS (ifp); |
| 4741 | |
| 4742 | seconds = strtol (argv[0], NULL, 10); |
| 4743 | |
| 4744 | /* HelloInterval range is <1-65535>. */ |
| 4745 | if (seconds < 1 || seconds > 65535) |
| 4746 | { |
| 4747 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); |
| 4748 | return CMD_WARNING; |
| 4749 | } |
| 4750 | |
| 4751 | if (argc == 2) |
| 4752 | { |
| 4753 | ret = inet_aton(argv[1], &addr); |
| 4754 | if (!ret) |
| 4755 | { |
| 4756 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4757 | VTY_NEWLINE); |
| 4758 | return CMD_WARNING; |
| 4759 | } |
| 4760 | |
| 4761 | params = ospf_get_if_params (ifp, addr); |
| 4762 | ospf_if_update_params (ifp, addr); |
| 4763 | } |
| 4764 | |
| 4765 | SET_IF_PARAM (params, v_hello); |
| 4766 | params->v_hello = seconds; |
| 4767 | |
| 4768 | return CMD_SUCCESS; |
| 4769 | } |
| 4770 | |
| 4771 | ALIAS (ip_ospf_hello_interval, |
| 4772 | ip_ospf_hello_interval_cmd, |
| 4773 | "ip ospf hello-interval <1-65535>", |
| 4774 | "IP Information\n" |
| 4775 | "OSPF interface commands\n" |
| 4776 | "Time between HELLO packets\n" |
| 4777 | "Seconds\n") |
| 4778 | |
| 4779 | ALIAS (ip_ospf_hello_interval, |
| 4780 | ospf_hello_interval_cmd, |
| 4781 | "ospf hello-interval <1-65535>", |
| 4782 | "OSPF interface commands\n" |
| 4783 | "Time between HELLO packets\n" |
| 4784 | "Seconds\n") |
| 4785 | |
| 4786 | DEFUN (no_ip_ospf_hello_interval, |
| 4787 | no_ip_ospf_hello_interval_addr_cmd, |
| 4788 | "no ip ospf hello-interval A.B.C.D", |
| 4789 | NO_STR |
| 4790 | "IP Information\n" |
| 4791 | "OSPF interface commands\n" |
| 4792 | "Time between HELLO packets\n" |
| 4793 | "Address of interface") |
| 4794 | { |
| 4795 | struct interface *ifp = vty->index; |
| 4796 | struct in_addr addr; |
| 4797 | int ret; |
| 4798 | struct ospf_if_params *params; |
| 4799 | |
| 4800 | ifp = vty->index; |
| 4801 | params = IF_DEF_PARAMS (ifp); |
| 4802 | |
| 4803 | if (argc == 1) |
| 4804 | { |
| 4805 | ret = inet_aton(argv[0], &addr); |
| 4806 | if (!ret) |
| 4807 | { |
| 4808 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4809 | VTY_NEWLINE); |
| 4810 | return CMD_WARNING; |
| 4811 | } |
| 4812 | |
| 4813 | params = ospf_lookup_if_params (ifp, addr); |
| 4814 | if (params == NULL) |
| 4815 | return CMD_SUCCESS; |
| 4816 | } |
| 4817 | |
| 4818 | UNSET_IF_PARAM (params, v_hello); |
| 4819 | params->v_hello = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 4820 | |
| 4821 | if (params != IF_DEF_PARAMS (ifp)) |
| 4822 | { |
| 4823 | ospf_free_if_params (ifp, addr); |
| 4824 | ospf_if_update_params (ifp, addr); |
| 4825 | } |
| 4826 | |
| 4827 | return CMD_SUCCESS; |
| 4828 | } |
| 4829 | |
| 4830 | ALIAS (no_ip_ospf_hello_interval, |
| 4831 | no_ip_ospf_hello_interval_cmd, |
| 4832 | "no ip ospf hello-interval", |
| 4833 | NO_STR |
| 4834 | "IP Information\n" |
| 4835 | "OSPF interface commands\n" |
| 4836 | "Time between HELLO packets\n") |
| 4837 | |
| 4838 | ALIAS (no_ip_ospf_hello_interval, |
| 4839 | no_ospf_hello_interval_cmd, |
| 4840 | "no ospf hello-interval", |
| 4841 | NO_STR |
| 4842 | "OSPF interface commands\n" |
| 4843 | "Time between HELLO packets\n") |
| 4844 | |
| 4845 | DEFUN (ip_ospf_network, |
| 4846 | ip_ospf_network_cmd, |
| 4847 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 4848 | "IP Information\n" |
| 4849 | "OSPF interface commands\n" |
| 4850 | "Network type\n" |
| 4851 | "Specify OSPF broadcast multi-access network\n" |
| 4852 | "Specify OSPF NBMA network\n" |
| 4853 | "Specify OSPF point-to-multipoint network\n" |
| 4854 | "Specify OSPF point-to-point network\n") |
| 4855 | { |
| 4856 | struct interface *ifp = vty->index; |
| 4857 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 4858 | struct route_node *rn; |
| 4859 | |
| 4860 | if (strncmp (argv[0], "b", 1) == 0) |
| 4861 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; |
| 4862 | else if (strncmp (argv[0], "n", 1) == 0) |
| 4863 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; |
| 4864 | else if (strncmp (argv[0], "point-to-m", 10) == 0) |
| 4865 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; |
| 4866 | else if (strncmp (argv[0], "point-to-p", 10) == 0) |
| 4867 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; |
| 4868 | |
| 4869 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 4870 | return CMD_SUCCESS; |
| 4871 | |
| 4872 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); |
| 4873 | |
| 4874 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4875 | { |
| 4876 | struct ospf_interface *oi = rn->info; |
| 4877 | |
| 4878 | if (!oi) |
| 4879 | continue; |
| 4880 | |
| 4881 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 4882 | |
| 4883 | if (oi->state > ISM_Down) |
| 4884 | { |
| 4885 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 4886 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 4887 | } |
| 4888 | } |
| 4889 | |
| 4890 | return CMD_SUCCESS; |
| 4891 | } |
| 4892 | |
| 4893 | ALIAS (ip_ospf_network, |
| 4894 | ospf_network_cmd, |
| 4895 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 4896 | "OSPF interface commands\n" |
| 4897 | "Network type\n" |
| 4898 | "Specify OSPF broadcast multi-access network\n" |
| 4899 | "Specify OSPF NBMA network\n" |
| 4900 | "Specify OSPF point-to-multipoint network\n" |
| 4901 | "Specify OSPF point-to-point network\n") |
| 4902 | |
| 4903 | DEFUN (no_ip_ospf_network, |
| 4904 | no_ip_ospf_network_cmd, |
| 4905 | "no ip ospf network", |
| 4906 | NO_STR |
| 4907 | "IP Information\n" |
| 4908 | "OSPF interface commands\n" |
| 4909 | "Network type\n") |
| 4910 | { |
| 4911 | struct interface *ifp = vty->index; |
| 4912 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 4913 | struct route_node *rn; |
| 4914 | |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 4915 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4916 | |
| 4917 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 4918 | return CMD_SUCCESS; |
| 4919 | |
| 4920 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4921 | { |
| 4922 | struct ospf_interface *oi = rn->info; |
| 4923 | |
| 4924 | if (!oi) |
| 4925 | continue; |
| 4926 | |
| 4927 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 4928 | |
| 4929 | if (oi->state > ISM_Down) |
| 4930 | { |
| 4931 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 4932 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 4933 | } |
| 4934 | } |
| 4935 | |
| 4936 | return CMD_SUCCESS; |
| 4937 | } |
| 4938 | |
| 4939 | ALIAS (no_ip_ospf_network, |
| 4940 | no_ospf_network_cmd, |
| 4941 | "no ospf network", |
| 4942 | NO_STR |
| 4943 | "OSPF interface commands\n" |
| 4944 | "Network type\n") |
| 4945 | |
| 4946 | DEFUN (ip_ospf_priority, |
| 4947 | ip_ospf_priority_addr_cmd, |
| 4948 | "ip ospf priority <0-255> A.B.C.D", |
| 4949 | "IP Information\n" |
| 4950 | "OSPF interface commands\n" |
| 4951 | "Router priority\n" |
| 4952 | "Priority\n" |
| 4953 | "Address of interface") |
| 4954 | { |
| 4955 | struct interface *ifp = vty->index; |
| 4956 | u_int32_t priority; |
| 4957 | struct route_node *rn; |
| 4958 | struct in_addr addr; |
| 4959 | int ret; |
| 4960 | struct ospf_if_params *params; |
| 4961 | |
| 4962 | params = IF_DEF_PARAMS (ifp); |
| 4963 | |
| 4964 | priority = strtol (argv[0], NULL, 10); |
| 4965 | |
| 4966 | /* Router Priority range is <0-255>. */ |
| 4967 | if (priority < 0 || priority > 255) |
| 4968 | { |
| 4969 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); |
| 4970 | return CMD_WARNING; |
| 4971 | } |
| 4972 | |
| 4973 | if (argc == 2) |
| 4974 | { |
| 4975 | ret = inet_aton(argv[1], &addr); |
| 4976 | if (!ret) |
| 4977 | { |
| 4978 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4979 | VTY_NEWLINE); |
| 4980 | return CMD_WARNING; |
| 4981 | } |
| 4982 | |
| 4983 | params = ospf_get_if_params (ifp, addr); |
| 4984 | ospf_if_update_params (ifp, addr); |
| 4985 | } |
| 4986 | |
| 4987 | SET_IF_PARAM (params, priority); |
| 4988 | params->priority = priority; |
| 4989 | |
| 4990 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 4991 | { |
| 4992 | struct ospf_interface *oi = rn->info; |
| 4993 | |
| 4994 | if (!oi) |
| 4995 | continue; |
| 4996 | |
| 4997 | |
| 4998 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 4999 | { |
| 5000 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5001 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5002 | } |
| 5003 | } |
| 5004 | |
| 5005 | return CMD_SUCCESS; |
| 5006 | } |
| 5007 | |
| 5008 | ALIAS (ip_ospf_priority, |
| 5009 | ip_ospf_priority_cmd, |
| 5010 | "ip ospf priority <0-255>", |
| 5011 | "IP Information\n" |
| 5012 | "OSPF interface commands\n" |
| 5013 | "Router priority\n" |
| 5014 | "Priority\n") |
| 5015 | |
| 5016 | ALIAS (ip_ospf_priority, |
| 5017 | ospf_priority_cmd, |
| 5018 | "ospf priority <0-255>", |
| 5019 | "OSPF interface commands\n" |
| 5020 | "Router priority\n" |
| 5021 | "Priority\n") |
| 5022 | |
| 5023 | DEFUN (no_ip_ospf_priority, |
| 5024 | no_ip_ospf_priority_addr_cmd, |
| 5025 | "no ip ospf priority A.B.C.D", |
| 5026 | NO_STR |
| 5027 | "IP Information\n" |
| 5028 | "OSPF interface commands\n" |
| 5029 | "Router priority\n" |
| 5030 | "Address of interface") |
| 5031 | { |
| 5032 | struct interface *ifp = vty->index; |
| 5033 | struct route_node *rn; |
| 5034 | struct in_addr addr; |
| 5035 | int ret; |
| 5036 | struct ospf_if_params *params; |
| 5037 | |
| 5038 | ifp = vty->index; |
| 5039 | params = IF_DEF_PARAMS (ifp); |
| 5040 | |
| 5041 | if (argc == 1) |
| 5042 | { |
| 5043 | ret = inet_aton(argv[0], &addr); |
| 5044 | if (!ret) |
| 5045 | { |
| 5046 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5047 | VTY_NEWLINE); |
| 5048 | return CMD_WARNING; |
| 5049 | } |
| 5050 | |
| 5051 | params = ospf_lookup_if_params (ifp, addr); |
| 5052 | if (params == NULL) |
| 5053 | return CMD_SUCCESS; |
| 5054 | } |
| 5055 | |
| 5056 | UNSET_IF_PARAM (params, priority); |
| 5057 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; |
| 5058 | |
| 5059 | if (params != IF_DEF_PARAMS (ifp)) |
| 5060 | { |
| 5061 | ospf_free_if_params (ifp, addr); |
| 5062 | ospf_if_update_params (ifp, addr); |
| 5063 | } |
| 5064 | |
| 5065 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5066 | { |
| 5067 | struct ospf_interface *oi = rn->info; |
| 5068 | |
| 5069 | if (!oi) |
| 5070 | continue; |
| 5071 | |
| 5072 | |
| 5073 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5074 | { |
| 5075 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5076 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5077 | } |
| 5078 | } |
| 5079 | |
| 5080 | return CMD_SUCCESS; |
| 5081 | } |
| 5082 | |
| 5083 | ALIAS (no_ip_ospf_priority, |
| 5084 | no_ip_ospf_priority_cmd, |
| 5085 | "no ip ospf priority", |
| 5086 | NO_STR |
| 5087 | "IP Information\n" |
| 5088 | "OSPF interface commands\n" |
| 5089 | "Router priority\n") |
| 5090 | |
| 5091 | ALIAS (no_ip_ospf_priority, |
| 5092 | no_ospf_priority_cmd, |
| 5093 | "no ospf priority", |
| 5094 | NO_STR |
| 5095 | "OSPF interface commands\n" |
| 5096 | "Router priority\n") |
| 5097 | |
| 5098 | DEFUN (ip_ospf_retransmit_interval, |
| 5099 | ip_ospf_retransmit_interval_addr_cmd, |
| 5100 | "ip ospf retransmit-interval <3-65535> A.B.C.D", |
| 5101 | "IP Information\n" |
| 5102 | "OSPF interface commands\n" |
| 5103 | "Time between retransmitting lost link state advertisements\n" |
| 5104 | "Seconds\n" |
| 5105 | "Address of interface") |
| 5106 | { |
| 5107 | struct interface *ifp = vty->index; |
| 5108 | u_int32_t seconds; |
| 5109 | struct in_addr addr; |
| 5110 | int ret; |
| 5111 | struct ospf_if_params *params; |
| 5112 | |
| 5113 | params = IF_DEF_PARAMS (ifp); |
| 5114 | seconds = strtol (argv[0], NULL, 10); |
| 5115 | |
| 5116 | /* Retransmit Interval range is <3-65535>. */ |
| 5117 | if (seconds < 3 || seconds > 65535) |
| 5118 | { |
| 5119 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); |
| 5120 | return CMD_WARNING; |
| 5121 | } |
| 5122 | |
| 5123 | |
| 5124 | if (argc == 2) |
| 5125 | { |
| 5126 | ret = inet_aton(argv[1], &addr); |
| 5127 | if (!ret) |
| 5128 | { |
| 5129 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5130 | VTY_NEWLINE); |
| 5131 | return CMD_WARNING; |
| 5132 | } |
| 5133 | |
| 5134 | params = ospf_get_if_params (ifp, addr); |
| 5135 | ospf_if_update_params (ifp, addr); |
| 5136 | } |
| 5137 | |
| 5138 | SET_IF_PARAM (params, retransmit_interval); |
| 5139 | params->retransmit_interval = seconds; |
| 5140 | |
| 5141 | return CMD_SUCCESS; |
| 5142 | } |
| 5143 | |
| 5144 | ALIAS (ip_ospf_retransmit_interval, |
| 5145 | ip_ospf_retransmit_interval_cmd, |
| 5146 | "ip ospf retransmit-interval <3-65535>", |
| 5147 | "IP Information\n" |
| 5148 | "OSPF interface commands\n" |
| 5149 | "Time between retransmitting lost link state advertisements\n" |
| 5150 | "Seconds\n") |
| 5151 | |
| 5152 | ALIAS (ip_ospf_retransmit_interval, |
| 5153 | ospf_retransmit_interval_cmd, |
| 5154 | "ospf retransmit-interval <3-65535>", |
| 5155 | "OSPF interface commands\n" |
| 5156 | "Time between retransmitting lost link state advertisements\n" |
| 5157 | "Seconds\n") |
| 5158 | |
| 5159 | DEFUN (no_ip_ospf_retransmit_interval, |
| 5160 | no_ip_ospf_retransmit_interval_addr_cmd, |
| 5161 | "no ip ospf retransmit-interval A.B.C.D", |
| 5162 | NO_STR |
| 5163 | "IP Information\n" |
| 5164 | "OSPF interface commands\n" |
| 5165 | "Time between retransmitting lost link state advertisements\n" |
| 5166 | "Address of interface") |
| 5167 | { |
| 5168 | struct interface *ifp = vty->index; |
| 5169 | struct in_addr addr; |
| 5170 | int ret; |
| 5171 | struct ospf_if_params *params; |
| 5172 | |
| 5173 | ifp = vty->index; |
| 5174 | params = IF_DEF_PARAMS (ifp); |
| 5175 | |
| 5176 | if (argc == 1) |
| 5177 | { |
| 5178 | ret = inet_aton(argv[0], &addr); |
| 5179 | if (!ret) |
| 5180 | { |
| 5181 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5182 | VTY_NEWLINE); |
| 5183 | return CMD_WARNING; |
| 5184 | } |
| 5185 | |
| 5186 | params = ospf_lookup_if_params (ifp, addr); |
| 5187 | if (params == NULL) |
| 5188 | return CMD_SUCCESS; |
| 5189 | } |
| 5190 | |
| 5191 | UNSET_IF_PARAM (params, retransmit_interval); |
| 5192 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 5193 | |
| 5194 | if (params != IF_DEF_PARAMS (ifp)) |
| 5195 | { |
| 5196 | ospf_free_if_params (ifp, addr); |
| 5197 | ospf_if_update_params (ifp, addr); |
| 5198 | } |
| 5199 | |
| 5200 | return CMD_SUCCESS; |
| 5201 | } |
| 5202 | |
| 5203 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5204 | no_ip_ospf_retransmit_interval_cmd, |
| 5205 | "no ip ospf retransmit-interval", |
| 5206 | NO_STR |
| 5207 | "IP Information\n" |
| 5208 | "OSPF interface commands\n" |
| 5209 | "Time between retransmitting lost link state advertisements\n") |
| 5210 | |
| 5211 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5212 | no_ospf_retransmit_interval_cmd, |
| 5213 | "no ospf retransmit-interval", |
| 5214 | NO_STR |
| 5215 | "OSPF interface commands\n" |
| 5216 | "Time between retransmitting lost link state advertisements\n") |
| 5217 | |
| 5218 | DEFUN (ip_ospf_transmit_delay, |
| 5219 | ip_ospf_transmit_delay_addr_cmd, |
| 5220 | "ip ospf transmit-delay <1-65535> A.B.C.D", |
| 5221 | "IP Information\n" |
| 5222 | "OSPF interface commands\n" |
| 5223 | "Link state transmit delay\n" |
| 5224 | "Seconds\n" |
| 5225 | "Address of interface") |
| 5226 | { |
| 5227 | struct interface *ifp = vty->index; |
| 5228 | u_int32_t seconds; |
| 5229 | struct in_addr addr; |
| 5230 | int ret; |
| 5231 | struct ospf_if_params *params; |
| 5232 | |
| 5233 | params = IF_DEF_PARAMS (ifp); |
| 5234 | seconds = strtol (argv[0], NULL, 10); |
| 5235 | |
| 5236 | /* Transmit Delay range is <1-65535>. */ |
| 5237 | if (seconds < 1 || seconds > 65535) |
| 5238 | { |
| 5239 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); |
| 5240 | return CMD_WARNING; |
| 5241 | } |
| 5242 | |
| 5243 | if (argc == 2) |
| 5244 | { |
| 5245 | ret = inet_aton(argv[1], &addr); |
| 5246 | if (!ret) |
| 5247 | { |
| 5248 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5249 | VTY_NEWLINE); |
| 5250 | return CMD_WARNING; |
| 5251 | } |
| 5252 | |
| 5253 | params = ospf_get_if_params (ifp, addr); |
| 5254 | ospf_if_update_params (ifp, addr); |
| 5255 | } |
| 5256 | |
| 5257 | SET_IF_PARAM (params, transmit_delay); |
| 5258 | params->transmit_delay = seconds; |
| 5259 | |
| 5260 | return CMD_SUCCESS; |
| 5261 | } |
| 5262 | |
| 5263 | ALIAS (ip_ospf_transmit_delay, |
| 5264 | ip_ospf_transmit_delay_cmd, |
| 5265 | "ip ospf transmit-delay <1-65535>", |
| 5266 | "IP Information\n" |
| 5267 | "OSPF interface commands\n" |
| 5268 | "Link state transmit delay\n" |
| 5269 | "Seconds\n") |
| 5270 | |
| 5271 | ALIAS (ip_ospf_transmit_delay, |
| 5272 | ospf_transmit_delay_cmd, |
| 5273 | "ospf transmit-delay <1-65535>", |
| 5274 | "OSPF interface commands\n" |
| 5275 | "Link state transmit delay\n" |
| 5276 | "Seconds\n") |
| 5277 | |
| 5278 | DEFUN (no_ip_ospf_transmit_delay, |
| 5279 | no_ip_ospf_transmit_delay_addr_cmd, |
| 5280 | "no ip ospf transmit-delay A.B.C.D", |
| 5281 | NO_STR |
| 5282 | "IP Information\n" |
| 5283 | "OSPF interface commands\n" |
| 5284 | "Link state transmit delay\n" |
| 5285 | "Address of interface") |
| 5286 | { |
| 5287 | struct interface *ifp = vty->index; |
| 5288 | struct in_addr addr; |
| 5289 | int ret; |
| 5290 | struct ospf_if_params *params; |
| 5291 | |
| 5292 | ifp = vty->index; |
| 5293 | params = IF_DEF_PARAMS (ifp); |
| 5294 | |
| 5295 | if (argc == 1) |
| 5296 | { |
| 5297 | ret = inet_aton(argv[0], &addr); |
| 5298 | if (!ret) |
| 5299 | { |
| 5300 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5301 | VTY_NEWLINE); |
| 5302 | return CMD_WARNING; |
| 5303 | } |
| 5304 | |
| 5305 | params = ospf_lookup_if_params (ifp, addr); |
| 5306 | if (params == NULL) |
| 5307 | return CMD_SUCCESS; |
| 5308 | } |
| 5309 | |
| 5310 | UNSET_IF_PARAM (params, transmit_delay); |
| 5311 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 5312 | |
| 5313 | if (params != IF_DEF_PARAMS (ifp)) |
| 5314 | { |
| 5315 | ospf_free_if_params (ifp, addr); |
| 5316 | ospf_if_update_params (ifp, addr); |
| 5317 | } |
| 5318 | |
| 5319 | return CMD_SUCCESS; |
| 5320 | } |
| 5321 | |
| 5322 | ALIAS (no_ip_ospf_transmit_delay, |
| 5323 | no_ip_ospf_transmit_delay_cmd, |
| 5324 | "no ip ospf transmit-delay", |
| 5325 | NO_STR |
| 5326 | "IP Information\n" |
| 5327 | "OSPF interface commands\n" |
| 5328 | "Link state transmit delay\n") |
| 5329 | |
| 5330 | ALIAS (no_ip_ospf_transmit_delay, |
| 5331 | no_ospf_transmit_delay_cmd, |
| 5332 | "no ospf transmit-delay", |
| 5333 | NO_STR |
| 5334 | "OSPF interface commands\n" |
| 5335 | "Link state transmit delay\n") |
| 5336 | |
| 5337 | |
| 5338 | DEFUN (ospf_redistribute_source_metric_type, |
| 5339 | ospf_redistribute_source_metric_type_routemap_cmd, |
| 5340 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5341 | "Redistribute information from another routing protocol\n" |
| 5342 | "Kernel routes\n" |
| 5343 | "Connected\n" |
| 5344 | "Static routes\n" |
| 5345 | "Routing Information Protocol (RIP)\n" |
| 5346 | "Border Gateway Protocol (BGP)\n" |
| 5347 | "Metric for redistributed routes\n" |
| 5348 | "OSPF default metric\n" |
| 5349 | "OSPF exterior metric type for redistributed routes\n" |
| 5350 | "Set OSPF External Type 1 metrics\n" |
| 5351 | "Set OSPF External Type 2 metrics\n" |
| 5352 | "Route map reference\n" |
| 5353 | "Pointer to route-map entries\n") |
| 5354 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5355 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5356 | int source; |
| 5357 | int type = -1; |
| 5358 | int metric = -1; |
| 5359 | |
| 5360 | /* Get distribute source. */ |
| 5361 | if (!str2distribute_source (argv[0], &source)) |
| 5362 | return CMD_WARNING; |
| 5363 | |
| 5364 | /* Get metric value. */ |
| 5365 | if (argc >= 2) |
| 5366 | if (!str2metric (argv[1], &metric)) |
| 5367 | return CMD_WARNING; |
| 5368 | |
| 5369 | /* Get metric type. */ |
| 5370 | if (argc >= 3) |
| 5371 | if (!str2metric_type (argv[2], &type)) |
| 5372 | return CMD_WARNING; |
| 5373 | |
| 5374 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5375 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5376 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5377 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5378 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5379 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5380 | } |
| 5381 | |
| 5382 | ALIAS (ospf_redistribute_source_metric_type, |
| 5383 | ospf_redistribute_source_metric_type_cmd, |
| 5384 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> metric-type (1|2)", |
| 5385 | "Redistribute information from another routing protocol\n" |
| 5386 | "Kernel routes\n" |
| 5387 | "Connected\n" |
| 5388 | "Static routes\n" |
| 5389 | "Routing Information Protocol (RIP)\n" |
| 5390 | "Border Gateway Protocol (BGP)\n" |
| 5391 | "Metric for redistributed routes\n" |
| 5392 | "OSPF default metric\n" |
| 5393 | "OSPF exterior metric type for redistributed routes\n" |
| 5394 | "Set OSPF External Type 1 metrics\n" |
| 5395 | "Set OSPF External Type 2 metrics\n") |
| 5396 | |
| 5397 | ALIAS (ospf_redistribute_source_metric_type, |
| 5398 | ospf_redistribute_source_metric_cmd, |
| 5399 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214>", |
| 5400 | "Redistribute information from another routing protocol\n" |
| 5401 | "Kernel routes\n" |
| 5402 | "Connected\n" |
| 5403 | "Static routes\n" |
| 5404 | "Routing Information Protocol (RIP)\n" |
| 5405 | "Border Gateway Protocol (BGP)\n" |
| 5406 | "Metric for redistributed routes\n" |
| 5407 | "OSPF default metric\n") |
| 5408 | |
| 5409 | DEFUN (ospf_redistribute_source_type_metric, |
| 5410 | ospf_redistribute_source_type_metric_routemap_cmd, |
| 5411 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5412 | "Redistribute information from another routing protocol\n" |
| 5413 | "Kernel routes\n" |
| 5414 | "Connected\n" |
| 5415 | "Static routes\n" |
| 5416 | "Routing Information Protocol (RIP)\n" |
| 5417 | "Border Gateway Protocol (BGP)\n" |
| 5418 | "OSPF exterior metric type for redistributed routes\n" |
| 5419 | "Set OSPF External Type 1 metrics\n" |
| 5420 | "Set OSPF External Type 2 metrics\n" |
| 5421 | "Metric for redistributed routes\n" |
| 5422 | "OSPF default metric\n" |
| 5423 | "Route map reference\n" |
| 5424 | "Pointer to route-map entries\n") |
| 5425 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5426 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5427 | int source; |
| 5428 | int type = -1; |
| 5429 | int metric = -1; |
| 5430 | |
| 5431 | /* Get distribute source. */ |
| 5432 | if (!str2distribute_source (argv[0], &source)) |
| 5433 | return CMD_WARNING; |
| 5434 | |
| 5435 | /* Get metric value. */ |
| 5436 | if (argc >= 2) |
| 5437 | if (!str2metric_type (argv[1], &type)) |
| 5438 | return CMD_WARNING; |
| 5439 | |
| 5440 | /* Get metric type. */ |
| 5441 | if (argc >= 3) |
| 5442 | if (!str2metric (argv[2], &metric)) |
| 5443 | return CMD_WARNING; |
| 5444 | |
| 5445 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5446 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5447 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5448 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5449 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5450 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5451 | } |
| 5452 | |
| 5453 | ALIAS (ospf_redistribute_source_type_metric, |
| 5454 | ospf_redistribute_source_type_metric_cmd, |
| 5455 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) metric <0-16777214>", |
| 5456 | "Redistribute information from another routing protocol\n" |
| 5457 | "Kernel routes\n" |
| 5458 | "Connected\n" |
| 5459 | "Static routes\n" |
| 5460 | "Routing Information Protocol (RIP)\n" |
| 5461 | "Border Gateway Protocol (BGP)\n" |
| 5462 | "OSPF exterior metric type for redistributed routes\n" |
| 5463 | "Set OSPF External Type 1 metrics\n" |
| 5464 | "Set OSPF External Type 2 metrics\n" |
| 5465 | "Metric for redistributed routes\n" |
| 5466 | "OSPF default metric\n") |
| 5467 | |
| 5468 | ALIAS (ospf_redistribute_source_type_metric, |
| 5469 | ospf_redistribute_source_type_cmd, |
| 5470 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2)", |
| 5471 | "Redistribute information from another routing protocol\n" |
| 5472 | "Kernel routes\n" |
| 5473 | "Connected\n" |
| 5474 | "Static routes\n" |
| 5475 | "Routing Information Protocol (RIP)\n" |
| 5476 | "Border Gateway Protocol (BGP)\n" |
| 5477 | "OSPF exterior metric type for redistributed routes\n" |
| 5478 | "Set OSPF External Type 1 metrics\n" |
| 5479 | "Set OSPF External Type 2 metrics\n") |
| 5480 | |
| 5481 | ALIAS (ospf_redistribute_source_type_metric, |
| 5482 | ospf_redistribute_source_cmd, |
| 5483 | "redistribute (kernel|connected|static|rip|bgp)", |
| 5484 | "Redistribute information from another routing protocol\n" |
| 5485 | "Kernel routes\n" |
| 5486 | "Connected\n" |
| 5487 | "Static routes\n" |
| 5488 | "Routing Information Protocol (RIP)\n" |
| 5489 | "Border Gateway Protocol (BGP)\n") |
| 5490 | |
| 5491 | DEFUN (ospf_redistribute_source_metric_routemap, |
| 5492 | ospf_redistribute_source_metric_routemap_cmd, |
| 5493 | "redistribute (kernel|connected|static|rip|bgp) metric <0-16777214> route-map WORD", |
| 5494 | "Redistribute information from another routing protocol\n" |
| 5495 | "Kernel routes\n" |
| 5496 | "Connected\n" |
| 5497 | "Static routes\n" |
| 5498 | "Routing Information Protocol (RIP)\n" |
| 5499 | "Border Gateway Protocol (BGP)\n" |
| 5500 | "Metric for redistributed routes\n" |
| 5501 | "OSPF default metric\n" |
| 5502 | "Route map reference\n" |
| 5503 | "Pointer to route-map entries\n") |
| 5504 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5505 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5506 | int source; |
| 5507 | int metric = -1; |
| 5508 | |
| 5509 | /* Get distribute source. */ |
| 5510 | if (!str2distribute_source (argv[0], &source)) |
| 5511 | return CMD_WARNING; |
| 5512 | |
| 5513 | /* Get metric value. */ |
| 5514 | if (argc >= 2) |
| 5515 | if (!str2metric (argv[1], &metric)) |
| 5516 | return CMD_WARNING; |
| 5517 | |
| 5518 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5519 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5520 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5521 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5522 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5523 | return ospf_redistribute_set (ospf, source, -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5524 | } |
| 5525 | |
| 5526 | DEFUN (ospf_redistribute_source_type_routemap, |
| 5527 | ospf_redistribute_source_type_routemap_cmd, |
| 5528 | "redistribute (kernel|connected|static|rip|bgp) metric-type (1|2) route-map WORD", |
| 5529 | "Redistribute information from another routing protocol\n" |
| 5530 | "Kernel routes\n" |
| 5531 | "Connected\n" |
| 5532 | "Static routes\n" |
| 5533 | "Routing Information Protocol (RIP)\n" |
| 5534 | "Border Gateway Protocol (BGP)\n" |
| 5535 | "OSPF exterior metric type for redistributed routes\n" |
| 5536 | "Set OSPF External Type 1 metrics\n" |
| 5537 | "Set OSPF External Type 2 metrics\n" |
| 5538 | "Route map reference\n" |
| 5539 | "Pointer to route-map entries\n") |
| 5540 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5541 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5542 | int source; |
| 5543 | int type = -1; |
| 5544 | |
| 5545 | /* Get distribute source. */ |
| 5546 | if (!str2distribute_source (argv[0], &source)) |
| 5547 | return CMD_WARNING; |
| 5548 | |
| 5549 | /* Get metric value. */ |
| 5550 | if (argc >= 2) |
| 5551 | if (!str2metric_type (argv[1], &type)) |
| 5552 | return CMD_WARNING; |
| 5553 | |
| 5554 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5555 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5556 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5557 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5558 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5559 | return ospf_redistribute_set (ospf, source, type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5560 | } |
| 5561 | |
| 5562 | DEFUN (ospf_redistribute_source_routemap, |
| 5563 | ospf_redistribute_source_routemap_cmd, |
| 5564 | "redistribute (kernel|connected|static|rip|bgp) route-map WORD", |
| 5565 | "Redistribute information from another routing protocol\n" |
| 5566 | "Kernel routes\n" |
| 5567 | "Connected\n" |
| 5568 | "Static routes\n" |
| 5569 | "Routing Information Protocol (RIP)\n" |
| 5570 | "Border Gateway Protocol (BGP)\n" |
| 5571 | "Route map reference\n" |
| 5572 | "Pointer to route-map entries\n") |
| 5573 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5574 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5575 | int source; |
| 5576 | |
| 5577 | /* Get distribute source. */ |
| 5578 | if (!str2distribute_source (argv[0], &source)) |
| 5579 | return CMD_WARNING; |
| 5580 | |
| 5581 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5582 | ospf_routemap_set (ospf, source, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5583 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5584 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5585 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5586 | return ospf_redistribute_set (ospf, source, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5587 | } |
| 5588 | |
| 5589 | DEFUN (no_ospf_redistribute_source, |
| 5590 | no_ospf_redistribute_source_cmd, |
| 5591 | "no redistribute (kernel|connected|static|rip|bgp)", |
| 5592 | NO_STR |
| 5593 | "Redistribute information from another routing protocol\n" |
| 5594 | "Kernel routes\n" |
| 5595 | "Connected\n" |
| 5596 | "Static routes\n" |
| 5597 | "Routing Information Protocol (RIP)\n" |
| 5598 | "Border Gateway Protocol (BGP)\n") |
| 5599 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5600 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5601 | int source; |
| 5602 | |
| 5603 | if (!str2distribute_source (argv[0], &source)) |
| 5604 | return CMD_WARNING; |
| 5605 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5606 | ospf_routemap_unset (ospf, source); |
| 5607 | return ospf_redistribute_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5608 | } |
| 5609 | |
| 5610 | DEFUN (ospf_distribute_list_out, |
| 5611 | ospf_distribute_list_out_cmd, |
| 5612 | "distribute-list WORD out (kernel|connected|static|rip|bgp)", |
| 5613 | "Filter networks in routing updates\n" |
| 5614 | "Access-list name\n" |
| 5615 | OUT_STR |
| 5616 | "Kernel routes\n" |
| 5617 | "Connected\n" |
| 5618 | "Static routes\n" |
| 5619 | "Routing Information Protocol (RIP)\n" |
| 5620 | "Border Gateway Protocol (BGP)\n") |
| 5621 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5622 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5623 | int source; |
| 5624 | |
| 5625 | /* Get distribute source. */ |
| 5626 | if (!str2distribute_source (argv[1], &source)) |
| 5627 | return CMD_WARNING; |
| 5628 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5629 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5630 | } |
| 5631 | |
| 5632 | DEFUN (no_ospf_distribute_list_out, |
| 5633 | no_ospf_distribute_list_out_cmd, |
| 5634 | "no distribute-list WORD out (kernel|connected|static|rip|bgp)", |
| 5635 | NO_STR |
| 5636 | "Filter networks in routing updates\n" |
| 5637 | "Access-list name\n" |
| 5638 | OUT_STR |
| 5639 | "Kernel routes\n" |
| 5640 | "Connected\n" |
| 5641 | "Static routes\n" |
| 5642 | "Routing Information Protocol (RIP)\n" |
| 5643 | "Border Gateway Protocol (BGP)\n") |
| 5644 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5645 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5646 | int source; |
| 5647 | |
| 5648 | if (!str2distribute_source (argv[1], &source)) |
| 5649 | return CMD_WARNING; |
| 5650 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5651 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5652 | } |
| 5653 | |
| 5654 | /* Default information originate. */ |
| 5655 | DEFUN (ospf_default_information_originate_metric_type_routemap, |
| 5656 | ospf_default_information_originate_metric_type_routemap_cmd, |
| 5657 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5658 | "Control distribution of default information\n" |
| 5659 | "Distribute a default route\n" |
| 5660 | "OSPF default metric\n" |
| 5661 | "OSPF metric\n" |
| 5662 | "OSPF metric type for default routes\n" |
| 5663 | "Set OSPF External Type 1 metrics\n" |
| 5664 | "Set OSPF External Type 2 metrics\n" |
| 5665 | "Route map reference\n" |
| 5666 | "Pointer to route-map entries\n") |
| 5667 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5668 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5669 | int type = -1; |
| 5670 | int metric = -1; |
| 5671 | |
| 5672 | /* Get metric value. */ |
| 5673 | if (argc >= 1) |
| 5674 | if (!str2metric (argv[0], &metric)) |
| 5675 | return CMD_WARNING; |
| 5676 | |
| 5677 | /* Get metric type. */ |
| 5678 | if (argc >= 2) |
| 5679 | if (!str2metric_type (argv[1], &type)) |
| 5680 | return CMD_WARNING; |
| 5681 | |
| 5682 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5683 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5684 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5685 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5686 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5687 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5688 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5689 | } |
| 5690 | |
| 5691 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5692 | ospf_default_information_originate_metric_type_cmd, |
| 5693 | "default-information originate metric <0-16777214> metric-type (1|2)", |
| 5694 | "Control distribution of default information\n" |
| 5695 | "Distribute a default route\n" |
| 5696 | "OSPF default metric\n" |
| 5697 | "OSPF metric\n" |
| 5698 | "OSPF metric type for default routes\n" |
| 5699 | "Set OSPF External Type 1 metrics\n" |
| 5700 | "Set OSPF External Type 2 metrics\n") |
| 5701 | |
| 5702 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5703 | ospf_default_information_originate_metric_cmd, |
| 5704 | "default-information originate metric <0-16777214>", |
| 5705 | "Control distribution of default information\n" |
| 5706 | "Distribute a default route\n" |
| 5707 | "OSPF default metric\n" |
| 5708 | "OSPF metric\n") |
| 5709 | |
| 5710 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 5711 | ospf_default_information_originate_cmd, |
| 5712 | "default-information originate", |
| 5713 | "Control distribution of default information\n" |
| 5714 | "Distribute a default route\n") |
| 5715 | |
| 5716 | /* Default information originate. */ |
| 5717 | DEFUN (ospf_default_information_originate_metric_routemap, |
| 5718 | ospf_default_information_originate_metric_routemap_cmd, |
| 5719 | "default-information originate metric <0-16777214> route-map WORD", |
| 5720 | "Control distribution of default information\n" |
| 5721 | "Distribute a default route\n" |
| 5722 | "OSPF default metric\n" |
| 5723 | "OSPF metric\n" |
| 5724 | "Route map reference\n" |
| 5725 | "Pointer to route-map entries\n") |
| 5726 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5727 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5728 | int metric = -1; |
| 5729 | |
| 5730 | /* Get metric value. */ |
| 5731 | if (argc >= 1) |
| 5732 | if (!str2metric (argv[0], &metric)) |
| 5733 | return CMD_WARNING; |
| 5734 | |
| 5735 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5736 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5737 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5738 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5739 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5740 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5741 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5742 | } |
| 5743 | |
| 5744 | /* Default information originate. */ |
| 5745 | DEFUN (ospf_default_information_originate_routemap, |
| 5746 | ospf_default_information_originate_routemap_cmd, |
| 5747 | "default-information originate route-map WORD", |
| 5748 | "Control distribution of default information\n" |
| 5749 | "Distribute a default route\n" |
| 5750 | "Route map reference\n" |
| 5751 | "Pointer to route-map entries\n") |
| 5752 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5753 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5754 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5755 | if (argc == 1) |
| 5756 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 5757 | else |
| 5758 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 5759 | |
| 5760 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5761 | } |
| 5762 | |
| 5763 | DEFUN (ospf_default_information_originate_type_metric_routemap, |
| 5764 | ospf_default_information_originate_type_metric_routemap_cmd, |
| 5765 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5766 | "Control distribution of default information\n" |
| 5767 | "Distribute a default route\n" |
| 5768 | "OSPF metric type for default routes\n" |
| 5769 | "Set OSPF External Type 1 metrics\n" |
| 5770 | "Set OSPF External Type 2 metrics\n" |
| 5771 | "OSPF default metric\n" |
| 5772 | "OSPF metric\n" |
| 5773 | "Route map reference\n" |
| 5774 | "Pointer to route-map entries\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 type = -1; |
| 5778 | int metric = -1; |
| 5779 | |
| 5780 | /* Get metric type. */ |
| 5781 | if (argc >= 1) |
| 5782 | if (!str2metric_type (argv[0], &type)) |
| 5783 | return CMD_WARNING; |
| 5784 | |
| 5785 | /* Get metric value. */ |
| 5786 | if (argc >= 2) |
| 5787 | if (!str2metric (argv[1], &metric)) |
| 5788 | return CMD_WARNING; |
| 5789 | |
| 5790 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5791 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5792 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5793 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5794 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5795 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5796 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5797 | } |
| 5798 | |
| 5799 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 5800 | ospf_default_information_originate_type_metric_cmd, |
| 5801 | "default-information originate metric-type (1|2) metric <0-16777214>", |
| 5802 | "Control distribution of default information\n" |
| 5803 | "Distribute a default route\n" |
| 5804 | "OSPF metric type for default routes\n" |
| 5805 | "Set OSPF External Type 1 metrics\n" |
| 5806 | "Set OSPF External Type 2 metrics\n" |
| 5807 | "OSPF default metric\n" |
| 5808 | "OSPF metric\n") |
| 5809 | |
| 5810 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 5811 | ospf_default_information_originate_type_cmd, |
| 5812 | "default-information originate metric-type (1|2)", |
| 5813 | "Control distribution of default information\n" |
| 5814 | "Distribute a default route\n" |
| 5815 | "OSPF metric type for default routes\n" |
| 5816 | "Set OSPF External Type 1 metrics\n" |
| 5817 | "Set OSPF External Type 2 metrics\n") |
| 5818 | |
| 5819 | DEFUN (ospf_default_information_originate_type_routemap, |
| 5820 | ospf_default_information_originate_type_routemap_cmd, |
| 5821 | "default-information originate metric-type (1|2) route-map WORD", |
| 5822 | "Control distribution of default information\n" |
| 5823 | "Distribute a default route\n" |
| 5824 | "OSPF metric type for default routes\n" |
| 5825 | "Set OSPF External Type 1 metrics\n" |
| 5826 | "Set OSPF External Type 2 metrics\n" |
| 5827 | "Route map reference\n" |
| 5828 | "Pointer to route-map entries\n") |
| 5829 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5830 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5831 | int type = -1; |
| 5832 | |
| 5833 | /* Get metric type. */ |
| 5834 | if (argc >= 1) |
| 5835 | if (!str2metric_type (argv[0], &type)) |
| 5836 | return CMD_WARNING; |
| 5837 | |
| 5838 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5839 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5840 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5841 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5842 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5843 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 5844 | type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5845 | } |
| 5846 | |
| 5847 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, |
| 5848 | ospf_default_information_originate_always_metric_type_routemap_cmd, |
| 5849 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5850 | "Control distribution of default information\n" |
| 5851 | "Distribute a default route\n" |
| 5852 | "Always advertise default route\n" |
| 5853 | "OSPF default metric\n" |
| 5854 | "OSPF metric\n" |
| 5855 | "OSPF metric type for default routes\n" |
| 5856 | "Set OSPF External Type 1 metrics\n" |
| 5857 | "Set OSPF External Type 2 metrics\n" |
| 5858 | "Route map reference\n" |
| 5859 | "Pointer to route-map entries\n") |
| 5860 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5861 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5862 | int type = -1; |
| 5863 | int metric = -1; |
| 5864 | |
| 5865 | /* Get metric value. */ |
| 5866 | if (argc >= 1) |
| 5867 | if (!str2metric (argv[0], &metric)) |
| 5868 | return CMD_WARNING; |
| 5869 | |
| 5870 | /* Get metric type. */ |
| 5871 | if (argc >= 2) |
| 5872 | if (!str2metric_type (argv[1], &type)) |
| 5873 | return CMD_WARNING; |
| 5874 | |
| 5875 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5876 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5877 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5878 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5879 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5880 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5881 | type, metric); |
| 5882 | } |
| 5883 | |
| 5884 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 5885 | ospf_default_information_originate_always_metric_type_cmd, |
| 5886 | "default-information originate always metric <0-16777214> metric-type (1|2)", |
| 5887 | "Control distribution of default information\n" |
| 5888 | "Distribute a default route\n" |
| 5889 | "Always advertise default route\n" |
| 5890 | "OSPF default metric\n" |
| 5891 | "OSPF metric\n" |
| 5892 | "OSPF metric type for default routes\n" |
| 5893 | "Set OSPF External Type 1 metrics\n" |
| 5894 | "Set OSPF External Type 2 metrics\n") |
| 5895 | |
| 5896 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 5897 | ospf_default_information_originate_always_metric_cmd, |
| 5898 | "default-information originate always metric <0-16777214>", |
| 5899 | "Control distribution of default information\n" |
| 5900 | "Distribute a default route\n" |
| 5901 | "Always advertise default route\n" |
| 5902 | "OSPF default metric\n" |
| 5903 | "OSPF metric\n" |
| 5904 | "OSPF metric type for default routes\n") |
| 5905 | |
| 5906 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 5907 | ospf_default_information_originate_always_cmd, |
| 5908 | "default-information originate always", |
| 5909 | "Control distribution of default information\n" |
| 5910 | "Distribute a default route\n" |
| 5911 | "Always advertise default route\n") |
| 5912 | |
| 5913 | DEFUN (ospf_default_information_originate_always_metric_routemap, |
| 5914 | ospf_default_information_originate_always_metric_routemap_cmd, |
| 5915 | "default-information originate always metric <0-16777214> route-map WORD", |
| 5916 | "Control distribution of default information\n" |
| 5917 | "Distribute a default route\n" |
| 5918 | "Always advertise default route\n" |
| 5919 | "OSPF default metric\n" |
| 5920 | "OSPF metric\n" |
| 5921 | "Route map reference\n" |
| 5922 | "Pointer to route-map entries\n") |
| 5923 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5924 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5925 | int metric = -1; |
| 5926 | |
| 5927 | /* Get metric value. */ |
| 5928 | if (argc >= 1) |
| 5929 | if (!str2metric (argv[0], &metric)) |
| 5930 | return CMD_WARNING; |
| 5931 | |
| 5932 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5933 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5934 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5935 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5936 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5937 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
| 5938 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5939 | } |
| 5940 | |
| 5941 | DEFUN (ospf_default_information_originate_always_routemap, |
| 5942 | ospf_default_information_originate_always_routemap_cmd, |
| 5943 | "default-information originate always route-map WORD", |
| 5944 | "Control distribution of default information\n" |
| 5945 | "Distribute a default route\n" |
| 5946 | "Always advertise default route\n" |
| 5947 | "Route map reference\n" |
| 5948 | "Pointer to route-map entries\n") |
| 5949 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5950 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5951 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5952 | if (argc == 1) |
| 5953 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 5954 | else |
| 5955 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 5956 | |
| 5957 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5958 | } |
| 5959 | |
| 5960 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, |
| 5961 | ospf_default_information_originate_always_type_metric_routemap_cmd, |
| 5962 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5963 | "Control distribution of default information\n" |
| 5964 | "Distribute a default route\n" |
| 5965 | "Always advertise default route\n" |
| 5966 | "OSPF metric type for default routes\n" |
| 5967 | "Set OSPF External Type 1 metrics\n" |
| 5968 | "Set OSPF External Type 2 metrics\n" |
| 5969 | "OSPF default metric\n" |
| 5970 | "OSPF metric\n" |
| 5971 | "Route map reference\n" |
| 5972 | "Pointer to route-map entries\n") |
| 5973 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5974 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5975 | int type = -1; |
| 5976 | int metric = -1; |
| 5977 | |
| 5978 | /* Get metric type. */ |
| 5979 | if (argc >= 1) |
| 5980 | if (!str2metric_type (argv[0], &type)) |
| 5981 | return CMD_WARNING; |
| 5982 | |
| 5983 | /* Get metric value. */ |
| 5984 | if (argc >= 2) |
| 5985 | if (!str2metric (argv[1], &metric)) |
| 5986 | return CMD_WARNING; |
| 5987 | |
| 5988 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5989 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5990 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5991 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5992 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5993 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5994 | type, metric); |
| 5995 | } |
| 5996 | |
| 5997 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 5998 | ospf_default_information_originate_always_type_metric_cmd, |
| 5999 | "default-information originate always metric-type (1|2) metric <0-16777214>", |
| 6000 | "Control distribution of default information\n" |
| 6001 | "Distribute a default route\n" |
| 6002 | "Always advertise default route\n" |
| 6003 | "OSPF metric type for default routes\n" |
| 6004 | "Set OSPF External Type 1 metrics\n" |
| 6005 | "Set OSPF External Type 2 metrics\n" |
| 6006 | "OSPF default metric\n" |
| 6007 | "OSPF metric\n") |
| 6008 | |
| 6009 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6010 | ospf_default_information_originate_always_type_cmd, |
| 6011 | "default-information originate always metric-type (1|2)", |
| 6012 | "Control distribution of default information\n" |
| 6013 | "Distribute a default route\n" |
| 6014 | "Always advertise default route\n" |
| 6015 | "OSPF metric type for default routes\n" |
| 6016 | "Set OSPF External Type 1 metrics\n" |
| 6017 | "Set OSPF External Type 2 metrics\n") |
| 6018 | |
| 6019 | DEFUN (ospf_default_information_originate_always_type_routemap, |
| 6020 | ospf_default_information_originate_always_type_routemap_cmd, |
| 6021 | "default-information originate always metric-type (1|2) route-map WORD", |
| 6022 | "Control distribution of default information\n" |
| 6023 | "Distribute a default route\n" |
| 6024 | "Always advertise default route\n" |
| 6025 | "OSPF metric type for default routes\n" |
| 6026 | "Set OSPF External Type 1 metrics\n" |
| 6027 | "Set OSPF External Type 2 metrics\n" |
| 6028 | "Route map reference\n" |
| 6029 | "Pointer to route-map entries\n") |
| 6030 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6031 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6032 | int type = -1; |
| 6033 | |
| 6034 | /* Get metric type. */ |
| 6035 | if (argc >= 1) |
| 6036 | if (!str2metric_type (argv[0], &type)) |
| 6037 | return CMD_WARNING; |
| 6038 | |
| 6039 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6040 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6041 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6042 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6043 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6044 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6045 | type, -1); |
| 6046 | } |
| 6047 | |
| 6048 | DEFUN (no_ospf_default_information_originate, |
| 6049 | no_ospf_default_information_originate_cmd, |
| 6050 | "no default-information originate", |
| 6051 | NO_STR |
| 6052 | "Control distribution of default information\n" |
| 6053 | "Distribute a default route\n") |
| 6054 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6055 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6056 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6057 | |
| 6058 | p.family = AF_INET; |
| 6059 | p.prefix.s_addr = 0; |
| 6060 | p.prefixlen = 0; |
| 6061 | |
ajs | 5339cfd | 2005-09-19 13:28:05 +0000 | [diff] [blame] | 6062 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6063 | |
| 6064 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { |
| 6065 | ospf_external_info_delete (DEFAULT_ROUTE, p); |
| 6066 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); |
| 6067 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; |
| 6068 | } |
| 6069 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6070 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6071 | return ospf_redistribute_default_unset (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6072 | } |
| 6073 | |
| 6074 | DEFUN (ospf_default_metric, |
| 6075 | ospf_default_metric_cmd, |
| 6076 | "default-metric <0-16777214>", |
| 6077 | "Set metric of redistributed routes\n" |
| 6078 | "Default metric\n") |
| 6079 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6080 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6081 | int metric = -1; |
| 6082 | |
| 6083 | if (!str2metric (argv[0], &metric)) |
| 6084 | return CMD_WARNING; |
| 6085 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6086 | ospf->default_metric = metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6087 | |
| 6088 | return CMD_SUCCESS; |
| 6089 | } |
| 6090 | |
| 6091 | DEFUN (no_ospf_default_metric, |
| 6092 | no_ospf_default_metric_cmd, |
| 6093 | "no default-metric", |
| 6094 | NO_STR |
| 6095 | "Set metric of redistributed routes\n") |
| 6096 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6097 | struct ospf *ospf = vty->index; |
| 6098 | |
| 6099 | ospf->default_metric = -1; |
| 6100 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6101 | return CMD_SUCCESS; |
| 6102 | } |
| 6103 | |
| 6104 | ALIAS (no_ospf_default_metric, |
| 6105 | no_ospf_default_metric_val_cmd, |
| 6106 | "no default-metric <0-16777214>", |
| 6107 | NO_STR |
| 6108 | "Set metric of redistributed routes\n" |
| 6109 | "Default metric\n") |
| 6110 | |
| 6111 | DEFUN (ospf_distance, |
| 6112 | ospf_distance_cmd, |
| 6113 | "distance <1-255>", |
| 6114 | "Define an administrative distance\n" |
| 6115 | "OSPF Administrative distance\n") |
| 6116 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6117 | struct ospf *ospf = vty->index; |
| 6118 | |
| 6119 | ospf->distance_all = atoi (argv[0]); |
| 6120 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6121 | return CMD_SUCCESS; |
| 6122 | } |
| 6123 | |
| 6124 | DEFUN (no_ospf_distance, |
| 6125 | no_ospf_distance_cmd, |
| 6126 | "no distance <1-255>", |
| 6127 | NO_STR |
| 6128 | "Define an administrative distance\n" |
| 6129 | "OSPF Administrative distance\n") |
| 6130 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6131 | struct ospf *ospf = vty->index; |
| 6132 | |
| 6133 | ospf->distance_all = 0; |
| 6134 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6135 | return CMD_SUCCESS; |
| 6136 | } |
| 6137 | |
| 6138 | DEFUN (no_ospf_distance_ospf, |
| 6139 | no_ospf_distance_ospf_cmd, |
| 6140 | "no distance ospf", |
| 6141 | NO_STR |
| 6142 | "Define an administrative distance\n" |
| 6143 | "OSPF Administrative distance\n" |
| 6144 | "OSPF Distance\n") |
| 6145 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6146 | struct ospf *ospf = vty->index; |
| 6147 | |
| 6148 | ospf->distance_intra = 0; |
| 6149 | ospf->distance_inter = 0; |
| 6150 | ospf->distance_external = 0; |
| 6151 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6152 | return CMD_SUCCESS; |
| 6153 | } |
| 6154 | |
| 6155 | DEFUN (ospf_distance_ospf_intra, |
| 6156 | ospf_distance_ospf_intra_cmd, |
| 6157 | "distance ospf intra-area <1-255>", |
| 6158 | "Define an administrative distance\n" |
| 6159 | "OSPF Administrative distance\n" |
| 6160 | "Intra-area routes\n" |
| 6161 | "Distance for intra-area routes\n") |
| 6162 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6163 | struct ospf *ospf = vty->index; |
| 6164 | |
| 6165 | ospf->distance_intra = atoi (argv[0]); |
| 6166 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6167 | return CMD_SUCCESS; |
| 6168 | } |
| 6169 | |
| 6170 | DEFUN (ospf_distance_ospf_intra_inter, |
| 6171 | ospf_distance_ospf_intra_inter_cmd, |
| 6172 | "distance ospf intra-area <1-255> inter-area <1-255>", |
| 6173 | "Define an administrative distance\n" |
| 6174 | "OSPF Administrative distance\n" |
| 6175 | "Intra-area routes\n" |
| 6176 | "Distance for intra-area routes\n" |
| 6177 | "Inter-area routes\n" |
| 6178 | "Distance for inter-area routes\n") |
| 6179 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6180 | struct ospf *ospf = vty->index; |
| 6181 | |
| 6182 | ospf->distance_intra = atoi (argv[0]); |
| 6183 | ospf->distance_inter = atoi (argv[1]); |
| 6184 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6185 | return CMD_SUCCESS; |
| 6186 | } |
| 6187 | |
| 6188 | DEFUN (ospf_distance_ospf_intra_external, |
| 6189 | ospf_distance_ospf_intra_external_cmd, |
| 6190 | "distance ospf intra-area <1-255> external <1-255>", |
| 6191 | "Define an administrative distance\n" |
| 6192 | "OSPF Administrative distance\n" |
| 6193 | "Intra-area routes\n" |
| 6194 | "Distance for intra-area routes\n" |
| 6195 | "External routes\n" |
| 6196 | "Distance for external routes\n") |
| 6197 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6198 | struct ospf *ospf = vty->index; |
| 6199 | |
| 6200 | ospf->distance_intra = atoi (argv[0]); |
| 6201 | ospf->distance_external = atoi (argv[1]); |
| 6202 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6203 | return CMD_SUCCESS; |
| 6204 | } |
| 6205 | |
| 6206 | DEFUN (ospf_distance_ospf_intra_inter_external, |
| 6207 | ospf_distance_ospf_intra_inter_external_cmd, |
| 6208 | "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>", |
| 6209 | "Define an administrative distance\n" |
| 6210 | "OSPF Administrative distance\n" |
| 6211 | "Intra-area routes\n" |
| 6212 | "Distance for intra-area routes\n" |
| 6213 | "Inter-area routes\n" |
| 6214 | "Distance for inter-area routes\n" |
| 6215 | "External routes\n" |
| 6216 | "Distance for external routes\n") |
| 6217 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6218 | struct ospf *ospf = vty->index; |
| 6219 | |
| 6220 | ospf->distance_intra = atoi (argv[0]); |
| 6221 | ospf->distance_inter = atoi (argv[1]); |
| 6222 | ospf->distance_external = atoi (argv[2]); |
| 6223 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6224 | return CMD_SUCCESS; |
| 6225 | } |
| 6226 | |
| 6227 | DEFUN (ospf_distance_ospf_intra_external_inter, |
| 6228 | ospf_distance_ospf_intra_external_inter_cmd, |
| 6229 | "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>", |
| 6230 | "Define an administrative distance\n" |
| 6231 | "OSPF Administrative distance\n" |
| 6232 | "Intra-area routes\n" |
| 6233 | "Distance for intra-area routes\n" |
| 6234 | "External routes\n" |
| 6235 | "Distance for external routes\n" |
| 6236 | "Inter-area routes\n" |
| 6237 | "Distance for inter-area routes\n") |
| 6238 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6239 | struct ospf *ospf = vty->index; |
| 6240 | |
| 6241 | ospf->distance_intra = atoi (argv[0]); |
| 6242 | ospf->distance_external = atoi (argv[1]); |
| 6243 | ospf->distance_inter = atoi (argv[2]); |
| 6244 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6245 | return CMD_SUCCESS; |
| 6246 | } |
| 6247 | |
| 6248 | DEFUN (ospf_distance_ospf_inter, |
| 6249 | ospf_distance_ospf_inter_cmd, |
| 6250 | "distance ospf inter-area <1-255>", |
| 6251 | "Define an administrative distance\n" |
| 6252 | "OSPF Administrative distance\n" |
| 6253 | "Inter-area routes\n" |
| 6254 | "Distance for inter-area routes\n") |
| 6255 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6256 | struct ospf *ospf = vty->index; |
| 6257 | |
| 6258 | ospf->distance_inter = atoi (argv[0]); |
| 6259 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6260 | return CMD_SUCCESS; |
| 6261 | } |
| 6262 | |
| 6263 | DEFUN (ospf_distance_ospf_inter_intra, |
| 6264 | ospf_distance_ospf_inter_intra_cmd, |
| 6265 | "distance ospf inter-area <1-255> intra-area <1-255>", |
| 6266 | "Define an administrative distance\n" |
| 6267 | "OSPF Administrative distance\n" |
| 6268 | "Inter-area routes\n" |
| 6269 | "Distance for inter-area routes\n" |
| 6270 | "Intra-area routes\n" |
| 6271 | "Distance for intra-area routes\n") |
| 6272 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6273 | struct ospf *ospf = vty->index; |
| 6274 | |
| 6275 | ospf->distance_inter = atoi (argv[0]); |
| 6276 | ospf->distance_intra = atoi (argv[1]); |
| 6277 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6278 | return CMD_SUCCESS; |
| 6279 | } |
| 6280 | |
| 6281 | DEFUN (ospf_distance_ospf_inter_external, |
| 6282 | ospf_distance_ospf_inter_external_cmd, |
| 6283 | "distance ospf inter-area <1-255> external <1-255>", |
| 6284 | "Define an administrative distance\n" |
| 6285 | "OSPF Administrative distance\n" |
| 6286 | "Inter-area routes\n" |
| 6287 | "Distance for inter-area routes\n" |
| 6288 | "External routes\n" |
| 6289 | "Distance for external routes\n") |
| 6290 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6291 | struct ospf *ospf = vty->index; |
| 6292 | |
| 6293 | ospf->distance_inter = atoi (argv[0]); |
| 6294 | ospf->distance_external = atoi (argv[1]); |
| 6295 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6296 | return CMD_SUCCESS; |
| 6297 | } |
| 6298 | |
| 6299 | DEFUN (ospf_distance_ospf_inter_intra_external, |
| 6300 | ospf_distance_ospf_inter_intra_external_cmd, |
| 6301 | "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", |
| 6302 | "Define an administrative distance\n" |
| 6303 | "OSPF Administrative distance\n" |
| 6304 | "Inter-area routes\n" |
| 6305 | "Distance for inter-area routes\n" |
| 6306 | "Intra-area routes\n" |
| 6307 | "Distance for intra-area routes\n" |
| 6308 | "External routes\n" |
| 6309 | "Distance for external routes\n") |
| 6310 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6311 | struct ospf *ospf = vty->index; |
| 6312 | |
| 6313 | ospf->distance_inter = atoi (argv[0]); |
| 6314 | ospf->distance_intra = atoi (argv[1]); |
| 6315 | ospf->distance_external = atoi (argv[2]); |
| 6316 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6317 | return CMD_SUCCESS; |
| 6318 | } |
| 6319 | |
| 6320 | DEFUN (ospf_distance_ospf_inter_external_intra, |
| 6321 | ospf_distance_ospf_inter_external_intra_cmd, |
| 6322 | "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>", |
| 6323 | "Define an administrative distance\n" |
| 6324 | "OSPF Administrative distance\n" |
| 6325 | "Inter-area routes\n" |
| 6326 | "Distance for inter-area routes\n" |
| 6327 | "External routes\n" |
| 6328 | "Distance for external routes\n" |
| 6329 | "Intra-area routes\n" |
| 6330 | "Distance for intra-area routes\n") |
| 6331 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6332 | struct ospf *ospf = vty->index; |
| 6333 | |
| 6334 | ospf->distance_inter = atoi (argv[0]); |
| 6335 | ospf->distance_external = atoi (argv[1]); |
| 6336 | ospf->distance_intra = atoi (argv[2]); |
| 6337 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6338 | return CMD_SUCCESS; |
| 6339 | } |
| 6340 | |
| 6341 | DEFUN (ospf_distance_ospf_external, |
| 6342 | ospf_distance_ospf_external_cmd, |
| 6343 | "distance ospf external <1-255>", |
| 6344 | "Define an administrative distance\n" |
| 6345 | "OSPF Administrative distance\n" |
| 6346 | "External routes\n" |
| 6347 | "Distance for external routes\n") |
| 6348 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6349 | struct ospf *ospf = vty->index; |
| 6350 | |
| 6351 | ospf->distance_external = atoi (argv[0]); |
| 6352 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6353 | return CMD_SUCCESS; |
| 6354 | } |
| 6355 | |
| 6356 | DEFUN (ospf_distance_ospf_external_intra, |
| 6357 | ospf_distance_ospf_external_intra_cmd, |
| 6358 | "distance ospf external <1-255> intra-area <1-255>", |
| 6359 | "Define an administrative distance\n" |
| 6360 | "OSPF Administrative distance\n" |
| 6361 | "External routes\n" |
| 6362 | "Distance for external routes\n" |
| 6363 | "Intra-area routes\n" |
| 6364 | "Distance for intra-area routes\n") |
| 6365 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6366 | struct ospf *ospf = vty->index; |
| 6367 | |
| 6368 | ospf->distance_external = atoi (argv[0]); |
| 6369 | ospf->distance_intra = atoi (argv[1]); |
| 6370 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6371 | return CMD_SUCCESS; |
| 6372 | } |
| 6373 | |
| 6374 | DEFUN (ospf_distance_ospf_external_inter, |
| 6375 | ospf_distance_ospf_external_inter_cmd, |
| 6376 | "distance ospf external <1-255> inter-area <1-255>", |
| 6377 | "Define an administrative distance\n" |
| 6378 | "OSPF Administrative distance\n" |
| 6379 | "External routes\n" |
| 6380 | "Distance for external routes\n" |
| 6381 | "Inter-area routes\n" |
| 6382 | "Distance for inter-area routes\n") |
| 6383 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6384 | struct ospf *ospf = vty->index; |
| 6385 | |
| 6386 | ospf->distance_external = atoi (argv[0]); |
| 6387 | ospf->distance_inter = atoi (argv[1]); |
| 6388 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6389 | return CMD_SUCCESS; |
| 6390 | } |
| 6391 | |
| 6392 | DEFUN (ospf_distance_ospf_external_intra_inter, |
| 6393 | ospf_distance_ospf_external_intra_inter_cmd, |
| 6394 | "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>", |
| 6395 | "Define an administrative distance\n" |
| 6396 | "OSPF Administrative distance\n" |
| 6397 | "External routes\n" |
| 6398 | "Distance for external routes\n" |
| 6399 | "Intra-area routes\n" |
| 6400 | "Distance for intra-area routes\n" |
| 6401 | "Inter-area routes\n" |
| 6402 | "Distance for inter-area routes\n") |
| 6403 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6404 | struct ospf *ospf = vty->index; |
| 6405 | |
| 6406 | ospf->distance_external = atoi (argv[0]); |
| 6407 | ospf->distance_intra = atoi (argv[1]); |
| 6408 | ospf->distance_inter = atoi (argv[2]); |
| 6409 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6410 | return CMD_SUCCESS; |
| 6411 | } |
| 6412 | |
| 6413 | DEFUN (ospf_distance_ospf_external_inter_intra, |
| 6414 | ospf_distance_ospf_external_inter_intra_cmd, |
| 6415 | "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>", |
| 6416 | "Define an administrative distance\n" |
| 6417 | "OSPF Administrative distance\n" |
| 6418 | "External routes\n" |
| 6419 | "Distance for external routes\n" |
| 6420 | "Inter-area routes\n" |
| 6421 | "Distance for inter-area routes\n" |
| 6422 | "Intra-area routes\n" |
| 6423 | "Distance for intra-area routes\n") |
| 6424 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6425 | struct ospf *ospf = vty->index; |
| 6426 | |
| 6427 | ospf->distance_external = atoi (argv[0]); |
| 6428 | ospf->distance_inter = atoi (argv[1]); |
| 6429 | ospf->distance_intra = atoi (argv[2]); |
| 6430 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6431 | return CMD_SUCCESS; |
| 6432 | } |
| 6433 | |
| 6434 | DEFUN (ospf_distance_source, |
| 6435 | ospf_distance_source_cmd, |
| 6436 | "distance <1-255> A.B.C.D/M", |
| 6437 | "Administrative distance\n" |
| 6438 | "Distance value\n" |
| 6439 | "IP source prefix\n") |
| 6440 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6441 | struct ospf *ospf = vty->index; |
| 6442 | |
| 6443 | ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6444 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6445 | return CMD_SUCCESS; |
| 6446 | } |
| 6447 | |
| 6448 | DEFUN (no_ospf_distance_source, |
| 6449 | no_ospf_distance_source_cmd, |
| 6450 | "no distance <1-255> A.B.C.D/M", |
| 6451 | NO_STR |
| 6452 | "Administrative distance\n" |
| 6453 | "Distance value\n" |
| 6454 | "IP source prefix\n") |
| 6455 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6456 | struct ospf *ospf = vty->index; |
| 6457 | |
| 6458 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); |
| 6459 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6460 | return CMD_SUCCESS; |
| 6461 | } |
| 6462 | |
| 6463 | DEFUN (ospf_distance_source_access_list, |
| 6464 | ospf_distance_source_access_list_cmd, |
| 6465 | "distance <1-255> A.B.C.D/M WORD", |
| 6466 | "Administrative distance\n" |
| 6467 | "Distance value\n" |
| 6468 | "IP source prefix\n" |
| 6469 | "Access list name\n") |
| 6470 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6471 | struct ospf *ospf = vty->index; |
| 6472 | |
| 6473 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); |
| 6474 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6475 | return CMD_SUCCESS; |
| 6476 | } |
| 6477 | |
| 6478 | DEFUN (no_ospf_distance_source_access_list, |
| 6479 | no_ospf_distance_source_access_list_cmd, |
| 6480 | "no distance <1-255> A.B.C.D/M WORD", |
| 6481 | NO_STR |
| 6482 | "Administrative distance\n" |
| 6483 | "Distance value\n" |
| 6484 | "IP source prefix\n" |
| 6485 | "Access list name\n") |
| 6486 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6487 | struct ospf *ospf = vty->index; |
| 6488 | |
| 6489 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); |
| 6490 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6491 | return CMD_SUCCESS; |
| 6492 | } |
| 6493 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6494 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6495 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
| 6496 | { |
| 6497 | struct route_node *rn; |
| 6498 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6499 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6500 | struct ospf_path *path; |
| 6501 | |
| 6502 | vty_out (vty, "============ OSPF network routing table ============%s", |
| 6503 | VTY_NEWLINE); |
| 6504 | |
| 6505 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 6506 | if ((or = rn->info) != NULL) |
| 6507 | { |
| 6508 | char buf1[19]; |
| 6509 | snprintf (buf1, 19, "%s/%d", |
| 6510 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 6511 | |
| 6512 | switch (or->path_type) |
| 6513 | { |
| 6514 | case OSPF_PATH_INTER_AREA: |
| 6515 | if (or->type == OSPF_DESTINATION_NETWORK) |
| 6516 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, |
| 6517 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 6518 | else if (or->type == OSPF_DESTINATION_DISCARD) |
| 6519 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); |
| 6520 | break; |
| 6521 | case OSPF_PATH_INTRA_AREA: |
| 6522 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, |
| 6523 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 6524 | break; |
| 6525 | default: |
| 6526 | break; |
| 6527 | } |
| 6528 | |
| 6529 | if (or->type == OSPF_DESTINATION_NETWORK) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6530 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 6531 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 6532 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 6533 | { |
| 6534 | if (path->nexthop.s_addr == 0) |
| 6535 | vty_out (vty, "%24s directly attached to %s%s", |
| 6536 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 6537 | else |
| 6538 | vty_out (vty, "%24s via %s, %s%s", "", |
| 6539 | inet_ntoa (path->nexthop), path->oi->ifp->name, |
| 6540 | VTY_NEWLINE); |
| 6541 | } |
| 6542 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6543 | } |
| 6544 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6545 | } |
| 6546 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6547 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6548 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
| 6549 | { |
| 6550 | struct route_node *rn; |
| 6551 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6552 | struct listnode *pnode; |
| 6553 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6554 | struct ospf_path *path; |
| 6555 | |
| 6556 | vty_out (vty, "============ OSPF router routing table =============%s", |
| 6557 | VTY_NEWLINE); |
| 6558 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) |
| 6559 | if (rn->info) |
| 6560 | { |
| 6561 | int flag = 0; |
| 6562 | |
| 6563 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); |
| 6564 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6565 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
| 6566 | { |
| 6567 | if (flag++) |
| 6568 | vty_out (vty, "%24s", ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6569 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6570 | /* Show path. */ |
| 6571 | vty_out (vty, "%s [%d] area: %s", |
| 6572 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), |
| 6573 | or->cost, inet_ntoa (or->u.std.area_id)); |
| 6574 | /* Show flags. */ |
| 6575 | vty_out (vty, "%s%s%s", |
| 6576 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), |
| 6577 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), |
| 6578 | VTY_NEWLINE); |
| 6579 | |
| 6580 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) |
| 6581 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 6582 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
| 6583 | { |
| 6584 | if (path->nexthop.s_addr == 0) |
| 6585 | vty_out (vty, "%24s directly attached to %s%s", |
| 6586 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 6587 | else |
| 6588 | vty_out (vty, "%24s via %s, %s%s", "", |
| 6589 | inet_ntoa (path->nexthop), |
| 6590 | path->oi->ifp->name, VTY_NEWLINE); |
| 6591 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6592 | } |
| 6593 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6594 | } |
| 6595 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6596 | } |
| 6597 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6598 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6599 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
| 6600 | { |
| 6601 | struct route_node *rn; |
| 6602 | struct ospf_route *er; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6603 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6604 | struct ospf_path *path; |
| 6605 | |
| 6606 | vty_out (vty, "============ OSPF external routing table ===========%s", |
| 6607 | VTY_NEWLINE); |
| 6608 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 6609 | if ((er = rn->info) != NULL) |
| 6610 | { |
| 6611 | char buf1[19]; |
| 6612 | snprintf (buf1, 19, "%s/%d", |
| 6613 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 6614 | |
| 6615 | switch (er->path_type) |
| 6616 | { |
| 6617 | case OSPF_PATH_TYPE1_EXTERNAL: |
| 6618 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, |
| 6619 | er->cost, er->u.ext.tag, VTY_NEWLINE); |
| 6620 | break; |
| 6621 | case OSPF_PATH_TYPE2_EXTERNAL: |
| 6622 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, |
| 6623 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); |
| 6624 | break; |
| 6625 | } |
| 6626 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6627 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6628 | { |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 6629 | if (path->oi != NULL && ospf_if_exists(path->oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6630 | { |
| 6631 | if (path->nexthop.s_addr == 0) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 6632 | vty_out (vty, "%24s directly attached to %s%s", |
| 6633 | "", path->oi->ifp->name, VTY_NEWLINE); |
| 6634 | else |
| 6635 | vty_out (vty, "%24s via %s, %s%s", "", |
| 6636 | inet_ntoa (path->nexthop), path->oi->ifp->name, |
| 6637 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6638 | } |
| 6639 | } |
| 6640 | } |
| 6641 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6642 | } |
| 6643 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6644 | DEFUN (show_ip_ospf_border_routers, |
| 6645 | show_ip_ospf_border_routers_cmd, |
| 6646 | "show ip ospf border-routers", |
| 6647 | SHOW_STR |
| 6648 | IP_STR |
| 6649 | "show all the ABR's and ASBR's\n" |
| 6650 | "for this area\n") |
| 6651 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6652 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6653 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6654 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6655 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6656 | { |
| 6657 | vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE); |
| 6658 | return CMD_SUCCESS; |
| 6659 | } |
| 6660 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6661 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6662 | { |
| 6663 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 6664 | return CMD_SUCCESS; |
| 6665 | } |
| 6666 | |
| 6667 | /* Show Network routes. |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6668 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6669 | |
| 6670 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6671 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6672 | |
| 6673 | return CMD_SUCCESS; |
| 6674 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6675 | |
| 6676 | DEFUN (show_ip_ospf_route, |
| 6677 | show_ip_ospf_route_cmd, |
| 6678 | "show ip ospf route", |
| 6679 | SHOW_STR |
| 6680 | IP_STR |
| 6681 | "OSPF information\n" |
| 6682 | "OSPF routing table\n") |
| 6683 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6684 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6685 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6686 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6687 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6688 | { |
| 6689 | vty_out (vty, "OSPF is not enabled%s", VTY_NEWLINE); |
| 6690 | return CMD_SUCCESS; |
| 6691 | } |
| 6692 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6693 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6694 | { |
| 6695 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 6696 | return CMD_SUCCESS; |
| 6697 | } |
| 6698 | |
| 6699 | /* Show Network routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6700 | show_ip_ospf_route_network (vty, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6701 | |
| 6702 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6703 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6704 | |
| 6705 | /* Show AS External routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6706 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6707 | |
| 6708 | return CMD_SUCCESS; |
| 6709 | } |
| 6710 | |
| 6711 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 6712 | const char *ospf_abr_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6713 | { |
| 6714 | "unknown", |
| 6715 | "standard", |
| 6716 | "ibm", |
| 6717 | "cisco", |
| 6718 | "shortcut" |
| 6719 | }; |
| 6720 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 6721 | const char *ospf_shortcut_mode_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6722 | { |
| 6723 | "default", |
| 6724 | "enable", |
| 6725 | "disable" |
| 6726 | }; |
| 6727 | |
| 6728 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6729 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6730 | area_id2str (char *buf, int length, struct ospf_area *area) |
| 6731 | { |
| 6732 | memset (buf, 0, length); |
| 6733 | |
| 6734 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 6735 | strncpy (buf, inet_ntoa (area->area_id), length); |
| 6736 | else |
| 6737 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); |
| 6738 | } |
| 6739 | |
| 6740 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 6741 | const char *ospf_int_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6742 | { |
| 6743 | "unknown", /* should never be used. */ |
| 6744 | "point-to-point", |
| 6745 | "broadcast", |
| 6746 | "non-broadcast", |
| 6747 | "point-to-multipoint", |
| 6748 | "virtual-link", /* should never be used. */ |
| 6749 | "loopback" |
| 6750 | }; |
| 6751 | |
| 6752 | /* Configuration write function for ospfd. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6753 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6754 | config_write_interface (struct vty *vty) |
| 6755 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 6756 | struct listnode *n1, *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6757 | struct interface *ifp; |
| 6758 | struct crypt_key *ck; |
| 6759 | int write = 0; |
| 6760 | struct route_node *rn = NULL; |
| 6761 | struct ospf_if_params *params; |
| 6762 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6763 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6764 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6765 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
| 6766 | continue; |
| 6767 | |
| 6768 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 6769 | vty_out (vty, "interface %s%s", ifp->name, |
| 6770 | VTY_NEWLINE); |
| 6771 | if (ifp->desc) |
| 6772 | vty_out (vty, " description %s%s", ifp->desc, |
| 6773 | VTY_NEWLINE); |
| 6774 | |
| 6775 | write++; |
| 6776 | |
| 6777 | params = IF_DEF_PARAMS (ifp); |
| 6778 | |
| 6779 | do { |
| 6780 | /* Interface Network print. */ |
| 6781 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6782 | params->type != OSPF_IFTYPE_LOOPBACK) |
| 6783 | { |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 6784 | if (params->type != ospf_default_iftype(ifp)) |
hasso | 7b90143 | 2004-08-31 13:37:42 +0000 | [diff] [blame] | 6785 | { |
| 6786 | vty_out (vty, " ip ospf network %s", |
| 6787 | ospf_int_type_str[params->type]); |
| 6788 | if (params != IF_DEF_PARAMS (ifp)) |
| 6789 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6790 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6791 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6792 | } |
| 6793 | |
| 6794 | /* OSPF interface authentication print */ |
| 6795 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && |
| 6796 | params->auth_type != OSPF_AUTH_NOTSET) |
| 6797 | { |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 6798 | const char *auth_str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6799 | |
| 6800 | /* Translation tables are not that much help here due to syntax |
| 6801 | of the simple option */ |
| 6802 | switch (params->auth_type) |
| 6803 | { |
| 6804 | |
| 6805 | case OSPF_AUTH_NULL: |
| 6806 | auth_str = " null"; |
| 6807 | break; |
| 6808 | |
| 6809 | case OSPF_AUTH_SIMPLE: |
| 6810 | auth_str = ""; |
| 6811 | break; |
| 6812 | |
| 6813 | case OSPF_AUTH_CRYPTOGRAPHIC: |
| 6814 | auth_str = " message-digest"; |
| 6815 | break; |
| 6816 | |
| 6817 | default: |
| 6818 | auth_str = ""; |
| 6819 | break; |
| 6820 | } |
| 6821 | |
| 6822 | vty_out (vty, " ip ospf authentication%s", auth_str); |
| 6823 | if (params != IF_DEF_PARAMS (ifp)) |
| 6824 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6825 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6826 | } |
| 6827 | |
| 6828 | /* Simple Authentication Password print. */ |
| 6829 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && |
| 6830 | params->auth_simple[0] != '\0') |
| 6831 | { |
| 6832 | vty_out (vty, " ip ospf authentication-key %s", |
| 6833 | params->auth_simple); |
| 6834 | if (params != IF_DEF_PARAMS (ifp)) |
| 6835 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6836 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6837 | } |
| 6838 | |
| 6839 | /* Cryptographic Authentication Key print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6840 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6841 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6842 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
| 6843 | ck->key_id, ck->auth_key); |
| 6844 | if (params != IF_DEF_PARAMS (ifp)) |
| 6845 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6846 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6847 | } |
| 6848 | |
| 6849 | /* Interface Output Cost print. */ |
| 6850 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) |
| 6851 | { |
| 6852 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); |
| 6853 | if (params != IF_DEF_PARAMS (ifp)) |
| 6854 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6855 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6856 | } |
| 6857 | |
| 6858 | /* Hello Interval print. */ |
| 6859 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && |
| 6860 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) |
| 6861 | { |
| 6862 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); |
| 6863 | if (params != IF_DEF_PARAMS (ifp)) |
| 6864 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6865 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6866 | } |
| 6867 | |
| 6868 | |
| 6869 | /* Router Dead Interval print. */ |
| 6870 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && |
| 6871 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) |
| 6872 | { |
| 6873 | vty_out (vty, " ip ospf dead-interval %u", params->v_wait); |
| 6874 | if (params != IF_DEF_PARAMS (ifp)) |
| 6875 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6876 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6877 | } |
| 6878 | |
| 6879 | /* Router Priority print. */ |
| 6880 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && |
| 6881 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) |
| 6882 | { |
| 6883 | vty_out (vty, " ip ospf priority %u", params->priority); |
| 6884 | if (params != IF_DEF_PARAMS (ifp)) |
| 6885 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6886 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6887 | } |
| 6888 | |
| 6889 | /* Retransmit Interval print. */ |
| 6890 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && |
| 6891 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) |
| 6892 | { |
| 6893 | vty_out (vty, " ip ospf retransmit-interval %u", |
| 6894 | params->retransmit_interval); |
| 6895 | if (params != IF_DEF_PARAMS (ifp)) |
| 6896 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6897 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6898 | } |
| 6899 | |
| 6900 | /* Transmit Delay print. */ |
| 6901 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && |
| 6902 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 6903 | { |
| 6904 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); |
| 6905 | if (params != IF_DEF_PARAMS (ifp)) |
| 6906 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 6907 | vty_out (vty, "%s", VTY_NEWLINE); |
| 6908 | } |
| 6909 | |
| 6910 | while (1) |
| 6911 | { |
| 6912 | if (rn == NULL) |
| 6913 | rn = route_top (IF_OIFS_PARAMS (ifp)); |
| 6914 | else |
| 6915 | rn = route_next (rn); |
| 6916 | |
| 6917 | if (rn == NULL) |
| 6918 | break; |
| 6919 | params = rn->info; |
| 6920 | if (params != NULL) |
| 6921 | break; |
| 6922 | } |
| 6923 | } while (rn); |
| 6924 | |
| 6925 | #ifdef HAVE_OPAQUE_LSA |
| 6926 | ospf_opaque_config_write_if (vty, ifp); |
| 6927 | #endif /* HAVE_OPAQUE_LSA */ |
| 6928 | } |
| 6929 | |
| 6930 | return write; |
| 6931 | } |
| 6932 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6933 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6934 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6935 | { |
| 6936 | struct route_node *rn; |
| 6937 | u_char buf[INET_ADDRSTRLEN]; |
| 6938 | |
| 6939 | /* `network area' print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6940 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6941 | if (rn->info) |
| 6942 | { |
| 6943 | struct ospf_network *n = rn->info; |
| 6944 | |
| 6945 | memset (buf, 0, INET_ADDRSTRLEN); |
| 6946 | |
| 6947 | /* Create Area ID string by specified Area ID format. */ |
| 6948 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 6949 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6950 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 6951 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6952 | (unsigned long int) ntohl (n->area_id.s_addr)); |
| 6953 | |
| 6954 | /* Network print. */ |
| 6955 | vty_out (vty, " network %s/%d area %s%s", |
| 6956 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 6957 | buf, VTY_NEWLINE); |
| 6958 | } |
| 6959 | |
| 6960 | return 0; |
| 6961 | } |
| 6962 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 6963 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6964 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6965 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 6966 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6967 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6968 | u_char buf[INET_ADDRSTRLEN]; |
| 6969 | |
| 6970 | /* Area configuration print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 6971 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6972 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6973 | struct route_node *rn1; |
| 6974 | |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 6975 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6976 | |
| 6977 | if (area->auth_type != OSPF_AUTH_NULL) |
| 6978 | { |
| 6979 | if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 6980 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); |
| 6981 | else |
| 6982 | vty_out (vty, " area %s authentication message-digest%s", |
| 6983 | buf, VTY_NEWLINE); |
| 6984 | } |
| 6985 | |
| 6986 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) |
| 6987 | vty_out (vty, " area %s shortcut %s%s", buf, |
| 6988 | ospf_shortcut_mode_str[area->shortcut_configured], |
| 6989 | VTY_NEWLINE); |
| 6990 | |
| 6991 | if ((area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6992 | || (area->external_routing == OSPF_AREA_NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6993 | ) |
| 6994 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 6995 | if (area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6996 | vty_out (vty, " area %s stub", buf); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 6997 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 6998 | { |
| 6999 | vty_out (vty, " area %s nssa", buf); |
| 7000 | switch (area->NSSATranslatorRole) |
| 7001 | { |
| 7002 | case OSPF_NSSA_ROLE_NEVER: |
| 7003 | vty_out (vty, " translate-never"); |
| 7004 | break; |
| 7005 | case OSPF_NSSA_ROLE_ALWAYS: |
| 7006 | vty_out (vty, " translate-always"); |
| 7007 | break; |
| 7008 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 7009 | default: |
| 7010 | vty_out (vty, " translate-candidate"); |
| 7011 | } |
| 7012 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7013 | |
| 7014 | if (area->no_summary) |
| 7015 | vty_out (vty, " no-summary"); |
| 7016 | |
| 7017 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7018 | |
| 7019 | if (area->default_cost != 1) |
| 7020 | vty_out (vty, " area %s default-cost %d%s", buf, |
| 7021 | area->default_cost, VTY_NEWLINE); |
| 7022 | } |
| 7023 | |
| 7024 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) |
| 7025 | if (rn1->info) |
| 7026 | { |
| 7027 | struct ospf_area_range *range = rn1->info; |
| 7028 | |
| 7029 | vty_out (vty, " area %s range %s/%d", buf, |
| 7030 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); |
| 7031 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 7032 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7033 | vty_out (vty, " cost %d", range->cost_config); |
| 7034 | |
| 7035 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 7036 | vty_out (vty, " not-advertise"); |
| 7037 | |
| 7038 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 7039 | vty_out (vty, " substitute %s/%d", |
| 7040 | inet_ntoa (range->subst_addr), range->subst_masklen); |
| 7041 | |
| 7042 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7043 | } |
| 7044 | |
| 7045 | if (EXPORT_NAME (area)) |
| 7046 | vty_out (vty, " area %s export-list %s%s", buf, |
| 7047 | EXPORT_NAME (area), VTY_NEWLINE); |
| 7048 | |
| 7049 | if (IMPORT_NAME (area)) |
| 7050 | vty_out (vty, " area %s import-list %s%s", buf, |
| 7051 | IMPORT_NAME (area), VTY_NEWLINE); |
| 7052 | |
| 7053 | if (PREFIX_NAME_IN (area)) |
| 7054 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, |
| 7055 | PREFIX_NAME_IN (area), VTY_NEWLINE); |
| 7056 | |
| 7057 | if (PREFIX_NAME_OUT (area)) |
| 7058 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, |
| 7059 | PREFIX_NAME_OUT (area), VTY_NEWLINE); |
| 7060 | } |
| 7061 | |
| 7062 | return 0; |
| 7063 | } |
| 7064 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7065 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7066 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7067 | { |
| 7068 | struct ospf_nbr_nbma *nbr_nbma; |
| 7069 | struct route_node *rn; |
| 7070 | |
| 7071 | /* Static Neighbor configuration print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7072 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7073 | if ((nbr_nbma = rn->info)) |
| 7074 | { |
| 7075 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); |
| 7076 | |
| 7077 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) |
| 7078 | vty_out (vty, " priority %d", nbr_nbma->priority); |
| 7079 | |
| 7080 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) |
| 7081 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); |
| 7082 | |
| 7083 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7084 | } |
| 7085 | |
| 7086 | return 0; |
| 7087 | } |
| 7088 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7089 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7090 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7091 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7092 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7093 | struct ospf_vl_data *vl_data; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7094 | u_char buf[INET_ADDRSTRLEN]; |
| 7095 | |
| 7096 | /* Virtual-Link print */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7097 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7098 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7099 | struct listnode *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7100 | struct crypt_key *ck; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7101 | struct ospf_interface *oi; |
| 7102 | |
| 7103 | if (vl_data != NULL) |
| 7104 | { |
| 7105 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7106 | |
| 7107 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7108 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7109 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7110 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7111 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
| 7112 | oi = vl_data->vl_oi; |
| 7113 | |
| 7114 | /* timers */ |
| 7115 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || |
| 7116 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || |
| 7117 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || |
| 7118 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7119 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", |
| 7120 | buf, |
| 7121 | inet_ntoa (vl_data->vl_peer), |
| 7122 | OSPF_IF_PARAM (oi, v_hello), |
| 7123 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 7124 | OSPF_IF_PARAM (oi, transmit_delay), |
| 7125 | OSPF_IF_PARAM (oi, v_wait), |
| 7126 | VTY_NEWLINE); |
| 7127 | else |
| 7128 | vty_out (vty, " area %s virtual-link %s%s", buf, |
| 7129 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); |
| 7130 | /* Auth key */ |
| 7131 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') |
| 7132 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", |
| 7133 | buf, |
| 7134 | inet_ntoa (vl_data->vl_peer), |
| 7135 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, |
| 7136 | VTY_NEWLINE); |
| 7137 | /* md5 keys */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7138 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
| 7139 | n2, ck)) |
| 7140 | vty_out (vty, " area %s virtual-link %s" |
| 7141 | " message-digest-key %d md5 %s%s", |
| 7142 | buf, |
| 7143 | inet_ntoa (vl_data->vl_peer), |
| 7144 | ck->key_id, ck->auth_key, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7145 | |
| 7146 | } |
| 7147 | } |
| 7148 | |
| 7149 | return 0; |
| 7150 | } |
| 7151 | |
| 7152 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7153 | const char *distribute_str[] = { "system", "kernel", "connected", "static", |
| 7154 | "rip", "ripng", "ospf", "ospf6", "isis", "bgp"}; |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7155 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7156 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7157 | { |
| 7158 | int type; |
| 7159 | |
| 7160 | /* redistribute print. */ |
| 7161 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
| 7162 | if (type != zclient->redist_default && zclient->redist[type]) |
| 7163 | { |
| 7164 | vty_out (vty, " redistribute %s", distribute_str[type]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7165 | if (ospf->dmetric[type].value >= 0) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7166 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7167 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7168 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7169 | vty_out (vty, " metric-type 1"); |
| 7170 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7171 | if (ROUTEMAP_NAME (ospf, type)) |
| 7172 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7173 | |
| 7174 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7175 | } |
| 7176 | |
| 7177 | return 0; |
| 7178 | } |
| 7179 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7180 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7181 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7182 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7183 | if (ospf->default_metric != -1) |
| 7184 | vty_out (vty, " default-metric %d%s", ospf->default_metric, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7185 | VTY_NEWLINE); |
| 7186 | return 0; |
| 7187 | } |
| 7188 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7189 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7190 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7191 | { |
| 7192 | int type; |
| 7193 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7194 | if (ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7195 | { |
| 7196 | /* distribute-list print. */ |
| 7197 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7198 | if (ospf->dlist[type].name) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7199 | vty_out (vty, " distribute-list %s out %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7200 | ospf->dlist[type].name, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7201 | distribute_str[type], VTY_NEWLINE); |
| 7202 | |
| 7203 | /* default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7204 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7205 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7206 | if (ospf->default_originate == DEFAULT_ORIGINATE_ZEBRA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7207 | vty_out (vty, " default-information originate"); |
| 7208 | else |
| 7209 | vty_out (vty, " default-information originate always"); |
| 7210 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7211 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7212 | vty_out (vty, " metric %d", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7213 | ospf->dmetric[DEFAULT_ROUTE].value); |
| 7214 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7215 | vty_out (vty, " metric-type 1"); |
| 7216 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7217 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
| 7218 | vty_out (vty, " route-map %s", |
| 7219 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7220 | |
| 7221 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7222 | } |
| 7223 | |
| 7224 | } |
| 7225 | |
| 7226 | return 0; |
| 7227 | } |
| 7228 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7229 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7230 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7231 | { |
| 7232 | struct route_node *rn; |
| 7233 | struct ospf_distance *odistance; |
| 7234 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7235 | if (ospf->distance_all) |
| 7236 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7237 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7238 | if (ospf->distance_intra |
| 7239 | || ospf->distance_inter |
| 7240 | || ospf->distance_external) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7241 | { |
| 7242 | vty_out (vty, " distance ospf"); |
| 7243 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7244 | if (ospf->distance_intra) |
| 7245 | vty_out (vty, " intra-area %d", ospf->distance_intra); |
| 7246 | if (ospf->distance_inter) |
| 7247 | vty_out (vty, " inter-area %d", ospf->distance_inter); |
| 7248 | if (ospf->distance_external) |
| 7249 | vty_out (vty, " external %d", ospf->distance_external); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7250 | |
| 7251 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7252 | } |
| 7253 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7254 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7255 | if ((odistance = rn->info) != NULL) |
| 7256 | { |
| 7257 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, |
| 7258 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7259 | odistance->access_list ? odistance->access_list : "", |
| 7260 | VTY_NEWLINE); |
| 7261 | } |
| 7262 | return 0; |
| 7263 | } |
| 7264 | |
| 7265 | /* OSPF configuration write function. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7266 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7267 | ospf_config_write (struct vty *vty) |
| 7268 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7269 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7270 | struct interface *ifp; |
| 7271 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7272 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7273 | int write = 0; |
| 7274 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7275 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7276 | if (ospf != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7277 | { |
| 7278 | /* `router ospf' print. */ |
| 7279 | vty_out (vty, "router ospf%s", VTY_NEWLINE); |
| 7280 | |
| 7281 | write++; |
| 7282 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7283 | if (!ospf->networks) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7284 | return write; |
| 7285 | |
| 7286 | /* Router ID print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7287 | if (ospf->router_id_static.s_addr != 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7288 | vty_out (vty, " ospf router-id %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7289 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7290 | |
| 7291 | /* ABR type print. */ |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 7292 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7293 | vty_out (vty, " ospf abr-type %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7294 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7295 | |
| 7296 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7297 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7298 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
| 7299 | |
| 7300 | /* auto-cost reference-bandwidth configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7301 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7302 | vty_out (vty, " auto-cost reference-bandwidth %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7303 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7304 | |
| 7305 | /* SPF timers print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7306 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
| 7307 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7308 | vty_out (vty, " timers spf %d %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7309 | ospf->spf_delay, ospf->spf_holdtime, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7310 | |
| 7311 | /* SPF refresh parameters print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7312 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7313 | vty_out (vty, " refresh timer %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7314 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7315 | |
| 7316 | /* Redistribute information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7317 | config_write_ospf_redistribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7318 | |
| 7319 | /* passive-interface print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7320 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 7321 | if (IF_DEF_PARAMS (ifp)->passive_interface == OSPF_IF_PASSIVE) |
| 7322 | vty_out (vty, " passive-interface %s%s", |
| 7323 | ifp->name, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7324 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7325 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 7326 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface) && |
| 7327 | oi->params->passive_interface == OSPF_IF_PASSIVE) |
| 7328 | vty_out (vty, " passive-interface %s %s%s", |
| 7329 | oi->ifp->name, |
| 7330 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7331 | |
| 7332 | /* Network area print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7333 | config_write_network_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7334 | |
| 7335 | /* Area config print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7336 | config_write_ospf_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7337 | |
| 7338 | /* static neighbor print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7339 | config_write_ospf_nbr_nbma (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7340 | |
| 7341 | /* Virtual-Link print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7342 | config_write_virtual_link (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7343 | |
| 7344 | /* Default metric configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7345 | config_write_ospf_default_metric (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7346 | |
| 7347 | /* Distribute-list and default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7348 | config_write_ospf_distribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7349 | |
| 7350 | /* Distance configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7351 | config_write_ospf_distance (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7352 | |
| 7353 | #ifdef HAVE_OPAQUE_LSA |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7354 | ospf_opaque_config_write_router (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7355 | #endif /* HAVE_OPAQUE_LSA */ |
| 7356 | } |
| 7357 | |
| 7358 | return write; |
| 7359 | } |
| 7360 | |
| 7361 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7362 | ospf_vty_show_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7363 | { |
| 7364 | /* "show ip ospf" commands. */ |
| 7365 | install_element (VIEW_NODE, &show_ip_ospf_cmd); |
| 7366 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); |
| 7367 | |
| 7368 | /* "show ip ospf database" commands. */ |
| 7369 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); |
| 7370 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); |
| 7371 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 7372 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 7373 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 7374 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); |
| 7375 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); |
| 7376 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); |
| 7377 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); |
| 7378 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 7379 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 7380 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 7381 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); |
| 7382 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); |
| 7383 | |
| 7384 | /* "show ip ospf interface" commands. */ |
| 7385 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); |
| 7386 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); |
| 7387 | |
| 7388 | /* "show ip ospf neighbor" commands. */ |
| 7389 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 7390 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 7391 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 7392 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 7393 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 7394 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); |
| 7395 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 7396 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 7397 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 7398 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 7399 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 7400 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 7401 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); |
| 7402 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 7403 | |
| 7404 | /* "show ip ospf route" commands. */ |
| 7405 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); |
| 7406 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7407 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
| 7408 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7409 | } |
| 7410 | |
| 7411 | |
| 7412 | /* ospfd's interface node. */ |
| 7413 | struct cmd_node interface_node = |
| 7414 | { |
| 7415 | INTERFACE_NODE, |
| 7416 | "%s(config-if)# ", |
| 7417 | 1 |
| 7418 | }; |
| 7419 | |
| 7420 | /* Initialization of OSPF interface. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7421 | static void |
| 7422 | ospf_vty_if_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7423 | { |
| 7424 | /* Install interface node. */ |
| 7425 | install_node (&interface_node, config_write_interface); |
| 7426 | |
| 7427 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 7428 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7429 | install_default (INTERFACE_NODE); |
| 7430 | |
| 7431 | /* "description" commands. */ |
| 7432 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 7433 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 7434 | |
| 7435 | /* "ip ospf authentication" commands. */ |
| 7436 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); |
| 7437 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); |
| 7438 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); |
| 7439 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); |
| 7440 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); |
| 7441 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); |
| 7442 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); |
| 7443 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); |
| 7444 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); |
| 7445 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); |
| 7446 | |
| 7447 | /* "ip ospf message-digest-key" commands. */ |
| 7448 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); |
| 7449 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); |
| 7450 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); |
| 7451 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); |
| 7452 | |
| 7453 | /* "ip ospf cost" commands. */ |
| 7454 | install_element (INTERFACE_NODE, &ip_ospf_cost_addr_cmd); |
| 7455 | install_element (INTERFACE_NODE, &ip_ospf_cost_cmd); |
| 7456 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_addr_cmd); |
| 7457 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); |
| 7458 | |
| 7459 | /* "ip ospf dead-interval" commands. */ |
| 7460 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); |
| 7461 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); |
| 7462 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
| 7463 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); |
| 7464 | |
| 7465 | /* "ip ospf hello-interval" commands. */ |
| 7466 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); |
| 7467 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); |
| 7468 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); |
| 7469 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); |
| 7470 | |
| 7471 | /* "ip ospf network" commands. */ |
| 7472 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); |
| 7473 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); |
| 7474 | |
| 7475 | /* "ip ospf priority" commands. */ |
| 7476 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); |
| 7477 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); |
| 7478 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); |
| 7479 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); |
| 7480 | |
| 7481 | /* "ip ospf retransmit-interval" commands. */ |
| 7482 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); |
| 7483 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); |
| 7484 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); |
| 7485 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); |
| 7486 | |
| 7487 | /* "ip ospf transmit-delay" commands. */ |
| 7488 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); |
| 7489 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); |
| 7490 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); |
| 7491 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); |
| 7492 | |
| 7493 | /* These commands are compatibitliy for previous version. */ |
| 7494 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); |
| 7495 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); |
| 7496 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); |
| 7497 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); |
| 7498 | install_element (INTERFACE_NODE, &ospf_cost_cmd); |
| 7499 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); |
| 7500 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); |
| 7501 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); |
| 7502 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); |
| 7503 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); |
| 7504 | install_element (INTERFACE_NODE, &ospf_network_cmd); |
| 7505 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); |
| 7506 | install_element (INTERFACE_NODE, &ospf_priority_cmd); |
| 7507 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); |
| 7508 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); |
| 7509 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); |
| 7510 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); |
| 7511 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); |
| 7512 | } |
| 7513 | |
| 7514 | /* Zebra node structure. */ |
| 7515 | struct cmd_node zebra_node = |
| 7516 | { |
| 7517 | ZEBRA_NODE, |
| 7518 | "%s(config-router)#", |
| 7519 | }; |
| 7520 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7521 | static void |
| 7522 | ospf_vty_zebra_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7523 | { |
| 7524 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); |
| 7525 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); |
| 7526 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); |
| 7527 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); |
| 7528 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); |
| 7529 | install_element (OSPF_NODE, |
| 7530 | &ospf_redistribute_source_metric_type_routemap_cmd); |
| 7531 | install_element (OSPF_NODE, |
| 7532 | &ospf_redistribute_source_type_metric_routemap_cmd); |
| 7533 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); |
| 7534 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); |
| 7535 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); |
| 7536 | |
| 7537 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); |
| 7538 | |
| 7539 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); |
| 7540 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); |
| 7541 | |
| 7542 | install_element (OSPF_NODE, |
| 7543 | &ospf_default_information_originate_metric_type_cmd); |
| 7544 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); |
| 7545 | install_element (OSPF_NODE, |
| 7546 | &ospf_default_information_originate_type_metric_cmd); |
| 7547 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); |
| 7548 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); |
| 7549 | install_element (OSPF_NODE, |
| 7550 | &ospf_default_information_originate_always_metric_type_cmd); |
| 7551 | install_element (OSPF_NODE, |
| 7552 | &ospf_default_information_originate_always_metric_cmd); |
| 7553 | install_element (OSPF_NODE, |
| 7554 | &ospf_default_information_originate_always_cmd); |
| 7555 | install_element (OSPF_NODE, |
| 7556 | &ospf_default_information_originate_always_type_metric_cmd); |
| 7557 | install_element (OSPF_NODE, |
| 7558 | &ospf_default_information_originate_always_type_cmd); |
| 7559 | |
| 7560 | install_element (OSPF_NODE, |
| 7561 | &ospf_default_information_originate_metric_type_routemap_cmd); |
| 7562 | install_element (OSPF_NODE, |
| 7563 | &ospf_default_information_originate_metric_routemap_cmd); |
| 7564 | install_element (OSPF_NODE, |
| 7565 | &ospf_default_information_originate_routemap_cmd); |
| 7566 | install_element (OSPF_NODE, |
| 7567 | &ospf_default_information_originate_type_metric_routemap_cmd); |
| 7568 | install_element (OSPF_NODE, |
| 7569 | &ospf_default_information_originate_type_routemap_cmd); |
| 7570 | install_element (OSPF_NODE, |
| 7571 | &ospf_default_information_originate_always_metric_type_routemap_cmd); |
| 7572 | install_element (OSPF_NODE, |
| 7573 | &ospf_default_information_originate_always_metric_routemap_cmd); |
| 7574 | install_element (OSPF_NODE, |
| 7575 | &ospf_default_information_originate_always_routemap_cmd); |
| 7576 | install_element (OSPF_NODE, |
| 7577 | &ospf_default_information_originate_always_type_metric_routemap_cmd); |
| 7578 | install_element (OSPF_NODE, |
| 7579 | &ospf_default_information_originate_always_type_routemap_cmd); |
| 7580 | |
| 7581 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); |
| 7582 | |
| 7583 | install_element (OSPF_NODE, &ospf_default_metric_cmd); |
| 7584 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); |
| 7585 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); |
| 7586 | |
| 7587 | install_element (OSPF_NODE, &ospf_distance_cmd); |
| 7588 | install_element (OSPF_NODE, &no_ospf_distance_cmd); |
| 7589 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); |
| 7590 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); |
| 7591 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); |
| 7592 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); |
| 7593 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); |
| 7594 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); |
| 7595 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); |
| 7596 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); |
| 7597 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); |
| 7598 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); |
| 7599 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); |
| 7600 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); |
| 7601 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); |
| 7602 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); |
| 7603 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); |
| 7604 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); |
| 7605 | #if 0 |
| 7606 | install_element (OSPF_NODE, &ospf_distance_source_cmd); |
| 7607 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); |
| 7608 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); |
| 7609 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); |
| 7610 | #endif /* 0 */ |
| 7611 | } |
| 7612 | |
| 7613 | struct cmd_node ospf_node = |
| 7614 | { |
| 7615 | OSPF_NODE, |
| 7616 | "%s(config-router)# ", |
| 7617 | 1 |
| 7618 | }; |
| 7619 | |
| 7620 | |
| 7621 | /* Install OSPF related vty commands. */ |
| 7622 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7623 | ospf_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7624 | { |
| 7625 | /* Install ospf top node. */ |
| 7626 | install_node (&ospf_node, ospf_config_write); |
| 7627 | |
| 7628 | /* "router ospf" commands. */ |
| 7629 | install_element (CONFIG_NODE, &router_ospf_cmd); |
| 7630 | install_element (CONFIG_NODE, &no_router_ospf_cmd); |
| 7631 | |
| 7632 | install_default (OSPF_NODE); |
| 7633 | |
| 7634 | /* "ospf router-id" commands. */ |
| 7635 | install_element (OSPF_NODE, &ospf_router_id_cmd); |
| 7636 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7637 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
| 7638 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7639 | |
| 7640 | /* "passive-interface" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7641 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
| 7642 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); |
| 7643 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); |
| 7644 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7645 | |
| 7646 | /* "ospf abr-type" commands. */ |
| 7647 | install_element (OSPF_NODE, &ospf_abr_type_cmd); |
| 7648 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); |
| 7649 | |
| 7650 | /* "ospf rfc1583-compatible" commands. */ |
| 7651 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); |
| 7652 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); |
| 7653 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); |
| 7654 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); |
| 7655 | |
| 7656 | /* "network area" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7657 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
| 7658 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7659 | |
| 7660 | /* "area authentication" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7661 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
| 7662 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); |
| 7663 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7664 | |
| 7665 | /* "area range" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7666 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
| 7667 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); |
| 7668 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); |
| 7669 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); |
| 7670 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); |
| 7671 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); |
| 7672 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); |
| 7673 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); |
| 7674 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); |
| 7675 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); |
| 7676 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7677 | |
| 7678 | /* "area virtual-link" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7679 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
| 7680 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7681 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7682 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
| 7683 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7684 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7685 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
| 7686 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7687 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7688 | install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); |
| 7689 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7690 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7691 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
| 7692 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7693 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7694 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
| 7695 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); |
| 7696 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7697 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7698 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
| 7699 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7700 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7701 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
| 7702 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7703 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7704 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
| 7705 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); |
| 7706 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7707 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7708 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
| 7709 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); |
| 7710 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7711 | |
| 7712 | /* "area stub" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7713 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
| 7714 | install_element (OSPF_NODE, &ospf_area_stub_cmd); |
| 7715 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); |
| 7716 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7717 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7718 | /* "area nssa" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7719 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
| 7720 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); |
| 7721 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); |
| 7722 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); |
| 7723 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); |
| 7724 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7725 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7726 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
| 7727 | install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7728 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7729 | install_element (OSPF_NODE, &ospf_area_shortcut_cmd); |
| 7730 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7731 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7732 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
| 7733 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7734 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7735 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
| 7736 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7737 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7738 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
| 7739 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7740 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7741 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
| 7742 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7743 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7744 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
| 7745 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); |
| 7746 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7747 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7748 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
| 7749 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7750 | |
| 7751 | /* "neighbor" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 7752 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
| 7753 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); |
| 7754 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); |
| 7755 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); |
| 7756 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); |
| 7757 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); |
| 7758 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); |
| 7759 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7760 | |
| 7761 | /* Init interface related vty commands. */ |
| 7762 | ospf_vty_if_init (); |
| 7763 | |
| 7764 | /* Init zebra related vty commands. */ |
| 7765 | ospf_vty_zebra_init (); |
| 7766 | } |