paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1 | /* OSPF VTY interface. |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2 | * Copyright (C) 2005 6WIND <alain.ritoux@6wind.com> |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3 | * Copyright (C) 2000 Toshiaki Takada |
| 4 | * |
| 5 | * This file is part of GNU Zebra. |
| 6 | * |
| 7 | * GNU Zebra is free software; you can redistribute it and/or modify it |
| 8 | * under the terms of the GNU General Public License as published by the |
| 9 | * Free Software Foundation; either version 2, or (at your option) any |
| 10 | * later version. |
| 11 | * |
| 12 | * GNU Zebra is distributed in the hope that it will be useful, but |
| 13 | * WITHOUT ANY WARRANTY; without even the implied warranty of |
| 14 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU |
| 15 | * General Public License for more details. |
| 16 | * |
| 17 | * You should have received a copy of the GNU General Public License |
| 18 | * along with GNU Zebra; see the file COPYING. If not, write to the Free |
| 19 | * Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA |
| 20 | * 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <zebra.h> |
| 24 | |
| 25 | #include "memory.h" |
| 26 | #include "thread.h" |
| 27 | #include "prefix.h" |
| 28 | #include "table.h" |
| 29 | #include "vty.h" |
| 30 | #include "command.h" |
| 31 | #include "plist.h" |
| 32 | #include "log.h" |
| 33 | #include "zclient.h" |
| 34 | |
| 35 | #include "ospfd/ospfd.h" |
| 36 | #include "ospfd/ospf_asbr.h" |
| 37 | #include "ospfd/ospf_lsa.h" |
| 38 | #include "ospfd/ospf_lsdb.h" |
| 39 | #include "ospfd/ospf_ism.h" |
| 40 | #include "ospfd/ospf_interface.h" |
| 41 | #include "ospfd/ospf_nsm.h" |
| 42 | #include "ospfd/ospf_neighbor.h" |
| 43 | #include "ospfd/ospf_flood.h" |
| 44 | #include "ospfd/ospf_abr.h" |
| 45 | #include "ospfd/ospf_spf.h" |
| 46 | #include "ospfd/ospf_route.h" |
| 47 | #include "ospfd/ospf_zebra.h" |
| 48 | /*#include "ospfd/ospf_routemap.h" */ |
| 49 | #include "ospfd/ospf_vty.h" |
| 50 | #include "ospfd/ospf_dump.h" |
| 51 | |
| 52 | |
Paul Jakma | 30a2231 | 2008-08-15 14:05:22 +0100 | [diff] [blame] | 53 | static const char *ospf_network_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 54 | { |
| 55 | "Null", |
| 56 | "POINTOPOINT", |
| 57 | "BROADCAST", |
| 58 | "NBMA", |
| 59 | "POINTOMULTIPOINT", |
| 60 | "VIRTUALLINK", |
| 61 | "LOOPBACK" |
| 62 | }; |
| 63 | |
| 64 | |
| 65 | /* Utility functions. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 66 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 67 | ospf_str2area_id (const char *str, struct in_addr *area_id, int *format) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 68 | { |
| 69 | char *endptr = NULL; |
| 70 | unsigned long ret; |
| 71 | |
| 72 | /* match "A.B.C.D". */ |
| 73 | if (strchr (str, '.') != NULL) |
| 74 | { |
| 75 | ret = inet_aton (str, area_id); |
| 76 | if (!ret) |
| 77 | return -1; |
| 78 | *format = OSPF_AREA_ID_FORMAT_ADDRESS; |
| 79 | } |
| 80 | /* match "<0-4294967295>". */ |
| 81 | else |
| 82 | { |
| 83 | ret = strtoul (str, &endptr, 10); |
| 84 | if (*endptr != '\0' || (ret == ULONG_MAX && errno == ERANGE)) |
| 85 | return -1; |
| 86 | |
| 87 | area_id->s_addr = htonl (ret); |
| 88 | *format = OSPF_AREA_ID_FORMAT_DECIMAL; |
| 89 | } |
| 90 | |
| 91 | return 0; |
| 92 | } |
| 93 | |
| 94 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 95 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 96 | str2distribute_source (const char *str, int *source) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | { |
| 98 | /* Sanity check. */ |
| 99 | if (str == NULL) |
| 100 | return 0; |
| 101 | |
| 102 | if (strncmp (str, "k", 1) == 0) |
| 103 | *source = ZEBRA_ROUTE_KERNEL; |
| 104 | else if (strncmp (str, "c", 1) == 0) |
| 105 | *source = ZEBRA_ROUTE_CONNECT; |
| 106 | else if (strncmp (str, "s", 1) == 0) |
| 107 | *source = ZEBRA_ROUTE_STATIC; |
| 108 | else if (strncmp (str, "r", 1) == 0) |
| 109 | *source = ZEBRA_ROUTE_RIP; |
| 110 | else if (strncmp (str, "b", 1) == 0) |
| 111 | *source = ZEBRA_ROUTE_BGP; |
| 112 | else |
| 113 | return 0; |
| 114 | |
| 115 | return 1; |
| 116 | } |
| 117 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 118 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 119 | str2metric (const char *str, int *metric) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 120 | { |
| 121 | /* Sanity check. */ |
| 122 | if (str == NULL) |
| 123 | return 0; |
| 124 | |
| 125 | *metric = strtol (str, NULL, 10); |
| 126 | if (*metric < 0 && *metric > 16777214) |
| 127 | { |
| 128 | /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */ |
| 129 | return 0; |
| 130 | } |
| 131 | |
| 132 | return 1; |
| 133 | } |
| 134 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 135 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 136 | str2metric_type (const char *str, int *metric_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 137 | { |
| 138 | /* Sanity check. */ |
| 139 | if (str == NULL) |
| 140 | return 0; |
| 141 | |
| 142 | if (strncmp (str, "1", 1) == 0) |
| 143 | *metric_type = EXTERNAL_METRIC_TYPE_1; |
| 144 | else if (strncmp (str, "2", 1) == 0) |
| 145 | *metric_type = EXTERNAL_METRIC_TYPE_2; |
| 146 | else |
| 147 | return 0; |
| 148 | |
| 149 | return 1; |
| 150 | } |
| 151 | |
| 152 | int |
| 153 | ospf_oi_count (struct interface *ifp) |
| 154 | { |
| 155 | struct route_node *rn; |
| 156 | int i = 0; |
| 157 | |
| 158 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 159 | if (rn->info) |
| 160 | i++; |
| 161 | |
| 162 | return i; |
| 163 | } |
| 164 | |
| 165 | |
| 166 | DEFUN (router_ospf, |
| 167 | router_ospf_cmd, |
| 168 | "router ospf", |
| 169 | "Enable a routing process\n" |
| 170 | "Start OSPF configuration\n") |
| 171 | { |
| 172 | vty->node = OSPF_NODE; |
| 173 | vty->index = ospf_get (); |
| 174 | |
| 175 | return CMD_SUCCESS; |
| 176 | } |
| 177 | |
| 178 | DEFUN (no_router_ospf, |
| 179 | no_router_ospf_cmd, |
| 180 | "no router ospf", |
| 181 | NO_STR |
| 182 | "Enable a routing process\n" |
| 183 | "Start OSPF configuration\n") |
| 184 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 185 | struct ospf *ospf; |
| 186 | |
| 187 | ospf = ospf_lookup (); |
| 188 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 189 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 190 | vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 191 | return CMD_WARNING; |
| 192 | } |
| 193 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 194 | ospf_finish (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 195 | |
| 196 | return CMD_SUCCESS; |
| 197 | } |
| 198 | |
| 199 | DEFUN (ospf_router_id, |
| 200 | ospf_router_id_cmd, |
| 201 | "ospf router-id A.B.C.D", |
| 202 | "OSPF specific commands\n" |
| 203 | "router-id for the OSPF process\n" |
| 204 | "OSPF router-id in IP address format\n") |
| 205 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 206 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 207 | struct in_addr router_id; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 208 | int ret; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 209 | |
| 210 | ret = inet_aton (argv[0], &router_id); |
| 211 | if (!ret) |
| 212 | { |
| 213 | vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); |
| 214 | return CMD_WARNING; |
| 215 | } |
| 216 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 217 | ospf->router_id_static = router_id; |
paul | b29800a | 2005-11-20 14:50:45 +0000 | [diff] [blame] | 218 | |
| 219 | ospf_router_id_update (ospf); |
| 220 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 221 | return CMD_SUCCESS; |
| 222 | } |
| 223 | |
| 224 | ALIAS (ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 225 | router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 226 | "router-id A.B.C.D", |
| 227 | "router-id for the OSPF process\n" |
| 228 | "OSPF router-id in IP address format\n") |
| 229 | |
| 230 | DEFUN (no_ospf_router_id, |
| 231 | no_ospf_router_id_cmd, |
| 232 | "no ospf router-id", |
| 233 | NO_STR |
| 234 | "OSPF specific commands\n" |
| 235 | "router-id for the OSPF process\n") |
| 236 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 237 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 238 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 239 | ospf->router_id_static.s_addr = 0; |
| 240 | |
| 241 | ospf_router_id_update (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 242 | |
| 243 | return CMD_SUCCESS; |
| 244 | } |
| 245 | |
| 246 | ALIAS (no_ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 247 | no_router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 248 | "no router-id", |
| 249 | NO_STR |
| 250 | "router-id for the OSPF process\n") |
| 251 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 252 | static void |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 253 | ospf_passive_interface_default (struct ospf *ospf, u_char newval) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 254 | { |
| 255 | struct listnode *ln; |
| 256 | struct interface *ifp; |
| 257 | struct ospf_interface *oi; |
| 258 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 259 | ospf->passive_interface_default = newval; |
| 260 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 261 | for (ALL_LIST_ELEMENTS_RO (om->iflist, ln, ifp)) |
| 262 | { |
| 263 | if (ifp && |
| 264 | OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) |
| 265 | UNSET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface); |
| 266 | } |
| 267 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, ln, oi)) |
| 268 | { |
| 269 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) |
| 270 | UNSET_IF_PARAM (oi->params, passive_interface); |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 271 | /* update multicast memberships */ |
| 272 | ospf_if_set_multicast(oi); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 273 | } |
| 274 | } |
| 275 | |
| 276 | static void |
| 277 | ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp, |
| 278 | struct in_addr addr, |
| 279 | struct ospf_if_params *params, u_char value) |
| 280 | { |
| 281 | u_char dflt; |
| 282 | |
| 283 | params->passive_interface = value; |
| 284 | if (params != IF_DEF_PARAMS (ifp)) |
| 285 | { |
| 286 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) |
| 287 | dflt = IF_DEF_PARAMS (ifp)->passive_interface; |
| 288 | else |
| 289 | dflt = ospf->passive_interface_default; |
| 290 | |
| 291 | if (value != dflt) |
| 292 | SET_IF_PARAM (params, passive_interface); |
| 293 | else |
| 294 | UNSET_IF_PARAM (params, passive_interface); |
| 295 | |
| 296 | ospf_free_if_params (ifp, addr); |
| 297 | ospf_if_update_params (ifp, addr); |
| 298 | } |
| 299 | else |
| 300 | { |
| 301 | if (value != ospf->passive_interface_default) |
| 302 | SET_IF_PARAM (params, passive_interface); |
| 303 | else |
| 304 | UNSET_IF_PARAM (params, passive_interface); |
| 305 | } |
| 306 | } |
| 307 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 308 | DEFUN (ospf_passive_interface, |
| 309 | ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 310 | "passive-interface IFNAME A.B.C.D", |
| 311 | "Suppress routing updates on an interface\n" |
| 312 | "Interface's name\n") |
| 313 | { |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 314 | struct interface *ifp; |
| 315 | struct in_addr addr; |
| 316 | int ret; |
| 317 | struct ospf_if_params *params; |
| 318 | struct route_node *rn; |
| 319 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 320 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 321 | if (argc == 0) |
| 322 | { |
| 323 | ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE); |
| 324 | return CMD_SUCCESS; |
| 325 | } |
| 326 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 327 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 328 | |
| 329 | params = IF_DEF_PARAMS (ifp); |
| 330 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 331 | if (argc == 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 332 | { |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 333 | ret = inet_aton(argv[1], &addr); |
| 334 | if (!ret) |
| 335 | { |
| 336 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 337 | VTY_NEWLINE); |
| 338 | return CMD_WARNING; |
| 339 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 340 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 341 | params = ospf_get_if_params (ifp, addr); |
| 342 | ospf_if_update_params (ifp, addr); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 343 | } |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 344 | ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE); |
| 345 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 346 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 347 | * interfaces for which the passive property changed. It is too much |
| 348 | * work to determine this set, so we do this for every interface. |
| 349 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 350 | * record of joined groups to avoid systems calls if the desired |
| 351 | * memberships match the current memership. |
| 352 | */ |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 353 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 354 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 355 | { |
| 356 | struct ospf_interface *oi = rn->info; |
| 357 | |
| 358 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 359 | ospf_if_set_multicast(oi); |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 360 | } |
| 361 | /* |
| 362 | * XXX It is not clear what state transitions the interface needs to |
| 363 | * undergo when going from active to passive. Fixing this will |
| 364 | * require precise identification of interfaces having such a |
| 365 | * transition. |
| 366 | */ |
| 367 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 368 | return CMD_SUCCESS; |
| 369 | } |
| 370 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 371 | ALIAS (ospf_passive_interface, |
| 372 | ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 373 | "passive-interface IFNAME", |
| 374 | "Suppress routing updates on an interface\n" |
| 375 | "Interface's name\n") |
| 376 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 377 | ALIAS (ospf_passive_interface, |
| 378 | ospf_passive_interface_default_cmd, |
| 379 | "passive-interface default", |
| 380 | "Suppress routing updates on an interface\n" |
| 381 | "Suppress routing updates on interfaces by default\n") |
| 382 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 383 | DEFUN (no_ospf_passive_interface, |
| 384 | no_ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 385 | "no passive-interface IFNAME A.B.C.D", |
| 386 | NO_STR |
| 387 | "Allow routing updates on an interface\n" |
| 388 | "Interface's name\n") |
| 389 | { |
| 390 | struct interface *ifp; |
| 391 | struct in_addr addr; |
| 392 | struct ospf_if_params *params; |
| 393 | int ret; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 394 | struct route_node *rn; |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 395 | struct ospf *ospf = vty->index; |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 396 | |
| 397 | if (argc == 0) |
| 398 | { |
| 399 | ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE); |
| 400 | return CMD_SUCCESS; |
| 401 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 402 | |
Andrew J. Schorr | 6e72cb6 | 2006-06-18 00:45:48 +0000 | [diff] [blame] | 403 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 404 | |
| 405 | params = IF_DEF_PARAMS (ifp); |
| 406 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 407 | if (argc == 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 408 | { |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 409 | ret = inet_aton(argv[1], &addr); |
| 410 | if (!ret) |
| 411 | { |
| 412 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 413 | VTY_NEWLINE); |
| 414 | return CMD_WARNING; |
| 415 | } |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 416 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 417 | params = ospf_lookup_if_params (ifp, addr); |
| 418 | if (params == NULL) |
| 419 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 420 | } |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 421 | ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE); |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 422 | |
| 423 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 424 | * interfaces for which the passive property changed. It is too much |
| 425 | * work to determine this set, so we do this for every interface. |
| 426 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 427 | * record of joined groups to avoid systems calls if the desired |
| 428 | * memberships match the current memership. |
| 429 | */ |
| 430 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 431 | { |
| 432 | struct ospf_interface *oi = rn->info; |
| 433 | |
| 434 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE)) |
| 435 | ospf_if_set_multicast(oi); |
| 436 | } |
| 437 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 438 | return CMD_SUCCESS; |
| 439 | } |
| 440 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 441 | ALIAS (no_ospf_passive_interface, |
| 442 | no_ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 443 | "no passive-interface IFNAME", |
| 444 | NO_STR |
| 445 | "Allow routing updates on an interface\n" |
| 446 | "Interface's name\n") |
| 447 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 448 | ALIAS (no_ospf_passive_interface, |
| 449 | no_ospf_passive_interface_default_cmd, |
| 450 | "no passive-interface default", |
| 451 | NO_STR |
| 452 | "Allow routing updates on an interface\n" |
| 453 | "Allow routing updates on interfaces by default\n") |
| 454 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 455 | DEFUN (ospf_network_area, |
| 456 | ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 457 | "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 458 | "Enable routing on an IP network\n" |
| 459 | "OSPF network prefix\n" |
| 460 | "Set the OSPF area ID\n" |
| 461 | "OSPF area ID in IP address format\n" |
| 462 | "OSPF area ID as a decimal value\n") |
| 463 | { |
| 464 | struct ospf *ospf= vty->index; |
| 465 | struct prefix_ipv4 p; |
| 466 | struct in_addr area_id; |
| 467 | int ret, format; |
| 468 | |
| 469 | /* Get network prefix and Area ID. */ |
| 470 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 471 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 472 | |
| 473 | ret = ospf_network_set (ospf, &p, area_id); |
| 474 | if (ret == 0) |
| 475 | { |
| 476 | vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); |
| 477 | return CMD_WARNING; |
| 478 | } |
| 479 | |
| 480 | return CMD_SUCCESS; |
| 481 | } |
| 482 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 483 | DEFUN (no_ospf_network_area, |
| 484 | no_ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 485 | "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 486 | NO_STR |
| 487 | "Enable routing on an IP network\n" |
| 488 | "OSPF network prefix\n" |
| 489 | "Set the OSPF area ID\n" |
| 490 | "OSPF area ID in IP address format\n" |
| 491 | "OSPF area ID as a decimal value\n") |
| 492 | { |
| 493 | struct ospf *ospf = (struct ospf *) vty->index; |
| 494 | struct prefix_ipv4 p; |
| 495 | struct in_addr area_id; |
| 496 | int ret, format; |
| 497 | |
| 498 | /* Get network prefix and Area ID. */ |
| 499 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 500 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 501 | |
| 502 | ret = ospf_network_unset (ospf, &p, area_id); |
| 503 | if (ret == 0) |
| 504 | { |
| 505 | vty_out (vty, "Can't find specified network area configuration.%s", |
| 506 | VTY_NEWLINE); |
| 507 | return CMD_WARNING; |
| 508 | } |
| 509 | |
| 510 | return CMD_SUCCESS; |
| 511 | } |
| 512 | |
| 513 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 514 | DEFUN (ospf_area_range, |
| 515 | ospf_area_range_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", |
| 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 | { |
| 523 | struct ospf *ospf = vty->index; |
| 524 | struct prefix_ipv4 p; |
| 525 | struct in_addr area_id; |
| 526 | int format; |
| 527 | u_int32_t cost; |
| 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, OSPF_AREA_RANGE_ADVERTISE); |
| 533 | if (argc > 2) |
| 534 | { |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 535 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 536 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
| 537 | } |
| 538 | |
| 539 | return CMD_SUCCESS; |
| 540 | } |
| 541 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 542 | ALIAS (ospf_area_range, |
| 543 | ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 544 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", |
| 545 | "OSPF area parameters\n" |
| 546 | "OSPF area ID in IP address format\n" |
| 547 | "OSPF area ID as a decimal value\n" |
| 548 | "OSPF area range for route advertise (default)\n" |
| 549 | "Area range prefix\n" |
| 550 | "Advertise this range (default)\n") |
| 551 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 552 | ALIAS (ospf_area_range, |
| 553 | ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 554 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 555 | "OSPF area parameters\n" |
| 556 | "OSPF area ID in IP address format\n" |
| 557 | "OSPF area ID as a decimal value\n" |
| 558 | "Summarize routes matching address/mask (border routers only)\n" |
| 559 | "Area range prefix\n" |
| 560 | "User specified metric for this range\n" |
| 561 | "Advertised metric for this range\n") |
| 562 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 563 | ALIAS (ospf_area_range, |
| 564 | ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 565 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 566 | "OSPF area parameters\n" |
| 567 | "OSPF area ID in IP address format\n" |
| 568 | "OSPF area ID as a decimal value\n" |
| 569 | "Summarize routes matching address/mask (border routers only)\n" |
| 570 | "Area range prefix\n" |
| 571 | "Advertise this range (default)\n" |
| 572 | "User specified metric for this range\n" |
| 573 | "Advertised metric for this range\n") |
| 574 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 575 | DEFUN (ospf_area_range_not_advertise, |
| 576 | ospf_area_range_not_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 577 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise", |
| 578 | "OSPF area parameters\n" |
| 579 | "OSPF area ID in IP address format\n" |
| 580 | "OSPF area ID as a decimal value\n" |
| 581 | "Summarize routes matching address/mask (border routers only)\n" |
| 582 | "Area range prefix\n" |
| 583 | "DoNotAdvertise this range\n") |
| 584 | { |
| 585 | struct ospf *ospf = vty->index; |
| 586 | struct prefix_ipv4 p; |
| 587 | struct in_addr area_id; |
| 588 | int format; |
| 589 | |
| 590 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 591 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 592 | |
| 593 | ospf_area_range_set (ospf, area_id, &p, 0); |
| 594 | |
| 595 | return CMD_SUCCESS; |
| 596 | } |
| 597 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 598 | DEFUN (no_ospf_area_range, |
| 599 | no_ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 600 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 601 | NO_STR |
| 602 | "OSPF area parameters\n" |
| 603 | "OSPF area ID in IP address format\n" |
| 604 | "OSPF area ID as a decimal value\n" |
| 605 | "Summarize routes matching address/mask (border routers only)\n" |
| 606 | "Area range prefix\n") |
| 607 | { |
| 608 | struct ospf *ospf = vty->index; |
| 609 | struct prefix_ipv4 p; |
| 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 | |
| 616 | ospf_area_range_unset (ospf, area_id, &p); |
| 617 | |
| 618 | return CMD_SUCCESS; |
| 619 | } |
| 620 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 621 | ALIAS (no_ospf_area_range, |
| 622 | no_ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 623 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", |
| 624 | NO_STR |
| 625 | "OSPF area parameters\n" |
| 626 | "OSPF area ID in IP address format\n" |
| 627 | "OSPF area ID as a decimal value\n" |
| 628 | "Summarize routes matching address/mask (border routers only)\n" |
| 629 | "Area range prefix\n" |
| 630 | "Advertise this range (default)\n" |
| 631 | "DoNotAdvertise this range\n") |
| 632 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 633 | ALIAS (no_ospf_area_range, |
| 634 | no_ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 635 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 636 | NO_STR |
| 637 | "OSPF area parameters\n" |
| 638 | "OSPF area ID in IP address format\n" |
| 639 | "OSPF area ID as a decimal value\n" |
| 640 | "Summarize routes matching address/mask (border routers only)\n" |
| 641 | "Area range prefix\n" |
| 642 | "User specified metric for this range\n" |
| 643 | "Advertised metric for this range\n") |
| 644 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 645 | ALIAS (no_ospf_area_range, |
| 646 | no_ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 647 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 648 | NO_STR |
| 649 | "OSPF area parameters\n" |
| 650 | "OSPF area ID in IP address format\n" |
| 651 | "OSPF area ID as a decimal value\n" |
| 652 | "Summarize routes matching address/mask (border routers only)\n" |
| 653 | "Area range prefix\n" |
| 654 | "Advertise this range (default)\n" |
| 655 | "User specified metric for this range\n" |
| 656 | "Advertised metric for this range\n") |
| 657 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 658 | DEFUN (ospf_area_range_substitute, |
| 659 | ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 660 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 661 | "OSPF area parameters\n" |
| 662 | "OSPF area ID in IP address format\n" |
| 663 | "OSPF area ID as a decimal value\n" |
| 664 | "Summarize routes matching address/mask (border routers only)\n" |
| 665 | "Area range prefix\n" |
| 666 | "Announce area range as another prefix\n" |
| 667 | "Network prefix to be announced instead of range\n") |
| 668 | { |
| 669 | struct ospf *ospf = vty->index; |
| 670 | struct prefix_ipv4 p, s; |
| 671 | struct in_addr area_id; |
| 672 | int format; |
| 673 | |
| 674 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 675 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 676 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 677 | |
| 678 | ospf_area_range_substitute_set (ospf, area_id, &p, &s); |
| 679 | |
| 680 | return CMD_SUCCESS; |
| 681 | } |
| 682 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 683 | DEFUN (no_ospf_area_range_substitute, |
| 684 | no_ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 685 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 686 | NO_STR |
| 687 | "OSPF area parameters\n" |
| 688 | "OSPF area ID in IP address format\n" |
| 689 | "OSPF area ID as a decimal value\n" |
| 690 | "Summarize routes matching address/mask (border routers only)\n" |
| 691 | "Area range prefix\n" |
| 692 | "Announce area range as another prefix\n" |
| 693 | "Network prefix to be announced instead of range\n") |
| 694 | { |
| 695 | struct ospf *ospf = vty->index; |
| 696 | struct prefix_ipv4 p, s; |
| 697 | struct in_addr area_id; |
| 698 | int format; |
| 699 | |
| 700 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 701 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 702 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 703 | |
| 704 | ospf_area_range_substitute_unset (ospf, area_id, &p); |
| 705 | |
| 706 | return CMD_SUCCESS; |
| 707 | } |
| 708 | |
| 709 | |
| 710 | /* Command Handler Logic in VLink stuff is delicate!! |
| 711 | |
| 712 | ALTER AT YOUR OWN RISK!!!! |
| 713 | |
| 714 | Various dummy values are used to represent 'NoChange' state for |
| 715 | VLink configuration NOT being changed by a VLink command, and |
| 716 | special syntax is used within the command strings so that the |
| 717 | typed in command verbs can be seen in the configuration command |
| 718 | bacckend handler. This is to drastically reduce the verbeage |
| 719 | required to coe up with a reasonably compatible Cisco VLink command |
| 720 | |
| 721 | - Matthew Grant <grantma@anathoth.gen.nz> |
| 722 | Wed, 21 Feb 2001 15:13:52 +1300 |
| 723 | */ |
| 724 | |
| 725 | |
| 726 | /* Configuration data for virtual links |
| 727 | */ |
| 728 | struct ospf_vl_config_data { |
| 729 | struct vty *vty; /* vty stuff */ |
| 730 | struct in_addr area_id; /* area ID from command line */ |
| 731 | int format; /* command line area ID format */ |
| 732 | struct in_addr vl_peer; /* command line vl_peer */ |
| 733 | int auth_type; /* Authehntication type, if given */ |
| 734 | char *auth_key; /* simple password if present */ |
| 735 | int crypto_key_id; /* Cryptographic key ID */ |
| 736 | char *md5_key; /* MD5 authentication key */ |
| 737 | int hello_interval; /* Obvious what these are... */ |
| 738 | int retransmit_interval; |
| 739 | int transmit_delay; |
| 740 | int dead_interval; |
| 741 | }; |
| 742 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 743 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 744 | ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, |
| 745 | struct vty *vty) |
| 746 | { |
| 747 | memset (vl_config, 0, sizeof (struct ospf_vl_config_data)); |
| 748 | vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN; |
| 749 | vl_config->vty = vty; |
| 750 | } |
| 751 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 752 | static struct ospf_vl_data * |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 753 | 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] | 754 | { |
| 755 | struct ospf_area *area; |
| 756 | struct ospf_vl_data *vl_data; |
| 757 | struct vty *vty; |
| 758 | struct in_addr area_id; |
| 759 | |
| 760 | vty = vl_config->vty; |
| 761 | area_id = vl_config->area_id; |
| 762 | |
| 763 | if (area_id.s_addr == OSPF_AREA_BACKBONE) |
| 764 | { |
| 765 | vty_out (vty, |
| 766 | "Configuring VLs over the backbone is not allowed%s", |
| 767 | VTY_NEWLINE); |
| 768 | return NULL; |
| 769 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 770 | area = ospf_area_get (ospf, area_id, vl_config->format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 771 | |
| 772 | if (area->external_routing != OSPF_AREA_DEFAULT) |
| 773 | { |
| 774 | if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 775 | vty_out (vty, "Area %s is %s%s", |
| 776 | inet_ntoa (area_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 777 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 778 | VTY_NEWLINE); |
| 779 | else |
| 780 | vty_out (vty, "Area %ld is %s%s", |
| 781 | (u_long)ntohl (area_id.s_addr), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 782 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 783 | VTY_NEWLINE); |
| 784 | return NULL; |
| 785 | } |
| 786 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 787 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config->vl_peer)) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 788 | { |
| 789 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); |
| 790 | if (vl_data->vl_oi == NULL) |
| 791 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 792 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
| 793 | ospf_vl_add (ospf, vl_data); |
| 794 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 795 | } |
| 796 | } |
| 797 | return vl_data; |
| 798 | } |
| 799 | |
| 800 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 801 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 802 | ospf_vl_set_security (struct ospf_vl_data *vl_data, |
| 803 | struct ospf_vl_config_data *vl_config) |
| 804 | { |
| 805 | struct crypt_key *ck; |
| 806 | struct vty *vty; |
| 807 | struct interface *ifp = vl_data->vl_oi->ifp; |
| 808 | |
| 809 | vty = vl_config->vty; |
| 810 | |
| 811 | if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN) |
| 812 | { |
| 813 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); |
| 814 | IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type; |
| 815 | } |
| 816 | |
| 817 | if (vl_config->auth_key) |
| 818 | { |
| 819 | memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 820 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 821 | OSPF_AUTH_SIMPLE_SIZE); |
| 822 | } |
| 823 | else if (vl_config->md5_key) |
| 824 | { |
| 825 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id) |
| 826 | != NULL) |
| 827 | { |
| 828 | vty_out (vty, "OSPF: Key %d already exists%s", |
| 829 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 830 | return CMD_WARNING; |
| 831 | } |
| 832 | ck = ospf_crypt_key_new (); |
| 833 | ck->key_id = vl_config->crypto_key_id; |
| 834 | memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 835 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 836 | |
| 837 | ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); |
| 838 | } |
| 839 | else if (vl_config->crypto_key_id != 0) |
| 840 | { |
| 841 | /* Delete a key */ |
| 842 | |
| 843 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, |
| 844 | vl_config->crypto_key_id) == NULL) |
| 845 | { |
| 846 | vty_out (vty, "OSPF: Key %d does not exist%s", |
| 847 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 848 | return CMD_WARNING; |
| 849 | } |
| 850 | |
| 851 | ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id); |
| 852 | |
| 853 | } |
| 854 | |
| 855 | return CMD_SUCCESS; |
| 856 | } |
| 857 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 858 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 859 | ospf_vl_set_timers (struct ospf_vl_data *vl_data, |
| 860 | struct ospf_vl_config_data *vl_config) |
| 861 | { |
| 862 | struct interface *ifp = ifp = vl_data->vl_oi->ifp; |
| 863 | /* Virtual Link data initialised to defaults, so only set |
| 864 | if a value given */ |
| 865 | if (vl_config->hello_interval) |
| 866 | { |
| 867 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); |
| 868 | IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval; |
| 869 | } |
| 870 | |
| 871 | if (vl_config->dead_interval) |
| 872 | { |
| 873 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait); |
| 874 | IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval; |
| 875 | } |
| 876 | |
| 877 | if (vl_config->retransmit_interval) |
| 878 | { |
| 879 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval); |
| 880 | IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval; |
| 881 | } |
| 882 | |
| 883 | if (vl_config->transmit_delay) |
| 884 | { |
| 885 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay); |
| 886 | IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay; |
| 887 | } |
| 888 | |
| 889 | return CMD_SUCCESS; |
| 890 | } |
| 891 | |
| 892 | |
| 893 | |
| 894 | /* The business end of all of the above */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 895 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 896 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 897 | { |
| 898 | struct ospf_vl_data *vl_data; |
| 899 | int ret; |
| 900 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 901 | vl_data = ospf_find_vl_data (ospf, vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 902 | if (!vl_data) |
| 903 | return CMD_WARNING; |
| 904 | |
| 905 | /* Process this one first as it can have a fatal result, which can |
| 906 | only logically occur if the virtual link exists already |
| 907 | Thus a command error does not result in a change to the |
| 908 | running configuration such as unexpectedly altered timer |
| 909 | values etc.*/ |
| 910 | ret = ospf_vl_set_security (vl_data, vl_config); |
| 911 | if (ret != CMD_SUCCESS) |
| 912 | return ret; |
| 913 | |
| 914 | /* Set any time based parameters, these area already range checked */ |
| 915 | |
| 916 | ret = ospf_vl_set_timers (vl_data, vl_config); |
| 917 | if (ret != CMD_SUCCESS) |
| 918 | return ret; |
| 919 | |
| 920 | return CMD_SUCCESS; |
| 921 | |
| 922 | } |
| 923 | |
| 924 | /* This stuff exists to make specifying all the alias commands A LOT simpler |
| 925 | */ |
| 926 | #define VLINK_HELPSTR_IPADDR \ |
| 927 | "OSPF area parameters\n" \ |
| 928 | "OSPF area ID in IP address format\n" \ |
| 929 | "OSPF area ID as a decimal value\n" \ |
| 930 | "Configure a virtual link\n" \ |
| 931 | "Router ID of the remote ABR\n" |
| 932 | |
| 933 | #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 934 | "Enable authentication on this virtual link\n" \ |
| 935 | "dummy string \n" |
| 936 | |
| 937 | #define VLINK_HELPSTR_AUTHTYPE_ALL \ |
| 938 | VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 939 | "Use null authentication\n" \ |
| 940 | "Use message-digest authentication\n" |
| 941 | |
| 942 | #define VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 943 | "Time between HELLO packets\n" \ |
| 944 | "Time between retransmitting lost link state advertisements\n" \ |
| 945 | "Link state transmit delay\n" \ |
| 946 | "Interval after which a neighbor is declared dead\n" |
| 947 | |
| 948 | #define VLINK_HELPSTR_TIME_PARAM \ |
| 949 | VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 950 | "Seconds\n" |
| 951 | |
| 952 | #define VLINK_HELPSTR_AUTH_SIMPLE \ |
| 953 | "Authentication password (key)\n" \ |
| 954 | "The OSPF password (key)" |
| 955 | |
| 956 | #define VLINK_HELPSTR_AUTH_MD5 \ |
| 957 | "Message digest authentication password (key)\n" \ |
| 958 | "dummy string \n" \ |
| 959 | "Key ID\n" \ |
| 960 | "Use MD5 algorithm\n" \ |
| 961 | "The OSPF password (key)" |
| 962 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 963 | DEFUN (ospf_area_vlink, |
| 964 | ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 965 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 966 | VLINK_HELPSTR_IPADDR) |
| 967 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 968 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 969 | struct ospf_vl_config_data vl_config; |
| 970 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 971 | char md5_key[OSPF_AUTH_MD5_SIZE+1]; |
| 972 | int i; |
| 973 | int ret; |
| 974 | |
| 975 | ospf_vl_config_data_init(&vl_config, vty); |
| 976 | |
| 977 | /* Read off first 2 parameters and check them */ |
| 978 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); |
| 979 | if (ret < 0) |
| 980 | { |
| 981 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 982 | return CMD_WARNING; |
| 983 | } |
| 984 | |
| 985 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 986 | if (! ret) |
| 987 | { |
| 988 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 989 | VTY_NEWLINE); |
| 990 | return CMD_WARNING; |
| 991 | } |
| 992 | |
| 993 | if (argc <=2) |
| 994 | { |
| 995 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 996 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 997 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 998 | } |
| 999 | |
| 1000 | /* Deal with other parameters */ |
| 1001 | for (i=2; i < argc; i++) |
| 1002 | { |
| 1003 | |
| 1004 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 1005 | |
| 1006 | switch (argv[i][0]) |
| 1007 | { |
| 1008 | |
| 1009 | case 'a': |
| 1010 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 1011 | { |
| 1012 | /* authentication-key - this option can occur anywhere on |
| 1013 | command line. At start of command line |
| 1014 | must check for authentication option. */ |
| 1015 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 1016 | strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); |
| 1017 | vl_config.auth_key = auth_key; |
| 1018 | i++; |
| 1019 | } |
| 1020 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1021 | { |
| 1022 | /* authentication - this option can only occur at start |
| 1023 | of command line */ |
| 1024 | vl_config.auth_type = OSPF_AUTH_SIMPLE; |
| 1025 | if ((i+1) < argc) |
| 1026 | { |
| 1027 | if (strncmp (argv[i+1], "n", 1) == 0) |
| 1028 | { |
| 1029 | /* "authentication null" */ |
| 1030 | vl_config.auth_type = OSPF_AUTH_NULL; |
| 1031 | i++; |
| 1032 | } |
| 1033 | else if (strncmp (argv[i+1], "m", 1) == 0 |
| 1034 | && strcmp (argv[i+1], "message-digest-") != 0) |
| 1035 | { |
| 1036 | /* "authentication message-digest" */ |
| 1037 | vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1038 | i++; |
| 1039 | } |
| 1040 | } |
| 1041 | } |
| 1042 | break; |
| 1043 | |
| 1044 | case 'm': |
| 1045 | /* message-digest-key */ |
| 1046 | i++; |
| 1047 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1048 | if (vl_config.crypto_key_id < 0) |
| 1049 | return CMD_WARNING; |
| 1050 | i++; |
| 1051 | memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); |
| 1052 | strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); |
| 1053 | vl_config.md5_key = md5_key; |
| 1054 | break; |
| 1055 | |
| 1056 | case 'h': |
| 1057 | /* Hello interval */ |
| 1058 | i++; |
| 1059 | vl_config.hello_interval = strtol (argv[i], NULL, 10); |
| 1060 | if (vl_config.hello_interval < 0) |
| 1061 | return CMD_WARNING; |
| 1062 | break; |
| 1063 | |
| 1064 | case 'r': |
| 1065 | /* Retransmit Interval */ |
| 1066 | i++; |
| 1067 | vl_config.retransmit_interval = strtol (argv[i], NULL, 10); |
| 1068 | if (vl_config.retransmit_interval < 0) |
| 1069 | return CMD_WARNING; |
| 1070 | break; |
| 1071 | |
| 1072 | case 't': |
| 1073 | /* Transmit Delay */ |
| 1074 | i++; |
| 1075 | vl_config.transmit_delay = strtol (argv[i], NULL, 10); |
| 1076 | if (vl_config.transmit_delay < 0) |
| 1077 | return CMD_WARNING; |
| 1078 | break; |
| 1079 | |
| 1080 | case 'd': |
| 1081 | /* Dead Interval */ |
| 1082 | i++; |
| 1083 | vl_config.dead_interval = strtol (argv[i], NULL, 10); |
| 1084 | if (vl_config.dead_interval < 0) |
| 1085 | return CMD_WARNING; |
| 1086 | break; |
| 1087 | } |
| 1088 | } |
| 1089 | |
| 1090 | |
| 1091 | /* Action configuration */ |
| 1092 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1093 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1094 | |
| 1095 | } |
| 1096 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1097 | DEFUN (no_ospf_area_vlink, |
| 1098 | no_ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1099 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 1100 | NO_STR |
| 1101 | VLINK_HELPSTR_IPADDR) |
| 1102 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1103 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1104 | struct ospf_area *area; |
| 1105 | struct ospf_vl_config_data vl_config; |
| 1106 | struct ospf_vl_data *vl_data = NULL; |
| 1107 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 1108 | int i; |
| 1109 | int ret, format; |
| 1110 | |
| 1111 | ospf_vl_config_data_init(&vl_config, vty); |
| 1112 | |
| 1113 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); |
| 1114 | if (ret < 0) |
| 1115 | { |
| 1116 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 1117 | return CMD_WARNING; |
| 1118 | } |
| 1119 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1120 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1121 | if (!area) |
| 1122 | { |
| 1123 | vty_out (vty, "Area does not exist%s", VTY_NEWLINE); |
| 1124 | return CMD_WARNING; |
| 1125 | } |
| 1126 | |
| 1127 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 1128 | if (! ret) |
| 1129 | { |
| 1130 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 1131 | VTY_NEWLINE); |
| 1132 | return CMD_WARNING; |
| 1133 | } |
| 1134 | |
| 1135 | if (argc <=2) |
| 1136 | { |
| 1137 | /* Basic VLink no command */ |
| 1138 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 1139 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1140 | ospf_vl_delete (ospf, vl_data); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1141 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1142 | ospf_area_check_free (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1143 | |
| 1144 | return CMD_SUCCESS; |
| 1145 | } |
| 1146 | |
| 1147 | /* If we are down here, we are reseting parameters */ |
| 1148 | |
| 1149 | /* Deal with other parameters */ |
| 1150 | for (i=2; i < argc; i++) |
| 1151 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1152 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 1153 | |
| 1154 | switch (argv[i][0]) |
| 1155 | { |
| 1156 | |
| 1157 | case 'a': |
| 1158 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 1159 | { |
| 1160 | /* authentication-key - this option can occur anywhere on |
| 1161 | command line. At start of command line |
| 1162 | must check for authentication option. */ |
| 1163 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 1164 | vl_config.auth_key = auth_key; |
| 1165 | } |
| 1166 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1167 | { |
| 1168 | /* authentication - this option can only occur at start |
| 1169 | of command line */ |
| 1170 | vl_config.auth_type = OSPF_AUTH_NOTSET; |
| 1171 | } |
| 1172 | break; |
| 1173 | |
| 1174 | case 'm': |
| 1175 | /* message-digest-key */ |
| 1176 | /* Delete one key */ |
| 1177 | i++; |
| 1178 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1179 | if (vl_config.crypto_key_id < 0) |
| 1180 | return CMD_WARNING; |
| 1181 | vl_config.md5_key = NULL; |
| 1182 | break; |
| 1183 | |
| 1184 | case 'h': |
| 1185 | /* Hello interval */ |
| 1186 | vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; |
| 1187 | break; |
| 1188 | |
| 1189 | case 'r': |
| 1190 | /* Retransmit Interval */ |
| 1191 | vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 1192 | break; |
| 1193 | |
| 1194 | case 't': |
| 1195 | /* Transmit Delay */ |
| 1196 | vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 1197 | break; |
| 1198 | |
| 1199 | case 'd': |
| 1200 | /* Dead Interval */ |
| 1201 | i++; |
| 1202 | vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 1203 | break; |
| 1204 | } |
| 1205 | } |
| 1206 | |
| 1207 | |
| 1208 | /* Action configuration */ |
| 1209 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1210 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1211 | } |
| 1212 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1213 | ALIAS (ospf_area_vlink, |
| 1214 | ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1215 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1216 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1217 | VLINK_HELPSTR_IPADDR |
| 1218 | VLINK_HELPSTR_TIME_PARAM) |
| 1219 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1220 | ALIAS (no_ospf_area_vlink, |
| 1221 | no_ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1222 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1223 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1224 | NO_STR |
| 1225 | VLINK_HELPSTR_IPADDR |
| 1226 | VLINK_HELPSTR_TIME_PARAM) |
| 1227 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1228 | ALIAS (ospf_area_vlink, |
| 1229 | ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1230 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1231 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1232 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1233 | VLINK_HELPSTR_IPADDR |
| 1234 | VLINK_HELPSTR_TIME_PARAM |
| 1235 | VLINK_HELPSTR_TIME_PARAM) |
| 1236 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1237 | ALIAS (no_ospf_area_vlink, |
| 1238 | no_ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1239 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1240 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1241 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1242 | NO_STR |
| 1243 | VLINK_HELPSTR_IPADDR |
| 1244 | VLINK_HELPSTR_TIME_PARAM |
| 1245 | VLINK_HELPSTR_TIME_PARAM) |
| 1246 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1247 | ALIAS (ospf_area_vlink, |
| 1248 | ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1249 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1250 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1251 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1252 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1253 | VLINK_HELPSTR_IPADDR |
| 1254 | VLINK_HELPSTR_TIME_PARAM |
| 1255 | VLINK_HELPSTR_TIME_PARAM |
| 1256 | VLINK_HELPSTR_TIME_PARAM) |
| 1257 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1258 | ALIAS (no_ospf_area_vlink, |
| 1259 | no_ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1260 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1261 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1262 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1263 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1264 | NO_STR |
| 1265 | VLINK_HELPSTR_IPADDR |
| 1266 | VLINK_HELPSTR_TIME_PARAM |
| 1267 | VLINK_HELPSTR_TIME_PARAM |
| 1268 | VLINK_HELPSTR_TIME_PARAM) |
| 1269 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1270 | ALIAS (ospf_area_vlink, |
| 1271 | ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1272 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1273 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1274 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1275 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1276 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1277 | VLINK_HELPSTR_IPADDR |
| 1278 | VLINK_HELPSTR_TIME_PARAM |
| 1279 | VLINK_HELPSTR_TIME_PARAM |
| 1280 | VLINK_HELPSTR_TIME_PARAM |
| 1281 | VLINK_HELPSTR_TIME_PARAM) |
| 1282 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1283 | ALIAS (no_ospf_area_vlink, |
| 1284 | no_ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1285 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1286 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1287 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1288 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1289 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1290 | NO_STR |
| 1291 | VLINK_HELPSTR_IPADDR |
| 1292 | VLINK_HELPSTR_TIME_PARAM |
| 1293 | VLINK_HELPSTR_TIME_PARAM |
| 1294 | VLINK_HELPSTR_TIME_PARAM |
| 1295 | VLINK_HELPSTR_TIME_PARAM) |
| 1296 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1297 | ALIAS (ospf_area_vlink, |
| 1298 | ospf_area_vlink_authtype_args_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|) (message-digest|null)", |
| 1301 | VLINK_HELPSTR_IPADDR |
| 1302 | VLINK_HELPSTR_AUTHTYPE_ALL) |
| 1303 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1304 | ALIAS (ospf_area_vlink, |
| 1305 | ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1306 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1307 | "(authentication|)", |
| 1308 | VLINK_HELPSTR_IPADDR |
| 1309 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1310 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1311 | ALIAS (no_ospf_area_vlink, |
| 1312 | no_ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1313 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1314 | "(authentication|)", |
| 1315 | NO_STR |
| 1316 | VLINK_HELPSTR_IPADDR |
| 1317 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1318 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1319 | ALIAS (ospf_area_vlink, |
| 1320 | ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1321 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1322 | "(message-digest-key|) <1-255> md5 KEY", |
| 1323 | VLINK_HELPSTR_IPADDR |
| 1324 | VLINK_HELPSTR_AUTH_MD5) |
| 1325 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1326 | ALIAS (no_ospf_area_vlink, |
| 1327 | no_ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1328 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1329 | "(message-digest-key|) <1-255>", |
| 1330 | NO_STR |
| 1331 | VLINK_HELPSTR_IPADDR |
| 1332 | VLINK_HELPSTR_AUTH_MD5) |
| 1333 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1334 | ALIAS (ospf_area_vlink, |
| 1335 | ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1336 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1337 | "(authentication-key|) AUTH_KEY", |
| 1338 | VLINK_HELPSTR_IPADDR |
| 1339 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1340 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1341 | ALIAS (no_ospf_area_vlink, |
| 1342 | no_ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1343 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1344 | "(authentication-key|)", |
| 1345 | NO_STR |
| 1346 | VLINK_HELPSTR_IPADDR |
| 1347 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1348 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1349 | ALIAS (ospf_area_vlink, |
| 1350 | ospf_area_vlink_authtype_args_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1351 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1352 | "(authentication|) (message-digest|null) " |
| 1353 | "(authentication-key|) AUTH_KEY", |
| 1354 | VLINK_HELPSTR_IPADDR |
| 1355 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1356 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1357 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1358 | ALIAS (ospf_area_vlink, |
| 1359 | ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1360 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1361 | "(authentication|) " |
| 1362 | "(authentication-key|) AUTH_KEY", |
| 1363 | VLINK_HELPSTR_IPADDR |
| 1364 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1365 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1366 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1367 | ALIAS (no_ospf_area_vlink, |
| 1368 | no_ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1369 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1370 | "(authentication|) " |
| 1371 | "(authentication-key|)", |
| 1372 | NO_STR |
| 1373 | VLINK_HELPSTR_IPADDR |
| 1374 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1375 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1376 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1377 | ALIAS (ospf_area_vlink, |
| 1378 | ospf_area_vlink_authtype_args_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1379 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1380 | "(authentication|) (message-digest|null) " |
| 1381 | "(message-digest-key|) <1-255> md5 KEY", |
| 1382 | VLINK_HELPSTR_IPADDR |
| 1383 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1384 | VLINK_HELPSTR_AUTH_MD5) |
| 1385 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1386 | ALIAS (ospf_area_vlink, |
| 1387 | ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1388 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1389 | "(authentication|) " |
| 1390 | "(message-digest-key|) <1-255> md5 KEY", |
| 1391 | VLINK_HELPSTR_IPADDR |
| 1392 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1393 | VLINK_HELPSTR_AUTH_MD5) |
| 1394 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1395 | ALIAS (no_ospf_area_vlink, |
| 1396 | no_ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1397 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1398 | "(authentication|) " |
| 1399 | "(message-digest-key|)", |
| 1400 | NO_STR |
| 1401 | VLINK_HELPSTR_IPADDR |
| 1402 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1403 | VLINK_HELPSTR_AUTH_MD5) |
| 1404 | |
| 1405 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1406 | DEFUN (ospf_area_shortcut, |
| 1407 | ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1408 | "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", |
| 1409 | "OSPF area parameters\n" |
| 1410 | "OSPF area ID in IP address format\n" |
| 1411 | "OSPF area ID as a decimal value\n" |
| 1412 | "Configure the area's shortcutting mode\n" |
| 1413 | "Set default shortcutting behavior\n" |
| 1414 | "Enable shortcutting through the area\n" |
| 1415 | "Disable shortcutting through the area\n") |
| 1416 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1417 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1418 | struct ospf_area *area; |
| 1419 | struct in_addr area_id; |
| 1420 | int mode; |
| 1421 | int format; |
| 1422 | |
| 1423 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1424 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1425 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1426 | |
| 1427 | if (strncmp (argv[1], "de", 2) == 0) |
| 1428 | mode = OSPF_SHORTCUT_DEFAULT; |
| 1429 | else if (strncmp (argv[1], "di", 2) == 0) |
| 1430 | mode = OSPF_SHORTCUT_DISABLE; |
| 1431 | else if (strncmp (argv[1], "e", 1) == 0) |
| 1432 | mode = OSPF_SHORTCUT_ENABLE; |
| 1433 | else |
| 1434 | return CMD_WARNING; |
| 1435 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1436 | ospf_area_shortcut_set (ospf, area, mode); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1437 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1438 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1439 | vty_out (vty, "Shortcut area setting will take effect " |
| 1440 | "only when the router is configured as Shortcut ABR%s", |
| 1441 | VTY_NEWLINE); |
| 1442 | |
| 1443 | return CMD_SUCCESS; |
| 1444 | } |
| 1445 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1446 | DEFUN (no_ospf_area_shortcut, |
| 1447 | no_ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1448 | "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", |
| 1449 | NO_STR |
| 1450 | "OSPF area parameters\n" |
| 1451 | "OSPF area ID in IP address format\n" |
| 1452 | "OSPF area ID as a decimal value\n" |
| 1453 | "Deconfigure the area's shortcutting mode\n" |
| 1454 | "Deconfigure enabled shortcutting through the area\n" |
| 1455 | "Deconfigure disabled shortcutting through the area\n") |
| 1456 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1457 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1458 | struct ospf_area *area; |
| 1459 | struct in_addr area_id; |
| 1460 | int format; |
| 1461 | |
| 1462 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1463 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1464 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1465 | if (!area) |
| 1466 | return CMD_SUCCESS; |
| 1467 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1468 | ospf_area_shortcut_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1469 | |
| 1470 | return CMD_SUCCESS; |
| 1471 | } |
| 1472 | |
| 1473 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1474 | DEFUN (ospf_area_stub, |
| 1475 | ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1476 | "area (A.B.C.D|<0-4294967295>) stub", |
| 1477 | "OSPF area parameters\n" |
| 1478 | "OSPF area ID in IP address format\n" |
| 1479 | "OSPF area ID as a decimal value\n" |
| 1480 | "Configure OSPF area as stub\n") |
| 1481 | { |
| 1482 | struct ospf *ospf = vty->index; |
| 1483 | struct in_addr area_id; |
| 1484 | int ret, format; |
| 1485 | |
| 1486 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1487 | |
| 1488 | ret = ospf_area_stub_set (ospf, area_id); |
| 1489 | if (ret == 0) |
| 1490 | { |
| 1491 | vty_out (vty, "First deconfigure all virtual link through this area%s", |
| 1492 | VTY_NEWLINE); |
| 1493 | return CMD_WARNING; |
| 1494 | } |
| 1495 | |
| 1496 | ospf_area_no_summary_unset (ospf, area_id); |
| 1497 | |
| 1498 | return CMD_SUCCESS; |
| 1499 | } |
| 1500 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1501 | DEFUN (ospf_area_stub_no_summary, |
| 1502 | ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1503 | "area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1504 | "OSPF stub parameters\n" |
| 1505 | "OSPF area ID in IP address format\n" |
| 1506 | "OSPF area ID as a decimal value\n" |
| 1507 | "Configure OSPF area as stub\n" |
| 1508 | "Do not inject inter-area routes into stub\n") |
| 1509 | { |
| 1510 | struct ospf *ospf = vty->index; |
| 1511 | struct in_addr area_id; |
| 1512 | int ret, format; |
| 1513 | |
| 1514 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1515 | |
| 1516 | ret = ospf_area_stub_set (ospf, area_id); |
| 1517 | if (ret == 0) |
| 1518 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1519 | 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] | 1520 | VTY_NEWLINE); |
| 1521 | return CMD_WARNING; |
| 1522 | } |
| 1523 | |
| 1524 | ospf_area_no_summary_set (ospf, area_id); |
| 1525 | |
| 1526 | return CMD_SUCCESS; |
| 1527 | } |
| 1528 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1529 | DEFUN (no_ospf_area_stub, |
| 1530 | no_ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1531 | "no area (A.B.C.D|<0-4294967295>) stub", |
| 1532 | NO_STR |
| 1533 | "OSPF area parameters\n" |
| 1534 | "OSPF area ID in IP address format\n" |
| 1535 | "OSPF area ID as a decimal value\n" |
| 1536 | "Configure OSPF area as stub\n") |
| 1537 | { |
| 1538 | struct ospf *ospf = vty->index; |
| 1539 | struct in_addr area_id; |
| 1540 | int format; |
| 1541 | |
| 1542 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1543 | |
| 1544 | ospf_area_stub_unset (ospf, area_id); |
| 1545 | ospf_area_no_summary_unset (ospf, area_id); |
| 1546 | |
| 1547 | return CMD_SUCCESS; |
| 1548 | } |
| 1549 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1550 | DEFUN (no_ospf_area_stub_no_summary, |
| 1551 | no_ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1552 | "no area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1553 | NO_STR |
| 1554 | "OSPF area parameters\n" |
| 1555 | "OSPF area ID in IP address format\n" |
| 1556 | "OSPF area ID as a decimal value\n" |
| 1557 | "Configure OSPF area as stub\n" |
| 1558 | "Do not inject inter-area routes into area\n") |
| 1559 | { |
| 1560 | struct ospf *ospf = vty->index; |
| 1561 | struct in_addr area_id; |
| 1562 | int format; |
| 1563 | |
| 1564 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1565 | ospf_area_no_summary_unset (ospf, area_id); |
| 1566 | |
| 1567 | return CMD_SUCCESS; |
| 1568 | } |
| 1569 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1570 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 1571 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
| 1572 | int nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1573 | { |
| 1574 | struct ospf *ospf = vty->index; |
| 1575 | struct in_addr area_id; |
| 1576 | int ret, format; |
| 1577 | |
| 1578 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1579 | |
| 1580 | ret = ospf_area_nssa_set (ospf, area_id); |
| 1581 | if (ret == 0) |
| 1582 | { |
| 1583 | vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", |
| 1584 | VTY_NEWLINE); |
| 1585 | return CMD_WARNING; |
| 1586 | } |
| 1587 | |
| 1588 | if (argc > 1) |
| 1589 | { |
| 1590 | if (strncmp (argv[1], "translate-c", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1591 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1592 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1593 | else if (strncmp (argv[1], "translate-n", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1594 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1595 | OSPF_NSSA_ROLE_NEVER); |
| 1596 | else if (strncmp (argv[1], "translate-a", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1597 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1598 | OSPF_NSSA_ROLE_ALWAYS); |
| 1599 | } |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1600 | else |
| 1601 | { |
| 1602 | ospf_area_nssa_translator_role_set (ospf, area_id, |
| 1603 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1604 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1605 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1606 | if (nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1607 | ospf_area_no_summary_set (ospf, area_id); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1608 | else |
| 1609 | ospf_area_no_summary_unset (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1610 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1611 | ospf_schedule_abr_task (ospf); |
| 1612 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1613 | return CMD_SUCCESS; |
| 1614 | } |
| 1615 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1616 | DEFUN (ospf_area_nssa_translate_no_summary, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1617 | ospf_area_nssa_translate_no_summary_cmd, |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1618 | "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] | 1619 | "OSPF area parameters\n" |
| 1620 | "OSPF area ID in IP address format\n" |
| 1621 | "OSPF area ID as a decimal value\n" |
| 1622 | "Configure OSPF area as nssa\n" |
| 1623 | "Configure NSSA-ABR for translate election (default)\n" |
| 1624 | "Configure NSSA-ABR to never translate\n" |
| 1625 | "Configure NSSA-ABR to always translate\n" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1626 | "Do not inject inter-area routes into nssa\n") |
| 1627 | { |
| 1628 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
| 1629 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1630 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1631 | DEFUN (ospf_area_nssa_translate, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1632 | ospf_area_nssa_translate_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1633 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", |
| 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 | "Configure NSSA-ABR for translate election (default)\n" |
| 1639 | "Configure NSSA-ABR to never translate\n" |
| 1640 | "Configure NSSA-ABR to always translate\n") |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1641 | { |
| 1642 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1643 | } |
| 1644 | |
| 1645 | DEFUN (ospf_area_nssa, |
| 1646 | ospf_area_nssa_cmd, |
| 1647 | "area (A.B.C.D|<0-4294967295>) nssa", |
| 1648 | "OSPF area parameters\n" |
| 1649 | "OSPF area ID in IP address format\n" |
| 1650 | "OSPF area ID as a decimal value\n" |
| 1651 | "Configure OSPF area as nssa\n") |
| 1652 | { |
| 1653 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1654 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1655 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1656 | DEFUN (ospf_area_nssa_no_summary, |
| 1657 | ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1658 | "area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1659 | "OSPF area parameters\n" |
| 1660 | "OSPF area ID in IP address format\n" |
| 1661 | "OSPF area ID as a decimal value\n" |
| 1662 | "Configure OSPF area as nssa\n" |
| 1663 | "Do not inject inter-area routes into nssa\n") |
| 1664 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1665 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1666 | } |
| 1667 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1668 | DEFUN (no_ospf_area_nssa, |
| 1669 | no_ospf_area_nssa_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1670 | "no area (A.B.C.D|<0-4294967295>) nssa", |
| 1671 | NO_STR |
| 1672 | "OSPF area parameters\n" |
| 1673 | "OSPF area ID in IP address format\n" |
| 1674 | "OSPF area ID as a decimal value\n" |
| 1675 | "Configure OSPF area as nssa\n") |
| 1676 | { |
| 1677 | struct ospf *ospf = vty->index; |
| 1678 | struct in_addr area_id; |
| 1679 | int format; |
| 1680 | |
| 1681 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1682 | |
| 1683 | ospf_area_nssa_unset (ospf, area_id); |
| 1684 | ospf_area_no_summary_unset (ospf, area_id); |
| 1685 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1686 | ospf_schedule_abr_task (ospf); |
| 1687 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1688 | return CMD_SUCCESS; |
| 1689 | } |
| 1690 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1691 | DEFUN (no_ospf_area_nssa_no_summary, |
| 1692 | no_ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1693 | "no area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1694 | NO_STR |
| 1695 | "OSPF area parameters\n" |
| 1696 | "OSPF area ID in IP address format\n" |
| 1697 | "OSPF area ID as a decimal value\n" |
| 1698 | "Configure OSPF area as nssa\n" |
| 1699 | "Do not inject inter-area routes into nssa\n") |
| 1700 | { |
| 1701 | struct ospf *ospf = vty->index; |
| 1702 | struct in_addr area_id; |
| 1703 | int format; |
| 1704 | |
| 1705 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1706 | ospf_area_no_summary_unset (ospf, area_id); |
| 1707 | |
| 1708 | return CMD_SUCCESS; |
| 1709 | } |
| 1710 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1711 | DEFUN (ospf_area_default_cost, |
| 1712 | ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1713 | "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1714 | "OSPF area parameters\n" |
| 1715 | "OSPF area ID in IP address format\n" |
| 1716 | "OSPF area ID as a decimal value\n" |
| 1717 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1718 | "Stub's advertised default summary cost\n") |
| 1719 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1720 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1721 | struct ospf_area *area; |
| 1722 | struct in_addr area_id; |
| 1723 | u_int32_t cost; |
| 1724 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1725 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1726 | |
| 1727 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1728 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1729 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1730 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1731 | |
| 1732 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1733 | { |
| 1734 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1735 | return CMD_WARNING; |
| 1736 | } |
| 1737 | |
| 1738 | area->default_cost = cost; |
| 1739 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1740 | p.family = AF_INET; |
| 1741 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1742 | p.prefixlen = 0; |
| 1743 | if (IS_DEBUG_OSPF_EVENT) |
| 1744 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1745 | "announcing 0.0.0.0/0 to area %s", |
| 1746 | inet_ntoa (area->area_id)); |
| 1747 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1748 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1749 | return CMD_SUCCESS; |
| 1750 | } |
| 1751 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1752 | DEFUN (no_ospf_area_default_cost, |
| 1753 | no_ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1754 | "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1755 | NO_STR |
| 1756 | "OSPF area parameters\n" |
| 1757 | "OSPF area ID in IP address format\n" |
| 1758 | "OSPF area ID as a decimal value\n" |
| 1759 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1760 | "Stub's advertised default summary cost\n") |
| 1761 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1762 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1763 | struct ospf_area *area; |
| 1764 | struct in_addr area_id; |
| 1765 | u_int32_t cost; |
| 1766 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1767 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1768 | |
| 1769 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1770 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1771 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1772 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1773 | if (area == NULL) |
| 1774 | return CMD_SUCCESS; |
| 1775 | |
| 1776 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1777 | { |
| 1778 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1779 | return CMD_WARNING; |
| 1780 | } |
| 1781 | |
| 1782 | area->default_cost = 1; |
| 1783 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1784 | p.family = AF_INET; |
| 1785 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1786 | p.prefixlen = 0; |
| 1787 | if (IS_DEBUG_OSPF_EVENT) |
| 1788 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1789 | "announcing 0.0.0.0/0 to area %s", |
| 1790 | inet_ntoa (area->area_id)); |
| 1791 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1792 | |
| 1793 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1794 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1795 | |
| 1796 | return CMD_SUCCESS; |
| 1797 | } |
| 1798 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1799 | DEFUN (ospf_area_export_list, |
| 1800 | ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1801 | "area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1802 | "OSPF area parameters\n" |
| 1803 | "OSPF area ID in IP address format\n" |
| 1804 | "OSPF area ID as a decimal value\n" |
| 1805 | "Set the filter for networks announced to other areas\n" |
| 1806 | "Name of the access-list\n") |
| 1807 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1808 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1809 | struct ospf_area *area; |
| 1810 | struct in_addr area_id; |
| 1811 | int format; |
| 1812 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1813 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1814 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1815 | area = ospf_area_get (ospf, area_id, format); |
| 1816 | ospf_area_export_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1817 | |
| 1818 | return CMD_SUCCESS; |
| 1819 | } |
| 1820 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1821 | DEFUN (no_ospf_area_export_list, |
| 1822 | no_ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1823 | "no area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1824 | NO_STR |
| 1825 | "OSPF area parameters\n" |
| 1826 | "OSPF area ID in IP address format\n" |
| 1827 | "OSPF area ID as a decimal value\n" |
| 1828 | "Unset the filter for networks announced to other areas\n" |
| 1829 | "Name of the access-list\n") |
| 1830 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1831 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1832 | struct ospf_area *area; |
| 1833 | struct in_addr area_id; |
| 1834 | int format; |
| 1835 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1836 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1837 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1838 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1839 | if (area == NULL) |
| 1840 | return CMD_SUCCESS; |
| 1841 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1842 | ospf_area_export_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1843 | |
| 1844 | return CMD_SUCCESS; |
| 1845 | } |
| 1846 | |
| 1847 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1848 | DEFUN (ospf_area_import_list, |
| 1849 | ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1850 | "area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1851 | "OSPF area parameters\n" |
| 1852 | "OSPF area ID in IP address format\n" |
| 1853 | "OSPF area ID as a decimal value\n" |
| 1854 | "Set the filter for networks from other areas announced to the specified one\n" |
| 1855 | "Name of the access-list\n") |
| 1856 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1857 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1858 | struct ospf_area *area; |
| 1859 | struct in_addr area_id; |
| 1860 | int format; |
| 1861 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1862 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1863 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1864 | area = ospf_area_get (ospf, area_id, format); |
| 1865 | ospf_area_import_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1866 | |
| 1867 | return CMD_SUCCESS; |
| 1868 | } |
| 1869 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1870 | DEFUN (no_ospf_area_import_list, |
| 1871 | no_ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1872 | "no area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1873 | NO_STR |
| 1874 | "OSPF area parameters\n" |
| 1875 | "OSPF area ID in IP address format\n" |
| 1876 | "OSPF area ID as a decimal value\n" |
| 1877 | "Unset the filter for networks announced to other areas\n" |
| 1878 | "Name of the access-list\n") |
| 1879 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1880 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1881 | struct ospf_area *area; |
| 1882 | struct in_addr area_id; |
| 1883 | int format; |
| 1884 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1885 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1886 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1887 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1888 | if (area == NULL) |
| 1889 | return CMD_SUCCESS; |
| 1890 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1891 | ospf_area_import_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1892 | |
| 1893 | return CMD_SUCCESS; |
| 1894 | } |
| 1895 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1896 | DEFUN (ospf_area_filter_list, |
| 1897 | ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1898 | "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1899 | "OSPF area parameters\n" |
| 1900 | "OSPF area ID in IP address format\n" |
| 1901 | "OSPF area ID as a decimal value\n" |
| 1902 | "Filter networks between OSPF areas\n" |
| 1903 | "Filter prefixes between OSPF areas\n" |
| 1904 | "Name of an IP prefix-list\n" |
| 1905 | "Filter networks sent to this area\n" |
| 1906 | "Filter networks sent from this area\n") |
| 1907 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1908 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1909 | struct ospf_area *area; |
| 1910 | struct in_addr area_id; |
| 1911 | struct prefix_list *plist; |
| 1912 | int format; |
| 1913 | |
| 1914 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1915 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1916 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1917 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1918 | if (strncmp (argv[2], "in", 2) == 0) |
| 1919 | { |
| 1920 | PREFIX_LIST_IN (area) = plist; |
| 1921 | if (PREFIX_NAME_IN (area)) |
| 1922 | free (PREFIX_NAME_IN (area)); |
| 1923 | |
| 1924 | PREFIX_NAME_IN (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1925 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1926 | } |
| 1927 | else |
| 1928 | { |
| 1929 | PREFIX_LIST_OUT (area) = plist; |
| 1930 | if (PREFIX_NAME_OUT (area)) |
| 1931 | free (PREFIX_NAME_OUT (area)); |
| 1932 | |
| 1933 | PREFIX_NAME_OUT (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1934 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1935 | } |
| 1936 | |
| 1937 | return CMD_SUCCESS; |
| 1938 | } |
| 1939 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1940 | DEFUN (no_ospf_area_filter_list, |
| 1941 | no_ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1942 | "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1943 | NO_STR |
| 1944 | "OSPF area parameters\n" |
| 1945 | "OSPF area ID in IP address format\n" |
| 1946 | "OSPF area ID as a decimal value\n" |
| 1947 | "Filter networks between OSPF areas\n" |
| 1948 | "Filter prefixes between OSPF areas\n" |
| 1949 | "Name of an IP prefix-list\n" |
| 1950 | "Filter networks sent to this area\n" |
| 1951 | "Filter networks sent from this area\n") |
| 1952 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1953 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1954 | struct ospf_area *area; |
| 1955 | struct in_addr area_id; |
| 1956 | struct prefix_list *plist; |
| 1957 | int format; |
| 1958 | |
| 1959 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1960 | |
Paul Jakma | 1a8ec2b | 2006-05-11 13:34:08 +0000 | [diff] [blame] | 1961 | if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) |
| 1962 | return CMD_SUCCESS; |
| 1963 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1964 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1965 | if (strncmp (argv[2], "in", 2) == 0) |
| 1966 | { |
| 1967 | if (PREFIX_NAME_IN (area)) |
| 1968 | if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) |
| 1969 | return CMD_SUCCESS; |
| 1970 | |
| 1971 | PREFIX_LIST_IN (area) = NULL; |
| 1972 | if (PREFIX_NAME_IN (area)) |
| 1973 | free (PREFIX_NAME_IN (area)); |
| 1974 | |
| 1975 | PREFIX_NAME_IN (area) = NULL; |
| 1976 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1977 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1978 | } |
| 1979 | else |
| 1980 | { |
| 1981 | if (PREFIX_NAME_OUT (area)) |
| 1982 | if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) |
| 1983 | return CMD_SUCCESS; |
| 1984 | |
| 1985 | PREFIX_LIST_OUT (area) = NULL; |
| 1986 | if (PREFIX_NAME_OUT (area)) |
| 1987 | free (PREFIX_NAME_OUT (area)); |
| 1988 | |
| 1989 | PREFIX_NAME_OUT (area) = NULL; |
| 1990 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1991 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1992 | } |
| 1993 | |
| 1994 | return CMD_SUCCESS; |
| 1995 | } |
| 1996 | |
| 1997 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1998 | DEFUN (ospf_area_authentication_message_digest, |
| 1999 | ospf_area_authentication_message_digest_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2000 | "area (A.B.C.D|<0-4294967295>) authentication message-digest", |
| 2001 | "OSPF area parameters\n" |
| 2002 | "Enable authentication\n" |
| 2003 | "Use message-digest authentication\n") |
| 2004 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2005 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2006 | struct ospf_area *area; |
| 2007 | struct in_addr area_id; |
| 2008 | int format; |
| 2009 | |
| 2010 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2011 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2012 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2013 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 2014 | |
| 2015 | return CMD_SUCCESS; |
| 2016 | } |
| 2017 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2018 | DEFUN (ospf_area_authentication, |
| 2019 | ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2020 | "area (A.B.C.D|<0-4294967295>) authentication", |
| 2021 | "OSPF area parameters\n" |
| 2022 | "OSPF area ID in IP address format\n" |
| 2023 | "OSPF area ID as a decimal value\n" |
| 2024 | "Enable authentication\n") |
| 2025 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2026 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2027 | struct ospf_area *area; |
| 2028 | struct in_addr area_id; |
| 2029 | int format; |
| 2030 | |
| 2031 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2032 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2033 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2034 | area->auth_type = OSPF_AUTH_SIMPLE; |
| 2035 | |
| 2036 | return CMD_SUCCESS; |
| 2037 | } |
| 2038 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2039 | DEFUN (no_ospf_area_authentication, |
| 2040 | no_ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2041 | "no area (A.B.C.D|<0-4294967295>) authentication", |
| 2042 | NO_STR |
| 2043 | "OSPF area parameters\n" |
| 2044 | "OSPF area ID in IP address format\n" |
| 2045 | "OSPF area ID as a decimal value\n" |
| 2046 | "Enable authentication\n") |
| 2047 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2048 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2049 | struct ospf_area *area; |
| 2050 | struct in_addr area_id; |
| 2051 | int format; |
| 2052 | |
| 2053 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2054 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2055 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2056 | if (area == NULL) |
| 2057 | return CMD_SUCCESS; |
| 2058 | |
| 2059 | area->auth_type = OSPF_AUTH_NULL; |
| 2060 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2061 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2062 | |
| 2063 | return CMD_SUCCESS; |
| 2064 | } |
| 2065 | |
| 2066 | |
| 2067 | DEFUN (ospf_abr_type, |
| 2068 | ospf_abr_type_cmd, |
| 2069 | "ospf abr-type (cisco|ibm|shortcut|standard)", |
| 2070 | "OSPF specific commands\n" |
| 2071 | "Set OSPF ABR type\n" |
| 2072 | "Alternative ABR, cisco implementation\n" |
| 2073 | "Alternative ABR, IBM implementation\n" |
| 2074 | "Shortcut ABR\n" |
| 2075 | "Standard behavior (RFC2328)\n") |
| 2076 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2077 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2078 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2079 | |
| 2080 | if (strncmp (argv[0], "c", 1) == 0) |
| 2081 | abr_type = OSPF_ABR_CISCO; |
| 2082 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2083 | abr_type = OSPF_ABR_IBM; |
| 2084 | else if (strncmp (argv[0], "sh", 2) == 0) |
| 2085 | abr_type = OSPF_ABR_SHORTCUT; |
| 2086 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2087 | abr_type = OSPF_ABR_STAND; |
| 2088 | else |
| 2089 | return CMD_WARNING; |
| 2090 | |
| 2091 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2092 | if (ospf->abr_type != abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2093 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2094 | ospf->abr_type = abr_type; |
| 2095 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2096 | } |
| 2097 | |
| 2098 | return CMD_SUCCESS; |
| 2099 | } |
| 2100 | |
| 2101 | DEFUN (no_ospf_abr_type, |
| 2102 | no_ospf_abr_type_cmd, |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2103 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2104 | NO_STR |
| 2105 | "OSPF specific commands\n" |
| 2106 | "Set OSPF ABR type\n" |
| 2107 | "Alternative ABR, cisco implementation\n" |
| 2108 | "Alternative ABR, IBM implementation\n" |
| 2109 | "Shortcut ABR\n") |
| 2110 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2111 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2112 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2113 | |
| 2114 | if (strncmp (argv[0], "c", 1) == 0) |
| 2115 | abr_type = OSPF_ABR_CISCO; |
| 2116 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2117 | abr_type = OSPF_ABR_IBM; |
Francesco Dolcini | 04d2331 | 2009-06-02 18:20:09 +0100 | [diff] [blame] | 2118 | else if (strncmp (argv[0], "sh", 2) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2119 | abr_type = OSPF_ABR_SHORTCUT; |
Francesco Dolcini | 04d2331 | 2009-06-02 18:20:09 +0100 | [diff] [blame] | 2120 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2121 | abr_type = OSPF_ABR_STAND; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2122 | else |
| 2123 | return CMD_WARNING; |
| 2124 | |
| 2125 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2126 | if (ospf->abr_type == abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2127 | { |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2128 | ospf->abr_type = OSPF_ABR_DEFAULT; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2129 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2130 | } |
| 2131 | |
| 2132 | return CMD_SUCCESS; |
| 2133 | } |
| 2134 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 2135 | DEFUN (ospf_log_adjacency_changes, |
| 2136 | ospf_log_adjacency_changes_cmd, |
| 2137 | "log-adjacency-changes", |
| 2138 | "Log changes in adjacency state\n") |
| 2139 | { |
| 2140 | struct ospf *ospf = vty->index; |
| 2141 | |
| 2142 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2143 | return CMD_SUCCESS; |
| 2144 | } |
| 2145 | |
| 2146 | DEFUN (ospf_log_adjacency_changes_detail, |
| 2147 | ospf_log_adjacency_changes_detail_cmd, |
| 2148 | "log-adjacency-changes detail", |
| 2149 | "Log changes in adjacency state\n" |
| 2150 | "Log all state changes\n") |
| 2151 | { |
| 2152 | struct ospf *ospf = vty->index; |
| 2153 | |
| 2154 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2155 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2156 | return CMD_SUCCESS; |
| 2157 | } |
| 2158 | |
| 2159 | DEFUN (no_ospf_log_adjacency_changes, |
| 2160 | no_ospf_log_adjacency_changes_cmd, |
| 2161 | "no log-adjacency-changes", |
| 2162 | NO_STR |
| 2163 | "Log changes in adjacency state\n") |
| 2164 | { |
| 2165 | struct ospf *ospf = vty->index; |
| 2166 | |
| 2167 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2168 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2169 | return CMD_SUCCESS; |
| 2170 | } |
| 2171 | |
| 2172 | DEFUN (no_ospf_log_adjacency_changes_detail, |
| 2173 | no_ospf_log_adjacency_changes_detail_cmd, |
| 2174 | "no log-adjacency-changes detail", |
| 2175 | NO_STR |
| 2176 | "Log changes in adjacency state\n" |
| 2177 | "Log all state changes\n") |
| 2178 | { |
| 2179 | struct ospf *ospf = vty->index; |
| 2180 | |
| 2181 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2182 | return CMD_SUCCESS; |
| 2183 | } |
| 2184 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2185 | DEFUN (ospf_compatible_rfc1583, |
| 2186 | ospf_compatible_rfc1583_cmd, |
| 2187 | "compatible rfc1583", |
| 2188 | "OSPF compatibility list\n" |
| 2189 | "compatible with RFC 1583\n") |
| 2190 | { |
| 2191 | struct ospf *ospf = vty->index; |
| 2192 | |
| 2193 | if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2194 | { |
| 2195 | SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2196 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2197 | } |
| 2198 | return CMD_SUCCESS; |
| 2199 | } |
| 2200 | |
| 2201 | DEFUN (no_ospf_compatible_rfc1583, |
| 2202 | no_ospf_compatible_rfc1583_cmd, |
| 2203 | "no compatible rfc1583", |
| 2204 | NO_STR |
| 2205 | "OSPF compatibility list\n" |
| 2206 | "compatible with RFC 1583\n") |
| 2207 | { |
| 2208 | struct ospf *ospf = vty->index; |
| 2209 | |
| 2210 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2211 | { |
| 2212 | UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2213 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2214 | } |
| 2215 | return CMD_SUCCESS; |
| 2216 | } |
| 2217 | |
| 2218 | ALIAS (ospf_compatible_rfc1583, |
| 2219 | ospf_rfc1583_flag_cmd, |
| 2220 | "ospf rfc1583compatibility", |
| 2221 | "OSPF specific commands\n" |
| 2222 | "Enable the RFC1583Compatibility flag\n") |
| 2223 | |
| 2224 | ALIAS (no_ospf_compatible_rfc1583, |
| 2225 | no_ospf_rfc1583_flag_cmd, |
| 2226 | "no ospf rfc1583compatibility", |
| 2227 | NO_STR |
| 2228 | "OSPF specific commands\n" |
| 2229 | "Disable the RFC1583Compatibility flag\n") |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2230 | |
| 2231 | static int |
| 2232 | ospf_timers_spf_set (struct vty *vty, unsigned int delay, |
| 2233 | unsigned int hold, |
| 2234 | unsigned int max) |
| 2235 | { |
| 2236 | struct ospf *ospf = vty->index; |
| 2237 | |
| 2238 | ospf->spf_delay = delay; |
| 2239 | ospf->spf_holdtime = hold; |
| 2240 | ospf->spf_max_holdtime = max; |
| 2241 | |
| 2242 | return CMD_SUCCESS; |
| 2243 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2244 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2245 | DEFUN (ospf_timers_throttle_spf, |
| 2246 | ospf_timers_throttle_spf_cmd, |
| 2247 | "timers throttle spf <0-600000> <0-600000> <0-600000>", |
| 2248 | "Adjust routing timers\n" |
| 2249 | "Throttling adaptive timer\n" |
| 2250 | "OSPF SPF timers\n" |
| 2251 | "Delay (msec) from first change received till SPF calculation\n" |
| 2252 | "Initial hold time (msec) between consecutive SPF calculations\n" |
| 2253 | "Maximum hold time (msec)\n") |
| 2254 | { |
| 2255 | unsigned int delay, hold, max; |
| 2256 | |
| 2257 | if (argc != 3) |
| 2258 | { |
| 2259 | vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); |
| 2260 | return CMD_WARNING; |
| 2261 | } |
| 2262 | |
| 2263 | VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); |
| 2264 | VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); |
| 2265 | VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); |
| 2266 | |
| 2267 | return ospf_timers_spf_set (vty, delay, hold, max); |
| 2268 | } |
| 2269 | |
| 2270 | DEFUN_DEPRECATED (ospf_timers_spf, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2271 | ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2272 | "timers spf <0-4294967295> <0-4294967295>", |
| 2273 | "Adjust routing timers\n" |
| 2274 | "OSPF SPF timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2275 | "Delay (s) between receiving a change to SPF calculation\n" |
| 2276 | "Hold time (s) between consecutive SPF calculations\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2277 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2278 | unsigned int delay, hold; |
| 2279 | |
| 2280 | if (argc != 2) |
| 2281 | { |
| 2282 | vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); |
| 2283 | return CMD_WARNING; |
| 2284 | } |
| 2285 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2286 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
| 2287 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2288 | |
| 2289 | /* truncate down the second values if they're greater than 600000ms */ |
| 2290 | if (delay > (600000 / 1000)) |
| 2291 | delay = 600000; |
| 2292 | else if (delay == 0) |
| 2293 | /* 0s delay was probably specified because of lack of ms resolution */ |
| 2294 | delay = OSPF_SPF_DELAY_DEFAULT; |
| 2295 | if (hold > (600000 / 1000)) |
| 2296 | hold = 600000; |
| 2297 | |
| 2298 | return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2299 | } |
| 2300 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2301 | DEFUN (no_ospf_timers_throttle_spf, |
| 2302 | no_ospf_timers_throttle_spf_cmd, |
| 2303 | "no timers throttle spf", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2304 | NO_STR |
| 2305 | "Adjust routing timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2306 | "Throttling adaptive timer\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2307 | "OSPF SPF timers\n") |
| 2308 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2309 | return ospf_timers_spf_set (vty, |
| 2310 | OSPF_SPF_DELAY_DEFAULT, |
| 2311 | OSPF_SPF_HOLDTIME_DEFAULT, |
| 2312 | OSPF_SPF_MAX_HOLDTIME_DEFAULT); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2313 | } |
| 2314 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2315 | ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, |
| 2316 | no_ospf_timers_spf_cmd, |
| 2317 | "no timers spf", |
| 2318 | NO_STR |
| 2319 | "Adjust routing timers\n" |
| 2320 | "OSPF SPF timers\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2321 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2322 | DEFUN (ospf_neighbor, |
| 2323 | ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2324 | "neighbor A.B.C.D", |
| 2325 | NEIGHBOR_STR |
| 2326 | "Neighbor IP address\n") |
| 2327 | { |
| 2328 | struct ospf *ospf = vty->index; |
| 2329 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2330 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2331 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2332 | |
| 2333 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2334 | |
| 2335 | if (argc > 1) |
| 2336 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); |
| 2337 | |
| 2338 | if (argc > 2) |
| 2339 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); |
| 2340 | |
| 2341 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2342 | if (argc > 1) |
| 2343 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2344 | if (argc > 2) |
| 2345 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); |
| 2346 | |
| 2347 | return CMD_SUCCESS; |
| 2348 | } |
| 2349 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2350 | ALIAS (ospf_neighbor, |
| 2351 | ospf_neighbor_priority_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2352 | "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2353 | NEIGHBOR_STR |
| 2354 | "Neighbor IP address\n" |
| 2355 | "Neighbor Priority\n" |
| 2356 | "Priority\n" |
| 2357 | "Dead Neighbor Polling interval\n" |
| 2358 | "Seconds\n") |
| 2359 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2360 | ALIAS (ospf_neighbor, |
| 2361 | ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2362 | "neighbor A.B.C.D priority <0-255>", |
| 2363 | NEIGHBOR_STR |
| 2364 | "Neighbor IP address\n" |
| 2365 | "Neighbor Priority\n" |
| 2366 | "Seconds\n") |
| 2367 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2368 | DEFUN (ospf_neighbor_poll_interval, |
| 2369 | ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2370 | "neighbor A.B.C.D poll-interval <1-65535>", |
| 2371 | NEIGHBOR_STR |
| 2372 | "Neighbor IP address\n" |
| 2373 | "Dead Neighbor Polling interval\n" |
| 2374 | "Seconds\n") |
| 2375 | { |
| 2376 | struct ospf *ospf = vty->index; |
| 2377 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2378 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2379 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2380 | |
| 2381 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2382 | |
| 2383 | if (argc > 1) |
| 2384 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); |
| 2385 | |
| 2386 | if (argc > 2) |
| 2387 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); |
| 2388 | |
| 2389 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2390 | if (argc > 1) |
| 2391 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); |
| 2392 | if (argc > 2) |
| 2393 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2394 | |
| 2395 | return CMD_SUCCESS; |
| 2396 | } |
| 2397 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2398 | ALIAS (ospf_neighbor_poll_interval, |
| 2399 | ospf_neighbor_poll_interval_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2400 | "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", |
| 2401 | NEIGHBOR_STR |
| 2402 | "Neighbor address\n" |
| 2403 | "OSPF dead-router polling interval\n" |
| 2404 | "Seconds\n" |
| 2405 | "OSPF priority of non-broadcast neighbor\n" |
| 2406 | "Priority\n") |
| 2407 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2408 | DEFUN (no_ospf_neighbor, |
| 2409 | no_ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2410 | "no neighbor A.B.C.D", |
| 2411 | NO_STR |
| 2412 | NEIGHBOR_STR |
| 2413 | "Neighbor IP address\n") |
| 2414 | { |
| 2415 | struct ospf *ospf = vty->index; |
| 2416 | struct in_addr nbr_addr; |
| 2417 | int ret; |
| 2418 | |
| 2419 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2420 | |
| 2421 | ret = ospf_nbr_nbma_unset (ospf, nbr_addr); |
| 2422 | |
| 2423 | return CMD_SUCCESS; |
| 2424 | } |
| 2425 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2426 | ALIAS (no_ospf_neighbor, |
| 2427 | no_ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2428 | "no neighbor A.B.C.D priority <0-255>", |
| 2429 | NO_STR |
| 2430 | NEIGHBOR_STR |
| 2431 | "Neighbor IP address\n" |
| 2432 | "Neighbor Priority\n" |
| 2433 | "Priority\n") |
| 2434 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2435 | ALIAS (no_ospf_neighbor, |
| 2436 | no_ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2437 | "no neighbor A.B.C.D poll-interval <1-65535>", |
| 2438 | NO_STR |
| 2439 | NEIGHBOR_STR |
| 2440 | "Neighbor IP address\n" |
| 2441 | "Dead Neighbor Polling interval\n" |
| 2442 | "Seconds\n") |
| 2443 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2444 | ALIAS (no_ospf_neighbor, |
| 2445 | no_ospf_neighbor_priority_pollinterval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2446 | "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2447 | NO_STR |
| 2448 | NEIGHBOR_STR |
| 2449 | "Neighbor IP address\n" |
| 2450 | "Neighbor Priority\n" |
| 2451 | "Priority\n" |
| 2452 | "Dead Neighbor Polling interval\n" |
| 2453 | "Seconds\n") |
| 2454 | |
| 2455 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2456 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2457 | "refresh timer <10-1800>", |
| 2458 | "Adjust refresh parameters\n" |
| 2459 | "Set refresh timer\n" |
| 2460 | "Timer value in seconds\n") |
| 2461 | { |
| 2462 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2463 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2464 | |
| 2465 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2466 | interval = (interval / 10) * 10; |
| 2467 | |
| 2468 | ospf_timers_refresh_set (ospf, interval); |
| 2469 | |
| 2470 | return CMD_SUCCESS; |
| 2471 | } |
| 2472 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2473 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2474 | "no refresh timer <10-1800>", |
| 2475 | "Adjust refresh parameters\n" |
| 2476 | "Unset refresh timer\n" |
| 2477 | "Timer value in seconds\n") |
| 2478 | { |
| 2479 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2480 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2481 | |
| 2482 | if (argc == 1) |
| 2483 | { |
| 2484 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2485 | |
| 2486 | if (ospf->lsa_refresh_interval != interval || |
| 2487 | interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
| 2488 | return CMD_SUCCESS; |
| 2489 | } |
| 2490 | |
| 2491 | ospf_timers_refresh_unset (ospf); |
| 2492 | |
| 2493 | return CMD_SUCCESS; |
| 2494 | } |
| 2495 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2496 | ALIAS (no_ospf_refresh_timer, |
| 2497 | no_ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2498 | "no refresh timer", |
| 2499 | "Adjust refresh parameters\n" |
| 2500 | "Unset refresh timer\n") |
| 2501 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2502 | DEFUN (ospf_auto_cost_reference_bandwidth, |
| 2503 | ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2504 | "auto-cost reference-bandwidth <1-4294967>", |
| 2505 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2506 | "Use reference bandwidth method to assign OSPF cost\n" |
| 2507 | "The reference bandwidth in terms of Mbits per second\n") |
| 2508 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2509 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2510 | u_int32_t refbw; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2511 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2512 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2513 | |
| 2514 | refbw = strtol (argv[0], NULL, 10); |
| 2515 | if (refbw < 1 || refbw > 4294967) |
| 2516 | { |
| 2517 | vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); |
| 2518 | return CMD_WARNING; |
| 2519 | } |
| 2520 | |
| 2521 | /* If reference bandwidth is changed. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2522 | if ((refbw * 1000) == ospf->ref_bandwidth) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2523 | return CMD_SUCCESS; |
| 2524 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2525 | ospf->ref_bandwidth = refbw * 1000; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2526 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 2527 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2528 | |
| 2529 | return CMD_SUCCESS; |
| 2530 | } |
| 2531 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2532 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
| 2533 | no_ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2534 | "no auto-cost reference-bandwidth", |
| 2535 | NO_STR |
| 2536 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2537 | "Use reference bandwidth method to assign OSPF cost\n") |
| 2538 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2539 | struct ospf *ospf = vty->index; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2540 | struct listnode *node, *nnode; |
| 2541 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2542 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2543 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2544 | return CMD_SUCCESS; |
| 2545 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2546 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2547 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
| 2548 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); |
| 2549 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2550 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
| 2551 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2552 | |
| 2553 | return CMD_SUCCESS; |
| 2554 | } |
| 2555 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2556 | const char *ospf_abr_type_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2557 | { |
| 2558 | "Unknown", |
| 2559 | "Standard (RFC2328)", |
| 2560 | "Alternative IBM", |
| 2561 | "Alternative Cisco", |
| 2562 | "Alternative Shortcut" |
| 2563 | }; |
| 2564 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2565 | const char *ospf_shortcut_mode_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2566 | { |
| 2567 | "Default", |
| 2568 | "Enabled", |
| 2569 | "Disabled" |
| 2570 | }; |
| 2571 | |
| 2572 | |
| 2573 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2574 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2575 | show_ip_ospf_area (struct vty *vty, struct ospf_area *area) |
| 2576 | { |
| 2577 | /* Show Area ID. */ |
| 2578 | vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); |
| 2579 | |
| 2580 | /* Show Area type/mode. */ |
| 2581 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 2582 | vty_out (vty, " (Backbone)%s", VTY_NEWLINE); |
| 2583 | else |
| 2584 | { |
| 2585 | if (area->external_routing == OSPF_AREA_STUB) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2586 | vty_out (vty, " (Stub%s%s)", |
| 2587 | area->no_summary ? ", no summary" : "", |
| 2588 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2589 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2590 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 2591 | vty_out (vty, " (NSSA%s%s)", |
| 2592 | area->no_summary ? ", no summary" : "", |
| 2593 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2594 | |
| 2595 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2596 | vty_out (vty, " Shortcutting mode: %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2597 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2598 | vty_out (vty, ", S-bit consensus: %s%s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2599 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2600 | } |
| 2601 | |
| 2602 | /* Show number of interfaces. */ |
| 2603 | vty_out (vty, " Number of interfaces in this area: Total: %d, " |
| 2604 | "Active: %d%s", listcount (area->oiflist), |
| 2605 | area->act_ints, VTY_NEWLINE); |
| 2606 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2607 | if (area->external_routing == OSPF_AREA_NSSA) |
| 2608 | { |
| 2609 | 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] | 2610 | if (! IS_OSPF_ABR (area->ospf)) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2611 | vty_out (vty, " It is not ABR, therefore not Translator. %s", |
| 2612 | VTY_NEWLINE); |
| 2613 | else if (area->NSSATranslatorState) |
| 2614 | { |
| 2615 | vty_out (vty, " We are an ABR and "); |
| 2616 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2617 | vty_out (vty, "the NSSA Elected Translator. %s", |
| 2618 | VTY_NEWLINE); |
| 2619 | else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) |
| 2620 | vty_out (vty, "always an NSSA Translator. %s", |
| 2621 | VTY_NEWLINE); |
| 2622 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2623 | else |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2624 | { |
| 2625 | vty_out (vty, " We are an ABR, but "); |
| 2626 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2627 | vty_out (vty, "not the NSSA Elected Translator. %s", |
| 2628 | VTY_NEWLINE); |
| 2629 | else |
hasso | c6b8781 | 2004-12-22 13:09:59 +0000 | [diff] [blame] | 2630 | vty_out (vty, "never an NSSA Translator. %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2631 | VTY_NEWLINE); |
| 2632 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2633 | } |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2634 | /* Stub-router state for this area */ |
| 2635 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
| 2636 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2637 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2638 | vty_out (vty, " Originating stub / maximum-distance Router-LSA%s", |
| 2639 | VTY_NEWLINE); |
| 2640 | if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 2641 | vty_out (vty, " Administratively activated (indefinitely)%s", |
| 2642 | VTY_NEWLINE); |
| 2643 | if (area->t_stub_router) |
| 2644 | vty_out (vty, " Active from startup, %s remaining%s", |
| 2645 | ospf_timer_dump (area->t_stub_router, timebuf, |
| 2646 | sizeof(timebuf)), VTY_NEWLINE); |
| 2647 | } |
| 2648 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2649 | /* Show number of fully adjacent neighbors. */ |
| 2650 | vty_out (vty, " Number of fully adjacent neighbors in this area:" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2651 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2652 | |
| 2653 | /* Show authentication type. */ |
| 2654 | vty_out (vty, " Area has "); |
| 2655 | if (area->auth_type == OSPF_AUTH_NULL) |
| 2656 | vty_out (vty, "no authentication%s", VTY_NEWLINE); |
| 2657 | else if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 2658 | vty_out (vty, "simple password authentication%s", VTY_NEWLINE); |
| 2659 | else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC) |
| 2660 | vty_out (vty, "message digest authentication%s", VTY_NEWLINE); |
| 2661 | |
| 2662 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 2663 | vty_out (vty, " Number of full virtual adjacencies going through" |
| 2664 | " this area: %d%s", area->full_vls, VTY_NEWLINE); |
| 2665 | |
| 2666 | /* Show SPF calculation times. */ |
| 2667 | vty_out (vty, " SPF algorithm executed %d times%s", |
| 2668 | area->spf_calculation, VTY_NEWLINE); |
| 2669 | |
| 2670 | /* Show number of LSA. */ |
| 2671 | vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE); |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2672 | vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s", |
| 2673 | ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA), |
| 2674 | ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE); |
| 2675 | vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s", |
| 2676 | ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA), |
| 2677 | ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE); |
| 2678 | vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2679 | ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA), |
| 2680 | ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE); |
| 2681 | vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2682 | ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA), |
| 2683 | ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE); |
| 2684 | vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s", |
| 2685 | ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA), |
| 2686 | ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE); |
| 2687 | #ifdef HAVE_OPAQUE_LSA |
| 2688 | vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s", |
| 2689 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA), |
| 2690 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE); |
| 2691 | vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s", |
| 2692 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA), |
| 2693 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE); |
| 2694 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2695 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2696 | } |
| 2697 | |
| 2698 | DEFUN (show_ip_ospf, |
| 2699 | show_ip_ospf_cmd, |
| 2700 | "show ip ospf", |
| 2701 | SHOW_STR |
| 2702 | IP_STR |
| 2703 | "OSPF information\n") |
| 2704 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2705 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2706 | struct ospf_area * area; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2707 | struct ospf *ospf; |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2708 | struct timeval result; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2709 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2710 | |
| 2711 | /* Check OSPF is enable. */ |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2712 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2713 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2714 | { |
| 2715 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2716 | return CMD_SUCCESS; |
| 2717 | } |
| 2718 | |
| 2719 | /* Show Router ID. */ |
| 2720 | vty_out (vty, " OSPF Routing Process, Router ID: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2721 | inet_ntoa (ospf->router_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2722 | VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2723 | |
| 2724 | /* Graceful shutdown */ |
paul | c9c93d5 | 2005-11-26 13:31:11 +0000 | [diff] [blame] | 2725 | if (ospf->t_deferred_shutdown) |
| 2726 | vty_out (vty, " Deferred shutdown in progress, %s remaining%s", |
| 2727 | ospf_timer_dump (ospf->t_deferred_shutdown, |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2728 | timebuf, sizeof (timebuf)), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2729 | /* Show capability. */ |
| 2730 | vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE); |
| 2731 | vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE); |
| 2732 | vty_out (vty, " RFC1583Compatibility flag is %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2733 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2734 | "enabled" : "disabled", VTY_NEWLINE); |
| 2735 | #ifdef HAVE_OPAQUE_LSA |
| 2736 | vty_out (vty, " OpaqueCapability flag is %s%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2737 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2738 | "enabled" : "disabled", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2739 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2740 | " (origination blocked)" : "", |
| 2741 | VTY_NEWLINE); |
| 2742 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2743 | |
| 2744 | /* Show stub-router configuration */ |
| 2745 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED |
| 2746 | || ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2747 | { |
| 2748 | vty_out (vty, " Stub router advertisement is configured%s", |
| 2749 | VTY_NEWLINE); |
| 2750 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2751 | vty_out (vty, " Enabled for %us after start-up%s", |
| 2752 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 2753 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2754 | vty_out (vty, " Enabled for %us prior to full shutdown%s", |
| 2755 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 2756 | } |
| 2757 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2758 | /* Show SPF timers. */ |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2759 | vty_out (vty, " Initial SPF scheduling delay %d millisec(s)%s" |
| 2760 | " Minimum hold time between consecutive SPFs %d millisec(s)%s" |
| 2761 | " Maximum hold time between consecutive SPFs %d millisec(s)%s" |
| 2762 | " Hold time multiplier is currently %d%s", |
| 2763 | ospf->spf_delay, VTY_NEWLINE, |
| 2764 | ospf->spf_holdtime, VTY_NEWLINE, |
| 2765 | ospf->spf_max_holdtime, VTY_NEWLINE, |
| 2766 | ospf->spf_hold_multiplier, VTY_NEWLINE); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2767 | vty_out (vty, " SPF algorithm "); |
| 2768 | if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec) |
| 2769 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 2770 | result = tv_sub (recent_relative_time (), ospf->ts_spf); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2771 | vty_out (vty, "last executed %s ago%s", |
| 2772 | ospf_timeval_dump (&result, timebuf, sizeof (timebuf)), |
| 2773 | VTY_NEWLINE); |
| 2774 | } |
| 2775 | else |
| 2776 | vty_out (vty, "has not been run%s", VTY_NEWLINE); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2777 | vty_out (vty, " SPF timer %s%s%s", |
| 2778 | (ospf->t_spf_calc ? "due in " : "is "), |
| 2779 | ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)), |
| 2780 | VTY_NEWLINE); |
| 2781 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2782 | /* Show refresh parameters. */ |
| 2783 | vty_out (vty, " Refresh timer %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2784 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2785 | |
| 2786 | /* Show ABR/ASBR flags. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2787 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2788 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2789 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2790 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2791 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2792 | vty_out (vty, " This router is an ASBR " |
| 2793 | "(injecting external routing information)%s", VTY_NEWLINE); |
| 2794 | |
| 2795 | /* Show Number of AS-external-LSAs. */ |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2796 | vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s", |
| 2797 | ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), |
| 2798 | ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE); |
| 2799 | #ifdef HAVE_OPAQUE_LSA |
| 2800 | vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s", |
| 2801 | ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA), |
| 2802 | ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE); |
| 2803 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2804 | /* Show number of areas attached. */ |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 2805 | vty_out (vty, " Number of areas attached to this router: %d%s", |
| 2806 | listcount (ospf->areas), VTY_NEWLINE); |
| 2807 | |
| 2808 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 2809 | { |
| 2810 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 2811 | vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE); |
| 2812 | else |
| 2813 | vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE); |
| 2814 | } |
| 2815 | |
| 2816 | vty_out (vty, "%s",VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2817 | |
| 2818 | /* Show each area status. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2819 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 2820 | show_ip_ospf_area (vty, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2821 | |
| 2822 | return CMD_SUCCESS; |
| 2823 | } |
| 2824 | |
| 2825 | |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2826 | static void |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2827 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
| 2828 | struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2829 | { |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2830 | int is_up; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2831 | struct ospf_neighbor *nbr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2832 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2833 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2834 | /* Is interface up? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2835 | vty_out (vty, "%s is %s%s", ifp->name, |
| 2836 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 2837 | vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s", |
| 2838 | ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), |
| 2839 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2840 | |
| 2841 | /* Is interface OSPF enabled? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2842 | if (ospf_oi_count(ifp) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2843 | { |
| 2844 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); |
| 2845 | return; |
| 2846 | } |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2847 | else if (!is_up) |
| 2848 | { |
| 2849 | vty_out (vty, " OSPF is enabled, but not running on this interface%s", |
| 2850 | VTY_NEWLINE); |
| 2851 | return; |
| 2852 | } |
| 2853 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2854 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 2855 | { |
| 2856 | struct ospf_interface *oi = rn->info; |
| 2857 | |
| 2858 | if (oi == NULL) |
| 2859 | continue; |
| 2860 | |
| 2861 | /* Show OSPF interface information. */ |
| 2862 | vty_out (vty, " Internet Address %s/%d,", |
| 2863 | inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen); |
| 2864 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 2865 | if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
| 2866 | { |
| 2867 | struct in_addr *dest; |
| 2868 | const char *dstr; |
| 2869 | |
Andrew J. Schorr | e452963 | 2006-12-12 19:18:21 +0000 | [diff] [blame] | 2870 | if (CONNECTED_PEER(oi->connected) |
| 2871 | || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 2872 | dstr = "Peer"; |
| 2873 | else |
| 2874 | dstr = "Broadcast"; |
| 2875 | |
| 2876 | /* For Vlinks, showing the peer address is probably more |
| 2877 | * informative than the local interface that is being used |
| 2878 | */ |
| 2879 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) |
| 2880 | dest = &oi->vl_data->peer_addr; |
| 2881 | else |
| 2882 | dest = &oi->connected->destination->u.prefix4; |
| 2883 | |
| 2884 | vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest)); |
| 2885 | } |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 2886 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2887 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
| 2888 | VTY_NEWLINE); |
| 2889 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2890 | vty_out (vty, " MTU mismatch detection:%s%s", |
| 2891 | OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE); |
| 2892 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2893 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2894 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2895 | oi->output_cost, VTY_NEWLINE); |
| 2896 | |
| 2897 | vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s", |
| 2898 | OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state), |
| 2899 | PRIORITY (oi), VTY_NEWLINE); |
| 2900 | |
| 2901 | /* Show DR information. */ |
| 2902 | if (DR (oi).s_addr == 0) |
| 2903 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2904 | else |
| 2905 | { |
| 2906 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi)); |
| 2907 | if (nbr == NULL) |
| 2908 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2909 | else |
| 2910 | { |
| 2911 | vty_out (vty, " Designated Router (ID) %s,", |
| 2912 | inet_ntoa (nbr->router_id)); |
| 2913 | vty_out (vty, " Interface Address %s%s", |
| 2914 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2915 | } |
| 2916 | } |
| 2917 | |
| 2918 | /* Show BDR information. */ |
| 2919 | if (BDR (oi).s_addr == 0) |
| 2920 | vty_out (vty, " No backup designated router on this network%s", |
| 2921 | VTY_NEWLINE); |
| 2922 | else |
| 2923 | { |
| 2924 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi)); |
| 2925 | if (nbr == NULL) |
| 2926 | vty_out (vty, " No backup designated router on this network%s", |
| 2927 | VTY_NEWLINE); |
| 2928 | else |
| 2929 | { |
| 2930 | vty_out (vty, " Backup Designated Router (ID) %s,", |
| 2931 | inet_ntoa (nbr->router_id)); |
| 2932 | vty_out (vty, " Interface Address %s%s", |
| 2933 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2934 | } |
| 2935 | } |
Paul Jakma | 7eb5b47 | 2009-10-13 16:13:13 +0100 | [diff] [blame] | 2936 | |
| 2937 | /* Next network-LSA sequence number we'll use, if we're elected DR */ |
| 2938 | if (oi->params && ntohl (oi->params->network_lsa_seqnum) |
| 2939 | != OSPF_INITIAL_SEQUENCE_NUMBER) |
| 2940 | vty_out (vty, " Saved Network-LSA sequence number 0x%x%s", |
| 2941 | ntohl (oi->params->network_lsa_seqnum), VTY_NEWLINE); |
| 2942 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2943 | vty_out (vty, " Multicast group memberships:"); |
Paul Jakma | 429ac78 | 2006-06-15 18:40:49 +0000 | [diff] [blame] | 2944 | if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS) |
| 2945 | || OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) |
| 2946 | { |
| 2947 | if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)) |
| 2948 | vty_out (vty, " OSPFAllRouters"); |
| 2949 | if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) |
| 2950 | vty_out (vty, " OSPFDesignatedRouters"); |
| 2951 | } |
| 2952 | else |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2953 | vty_out (vty, " <None>"); |
| 2954 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2955 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2956 | vty_out (vty, " Timer intervals configured,"); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2957 | vty_out (vty, " Hello "); |
| 2958 | if (OSPF_IF_PARAM (oi, fast_hello) == 0) |
| 2959 | vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello)); |
| 2960 | else |
| 2961 | vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello)); |
| 2962 | vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s", |
| 2963 | OSPF_IF_PARAM (oi, v_wait), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2964 | OSPF_IF_PARAM (oi, v_wait), |
| 2965 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 2966 | VTY_NEWLINE); |
| 2967 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 2968 | if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_ACTIVE) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2969 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2970 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2971 | vty_out (vty, " Hello due in %s%s", |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2972 | ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)), |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2973 | VTY_NEWLINE); |
| 2974 | } |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 2975 | else /* passive-interface is set */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2976 | vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); |
| 2977 | |
| 2978 | vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2979 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2980 | VTY_NEWLINE); |
| 2981 | } |
| 2982 | } |
| 2983 | |
| 2984 | DEFUN (show_ip_ospf_interface, |
| 2985 | show_ip_ospf_interface_cmd, |
| 2986 | "show ip ospf interface [INTERFACE]", |
| 2987 | SHOW_STR |
| 2988 | IP_STR |
| 2989 | "OSPF information\n" |
| 2990 | "Interface information\n" |
| 2991 | "Interface name\n") |
| 2992 | { |
| 2993 | struct interface *ifp; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2994 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2995 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2996 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2997 | ospf = ospf_lookup (); |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 2998 | if (ospf == NULL) |
| 2999 | { |
| 3000 | vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3001 | return CMD_SUCCESS; |
| 3002 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3003 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3004 | /* Show All Interfaces. */ |
| 3005 | if (argc == 0) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3006 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 3007 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3008 | /* Interface name is specified. */ |
| 3009 | else |
| 3010 | { |
| 3011 | if ((ifp = if_lookup_by_name (argv[0])) == NULL) |
| 3012 | vty_out (vty, "No such interface name%s", VTY_NEWLINE); |
| 3013 | else |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3014 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3015 | } |
| 3016 | |
| 3017 | return CMD_SUCCESS; |
| 3018 | } |
| 3019 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3020 | static void |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3021 | show_ip_ospf_neighbour_header (struct vty *vty) |
| 3022 | { |
| 3023 | vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s", |
| 3024 | VTY_NEWLINE, |
| 3025 | "Neighbor ID", "Pri", "State", "Dead Time", |
| 3026 | "Address", "Interface", "RXmtL", "RqstL", "DBsmL", |
| 3027 | VTY_NEWLINE); |
| 3028 | } |
| 3029 | |
| 3030 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3031 | show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) |
| 3032 | { |
| 3033 | struct route_node *rn; |
| 3034 | struct ospf_neighbor *nbr; |
| 3035 | char msgbuf[16]; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3036 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3037 | |
| 3038 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3039 | if ((nbr = rn->info)) |
| 3040 | /* Do not show myself. */ |
| 3041 | if (nbr != oi->nbr_self) |
| 3042 | /* Down state is not shown. */ |
| 3043 | if (nbr->state != NSM_Down) |
| 3044 | { |
| 3045 | ospf_nbr_state_message (nbr, msgbuf, 16); |
| 3046 | |
| 3047 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3048 | vty_out (vty, "%-15s %3d %-15s ", |
| 3049 | "-", nbr->priority, |
| 3050 | msgbuf); |
| 3051 | else |
| 3052 | vty_out (vty, "%-15s %3d %-15s ", |
| 3053 | inet_ntoa (nbr->router_id), nbr->priority, |
| 3054 | msgbuf); |
| 3055 | |
| 3056 | vty_out (vty, "%9s ", |
| 3057 | ospf_timer_dump (nbr->t_inactivity, timebuf, |
| 3058 | sizeof(timebuf))); |
| 3059 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3060 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3061 | vty_out (vty, "%-20s %5ld %5ld %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3062 | IF_NAME (oi), ospf_ls_retransmit_count (nbr), |
| 3063 | ospf_ls_request_count (nbr), ospf_db_summary_count (nbr), |
| 3064 | VTY_NEWLINE); |
| 3065 | } |
| 3066 | } |
| 3067 | |
| 3068 | DEFUN (show_ip_ospf_neighbor, |
| 3069 | show_ip_ospf_neighbor_cmd, |
| 3070 | "show ip ospf neighbor", |
| 3071 | SHOW_STR |
| 3072 | IP_STR |
| 3073 | "OSPF information\n" |
| 3074 | "Neighbor list\n") |
| 3075 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3076 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3077 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3078 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3079 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3080 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3081 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3082 | { |
| 3083 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3084 | return CMD_SUCCESS; |
| 3085 | } |
| 3086 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3087 | show_ip_ospf_neighbour_header (vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3088 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3089 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3090 | show_ip_ospf_neighbor_sub (vty, oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3091 | |
| 3092 | return CMD_SUCCESS; |
| 3093 | } |
| 3094 | |
| 3095 | DEFUN (show_ip_ospf_neighbor_all, |
| 3096 | show_ip_ospf_neighbor_all_cmd, |
| 3097 | "show ip ospf neighbor all", |
| 3098 | SHOW_STR |
| 3099 | IP_STR |
| 3100 | "OSPF information\n" |
| 3101 | "Neighbor list\n" |
| 3102 | "include down status neighbor\n") |
| 3103 | { |
Joakim Tjernlund | 35f8914 | 2008-07-01 16:54:07 +0200 | [diff] [blame] | 3104 | struct ospf *ospf = ospf_lookup (); |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3105 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3106 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3107 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3108 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3109 | { |
| 3110 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3111 | return CMD_SUCCESS; |
| 3112 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3113 | |
| 3114 | show_ip_ospf_neighbour_header (vty); |
| 3115 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3116 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3117 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3118 | struct listnode *nbr_node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3119 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3120 | |
| 3121 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3122 | |
| 3123 | /* print Down neighbor status */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3124 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3125 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3126 | if (nbr_nbma->nbr == NULL |
| 3127 | || nbr_nbma->nbr->state == NSM_Down) |
| 3128 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3129 | vty_out (vty, "%-15s %3d %-15s %9s ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3130 | "-", nbr_nbma->priority, "Down", "-"); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3131 | vty_out (vty, "%-15s %-20s %5d %5d %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3132 | inet_ntoa (nbr_nbma->addr), IF_NAME (oi), |
| 3133 | 0, 0, 0, VTY_NEWLINE); |
| 3134 | } |
| 3135 | } |
| 3136 | } |
| 3137 | |
| 3138 | return CMD_SUCCESS; |
| 3139 | } |
| 3140 | |
| 3141 | DEFUN (show_ip_ospf_neighbor_int, |
| 3142 | show_ip_ospf_neighbor_int_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3143 | "show ip ospf neighbor IFNAME", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3144 | SHOW_STR |
| 3145 | IP_STR |
| 3146 | "OSPF information\n" |
| 3147 | "Neighbor list\n" |
| 3148 | "Interface name\n") |
| 3149 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3150 | struct ospf *ospf; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3151 | struct interface *ifp; |
| 3152 | struct route_node *rn; |
| 3153 | |
| 3154 | ifp = if_lookup_by_name (argv[0]); |
| 3155 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3156 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3157 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3158 | return CMD_WARNING; |
| 3159 | } |
| 3160 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3161 | ospf = ospf_lookup (); |
| 3162 | if (ospf == NULL) |
| 3163 | { |
| 3164 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3165 | return CMD_SUCCESS; |
| 3166 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3167 | |
| 3168 | show_ip_ospf_neighbour_header (vty); |
| 3169 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3170 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3171 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3172 | struct ospf_interface *oi = rn->info; |
| 3173 | |
| 3174 | if (oi == NULL) |
| 3175 | continue; |
| 3176 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3177 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3178 | } |
| 3179 | |
| 3180 | return CMD_SUCCESS; |
| 3181 | } |
| 3182 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3183 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3184 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3185 | struct ospf_nbr_nbma *nbr_nbma) |
| 3186 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3187 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3188 | |
| 3189 | /* Show neighbor ID. */ |
| 3190 | vty_out (vty, " Neighbor %s,", "-"); |
| 3191 | |
| 3192 | /* Show interface address. */ |
| 3193 | vty_out (vty, " interface address %s%s", |
| 3194 | inet_ntoa (nbr_nbma->addr), VTY_NEWLINE); |
| 3195 | /* Show Area ID. */ |
| 3196 | vty_out (vty, " In the area %s via interface %s%s", |
| 3197 | ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE); |
| 3198 | /* Show neighbor priority and state. */ |
| 3199 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3200 | nbr_nbma->priority, "Down"); |
| 3201 | /* Show state changes. */ |
| 3202 | vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE); |
| 3203 | |
| 3204 | /* Show PollInterval */ |
| 3205 | vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE); |
| 3206 | |
| 3207 | /* Show poll-interval timer. */ |
| 3208 | vty_out (vty, " Poll timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3209 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)), |
| 3210 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3211 | |
| 3212 | /* Show poll-interval timer thread. */ |
| 3213 | vty_out (vty, " Thread Poll Timer %s%s", |
| 3214 | nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); |
| 3215 | } |
| 3216 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3217 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3218 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3219 | struct ospf_neighbor *nbr) |
| 3220 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3221 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3222 | |
| 3223 | /* Show neighbor ID. */ |
| 3224 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
| 3225 | vty_out (vty, " Neighbor %s,", "-"); |
| 3226 | else |
| 3227 | vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id)); |
| 3228 | |
| 3229 | /* Show interface address. */ |
| 3230 | vty_out (vty, " interface address %s%s", |
| 3231 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 3232 | /* Show Area ID. */ |
| 3233 | vty_out (vty, " In the area %s via interface %s%s", |
| 3234 | ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE); |
| 3235 | /* Show neighbor priority and state. */ |
| 3236 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3237 | nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state)); |
| 3238 | /* Show state changes. */ |
| 3239 | vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3240 | if (nbr->ts_last_progress.tv_sec || nbr->ts_last_progress.tv_usec) |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3241 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 3242 | struct timeval res |
| 3243 | = tv_sub (recent_relative_time (), nbr->ts_last_progress); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3244 | vty_out (vty, " Most recent state change statistics:%s", |
| 3245 | VTY_NEWLINE); |
| 3246 | vty_out (vty, " Progressive change %s ago%s", |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3247 | ospf_timeval_dump (&res, timebuf, sizeof(timebuf)), |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3248 | VTY_NEWLINE); |
| 3249 | } |
| 3250 | if (nbr->ts_last_regress.tv_sec || nbr->ts_last_regress.tv_usec) |
| 3251 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 3252 | struct timeval res |
| 3253 | = tv_sub (recent_relative_time (), nbr->ts_last_regress); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3254 | vty_out (vty, " Regressive change %s ago, due to %s%s", |
| 3255 | ospf_timeval_dump (&res, timebuf, sizeof(timebuf)), |
| 3256 | (nbr->last_regress_str ? nbr->last_regress_str : "??"), |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3257 | VTY_NEWLINE); |
| 3258 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3259 | /* Show Designated Rotuer ID. */ |
| 3260 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); |
| 3261 | /* Show Backup Designated Rotuer ID. */ |
| 3262 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); |
| 3263 | /* Show options. */ |
| 3264 | vty_out (vty, " Options %d %s%s", nbr->options, |
| 3265 | ospf_options_dump (nbr->options), VTY_NEWLINE); |
| 3266 | /* Show Router Dead interval timer. */ |
| 3267 | vty_out (vty, " Dead timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3268 | ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)), |
| 3269 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3270 | /* Show Database Summary list. */ |
| 3271 | vty_out (vty, " Database Summary List %d%s", |
| 3272 | ospf_db_summary_count (nbr), VTY_NEWLINE); |
| 3273 | /* Show Link State Request list. */ |
| 3274 | vty_out (vty, " Link State Request List %ld%s", |
| 3275 | ospf_ls_request_count (nbr), VTY_NEWLINE); |
| 3276 | /* Show Link State Retransmission list. */ |
| 3277 | vty_out (vty, " Link State Retransmission List %ld%s", |
| 3278 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); |
| 3279 | /* Show inactivity timer thread. */ |
| 3280 | vty_out (vty, " Thread Inactivity Timer %s%s", |
| 3281 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); |
| 3282 | /* Show Database Description retransmission thread. */ |
| 3283 | vty_out (vty, " Thread Database Description Retransmision %s%s", |
| 3284 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); |
| 3285 | /* Show Link State Request Retransmission thread. */ |
| 3286 | vty_out (vty, " Thread Link State Request Retransmission %s%s", |
| 3287 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); |
| 3288 | /* Show Link State Update Retransmission thread. */ |
| 3289 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", |
| 3290 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); |
| 3291 | } |
| 3292 | |
| 3293 | DEFUN (show_ip_ospf_neighbor_id, |
| 3294 | show_ip_ospf_neighbor_id_cmd, |
| 3295 | "show ip ospf neighbor A.B.C.D", |
| 3296 | SHOW_STR |
| 3297 | IP_STR |
| 3298 | "OSPF information\n" |
| 3299 | "Neighbor list\n" |
| 3300 | "Neighbor ID\n") |
| 3301 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3302 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3303 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3304 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3305 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3306 | struct in_addr router_id; |
| 3307 | int ret; |
| 3308 | |
| 3309 | ret = inet_aton (argv[0], &router_id); |
| 3310 | if (!ret) |
| 3311 | { |
| 3312 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); |
| 3313 | return CMD_WARNING; |
| 3314 | } |
| 3315 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3316 | ospf = ospf_lookup (); |
| 3317 | if (ospf == NULL) |
| 3318 | { |
| 3319 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3320 | return CMD_SUCCESS; |
| 3321 | } |
| 3322 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3323 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3324 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) |
Andrew J. Schorr | 1c066bf | 2006-06-30 16:53:47 +0000 | [diff] [blame] | 3325 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3326 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3327 | return CMD_SUCCESS; |
| 3328 | } |
| 3329 | |
| 3330 | DEFUN (show_ip_ospf_neighbor_detail, |
| 3331 | show_ip_ospf_neighbor_detail_cmd, |
| 3332 | "show ip ospf neighbor detail", |
| 3333 | SHOW_STR |
| 3334 | IP_STR |
| 3335 | "OSPF information\n" |
| 3336 | "Neighbor list\n" |
| 3337 | "detail of all neighbors\n") |
| 3338 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3339 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3340 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3341 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3342 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3343 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3344 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3345 | { |
| 3346 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3347 | return CMD_SUCCESS; |
| 3348 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3349 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3350 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3351 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3352 | struct route_node *rn; |
| 3353 | struct ospf_neighbor *nbr; |
| 3354 | |
| 3355 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3356 | if ((nbr = rn->info)) |
| 3357 | if (nbr != oi->nbr_self) |
| 3358 | if (nbr->state != NSM_Down) |
| 3359 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3360 | } |
| 3361 | |
| 3362 | return CMD_SUCCESS; |
| 3363 | } |
| 3364 | |
| 3365 | DEFUN (show_ip_ospf_neighbor_detail_all, |
| 3366 | show_ip_ospf_neighbor_detail_all_cmd, |
| 3367 | "show ip ospf neighbor detail all", |
| 3368 | SHOW_STR |
| 3369 | IP_STR |
| 3370 | "OSPF information\n" |
| 3371 | "Neighbor list\n" |
| 3372 | "detail of all neighbors\n" |
| 3373 | "include down status neighbor\n") |
| 3374 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3375 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3376 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3377 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3378 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3379 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3380 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3381 | { |
| 3382 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3383 | return CMD_SUCCESS; |
| 3384 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3385 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3386 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3387 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3388 | struct route_node *rn; |
| 3389 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3390 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3391 | |
| 3392 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3393 | if ((nbr = rn->info)) |
| 3394 | if (nbr != oi->nbr_self) |
| 3395 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) |
| 3396 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); |
| 3397 | |
| 3398 | if (oi->type == OSPF_IFTYPE_NBMA) |
| 3399 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3400 | struct listnode *nd; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3401 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3402 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
| 3403 | if (nbr_nbma->nbr == NULL |
| 3404 | || nbr_nbma->nbr->state == NSM_Down) |
| 3405 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3406 | } |
| 3407 | } |
| 3408 | |
| 3409 | return CMD_SUCCESS; |
| 3410 | } |
| 3411 | |
| 3412 | DEFUN (show_ip_ospf_neighbor_int_detail, |
| 3413 | show_ip_ospf_neighbor_int_detail_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3414 | "show ip ospf neighbor IFNAME detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3415 | SHOW_STR |
| 3416 | IP_STR |
| 3417 | "OSPF information\n" |
| 3418 | "Neighbor list\n" |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3419 | "Interface name\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3420 | "detail of all neighbors") |
| 3421 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3422 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3423 | struct ospf_interface *oi; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3424 | struct interface *ifp; |
| 3425 | struct route_node *rn, *nrn; |
| 3426 | struct ospf_neighbor *nbr; |
| 3427 | |
| 3428 | ifp = if_lookup_by_name (argv[0]); |
| 3429 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3430 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3431 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3432 | return CMD_WARNING; |
| 3433 | } |
| 3434 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3435 | ospf = ospf_lookup (); |
| 3436 | if (ospf == NULL) |
| 3437 | { |
| 3438 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3439 | return CMD_SUCCESS; |
| 3440 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3441 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3442 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3443 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 3444 | if ((oi = rn->info)) |
| 3445 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) |
| 3446 | if ((nbr = nrn->info)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3447 | if (nbr != oi->nbr_self) |
| 3448 | if (nbr->state != NSM_Down) |
| 3449 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3450 | |
| 3451 | return CMD_SUCCESS; |
| 3452 | } |
| 3453 | |
| 3454 | |
| 3455 | /* Show functions */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3456 | static int |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3457 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3458 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3459 | struct router_lsa *rl; |
| 3460 | struct summary_lsa *sl; |
| 3461 | struct as_external_lsa *asel; |
| 3462 | struct prefix_ipv4 p; |
| 3463 | |
| 3464 | if (lsa != NULL) |
| 3465 | /* If self option is set, check LSA self flag. */ |
| 3466 | if (self == 0 || IS_LSA_SELF (lsa)) |
| 3467 | { |
| 3468 | /* LSA common part show. */ |
| 3469 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); |
| 3470 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", |
| 3471 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), |
| 3472 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); |
| 3473 | /* LSA specific part show. */ |
| 3474 | switch (lsa->data->type) |
| 3475 | { |
| 3476 | case OSPF_ROUTER_LSA: |
| 3477 | rl = (struct router_lsa *) lsa->data; |
| 3478 | vty_out (vty, " %-d", ntohs (rl->links)); |
| 3479 | break; |
| 3480 | case OSPF_SUMMARY_LSA: |
| 3481 | sl = (struct summary_lsa *) lsa->data; |
| 3482 | |
| 3483 | p.family = AF_INET; |
| 3484 | p.prefix = sl->header.id; |
| 3485 | p.prefixlen = ip_masklen (sl->mask); |
| 3486 | apply_mask_ipv4 (&p); |
| 3487 | |
| 3488 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); |
| 3489 | break; |
| 3490 | case OSPF_AS_EXTERNAL_LSA: |
paul | 551a897 | 2003-05-18 15:22:55 +0000 | [diff] [blame] | 3491 | case OSPF_AS_NSSA_LSA: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3492 | asel = (struct as_external_lsa *) lsa->data; |
| 3493 | |
| 3494 | p.family = AF_INET; |
| 3495 | p.prefix = asel->header.id; |
| 3496 | p.prefixlen = ip_masklen (asel->mask); |
| 3497 | apply_mask_ipv4 (&p); |
| 3498 | |
| 3499 | vty_out (vty, " %s %s/%d [0x%lx]", |
| 3500 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", |
| 3501 | inet_ntoa (p.prefix), p.prefixlen, |
| 3502 | (u_long)ntohl (asel->e[0].route_tag)); |
| 3503 | break; |
| 3504 | case OSPF_NETWORK_LSA: |
| 3505 | case OSPF_ASBR_SUMMARY_LSA: |
| 3506 | #ifdef HAVE_OPAQUE_LSA |
| 3507 | case OSPF_OPAQUE_LINK_LSA: |
| 3508 | case OSPF_OPAQUE_AREA_LSA: |
| 3509 | case OSPF_OPAQUE_AS_LSA: |
| 3510 | #endif /* HAVE_OPAQUE_LSA */ |
| 3511 | default: |
| 3512 | break; |
| 3513 | } |
| 3514 | vty_out (vty, VTY_NEWLINE); |
| 3515 | } |
| 3516 | |
| 3517 | return 0; |
| 3518 | } |
| 3519 | |
Stephen Hemminger | 8b6a15b | 2009-12-03 19:25:04 +0300 | [diff] [blame] | 3520 | static const char *show_database_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3521 | { |
| 3522 | "unknown", |
| 3523 | "Router Link States", |
| 3524 | "Net Link States", |
| 3525 | "Summary Link States", |
| 3526 | "ASBR-Summary Link States", |
| 3527 | "AS External Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3528 | "Group Membership LSA", |
| 3529 | "NSSA-external Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3530 | #ifdef HAVE_OPAQUE_LSA |
| 3531 | "Type-8 LSA", |
| 3532 | "Link-Local Opaque-LSA", |
| 3533 | "Area-Local Opaque-LSA", |
| 3534 | "AS-external Opaque-LSA", |
| 3535 | #endif /* HAVE_OPAQUE_LSA */ |
| 3536 | }; |
| 3537 | |
Stephen Hemminger | 8b6a15b | 2009-12-03 19:25:04 +0300 | [diff] [blame] | 3538 | static const char *show_database_header[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3539 | { |
| 3540 | "", |
| 3541 | "Link ID ADV Router Age Seq# CkSum Link count", |
| 3542 | "Link ID ADV Router Age Seq# CkSum", |
| 3543 | "Link ID ADV Router Age Seq# CkSum Route", |
| 3544 | "Link ID ADV Router Age Seq# CkSum", |
| 3545 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3546 | " --- header for Group Member ----", |
| 3547 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3548 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3549 | " --- type-8 ---", |
| 3550 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3551 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3552 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3553 | #endif /* HAVE_OPAQUE_LSA */ |
| 3554 | }; |
| 3555 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3556 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3557 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
| 3558 | { |
| 3559 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3560 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3561 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3562 | vty_out (vty, " Options: 0x%-2x : %s%s", |
| 3563 | lsa->data->options, |
| 3564 | ospf_options_dump(lsa->data->options), |
| 3565 | VTY_NEWLINE); |
| 3566 | vty_out (vty, " LS Flags: 0x%-2x %s%s", |
paul | 9d52603 | 2003-06-30 22:46:14 +0000 | [diff] [blame] | 3567 | lsa->flags, |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3568 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
| 3569 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3570 | |
| 3571 | if (lsa->data->type == OSPF_ROUTER_LSA) |
| 3572 | { |
| 3573 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); |
| 3574 | |
| 3575 | if (rlsa->flags) |
| 3576 | vty_out (vty, " :%s%s%s%s", |
| 3577 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", |
| 3578 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", |
| 3579 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", |
| 3580 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); |
| 3581 | |
| 3582 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3583 | } |
| 3584 | vty_out (vty, " LS Type: %s%s", |
| 3585 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3586 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), |
| 3587 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3588 | vty_out (vty, " Advertising Router: %s%s", |
| 3589 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3590 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), |
| 3591 | VTY_NEWLINE); |
| 3592 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), |
| 3593 | VTY_NEWLINE); |
| 3594 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); |
| 3595 | } |
| 3596 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3597 | const char *link_type_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3598 | { |
| 3599 | "(null)", |
| 3600 | "another Router (point-to-point)", |
| 3601 | "a Transit Network", |
| 3602 | "Stub Network", |
| 3603 | "a Virtual Link", |
| 3604 | }; |
| 3605 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3606 | const char *link_id_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3607 | { |
| 3608 | "(null)", |
| 3609 | "Neighboring Router ID", |
| 3610 | "Designated Router address", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3611 | "Net", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3612 | "Neighboring Router ID", |
| 3613 | }; |
| 3614 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3615 | const char *link_data_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3616 | { |
| 3617 | "(null)", |
| 3618 | "Router Interface address", |
| 3619 | "Router Interface address", |
| 3620 | "Network Mask", |
| 3621 | "Router Interface address", |
| 3622 | }; |
| 3623 | |
| 3624 | /* Show router-LSA each Link information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3625 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3626 | show_ip_ospf_database_router_links (struct vty *vty, |
| 3627 | struct router_lsa *rl) |
| 3628 | { |
| 3629 | int len, i, type; |
| 3630 | |
| 3631 | len = ntohs (rl->header.length) - 4; |
| 3632 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) |
| 3633 | { |
| 3634 | type = rl->link[i].type; |
| 3635 | |
| 3636 | vty_out (vty, " Link connected to: %s%s", |
| 3637 | link_type_desc[type], VTY_NEWLINE); |
| 3638 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], |
| 3639 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); |
| 3640 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], |
| 3641 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); |
| 3642 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); |
| 3643 | vty_out (vty, " TOS 0 Metric: %d%s", |
| 3644 | ntohs (rl->link[i].metric), VTY_NEWLINE); |
| 3645 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3646 | } |
| 3647 | } |
| 3648 | |
| 3649 | /* Show router-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3650 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3651 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3652 | { |
| 3653 | if (lsa != NULL) |
| 3654 | { |
| 3655 | struct router_lsa *rl = (struct router_lsa *) lsa->data; |
| 3656 | |
| 3657 | show_ip_ospf_database_header (vty, lsa); |
| 3658 | |
| 3659 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), |
| 3660 | VTY_NEWLINE, VTY_NEWLINE); |
| 3661 | |
| 3662 | show_ip_ospf_database_router_links (vty, rl); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3663 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3664 | } |
| 3665 | |
| 3666 | return 0; |
| 3667 | } |
| 3668 | |
| 3669 | /* Show network-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3670 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3671 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3672 | { |
| 3673 | int length, i; |
| 3674 | |
| 3675 | if (lsa != NULL) |
| 3676 | { |
| 3677 | struct network_lsa *nl = (struct network_lsa *) lsa->data; |
| 3678 | |
| 3679 | show_ip_ospf_database_header (vty, lsa); |
| 3680 | |
| 3681 | vty_out (vty, " Network Mask: /%d%s", |
| 3682 | ip_masklen (nl->mask), VTY_NEWLINE); |
| 3683 | |
| 3684 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; |
| 3685 | |
| 3686 | for (i = 0; length > 0; i++, length -= 4) |
| 3687 | vty_out (vty, " Attached Router: %s%s", |
| 3688 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); |
| 3689 | |
| 3690 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3691 | } |
| 3692 | |
| 3693 | return 0; |
| 3694 | } |
| 3695 | |
| 3696 | /* Show summary-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3697 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3698 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3699 | { |
| 3700 | if (lsa != NULL) |
| 3701 | { |
| 3702 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3703 | |
| 3704 | show_ip_ospf_database_header (vty, lsa); |
| 3705 | |
| 3706 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), |
| 3707 | VTY_NEWLINE); |
| 3708 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3709 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3710 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3711 | } |
| 3712 | |
| 3713 | return 0; |
| 3714 | } |
| 3715 | |
| 3716 | /* Show summary-ASBR-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3717 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3718 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3719 | { |
| 3720 | if (lsa != NULL) |
| 3721 | { |
| 3722 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3723 | |
| 3724 | show_ip_ospf_database_header (vty, lsa); |
| 3725 | |
| 3726 | vty_out (vty, " Network Mask: /%d%s", |
| 3727 | ip_masklen (sl->mask), VTY_NEWLINE); |
| 3728 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3729 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3730 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3731 | } |
| 3732 | |
| 3733 | return 0; |
| 3734 | } |
| 3735 | |
| 3736 | /* Show AS-external-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3737 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3738 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3739 | { |
| 3740 | if (lsa != NULL) |
| 3741 | { |
| 3742 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3743 | |
| 3744 | show_ip_ospf_database_header (vty, lsa); |
| 3745 | |
| 3746 | vty_out (vty, " Network Mask: /%d%s", |
| 3747 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3748 | vty_out (vty, " Metric Type: %s%s", |
| 3749 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3750 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3751 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3752 | vty_out (vty, " Metric: %d%s", |
| 3753 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3754 | vty_out (vty, " Forward Address: %s%s", |
| 3755 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3756 | |
| 3757 | vty_out (vty, " External Route Tag: %lu%s%s", |
| 3758 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3759 | } |
| 3760 | |
| 3761 | return 0; |
| 3762 | } |
| 3763 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3764 | /* N.B. This function currently seems to be unused. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3765 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3766 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
| 3767 | { |
| 3768 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3769 | |
| 3770 | /* show_ip_ospf_database_header (vty, lsa); */ |
| 3771 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3772 | zlog_debug( " Network Mask: /%d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3773 | ip_masklen (al->mask), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3774 | zlog_debug( " Metric Type: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3775 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3776 | "2 (Larger than any link state path)" : "1", "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3777 | zlog_debug( " TOS: 0%s", "\n"); |
| 3778 | zlog_debug( " Metric: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3779 | GET_METRIC (al->e[0].metric), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3780 | zlog_debug( " Forward Address: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3781 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
| 3782 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3783 | zlog_debug( " External Route Tag: %u%s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3784 | ntohl (al->e[0].route_tag), "\n", "\n"); |
| 3785 | |
| 3786 | return 0; |
| 3787 | } |
| 3788 | |
| 3789 | /* Show AS-NSSA-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3790 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3791 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3792 | { |
| 3793 | if (lsa != NULL) |
| 3794 | { |
| 3795 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3796 | |
| 3797 | show_ip_ospf_database_header (vty, lsa); |
| 3798 | |
| 3799 | vty_out (vty, " Network Mask: /%d%s", |
| 3800 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3801 | vty_out (vty, " Metric Type: %s%s", |
| 3802 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3803 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3804 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3805 | vty_out (vty, " Metric: %d%s", |
| 3806 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3807 | vty_out (vty, " NSSA: Forward Address: %s%s", |
| 3808 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3809 | |
| 3810 | vty_out (vty, " External Route Tag: %u%s%s", |
| 3811 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3812 | } |
| 3813 | |
| 3814 | return 0; |
| 3815 | } |
| 3816 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3817 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3818 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
| 3819 | { |
| 3820 | return 0; |
| 3821 | } |
| 3822 | |
| 3823 | #ifdef HAVE_OPAQUE_LSA |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3824 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3825 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3826 | { |
| 3827 | if (lsa != NULL) |
| 3828 | { |
| 3829 | show_ip_ospf_database_header (vty, lsa); |
| 3830 | show_opaque_info_detail (vty, lsa); |
| 3831 | |
| 3832 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3833 | } |
| 3834 | return 0; |
| 3835 | } |
| 3836 | #endif /* HAVE_OPAQUE_LSA */ |
| 3837 | |
| 3838 | int (*show_function[])(struct vty *, struct ospf_lsa *) = |
| 3839 | { |
| 3840 | NULL, |
| 3841 | show_router_lsa_detail, |
| 3842 | show_network_lsa_detail, |
| 3843 | show_summary_lsa_detail, |
| 3844 | show_summary_asbr_lsa_detail, |
| 3845 | show_as_external_lsa_detail, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3846 | show_func_dummy, |
| 3847 | show_as_nssa_lsa_detail, /* almost same as external */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3848 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3849 | NULL, /* type-8 */ |
| 3850 | show_opaque_lsa_detail, |
| 3851 | show_opaque_lsa_detail, |
| 3852 | show_opaque_lsa_detail, |
| 3853 | #endif /* HAVE_OPAQUE_LSA */ |
| 3854 | }; |
| 3855 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3856 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3857 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
| 3858 | struct in_addr *adv_router) |
| 3859 | { |
| 3860 | memset (lp, 0, sizeof (struct prefix_ls)); |
| 3861 | lp->family = 0; |
| 3862 | if (id == NULL) |
| 3863 | lp->prefixlen = 0; |
| 3864 | else if (adv_router == NULL) |
| 3865 | { |
| 3866 | lp->prefixlen = 32; |
| 3867 | lp->id = *id; |
| 3868 | } |
| 3869 | else |
| 3870 | { |
| 3871 | lp->prefixlen = 64; |
| 3872 | lp->id = *id; |
| 3873 | lp->adv_router = *adv_router; |
| 3874 | } |
| 3875 | } |
| 3876 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3877 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3878 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
| 3879 | struct in_addr *id, struct in_addr *adv_router) |
| 3880 | { |
| 3881 | struct prefix_ls lp; |
| 3882 | struct route_node *rn, *start; |
| 3883 | struct ospf_lsa *lsa; |
| 3884 | |
| 3885 | show_lsa_prefix_set (vty, &lp, id, adv_router); |
| 3886 | start = route_node_get (rt, (struct prefix *) &lp); |
| 3887 | if (start) |
| 3888 | { |
| 3889 | route_lock_node (start); |
| 3890 | for (rn = start; rn; rn = route_next_until (rn, start)) |
| 3891 | if ((lsa = rn->info)) |
| 3892 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3893 | if (show_function[lsa->data->type] != NULL) |
| 3894 | show_function[lsa->data->type] (vty, lsa); |
| 3895 | } |
| 3896 | route_unlock_node (start); |
| 3897 | } |
| 3898 | } |
| 3899 | |
| 3900 | /* Show detail LSA information |
| 3901 | -- if id is NULL then show all LSAs. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3902 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3903 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3904 | struct in_addr *id, struct in_addr *adv_router) |
| 3905 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3906 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3907 | struct ospf_area *area; |
| 3908 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3909 | switch (type) |
| 3910 | { |
| 3911 | case OSPF_AS_EXTERNAL_LSA: |
| 3912 | #ifdef HAVE_OPAQUE_LSA |
| 3913 | case OSPF_OPAQUE_AS_LSA: |
| 3914 | #endif /* HAVE_OPAQUE_LSA */ |
| 3915 | vty_out (vty, " %s %s%s", |
| 3916 | show_database_desc[type], |
| 3917 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3918 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3919 | break; |
| 3920 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3921 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3922 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3923 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3924 | VTY_NEWLINE, show_database_desc[type], |
| 3925 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3926 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); |
| 3927 | } |
| 3928 | break; |
| 3929 | } |
| 3930 | } |
| 3931 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3932 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3933 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
| 3934 | struct in_addr *adv_router) |
| 3935 | { |
| 3936 | struct route_node *rn; |
| 3937 | struct ospf_lsa *lsa; |
| 3938 | |
| 3939 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 3940 | if ((lsa = rn->info)) |
| 3941 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) |
| 3942 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3943 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
| 3944 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3945 | if (show_function[lsa->data->type] != NULL) |
| 3946 | show_function[lsa->data->type] (vty, lsa); |
| 3947 | } |
| 3948 | } |
| 3949 | |
| 3950 | /* Show detail LSA information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3951 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3952 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3953 | struct in_addr *adv_router) |
| 3954 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3955 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3956 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3957 | |
| 3958 | switch (type) |
| 3959 | { |
| 3960 | case OSPF_AS_EXTERNAL_LSA: |
| 3961 | #ifdef HAVE_OPAQUE_LSA |
| 3962 | case OSPF_OPAQUE_AS_LSA: |
| 3963 | #endif /* HAVE_OPAQUE_LSA */ |
| 3964 | vty_out (vty, " %s %s%s", |
| 3965 | show_database_desc[type], |
| 3966 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3967 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3968 | adv_router); |
| 3969 | break; |
| 3970 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3971 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3972 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3973 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3974 | VTY_NEWLINE, show_database_desc[type], |
| 3975 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3976 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), |
| 3977 | adv_router); |
| 3978 | } |
| 3979 | break; |
| 3980 | } |
| 3981 | } |
| 3982 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3983 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3984 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3985 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3986 | struct ospf_lsa *lsa; |
| 3987 | struct route_node *rn; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3988 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3989 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3990 | int type; |
| 3991 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3992 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3993 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3994 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3995 | { |
| 3996 | switch (type) |
| 3997 | { |
| 3998 | case OSPF_AS_EXTERNAL_LSA: |
| 3999 | #ifdef HAVE_OPAQUE_LSA |
| 4000 | case OSPF_OPAQUE_AS_LSA: |
| 4001 | #endif /* HAVE_OPAQUE_LSA */ |
| 4002 | continue; |
| 4003 | default: |
| 4004 | break; |
| 4005 | } |
| 4006 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || |
| 4007 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) |
| 4008 | { |
| 4009 | vty_out (vty, " %s (Area %s)%s%s", |
| 4010 | show_database_desc[type], |
| 4011 | ospf_area_desc_string (area), |
| 4012 | VTY_NEWLINE, VTY_NEWLINE); |
| 4013 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); |
| 4014 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4015 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
| 4016 | show_lsa_summary (vty, lsa, self); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4017 | |
| 4018 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4019 | } |
| 4020 | } |
| 4021 | } |
| 4022 | |
| 4023 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 4024 | { |
| 4025 | switch (type) |
| 4026 | { |
| 4027 | case OSPF_AS_EXTERNAL_LSA: |
| 4028 | #ifdef HAVE_OPAQUE_LSA |
| 4029 | case OSPF_OPAQUE_AS_LSA: |
| 4030 | #endif /* HAVE_OPAQUE_LSA */ |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4031 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4032 | default: |
| 4033 | continue; |
| 4034 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4035 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
| 4036 | (!self && ospf_lsdb_count (ospf->lsdb, type))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4037 | { |
| 4038 | vty_out (vty, " %s%s%s", |
| 4039 | show_database_desc[type], |
| 4040 | VTY_NEWLINE, VTY_NEWLINE); |
| 4041 | vty_out (vty, "%s%s", show_database_header[type], |
| 4042 | VTY_NEWLINE); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4043 | |
| 4044 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) |
| 4045 | show_lsa_summary (vty, lsa, self); |
| 4046 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4047 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4048 | } |
| 4049 | } |
| 4050 | |
| 4051 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4052 | } |
| 4053 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4054 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4055 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4056 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 4057 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4058 | struct ospf_lsa *lsa; |
| 4059 | |
| 4060 | vty_out (vty, "%s MaxAge Link States:%s%s", |
| 4061 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); |
| 4062 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4063 | for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) |
| 4064 | { |
| 4065 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); |
| 4066 | vty_out (vty, "Link State ID: %s%s", |
| 4067 | inet_ntoa (lsa->data->id), VTY_NEWLINE); |
| 4068 | vty_out (vty, "Advertising Router: %s%s", |
| 4069 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 4070 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); |
| 4071 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4072 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4073 | } |
| 4074 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4075 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
| 4076 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4077 | |
| 4078 | #ifdef HAVE_OPAQUE_LSA |
| 4079 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" |
| 4080 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" |
| 4081 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" |
| 4082 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" |
| 4083 | #else /* HAVE_OPAQUE_LSA */ |
| 4084 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" |
| 4085 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" |
| 4086 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" |
| 4087 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" |
| 4088 | #endif /* HAVE_OPAQUE_LSA */ |
| 4089 | |
| 4090 | #define OSPF_LSA_TYPES_CMD_STR \ |
| 4091 | "asbr-summary|external|network|router|summary" \ |
| 4092 | OSPF_LSA_TYPE_NSSA_CMD_STR \ |
| 4093 | OSPF_LSA_TYPE_OPAQUE_CMD_STR |
| 4094 | |
| 4095 | #define OSPF_LSA_TYPES_DESC \ |
| 4096 | "ASBR summary link states\n" \ |
| 4097 | "External link states\n" \ |
| 4098 | "Network link states\n" \ |
| 4099 | "Router link states\n" \ |
| 4100 | "Network summary link states\n" \ |
| 4101 | OSPF_LSA_TYPE_NSSA_DESC \ |
| 4102 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ |
| 4103 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ |
| 4104 | OSPF_LSA_TYPE_OPAQUE_AS_DESC |
| 4105 | |
| 4106 | DEFUN (show_ip_ospf_database, |
| 4107 | show_ip_ospf_database_cmd, |
| 4108 | "show ip ospf database", |
| 4109 | SHOW_STR |
| 4110 | IP_STR |
| 4111 | "OSPF information\n" |
| 4112 | "Database summary\n") |
| 4113 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4114 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4115 | int type, ret; |
| 4116 | struct in_addr id, adv_router; |
| 4117 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4118 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4119 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4120 | { |
| 4121 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4122 | return CMD_SUCCESS; |
| 4123 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4124 | |
| 4125 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4126 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4127 | |
| 4128 | /* Show all LSA. */ |
| 4129 | if (argc == 0) |
| 4130 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4131 | show_ip_ospf_database_summary (vty, ospf, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4132 | return CMD_SUCCESS; |
| 4133 | } |
| 4134 | |
| 4135 | /* Set database type to show. */ |
| 4136 | if (strncmp (argv[0], "r", 1) == 0) |
| 4137 | type = OSPF_ROUTER_LSA; |
| 4138 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4139 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4140 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4141 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4142 | else if (strncmp (argv[0], "su", 2) == 0) |
| 4143 | type = OSPF_SUMMARY_LSA; |
| 4144 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4145 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4146 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4147 | type = OSPF_AS_EXTERNAL_LSA; |
| 4148 | else if (strncmp (argv[0], "se", 2) == 0) |
| 4149 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4150 | show_ip_ospf_database_summary (vty, ospf, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4151 | return CMD_SUCCESS; |
| 4152 | } |
| 4153 | else if (strncmp (argv[0], "m", 1) == 0) |
| 4154 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4155 | show_ip_ospf_database_maxage (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4156 | return CMD_SUCCESS; |
| 4157 | } |
| 4158 | #ifdef HAVE_OPAQUE_LSA |
| 4159 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4160 | type = OSPF_OPAQUE_LINK_LSA; |
| 4161 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4162 | type = OSPF_OPAQUE_AREA_LSA; |
| 4163 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4164 | type = OSPF_OPAQUE_AS_LSA; |
| 4165 | #endif /* HAVE_OPAQUE_LSA */ |
| 4166 | else |
| 4167 | return CMD_WARNING; |
| 4168 | |
| 4169 | /* `show ip ospf database LSA'. */ |
| 4170 | if (argc == 1) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4171 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4172 | else if (argc >= 2) |
| 4173 | { |
| 4174 | ret = inet_aton (argv[1], &id); |
| 4175 | if (!ret) |
| 4176 | return CMD_WARNING; |
| 4177 | |
| 4178 | /* `show ip ospf database LSA ID'. */ |
| 4179 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4180 | show_lsa_detail (vty, ospf, type, &id, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4181 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
| 4182 | else if (argc == 3) |
| 4183 | { |
| 4184 | if (strncmp (argv[2], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4185 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4186 | else |
| 4187 | { |
| 4188 | ret = inet_aton (argv[2], &adv_router); |
| 4189 | if (!ret) |
| 4190 | return CMD_WARNING; |
| 4191 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4192 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4193 | } |
| 4194 | } |
| 4195 | |
| 4196 | return CMD_SUCCESS; |
| 4197 | } |
| 4198 | |
| 4199 | ALIAS (show_ip_ospf_database, |
| 4200 | show_ip_ospf_database_type_cmd, |
| 4201 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", |
| 4202 | SHOW_STR |
| 4203 | IP_STR |
| 4204 | "OSPF information\n" |
| 4205 | "Database summary\n" |
| 4206 | OSPF_LSA_TYPES_DESC |
| 4207 | "LSAs in MaxAge list\n" |
| 4208 | "Self-originated link states\n") |
| 4209 | |
| 4210 | ALIAS (show_ip_ospf_database, |
| 4211 | show_ip_ospf_database_type_id_cmd, |
| 4212 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", |
| 4213 | SHOW_STR |
| 4214 | IP_STR |
| 4215 | "OSPF information\n" |
| 4216 | "Database summary\n" |
| 4217 | OSPF_LSA_TYPES_DESC |
| 4218 | "Link State ID (as an IP address)\n") |
| 4219 | |
| 4220 | ALIAS (show_ip_ospf_database, |
| 4221 | show_ip_ospf_database_type_id_adv_router_cmd, |
| 4222 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", |
| 4223 | SHOW_STR |
| 4224 | IP_STR |
| 4225 | "OSPF information\n" |
| 4226 | "Database summary\n" |
| 4227 | OSPF_LSA_TYPES_DESC |
| 4228 | "Link State ID (as an IP address)\n" |
| 4229 | "Advertising Router link states\n" |
| 4230 | "Advertising Router (as an IP address)\n") |
| 4231 | |
| 4232 | ALIAS (show_ip_ospf_database, |
| 4233 | show_ip_ospf_database_type_id_self_cmd, |
| 4234 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", |
| 4235 | SHOW_STR |
| 4236 | IP_STR |
| 4237 | "OSPF information\n" |
| 4238 | "Database summary\n" |
| 4239 | OSPF_LSA_TYPES_DESC |
| 4240 | "Link State ID (as an IP address)\n" |
| 4241 | "Self-originated link states\n" |
| 4242 | "\n") |
| 4243 | |
| 4244 | DEFUN (show_ip_ospf_database_type_adv_router, |
| 4245 | show_ip_ospf_database_type_adv_router_cmd, |
| 4246 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", |
| 4247 | SHOW_STR |
| 4248 | IP_STR |
| 4249 | "OSPF information\n" |
| 4250 | "Database summary\n" |
| 4251 | OSPF_LSA_TYPES_DESC |
| 4252 | "Advertising Router link states\n" |
| 4253 | "Advertising Router (as an IP address)\n") |
| 4254 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4255 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4256 | int type, ret; |
| 4257 | struct in_addr adv_router; |
| 4258 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4259 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4260 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4261 | { |
| 4262 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4263 | return CMD_SUCCESS; |
| 4264 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4265 | |
| 4266 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4267 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4268 | |
| 4269 | if (argc != 2) |
| 4270 | return CMD_WARNING; |
| 4271 | |
| 4272 | /* Set database type to show. */ |
| 4273 | if (strncmp (argv[0], "r", 1) == 0) |
| 4274 | type = OSPF_ROUTER_LSA; |
| 4275 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4276 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4277 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4278 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4279 | else if (strncmp (argv[0], "s", 1) == 0) |
| 4280 | type = OSPF_SUMMARY_LSA; |
| 4281 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4282 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4283 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4284 | type = OSPF_AS_EXTERNAL_LSA; |
| 4285 | #ifdef HAVE_OPAQUE_LSA |
| 4286 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4287 | type = OSPF_OPAQUE_LINK_LSA; |
| 4288 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4289 | type = OSPF_OPAQUE_AREA_LSA; |
| 4290 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4291 | type = OSPF_OPAQUE_AS_LSA; |
| 4292 | #endif /* HAVE_OPAQUE_LSA */ |
| 4293 | else |
| 4294 | return CMD_WARNING; |
| 4295 | |
| 4296 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ |
| 4297 | if (strncmp (argv[1], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4298 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4299 | else |
| 4300 | { |
| 4301 | ret = inet_aton (argv[1], &adv_router); |
| 4302 | if (!ret) |
| 4303 | return CMD_WARNING; |
| 4304 | } |
| 4305 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4306 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4307 | |
| 4308 | return CMD_SUCCESS; |
| 4309 | } |
| 4310 | |
| 4311 | ALIAS (show_ip_ospf_database_type_adv_router, |
| 4312 | show_ip_ospf_database_type_self_cmd, |
| 4313 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", |
| 4314 | SHOW_STR |
| 4315 | IP_STR |
| 4316 | "OSPF information\n" |
| 4317 | "Database summary\n" |
| 4318 | OSPF_LSA_TYPES_DESC |
| 4319 | "Self-originated link states\n") |
| 4320 | |
| 4321 | |
| 4322 | DEFUN (ip_ospf_authentication_args, |
| 4323 | ip_ospf_authentication_args_addr_cmd, |
| 4324 | "ip ospf authentication (null|message-digest) A.B.C.D", |
| 4325 | "IP Information\n" |
| 4326 | "OSPF interface commands\n" |
| 4327 | "Enable authentication on this interface\n" |
| 4328 | "Use null authentication\n" |
| 4329 | "Use message-digest authentication\n" |
| 4330 | "Address of interface") |
| 4331 | { |
| 4332 | struct interface *ifp; |
| 4333 | struct in_addr addr; |
| 4334 | int ret; |
| 4335 | struct ospf_if_params *params; |
| 4336 | |
| 4337 | ifp = vty->index; |
| 4338 | params = IF_DEF_PARAMS (ifp); |
| 4339 | |
| 4340 | if (argc == 2) |
| 4341 | { |
| 4342 | ret = inet_aton(argv[1], &addr); |
| 4343 | if (!ret) |
| 4344 | { |
| 4345 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4346 | VTY_NEWLINE); |
| 4347 | return CMD_WARNING; |
| 4348 | } |
| 4349 | |
| 4350 | params = ospf_get_if_params (ifp, addr); |
| 4351 | ospf_if_update_params (ifp, addr); |
| 4352 | } |
| 4353 | |
| 4354 | /* Handle null authentication */ |
| 4355 | if ( argv[0][0] == 'n' ) |
| 4356 | { |
| 4357 | SET_IF_PARAM (params, auth_type); |
| 4358 | params->auth_type = OSPF_AUTH_NULL; |
| 4359 | return CMD_SUCCESS; |
| 4360 | } |
| 4361 | |
| 4362 | /* Handle message-digest authentication */ |
| 4363 | if ( argv[0][0] == 'm' ) |
| 4364 | { |
| 4365 | SET_IF_PARAM (params, auth_type); |
| 4366 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 4367 | return CMD_SUCCESS; |
| 4368 | } |
| 4369 | |
| 4370 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); |
| 4371 | return CMD_WARNING; |
| 4372 | } |
| 4373 | |
| 4374 | ALIAS (ip_ospf_authentication_args, |
| 4375 | ip_ospf_authentication_args_cmd, |
| 4376 | "ip ospf authentication (null|message-digest)", |
| 4377 | "IP Information\n" |
| 4378 | "OSPF interface commands\n" |
| 4379 | "Enable authentication on this interface\n" |
| 4380 | "Use null authentication\n" |
| 4381 | "Use message-digest authentication\n") |
| 4382 | |
| 4383 | DEFUN (ip_ospf_authentication, |
| 4384 | ip_ospf_authentication_addr_cmd, |
| 4385 | "ip ospf authentication A.B.C.D", |
| 4386 | "IP Information\n" |
| 4387 | "OSPF interface commands\n" |
| 4388 | "Enable authentication on this interface\n" |
| 4389 | "Address of interface") |
| 4390 | { |
| 4391 | struct interface *ifp; |
| 4392 | struct in_addr addr; |
| 4393 | int ret; |
| 4394 | struct ospf_if_params *params; |
| 4395 | |
| 4396 | ifp = vty->index; |
| 4397 | params = IF_DEF_PARAMS (ifp); |
| 4398 | |
| 4399 | if (argc == 1) |
| 4400 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4401 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4402 | if (!ret) |
| 4403 | { |
| 4404 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4405 | VTY_NEWLINE); |
| 4406 | return CMD_WARNING; |
| 4407 | } |
| 4408 | |
| 4409 | params = ospf_get_if_params (ifp, addr); |
| 4410 | ospf_if_update_params (ifp, addr); |
| 4411 | } |
| 4412 | |
| 4413 | SET_IF_PARAM (params, auth_type); |
| 4414 | params->auth_type = OSPF_AUTH_SIMPLE; |
| 4415 | |
| 4416 | return CMD_SUCCESS; |
| 4417 | } |
| 4418 | |
| 4419 | ALIAS (ip_ospf_authentication, |
| 4420 | ip_ospf_authentication_cmd, |
| 4421 | "ip ospf authentication", |
| 4422 | "IP Information\n" |
| 4423 | "OSPF interface commands\n" |
| 4424 | "Enable authentication on this interface\n") |
| 4425 | |
| 4426 | DEFUN (no_ip_ospf_authentication, |
| 4427 | no_ip_ospf_authentication_addr_cmd, |
| 4428 | "no ip ospf authentication A.B.C.D", |
| 4429 | NO_STR |
| 4430 | "IP Information\n" |
| 4431 | "OSPF interface commands\n" |
| 4432 | "Enable authentication on this interface\n" |
| 4433 | "Address of interface") |
| 4434 | { |
| 4435 | struct interface *ifp; |
| 4436 | struct in_addr addr; |
| 4437 | int ret; |
| 4438 | struct ospf_if_params *params; |
| 4439 | |
| 4440 | ifp = vty->index; |
| 4441 | params = IF_DEF_PARAMS (ifp); |
| 4442 | |
| 4443 | if (argc == 1) |
| 4444 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4445 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4446 | if (!ret) |
| 4447 | { |
| 4448 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4449 | VTY_NEWLINE); |
| 4450 | return CMD_WARNING; |
| 4451 | } |
| 4452 | |
| 4453 | params = ospf_lookup_if_params (ifp, addr); |
| 4454 | if (params == NULL) |
| 4455 | return CMD_SUCCESS; |
| 4456 | } |
| 4457 | |
| 4458 | params->auth_type = OSPF_AUTH_NOTSET; |
| 4459 | UNSET_IF_PARAM (params, auth_type); |
| 4460 | |
| 4461 | if (params != IF_DEF_PARAMS (ifp)) |
| 4462 | { |
| 4463 | ospf_free_if_params (ifp, addr); |
| 4464 | ospf_if_update_params (ifp, addr); |
| 4465 | } |
| 4466 | |
| 4467 | return CMD_SUCCESS; |
| 4468 | } |
| 4469 | |
| 4470 | ALIAS (no_ip_ospf_authentication, |
| 4471 | no_ip_ospf_authentication_cmd, |
| 4472 | "no ip ospf authentication", |
| 4473 | NO_STR |
| 4474 | "IP Information\n" |
| 4475 | "OSPF interface commands\n" |
| 4476 | "Enable authentication on this interface\n") |
| 4477 | |
| 4478 | DEFUN (ip_ospf_authentication_key, |
| 4479 | ip_ospf_authentication_key_addr_cmd, |
| 4480 | "ip ospf authentication-key AUTH_KEY A.B.C.D", |
| 4481 | "IP Information\n" |
| 4482 | "OSPF interface commands\n" |
| 4483 | "Authentication password (key)\n" |
| 4484 | "The OSPF password (key)\n" |
| 4485 | "Address of interface") |
| 4486 | { |
| 4487 | struct interface *ifp; |
| 4488 | struct in_addr addr; |
| 4489 | int ret; |
| 4490 | struct ospf_if_params *params; |
| 4491 | |
| 4492 | ifp = vty->index; |
| 4493 | params = IF_DEF_PARAMS (ifp); |
| 4494 | |
| 4495 | if (argc == 2) |
| 4496 | { |
| 4497 | ret = inet_aton(argv[1], &addr); |
| 4498 | if (!ret) |
| 4499 | { |
| 4500 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4501 | VTY_NEWLINE); |
| 4502 | return CMD_WARNING; |
| 4503 | } |
| 4504 | |
| 4505 | params = ospf_get_if_params (ifp, addr); |
| 4506 | ospf_if_update_params (ifp, addr); |
| 4507 | } |
| 4508 | |
| 4509 | |
| 4510 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4511 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4512 | SET_IF_PARAM (params, auth_simple); |
| 4513 | |
| 4514 | return CMD_SUCCESS; |
| 4515 | } |
| 4516 | |
| 4517 | ALIAS (ip_ospf_authentication_key, |
| 4518 | ip_ospf_authentication_key_cmd, |
| 4519 | "ip ospf authentication-key AUTH_KEY", |
| 4520 | "IP Information\n" |
| 4521 | "OSPF interface commands\n" |
| 4522 | "Authentication password (key)\n" |
| 4523 | "The OSPF password (key)") |
| 4524 | |
| 4525 | ALIAS (ip_ospf_authentication_key, |
| 4526 | ospf_authentication_key_cmd, |
| 4527 | "ospf authentication-key AUTH_KEY", |
| 4528 | "OSPF interface commands\n" |
| 4529 | "Authentication password (key)\n" |
| 4530 | "The OSPF password (key)") |
| 4531 | |
| 4532 | DEFUN (no_ip_ospf_authentication_key, |
| 4533 | no_ip_ospf_authentication_key_addr_cmd, |
| 4534 | "no ip ospf authentication-key A.B.C.D", |
| 4535 | NO_STR |
| 4536 | "IP Information\n" |
| 4537 | "OSPF interface commands\n" |
| 4538 | "Authentication password (key)\n" |
| 4539 | "Address of interface") |
| 4540 | { |
| 4541 | struct interface *ifp; |
| 4542 | struct in_addr addr; |
| 4543 | int ret; |
| 4544 | struct ospf_if_params *params; |
| 4545 | |
| 4546 | ifp = vty->index; |
| 4547 | params = IF_DEF_PARAMS (ifp); |
| 4548 | |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4549 | if (argc == 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4550 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4551 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4552 | if (!ret) |
| 4553 | { |
| 4554 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4555 | VTY_NEWLINE); |
| 4556 | return CMD_WARNING; |
| 4557 | } |
| 4558 | |
| 4559 | params = ospf_lookup_if_params (ifp, addr); |
| 4560 | if (params == NULL) |
| 4561 | return CMD_SUCCESS; |
| 4562 | } |
| 4563 | |
| 4564 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); |
| 4565 | UNSET_IF_PARAM (params, auth_simple); |
| 4566 | |
| 4567 | if (params != IF_DEF_PARAMS (ifp)) |
| 4568 | { |
| 4569 | ospf_free_if_params (ifp, addr); |
| 4570 | ospf_if_update_params (ifp, addr); |
| 4571 | } |
| 4572 | |
| 4573 | return CMD_SUCCESS; |
| 4574 | } |
| 4575 | |
| 4576 | ALIAS (no_ip_ospf_authentication_key, |
| 4577 | no_ip_ospf_authentication_key_cmd, |
| 4578 | "no ip ospf authentication-key", |
| 4579 | NO_STR |
| 4580 | "IP Information\n" |
| 4581 | "OSPF interface commands\n" |
| 4582 | "Authentication password (key)\n") |
| 4583 | |
| 4584 | ALIAS (no_ip_ospf_authentication_key, |
| 4585 | no_ospf_authentication_key_cmd, |
| 4586 | "no ospf authentication-key", |
| 4587 | NO_STR |
| 4588 | "OSPF interface commands\n" |
| 4589 | "Authentication password (key)\n") |
| 4590 | |
| 4591 | DEFUN (ip_ospf_message_digest_key, |
| 4592 | ip_ospf_message_digest_key_addr_cmd, |
| 4593 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", |
| 4594 | "IP Information\n" |
| 4595 | "OSPF interface commands\n" |
| 4596 | "Message digest authentication password (key)\n" |
| 4597 | "Key ID\n" |
| 4598 | "Use MD5 algorithm\n" |
| 4599 | "The OSPF password (key)" |
| 4600 | "Address of interface") |
| 4601 | { |
| 4602 | struct interface *ifp; |
| 4603 | struct crypt_key *ck; |
| 4604 | u_char key_id; |
| 4605 | struct in_addr addr; |
| 4606 | int ret; |
| 4607 | struct ospf_if_params *params; |
| 4608 | |
| 4609 | ifp = vty->index; |
| 4610 | params = IF_DEF_PARAMS (ifp); |
| 4611 | |
| 4612 | if (argc == 3) |
| 4613 | { |
| 4614 | ret = inet_aton(argv[2], &addr); |
| 4615 | if (!ret) |
| 4616 | { |
| 4617 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4618 | VTY_NEWLINE); |
| 4619 | return CMD_WARNING; |
| 4620 | } |
| 4621 | |
| 4622 | params = ospf_get_if_params (ifp, addr); |
| 4623 | ospf_if_update_params (ifp, addr); |
| 4624 | } |
| 4625 | |
| 4626 | key_id = strtol (argv[0], NULL, 10); |
| 4627 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) |
| 4628 | { |
| 4629 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); |
| 4630 | return CMD_WARNING; |
| 4631 | } |
| 4632 | |
| 4633 | ck = ospf_crypt_key_new (); |
| 4634 | ck->key_id = (u_char) key_id; |
| 4635 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4636 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4637 | |
| 4638 | ospf_crypt_key_add (params->auth_crypt, ck); |
| 4639 | SET_IF_PARAM (params, auth_crypt); |
| 4640 | |
| 4641 | return CMD_SUCCESS; |
| 4642 | } |
| 4643 | |
| 4644 | ALIAS (ip_ospf_message_digest_key, |
| 4645 | ip_ospf_message_digest_key_cmd, |
| 4646 | "ip ospf message-digest-key <1-255> md5 KEY", |
| 4647 | "IP Information\n" |
| 4648 | "OSPF interface commands\n" |
| 4649 | "Message digest authentication password (key)\n" |
| 4650 | "Key ID\n" |
| 4651 | "Use MD5 algorithm\n" |
| 4652 | "The OSPF password (key)") |
| 4653 | |
| 4654 | ALIAS (ip_ospf_message_digest_key, |
| 4655 | ospf_message_digest_key_cmd, |
| 4656 | "ospf message-digest-key <1-255> md5 KEY", |
| 4657 | "OSPF interface commands\n" |
| 4658 | "Message digest authentication password (key)\n" |
| 4659 | "Key ID\n" |
| 4660 | "Use MD5 algorithm\n" |
| 4661 | "The OSPF password (key)") |
| 4662 | |
| 4663 | DEFUN (no_ip_ospf_message_digest_key, |
| 4664 | no_ip_ospf_message_digest_key_addr_cmd, |
| 4665 | "no ip ospf message-digest-key <1-255> A.B.C.D", |
| 4666 | NO_STR |
| 4667 | "IP Information\n" |
| 4668 | "OSPF interface commands\n" |
| 4669 | "Message digest authentication password (key)\n" |
| 4670 | "Key ID\n" |
| 4671 | "Address of interface") |
| 4672 | { |
| 4673 | struct interface *ifp; |
| 4674 | struct crypt_key *ck; |
| 4675 | int key_id; |
| 4676 | struct in_addr addr; |
| 4677 | int ret; |
| 4678 | struct ospf_if_params *params; |
| 4679 | |
| 4680 | ifp = vty->index; |
| 4681 | params = IF_DEF_PARAMS (ifp); |
| 4682 | |
| 4683 | if (argc == 2) |
| 4684 | { |
| 4685 | ret = inet_aton(argv[1], &addr); |
| 4686 | if (!ret) |
| 4687 | { |
| 4688 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4689 | VTY_NEWLINE); |
| 4690 | return CMD_WARNING; |
| 4691 | } |
| 4692 | |
| 4693 | params = ospf_lookup_if_params (ifp, addr); |
| 4694 | if (params == NULL) |
| 4695 | return CMD_SUCCESS; |
| 4696 | } |
| 4697 | |
| 4698 | key_id = strtol (argv[0], NULL, 10); |
| 4699 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); |
| 4700 | if (ck == NULL) |
| 4701 | { |
| 4702 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); |
| 4703 | return CMD_WARNING; |
| 4704 | } |
| 4705 | |
| 4706 | ospf_crypt_key_delete (params->auth_crypt, key_id); |
| 4707 | |
| 4708 | if (params != IF_DEF_PARAMS (ifp)) |
| 4709 | { |
| 4710 | ospf_free_if_params (ifp, addr); |
| 4711 | ospf_if_update_params (ifp, addr); |
| 4712 | } |
| 4713 | |
| 4714 | return CMD_SUCCESS; |
| 4715 | } |
| 4716 | |
| 4717 | ALIAS (no_ip_ospf_message_digest_key, |
| 4718 | no_ip_ospf_message_digest_key_cmd, |
| 4719 | "no ip ospf message-digest-key <1-255>", |
| 4720 | NO_STR |
| 4721 | "IP Information\n" |
| 4722 | "OSPF interface commands\n" |
| 4723 | "Message digest authentication password (key)\n" |
| 4724 | "Key ID\n") |
| 4725 | |
| 4726 | ALIAS (no_ip_ospf_message_digest_key, |
| 4727 | no_ospf_message_digest_key_cmd, |
| 4728 | "no ospf message-digest-key <1-255>", |
| 4729 | NO_STR |
| 4730 | "OSPF interface commands\n" |
| 4731 | "Message digest authentication password (key)\n" |
| 4732 | "Key ID\n") |
| 4733 | |
| 4734 | DEFUN (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4735 | ip_ospf_cost_u32_inet4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4736 | "ip ospf cost <1-65535> A.B.C.D", |
| 4737 | "IP Information\n" |
| 4738 | "OSPF interface commands\n" |
| 4739 | "Interface cost\n" |
| 4740 | "Cost\n" |
| 4741 | "Address of interface") |
| 4742 | { |
| 4743 | struct interface *ifp = vty->index; |
| 4744 | u_int32_t cost; |
| 4745 | struct in_addr addr; |
| 4746 | int ret; |
| 4747 | struct ospf_if_params *params; |
| 4748 | |
| 4749 | params = IF_DEF_PARAMS (ifp); |
| 4750 | |
| 4751 | cost = strtol (argv[0], NULL, 10); |
| 4752 | |
| 4753 | /* cost range is <1-65535>. */ |
| 4754 | if (cost < 1 || cost > 65535) |
| 4755 | { |
| 4756 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4757 | return CMD_WARNING; |
| 4758 | } |
| 4759 | |
| 4760 | if (argc == 2) |
| 4761 | { |
| 4762 | ret = inet_aton(argv[1], &addr); |
| 4763 | if (!ret) |
| 4764 | { |
| 4765 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4766 | VTY_NEWLINE); |
| 4767 | return CMD_WARNING; |
| 4768 | } |
| 4769 | |
| 4770 | params = ospf_get_if_params (ifp, addr); |
| 4771 | ospf_if_update_params (ifp, addr); |
| 4772 | } |
| 4773 | |
| 4774 | SET_IF_PARAM (params, output_cost_cmd); |
| 4775 | params->output_cost_cmd = cost; |
| 4776 | |
| 4777 | ospf_if_recalculate_output_cost (ifp); |
| 4778 | |
| 4779 | return CMD_SUCCESS; |
| 4780 | } |
| 4781 | |
| 4782 | ALIAS (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4783 | ip_ospf_cost_u32_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4784 | "ip ospf cost <1-65535>", |
| 4785 | "IP Information\n" |
| 4786 | "OSPF interface commands\n" |
| 4787 | "Interface cost\n" |
| 4788 | "Cost") |
| 4789 | |
| 4790 | ALIAS (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4791 | ospf_cost_u32_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4792 | "ospf cost <1-65535>", |
| 4793 | "OSPF interface commands\n" |
| 4794 | "Interface cost\n" |
| 4795 | "Cost") |
| 4796 | |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4797 | ALIAS (ip_ospf_cost, |
| 4798 | ospf_cost_u32_inet4_cmd, |
| 4799 | "ospf cost <1-65535> A.B.C.D", |
| 4800 | "OSPF interface commands\n" |
| 4801 | "Interface cost\n" |
| 4802 | "Cost\n" |
| 4803 | "Address of interface") |
| 4804 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4805 | DEFUN (no_ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4806 | no_ip_ospf_cost_inet4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4807 | "no ip ospf cost A.B.C.D", |
| 4808 | NO_STR |
| 4809 | "IP Information\n" |
| 4810 | "OSPF interface commands\n" |
| 4811 | "Interface cost\n" |
| 4812 | "Address of interface") |
| 4813 | { |
| 4814 | struct interface *ifp = vty->index; |
| 4815 | struct in_addr addr; |
| 4816 | int ret; |
| 4817 | struct ospf_if_params *params; |
| 4818 | |
| 4819 | ifp = vty->index; |
| 4820 | params = IF_DEF_PARAMS (ifp); |
| 4821 | |
| 4822 | if (argc == 1) |
| 4823 | { |
| 4824 | ret = inet_aton(argv[0], &addr); |
| 4825 | if (!ret) |
| 4826 | { |
| 4827 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4828 | VTY_NEWLINE); |
| 4829 | return CMD_WARNING; |
| 4830 | } |
| 4831 | |
| 4832 | params = ospf_lookup_if_params (ifp, addr); |
| 4833 | if (params == NULL) |
| 4834 | return CMD_SUCCESS; |
| 4835 | } |
| 4836 | |
| 4837 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4838 | |
| 4839 | if (params != IF_DEF_PARAMS (ifp)) |
| 4840 | { |
| 4841 | ospf_free_if_params (ifp, addr); |
| 4842 | ospf_if_update_params (ifp, addr); |
| 4843 | } |
| 4844 | |
| 4845 | ospf_if_recalculate_output_cost (ifp); |
| 4846 | |
| 4847 | return CMD_SUCCESS; |
| 4848 | } |
| 4849 | |
| 4850 | ALIAS (no_ip_ospf_cost, |
| 4851 | no_ip_ospf_cost_cmd, |
| 4852 | "no ip ospf cost", |
| 4853 | NO_STR |
| 4854 | "IP Information\n" |
| 4855 | "OSPF interface commands\n" |
| 4856 | "Interface cost\n") |
| 4857 | |
| 4858 | ALIAS (no_ip_ospf_cost, |
| 4859 | no_ospf_cost_cmd, |
| 4860 | "no ospf cost", |
| 4861 | NO_STR |
| 4862 | "OSPF interface commands\n" |
| 4863 | "Interface cost\n") |
| 4864 | |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4865 | ALIAS (no_ip_ospf_cost, |
| 4866 | no_ospf_cost_inet4_cmd, |
| 4867 | "no ospf cost A.B.C.D", |
| 4868 | NO_STR |
| 4869 | "OSPF interface commands\n" |
| 4870 | "Interface cost\n" |
| 4871 | "Address of interface") |
| 4872 | |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 4873 | DEFUN (no_ip_ospf_cost2, |
| 4874 | no_ip_ospf_cost_u32_cmd, |
| 4875 | "no ip ospf cost <1-65535>", |
| 4876 | NO_STR |
| 4877 | "IP Information\n" |
| 4878 | "OSPF interface commands\n" |
| 4879 | "Interface cost\n" |
| 4880 | "Cost") |
| 4881 | { |
| 4882 | struct interface *ifp = vty->index; |
| 4883 | struct in_addr addr; |
| 4884 | u_int32_t cost; |
| 4885 | int ret; |
| 4886 | struct ospf_if_params *params; |
| 4887 | |
| 4888 | ifp = vty->index; |
| 4889 | params = IF_DEF_PARAMS (ifp); |
| 4890 | |
| 4891 | /* According to the semantics we are mimicking "no ip ospf cost N" is |
| 4892 | * always treated as "no ip ospf cost" regardless of the actual value |
| 4893 | * of N already configured for the interface. Thus the first argument |
| 4894 | * is always checked to be a number, but is ignored after that. |
| 4895 | */ |
| 4896 | cost = strtol (argv[0], NULL, 10); |
| 4897 | if (cost < 1 || cost > 65535) |
| 4898 | { |
| 4899 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4900 | return CMD_WARNING; |
| 4901 | } |
| 4902 | |
| 4903 | if (argc == 2) |
| 4904 | { |
| 4905 | ret = inet_aton(argv[1], &addr); |
| 4906 | if (!ret) |
| 4907 | { |
| 4908 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4909 | VTY_NEWLINE); |
| 4910 | return CMD_WARNING; |
| 4911 | } |
| 4912 | |
| 4913 | params = ospf_lookup_if_params (ifp, addr); |
| 4914 | if (params == NULL) |
| 4915 | return CMD_SUCCESS; |
| 4916 | } |
| 4917 | |
| 4918 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4919 | |
| 4920 | if (params != IF_DEF_PARAMS (ifp)) |
| 4921 | { |
| 4922 | ospf_free_if_params (ifp, addr); |
| 4923 | ospf_if_update_params (ifp, addr); |
| 4924 | } |
| 4925 | |
| 4926 | ospf_if_recalculate_output_cost (ifp); |
| 4927 | |
| 4928 | return CMD_SUCCESS; |
| 4929 | } |
| 4930 | |
| 4931 | ALIAS (no_ip_ospf_cost2, |
| 4932 | no_ospf_cost_u32_cmd, |
| 4933 | "no ospf cost <1-65535>", |
| 4934 | NO_STR |
| 4935 | "OSPF interface commands\n" |
| 4936 | "Interface cost\n" |
| 4937 | "Cost") |
| 4938 | |
| 4939 | ALIAS (no_ip_ospf_cost2, |
| 4940 | no_ip_ospf_cost_u32_inet4_cmd, |
| 4941 | "no ip ospf cost <1-65535> A.B.C.D", |
| 4942 | NO_STR |
| 4943 | "IP Information\n" |
| 4944 | "OSPF interface commands\n" |
| 4945 | "Interface cost\n" |
| 4946 | "Cost\n" |
| 4947 | "Address of interface") |
| 4948 | |
| 4949 | ALIAS (no_ip_ospf_cost2, |
| 4950 | no_ospf_cost_u32_inet4_cmd, |
| 4951 | "no ospf cost <1-65535> A.B.C.D", |
| 4952 | NO_STR |
| 4953 | "OSPF interface commands\n" |
| 4954 | "Interface cost\n" |
| 4955 | "Cost\n" |
| 4956 | "Address of interface") |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4957 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4958 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4959 | ospf_nbr_timer_update (struct ospf_interface *oi) |
| 4960 | { |
| 4961 | struct route_node *rn; |
| 4962 | struct ospf_neighbor *nbr; |
| 4963 | |
| 4964 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 4965 | if ((nbr = rn->info)) |
| 4966 | { |
| 4967 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); |
| 4968 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4969 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4970 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4971 | } |
| 4972 | } |
| 4973 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4974 | static int |
| 4975 | ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, |
| 4976 | const char *nbr_str, |
| 4977 | const char *fast_hello_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4978 | { |
| 4979 | struct interface *ifp = vty->index; |
| 4980 | u_int32_t seconds; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4981 | u_char hellomult; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4982 | struct in_addr addr; |
| 4983 | int ret; |
| 4984 | struct ospf_if_params *params; |
| 4985 | struct ospf_interface *oi; |
| 4986 | struct route_node *rn; |
| 4987 | |
| 4988 | params = IF_DEF_PARAMS (ifp); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4989 | |
| 4990 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4991 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4992 | ret = inet_aton(nbr_str, &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4993 | if (!ret) |
| 4994 | { |
| 4995 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4996 | VTY_NEWLINE); |
| 4997 | return CMD_WARNING; |
| 4998 | } |
| 4999 | |
| 5000 | params = ospf_get_if_params (ifp, addr); |
| 5001 | ospf_if_update_params (ifp, addr); |
| 5002 | } |
| 5003 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5004 | if (interval_str) |
| 5005 | { |
| 5006 | VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str, |
| 5007 | 1, 65535); |
| 5008 | |
| 5009 | /* reset fast_hello too, just to be sure */ |
| 5010 | UNSET_IF_PARAM (params, fast_hello); |
| 5011 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 5012 | } |
| 5013 | else if (fast_hello_str) |
| 5014 | { |
| 5015 | VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str, |
| 5016 | 1, 10); |
| 5017 | /* 1s dead-interval with sub-second hellos desired */ |
| 5018 | seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL; |
| 5019 | SET_IF_PARAM (params, fast_hello); |
| 5020 | params->fast_hello = hellomult; |
| 5021 | } |
| 5022 | else |
| 5023 | { |
| 5024 | vty_out (vty, "Please specify dead-interval or hello-multiplier%s", |
| 5025 | VTY_NEWLINE); |
| 5026 | return CMD_WARNING; |
| 5027 | } |
| 5028 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5029 | SET_IF_PARAM (params, v_wait); |
| 5030 | params->v_wait = seconds; |
| 5031 | |
| 5032 | /* Update timer values in neighbor structure. */ |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5033 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5034 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 5035 | struct ospf *ospf; |
| 5036 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5037 | { |
| 5038 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 5039 | if (oi) |
| 5040 | ospf_nbr_timer_update (oi); |
| 5041 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5042 | } |
| 5043 | else |
| 5044 | { |
| 5045 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5046 | if ((oi = rn->info)) |
| 5047 | ospf_nbr_timer_update (oi); |
| 5048 | } |
| 5049 | |
| 5050 | return CMD_SUCCESS; |
| 5051 | } |
| 5052 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5053 | |
| 5054 | DEFUN (ip_ospf_dead_interval, |
| 5055 | ip_ospf_dead_interval_addr_cmd, |
| 5056 | "ip ospf dead-interval <1-65535> A.B.C.D", |
| 5057 | "IP Information\n" |
| 5058 | "OSPF interface commands\n" |
| 5059 | "Interval after which a neighbor is declared dead\n" |
| 5060 | "Seconds\n" |
| 5061 | "Address of interface\n") |
| 5062 | { |
| 5063 | if (argc == 2) |
| 5064 | return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); |
| 5065 | else |
| 5066 | return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); |
| 5067 | } |
| 5068 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5069 | ALIAS (ip_ospf_dead_interval, |
| 5070 | ip_ospf_dead_interval_cmd, |
| 5071 | "ip ospf dead-interval <1-65535>", |
| 5072 | "IP Information\n" |
| 5073 | "OSPF interface commands\n" |
| 5074 | "Interval after which a neighbor is declared dead\n" |
| 5075 | "Seconds\n") |
| 5076 | |
| 5077 | ALIAS (ip_ospf_dead_interval, |
| 5078 | ospf_dead_interval_cmd, |
| 5079 | "ospf dead-interval <1-65535>", |
| 5080 | "OSPF interface commands\n" |
| 5081 | "Interval after which a neighbor is declared dead\n" |
| 5082 | "Seconds\n") |
| 5083 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5084 | DEFUN (ip_ospf_dead_interval_minimal, |
| 5085 | ip_ospf_dead_interval_minimal_addr_cmd, |
| 5086 | "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", |
| 5087 | "IP Information\n" |
| 5088 | "OSPF interface commands\n" |
| 5089 | "Interval after which a neighbor is declared dead\n" |
| 5090 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 5091 | "Hello multiplier factor\n" |
| 5092 | "Number of Hellos to send each second\n" |
| 5093 | "Address of interface\n") |
| 5094 | { |
| 5095 | if (argc == 2) |
| 5096 | return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); |
| 5097 | else |
| 5098 | return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); |
| 5099 | } |
| 5100 | |
| 5101 | ALIAS (ip_ospf_dead_interval_minimal, |
| 5102 | ip_ospf_dead_interval_minimal_cmd, |
| 5103 | "ip ospf dead-interval minimal hello-multiplier <1-10>", |
| 5104 | "IP Information\n" |
| 5105 | "OSPF interface commands\n" |
| 5106 | "Interval after which a neighbor is declared dead\n" |
| 5107 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 5108 | "Hello multiplier factor\n" |
| 5109 | "Number of Hellos to send each second\n") |
| 5110 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5111 | DEFUN (no_ip_ospf_dead_interval, |
| 5112 | no_ip_ospf_dead_interval_addr_cmd, |
| 5113 | "no ip ospf dead-interval A.B.C.D", |
| 5114 | NO_STR |
| 5115 | "IP Information\n" |
| 5116 | "OSPF interface commands\n" |
| 5117 | "Interval after which a neighbor is declared dead\n" |
| 5118 | "Address of interface") |
| 5119 | { |
| 5120 | struct interface *ifp = vty->index; |
| 5121 | struct in_addr addr; |
| 5122 | int ret; |
| 5123 | struct ospf_if_params *params; |
| 5124 | struct ospf_interface *oi; |
| 5125 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5126 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5127 | ifp = vty->index; |
| 5128 | params = IF_DEF_PARAMS (ifp); |
| 5129 | |
| 5130 | if (argc == 1) |
| 5131 | { |
| 5132 | ret = inet_aton(argv[0], &addr); |
| 5133 | if (!ret) |
| 5134 | { |
| 5135 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5136 | VTY_NEWLINE); |
| 5137 | return CMD_WARNING; |
| 5138 | } |
| 5139 | |
| 5140 | params = ospf_lookup_if_params (ifp, addr); |
| 5141 | if (params == NULL) |
| 5142 | return CMD_SUCCESS; |
| 5143 | } |
| 5144 | |
| 5145 | UNSET_IF_PARAM (params, v_wait); |
| 5146 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5147 | |
| 5148 | UNSET_IF_PARAM (params, fast_hello); |
| 5149 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 5150 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5151 | if (params != IF_DEF_PARAMS (ifp)) |
| 5152 | { |
| 5153 | ospf_free_if_params (ifp, addr); |
| 5154 | ospf_if_update_params (ifp, addr); |
| 5155 | } |
| 5156 | |
| 5157 | /* Update timer values in neighbor structure. */ |
| 5158 | if (argc == 1) |
| 5159 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 5160 | struct ospf *ospf; |
| 5161 | |
| 5162 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5163 | { |
| 5164 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 5165 | if (oi) |
| 5166 | ospf_nbr_timer_update (oi); |
| 5167 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5168 | } |
| 5169 | else |
| 5170 | { |
| 5171 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5172 | if ((oi = rn->info)) |
| 5173 | ospf_nbr_timer_update (oi); |
| 5174 | } |
| 5175 | |
| 5176 | return CMD_SUCCESS; |
| 5177 | } |
| 5178 | |
| 5179 | ALIAS (no_ip_ospf_dead_interval, |
| 5180 | no_ip_ospf_dead_interval_cmd, |
| 5181 | "no ip ospf dead-interval", |
| 5182 | NO_STR |
| 5183 | "IP Information\n" |
| 5184 | "OSPF interface commands\n" |
| 5185 | "Interval after which a neighbor is declared dead\n") |
| 5186 | |
| 5187 | ALIAS (no_ip_ospf_dead_interval, |
| 5188 | no_ospf_dead_interval_cmd, |
| 5189 | "no ospf dead-interval", |
| 5190 | NO_STR |
| 5191 | "OSPF interface commands\n" |
| 5192 | "Interval after which a neighbor is declared dead\n") |
| 5193 | |
| 5194 | DEFUN (ip_ospf_hello_interval, |
| 5195 | ip_ospf_hello_interval_addr_cmd, |
| 5196 | "ip ospf hello-interval <1-65535> A.B.C.D", |
| 5197 | "IP Information\n" |
| 5198 | "OSPF interface commands\n" |
| 5199 | "Time between HELLO packets\n" |
| 5200 | "Seconds\n" |
| 5201 | "Address of interface") |
| 5202 | { |
| 5203 | struct interface *ifp = vty->index; |
| 5204 | u_int32_t seconds; |
| 5205 | struct in_addr addr; |
| 5206 | int ret; |
| 5207 | struct ospf_if_params *params; |
| 5208 | |
| 5209 | params = IF_DEF_PARAMS (ifp); |
| 5210 | |
| 5211 | seconds = strtol (argv[0], NULL, 10); |
| 5212 | |
| 5213 | /* HelloInterval range is <1-65535>. */ |
| 5214 | if (seconds < 1 || seconds > 65535) |
| 5215 | { |
| 5216 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); |
| 5217 | return CMD_WARNING; |
| 5218 | } |
| 5219 | |
| 5220 | if (argc == 2) |
| 5221 | { |
| 5222 | ret = inet_aton(argv[1], &addr); |
| 5223 | if (!ret) |
| 5224 | { |
| 5225 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5226 | VTY_NEWLINE); |
| 5227 | return CMD_WARNING; |
| 5228 | } |
| 5229 | |
| 5230 | params = ospf_get_if_params (ifp, addr); |
| 5231 | ospf_if_update_params (ifp, addr); |
| 5232 | } |
| 5233 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5234 | SET_IF_PARAM (params, v_hello); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5235 | params->v_hello = seconds; |
| 5236 | |
| 5237 | return CMD_SUCCESS; |
| 5238 | } |
| 5239 | |
| 5240 | ALIAS (ip_ospf_hello_interval, |
| 5241 | ip_ospf_hello_interval_cmd, |
| 5242 | "ip ospf hello-interval <1-65535>", |
| 5243 | "IP Information\n" |
| 5244 | "OSPF interface commands\n" |
| 5245 | "Time between HELLO packets\n" |
| 5246 | "Seconds\n") |
| 5247 | |
| 5248 | ALIAS (ip_ospf_hello_interval, |
| 5249 | ospf_hello_interval_cmd, |
| 5250 | "ospf hello-interval <1-65535>", |
| 5251 | "OSPF interface commands\n" |
| 5252 | "Time between HELLO packets\n" |
| 5253 | "Seconds\n") |
| 5254 | |
| 5255 | DEFUN (no_ip_ospf_hello_interval, |
| 5256 | no_ip_ospf_hello_interval_addr_cmd, |
| 5257 | "no ip ospf hello-interval A.B.C.D", |
| 5258 | NO_STR |
| 5259 | "IP Information\n" |
| 5260 | "OSPF interface commands\n" |
| 5261 | "Time between HELLO packets\n" |
| 5262 | "Address of interface") |
| 5263 | { |
| 5264 | struct interface *ifp = vty->index; |
| 5265 | struct in_addr addr; |
| 5266 | int ret; |
| 5267 | struct ospf_if_params *params; |
| 5268 | |
| 5269 | ifp = vty->index; |
| 5270 | params = IF_DEF_PARAMS (ifp); |
| 5271 | |
| 5272 | if (argc == 1) |
| 5273 | { |
| 5274 | ret = inet_aton(argv[0], &addr); |
| 5275 | if (!ret) |
| 5276 | { |
| 5277 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5278 | VTY_NEWLINE); |
| 5279 | return CMD_WARNING; |
| 5280 | } |
| 5281 | |
| 5282 | params = ospf_lookup_if_params (ifp, addr); |
| 5283 | if (params == NULL) |
| 5284 | return CMD_SUCCESS; |
| 5285 | } |
| 5286 | |
| 5287 | UNSET_IF_PARAM (params, v_hello); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5288 | params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5289 | |
| 5290 | if (params != IF_DEF_PARAMS (ifp)) |
| 5291 | { |
| 5292 | ospf_free_if_params (ifp, addr); |
| 5293 | ospf_if_update_params (ifp, addr); |
| 5294 | } |
| 5295 | |
| 5296 | return CMD_SUCCESS; |
| 5297 | } |
| 5298 | |
| 5299 | ALIAS (no_ip_ospf_hello_interval, |
| 5300 | no_ip_ospf_hello_interval_cmd, |
| 5301 | "no ip ospf hello-interval", |
| 5302 | NO_STR |
| 5303 | "IP Information\n" |
| 5304 | "OSPF interface commands\n" |
| 5305 | "Time between HELLO packets\n") |
| 5306 | |
| 5307 | ALIAS (no_ip_ospf_hello_interval, |
| 5308 | no_ospf_hello_interval_cmd, |
| 5309 | "no ospf hello-interval", |
| 5310 | NO_STR |
| 5311 | "OSPF interface commands\n" |
| 5312 | "Time between HELLO packets\n") |
| 5313 | |
| 5314 | DEFUN (ip_ospf_network, |
| 5315 | ip_ospf_network_cmd, |
| 5316 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5317 | "IP Information\n" |
| 5318 | "OSPF interface commands\n" |
| 5319 | "Network type\n" |
| 5320 | "Specify OSPF broadcast multi-access network\n" |
| 5321 | "Specify OSPF NBMA network\n" |
| 5322 | "Specify OSPF point-to-multipoint network\n" |
| 5323 | "Specify OSPF point-to-point network\n") |
| 5324 | { |
| 5325 | struct interface *ifp = vty->index; |
| 5326 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5327 | struct route_node *rn; |
| 5328 | |
| 5329 | if (strncmp (argv[0], "b", 1) == 0) |
| 5330 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; |
| 5331 | else if (strncmp (argv[0], "n", 1) == 0) |
| 5332 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; |
| 5333 | else if (strncmp (argv[0], "point-to-m", 10) == 0) |
| 5334 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; |
| 5335 | else if (strncmp (argv[0], "point-to-p", 10) == 0) |
| 5336 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; |
| 5337 | |
| 5338 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5339 | return CMD_SUCCESS; |
| 5340 | |
| 5341 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); |
| 5342 | |
| 5343 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5344 | { |
| 5345 | struct ospf_interface *oi = rn->info; |
| 5346 | |
| 5347 | if (!oi) |
| 5348 | continue; |
| 5349 | |
| 5350 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5351 | |
| 5352 | if (oi->state > ISM_Down) |
| 5353 | { |
| 5354 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5355 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5356 | } |
| 5357 | } |
| 5358 | |
| 5359 | return CMD_SUCCESS; |
| 5360 | } |
| 5361 | |
| 5362 | ALIAS (ip_ospf_network, |
| 5363 | ospf_network_cmd, |
| 5364 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5365 | "OSPF interface commands\n" |
| 5366 | "Network type\n" |
| 5367 | "Specify OSPF broadcast multi-access network\n" |
| 5368 | "Specify OSPF NBMA network\n" |
| 5369 | "Specify OSPF point-to-multipoint network\n" |
| 5370 | "Specify OSPF point-to-point network\n") |
| 5371 | |
| 5372 | DEFUN (no_ip_ospf_network, |
| 5373 | no_ip_ospf_network_cmd, |
| 5374 | "no ip ospf network", |
| 5375 | NO_STR |
| 5376 | "IP Information\n" |
| 5377 | "OSPF interface commands\n" |
| 5378 | "Network type\n") |
| 5379 | { |
| 5380 | struct interface *ifp = vty->index; |
| 5381 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5382 | struct route_node *rn; |
| 5383 | |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 5384 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5385 | |
| 5386 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5387 | return CMD_SUCCESS; |
| 5388 | |
| 5389 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5390 | { |
| 5391 | struct ospf_interface *oi = rn->info; |
| 5392 | |
| 5393 | if (!oi) |
| 5394 | continue; |
| 5395 | |
| 5396 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5397 | |
| 5398 | if (oi->state > ISM_Down) |
| 5399 | { |
| 5400 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5401 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5402 | } |
| 5403 | } |
| 5404 | |
| 5405 | return CMD_SUCCESS; |
| 5406 | } |
| 5407 | |
| 5408 | ALIAS (no_ip_ospf_network, |
| 5409 | no_ospf_network_cmd, |
| 5410 | "no ospf network", |
| 5411 | NO_STR |
| 5412 | "OSPF interface commands\n" |
| 5413 | "Network type\n") |
| 5414 | |
| 5415 | DEFUN (ip_ospf_priority, |
| 5416 | ip_ospf_priority_addr_cmd, |
| 5417 | "ip ospf priority <0-255> A.B.C.D", |
| 5418 | "IP Information\n" |
| 5419 | "OSPF interface commands\n" |
| 5420 | "Router priority\n" |
| 5421 | "Priority\n" |
| 5422 | "Address of interface") |
| 5423 | { |
| 5424 | struct interface *ifp = vty->index; |
| 5425 | u_int32_t priority; |
| 5426 | struct route_node *rn; |
| 5427 | struct in_addr addr; |
| 5428 | int ret; |
| 5429 | struct ospf_if_params *params; |
| 5430 | |
| 5431 | params = IF_DEF_PARAMS (ifp); |
| 5432 | |
| 5433 | priority = strtol (argv[0], NULL, 10); |
| 5434 | |
| 5435 | /* Router Priority range is <0-255>. */ |
| 5436 | if (priority < 0 || priority > 255) |
| 5437 | { |
| 5438 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); |
| 5439 | return CMD_WARNING; |
| 5440 | } |
| 5441 | |
| 5442 | if (argc == 2) |
| 5443 | { |
| 5444 | ret = inet_aton(argv[1], &addr); |
| 5445 | if (!ret) |
| 5446 | { |
| 5447 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5448 | VTY_NEWLINE); |
| 5449 | return CMD_WARNING; |
| 5450 | } |
| 5451 | |
| 5452 | params = ospf_get_if_params (ifp, addr); |
| 5453 | ospf_if_update_params (ifp, addr); |
| 5454 | } |
| 5455 | |
| 5456 | SET_IF_PARAM (params, priority); |
| 5457 | params->priority = priority; |
| 5458 | |
| 5459 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5460 | { |
| 5461 | struct ospf_interface *oi = rn->info; |
| 5462 | |
| 5463 | if (!oi) |
| 5464 | continue; |
| 5465 | |
| 5466 | |
| 5467 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5468 | { |
| 5469 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5470 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5471 | } |
| 5472 | } |
| 5473 | |
| 5474 | return CMD_SUCCESS; |
| 5475 | } |
| 5476 | |
| 5477 | ALIAS (ip_ospf_priority, |
| 5478 | ip_ospf_priority_cmd, |
| 5479 | "ip ospf priority <0-255>", |
| 5480 | "IP Information\n" |
| 5481 | "OSPF interface commands\n" |
| 5482 | "Router priority\n" |
| 5483 | "Priority\n") |
| 5484 | |
| 5485 | ALIAS (ip_ospf_priority, |
| 5486 | ospf_priority_cmd, |
| 5487 | "ospf priority <0-255>", |
| 5488 | "OSPF interface commands\n" |
| 5489 | "Router priority\n" |
| 5490 | "Priority\n") |
| 5491 | |
| 5492 | DEFUN (no_ip_ospf_priority, |
| 5493 | no_ip_ospf_priority_addr_cmd, |
| 5494 | "no ip ospf priority A.B.C.D", |
| 5495 | NO_STR |
| 5496 | "IP Information\n" |
| 5497 | "OSPF interface commands\n" |
| 5498 | "Router priority\n" |
| 5499 | "Address of interface") |
| 5500 | { |
| 5501 | struct interface *ifp = vty->index; |
| 5502 | struct route_node *rn; |
| 5503 | struct in_addr addr; |
| 5504 | int ret; |
| 5505 | struct ospf_if_params *params; |
| 5506 | |
| 5507 | ifp = vty->index; |
| 5508 | params = IF_DEF_PARAMS (ifp); |
| 5509 | |
| 5510 | if (argc == 1) |
| 5511 | { |
| 5512 | ret = inet_aton(argv[0], &addr); |
| 5513 | if (!ret) |
| 5514 | { |
| 5515 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5516 | VTY_NEWLINE); |
| 5517 | return CMD_WARNING; |
| 5518 | } |
| 5519 | |
| 5520 | params = ospf_lookup_if_params (ifp, addr); |
| 5521 | if (params == NULL) |
| 5522 | return CMD_SUCCESS; |
| 5523 | } |
| 5524 | |
| 5525 | UNSET_IF_PARAM (params, priority); |
| 5526 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; |
| 5527 | |
| 5528 | if (params != IF_DEF_PARAMS (ifp)) |
| 5529 | { |
| 5530 | ospf_free_if_params (ifp, addr); |
| 5531 | ospf_if_update_params (ifp, addr); |
| 5532 | } |
| 5533 | |
| 5534 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5535 | { |
| 5536 | struct ospf_interface *oi = rn->info; |
| 5537 | |
| 5538 | if (!oi) |
| 5539 | continue; |
| 5540 | |
| 5541 | |
| 5542 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5543 | { |
| 5544 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5545 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5546 | } |
| 5547 | } |
| 5548 | |
| 5549 | return CMD_SUCCESS; |
| 5550 | } |
| 5551 | |
| 5552 | ALIAS (no_ip_ospf_priority, |
| 5553 | no_ip_ospf_priority_cmd, |
| 5554 | "no ip ospf priority", |
| 5555 | NO_STR |
| 5556 | "IP Information\n" |
| 5557 | "OSPF interface commands\n" |
| 5558 | "Router priority\n") |
| 5559 | |
| 5560 | ALIAS (no_ip_ospf_priority, |
| 5561 | no_ospf_priority_cmd, |
| 5562 | "no ospf priority", |
| 5563 | NO_STR |
| 5564 | "OSPF interface commands\n" |
| 5565 | "Router priority\n") |
| 5566 | |
| 5567 | DEFUN (ip_ospf_retransmit_interval, |
| 5568 | ip_ospf_retransmit_interval_addr_cmd, |
| 5569 | "ip ospf retransmit-interval <3-65535> A.B.C.D", |
| 5570 | "IP Information\n" |
| 5571 | "OSPF interface commands\n" |
| 5572 | "Time between retransmitting lost link state advertisements\n" |
| 5573 | "Seconds\n" |
| 5574 | "Address of interface") |
| 5575 | { |
| 5576 | struct interface *ifp = vty->index; |
| 5577 | u_int32_t seconds; |
| 5578 | struct in_addr addr; |
| 5579 | int ret; |
| 5580 | struct ospf_if_params *params; |
| 5581 | |
| 5582 | params = IF_DEF_PARAMS (ifp); |
| 5583 | seconds = strtol (argv[0], NULL, 10); |
| 5584 | |
| 5585 | /* Retransmit Interval range is <3-65535>. */ |
| 5586 | if (seconds < 3 || seconds > 65535) |
| 5587 | { |
| 5588 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); |
| 5589 | return CMD_WARNING; |
| 5590 | } |
| 5591 | |
| 5592 | |
| 5593 | if (argc == 2) |
| 5594 | { |
| 5595 | ret = inet_aton(argv[1], &addr); |
| 5596 | if (!ret) |
| 5597 | { |
| 5598 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5599 | VTY_NEWLINE); |
| 5600 | return CMD_WARNING; |
| 5601 | } |
| 5602 | |
| 5603 | params = ospf_get_if_params (ifp, addr); |
| 5604 | ospf_if_update_params (ifp, addr); |
| 5605 | } |
| 5606 | |
| 5607 | SET_IF_PARAM (params, retransmit_interval); |
| 5608 | params->retransmit_interval = seconds; |
| 5609 | |
| 5610 | return CMD_SUCCESS; |
| 5611 | } |
| 5612 | |
| 5613 | ALIAS (ip_ospf_retransmit_interval, |
| 5614 | ip_ospf_retransmit_interval_cmd, |
| 5615 | "ip ospf retransmit-interval <3-65535>", |
| 5616 | "IP Information\n" |
| 5617 | "OSPF interface commands\n" |
| 5618 | "Time between retransmitting lost link state advertisements\n" |
| 5619 | "Seconds\n") |
| 5620 | |
| 5621 | ALIAS (ip_ospf_retransmit_interval, |
| 5622 | ospf_retransmit_interval_cmd, |
| 5623 | "ospf retransmit-interval <3-65535>", |
| 5624 | "OSPF interface commands\n" |
| 5625 | "Time between retransmitting lost link state advertisements\n" |
| 5626 | "Seconds\n") |
| 5627 | |
| 5628 | DEFUN (no_ip_ospf_retransmit_interval, |
| 5629 | no_ip_ospf_retransmit_interval_addr_cmd, |
| 5630 | "no ip ospf retransmit-interval A.B.C.D", |
| 5631 | NO_STR |
| 5632 | "IP Information\n" |
| 5633 | "OSPF interface commands\n" |
| 5634 | "Time between retransmitting lost link state advertisements\n" |
| 5635 | "Address of interface") |
| 5636 | { |
| 5637 | struct interface *ifp = vty->index; |
| 5638 | struct in_addr addr; |
| 5639 | int ret; |
| 5640 | struct ospf_if_params *params; |
| 5641 | |
| 5642 | ifp = vty->index; |
| 5643 | params = IF_DEF_PARAMS (ifp); |
| 5644 | |
| 5645 | if (argc == 1) |
| 5646 | { |
| 5647 | ret = inet_aton(argv[0], &addr); |
| 5648 | if (!ret) |
| 5649 | { |
| 5650 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5651 | VTY_NEWLINE); |
| 5652 | return CMD_WARNING; |
| 5653 | } |
| 5654 | |
| 5655 | params = ospf_lookup_if_params (ifp, addr); |
| 5656 | if (params == NULL) |
| 5657 | return CMD_SUCCESS; |
| 5658 | } |
| 5659 | |
| 5660 | UNSET_IF_PARAM (params, retransmit_interval); |
| 5661 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 5662 | |
| 5663 | if (params != IF_DEF_PARAMS (ifp)) |
| 5664 | { |
| 5665 | ospf_free_if_params (ifp, addr); |
| 5666 | ospf_if_update_params (ifp, addr); |
| 5667 | } |
| 5668 | |
| 5669 | return CMD_SUCCESS; |
| 5670 | } |
| 5671 | |
| 5672 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5673 | no_ip_ospf_retransmit_interval_cmd, |
| 5674 | "no ip ospf retransmit-interval", |
| 5675 | NO_STR |
| 5676 | "IP Information\n" |
| 5677 | "OSPF interface commands\n" |
| 5678 | "Time between retransmitting lost link state advertisements\n") |
| 5679 | |
| 5680 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5681 | no_ospf_retransmit_interval_cmd, |
| 5682 | "no ospf retransmit-interval", |
| 5683 | NO_STR |
| 5684 | "OSPF interface commands\n" |
| 5685 | "Time between retransmitting lost link state advertisements\n") |
| 5686 | |
| 5687 | DEFUN (ip_ospf_transmit_delay, |
| 5688 | ip_ospf_transmit_delay_addr_cmd, |
| 5689 | "ip ospf transmit-delay <1-65535> A.B.C.D", |
| 5690 | "IP Information\n" |
| 5691 | "OSPF interface commands\n" |
| 5692 | "Link state transmit delay\n" |
| 5693 | "Seconds\n" |
| 5694 | "Address of interface") |
| 5695 | { |
| 5696 | struct interface *ifp = vty->index; |
| 5697 | u_int32_t seconds; |
| 5698 | struct in_addr addr; |
| 5699 | int ret; |
| 5700 | struct ospf_if_params *params; |
| 5701 | |
| 5702 | params = IF_DEF_PARAMS (ifp); |
| 5703 | seconds = strtol (argv[0], NULL, 10); |
| 5704 | |
| 5705 | /* Transmit Delay range is <1-65535>. */ |
| 5706 | if (seconds < 1 || seconds > 65535) |
| 5707 | { |
| 5708 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); |
| 5709 | return CMD_WARNING; |
| 5710 | } |
| 5711 | |
| 5712 | if (argc == 2) |
| 5713 | { |
| 5714 | ret = inet_aton(argv[1], &addr); |
| 5715 | if (!ret) |
| 5716 | { |
| 5717 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5718 | VTY_NEWLINE); |
| 5719 | return CMD_WARNING; |
| 5720 | } |
| 5721 | |
| 5722 | params = ospf_get_if_params (ifp, addr); |
| 5723 | ospf_if_update_params (ifp, addr); |
| 5724 | } |
| 5725 | |
| 5726 | SET_IF_PARAM (params, transmit_delay); |
| 5727 | params->transmit_delay = seconds; |
| 5728 | |
| 5729 | return CMD_SUCCESS; |
| 5730 | } |
| 5731 | |
| 5732 | ALIAS (ip_ospf_transmit_delay, |
| 5733 | ip_ospf_transmit_delay_cmd, |
| 5734 | "ip ospf transmit-delay <1-65535>", |
| 5735 | "IP Information\n" |
| 5736 | "OSPF interface commands\n" |
| 5737 | "Link state transmit delay\n" |
| 5738 | "Seconds\n") |
| 5739 | |
| 5740 | ALIAS (ip_ospf_transmit_delay, |
| 5741 | ospf_transmit_delay_cmd, |
| 5742 | "ospf transmit-delay <1-65535>", |
| 5743 | "OSPF interface commands\n" |
| 5744 | "Link state transmit delay\n" |
| 5745 | "Seconds\n") |
| 5746 | |
| 5747 | DEFUN (no_ip_ospf_transmit_delay, |
| 5748 | no_ip_ospf_transmit_delay_addr_cmd, |
| 5749 | "no ip ospf transmit-delay A.B.C.D", |
| 5750 | NO_STR |
| 5751 | "IP Information\n" |
| 5752 | "OSPF interface commands\n" |
| 5753 | "Link state transmit delay\n" |
| 5754 | "Address of interface") |
| 5755 | { |
| 5756 | struct interface *ifp = vty->index; |
| 5757 | struct in_addr addr; |
| 5758 | int ret; |
| 5759 | struct ospf_if_params *params; |
| 5760 | |
| 5761 | ifp = vty->index; |
| 5762 | params = IF_DEF_PARAMS (ifp); |
| 5763 | |
| 5764 | if (argc == 1) |
| 5765 | { |
| 5766 | ret = inet_aton(argv[0], &addr); |
| 5767 | if (!ret) |
| 5768 | { |
| 5769 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5770 | VTY_NEWLINE); |
| 5771 | return CMD_WARNING; |
| 5772 | } |
| 5773 | |
| 5774 | params = ospf_lookup_if_params (ifp, addr); |
| 5775 | if (params == NULL) |
| 5776 | return CMD_SUCCESS; |
| 5777 | } |
| 5778 | |
| 5779 | UNSET_IF_PARAM (params, transmit_delay); |
| 5780 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 5781 | |
| 5782 | if (params != IF_DEF_PARAMS (ifp)) |
| 5783 | { |
| 5784 | ospf_free_if_params (ifp, addr); |
| 5785 | ospf_if_update_params (ifp, addr); |
| 5786 | } |
| 5787 | |
| 5788 | return CMD_SUCCESS; |
| 5789 | } |
| 5790 | |
| 5791 | ALIAS (no_ip_ospf_transmit_delay, |
| 5792 | no_ip_ospf_transmit_delay_cmd, |
| 5793 | "no ip ospf transmit-delay", |
| 5794 | NO_STR |
| 5795 | "IP Information\n" |
| 5796 | "OSPF interface commands\n" |
| 5797 | "Link state transmit delay\n") |
| 5798 | |
| 5799 | ALIAS (no_ip_ospf_transmit_delay, |
| 5800 | no_ospf_transmit_delay_cmd, |
| 5801 | "no ospf transmit-delay", |
| 5802 | NO_STR |
| 5803 | "OSPF interface commands\n" |
| 5804 | "Link state transmit delay\n") |
| 5805 | |
| 5806 | |
| 5807 | DEFUN (ospf_redistribute_source_metric_type, |
| 5808 | ospf_redistribute_source_metric_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5809 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5810 | " metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5811 | REDIST_STR |
| 5812 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5813 | "Metric for redistributed routes\n" |
| 5814 | "OSPF default metric\n" |
| 5815 | "OSPF exterior metric type for redistributed routes\n" |
| 5816 | "Set OSPF External Type 1 metrics\n" |
| 5817 | "Set OSPF External Type 2 metrics\n" |
| 5818 | "Route map reference\n" |
| 5819 | "Pointer to route-map entries\n") |
| 5820 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5821 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5822 | int source; |
| 5823 | int type = -1; |
| 5824 | int metric = -1; |
| 5825 | |
| 5826 | /* Get distribute source. */ |
| 5827 | if (!str2distribute_source (argv[0], &source)) |
| 5828 | return CMD_WARNING; |
| 5829 | |
| 5830 | /* Get metric value. */ |
| 5831 | if (argc >= 2) |
| 5832 | if (!str2metric (argv[1], &metric)) |
| 5833 | return CMD_WARNING; |
| 5834 | |
| 5835 | /* Get metric type. */ |
| 5836 | if (argc >= 3) |
| 5837 | if (!str2metric_type (argv[2], &type)) |
| 5838 | return CMD_WARNING; |
| 5839 | |
| 5840 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5841 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5842 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5843 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5844 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5845 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5846 | } |
| 5847 | |
| 5848 | ALIAS (ospf_redistribute_source_metric_type, |
| 5849 | ospf_redistribute_source_metric_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5850 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5851 | " metric <0-16777214> metric-type (1|2)", |
| 5852 | REDIST_STR |
| 5853 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5854 | "Metric for redistributed routes\n" |
| 5855 | "OSPF default metric\n" |
| 5856 | "OSPF exterior metric type for redistributed routes\n" |
| 5857 | "Set OSPF External Type 1 metrics\n" |
| 5858 | "Set OSPF External Type 2 metrics\n") |
| 5859 | |
| 5860 | ALIAS (ospf_redistribute_source_metric_type, |
| 5861 | ospf_redistribute_source_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5862 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric <0-16777214>", |
| 5863 | REDIST_STR |
| 5864 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5865 | "Metric for redistributed routes\n" |
| 5866 | "OSPF default metric\n") |
| 5867 | |
| 5868 | DEFUN (ospf_redistribute_source_type_metric, |
| 5869 | ospf_redistribute_source_type_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5870 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5871 | " metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5872 | REDIST_STR |
| 5873 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5874 | "OSPF exterior metric type for redistributed routes\n" |
| 5875 | "Set OSPF External Type 1 metrics\n" |
| 5876 | "Set OSPF External Type 2 metrics\n" |
| 5877 | "Metric for redistributed routes\n" |
| 5878 | "OSPF default metric\n" |
| 5879 | "Route map reference\n" |
| 5880 | "Pointer to route-map entries\n") |
| 5881 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5882 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5883 | int source; |
| 5884 | int type = -1; |
| 5885 | int metric = -1; |
| 5886 | |
| 5887 | /* Get distribute source. */ |
| 5888 | if (!str2distribute_source (argv[0], &source)) |
| 5889 | return CMD_WARNING; |
| 5890 | |
| 5891 | /* Get metric value. */ |
| 5892 | if (argc >= 2) |
| 5893 | if (!str2metric_type (argv[1], &type)) |
| 5894 | return CMD_WARNING; |
| 5895 | |
| 5896 | /* Get metric type. */ |
| 5897 | if (argc >= 3) |
| 5898 | if (!str2metric (argv[2], &metric)) |
| 5899 | return CMD_WARNING; |
| 5900 | |
| 5901 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5902 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5903 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5904 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5905 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5906 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5907 | } |
| 5908 | |
| 5909 | ALIAS (ospf_redistribute_source_type_metric, |
| 5910 | ospf_redistribute_source_type_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5911 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5912 | " metric-type (1|2) metric <0-16777214>", |
| 5913 | REDIST_STR |
| 5914 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5915 | "OSPF exterior metric type for redistributed routes\n" |
| 5916 | "Set OSPF External Type 1 metrics\n" |
| 5917 | "Set OSPF External Type 2 metrics\n" |
| 5918 | "Metric for redistributed routes\n" |
| 5919 | "OSPF default metric\n") |
| 5920 | |
| 5921 | ALIAS (ospf_redistribute_source_type_metric, |
| 5922 | ospf_redistribute_source_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5923 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric-type (1|2)", |
| 5924 | REDIST_STR |
| 5925 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5926 | "OSPF exterior metric type for redistributed routes\n" |
| 5927 | "Set OSPF External Type 1 metrics\n" |
| 5928 | "Set OSPF External Type 2 metrics\n") |
| 5929 | |
| 5930 | ALIAS (ospf_redistribute_source_type_metric, |
| 5931 | ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5932 | "redistribute " QUAGGA_REDIST_STR_OSPFD, |
| 5933 | REDIST_STR |
| 5934 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5935 | |
| 5936 | DEFUN (ospf_redistribute_source_metric_routemap, |
| 5937 | ospf_redistribute_source_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5938 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5939 | " metric <0-16777214> route-map WORD", |
| 5940 | REDIST_STR |
| 5941 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5942 | "Metric for redistributed routes\n" |
| 5943 | "OSPF default metric\n" |
| 5944 | "Route map reference\n" |
| 5945 | "Pointer to route-map entries\n") |
| 5946 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5947 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5948 | int source; |
| 5949 | int metric = -1; |
| 5950 | |
| 5951 | /* Get distribute source. */ |
| 5952 | if (!str2distribute_source (argv[0], &source)) |
| 5953 | return CMD_WARNING; |
| 5954 | |
| 5955 | /* Get metric value. */ |
| 5956 | if (argc >= 2) |
| 5957 | if (!str2metric (argv[1], &metric)) |
| 5958 | return CMD_WARNING; |
| 5959 | |
| 5960 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5961 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5962 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5963 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5964 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5965 | return ospf_redistribute_set (ospf, source, -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5966 | } |
| 5967 | |
| 5968 | DEFUN (ospf_redistribute_source_type_routemap, |
| 5969 | ospf_redistribute_source_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5970 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5971 | " metric-type (1|2) route-map WORD", |
| 5972 | REDIST_STR |
| 5973 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5974 | "OSPF exterior metric type for redistributed routes\n" |
| 5975 | "Set OSPF External Type 1 metrics\n" |
| 5976 | "Set OSPF External Type 2 metrics\n" |
| 5977 | "Route map reference\n" |
| 5978 | "Pointer to route-map entries\n") |
| 5979 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5980 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5981 | int source; |
| 5982 | int type = -1; |
| 5983 | |
| 5984 | /* Get distribute source. */ |
| 5985 | if (!str2distribute_source (argv[0], &source)) |
| 5986 | return CMD_WARNING; |
| 5987 | |
| 5988 | /* Get metric value. */ |
| 5989 | if (argc >= 2) |
| 5990 | if (!str2metric_type (argv[1], &type)) |
| 5991 | return CMD_WARNING; |
| 5992 | |
| 5993 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5994 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5995 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5996 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5997 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5998 | return ospf_redistribute_set (ospf, source, type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5999 | } |
| 6000 | |
| 6001 | DEFUN (ospf_redistribute_source_routemap, |
| 6002 | ospf_redistribute_source_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6003 | "redistribute " QUAGGA_REDIST_STR_OSPFD " route-map WORD", |
| 6004 | REDIST_STR |
| 6005 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6006 | "Route map reference\n" |
| 6007 | "Pointer to route-map entries\n") |
| 6008 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6009 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6010 | int source; |
| 6011 | |
| 6012 | /* Get distribute source. */ |
| 6013 | if (!str2distribute_source (argv[0], &source)) |
| 6014 | return CMD_WARNING; |
| 6015 | |
| 6016 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6017 | ospf_routemap_set (ospf, source, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6018 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6019 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6020 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6021 | return ospf_redistribute_set (ospf, source, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6022 | } |
| 6023 | |
| 6024 | DEFUN (no_ospf_redistribute_source, |
| 6025 | no_ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6026 | "no redistribute " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6027 | NO_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6028 | REDIST_STR |
| 6029 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 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 source; |
| 6033 | |
| 6034 | if (!str2distribute_source (argv[0], &source)) |
| 6035 | return CMD_WARNING; |
| 6036 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6037 | ospf_routemap_unset (ospf, source); |
| 6038 | return ospf_redistribute_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6039 | } |
| 6040 | |
| 6041 | DEFUN (ospf_distribute_list_out, |
| 6042 | ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6043 | "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6044 | "Filter networks in routing updates\n" |
| 6045 | "Access-list name\n" |
| 6046 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6047 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6048 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6049 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6050 | int source; |
| 6051 | |
| 6052 | /* Get distribute source. */ |
| 6053 | if (!str2distribute_source (argv[1], &source)) |
| 6054 | return CMD_WARNING; |
| 6055 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6056 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6057 | } |
| 6058 | |
| 6059 | DEFUN (no_ospf_distribute_list_out, |
| 6060 | no_ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6061 | "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6062 | NO_STR |
| 6063 | "Filter networks in routing updates\n" |
| 6064 | "Access-list name\n" |
| 6065 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6066 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6067 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6068 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6069 | int source; |
| 6070 | |
| 6071 | if (!str2distribute_source (argv[1], &source)) |
| 6072 | return CMD_WARNING; |
| 6073 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6074 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6075 | } |
| 6076 | |
| 6077 | /* Default information originate. */ |
| 6078 | DEFUN (ospf_default_information_originate_metric_type_routemap, |
| 6079 | ospf_default_information_originate_metric_type_routemap_cmd, |
| 6080 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6081 | "Control distribution of default information\n" |
| 6082 | "Distribute a default route\n" |
| 6083 | "OSPF default metric\n" |
| 6084 | "OSPF metric\n" |
| 6085 | "OSPF metric type for default routes\n" |
| 6086 | "Set OSPF External Type 1 metrics\n" |
| 6087 | "Set OSPF External Type 2 metrics\n" |
| 6088 | "Route map reference\n" |
| 6089 | "Pointer to route-map entries\n") |
| 6090 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6091 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6092 | int type = -1; |
| 6093 | int metric = -1; |
| 6094 | |
| 6095 | /* Get metric value. */ |
| 6096 | if (argc >= 1) |
| 6097 | if (!str2metric (argv[0], &metric)) |
| 6098 | return CMD_WARNING; |
| 6099 | |
| 6100 | /* Get metric type. */ |
| 6101 | if (argc >= 2) |
| 6102 | if (!str2metric_type (argv[1], &type)) |
| 6103 | return CMD_WARNING; |
| 6104 | |
| 6105 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6106 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6107 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6108 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6109 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6110 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6111 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6112 | } |
| 6113 | |
| 6114 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6115 | ospf_default_information_originate_metric_type_cmd, |
| 6116 | "default-information originate metric <0-16777214> metric-type (1|2)", |
| 6117 | "Control distribution of default information\n" |
| 6118 | "Distribute a default route\n" |
| 6119 | "OSPF default metric\n" |
| 6120 | "OSPF metric\n" |
| 6121 | "OSPF metric type for default routes\n" |
| 6122 | "Set OSPF External Type 1 metrics\n" |
| 6123 | "Set OSPF External Type 2 metrics\n") |
| 6124 | |
| 6125 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6126 | ospf_default_information_originate_metric_cmd, |
| 6127 | "default-information originate metric <0-16777214>", |
| 6128 | "Control distribution of default information\n" |
| 6129 | "Distribute a default route\n" |
| 6130 | "OSPF default metric\n" |
| 6131 | "OSPF metric\n") |
| 6132 | |
| 6133 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6134 | ospf_default_information_originate_cmd, |
| 6135 | "default-information originate", |
| 6136 | "Control distribution of default information\n" |
| 6137 | "Distribute a default route\n") |
| 6138 | |
| 6139 | /* Default information originate. */ |
| 6140 | DEFUN (ospf_default_information_originate_metric_routemap, |
| 6141 | ospf_default_information_originate_metric_routemap_cmd, |
| 6142 | "default-information originate metric <0-16777214> route-map WORD", |
| 6143 | "Control distribution of default information\n" |
| 6144 | "Distribute a default route\n" |
| 6145 | "OSPF default metric\n" |
| 6146 | "OSPF metric\n" |
| 6147 | "Route map reference\n" |
| 6148 | "Pointer to route-map entries\n") |
| 6149 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6150 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6151 | int metric = -1; |
| 6152 | |
| 6153 | /* Get metric value. */ |
| 6154 | if (argc >= 1) |
| 6155 | if (!str2metric (argv[0], &metric)) |
| 6156 | return CMD_WARNING; |
| 6157 | |
| 6158 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6159 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6160 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6161 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6162 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6163 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6164 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6165 | } |
| 6166 | |
| 6167 | /* Default information originate. */ |
| 6168 | DEFUN (ospf_default_information_originate_routemap, |
| 6169 | ospf_default_information_originate_routemap_cmd, |
| 6170 | "default-information originate route-map WORD", |
| 6171 | "Control distribution of default information\n" |
| 6172 | "Distribute a default route\n" |
| 6173 | "Route map reference\n" |
| 6174 | "Pointer to route-map entries\n") |
| 6175 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6176 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6177 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6178 | if (argc == 1) |
| 6179 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6180 | else |
| 6181 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6182 | |
| 6183 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6184 | } |
| 6185 | |
| 6186 | DEFUN (ospf_default_information_originate_type_metric_routemap, |
| 6187 | ospf_default_information_originate_type_metric_routemap_cmd, |
| 6188 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6189 | "Control distribution of default information\n" |
| 6190 | "Distribute a default route\n" |
| 6191 | "OSPF metric type for default routes\n" |
| 6192 | "Set OSPF External Type 1 metrics\n" |
| 6193 | "Set OSPF External Type 2 metrics\n" |
| 6194 | "OSPF default metric\n" |
| 6195 | "OSPF metric\n" |
| 6196 | "Route map reference\n" |
| 6197 | "Pointer to route-map entries\n") |
| 6198 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6199 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6200 | int type = -1; |
| 6201 | int metric = -1; |
| 6202 | |
| 6203 | /* Get metric type. */ |
| 6204 | if (argc >= 1) |
| 6205 | if (!str2metric_type (argv[0], &type)) |
| 6206 | return CMD_WARNING; |
| 6207 | |
| 6208 | /* Get metric value. */ |
| 6209 | if (argc >= 2) |
| 6210 | if (!str2metric (argv[1], &metric)) |
| 6211 | return CMD_WARNING; |
| 6212 | |
| 6213 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6214 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6215 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6216 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6217 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6218 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6219 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6220 | } |
| 6221 | |
| 6222 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6223 | ospf_default_information_originate_type_metric_cmd, |
| 6224 | "default-information originate metric-type (1|2) metric <0-16777214>", |
| 6225 | "Control distribution of default information\n" |
| 6226 | "Distribute a default route\n" |
| 6227 | "OSPF metric type for default routes\n" |
| 6228 | "Set OSPF External Type 1 metrics\n" |
| 6229 | "Set OSPF External Type 2 metrics\n" |
| 6230 | "OSPF default metric\n" |
| 6231 | "OSPF metric\n") |
| 6232 | |
| 6233 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6234 | ospf_default_information_originate_type_cmd, |
| 6235 | "default-information originate metric-type (1|2)", |
| 6236 | "Control distribution of default information\n" |
| 6237 | "Distribute a default route\n" |
| 6238 | "OSPF metric type for default routes\n" |
| 6239 | "Set OSPF External Type 1 metrics\n" |
| 6240 | "Set OSPF External Type 2 metrics\n") |
| 6241 | |
| 6242 | DEFUN (ospf_default_information_originate_type_routemap, |
| 6243 | ospf_default_information_originate_type_routemap_cmd, |
| 6244 | "default-information originate metric-type (1|2) route-map WORD", |
| 6245 | "Control distribution of default information\n" |
| 6246 | "Distribute a default route\n" |
| 6247 | "OSPF metric type for default routes\n" |
| 6248 | "Set OSPF External Type 1 metrics\n" |
| 6249 | "Set OSPF External Type 2 metrics\n" |
| 6250 | "Route map reference\n" |
| 6251 | "Pointer to route-map entries\n") |
| 6252 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6253 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6254 | int type = -1; |
| 6255 | |
| 6256 | /* Get metric type. */ |
| 6257 | if (argc >= 1) |
| 6258 | if (!str2metric_type (argv[0], &type)) |
| 6259 | return CMD_WARNING; |
| 6260 | |
| 6261 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6262 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6263 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6264 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6265 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6266 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6267 | type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6268 | } |
| 6269 | |
| 6270 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, |
| 6271 | ospf_default_information_originate_always_metric_type_routemap_cmd, |
| 6272 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6273 | "Control distribution of default information\n" |
| 6274 | "Distribute a default route\n" |
| 6275 | "Always advertise default route\n" |
| 6276 | "OSPF default metric\n" |
| 6277 | "OSPF metric\n" |
| 6278 | "OSPF metric type for default routes\n" |
| 6279 | "Set OSPF External Type 1 metrics\n" |
| 6280 | "Set OSPF External Type 2 metrics\n" |
| 6281 | "Route map reference\n" |
| 6282 | "Pointer to route-map entries\n") |
| 6283 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6284 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6285 | int type = -1; |
| 6286 | int metric = -1; |
| 6287 | |
| 6288 | /* Get metric value. */ |
| 6289 | if (argc >= 1) |
| 6290 | if (!str2metric (argv[0], &metric)) |
| 6291 | return CMD_WARNING; |
| 6292 | |
| 6293 | /* Get metric type. */ |
| 6294 | if (argc >= 2) |
| 6295 | if (!str2metric_type (argv[1], &type)) |
| 6296 | return CMD_WARNING; |
| 6297 | |
| 6298 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6299 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6300 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6301 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6302 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6303 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6304 | type, metric); |
| 6305 | } |
| 6306 | |
| 6307 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6308 | ospf_default_information_originate_always_metric_type_cmd, |
| 6309 | "default-information originate always metric <0-16777214> metric-type (1|2)", |
| 6310 | "Control distribution of default information\n" |
| 6311 | "Distribute a default route\n" |
| 6312 | "Always advertise default route\n" |
| 6313 | "OSPF default metric\n" |
| 6314 | "OSPF metric\n" |
| 6315 | "OSPF metric type for default routes\n" |
| 6316 | "Set OSPF External Type 1 metrics\n" |
| 6317 | "Set OSPF External Type 2 metrics\n") |
| 6318 | |
| 6319 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6320 | ospf_default_information_originate_always_metric_cmd, |
| 6321 | "default-information originate always metric <0-16777214>", |
| 6322 | "Control distribution of default information\n" |
| 6323 | "Distribute a default route\n" |
| 6324 | "Always advertise default route\n" |
| 6325 | "OSPF default metric\n" |
| 6326 | "OSPF metric\n" |
| 6327 | "OSPF metric type for default routes\n") |
| 6328 | |
| 6329 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6330 | ospf_default_information_originate_always_cmd, |
| 6331 | "default-information originate always", |
| 6332 | "Control distribution of default information\n" |
| 6333 | "Distribute a default route\n" |
| 6334 | "Always advertise default route\n") |
| 6335 | |
| 6336 | DEFUN (ospf_default_information_originate_always_metric_routemap, |
| 6337 | ospf_default_information_originate_always_metric_routemap_cmd, |
| 6338 | "default-information originate always metric <0-16777214> route-map WORD", |
| 6339 | "Control distribution of default information\n" |
| 6340 | "Distribute a default route\n" |
| 6341 | "Always advertise default route\n" |
| 6342 | "OSPF default metric\n" |
| 6343 | "OSPF metric\n" |
| 6344 | "Route map reference\n" |
| 6345 | "Pointer to route-map entries\n") |
| 6346 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6347 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6348 | int metric = -1; |
| 6349 | |
| 6350 | /* Get metric value. */ |
| 6351 | if (argc >= 1) |
| 6352 | if (!str2metric (argv[0], &metric)) |
| 6353 | return CMD_WARNING; |
| 6354 | |
| 6355 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6356 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6357 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6358 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6359 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6360 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
| 6361 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6362 | } |
| 6363 | |
| 6364 | DEFUN (ospf_default_information_originate_always_routemap, |
| 6365 | ospf_default_information_originate_always_routemap_cmd, |
| 6366 | "default-information originate always route-map WORD", |
| 6367 | "Control distribution of default information\n" |
| 6368 | "Distribute a default route\n" |
| 6369 | "Always advertise default route\n" |
| 6370 | "Route map reference\n" |
| 6371 | "Pointer to route-map entries\n") |
| 6372 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6373 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6374 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6375 | if (argc == 1) |
| 6376 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6377 | else |
| 6378 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6379 | |
| 6380 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6381 | } |
| 6382 | |
| 6383 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, |
| 6384 | ospf_default_information_originate_always_type_metric_routemap_cmd, |
| 6385 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6386 | "Control distribution of default information\n" |
| 6387 | "Distribute a default route\n" |
| 6388 | "Always advertise default route\n" |
| 6389 | "OSPF metric type for default routes\n" |
| 6390 | "Set OSPF External Type 1 metrics\n" |
| 6391 | "Set OSPF External Type 2 metrics\n" |
| 6392 | "OSPF default metric\n" |
| 6393 | "OSPF metric\n" |
| 6394 | "Route map reference\n" |
| 6395 | "Pointer to route-map entries\n") |
| 6396 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6397 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6398 | int type = -1; |
| 6399 | int metric = -1; |
| 6400 | |
| 6401 | /* Get metric type. */ |
| 6402 | if (argc >= 1) |
| 6403 | if (!str2metric_type (argv[0], &type)) |
| 6404 | return CMD_WARNING; |
| 6405 | |
| 6406 | /* Get metric value. */ |
| 6407 | if (argc >= 2) |
| 6408 | if (!str2metric (argv[1], &metric)) |
| 6409 | return CMD_WARNING; |
| 6410 | |
| 6411 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6412 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6413 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6414 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6415 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6416 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6417 | type, metric); |
| 6418 | } |
| 6419 | |
| 6420 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6421 | ospf_default_information_originate_always_type_metric_cmd, |
| 6422 | "default-information originate always metric-type (1|2) metric <0-16777214>", |
| 6423 | "Control distribution of default information\n" |
| 6424 | "Distribute a default route\n" |
| 6425 | "Always advertise default route\n" |
| 6426 | "OSPF metric type for default routes\n" |
| 6427 | "Set OSPF External Type 1 metrics\n" |
| 6428 | "Set OSPF External Type 2 metrics\n" |
| 6429 | "OSPF default metric\n" |
| 6430 | "OSPF metric\n") |
| 6431 | |
| 6432 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6433 | ospf_default_information_originate_always_type_cmd, |
| 6434 | "default-information originate always metric-type (1|2)", |
| 6435 | "Control distribution of default information\n" |
| 6436 | "Distribute a default route\n" |
| 6437 | "Always advertise default route\n" |
| 6438 | "OSPF metric type for default routes\n" |
| 6439 | "Set OSPF External Type 1 metrics\n" |
| 6440 | "Set OSPF External Type 2 metrics\n") |
| 6441 | |
| 6442 | DEFUN (ospf_default_information_originate_always_type_routemap, |
| 6443 | ospf_default_information_originate_always_type_routemap_cmd, |
| 6444 | "default-information originate always metric-type (1|2) route-map WORD", |
| 6445 | "Control distribution of default information\n" |
| 6446 | "Distribute a default route\n" |
| 6447 | "Always advertise default route\n" |
| 6448 | "OSPF metric type for default routes\n" |
| 6449 | "Set OSPF External Type 1 metrics\n" |
| 6450 | "Set OSPF External Type 2 metrics\n" |
| 6451 | "Route map reference\n" |
| 6452 | "Pointer to route-map entries\n") |
| 6453 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6454 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6455 | int type = -1; |
| 6456 | |
| 6457 | /* Get metric type. */ |
| 6458 | if (argc >= 1) |
| 6459 | if (!str2metric_type (argv[0], &type)) |
| 6460 | return CMD_WARNING; |
| 6461 | |
| 6462 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6463 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6464 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6465 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6466 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6467 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6468 | type, -1); |
| 6469 | } |
| 6470 | |
| 6471 | DEFUN (no_ospf_default_information_originate, |
| 6472 | no_ospf_default_information_originate_cmd, |
| 6473 | "no default-information originate", |
| 6474 | NO_STR |
| 6475 | "Control distribution of default information\n" |
| 6476 | "Distribute a default route\n") |
| 6477 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6478 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6479 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6480 | |
| 6481 | p.family = AF_INET; |
| 6482 | p.prefix.s_addr = 0; |
| 6483 | p.prefixlen = 0; |
| 6484 | |
ajs | 5339cfd | 2005-09-19 13:28:05 +0000 | [diff] [blame] | 6485 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6486 | |
| 6487 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { |
| 6488 | ospf_external_info_delete (DEFAULT_ROUTE, p); |
| 6489 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); |
| 6490 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; |
| 6491 | } |
| 6492 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6493 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6494 | return ospf_redistribute_default_unset (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6495 | } |
| 6496 | |
| 6497 | DEFUN (ospf_default_metric, |
| 6498 | ospf_default_metric_cmd, |
| 6499 | "default-metric <0-16777214>", |
| 6500 | "Set metric of redistributed routes\n" |
| 6501 | "Default metric\n") |
| 6502 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6503 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6504 | int metric = -1; |
| 6505 | |
| 6506 | if (!str2metric (argv[0], &metric)) |
| 6507 | return CMD_WARNING; |
| 6508 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6509 | ospf->default_metric = metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6510 | |
| 6511 | return CMD_SUCCESS; |
| 6512 | } |
| 6513 | |
| 6514 | DEFUN (no_ospf_default_metric, |
| 6515 | no_ospf_default_metric_cmd, |
| 6516 | "no default-metric", |
| 6517 | NO_STR |
| 6518 | "Set metric of redistributed routes\n") |
| 6519 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6520 | struct ospf *ospf = vty->index; |
| 6521 | |
| 6522 | ospf->default_metric = -1; |
| 6523 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6524 | return CMD_SUCCESS; |
| 6525 | } |
| 6526 | |
| 6527 | ALIAS (no_ospf_default_metric, |
| 6528 | no_ospf_default_metric_val_cmd, |
| 6529 | "no default-metric <0-16777214>", |
| 6530 | NO_STR |
| 6531 | "Set metric of redistributed routes\n" |
| 6532 | "Default metric\n") |
| 6533 | |
| 6534 | DEFUN (ospf_distance, |
| 6535 | ospf_distance_cmd, |
| 6536 | "distance <1-255>", |
| 6537 | "Define an administrative distance\n" |
| 6538 | "OSPF Administrative distance\n") |
| 6539 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6540 | struct ospf *ospf = vty->index; |
| 6541 | |
| 6542 | ospf->distance_all = atoi (argv[0]); |
| 6543 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6544 | return CMD_SUCCESS; |
| 6545 | } |
| 6546 | |
| 6547 | DEFUN (no_ospf_distance, |
| 6548 | no_ospf_distance_cmd, |
| 6549 | "no distance <1-255>", |
| 6550 | NO_STR |
| 6551 | "Define an administrative distance\n" |
| 6552 | "OSPF Administrative distance\n") |
| 6553 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6554 | struct ospf *ospf = vty->index; |
| 6555 | |
| 6556 | ospf->distance_all = 0; |
| 6557 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6558 | return CMD_SUCCESS; |
| 6559 | } |
| 6560 | |
| 6561 | DEFUN (no_ospf_distance_ospf, |
| 6562 | no_ospf_distance_ospf_cmd, |
| 6563 | "no distance ospf", |
| 6564 | NO_STR |
| 6565 | "Define an administrative distance\n" |
| 6566 | "OSPF Administrative distance\n" |
| 6567 | "OSPF Distance\n") |
| 6568 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6569 | struct ospf *ospf = vty->index; |
| 6570 | |
| 6571 | ospf->distance_intra = 0; |
| 6572 | ospf->distance_inter = 0; |
| 6573 | ospf->distance_external = 0; |
| 6574 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6575 | return CMD_SUCCESS; |
| 6576 | } |
| 6577 | |
| 6578 | DEFUN (ospf_distance_ospf_intra, |
| 6579 | ospf_distance_ospf_intra_cmd, |
| 6580 | "distance ospf intra-area <1-255>", |
| 6581 | "Define an administrative distance\n" |
| 6582 | "OSPF Administrative distance\n" |
| 6583 | "Intra-area routes\n" |
| 6584 | "Distance for intra-area routes\n") |
| 6585 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6586 | struct ospf *ospf = vty->index; |
| 6587 | |
| 6588 | ospf->distance_intra = atoi (argv[0]); |
| 6589 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6590 | return CMD_SUCCESS; |
| 6591 | } |
| 6592 | |
| 6593 | DEFUN (ospf_distance_ospf_intra_inter, |
| 6594 | ospf_distance_ospf_intra_inter_cmd, |
| 6595 | "distance ospf intra-area <1-255> inter-area <1-255>", |
| 6596 | "Define an administrative distance\n" |
| 6597 | "OSPF Administrative distance\n" |
| 6598 | "Intra-area routes\n" |
| 6599 | "Distance for intra-area routes\n" |
| 6600 | "Inter-area routes\n" |
| 6601 | "Distance for inter-area routes\n") |
| 6602 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6603 | struct ospf *ospf = vty->index; |
| 6604 | |
| 6605 | ospf->distance_intra = atoi (argv[0]); |
| 6606 | ospf->distance_inter = atoi (argv[1]); |
| 6607 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6608 | return CMD_SUCCESS; |
| 6609 | } |
| 6610 | |
| 6611 | DEFUN (ospf_distance_ospf_intra_external, |
| 6612 | ospf_distance_ospf_intra_external_cmd, |
| 6613 | "distance ospf intra-area <1-255> external <1-255>", |
| 6614 | "Define an administrative distance\n" |
| 6615 | "OSPF Administrative distance\n" |
| 6616 | "Intra-area routes\n" |
| 6617 | "Distance for intra-area routes\n" |
| 6618 | "External routes\n" |
| 6619 | "Distance for external routes\n") |
| 6620 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6621 | struct ospf *ospf = vty->index; |
| 6622 | |
| 6623 | ospf->distance_intra = atoi (argv[0]); |
| 6624 | ospf->distance_external = atoi (argv[1]); |
| 6625 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6626 | return CMD_SUCCESS; |
| 6627 | } |
| 6628 | |
| 6629 | DEFUN (ospf_distance_ospf_intra_inter_external, |
| 6630 | ospf_distance_ospf_intra_inter_external_cmd, |
| 6631 | "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>", |
| 6632 | "Define an administrative distance\n" |
| 6633 | "OSPF Administrative distance\n" |
| 6634 | "Intra-area routes\n" |
| 6635 | "Distance for intra-area routes\n" |
| 6636 | "Inter-area routes\n" |
| 6637 | "Distance for inter-area routes\n" |
| 6638 | "External routes\n" |
| 6639 | "Distance for external routes\n") |
| 6640 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6641 | struct ospf *ospf = vty->index; |
| 6642 | |
| 6643 | ospf->distance_intra = atoi (argv[0]); |
| 6644 | ospf->distance_inter = atoi (argv[1]); |
| 6645 | ospf->distance_external = atoi (argv[2]); |
| 6646 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6647 | return CMD_SUCCESS; |
| 6648 | } |
| 6649 | |
| 6650 | DEFUN (ospf_distance_ospf_intra_external_inter, |
| 6651 | ospf_distance_ospf_intra_external_inter_cmd, |
| 6652 | "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>", |
| 6653 | "Define an administrative distance\n" |
| 6654 | "OSPF Administrative distance\n" |
| 6655 | "Intra-area routes\n" |
| 6656 | "Distance for intra-area routes\n" |
| 6657 | "External routes\n" |
| 6658 | "Distance for external routes\n" |
| 6659 | "Inter-area routes\n" |
| 6660 | "Distance for inter-area routes\n") |
| 6661 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6662 | struct ospf *ospf = vty->index; |
| 6663 | |
| 6664 | ospf->distance_intra = atoi (argv[0]); |
| 6665 | ospf->distance_external = atoi (argv[1]); |
| 6666 | ospf->distance_inter = atoi (argv[2]); |
| 6667 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6668 | return CMD_SUCCESS; |
| 6669 | } |
| 6670 | |
| 6671 | DEFUN (ospf_distance_ospf_inter, |
| 6672 | ospf_distance_ospf_inter_cmd, |
| 6673 | "distance ospf inter-area <1-255>", |
| 6674 | "Define an administrative distance\n" |
| 6675 | "OSPF Administrative distance\n" |
| 6676 | "Inter-area routes\n" |
| 6677 | "Distance for inter-area routes\n") |
| 6678 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6679 | struct ospf *ospf = vty->index; |
| 6680 | |
| 6681 | ospf->distance_inter = atoi (argv[0]); |
| 6682 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6683 | return CMD_SUCCESS; |
| 6684 | } |
| 6685 | |
| 6686 | DEFUN (ospf_distance_ospf_inter_intra, |
| 6687 | ospf_distance_ospf_inter_intra_cmd, |
| 6688 | "distance ospf inter-area <1-255> intra-area <1-255>", |
| 6689 | "Define an administrative distance\n" |
| 6690 | "OSPF Administrative distance\n" |
| 6691 | "Inter-area routes\n" |
| 6692 | "Distance for inter-area routes\n" |
| 6693 | "Intra-area routes\n" |
| 6694 | "Distance for intra-area routes\n") |
| 6695 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6696 | struct ospf *ospf = vty->index; |
| 6697 | |
| 6698 | ospf->distance_inter = atoi (argv[0]); |
| 6699 | ospf->distance_intra = atoi (argv[1]); |
| 6700 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6701 | return CMD_SUCCESS; |
| 6702 | } |
| 6703 | |
| 6704 | DEFUN (ospf_distance_ospf_inter_external, |
| 6705 | ospf_distance_ospf_inter_external_cmd, |
| 6706 | "distance ospf inter-area <1-255> external <1-255>", |
| 6707 | "Define an administrative distance\n" |
| 6708 | "OSPF Administrative distance\n" |
| 6709 | "Inter-area routes\n" |
| 6710 | "Distance for inter-area routes\n" |
| 6711 | "External routes\n" |
| 6712 | "Distance for external routes\n") |
| 6713 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6714 | struct ospf *ospf = vty->index; |
| 6715 | |
| 6716 | ospf->distance_inter = atoi (argv[0]); |
| 6717 | ospf->distance_external = atoi (argv[1]); |
| 6718 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6719 | return CMD_SUCCESS; |
| 6720 | } |
| 6721 | |
| 6722 | DEFUN (ospf_distance_ospf_inter_intra_external, |
| 6723 | ospf_distance_ospf_inter_intra_external_cmd, |
| 6724 | "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", |
| 6725 | "Define an administrative distance\n" |
| 6726 | "OSPF Administrative distance\n" |
| 6727 | "Inter-area routes\n" |
| 6728 | "Distance for inter-area routes\n" |
| 6729 | "Intra-area routes\n" |
| 6730 | "Distance for intra-area routes\n" |
| 6731 | "External routes\n" |
| 6732 | "Distance for external routes\n") |
| 6733 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6734 | struct ospf *ospf = vty->index; |
| 6735 | |
| 6736 | ospf->distance_inter = atoi (argv[0]); |
| 6737 | ospf->distance_intra = atoi (argv[1]); |
| 6738 | ospf->distance_external = atoi (argv[2]); |
| 6739 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6740 | return CMD_SUCCESS; |
| 6741 | } |
| 6742 | |
| 6743 | DEFUN (ospf_distance_ospf_inter_external_intra, |
| 6744 | ospf_distance_ospf_inter_external_intra_cmd, |
| 6745 | "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>", |
| 6746 | "Define an administrative distance\n" |
| 6747 | "OSPF Administrative distance\n" |
| 6748 | "Inter-area routes\n" |
| 6749 | "Distance for inter-area routes\n" |
| 6750 | "External routes\n" |
| 6751 | "Distance for external routes\n" |
| 6752 | "Intra-area routes\n" |
| 6753 | "Distance for intra-area routes\n") |
| 6754 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6755 | struct ospf *ospf = vty->index; |
| 6756 | |
| 6757 | ospf->distance_inter = atoi (argv[0]); |
| 6758 | ospf->distance_external = atoi (argv[1]); |
| 6759 | ospf->distance_intra = atoi (argv[2]); |
| 6760 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6761 | return CMD_SUCCESS; |
| 6762 | } |
| 6763 | |
| 6764 | DEFUN (ospf_distance_ospf_external, |
| 6765 | ospf_distance_ospf_external_cmd, |
| 6766 | "distance ospf external <1-255>", |
| 6767 | "Define an administrative distance\n" |
| 6768 | "OSPF Administrative distance\n" |
| 6769 | "External routes\n" |
| 6770 | "Distance for external routes\n") |
| 6771 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6772 | struct ospf *ospf = vty->index; |
| 6773 | |
| 6774 | ospf->distance_external = atoi (argv[0]); |
| 6775 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6776 | return CMD_SUCCESS; |
| 6777 | } |
| 6778 | |
| 6779 | DEFUN (ospf_distance_ospf_external_intra, |
| 6780 | ospf_distance_ospf_external_intra_cmd, |
| 6781 | "distance ospf external <1-255> intra-area <1-255>", |
| 6782 | "Define an administrative distance\n" |
| 6783 | "OSPF Administrative distance\n" |
| 6784 | "External routes\n" |
| 6785 | "Distance for external routes\n" |
| 6786 | "Intra-area routes\n" |
| 6787 | "Distance for intra-area routes\n") |
| 6788 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6789 | struct ospf *ospf = vty->index; |
| 6790 | |
| 6791 | ospf->distance_external = atoi (argv[0]); |
| 6792 | ospf->distance_intra = atoi (argv[1]); |
| 6793 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6794 | return CMD_SUCCESS; |
| 6795 | } |
| 6796 | |
| 6797 | DEFUN (ospf_distance_ospf_external_inter, |
| 6798 | ospf_distance_ospf_external_inter_cmd, |
| 6799 | "distance ospf external <1-255> inter-area <1-255>", |
| 6800 | "Define an administrative distance\n" |
| 6801 | "OSPF Administrative distance\n" |
| 6802 | "External routes\n" |
| 6803 | "Distance for external routes\n" |
| 6804 | "Inter-area routes\n" |
| 6805 | "Distance for inter-area routes\n") |
| 6806 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6807 | struct ospf *ospf = vty->index; |
| 6808 | |
| 6809 | ospf->distance_external = atoi (argv[0]); |
| 6810 | ospf->distance_inter = atoi (argv[1]); |
| 6811 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6812 | return CMD_SUCCESS; |
| 6813 | } |
| 6814 | |
| 6815 | DEFUN (ospf_distance_ospf_external_intra_inter, |
| 6816 | ospf_distance_ospf_external_intra_inter_cmd, |
| 6817 | "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>", |
| 6818 | "Define an administrative distance\n" |
| 6819 | "OSPF Administrative distance\n" |
| 6820 | "External routes\n" |
| 6821 | "Distance for external routes\n" |
| 6822 | "Intra-area routes\n" |
| 6823 | "Distance for intra-area routes\n" |
| 6824 | "Inter-area routes\n" |
| 6825 | "Distance for inter-area routes\n") |
| 6826 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6827 | struct ospf *ospf = vty->index; |
| 6828 | |
| 6829 | ospf->distance_external = atoi (argv[0]); |
| 6830 | ospf->distance_intra = atoi (argv[1]); |
| 6831 | ospf->distance_inter = atoi (argv[2]); |
| 6832 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6833 | return CMD_SUCCESS; |
| 6834 | } |
| 6835 | |
| 6836 | DEFUN (ospf_distance_ospf_external_inter_intra, |
| 6837 | ospf_distance_ospf_external_inter_intra_cmd, |
| 6838 | "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>", |
| 6839 | "Define an administrative distance\n" |
| 6840 | "OSPF Administrative distance\n" |
| 6841 | "External routes\n" |
| 6842 | "Distance for external routes\n" |
| 6843 | "Inter-area routes\n" |
| 6844 | "Distance for inter-area routes\n" |
| 6845 | "Intra-area routes\n" |
| 6846 | "Distance for intra-area routes\n") |
| 6847 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6848 | struct ospf *ospf = vty->index; |
| 6849 | |
| 6850 | ospf->distance_external = atoi (argv[0]); |
| 6851 | ospf->distance_inter = atoi (argv[1]); |
| 6852 | ospf->distance_intra = atoi (argv[2]); |
| 6853 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6854 | return CMD_SUCCESS; |
| 6855 | } |
| 6856 | |
| 6857 | DEFUN (ospf_distance_source, |
| 6858 | ospf_distance_source_cmd, |
| 6859 | "distance <1-255> A.B.C.D/M", |
| 6860 | "Administrative distance\n" |
| 6861 | "Distance value\n" |
| 6862 | "IP source prefix\n") |
| 6863 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6864 | struct ospf *ospf = vty->index; |
| 6865 | |
| 6866 | ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6867 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6868 | return CMD_SUCCESS; |
| 6869 | } |
| 6870 | |
| 6871 | DEFUN (no_ospf_distance_source, |
| 6872 | no_ospf_distance_source_cmd, |
| 6873 | "no distance <1-255> A.B.C.D/M", |
| 6874 | NO_STR |
| 6875 | "Administrative distance\n" |
| 6876 | "Distance value\n" |
| 6877 | "IP source prefix\n") |
| 6878 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6879 | struct ospf *ospf = vty->index; |
| 6880 | |
| 6881 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); |
| 6882 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6883 | return CMD_SUCCESS; |
| 6884 | } |
| 6885 | |
| 6886 | DEFUN (ospf_distance_source_access_list, |
| 6887 | ospf_distance_source_access_list_cmd, |
| 6888 | "distance <1-255> A.B.C.D/M WORD", |
| 6889 | "Administrative distance\n" |
| 6890 | "Distance value\n" |
| 6891 | "IP source prefix\n" |
| 6892 | "Access list name\n") |
| 6893 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6894 | struct ospf *ospf = vty->index; |
| 6895 | |
| 6896 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); |
| 6897 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6898 | return CMD_SUCCESS; |
| 6899 | } |
| 6900 | |
| 6901 | DEFUN (no_ospf_distance_source_access_list, |
| 6902 | no_ospf_distance_source_access_list_cmd, |
| 6903 | "no distance <1-255> A.B.C.D/M WORD", |
| 6904 | NO_STR |
| 6905 | "Administrative distance\n" |
| 6906 | "Distance value\n" |
| 6907 | "IP source prefix\n" |
| 6908 | "Access list name\n") |
| 6909 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6910 | struct ospf *ospf = vty->index; |
| 6911 | |
| 6912 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); |
| 6913 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6914 | return CMD_SUCCESS; |
| 6915 | } |
| 6916 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 6917 | DEFUN (ip_ospf_mtu_ignore, |
| 6918 | ip_ospf_mtu_ignore_addr_cmd, |
| 6919 | "ip ospf mtu-ignore A.B.C.D", |
| 6920 | "IP Information\n" |
| 6921 | "OSPF interface commands\n" |
| 6922 | "Disable mtu mismatch detection\n" |
| 6923 | "Address of interface") |
| 6924 | { |
| 6925 | struct interface *ifp = vty->index; |
| 6926 | struct in_addr addr; |
| 6927 | int ret; |
| 6928 | |
| 6929 | struct ospf_if_params *params; |
| 6930 | params = IF_DEF_PARAMS (ifp); |
| 6931 | |
| 6932 | if (argc == 1) |
| 6933 | { |
| 6934 | ret = inet_aton(argv[0], &addr); |
| 6935 | if (!ret) |
| 6936 | { |
| 6937 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6938 | VTY_NEWLINE); |
| 6939 | return CMD_WARNING; |
| 6940 | } |
| 6941 | params = ospf_get_if_params (ifp, addr); |
| 6942 | ospf_if_update_params (ifp, addr); |
| 6943 | } |
| 6944 | params->mtu_ignore = 1; |
| 6945 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6946 | SET_IF_PARAM (params, mtu_ignore); |
| 6947 | else |
| 6948 | { |
| 6949 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6950 | if (params != IF_DEF_PARAMS (ifp)) |
| 6951 | { |
| 6952 | ospf_free_if_params (ifp, addr); |
| 6953 | ospf_if_update_params (ifp, addr); |
| 6954 | } |
| 6955 | } |
| 6956 | return CMD_SUCCESS; |
| 6957 | } |
| 6958 | |
| 6959 | ALIAS (ip_ospf_mtu_ignore, |
| 6960 | ip_ospf_mtu_ignore_cmd, |
| 6961 | "ip ospf mtu-ignore", |
| 6962 | "IP Information\n" |
| 6963 | "OSPF interface commands\n" |
| 6964 | "Disable mtu mismatch detection\n") |
| 6965 | |
| 6966 | |
| 6967 | DEFUN (no_ip_ospf_mtu_ignore, |
| 6968 | no_ip_ospf_mtu_ignore_addr_cmd, |
| 6969 | "no ip ospf mtu-ignore A.B.C.D", |
| 6970 | "IP Information\n" |
| 6971 | "OSPF interface commands\n" |
| 6972 | "Disable mtu mismatch detection\n" |
| 6973 | "Address of interface") |
| 6974 | { |
| 6975 | struct interface *ifp = vty->index; |
| 6976 | struct in_addr addr; |
| 6977 | int ret; |
| 6978 | |
| 6979 | struct ospf_if_params *params; |
| 6980 | params = IF_DEF_PARAMS (ifp); |
| 6981 | |
| 6982 | if (argc == 1) |
| 6983 | { |
| 6984 | ret = inet_aton(argv[0], &addr); |
| 6985 | if (!ret) |
| 6986 | { |
| 6987 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6988 | VTY_NEWLINE); |
| 6989 | return CMD_WARNING; |
| 6990 | } |
| 6991 | params = ospf_get_if_params (ifp, addr); |
| 6992 | ospf_if_update_params (ifp, addr); |
| 6993 | } |
| 6994 | params->mtu_ignore = 0; |
| 6995 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6996 | SET_IF_PARAM (params, mtu_ignore); |
| 6997 | else |
| 6998 | { |
| 6999 | UNSET_IF_PARAM (params, mtu_ignore); |
| 7000 | if (params != IF_DEF_PARAMS (ifp)) |
| 7001 | { |
| 7002 | ospf_free_if_params (ifp, addr); |
| 7003 | ospf_if_update_params (ifp, addr); |
| 7004 | } |
| 7005 | } |
| 7006 | return CMD_SUCCESS; |
| 7007 | } |
| 7008 | |
| 7009 | ALIAS (no_ip_ospf_mtu_ignore, |
| 7010 | no_ip_ospf_mtu_ignore_cmd, |
| 7011 | "no ip ospf mtu-ignore", |
| 7012 | "IP Information\n" |
| 7013 | "OSPF interface commands\n" |
| 7014 | "Disable mtu mismatch detection\n") |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7015 | |
| 7016 | DEFUN (ospf_max_metric_router_lsa_admin, |
| 7017 | ospf_max_metric_router_lsa_admin_cmd, |
| 7018 | "max-metric router-lsa administrative", |
| 7019 | "OSPF maximum / infinite-distance metric\n" |
| 7020 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7021 | "Administratively applied, for an indefinite period\n") |
| 7022 | { |
| 7023 | struct listnode *ln; |
| 7024 | struct ospf_area *area; |
| 7025 | struct ospf *ospf = vty->index; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7026 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7027 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7028 | { |
| 7029 | SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 7030 | |
| 7031 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
Paul Jakma | c363d38 | 2010-01-24 22:42:13 +0000 | [diff] [blame] | 7032 | ospf_router_lsa_update_area (area); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7033 | } |
| 7034 | return CMD_SUCCESS; |
| 7035 | } |
| 7036 | |
| 7037 | DEFUN (no_ospf_max_metric_router_lsa_admin, |
| 7038 | no_ospf_max_metric_router_lsa_admin_cmd, |
| 7039 | "no max-metric router-lsa administrative", |
| 7040 | NO_STR |
| 7041 | "OSPF maximum / infinite-distance metric\n" |
| 7042 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7043 | "Administratively applied, for an indefinite period\n") |
| 7044 | { |
| 7045 | struct listnode *ln; |
| 7046 | struct ospf_area *area; |
| 7047 | struct ospf *ospf = vty->index; |
| 7048 | |
| 7049 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7050 | { |
| 7051 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 7052 | |
| 7053 | /* Don't trample on the start-up stub timer */ |
| 7054 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED) |
| 7055 | && !area->t_stub_router) |
| 7056 | { |
| 7057 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
Paul Jakma | c363d38 | 2010-01-24 22:42:13 +0000 | [diff] [blame] | 7058 | ospf_router_lsa_update_area (area); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7059 | } |
| 7060 | } |
| 7061 | return CMD_SUCCESS; |
| 7062 | } |
| 7063 | |
| 7064 | DEFUN (ospf_max_metric_router_lsa_startup, |
| 7065 | ospf_max_metric_router_lsa_startup_cmd, |
| 7066 | "max-metric router-lsa on-startup <5-86400>", |
| 7067 | "OSPF maximum / infinite-distance metric\n" |
| 7068 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7069 | "Automatically advertise stub Router-LSA on startup of OSPF\n" |
| 7070 | "Time (seconds) to advertise self as stub-router\n") |
| 7071 | { |
| 7072 | unsigned int seconds; |
| 7073 | struct ospf *ospf = vty->index; |
| 7074 | |
| 7075 | if (argc != 1) |
| 7076 | { |
| 7077 | vty_out (vty, "%% Must supply stub-router period"); |
| 7078 | return CMD_WARNING; |
| 7079 | } |
| 7080 | |
| 7081 | VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); |
| 7082 | |
| 7083 | ospf->stub_router_startup_time = seconds; |
| 7084 | |
| 7085 | return CMD_SUCCESS; |
| 7086 | } |
| 7087 | |
| 7088 | DEFUN (no_ospf_max_metric_router_lsa_startup, |
| 7089 | no_ospf_max_metric_router_lsa_startup_cmd, |
| 7090 | "no max-metric router-lsa on-startup", |
| 7091 | NO_STR |
| 7092 | "OSPF maximum / infinite-distance metric\n" |
| 7093 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7094 | "Automatically advertise stub Router-LSA on startup of OSPF\n") |
| 7095 | { |
| 7096 | struct listnode *ln; |
| 7097 | struct ospf_area *area; |
| 7098 | struct ospf *ospf = vty->index; |
| 7099 | |
| 7100 | ospf->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 7101 | |
| 7102 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7103 | { |
| 7104 | SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED); |
| 7105 | OSPF_TIMER_OFF (area->t_stub_router); |
| 7106 | |
| 7107 | /* Don't trample on admin stub routed */ |
| 7108 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 7109 | { |
| 7110 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
Paul Jakma | c363d38 | 2010-01-24 22:42:13 +0000 | [diff] [blame] | 7111 | ospf_router_lsa_update_area (area); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7112 | } |
| 7113 | } |
| 7114 | return CMD_SUCCESS; |
| 7115 | } |
| 7116 | |
| 7117 | DEFUN (ospf_max_metric_router_lsa_shutdown, |
| 7118 | ospf_max_metric_router_lsa_shutdown_cmd, |
| 7119 | "max-metric router-lsa on-shutdown <5-86400>", |
| 7120 | "OSPF maximum / infinite-distance metric\n" |
| 7121 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7122 | "Advertise stub-router prior to full shutdown of OSPF\n" |
| 7123 | "Time (seconds) to wait till full shutdown\n") |
| 7124 | { |
| 7125 | unsigned int seconds; |
| 7126 | struct ospf *ospf = vty->index; |
| 7127 | |
| 7128 | if (argc != 1) |
| 7129 | { |
| 7130 | vty_out (vty, "%% Must supply stub-router shutdown period"); |
| 7131 | return CMD_WARNING; |
| 7132 | } |
| 7133 | |
| 7134 | VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); |
| 7135 | |
| 7136 | ospf->stub_router_shutdown_time = seconds; |
| 7137 | |
| 7138 | return CMD_SUCCESS; |
| 7139 | } |
| 7140 | |
| 7141 | DEFUN (no_ospf_max_metric_router_lsa_shutdown, |
| 7142 | no_ospf_max_metric_router_lsa_shutdown_cmd, |
| 7143 | "no max-metric router-lsa on-shutdown", |
| 7144 | NO_STR |
| 7145 | "OSPF maximum / infinite-distance metric\n" |
| 7146 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7147 | "Advertise stub-router prior to full shutdown of OSPF\n") |
| 7148 | { |
| 7149 | struct ospf *ospf = vty->index; |
| 7150 | |
| 7151 | ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 7152 | |
| 7153 | return CMD_SUCCESS; |
| 7154 | } |
| 7155 | |
| 7156 | static void |
| 7157 | config_write_stub_router (struct vty *vty, struct ospf *ospf) |
| 7158 | { |
| 7159 | struct listnode *ln; |
| 7160 | struct ospf_area *area; |
| 7161 | |
| 7162 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 7163 | vty_out (vty, " max-metric router-lsa on-startup %u%s", |
| 7164 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 7165 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 7166 | vty_out (vty, " max-metric router-lsa on-shutdown %u%s", |
| 7167 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 7168 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7169 | { |
| 7170 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 7171 | { |
| 7172 | vty_out (vty, " max-metric router-lsa administrative%s", |
| 7173 | VTY_NEWLINE); |
| 7174 | break; |
| 7175 | } |
| 7176 | } |
| 7177 | return; |
| 7178 | } |
| 7179 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7180 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7181 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
| 7182 | { |
| 7183 | struct route_node *rn; |
| 7184 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7185 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7186 | struct ospf_path *path; |
| 7187 | |
| 7188 | vty_out (vty, "============ OSPF network routing table ============%s", |
| 7189 | VTY_NEWLINE); |
| 7190 | |
| 7191 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7192 | if ((or = rn->info) != NULL) |
| 7193 | { |
| 7194 | char buf1[19]; |
| 7195 | snprintf (buf1, 19, "%s/%d", |
| 7196 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7197 | |
| 7198 | switch (or->path_type) |
| 7199 | { |
| 7200 | case OSPF_PATH_INTER_AREA: |
| 7201 | if (or->type == OSPF_DESTINATION_NETWORK) |
| 7202 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, |
| 7203 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7204 | else if (or->type == OSPF_DESTINATION_DISCARD) |
| 7205 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); |
| 7206 | break; |
| 7207 | case OSPF_PATH_INTRA_AREA: |
| 7208 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, |
| 7209 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7210 | break; |
| 7211 | default: |
| 7212 | break; |
| 7213 | } |
| 7214 | |
| 7215 | if (or->type == OSPF_DESTINATION_NETWORK) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7216 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7217 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7218 | if (if_lookup_by_index(path->ifindex)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7219 | { |
| 7220 | if (path->nexthop.s_addr == 0) |
| 7221 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7222 | "", ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7223 | else |
| 7224 | vty_out (vty, "%24s via %s, %s%s", "", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7225 | inet_ntoa (path->nexthop), |
| 7226 | ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7227 | } |
| 7228 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7229 | } |
| 7230 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7231 | } |
| 7232 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7233 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7234 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
| 7235 | { |
| 7236 | struct route_node *rn; |
| 7237 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7238 | struct listnode *pnode; |
| 7239 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7240 | struct ospf_path *path; |
| 7241 | |
| 7242 | vty_out (vty, "============ OSPF router routing table =============%s", |
| 7243 | VTY_NEWLINE); |
| 7244 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) |
| 7245 | if (rn->info) |
| 7246 | { |
| 7247 | int flag = 0; |
| 7248 | |
| 7249 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); |
| 7250 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7251 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
| 7252 | { |
| 7253 | if (flag++) |
| 7254 | vty_out (vty, "%24s", ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7255 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7256 | /* Show path. */ |
| 7257 | vty_out (vty, "%s [%d] area: %s", |
| 7258 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), |
| 7259 | or->cost, inet_ntoa (or->u.std.area_id)); |
| 7260 | /* Show flags. */ |
| 7261 | vty_out (vty, "%s%s%s", |
| 7262 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), |
| 7263 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), |
| 7264 | VTY_NEWLINE); |
| 7265 | |
| 7266 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) |
| 7267 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7268 | if (if_lookup_by_index(path->ifindex)) |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7269 | { |
| 7270 | if (path->nexthop.s_addr == 0) |
| 7271 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7272 | "", ifindex2ifname (path->ifindex), |
| 7273 | VTY_NEWLINE); |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7274 | else |
| 7275 | vty_out (vty, "%24s via %s, %s%s", "", |
| 7276 | inet_ntoa (path->nexthop), |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7277 | ifindex2ifname (path->ifindex), |
| 7278 | VTY_NEWLINE); |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7279 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7280 | } |
| 7281 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7282 | } |
| 7283 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7284 | } |
| 7285 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7286 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7287 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
| 7288 | { |
| 7289 | struct route_node *rn; |
| 7290 | struct ospf_route *er; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7291 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7292 | struct ospf_path *path; |
| 7293 | |
| 7294 | vty_out (vty, "============ OSPF external routing table ===========%s", |
| 7295 | VTY_NEWLINE); |
| 7296 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7297 | if ((er = rn->info) != NULL) |
| 7298 | { |
| 7299 | char buf1[19]; |
| 7300 | snprintf (buf1, 19, "%s/%d", |
| 7301 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7302 | |
| 7303 | switch (er->path_type) |
| 7304 | { |
| 7305 | case OSPF_PATH_TYPE1_EXTERNAL: |
| 7306 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, |
| 7307 | er->cost, er->u.ext.tag, VTY_NEWLINE); |
| 7308 | break; |
| 7309 | case OSPF_PATH_TYPE2_EXTERNAL: |
| 7310 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, |
| 7311 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); |
| 7312 | break; |
| 7313 | } |
| 7314 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7315 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7316 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7317 | if (if_lookup_by_index(path->ifindex)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7318 | { |
| 7319 | if (path->nexthop.s_addr == 0) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7320 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7321 | "", ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7322 | else |
| 7323 | vty_out (vty, "%24s via %s, %s%s", "", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7324 | inet_ntoa (path->nexthop), |
| 7325 | ifindex2ifname (path->ifindex), |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7326 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7327 | } |
| 7328 | } |
| 7329 | } |
| 7330 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7331 | } |
| 7332 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7333 | DEFUN (show_ip_ospf_border_routers, |
| 7334 | show_ip_ospf_border_routers_cmd, |
| 7335 | "show ip ospf border-routers", |
| 7336 | SHOW_STR |
| 7337 | IP_STR |
| 7338 | "show all the ABR's and ASBR's\n" |
| 7339 | "for this area\n") |
| 7340 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7341 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7342 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7343 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7344 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7345 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7346 | return CMD_SUCCESS; |
| 7347 | } |
| 7348 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7349 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7350 | { |
| 7351 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7352 | return CMD_SUCCESS; |
| 7353 | } |
| 7354 | |
| 7355 | /* Show Network routes. |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7356 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7357 | |
| 7358 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7359 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7360 | |
| 7361 | return CMD_SUCCESS; |
| 7362 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7363 | |
| 7364 | DEFUN (show_ip_ospf_route, |
| 7365 | show_ip_ospf_route_cmd, |
| 7366 | "show ip ospf route", |
| 7367 | SHOW_STR |
| 7368 | IP_STR |
| 7369 | "OSPF information\n" |
| 7370 | "OSPF routing table\n") |
| 7371 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7372 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7373 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7374 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7375 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7376 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7377 | return CMD_SUCCESS; |
| 7378 | } |
| 7379 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7380 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7381 | { |
| 7382 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7383 | return CMD_SUCCESS; |
| 7384 | } |
| 7385 | |
| 7386 | /* Show Network routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7387 | show_ip_ospf_route_network (vty, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7388 | |
| 7389 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7390 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7391 | |
| 7392 | /* Show AS External routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7393 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7394 | |
| 7395 | return CMD_SUCCESS; |
| 7396 | } |
| 7397 | |
| 7398 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7399 | const char *ospf_abr_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7400 | { |
| 7401 | "unknown", |
| 7402 | "standard", |
| 7403 | "ibm", |
| 7404 | "cisco", |
| 7405 | "shortcut" |
| 7406 | }; |
| 7407 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7408 | const char *ospf_shortcut_mode_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7409 | { |
| 7410 | "default", |
| 7411 | "enable", |
| 7412 | "disable" |
| 7413 | }; |
| 7414 | |
| 7415 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7416 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7417 | area_id2str (char *buf, int length, struct ospf_area *area) |
| 7418 | { |
| 7419 | memset (buf, 0, length); |
| 7420 | |
| 7421 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 7422 | strncpy (buf, inet_ntoa (area->area_id), length); |
| 7423 | else |
| 7424 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); |
| 7425 | } |
| 7426 | |
| 7427 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7428 | const char *ospf_int_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7429 | { |
| 7430 | "unknown", /* should never be used. */ |
| 7431 | "point-to-point", |
| 7432 | "broadcast", |
| 7433 | "non-broadcast", |
| 7434 | "point-to-multipoint", |
| 7435 | "virtual-link", /* should never be used. */ |
| 7436 | "loopback" |
| 7437 | }; |
| 7438 | |
| 7439 | /* Configuration write function for ospfd. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7440 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7441 | config_write_interface (struct vty *vty) |
| 7442 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7443 | struct listnode *n1, *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7444 | struct interface *ifp; |
| 7445 | struct crypt_key *ck; |
| 7446 | int write = 0; |
| 7447 | struct route_node *rn = NULL; |
| 7448 | struct ospf_if_params *params; |
| 7449 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7450 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7451 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7452 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
| 7453 | continue; |
| 7454 | |
| 7455 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 7456 | vty_out (vty, "interface %s%s", ifp->name, |
| 7457 | VTY_NEWLINE); |
| 7458 | if (ifp->desc) |
| 7459 | vty_out (vty, " description %s%s", ifp->desc, |
| 7460 | VTY_NEWLINE); |
| 7461 | |
| 7462 | write++; |
| 7463 | |
| 7464 | params = IF_DEF_PARAMS (ifp); |
| 7465 | |
| 7466 | do { |
| 7467 | /* Interface Network print. */ |
| 7468 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7469 | params->type != OSPF_IFTYPE_LOOPBACK) |
| 7470 | { |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 7471 | if (params->type != ospf_default_iftype(ifp)) |
hasso | 7b90143 | 2004-08-31 13:37:42 +0000 | [diff] [blame] | 7472 | { |
| 7473 | vty_out (vty, " ip ospf network %s", |
| 7474 | ospf_int_type_str[params->type]); |
| 7475 | if (params != IF_DEF_PARAMS (ifp)) |
| 7476 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7477 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7478 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7479 | } |
| 7480 | |
| 7481 | /* OSPF interface authentication print */ |
| 7482 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && |
| 7483 | params->auth_type != OSPF_AUTH_NOTSET) |
| 7484 | { |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7485 | const char *auth_str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7486 | |
| 7487 | /* Translation tables are not that much help here due to syntax |
| 7488 | of the simple option */ |
| 7489 | switch (params->auth_type) |
| 7490 | { |
| 7491 | |
| 7492 | case OSPF_AUTH_NULL: |
| 7493 | auth_str = " null"; |
| 7494 | break; |
| 7495 | |
| 7496 | case OSPF_AUTH_SIMPLE: |
| 7497 | auth_str = ""; |
| 7498 | break; |
| 7499 | |
| 7500 | case OSPF_AUTH_CRYPTOGRAPHIC: |
| 7501 | auth_str = " message-digest"; |
| 7502 | break; |
| 7503 | |
| 7504 | default: |
| 7505 | auth_str = ""; |
| 7506 | break; |
| 7507 | } |
| 7508 | |
| 7509 | vty_out (vty, " ip ospf authentication%s", auth_str); |
| 7510 | if (params != IF_DEF_PARAMS (ifp)) |
| 7511 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7512 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7513 | } |
| 7514 | |
| 7515 | /* Simple Authentication Password print. */ |
| 7516 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && |
| 7517 | params->auth_simple[0] != '\0') |
| 7518 | { |
| 7519 | vty_out (vty, " ip ospf authentication-key %s", |
| 7520 | params->auth_simple); |
| 7521 | if (params != IF_DEF_PARAMS (ifp)) |
| 7522 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7523 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7524 | } |
| 7525 | |
| 7526 | /* Cryptographic Authentication Key print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7527 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7528 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7529 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
| 7530 | ck->key_id, ck->auth_key); |
| 7531 | if (params != IF_DEF_PARAMS (ifp)) |
| 7532 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7533 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7534 | } |
| 7535 | |
| 7536 | /* Interface Output Cost print. */ |
| 7537 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) |
| 7538 | { |
| 7539 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); |
| 7540 | if (params != IF_DEF_PARAMS (ifp)) |
| 7541 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7542 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7543 | } |
| 7544 | |
| 7545 | /* Hello Interval print. */ |
| 7546 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && |
| 7547 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) |
| 7548 | { |
| 7549 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); |
| 7550 | if (params != IF_DEF_PARAMS (ifp)) |
| 7551 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7552 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7553 | } |
| 7554 | |
| 7555 | |
| 7556 | /* Router Dead Interval print. */ |
| 7557 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && |
| 7558 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) |
| 7559 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7560 | vty_out (vty, " ip ospf dead-interval "); |
| 7561 | |
| 7562 | /* fast hello ? */ |
| 7563 | if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello)) |
| 7564 | vty_out (vty, "minimal hello-multiplier %d", |
| 7565 | params->fast_hello); |
| 7566 | else |
| 7567 | vty_out (vty, "%u", params->v_wait); |
| 7568 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7569 | if (params != IF_DEF_PARAMS (ifp)) |
| 7570 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7571 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7572 | } |
| 7573 | |
| 7574 | /* Router Priority print. */ |
| 7575 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && |
| 7576 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) |
| 7577 | { |
| 7578 | vty_out (vty, " ip ospf priority %u", params->priority); |
| 7579 | if (params != IF_DEF_PARAMS (ifp)) |
| 7580 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7581 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7582 | } |
| 7583 | |
| 7584 | /* Retransmit Interval print. */ |
| 7585 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && |
| 7586 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) |
| 7587 | { |
| 7588 | vty_out (vty, " ip ospf retransmit-interval %u", |
| 7589 | params->retransmit_interval); |
| 7590 | if (params != IF_DEF_PARAMS (ifp)) |
| 7591 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7592 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7593 | } |
| 7594 | |
| 7595 | /* Transmit Delay print. */ |
| 7596 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && |
| 7597 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7598 | { |
| 7599 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); |
| 7600 | if (params != IF_DEF_PARAMS (ifp)) |
| 7601 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7602 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7603 | } |
| 7604 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7605 | /* MTU ignore print. */ |
| 7606 | if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) && |
| 7607 | params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 7608 | { |
| 7609 | if (params->mtu_ignore == 0) |
| 7610 | vty_out (vty, " no ip ospf mtu-ignore"); |
| 7611 | else |
| 7612 | vty_out (vty, " ip ospf mtu-ignore"); |
| 7613 | if (params != IF_DEF_PARAMS (ifp)) |
| 7614 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7615 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7616 | } |
| 7617 | |
| 7618 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7619 | while (1) |
| 7620 | { |
| 7621 | if (rn == NULL) |
| 7622 | rn = route_top (IF_OIFS_PARAMS (ifp)); |
| 7623 | else |
| 7624 | rn = route_next (rn); |
| 7625 | |
| 7626 | if (rn == NULL) |
| 7627 | break; |
| 7628 | params = rn->info; |
| 7629 | if (params != NULL) |
| 7630 | break; |
| 7631 | } |
| 7632 | } while (rn); |
| 7633 | |
| 7634 | #ifdef HAVE_OPAQUE_LSA |
| 7635 | ospf_opaque_config_write_if (vty, ifp); |
| 7636 | #endif /* HAVE_OPAQUE_LSA */ |
| 7637 | } |
| 7638 | |
| 7639 | return write; |
| 7640 | } |
| 7641 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7642 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7643 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7644 | { |
| 7645 | struct route_node *rn; |
| 7646 | u_char buf[INET_ADDRSTRLEN]; |
| 7647 | |
| 7648 | /* `network area' print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7649 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7650 | if (rn->info) |
| 7651 | { |
| 7652 | struct ospf_network *n = rn->info; |
| 7653 | |
| 7654 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7655 | |
| 7656 | /* Create Area ID string by specified Area ID format. */ |
| 7657 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7658 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7659 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7660 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7661 | (unsigned long int) ntohl (n->area_id.s_addr)); |
| 7662 | |
| 7663 | /* Network print. */ |
| 7664 | vty_out (vty, " network %s/%d area %s%s", |
| 7665 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7666 | buf, VTY_NEWLINE); |
| 7667 | } |
| 7668 | |
| 7669 | return 0; |
| 7670 | } |
| 7671 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7672 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7673 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7674 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7675 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7676 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7677 | u_char buf[INET_ADDRSTRLEN]; |
| 7678 | |
| 7679 | /* Area configuration print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7680 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7681 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7682 | struct route_node *rn1; |
| 7683 | |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7684 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7685 | |
| 7686 | if (area->auth_type != OSPF_AUTH_NULL) |
| 7687 | { |
| 7688 | if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 7689 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); |
| 7690 | else |
| 7691 | vty_out (vty, " area %s authentication message-digest%s", |
| 7692 | buf, VTY_NEWLINE); |
| 7693 | } |
| 7694 | |
| 7695 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) |
| 7696 | vty_out (vty, " area %s shortcut %s%s", buf, |
| 7697 | ospf_shortcut_mode_str[area->shortcut_configured], |
| 7698 | VTY_NEWLINE); |
| 7699 | |
| 7700 | if ((area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7701 | || (area->external_routing == OSPF_AREA_NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7702 | ) |
| 7703 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7704 | if (area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7705 | vty_out (vty, " area %s stub", buf); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7706 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 7707 | { |
| 7708 | vty_out (vty, " area %s nssa", buf); |
| 7709 | switch (area->NSSATranslatorRole) |
| 7710 | { |
| 7711 | case OSPF_NSSA_ROLE_NEVER: |
| 7712 | vty_out (vty, " translate-never"); |
| 7713 | break; |
| 7714 | case OSPF_NSSA_ROLE_ALWAYS: |
| 7715 | vty_out (vty, " translate-always"); |
| 7716 | break; |
| 7717 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 7718 | default: |
| 7719 | vty_out (vty, " translate-candidate"); |
| 7720 | } |
| 7721 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7722 | |
| 7723 | if (area->no_summary) |
| 7724 | vty_out (vty, " no-summary"); |
| 7725 | |
| 7726 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7727 | |
| 7728 | if (area->default_cost != 1) |
| 7729 | vty_out (vty, " area %s default-cost %d%s", buf, |
| 7730 | area->default_cost, VTY_NEWLINE); |
| 7731 | } |
| 7732 | |
| 7733 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) |
| 7734 | if (rn1->info) |
| 7735 | { |
| 7736 | struct ospf_area_range *range = rn1->info; |
| 7737 | |
| 7738 | vty_out (vty, " area %s range %s/%d", buf, |
| 7739 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); |
| 7740 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 7741 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7742 | vty_out (vty, " cost %d", range->cost_config); |
| 7743 | |
| 7744 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 7745 | vty_out (vty, " not-advertise"); |
| 7746 | |
| 7747 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 7748 | vty_out (vty, " substitute %s/%d", |
| 7749 | inet_ntoa (range->subst_addr), range->subst_masklen); |
| 7750 | |
| 7751 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7752 | } |
| 7753 | |
| 7754 | if (EXPORT_NAME (area)) |
| 7755 | vty_out (vty, " area %s export-list %s%s", buf, |
| 7756 | EXPORT_NAME (area), VTY_NEWLINE); |
| 7757 | |
| 7758 | if (IMPORT_NAME (area)) |
| 7759 | vty_out (vty, " area %s import-list %s%s", buf, |
| 7760 | IMPORT_NAME (area), VTY_NEWLINE); |
| 7761 | |
| 7762 | if (PREFIX_NAME_IN (area)) |
| 7763 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, |
| 7764 | PREFIX_NAME_IN (area), VTY_NEWLINE); |
| 7765 | |
| 7766 | if (PREFIX_NAME_OUT (area)) |
| 7767 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, |
| 7768 | PREFIX_NAME_OUT (area), VTY_NEWLINE); |
| 7769 | } |
| 7770 | |
| 7771 | return 0; |
| 7772 | } |
| 7773 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7774 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7775 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7776 | { |
| 7777 | struct ospf_nbr_nbma *nbr_nbma; |
| 7778 | struct route_node *rn; |
| 7779 | |
| 7780 | /* Static Neighbor configuration print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7781 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7782 | if ((nbr_nbma = rn->info)) |
| 7783 | { |
| 7784 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); |
| 7785 | |
| 7786 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) |
| 7787 | vty_out (vty, " priority %d", nbr_nbma->priority); |
| 7788 | |
| 7789 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) |
| 7790 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); |
| 7791 | |
| 7792 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7793 | } |
| 7794 | |
| 7795 | return 0; |
| 7796 | } |
| 7797 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7798 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7799 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7800 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7801 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7802 | struct ospf_vl_data *vl_data; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7803 | u_char buf[INET_ADDRSTRLEN]; |
| 7804 | |
| 7805 | /* Virtual-Link print */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7806 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7807 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7808 | struct listnode *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7809 | struct crypt_key *ck; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7810 | struct ospf_interface *oi; |
| 7811 | |
| 7812 | if (vl_data != NULL) |
| 7813 | { |
| 7814 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7815 | |
| 7816 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7817 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7818 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7819 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7820 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
| 7821 | oi = vl_data->vl_oi; |
| 7822 | |
| 7823 | /* timers */ |
| 7824 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || |
| 7825 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || |
| 7826 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || |
| 7827 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7828 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", |
| 7829 | buf, |
| 7830 | inet_ntoa (vl_data->vl_peer), |
| 7831 | OSPF_IF_PARAM (oi, v_hello), |
| 7832 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 7833 | OSPF_IF_PARAM (oi, transmit_delay), |
| 7834 | OSPF_IF_PARAM (oi, v_wait), |
| 7835 | VTY_NEWLINE); |
| 7836 | else |
| 7837 | vty_out (vty, " area %s virtual-link %s%s", buf, |
| 7838 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); |
| 7839 | /* Auth key */ |
| 7840 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') |
| 7841 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", |
| 7842 | buf, |
| 7843 | inet_ntoa (vl_data->vl_peer), |
| 7844 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, |
| 7845 | VTY_NEWLINE); |
| 7846 | /* md5 keys */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7847 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
| 7848 | n2, ck)) |
| 7849 | vty_out (vty, " area %s virtual-link %s" |
| 7850 | " message-digest-key %d md5 %s%s", |
| 7851 | buf, |
| 7852 | inet_ntoa (vl_data->vl_peer), |
| 7853 | ck->key_id, ck->auth_key, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7854 | |
| 7855 | } |
| 7856 | } |
| 7857 | |
| 7858 | return 0; |
| 7859 | } |
| 7860 | |
| 7861 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7862 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7863 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7864 | { |
| 7865 | int type; |
| 7866 | |
| 7867 | /* redistribute print. */ |
| 7868 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
| 7869 | if (type != zclient->redist_default && zclient->redist[type]) |
| 7870 | { |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7871 | vty_out (vty, " redistribute %s", zebra_route_string(type)); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7872 | if (ospf->dmetric[type].value >= 0) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7873 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7874 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7875 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7876 | vty_out (vty, " metric-type 1"); |
| 7877 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7878 | if (ROUTEMAP_NAME (ospf, type)) |
| 7879 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7880 | |
| 7881 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7882 | } |
| 7883 | |
| 7884 | return 0; |
| 7885 | } |
| 7886 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7887 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7888 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7889 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7890 | if (ospf->default_metric != -1) |
| 7891 | vty_out (vty, " default-metric %d%s", ospf->default_metric, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7892 | VTY_NEWLINE); |
| 7893 | return 0; |
| 7894 | } |
| 7895 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7896 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7897 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7898 | { |
| 7899 | int type; |
| 7900 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7901 | if (ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7902 | { |
| 7903 | /* distribute-list print. */ |
| 7904 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
Denis Ovsienko | 171c9a9 | 2011-09-10 16:40:23 +0400 | [diff] [blame] | 7905 | if (DISTRIBUTE_NAME (ospf, type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7906 | vty_out (vty, " distribute-list %s out %s%s", |
Denis Ovsienko | 171c9a9 | 2011-09-10 16:40:23 +0400 | [diff] [blame] | 7907 | DISTRIBUTE_NAME (ospf, type), |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7908 | zebra_route_string(type), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7909 | |
| 7910 | /* default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7911 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7912 | { |
paul | c42c177 | 2006-01-10 20:36:49 +0000 | [diff] [blame] | 7913 | vty_out (vty, " default-information originate"); |
| 7914 | if (ospf->default_originate == DEFAULT_ORIGINATE_ALWAYS) |
| 7915 | vty_out (vty, " always"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7916 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7917 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7918 | vty_out (vty, " metric %d", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7919 | ospf->dmetric[DEFAULT_ROUTE].value); |
| 7920 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7921 | vty_out (vty, " metric-type 1"); |
| 7922 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7923 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
| 7924 | vty_out (vty, " route-map %s", |
| 7925 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7926 | |
| 7927 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7928 | } |
| 7929 | |
| 7930 | } |
| 7931 | |
| 7932 | return 0; |
| 7933 | } |
| 7934 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7935 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7936 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7937 | { |
| 7938 | struct route_node *rn; |
| 7939 | struct ospf_distance *odistance; |
| 7940 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7941 | if (ospf->distance_all) |
| 7942 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7943 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7944 | if (ospf->distance_intra |
| 7945 | || ospf->distance_inter |
| 7946 | || ospf->distance_external) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7947 | { |
| 7948 | vty_out (vty, " distance ospf"); |
| 7949 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7950 | if (ospf->distance_intra) |
| 7951 | vty_out (vty, " intra-area %d", ospf->distance_intra); |
| 7952 | if (ospf->distance_inter) |
| 7953 | vty_out (vty, " inter-area %d", ospf->distance_inter); |
| 7954 | if (ospf->distance_external) |
| 7955 | vty_out (vty, " external %d", ospf->distance_external); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7956 | |
| 7957 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7958 | } |
| 7959 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7960 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7961 | if ((odistance = rn->info) != NULL) |
| 7962 | { |
| 7963 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, |
| 7964 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7965 | odistance->access_list ? odistance->access_list : "", |
| 7966 | VTY_NEWLINE); |
| 7967 | } |
| 7968 | return 0; |
| 7969 | } |
| 7970 | |
| 7971 | /* OSPF configuration write function. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7972 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7973 | ospf_config_write (struct vty *vty) |
| 7974 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7975 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7976 | struct interface *ifp; |
| 7977 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7978 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7979 | int write = 0; |
| 7980 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7981 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7982 | if (ospf != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7983 | { |
| 7984 | /* `router ospf' print. */ |
| 7985 | vty_out (vty, "router ospf%s", VTY_NEWLINE); |
| 7986 | |
| 7987 | write++; |
| 7988 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7989 | if (!ospf->networks) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7990 | return write; |
| 7991 | |
| 7992 | /* Router ID print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7993 | if (ospf->router_id_static.s_addr != 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7994 | vty_out (vty, " ospf router-id %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7995 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7996 | |
| 7997 | /* ABR type print. */ |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 7998 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7999 | vty_out (vty, " ospf abr-type %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8000 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8001 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 8002 | /* log-adjacency-changes flag print. */ |
| 8003 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 8004 | { |
| 8005 | vty_out(vty, " log-adjacency-changes"); |
| 8006 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 8007 | vty_out(vty, " detail"); |
| 8008 | vty_out(vty, "%s", VTY_NEWLINE); |
| 8009 | } |
| 8010 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8011 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8012 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8013 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
| 8014 | |
| 8015 | /* auto-cost reference-bandwidth configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8016 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8017 | { |
| 8018 | vty_out (vty, "! Important: ensure reference bandwidth " |
| 8019 | "is consistent across all routers%s", VTY_NEWLINE); |
| 8020 | vty_out (vty, " auto-cost reference-bandwidth %d%s", |
| 8021 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); |
| 8022 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8023 | |
| 8024 | /* SPF timers print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8025 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 8026 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT || |
| 8027 | ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT) |
| 8028 | vty_out (vty, " timers throttle spf %d %d %d%s", |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8029 | ospf->spf_delay, ospf->spf_holdtime, |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 8030 | ospf->spf_max_holdtime, VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8031 | |
| 8032 | /* Max-metric router-lsa print */ |
| 8033 | config_write_stub_router (vty, ospf); |
| 8034 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8035 | /* SPF refresh parameters print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8036 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8037 | vty_out (vty, " refresh timer %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8038 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8039 | |
| 8040 | /* Redistribute information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8041 | config_write_ospf_redistribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8042 | |
| 8043 | /* passive-interface print. */ |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8044 | if (ospf->passive_interface_default == OSPF_IF_PASSIVE) |
| 8045 | vty_out (vty, " passive-interface default%s", VTY_NEWLINE); |
| 8046 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8047 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8048 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface) |
| 8049 | && IF_DEF_PARAMS (ifp)->passive_interface != |
| 8050 | ospf->passive_interface_default) |
| 8051 | { |
| 8052 | vty_out (vty, " %spassive-interface %s%s", |
| 8053 | IF_DEF_PARAMS (ifp)->passive_interface ? "" : "no ", |
| 8054 | ifp->name, VTY_NEWLINE); |
| 8055 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8056 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8057 | { |
| 8058 | if (!OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) |
| 8059 | continue; |
| 8060 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi->ifp), |
| 8061 | passive_interface)) |
| 8062 | { |
| 8063 | if (oi->params->passive_interface == IF_DEF_PARAMS (oi->ifp)->passive_interface) |
| 8064 | continue; |
| 8065 | } |
| 8066 | else if (oi->params->passive_interface == ospf->passive_interface_default) |
| 8067 | continue; |
| 8068 | |
| 8069 | vty_out (vty, " %spassive-interface %s %s%s", |
| 8070 | oi->params->passive_interface ? "" : "no ", |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8071 | oi->ifp->name, |
| 8072 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8073 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8074 | |
| 8075 | /* Network area print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8076 | config_write_network_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8077 | |
| 8078 | /* Area config print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8079 | config_write_ospf_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8080 | |
| 8081 | /* static neighbor print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8082 | config_write_ospf_nbr_nbma (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8083 | |
| 8084 | /* Virtual-Link print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8085 | config_write_virtual_link (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8086 | |
| 8087 | /* Default metric configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8088 | config_write_ospf_default_metric (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8089 | |
| 8090 | /* Distribute-list and default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8091 | config_write_ospf_distribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8092 | |
| 8093 | /* Distance configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8094 | config_write_ospf_distance (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8095 | |
| 8096 | #ifdef HAVE_OPAQUE_LSA |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8097 | ospf_opaque_config_write_router (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8098 | #endif /* HAVE_OPAQUE_LSA */ |
| 8099 | } |
| 8100 | |
| 8101 | return write; |
| 8102 | } |
| 8103 | |
| 8104 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8105 | ospf_vty_show_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8106 | { |
| 8107 | /* "show ip ospf" commands. */ |
| 8108 | install_element (VIEW_NODE, &show_ip_ospf_cmd); |
| 8109 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); |
| 8110 | |
| 8111 | /* "show ip ospf database" commands. */ |
| 8112 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); |
| 8113 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); |
| 8114 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 8115 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 8116 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 8117 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); |
| 8118 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); |
| 8119 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); |
| 8120 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); |
| 8121 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 8122 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 8123 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 8124 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); |
| 8125 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); |
| 8126 | |
| 8127 | /* "show ip ospf interface" commands. */ |
| 8128 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); |
| 8129 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); |
| 8130 | |
| 8131 | /* "show ip ospf neighbor" commands. */ |
| 8132 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 8133 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 8134 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 8135 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 8136 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 8137 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); |
| 8138 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 8139 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 8140 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 8141 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 8142 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 8143 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 8144 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); |
| 8145 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 8146 | |
| 8147 | /* "show ip ospf route" commands. */ |
| 8148 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); |
| 8149 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8150 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
| 8151 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8152 | } |
| 8153 | |
| 8154 | |
| 8155 | /* ospfd's interface node. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8156 | static struct cmd_node interface_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8157 | { |
| 8158 | INTERFACE_NODE, |
| 8159 | "%s(config-if)# ", |
| 8160 | 1 |
| 8161 | }; |
| 8162 | |
| 8163 | /* Initialization of OSPF interface. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8164 | static void |
| 8165 | ospf_vty_if_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8166 | { |
| 8167 | /* Install interface node. */ |
| 8168 | install_node (&interface_node, config_write_interface); |
| 8169 | |
| 8170 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 8171 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8172 | install_default (INTERFACE_NODE); |
| 8173 | |
| 8174 | /* "description" commands. */ |
| 8175 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 8176 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 8177 | |
| 8178 | /* "ip ospf authentication" commands. */ |
| 8179 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); |
| 8180 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); |
| 8181 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); |
| 8182 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); |
| 8183 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); |
| 8184 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); |
| 8185 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); |
| 8186 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); |
| 8187 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); |
| 8188 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); |
| 8189 | |
| 8190 | /* "ip ospf message-digest-key" commands. */ |
| 8191 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); |
| 8192 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); |
| 8193 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); |
| 8194 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); |
| 8195 | |
| 8196 | /* "ip ospf cost" commands. */ |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8197 | install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd); |
| 8198 | install_element (INTERFACE_NODE, &ip_ospf_cost_u32_cmd); |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 8199 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd); |
| 8200 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_inet4_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8201 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8202 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); |
| 8203 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 8204 | /* "ip ospf mtu-ignore" commands. */ |
| 8205 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); |
| 8206 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); |
| 8207 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); |
| 8208 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); |
| 8209 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8210 | /* "ip ospf dead-interval" commands. */ |
| 8211 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); |
| 8212 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8213 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); |
| 8214 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8215 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
| 8216 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8217 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8218 | /* "ip ospf hello-interval" commands. */ |
| 8219 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); |
| 8220 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); |
| 8221 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); |
| 8222 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); |
| 8223 | |
| 8224 | /* "ip ospf network" commands. */ |
| 8225 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); |
| 8226 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); |
| 8227 | |
| 8228 | /* "ip ospf priority" commands. */ |
| 8229 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); |
| 8230 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); |
| 8231 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); |
| 8232 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); |
| 8233 | |
| 8234 | /* "ip ospf retransmit-interval" commands. */ |
| 8235 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); |
| 8236 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); |
| 8237 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); |
| 8238 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); |
| 8239 | |
| 8240 | /* "ip ospf transmit-delay" commands. */ |
| 8241 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); |
| 8242 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); |
| 8243 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); |
| 8244 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); |
| 8245 | |
| 8246 | /* These commands are compatibitliy for previous version. */ |
| 8247 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); |
| 8248 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); |
| 8249 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); |
| 8250 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8251 | install_element (INTERFACE_NODE, &ospf_cost_u32_cmd); |
| 8252 | install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8253 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 8254 | install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd); |
| 8255 | install_element (INTERFACE_NODE, &no_ospf_cost_u32_inet4_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8256 | install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8257 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); |
| 8258 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); |
| 8259 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); |
| 8260 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); |
| 8261 | install_element (INTERFACE_NODE, &ospf_network_cmd); |
| 8262 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); |
| 8263 | install_element (INTERFACE_NODE, &ospf_priority_cmd); |
| 8264 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); |
| 8265 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); |
| 8266 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); |
| 8267 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); |
| 8268 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); |
| 8269 | } |
| 8270 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8271 | static void |
| 8272 | ospf_vty_zebra_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8273 | { |
| 8274 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); |
| 8275 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); |
| 8276 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); |
| 8277 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); |
| 8278 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); |
| 8279 | install_element (OSPF_NODE, |
| 8280 | &ospf_redistribute_source_metric_type_routemap_cmd); |
| 8281 | install_element (OSPF_NODE, |
| 8282 | &ospf_redistribute_source_type_metric_routemap_cmd); |
| 8283 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); |
| 8284 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); |
| 8285 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); |
| 8286 | |
| 8287 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); |
| 8288 | |
| 8289 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); |
| 8290 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); |
| 8291 | |
| 8292 | install_element (OSPF_NODE, |
| 8293 | &ospf_default_information_originate_metric_type_cmd); |
| 8294 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); |
| 8295 | install_element (OSPF_NODE, |
| 8296 | &ospf_default_information_originate_type_metric_cmd); |
| 8297 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); |
| 8298 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); |
| 8299 | install_element (OSPF_NODE, |
| 8300 | &ospf_default_information_originate_always_metric_type_cmd); |
| 8301 | install_element (OSPF_NODE, |
| 8302 | &ospf_default_information_originate_always_metric_cmd); |
| 8303 | install_element (OSPF_NODE, |
| 8304 | &ospf_default_information_originate_always_cmd); |
| 8305 | install_element (OSPF_NODE, |
| 8306 | &ospf_default_information_originate_always_type_metric_cmd); |
| 8307 | install_element (OSPF_NODE, |
| 8308 | &ospf_default_information_originate_always_type_cmd); |
| 8309 | |
| 8310 | install_element (OSPF_NODE, |
| 8311 | &ospf_default_information_originate_metric_type_routemap_cmd); |
| 8312 | install_element (OSPF_NODE, |
| 8313 | &ospf_default_information_originate_metric_routemap_cmd); |
| 8314 | install_element (OSPF_NODE, |
| 8315 | &ospf_default_information_originate_routemap_cmd); |
| 8316 | install_element (OSPF_NODE, |
| 8317 | &ospf_default_information_originate_type_metric_routemap_cmd); |
| 8318 | install_element (OSPF_NODE, |
| 8319 | &ospf_default_information_originate_type_routemap_cmd); |
| 8320 | install_element (OSPF_NODE, |
| 8321 | &ospf_default_information_originate_always_metric_type_routemap_cmd); |
| 8322 | install_element (OSPF_NODE, |
| 8323 | &ospf_default_information_originate_always_metric_routemap_cmd); |
| 8324 | install_element (OSPF_NODE, |
| 8325 | &ospf_default_information_originate_always_routemap_cmd); |
| 8326 | install_element (OSPF_NODE, |
| 8327 | &ospf_default_information_originate_always_type_metric_routemap_cmd); |
| 8328 | install_element (OSPF_NODE, |
| 8329 | &ospf_default_information_originate_always_type_routemap_cmd); |
| 8330 | |
| 8331 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); |
| 8332 | |
| 8333 | install_element (OSPF_NODE, &ospf_default_metric_cmd); |
| 8334 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); |
| 8335 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); |
| 8336 | |
| 8337 | install_element (OSPF_NODE, &ospf_distance_cmd); |
| 8338 | install_element (OSPF_NODE, &no_ospf_distance_cmd); |
| 8339 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); |
| 8340 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); |
| 8341 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); |
| 8342 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); |
| 8343 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); |
| 8344 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); |
| 8345 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); |
| 8346 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); |
| 8347 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); |
| 8348 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); |
| 8349 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); |
| 8350 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); |
| 8351 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); |
| 8352 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); |
| 8353 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); |
| 8354 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); |
| 8355 | #if 0 |
| 8356 | install_element (OSPF_NODE, &ospf_distance_source_cmd); |
| 8357 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); |
| 8358 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); |
| 8359 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); |
| 8360 | #endif /* 0 */ |
| 8361 | } |
| 8362 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8363 | static struct cmd_node ospf_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8364 | { |
| 8365 | OSPF_NODE, |
| 8366 | "%s(config-router)# ", |
| 8367 | 1 |
| 8368 | }; |
| 8369 | |
| 8370 | |
| 8371 | /* Install OSPF related vty commands. */ |
| 8372 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8373 | ospf_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8374 | { |
| 8375 | /* Install ospf top node. */ |
| 8376 | install_node (&ospf_node, ospf_config_write); |
| 8377 | |
| 8378 | /* "router ospf" commands. */ |
| 8379 | install_element (CONFIG_NODE, &router_ospf_cmd); |
| 8380 | install_element (CONFIG_NODE, &no_router_ospf_cmd); |
| 8381 | |
| 8382 | install_default (OSPF_NODE); |
| 8383 | |
| 8384 | /* "ospf router-id" commands. */ |
| 8385 | install_element (OSPF_NODE, &ospf_router_id_cmd); |
| 8386 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8387 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
| 8388 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8389 | |
| 8390 | /* "passive-interface" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8391 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
| 8392 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8393 | install_element (OSPF_NODE, &ospf_passive_interface_default_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8394 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); |
| 8395 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8396 | install_element (OSPF_NODE, &no_ospf_passive_interface_default_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8397 | |
| 8398 | /* "ospf abr-type" commands. */ |
| 8399 | install_element (OSPF_NODE, &ospf_abr_type_cmd); |
| 8400 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); |
| 8401 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 8402 | /* "ospf log-adjacency-changes" commands. */ |
| 8403 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_cmd); |
| 8404 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_detail_cmd); |
| 8405 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_cmd); |
| 8406 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_detail_cmd); |
| 8407 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8408 | /* "ospf rfc1583-compatible" commands. */ |
| 8409 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); |
| 8410 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); |
| 8411 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); |
| 8412 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); |
| 8413 | |
| 8414 | /* "network area" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8415 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
| 8416 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8417 | |
| 8418 | /* "area authentication" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8419 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
| 8420 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); |
| 8421 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8422 | |
| 8423 | /* "area range" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8424 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
| 8425 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); |
| 8426 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); |
| 8427 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); |
| 8428 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); |
| 8429 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); |
| 8430 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); |
| 8431 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); |
| 8432 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); |
| 8433 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); |
| 8434 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8435 | |
| 8436 | /* "area virtual-link" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8437 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
| 8438 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8439 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8440 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
| 8441 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8442 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8443 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
| 8444 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8445 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8446 | install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); |
| 8447 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8448 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8449 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
| 8450 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8451 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8452 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
| 8453 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); |
| 8454 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8455 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8456 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
| 8457 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8458 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8459 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
| 8460 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8461 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8462 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
| 8463 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); |
| 8464 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8465 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8466 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
| 8467 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); |
| 8468 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8469 | |
| 8470 | /* "area stub" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8471 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
| 8472 | install_element (OSPF_NODE, &ospf_area_stub_cmd); |
| 8473 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); |
| 8474 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8475 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8476 | /* "area nssa" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8477 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
| 8478 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); |
| 8479 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); |
| 8480 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); |
| 8481 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); |
| 8482 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8483 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8484 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
| 8485 | install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8486 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8487 | install_element (OSPF_NODE, &ospf_area_shortcut_cmd); |
| 8488 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8489 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8490 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
| 8491 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8492 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8493 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
| 8494 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8495 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8496 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
| 8497 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8498 | |
| 8499 | /* SPF timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8500 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
| 8501 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 8502 | install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); |
| 8503 | install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); |
| 8504 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8505 | /* refresh timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8506 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
| 8507 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); |
| 8508 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8509 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8510 | /* max-metric commands */ |
| 8511 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd); |
| 8512 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd); |
| 8513 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd); |
| 8514 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd); |
| 8515 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd); |
| 8516 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd); |
| 8517 | |
| 8518 | /* reference bandwidth commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8519 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
| 8520 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8521 | |
| 8522 | /* "neighbor" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8523 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
| 8524 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); |
| 8525 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); |
| 8526 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); |
| 8527 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); |
| 8528 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); |
| 8529 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); |
| 8530 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8531 | |
| 8532 | /* Init interface related vty commands. */ |
| 8533 | ospf_vty_if_init (); |
| 8534 | |
| 8535 | /* Init zebra related vty commands. */ |
| 8536 | ospf_vty_zebra_init (); |
| 8537 | } |