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 | str2metric (const char *str, int *metric) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 97 | { |
| 98 | /* Sanity check. */ |
| 99 | if (str == NULL) |
| 100 | return 0; |
| 101 | |
| 102 | *metric = strtol (str, NULL, 10); |
| 103 | if (*metric < 0 && *metric > 16777214) |
| 104 | { |
| 105 | /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */ |
| 106 | return 0; |
| 107 | } |
| 108 | |
| 109 | return 1; |
| 110 | } |
| 111 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 112 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 113 | str2metric_type (const char *str, int *metric_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 114 | { |
| 115 | /* Sanity check. */ |
| 116 | if (str == NULL) |
| 117 | return 0; |
| 118 | |
| 119 | if (strncmp (str, "1", 1) == 0) |
| 120 | *metric_type = EXTERNAL_METRIC_TYPE_1; |
| 121 | else if (strncmp (str, "2", 1) == 0) |
| 122 | *metric_type = EXTERNAL_METRIC_TYPE_2; |
| 123 | else |
| 124 | return 0; |
| 125 | |
| 126 | return 1; |
| 127 | } |
| 128 | |
| 129 | int |
| 130 | ospf_oi_count (struct interface *ifp) |
| 131 | { |
| 132 | struct route_node *rn; |
| 133 | int i = 0; |
| 134 | |
| 135 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 136 | if (rn->info) |
| 137 | i++; |
| 138 | |
| 139 | return i; |
| 140 | } |
| 141 | |
| 142 | |
| 143 | DEFUN (router_ospf, |
| 144 | router_ospf_cmd, |
| 145 | "router ospf", |
| 146 | "Enable a routing process\n" |
| 147 | "Start OSPF configuration\n") |
| 148 | { |
| 149 | vty->node = OSPF_NODE; |
| 150 | vty->index = ospf_get (); |
| 151 | |
| 152 | return CMD_SUCCESS; |
| 153 | } |
| 154 | |
| 155 | DEFUN (no_router_ospf, |
| 156 | no_router_ospf_cmd, |
| 157 | "no router ospf", |
| 158 | NO_STR |
| 159 | "Enable a routing process\n" |
| 160 | "Start OSPF configuration\n") |
| 161 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 162 | struct ospf *ospf; |
| 163 | |
| 164 | ospf = ospf_lookup (); |
| 165 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 166 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 167 | vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 168 | return CMD_WARNING; |
| 169 | } |
| 170 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 171 | ospf_finish (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 172 | |
| 173 | return CMD_SUCCESS; |
| 174 | } |
| 175 | |
| 176 | DEFUN (ospf_router_id, |
| 177 | ospf_router_id_cmd, |
| 178 | "ospf router-id A.B.C.D", |
| 179 | "OSPF specific commands\n" |
| 180 | "router-id for the OSPF process\n" |
| 181 | "OSPF router-id in IP address format\n") |
| 182 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 183 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 184 | struct in_addr router_id; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 185 | int ret; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 186 | |
| 187 | ret = inet_aton (argv[0], &router_id); |
| 188 | if (!ret) |
| 189 | { |
| 190 | vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); |
| 191 | return CMD_WARNING; |
| 192 | } |
| 193 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 194 | ospf->router_id_static = router_id; |
paul | b29800a | 2005-11-20 14:50:45 +0000 | [diff] [blame] | 195 | |
| 196 | ospf_router_id_update (ospf); |
| 197 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 198 | return CMD_SUCCESS; |
| 199 | } |
| 200 | |
| 201 | ALIAS (ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 202 | router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 203 | "router-id A.B.C.D", |
| 204 | "router-id for the OSPF process\n" |
| 205 | "OSPF router-id in IP address format\n") |
| 206 | |
| 207 | DEFUN (no_ospf_router_id, |
| 208 | no_ospf_router_id_cmd, |
| 209 | "no ospf router-id", |
| 210 | NO_STR |
| 211 | "OSPF specific commands\n" |
| 212 | "router-id for the OSPF process\n") |
| 213 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 214 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 215 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 216 | ospf->router_id_static.s_addr = 0; |
| 217 | |
| 218 | ospf_router_id_update (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 219 | |
| 220 | return CMD_SUCCESS; |
| 221 | } |
| 222 | |
| 223 | ALIAS (no_ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 224 | no_router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 225 | "no router-id", |
| 226 | NO_STR |
| 227 | "router-id for the OSPF process\n") |
| 228 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 229 | static void |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 230 | ospf_passive_interface_default (struct ospf *ospf, u_char newval) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 231 | { |
| 232 | struct listnode *ln; |
| 233 | struct interface *ifp; |
| 234 | struct ospf_interface *oi; |
| 235 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 236 | ospf->passive_interface_default = newval; |
| 237 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 238 | for (ALL_LIST_ELEMENTS_RO (om->iflist, ln, ifp)) |
| 239 | { |
| 240 | if (ifp && |
| 241 | OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) |
| 242 | UNSET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface); |
| 243 | } |
| 244 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, ln, oi)) |
| 245 | { |
| 246 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) |
| 247 | UNSET_IF_PARAM (oi->params, passive_interface); |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 248 | /* update multicast memberships */ |
| 249 | ospf_if_set_multicast(oi); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 250 | } |
| 251 | } |
| 252 | |
| 253 | static void |
| 254 | ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp, |
| 255 | struct in_addr addr, |
| 256 | struct ospf_if_params *params, u_char value) |
| 257 | { |
| 258 | u_char dflt; |
| 259 | |
| 260 | params->passive_interface = value; |
| 261 | if (params != IF_DEF_PARAMS (ifp)) |
| 262 | { |
| 263 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) |
| 264 | dflt = IF_DEF_PARAMS (ifp)->passive_interface; |
| 265 | else |
| 266 | dflt = ospf->passive_interface_default; |
| 267 | |
| 268 | if (value != dflt) |
| 269 | SET_IF_PARAM (params, passive_interface); |
| 270 | else |
| 271 | UNSET_IF_PARAM (params, passive_interface); |
| 272 | |
| 273 | ospf_free_if_params (ifp, addr); |
| 274 | ospf_if_update_params (ifp, addr); |
| 275 | } |
| 276 | else |
| 277 | { |
| 278 | if (value != ospf->passive_interface_default) |
| 279 | SET_IF_PARAM (params, passive_interface); |
| 280 | else |
| 281 | UNSET_IF_PARAM (params, passive_interface); |
| 282 | } |
| 283 | } |
| 284 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 285 | DEFUN (ospf_passive_interface, |
| 286 | ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 287 | "passive-interface IFNAME A.B.C.D", |
| 288 | "Suppress routing updates on an interface\n" |
| 289 | "Interface's name\n") |
| 290 | { |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 291 | struct interface *ifp; |
| 292 | struct in_addr addr; |
| 293 | int ret; |
| 294 | struct ospf_if_params *params; |
| 295 | struct route_node *rn; |
| 296 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 297 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 298 | if (argc == 0) |
| 299 | { |
| 300 | ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE); |
| 301 | return CMD_SUCCESS; |
| 302 | } |
| 303 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 304 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 305 | |
| 306 | params = IF_DEF_PARAMS (ifp); |
| 307 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 308 | if (argc == 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 309 | { |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 310 | ret = inet_aton(argv[1], &addr); |
| 311 | if (!ret) |
| 312 | { |
| 313 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 314 | VTY_NEWLINE); |
| 315 | return CMD_WARNING; |
| 316 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 317 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 318 | params = ospf_get_if_params (ifp, addr); |
| 319 | ospf_if_update_params (ifp, addr); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 320 | } |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 321 | ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE); |
| 322 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 323 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 324 | * interfaces for which the passive property changed. It is too much |
| 325 | * work to determine this set, so we do this for every interface. |
| 326 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 327 | * record of joined groups to avoid systems calls if the desired |
| 328 | * memberships match the current memership. |
| 329 | */ |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 330 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 331 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 332 | { |
| 333 | struct ospf_interface *oi = rn->info; |
| 334 | |
| 335 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 336 | ospf_if_set_multicast(oi); |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 337 | } |
| 338 | /* |
| 339 | * XXX It is not clear what state transitions the interface needs to |
| 340 | * undergo when going from active to passive. Fixing this will |
| 341 | * require precise identification of interfaces having such a |
| 342 | * transition. |
| 343 | */ |
| 344 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 345 | return CMD_SUCCESS; |
| 346 | } |
| 347 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 348 | ALIAS (ospf_passive_interface, |
| 349 | ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 350 | "passive-interface IFNAME", |
| 351 | "Suppress routing updates on an interface\n" |
| 352 | "Interface's name\n") |
| 353 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 354 | ALIAS (ospf_passive_interface, |
| 355 | ospf_passive_interface_default_cmd, |
| 356 | "passive-interface default", |
| 357 | "Suppress routing updates on an interface\n" |
| 358 | "Suppress routing updates on interfaces by default\n") |
| 359 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 360 | DEFUN (no_ospf_passive_interface, |
| 361 | no_ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 362 | "no passive-interface IFNAME A.B.C.D", |
| 363 | NO_STR |
| 364 | "Allow routing updates on an interface\n" |
| 365 | "Interface's name\n") |
| 366 | { |
| 367 | struct interface *ifp; |
| 368 | struct in_addr addr; |
| 369 | struct ospf_if_params *params; |
| 370 | int ret; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 371 | struct route_node *rn; |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 372 | struct ospf *ospf = vty->index; |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 373 | |
| 374 | if (argc == 0) |
| 375 | { |
| 376 | ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE); |
| 377 | return CMD_SUCCESS; |
| 378 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 379 | |
Andrew J. Schorr | 6e72cb6 | 2006-06-18 00:45:48 +0000 | [diff] [blame] | 380 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 381 | |
| 382 | params = IF_DEF_PARAMS (ifp); |
| 383 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 384 | if (argc == 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 385 | { |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 386 | ret = inet_aton(argv[1], &addr); |
| 387 | if (!ret) |
| 388 | { |
| 389 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 390 | VTY_NEWLINE); |
| 391 | return CMD_WARNING; |
| 392 | } |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 393 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 394 | params = ospf_lookup_if_params (ifp, addr); |
| 395 | if (params == NULL) |
| 396 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 397 | } |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 398 | ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE); |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 399 | |
| 400 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 401 | * interfaces for which the passive property changed. It is too much |
| 402 | * work to determine this set, so we do this for every interface. |
| 403 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 404 | * record of joined groups to avoid systems calls if the desired |
| 405 | * memberships match the current memership. |
| 406 | */ |
| 407 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 408 | { |
| 409 | struct ospf_interface *oi = rn->info; |
| 410 | |
| 411 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE)) |
| 412 | ospf_if_set_multicast(oi); |
| 413 | } |
| 414 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 415 | return CMD_SUCCESS; |
| 416 | } |
| 417 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 418 | ALIAS (no_ospf_passive_interface, |
| 419 | no_ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 420 | "no passive-interface IFNAME", |
| 421 | NO_STR |
| 422 | "Allow routing updates on an interface\n" |
| 423 | "Interface's name\n") |
| 424 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 425 | ALIAS (no_ospf_passive_interface, |
| 426 | no_ospf_passive_interface_default_cmd, |
| 427 | "no passive-interface default", |
| 428 | NO_STR |
| 429 | "Allow routing updates on an interface\n" |
| 430 | "Allow routing updates on interfaces by default\n") |
| 431 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 432 | DEFUN (ospf_network_area, |
| 433 | ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 434 | "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 435 | "Enable routing on an IP network\n" |
| 436 | "OSPF network prefix\n" |
| 437 | "Set the OSPF area ID\n" |
| 438 | "OSPF area ID in IP address format\n" |
| 439 | "OSPF area ID as a decimal value\n") |
| 440 | { |
| 441 | struct ospf *ospf= vty->index; |
| 442 | struct prefix_ipv4 p; |
| 443 | struct in_addr area_id; |
| 444 | int ret, format; |
| 445 | |
| 446 | /* Get network prefix and Area ID. */ |
| 447 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 448 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 449 | |
| 450 | ret = ospf_network_set (ospf, &p, area_id); |
| 451 | if (ret == 0) |
| 452 | { |
| 453 | vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); |
| 454 | return CMD_WARNING; |
| 455 | } |
| 456 | |
| 457 | return CMD_SUCCESS; |
| 458 | } |
| 459 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 460 | DEFUN (no_ospf_network_area, |
| 461 | no_ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 462 | "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 463 | NO_STR |
| 464 | "Enable routing on an IP network\n" |
| 465 | "OSPF network prefix\n" |
| 466 | "Set the OSPF area ID\n" |
| 467 | "OSPF area ID in IP address format\n" |
| 468 | "OSPF area ID as a decimal value\n") |
| 469 | { |
| 470 | struct ospf *ospf = (struct ospf *) vty->index; |
| 471 | struct prefix_ipv4 p; |
| 472 | struct in_addr area_id; |
| 473 | int ret, format; |
| 474 | |
| 475 | /* Get network prefix and Area ID. */ |
| 476 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 477 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 478 | |
| 479 | ret = ospf_network_unset (ospf, &p, area_id); |
| 480 | if (ret == 0) |
| 481 | { |
| 482 | vty_out (vty, "Can't find specified network area configuration.%s", |
| 483 | VTY_NEWLINE); |
| 484 | return CMD_WARNING; |
| 485 | } |
| 486 | |
| 487 | return CMD_SUCCESS; |
| 488 | } |
| 489 | |
| 490 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 491 | DEFUN (ospf_area_range, |
| 492 | ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 493 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 494 | "OSPF area parameters\n" |
| 495 | "OSPF area ID in IP address format\n" |
| 496 | "OSPF area ID as a decimal value\n" |
| 497 | "Summarize routes matching address/mask (border routers only)\n" |
| 498 | "Area range prefix\n") |
| 499 | { |
| 500 | struct ospf *ospf = vty->index; |
| 501 | struct prefix_ipv4 p; |
| 502 | struct in_addr area_id; |
| 503 | int format; |
| 504 | u_int32_t cost; |
| 505 | |
| 506 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 507 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 508 | |
| 509 | ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); |
| 510 | if (argc > 2) |
| 511 | { |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 512 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 513 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
| 514 | } |
| 515 | |
| 516 | return CMD_SUCCESS; |
| 517 | } |
| 518 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 519 | ALIAS (ospf_area_range, |
| 520 | ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 521 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", |
| 522 | "OSPF area parameters\n" |
| 523 | "OSPF area ID in IP address format\n" |
| 524 | "OSPF area ID as a decimal value\n" |
| 525 | "OSPF area range for route advertise (default)\n" |
| 526 | "Area range prefix\n" |
| 527 | "Advertise this range (default)\n") |
| 528 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 529 | ALIAS (ospf_area_range, |
| 530 | ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 531 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 532 | "OSPF area parameters\n" |
| 533 | "OSPF area ID in IP address format\n" |
| 534 | "OSPF area ID as a decimal value\n" |
| 535 | "Summarize routes matching address/mask (border routers only)\n" |
| 536 | "Area range prefix\n" |
| 537 | "User specified metric for this range\n" |
| 538 | "Advertised metric for this range\n") |
| 539 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 540 | ALIAS (ospf_area_range, |
| 541 | ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 542 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 543 | "OSPF area parameters\n" |
| 544 | "OSPF area ID in IP address format\n" |
| 545 | "OSPF area ID as a decimal value\n" |
| 546 | "Summarize routes matching address/mask (border routers only)\n" |
| 547 | "Area range prefix\n" |
| 548 | "Advertise this range (default)\n" |
| 549 | "User specified metric for this range\n" |
| 550 | "Advertised metric for this range\n") |
| 551 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 552 | DEFUN (ospf_area_range_not_advertise, |
| 553 | ospf_area_range_not_advertise_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 not-advertise", |
| 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 | "DoNotAdvertise this range\n") |
| 561 | { |
| 562 | struct ospf *ospf = vty->index; |
| 563 | struct prefix_ipv4 p; |
| 564 | struct in_addr area_id; |
| 565 | int format; |
| 566 | |
| 567 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 568 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 569 | |
| 570 | ospf_area_range_set (ospf, area_id, &p, 0); |
| 571 | |
| 572 | return CMD_SUCCESS; |
| 573 | } |
| 574 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 575 | DEFUN (no_ospf_area_range, |
| 576 | no_ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 577 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 578 | NO_STR |
| 579 | "OSPF area parameters\n" |
| 580 | "OSPF area ID in IP address format\n" |
| 581 | "OSPF area ID as a decimal value\n" |
| 582 | "Summarize routes matching address/mask (border routers only)\n" |
| 583 | "Area range prefix\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_unset (ospf, area_id, &p); |
| 594 | |
| 595 | return CMD_SUCCESS; |
| 596 | } |
| 597 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 598 | ALIAS (no_ospf_area_range, |
| 599 | no_ospf_area_range_advertise_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 (advertise|not-advertise)", |
| 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 | "Advertise this range (default)\n" |
| 608 | "DoNotAdvertise this range\n") |
| 609 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 610 | ALIAS (no_ospf_area_range, |
| 611 | no_ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 612 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 613 | NO_STR |
| 614 | "OSPF area parameters\n" |
| 615 | "OSPF area ID in IP address format\n" |
| 616 | "OSPF area ID as a decimal value\n" |
| 617 | "Summarize routes matching address/mask (border routers only)\n" |
| 618 | "Area range prefix\n" |
| 619 | "User specified metric for this range\n" |
| 620 | "Advertised metric for this range\n") |
| 621 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 622 | ALIAS (no_ospf_area_range, |
| 623 | no_ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 624 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 625 | NO_STR |
| 626 | "OSPF area parameters\n" |
| 627 | "OSPF area ID in IP address format\n" |
| 628 | "OSPF area ID as a decimal value\n" |
| 629 | "Summarize routes matching address/mask (border routers only)\n" |
| 630 | "Area range prefix\n" |
| 631 | "Advertise this range (default)\n" |
| 632 | "User specified metric for this range\n" |
| 633 | "Advertised metric for this range\n") |
| 634 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 635 | DEFUN (ospf_area_range_substitute, |
| 636 | ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 637 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 638 | "OSPF area parameters\n" |
| 639 | "OSPF area ID in IP address format\n" |
| 640 | "OSPF area ID as a decimal value\n" |
| 641 | "Summarize routes matching address/mask (border routers only)\n" |
| 642 | "Area range prefix\n" |
| 643 | "Announce area range as another prefix\n" |
| 644 | "Network prefix to be announced instead of range\n") |
| 645 | { |
| 646 | struct ospf *ospf = vty->index; |
| 647 | struct prefix_ipv4 p, s; |
| 648 | struct in_addr area_id; |
| 649 | int format; |
| 650 | |
| 651 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 652 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 653 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 654 | |
| 655 | ospf_area_range_substitute_set (ospf, area_id, &p, &s); |
| 656 | |
| 657 | return CMD_SUCCESS; |
| 658 | } |
| 659 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 660 | DEFUN (no_ospf_area_range_substitute, |
| 661 | no_ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 662 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 663 | NO_STR |
| 664 | "OSPF area parameters\n" |
| 665 | "OSPF area ID in IP address format\n" |
| 666 | "OSPF area ID as a decimal value\n" |
| 667 | "Summarize routes matching address/mask (border routers only)\n" |
| 668 | "Area range prefix\n" |
| 669 | "Announce area range as another prefix\n" |
| 670 | "Network prefix to be announced instead of range\n") |
| 671 | { |
| 672 | struct ospf *ospf = vty->index; |
| 673 | struct prefix_ipv4 p, s; |
| 674 | struct in_addr area_id; |
| 675 | int format; |
| 676 | |
| 677 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 678 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 679 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 680 | |
| 681 | ospf_area_range_substitute_unset (ospf, area_id, &p); |
| 682 | |
| 683 | return CMD_SUCCESS; |
| 684 | } |
| 685 | |
| 686 | |
| 687 | /* Command Handler Logic in VLink stuff is delicate!! |
| 688 | |
| 689 | ALTER AT YOUR OWN RISK!!!! |
| 690 | |
| 691 | Various dummy values are used to represent 'NoChange' state for |
| 692 | VLink configuration NOT being changed by a VLink command, and |
| 693 | special syntax is used within the command strings so that the |
| 694 | typed in command verbs can be seen in the configuration command |
| 695 | bacckend handler. This is to drastically reduce the verbeage |
| 696 | required to coe up with a reasonably compatible Cisco VLink command |
| 697 | |
| 698 | - Matthew Grant <grantma@anathoth.gen.nz> |
| 699 | Wed, 21 Feb 2001 15:13:52 +1300 |
| 700 | */ |
| 701 | |
| 702 | |
| 703 | /* Configuration data for virtual links |
| 704 | */ |
| 705 | struct ospf_vl_config_data { |
| 706 | struct vty *vty; /* vty stuff */ |
| 707 | struct in_addr area_id; /* area ID from command line */ |
| 708 | int format; /* command line area ID format */ |
| 709 | struct in_addr vl_peer; /* command line vl_peer */ |
| 710 | int auth_type; /* Authehntication type, if given */ |
| 711 | char *auth_key; /* simple password if present */ |
| 712 | int crypto_key_id; /* Cryptographic key ID */ |
| 713 | char *md5_key; /* MD5 authentication key */ |
| 714 | int hello_interval; /* Obvious what these are... */ |
| 715 | int retransmit_interval; |
| 716 | int transmit_delay; |
| 717 | int dead_interval; |
| 718 | }; |
| 719 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 720 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 721 | ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, |
| 722 | struct vty *vty) |
| 723 | { |
| 724 | memset (vl_config, 0, sizeof (struct ospf_vl_config_data)); |
| 725 | vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN; |
| 726 | vl_config->vty = vty; |
| 727 | } |
| 728 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 729 | static struct ospf_vl_data * |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 730 | 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] | 731 | { |
| 732 | struct ospf_area *area; |
| 733 | struct ospf_vl_data *vl_data; |
| 734 | struct vty *vty; |
| 735 | struct in_addr area_id; |
| 736 | |
| 737 | vty = vl_config->vty; |
| 738 | area_id = vl_config->area_id; |
| 739 | |
| 740 | if (area_id.s_addr == OSPF_AREA_BACKBONE) |
| 741 | { |
| 742 | vty_out (vty, |
| 743 | "Configuring VLs over the backbone is not allowed%s", |
| 744 | VTY_NEWLINE); |
| 745 | return NULL; |
| 746 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 747 | area = ospf_area_get (ospf, area_id, vl_config->format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 748 | |
| 749 | if (area->external_routing != OSPF_AREA_DEFAULT) |
| 750 | { |
| 751 | if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 752 | vty_out (vty, "Area %s is %s%s", |
| 753 | inet_ntoa (area_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 754 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 755 | VTY_NEWLINE); |
| 756 | else |
| 757 | vty_out (vty, "Area %ld is %s%s", |
| 758 | (u_long)ntohl (area_id.s_addr), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 759 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 760 | VTY_NEWLINE); |
| 761 | return NULL; |
| 762 | } |
| 763 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 764 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config->vl_peer)) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 765 | { |
| 766 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); |
| 767 | if (vl_data->vl_oi == NULL) |
| 768 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 769 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
| 770 | ospf_vl_add (ospf, vl_data); |
| 771 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 772 | } |
| 773 | } |
| 774 | return vl_data; |
| 775 | } |
| 776 | |
| 777 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 778 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 779 | ospf_vl_set_security (struct ospf_vl_data *vl_data, |
| 780 | struct ospf_vl_config_data *vl_config) |
| 781 | { |
| 782 | struct crypt_key *ck; |
| 783 | struct vty *vty; |
| 784 | struct interface *ifp = vl_data->vl_oi->ifp; |
| 785 | |
| 786 | vty = vl_config->vty; |
| 787 | |
| 788 | if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN) |
| 789 | { |
| 790 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); |
| 791 | IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type; |
| 792 | } |
| 793 | |
| 794 | if (vl_config->auth_key) |
| 795 | { |
| 796 | memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 797 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 798 | OSPF_AUTH_SIMPLE_SIZE); |
| 799 | } |
| 800 | else if (vl_config->md5_key) |
| 801 | { |
| 802 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id) |
| 803 | != NULL) |
| 804 | { |
| 805 | vty_out (vty, "OSPF: Key %d already exists%s", |
| 806 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 807 | return CMD_WARNING; |
| 808 | } |
| 809 | ck = ospf_crypt_key_new (); |
| 810 | ck->key_id = vl_config->crypto_key_id; |
| 811 | memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 812 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 813 | |
| 814 | ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); |
| 815 | } |
| 816 | else if (vl_config->crypto_key_id != 0) |
| 817 | { |
| 818 | /* Delete a key */ |
| 819 | |
| 820 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, |
| 821 | vl_config->crypto_key_id) == NULL) |
| 822 | { |
| 823 | vty_out (vty, "OSPF: Key %d does not exist%s", |
| 824 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 825 | return CMD_WARNING; |
| 826 | } |
| 827 | |
| 828 | ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id); |
| 829 | |
| 830 | } |
| 831 | |
| 832 | return CMD_SUCCESS; |
| 833 | } |
| 834 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 835 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 836 | ospf_vl_set_timers (struct ospf_vl_data *vl_data, |
| 837 | struct ospf_vl_config_data *vl_config) |
| 838 | { |
| 839 | struct interface *ifp = ifp = vl_data->vl_oi->ifp; |
| 840 | /* Virtual Link data initialised to defaults, so only set |
| 841 | if a value given */ |
| 842 | if (vl_config->hello_interval) |
| 843 | { |
| 844 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); |
| 845 | IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval; |
| 846 | } |
| 847 | |
| 848 | if (vl_config->dead_interval) |
| 849 | { |
| 850 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait); |
| 851 | IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval; |
| 852 | } |
| 853 | |
| 854 | if (vl_config->retransmit_interval) |
| 855 | { |
| 856 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval); |
| 857 | IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval; |
| 858 | } |
| 859 | |
| 860 | if (vl_config->transmit_delay) |
| 861 | { |
| 862 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay); |
| 863 | IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay; |
| 864 | } |
| 865 | |
| 866 | return CMD_SUCCESS; |
| 867 | } |
| 868 | |
| 869 | |
| 870 | |
| 871 | /* The business end of all of the above */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 872 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 873 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 874 | { |
| 875 | struct ospf_vl_data *vl_data; |
| 876 | int ret; |
| 877 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 878 | vl_data = ospf_find_vl_data (ospf, vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 879 | if (!vl_data) |
| 880 | return CMD_WARNING; |
| 881 | |
| 882 | /* Process this one first as it can have a fatal result, which can |
| 883 | only logically occur if the virtual link exists already |
| 884 | Thus a command error does not result in a change to the |
| 885 | running configuration such as unexpectedly altered timer |
| 886 | values etc.*/ |
| 887 | ret = ospf_vl_set_security (vl_data, vl_config); |
| 888 | if (ret != CMD_SUCCESS) |
| 889 | return ret; |
| 890 | |
| 891 | /* Set any time based parameters, these area already range checked */ |
| 892 | |
| 893 | ret = ospf_vl_set_timers (vl_data, vl_config); |
| 894 | if (ret != CMD_SUCCESS) |
| 895 | return ret; |
| 896 | |
| 897 | return CMD_SUCCESS; |
| 898 | |
| 899 | } |
| 900 | |
| 901 | /* This stuff exists to make specifying all the alias commands A LOT simpler |
| 902 | */ |
| 903 | #define VLINK_HELPSTR_IPADDR \ |
| 904 | "OSPF area parameters\n" \ |
| 905 | "OSPF area ID in IP address format\n" \ |
| 906 | "OSPF area ID as a decimal value\n" \ |
| 907 | "Configure a virtual link\n" \ |
| 908 | "Router ID of the remote ABR\n" |
| 909 | |
| 910 | #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 911 | "Enable authentication on this virtual link\n" \ |
| 912 | "dummy string \n" |
| 913 | |
| 914 | #define VLINK_HELPSTR_AUTHTYPE_ALL \ |
| 915 | VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 916 | "Use null authentication\n" \ |
| 917 | "Use message-digest authentication\n" |
| 918 | |
| 919 | #define VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 920 | "Time between HELLO packets\n" \ |
| 921 | "Time between retransmitting lost link state advertisements\n" \ |
| 922 | "Link state transmit delay\n" \ |
| 923 | "Interval after which a neighbor is declared dead\n" |
| 924 | |
| 925 | #define VLINK_HELPSTR_TIME_PARAM \ |
| 926 | VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 927 | "Seconds\n" |
| 928 | |
| 929 | #define VLINK_HELPSTR_AUTH_SIMPLE \ |
| 930 | "Authentication password (key)\n" \ |
| 931 | "The OSPF password (key)" |
| 932 | |
| 933 | #define VLINK_HELPSTR_AUTH_MD5 \ |
| 934 | "Message digest authentication password (key)\n" \ |
| 935 | "dummy string \n" \ |
| 936 | "Key ID\n" \ |
| 937 | "Use MD5 algorithm\n" \ |
| 938 | "The OSPF password (key)" |
| 939 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 940 | DEFUN (ospf_area_vlink, |
| 941 | ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 942 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 943 | VLINK_HELPSTR_IPADDR) |
| 944 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 945 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 946 | struct ospf_vl_config_data vl_config; |
| 947 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 948 | char md5_key[OSPF_AUTH_MD5_SIZE+1]; |
| 949 | int i; |
| 950 | int ret; |
| 951 | |
| 952 | ospf_vl_config_data_init(&vl_config, vty); |
| 953 | |
| 954 | /* Read off first 2 parameters and check them */ |
| 955 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); |
| 956 | if (ret < 0) |
| 957 | { |
| 958 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 959 | return CMD_WARNING; |
| 960 | } |
| 961 | |
| 962 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 963 | if (! ret) |
| 964 | { |
| 965 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 966 | VTY_NEWLINE); |
| 967 | return CMD_WARNING; |
| 968 | } |
| 969 | |
| 970 | if (argc <=2) |
| 971 | { |
| 972 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 973 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 974 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 975 | } |
| 976 | |
| 977 | /* Deal with other parameters */ |
| 978 | for (i=2; i < argc; i++) |
| 979 | { |
| 980 | |
| 981 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 982 | |
| 983 | switch (argv[i][0]) |
| 984 | { |
| 985 | |
| 986 | case 'a': |
| 987 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 988 | { |
| 989 | /* authentication-key - this option can occur anywhere on |
| 990 | command line. At start of command line |
| 991 | must check for authentication option. */ |
| 992 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 993 | strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); |
| 994 | vl_config.auth_key = auth_key; |
| 995 | i++; |
| 996 | } |
| 997 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 998 | { |
| 999 | /* authentication - this option can only occur at start |
| 1000 | of command line */ |
| 1001 | vl_config.auth_type = OSPF_AUTH_SIMPLE; |
| 1002 | if ((i+1) < argc) |
| 1003 | { |
| 1004 | if (strncmp (argv[i+1], "n", 1) == 0) |
| 1005 | { |
| 1006 | /* "authentication null" */ |
| 1007 | vl_config.auth_type = OSPF_AUTH_NULL; |
| 1008 | i++; |
| 1009 | } |
| 1010 | else if (strncmp (argv[i+1], "m", 1) == 0 |
| 1011 | && strcmp (argv[i+1], "message-digest-") != 0) |
| 1012 | { |
| 1013 | /* "authentication message-digest" */ |
| 1014 | vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1015 | i++; |
| 1016 | } |
| 1017 | } |
| 1018 | } |
| 1019 | break; |
| 1020 | |
| 1021 | case 'm': |
| 1022 | /* message-digest-key */ |
| 1023 | i++; |
| 1024 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1025 | if (vl_config.crypto_key_id < 0) |
| 1026 | return CMD_WARNING; |
| 1027 | i++; |
| 1028 | memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); |
| 1029 | strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); |
| 1030 | vl_config.md5_key = md5_key; |
| 1031 | break; |
| 1032 | |
| 1033 | case 'h': |
| 1034 | /* Hello interval */ |
| 1035 | i++; |
| 1036 | vl_config.hello_interval = strtol (argv[i], NULL, 10); |
| 1037 | if (vl_config.hello_interval < 0) |
| 1038 | return CMD_WARNING; |
| 1039 | break; |
| 1040 | |
| 1041 | case 'r': |
| 1042 | /* Retransmit Interval */ |
| 1043 | i++; |
| 1044 | vl_config.retransmit_interval = strtol (argv[i], NULL, 10); |
| 1045 | if (vl_config.retransmit_interval < 0) |
| 1046 | return CMD_WARNING; |
| 1047 | break; |
| 1048 | |
| 1049 | case 't': |
| 1050 | /* Transmit Delay */ |
| 1051 | i++; |
| 1052 | vl_config.transmit_delay = strtol (argv[i], NULL, 10); |
| 1053 | if (vl_config.transmit_delay < 0) |
| 1054 | return CMD_WARNING; |
| 1055 | break; |
| 1056 | |
| 1057 | case 'd': |
| 1058 | /* Dead Interval */ |
| 1059 | i++; |
| 1060 | vl_config.dead_interval = strtol (argv[i], NULL, 10); |
| 1061 | if (vl_config.dead_interval < 0) |
| 1062 | return CMD_WARNING; |
| 1063 | break; |
| 1064 | } |
| 1065 | } |
| 1066 | |
| 1067 | |
| 1068 | /* Action configuration */ |
| 1069 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1070 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1071 | |
| 1072 | } |
| 1073 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1074 | DEFUN (no_ospf_area_vlink, |
| 1075 | no_ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1076 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 1077 | NO_STR |
| 1078 | VLINK_HELPSTR_IPADDR) |
| 1079 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1080 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1081 | struct ospf_area *area; |
| 1082 | struct ospf_vl_config_data vl_config; |
| 1083 | struct ospf_vl_data *vl_data = NULL; |
| 1084 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 1085 | int i; |
| 1086 | int ret, format; |
| 1087 | |
| 1088 | ospf_vl_config_data_init(&vl_config, vty); |
| 1089 | |
| 1090 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); |
| 1091 | if (ret < 0) |
| 1092 | { |
| 1093 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 1094 | return CMD_WARNING; |
| 1095 | } |
| 1096 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1097 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1098 | if (!area) |
| 1099 | { |
| 1100 | vty_out (vty, "Area does not exist%s", VTY_NEWLINE); |
| 1101 | return CMD_WARNING; |
| 1102 | } |
| 1103 | |
| 1104 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 1105 | if (! ret) |
| 1106 | { |
| 1107 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 1108 | VTY_NEWLINE); |
| 1109 | return CMD_WARNING; |
| 1110 | } |
| 1111 | |
| 1112 | if (argc <=2) |
| 1113 | { |
| 1114 | /* Basic VLink no command */ |
| 1115 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 1116 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1117 | ospf_vl_delete (ospf, vl_data); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1118 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1119 | ospf_area_check_free (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1120 | |
| 1121 | return CMD_SUCCESS; |
| 1122 | } |
| 1123 | |
| 1124 | /* If we are down here, we are reseting parameters */ |
| 1125 | |
| 1126 | /* Deal with other parameters */ |
| 1127 | for (i=2; i < argc; i++) |
| 1128 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1129 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 1130 | |
| 1131 | switch (argv[i][0]) |
| 1132 | { |
| 1133 | |
| 1134 | case 'a': |
| 1135 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 1136 | { |
| 1137 | /* authentication-key - this option can occur anywhere on |
| 1138 | command line. At start of command line |
| 1139 | must check for authentication option. */ |
| 1140 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 1141 | vl_config.auth_key = auth_key; |
| 1142 | } |
| 1143 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1144 | { |
| 1145 | /* authentication - this option can only occur at start |
| 1146 | of command line */ |
| 1147 | vl_config.auth_type = OSPF_AUTH_NOTSET; |
| 1148 | } |
| 1149 | break; |
| 1150 | |
| 1151 | case 'm': |
| 1152 | /* message-digest-key */ |
| 1153 | /* Delete one key */ |
| 1154 | i++; |
| 1155 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1156 | if (vl_config.crypto_key_id < 0) |
| 1157 | return CMD_WARNING; |
| 1158 | vl_config.md5_key = NULL; |
| 1159 | break; |
| 1160 | |
| 1161 | case 'h': |
| 1162 | /* Hello interval */ |
| 1163 | vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; |
| 1164 | break; |
| 1165 | |
| 1166 | case 'r': |
| 1167 | /* Retransmit Interval */ |
| 1168 | vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 1169 | break; |
| 1170 | |
| 1171 | case 't': |
| 1172 | /* Transmit Delay */ |
| 1173 | vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 1174 | break; |
| 1175 | |
| 1176 | case 'd': |
| 1177 | /* Dead Interval */ |
| 1178 | i++; |
| 1179 | vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 1180 | break; |
| 1181 | } |
| 1182 | } |
| 1183 | |
| 1184 | |
| 1185 | /* Action configuration */ |
| 1186 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1187 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1188 | } |
| 1189 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1190 | ALIAS (ospf_area_vlink, |
| 1191 | ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1192 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1193 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1194 | VLINK_HELPSTR_IPADDR |
| 1195 | VLINK_HELPSTR_TIME_PARAM) |
| 1196 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1197 | ALIAS (no_ospf_area_vlink, |
| 1198 | no_ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1199 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1200 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1201 | NO_STR |
| 1202 | VLINK_HELPSTR_IPADDR |
| 1203 | VLINK_HELPSTR_TIME_PARAM) |
| 1204 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1205 | ALIAS (ospf_area_vlink, |
| 1206 | ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1207 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1208 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1209 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1210 | VLINK_HELPSTR_IPADDR |
| 1211 | VLINK_HELPSTR_TIME_PARAM |
| 1212 | VLINK_HELPSTR_TIME_PARAM) |
| 1213 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1214 | ALIAS (no_ospf_area_vlink, |
| 1215 | no_ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1216 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1217 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1218 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1219 | NO_STR |
| 1220 | VLINK_HELPSTR_IPADDR |
| 1221 | VLINK_HELPSTR_TIME_PARAM |
| 1222 | VLINK_HELPSTR_TIME_PARAM) |
| 1223 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1224 | ALIAS (ospf_area_vlink, |
| 1225 | ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1226 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1227 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1228 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1229 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1230 | VLINK_HELPSTR_IPADDR |
| 1231 | VLINK_HELPSTR_TIME_PARAM |
| 1232 | VLINK_HELPSTR_TIME_PARAM |
| 1233 | VLINK_HELPSTR_TIME_PARAM) |
| 1234 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1235 | ALIAS (no_ospf_area_vlink, |
| 1236 | no_ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1237 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1238 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1239 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1240 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1241 | NO_STR |
| 1242 | VLINK_HELPSTR_IPADDR |
| 1243 | VLINK_HELPSTR_TIME_PARAM |
| 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_param4_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 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1254 | VLINK_HELPSTR_IPADDR |
| 1255 | VLINK_HELPSTR_TIME_PARAM |
| 1256 | VLINK_HELPSTR_TIME_PARAM |
| 1257 | VLINK_HELPSTR_TIME_PARAM |
| 1258 | VLINK_HELPSTR_TIME_PARAM) |
| 1259 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1260 | ALIAS (no_ospf_area_vlink, |
| 1261 | no_ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1262 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1263 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1264 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1265 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1266 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1267 | NO_STR |
| 1268 | VLINK_HELPSTR_IPADDR |
| 1269 | VLINK_HELPSTR_TIME_PARAM |
| 1270 | VLINK_HELPSTR_TIME_PARAM |
| 1271 | VLINK_HELPSTR_TIME_PARAM |
| 1272 | VLINK_HELPSTR_TIME_PARAM) |
| 1273 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1274 | ALIAS (ospf_area_vlink, |
| 1275 | ospf_area_vlink_authtype_args_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1276 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1277 | "(authentication|) (message-digest|null)", |
| 1278 | VLINK_HELPSTR_IPADDR |
| 1279 | VLINK_HELPSTR_AUTHTYPE_ALL) |
| 1280 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1281 | ALIAS (ospf_area_vlink, |
| 1282 | ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1283 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1284 | "(authentication|)", |
| 1285 | VLINK_HELPSTR_IPADDR |
| 1286 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1287 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1288 | ALIAS (no_ospf_area_vlink, |
| 1289 | no_ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1290 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1291 | "(authentication|)", |
| 1292 | NO_STR |
| 1293 | VLINK_HELPSTR_IPADDR |
| 1294 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1295 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1296 | ALIAS (ospf_area_vlink, |
| 1297 | ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1298 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1299 | "(message-digest-key|) <1-255> md5 KEY", |
| 1300 | VLINK_HELPSTR_IPADDR |
| 1301 | VLINK_HELPSTR_AUTH_MD5) |
| 1302 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1303 | ALIAS (no_ospf_area_vlink, |
| 1304 | no_ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1305 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1306 | "(message-digest-key|) <1-255>", |
| 1307 | NO_STR |
| 1308 | VLINK_HELPSTR_IPADDR |
| 1309 | VLINK_HELPSTR_AUTH_MD5) |
| 1310 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1311 | ALIAS (ospf_area_vlink, |
| 1312 | ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1313 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1314 | "(authentication-key|) AUTH_KEY", |
| 1315 | VLINK_HELPSTR_IPADDR |
| 1316 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1317 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1318 | ALIAS (no_ospf_area_vlink, |
| 1319 | no_ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1320 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1321 | "(authentication-key|)", |
| 1322 | NO_STR |
| 1323 | VLINK_HELPSTR_IPADDR |
| 1324 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1325 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1326 | ALIAS (ospf_area_vlink, |
| 1327 | ospf_area_vlink_authtype_args_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1328 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1329 | "(authentication|) (message-digest|null) " |
| 1330 | "(authentication-key|) AUTH_KEY", |
| 1331 | VLINK_HELPSTR_IPADDR |
| 1332 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1333 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1334 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1335 | ALIAS (ospf_area_vlink, |
| 1336 | ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1337 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1338 | "(authentication|) " |
| 1339 | "(authentication-key|) AUTH_KEY", |
| 1340 | VLINK_HELPSTR_IPADDR |
| 1341 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1342 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1343 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1344 | ALIAS (no_ospf_area_vlink, |
| 1345 | no_ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1346 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1347 | "(authentication|) " |
| 1348 | "(authentication-key|)", |
| 1349 | NO_STR |
| 1350 | VLINK_HELPSTR_IPADDR |
| 1351 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1352 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1353 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1354 | ALIAS (ospf_area_vlink, |
| 1355 | ospf_area_vlink_authtype_args_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1356 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1357 | "(authentication|) (message-digest|null) " |
| 1358 | "(message-digest-key|) <1-255> md5 KEY", |
| 1359 | VLINK_HELPSTR_IPADDR |
| 1360 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1361 | VLINK_HELPSTR_AUTH_MD5) |
| 1362 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1363 | ALIAS (ospf_area_vlink, |
| 1364 | ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1365 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1366 | "(authentication|) " |
| 1367 | "(message-digest-key|) <1-255> md5 KEY", |
| 1368 | VLINK_HELPSTR_IPADDR |
| 1369 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1370 | VLINK_HELPSTR_AUTH_MD5) |
| 1371 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1372 | ALIAS (no_ospf_area_vlink, |
| 1373 | no_ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1374 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1375 | "(authentication|) " |
| 1376 | "(message-digest-key|)", |
| 1377 | NO_STR |
| 1378 | VLINK_HELPSTR_IPADDR |
| 1379 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1380 | VLINK_HELPSTR_AUTH_MD5) |
| 1381 | |
| 1382 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1383 | DEFUN (ospf_area_shortcut, |
| 1384 | ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1385 | "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", |
| 1386 | "OSPF area parameters\n" |
| 1387 | "OSPF area ID in IP address format\n" |
| 1388 | "OSPF area ID as a decimal value\n" |
| 1389 | "Configure the area's shortcutting mode\n" |
| 1390 | "Set default shortcutting behavior\n" |
| 1391 | "Enable shortcutting through the area\n" |
| 1392 | "Disable shortcutting through the area\n") |
| 1393 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1394 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1395 | struct ospf_area *area; |
| 1396 | struct in_addr area_id; |
| 1397 | int mode; |
| 1398 | int format; |
| 1399 | |
| 1400 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1401 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1402 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1403 | |
| 1404 | if (strncmp (argv[1], "de", 2) == 0) |
| 1405 | mode = OSPF_SHORTCUT_DEFAULT; |
| 1406 | else if (strncmp (argv[1], "di", 2) == 0) |
| 1407 | mode = OSPF_SHORTCUT_DISABLE; |
| 1408 | else if (strncmp (argv[1], "e", 1) == 0) |
| 1409 | mode = OSPF_SHORTCUT_ENABLE; |
| 1410 | else |
| 1411 | return CMD_WARNING; |
| 1412 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1413 | ospf_area_shortcut_set (ospf, area, mode); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1414 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1415 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1416 | vty_out (vty, "Shortcut area setting will take effect " |
| 1417 | "only when the router is configured as Shortcut ABR%s", |
| 1418 | VTY_NEWLINE); |
| 1419 | |
| 1420 | return CMD_SUCCESS; |
| 1421 | } |
| 1422 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1423 | DEFUN (no_ospf_area_shortcut, |
| 1424 | no_ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1425 | "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", |
| 1426 | NO_STR |
| 1427 | "OSPF area parameters\n" |
| 1428 | "OSPF area ID in IP address format\n" |
| 1429 | "OSPF area ID as a decimal value\n" |
| 1430 | "Deconfigure the area's shortcutting mode\n" |
| 1431 | "Deconfigure enabled shortcutting through the area\n" |
| 1432 | "Deconfigure disabled shortcutting through the area\n") |
| 1433 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1434 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1435 | struct ospf_area *area; |
| 1436 | struct in_addr area_id; |
| 1437 | int format; |
| 1438 | |
| 1439 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1440 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1441 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1442 | if (!area) |
| 1443 | return CMD_SUCCESS; |
| 1444 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1445 | ospf_area_shortcut_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1446 | |
| 1447 | return CMD_SUCCESS; |
| 1448 | } |
| 1449 | |
| 1450 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1451 | DEFUN (ospf_area_stub, |
| 1452 | ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1453 | "area (A.B.C.D|<0-4294967295>) stub", |
| 1454 | "OSPF area parameters\n" |
| 1455 | "OSPF area ID in IP address format\n" |
| 1456 | "OSPF area ID as a decimal value\n" |
| 1457 | "Configure OSPF area as stub\n") |
| 1458 | { |
| 1459 | struct ospf *ospf = vty->index; |
| 1460 | struct in_addr area_id; |
| 1461 | int ret, format; |
| 1462 | |
| 1463 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1464 | |
| 1465 | ret = ospf_area_stub_set (ospf, area_id); |
| 1466 | if (ret == 0) |
| 1467 | { |
| 1468 | vty_out (vty, "First deconfigure all virtual link through this area%s", |
| 1469 | VTY_NEWLINE); |
| 1470 | return CMD_WARNING; |
| 1471 | } |
| 1472 | |
| 1473 | ospf_area_no_summary_unset (ospf, area_id); |
| 1474 | |
| 1475 | return CMD_SUCCESS; |
| 1476 | } |
| 1477 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1478 | DEFUN (ospf_area_stub_no_summary, |
| 1479 | ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1480 | "area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1481 | "OSPF stub parameters\n" |
| 1482 | "OSPF area ID in IP address format\n" |
| 1483 | "OSPF area ID as a decimal value\n" |
| 1484 | "Configure OSPF area as stub\n" |
| 1485 | "Do not inject inter-area routes into stub\n") |
| 1486 | { |
| 1487 | struct ospf *ospf = vty->index; |
| 1488 | struct in_addr area_id; |
| 1489 | int ret, format; |
| 1490 | |
| 1491 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1492 | |
| 1493 | ret = ospf_area_stub_set (ospf, area_id); |
| 1494 | if (ret == 0) |
| 1495 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1496 | 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] | 1497 | VTY_NEWLINE); |
| 1498 | return CMD_WARNING; |
| 1499 | } |
| 1500 | |
| 1501 | ospf_area_no_summary_set (ospf, area_id); |
| 1502 | |
| 1503 | return CMD_SUCCESS; |
| 1504 | } |
| 1505 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1506 | DEFUN (no_ospf_area_stub, |
| 1507 | no_ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1508 | "no area (A.B.C.D|<0-4294967295>) stub", |
| 1509 | NO_STR |
| 1510 | "OSPF area parameters\n" |
| 1511 | "OSPF area ID in IP address format\n" |
| 1512 | "OSPF area ID as a decimal value\n" |
| 1513 | "Configure OSPF area as stub\n") |
| 1514 | { |
| 1515 | struct ospf *ospf = vty->index; |
| 1516 | struct in_addr area_id; |
| 1517 | int format; |
| 1518 | |
| 1519 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1520 | |
| 1521 | ospf_area_stub_unset (ospf, area_id); |
| 1522 | ospf_area_no_summary_unset (ospf, area_id); |
| 1523 | |
| 1524 | return CMD_SUCCESS; |
| 1525 | } |
| 1526 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1527 | DEFUN (no_ospf_area_stub_no_summary, |
| 1528 | no_ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1529 | "no area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1530 | NO_STR |
| 1531 | "OSPF area parameters\n" |
| 1532 | "OSPF area ID in IP address format\n" |
| 1533 | "OSPF area ID as a decimal value\n" |
| 1534 | "Configure OSPF area as stub\n" |
| 1535 | "Do not inject inter-area routes into area\n") |
| 1536 | { |
| 1537 | struct ospf *ospf = vty->index; |
| 1538 | struct in_addr area_id; |
| 1539 | int format; |
| 1540 | |
| 1541 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1542 | ospf_area_no_summary_unset (ospf, area_id); |
| 1543 | |
| 1544 | return CMD_SUCCESS; |
| 1545 | } |
| 1546 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1547 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 1548 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
| 1549 | int nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1550 | { |
| 1551 | struct ospf *ospf = vty->index; |
| 1552 | struct in_addr area_id; |
| 1553 | int ret, format; |
| 1554 | |
| 1555 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1556 | |
| 1557 | ret = ospf_area_nssa_set (ospf, area_id); |
| 1558 | if (ret == 0) |
| 1559 | { |
| 1560 | vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", |
| 1561 | VTY_NEWLINE); |
| 1562 | return CMD_WARNING; |
| 1563 | } |
| 1564 | |
| 1565 | if (argc > 1) |
| 1566 | { |
| 1567 | if (strncmp (argv[1], "translate-c", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1568 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1569 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1570 | else if (strncmp (argv[1], "translate-n", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1571 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1572 | OSPF_NSSA_ROLE_NEVER); |
| 1573 | else if (strncmp (argv[1], "translate-a", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1574 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1575 | OSPF_NSSA_ROLE_ALWAYS); |
| 1576 | } |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1577 | else |
| 1578 | { |
| 1579 | ospf_area_nssa_translator_role_set (ospf, area_id, |
| 1580 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1581 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1582 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1583 | if (nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1584 | ospf_area_no_summary_set (ospf, area_id); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1585 | else |
| 1586 | ospf_area_no_summary_unset (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1587 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1588 | ospf_schedule_abr_task (ospf); |
| 1589 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1590 | return CMD_SUCCESS; |
| 1591 | } |
| 1592 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1593 | DEFUN (ospf_area_nssa_translate_no_summary, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1594 | ospf_area_nssa_translate_no_summary_cmd, |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1595 | "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] | 1596 | "OSPF area parameters\n" |
| 1597 | "OSPF area ID in IP address format\n" |
| 1598 | "OSPF area ID as a decimal value\n" |
| 1599 | "Configure OSPF area as nssa\n" |
| 1600 | "Configure NSSA-ABR for translate election (default)\n" |
| 1601 | "Configure NSSA-ABR to never translate\n" |
| 1602 | "Configure NSSA-ABR to always translate\n" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1603 | "Do not inject inter-area routes into nssa\n") |
| 1604 | { |
| 1605 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
| 1606 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1607 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1608 | DEFUN (ospf_area_nssa_translate, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1609 | ospf_area_nssa_translate_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1610 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", |
| 1611 | "OSPF area parameters\n" |
| 1612 | "OSPF area ID in IP address format\n" |
| 1613 | "OSPF area ID as a decimal value\n" |
| 1614 | "Configure OSPF area as nssa\n" |
| 1615 | "Configure NSSA-ABR for translate election (default)\n" |
| 1616 | "Configure NSSA-ABR to never translate\n" |
| 1617 | "Configure NSSA-ABR to always translate\n") |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1618 | { |
| 1619 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1620 | } |
| 1621 | |
| 1622 | DEFUN (ospf_area_nssa, |
| 1623 | ospf_area_nssa_cmd, |
| 1624 | "area (A.B.C.D|<0-4294967295>) nssa", |
| 1625 | "OSPF area parameters\n" |
| 1626 | "OSPF area ID in IP address format\n" |
| 1627 | "OSPF area ID as a decimal value\n" |
| 1628 | "Configure OSPF area as nssa\n") |
| 1629 | { |
| 1630 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1631 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1632 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1633 | DEFUN (ospf_area_nssa_no_summary, |
| 1634 | ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1635 | "area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1636 | "OSPF area parameters\n" |
| 1637 | "OSPF area ID in IP address format\n" |
| 1638 | "OSPF area ID as a decimal value\n" |
| 1639 | "Configure OSPF area as nssa\n" |
| 1640 | "Do not inject inter-area routes into nssa\n") |
| 1641 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1642 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1643 | } |
| 1644 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1645 | DEFUN (no_ospf_area_nssa, |
| 1646 | no_ospf_area_nssa_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1647 | "no area (A.B.C.D|<0-4294967295>) nssa", |
| 1648 | NO_STR |
| 1649 | "OSPF area parameters\n" |
| 1650 | "OSPF area ID in IP address format\n" |
| 1651 | "OSPF area ID as a decimal value\n" |
| 1652 | "Configure OSPF area as nssa\n") |
| 1653 | { |
| 1654 | struct ospf *ospf = vty->index; |
| 1655 | struct in_addr area_id; |
| 1656 | int format; |
| 1657 | |
| 1658 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1659 | |
| 1660 | ospf_area_nssa_unset (ospf, area_id); |
| 1661 | ospf_area_no_summary_unset (ospf, area_id); |
| 1662 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1663 | ospf_schedule_abr_task (ospf); |
| 1664 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1665 | return CMD_SUCCESS; |
| 1666 | } |
| 1667 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1668 | DEFUN (no_ospf_area_nssa_no_summary, |
| 1669 | no_ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1670 | "no area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 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 | "Do not inject inter-area routes into nssa\n") |
| 1677 | { |
| 1678 | struct ospf *ospf = vty->index; |
| 1679 | struct in_addr area_id; |
| 1680 | int format; |
| 1681 | |
| 1682 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1683 | ospf_area_no_summary_unset (ospf, area_id); |
| 1684 | |
| 1685 | return CMD_SUCCESS; |
| 1686 | } |
| 1687 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1688 | DEFUN (ospf_area_default_cost, |
| 1689 | ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1690 | "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1691 | "OSPF area parameters\n" |
| 1692 | "OSPF area ID in IP address format\n" |
| 1693 | "OSPF area ID as a decimal value\n" |
| 1694 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1695 | "Stub's advertised default summary cost\n") |
| 1696 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1697 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1698 | struct ospf_area *area; |
| 1699 | struct in_addr area_id; |
| 1700 | u_int32_t cost; |
| 1701 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1702 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1703 | |
| 1704 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1705 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1706 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1707 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1708 | |
| 1709 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1710 | { |
| 1711 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1712 | return CMD_WARNING; |
| 1713 | } |
| 1714 | |
| 1715 | area->default_cost = cost; |
| 1716 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1717 | p.family = AF_INET; |
| 1718 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1719 | p.prefixlen = 0; |
| 1720 | if (IS_DEBUG_OSPF_EVENT) |
| 1721 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1722 | "announcing 0.0.0.0/0 to area %s", |
| 1723 | inet_ntoa (area->area_id)); |
| 1724 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1725 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1726 | return CMD_SUCCESS; |
| 1727 | } |
| 1728 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1729 | DEFUN (no_ospf_area_default_cost, |
| 1730 | no_ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1731 | "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1732 | NO_STR |
| 1733 | "OSPF area parameters\n" |
| 1734 | "OSPF area ID in IP address format\n" |
| 1735 | "OSPF area ID as a decimal value\n" |
| 1736 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1737 | "Stub's advertised default summary cost\n") |
| 1738 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1739 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1740 | struct ospf_area *area; |
| 1741 | struct in_addr area_id; |
| 1742 | u_int32_t cost; |
| 1743 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1744 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1745 | |
| 1746 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1747 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1748 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1749 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1750 | if (area == NULL) |
| 1751 | return CMD_SUCCESS; |
| 1752 | |
| 1753 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1754 | { |
| 1755 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1756 | return CMD_WARNING; |
| 1757 | } |
| 1758 | |
| 1759 | area->default_cost = 1; |
| 1760 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1761 | p.family = AF_INET; |
| 1762 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1763 | p.prefixlen = 0; |
| 1764 | if (IS_DEBUG_OSPF_EVENT) |
| 1765 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1766 | "announcing 0.0.0.0/0 to area %s", |
| 1767 | inet_ntoa (area->area_id)); |
| 1768 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1769 | |
| 1770 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1771 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1772 | |
| 1773 | return CMD_SUCCESS; |
| 1774 | } |
| 1775 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1776 | DEFUN (ospf_area_export_list, |
| 1777 | ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1778 | "area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1779 | "OSPF area parameters\n" |
| 1780 | "OSPF area ID in IP address format\n" |
| 1781 | "OSPF area ID as a decimal value\n" |
| 1782 | "Set the filter for networks announced to other areas\n" |
| 1783 | "Name of the access-list\n") |
| 1784 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1785 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1786 | struct ospf_area *area; |
| 1787 | struct in_addr area_id; |
| 1788 | int format; |
| 1789 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1790 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1791 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1792 | area = ospf_area_get (ospf, area_id, format); |
| 1793 | ospf_area_export_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1794 | |
| 1795 | return CMD_SUCCESS; |
| 1796 | } |
| 1797 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1798 | DEFUN (no_ospf_area_export_list, |
| 1799 | no_ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1800 | "no area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1801 | NO_STR |
| 1802 | "OSPF area parameters\n" |
| 1803 | "OSPF area ID in IP address format\n" |
| 1804 | "OSPF area ID as a decimal value\n" |
| 1805 | "Unset 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_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1816 | if (area == NULL) |
| 1817 | return CMD_SUCCESS; |
| 1818 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1819 | ospf_area_export_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1820 | |
| 1821 | return CMD_SUCCESS; |
| 1822 | } |
| 1823 | |
| 1824 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1825 | DEFUN (ospf_area_import_list, |
| 1826 | ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1827 | "area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1828 | "OSPF area parameters\n" |
| 1829 | "OSPF area ID in IP address format\n" |
| 1830 | "OSPF area ID as a decimal value\n" |
| 1831 | "Set the filter for networks from other areas announced to the specified one\n" |
| 1832 | "Name of the access-list\n") |
| 1833 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1834 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1835 | struct ospf_area *area; |
| 1836 | struct in_addr area_id; |
| 1837 | int format; |
| 1838 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1839 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1840 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1841 | area = ospf_area_get (ospf, area_id, format); |
| 1842 | ospf_area_import_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1843 | |
| 1844 | return CMD_SUCCESS; |
| 1845 | } |
| 1846 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1847 | DEFUN (no_ospf_area_import_list, |
| 1848 | no_ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1849 | "no area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1850 | NO_STR |
| 1851 | "OSPF area parameters\n" |
| 1852 | "OSPF area ID in IP address format\n" |
| 1853 | "OSPF area ID as a decimal value\n" |
| 1854 | "Unset the filter for networks announced to other areas\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_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1865 | if (area == NULL) |
| 1866 | return CMD_SUCCESS; |
| 1867 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1868 | ospf_area_import_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1869 | |
| 1870 | return CMD_SUCCESS; |
| 1871 | } |
| 1872 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1873 | DEFUN (ospf_area_filter_list, |
| 1874 | ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1875 | "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1876 | "OSPF area parameters\n" |
| 1877 | "OSPF area ID in IP address format\n" |
| 1878 | "OSPF area ID as a decimal value\n" |
| 1879 | "Filter networks between OSPF areas\n" |
| 1880 | "Filter prefixes between OSPF areas\n" |
| 1881 | "Name of an IP prefix-list\n" |
| 1882 | "Filter networks sent to this area\n" |
| 1883 | "Filter networks sent from this area\n") |
| 1884 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1885 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1886 | struct ospf_area *area; |
| 1887 | struct in_addr area_id; |
| 1888 | struct prefix_list *plist; |
| 1889 | int format; |
| 1890 | |
| 1891 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1892 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1893 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1894 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1895 | if (strncmp (argv[2], "in", 2) == 0) |
| 1896 | { |
| 1897 | PREFIX_LIST_IN (area) = plist; |
| 1898 | if (PREFIX_NAME_IN (area)) |
| 1899 | free (PREFIX_NAME_IN (area)); |
| 1900 | |
| 1901 | PREFIX_NAME_IN (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1902 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1903 | } |
| 1904 | else |
| 1905 | { |
| 1906 | PREFIX_LIST_OUT (area) = plist; |
| 1907 | if (PREFIX_NAME_OUT (area)) |
| 1908 | free (PREFIX_NAME_OUT (area)); |
| 1909 | |
| 1910 | PREFIX_NAME_OUT (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1911 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1912 | } |
| 1913 | |
| 1914 | return CMD_SUCCESS; |
| 1915 | } |
| 1916 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1917 | DEFUN (no_ospf_area_filter_list, |
| 1918 | no_ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1919 | "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1920 | NO_STR |
| 1921 | "OSPF area parameters\n" |
| 1922 | "OSPF area ID in IP address format\n" |
| 1923 | "OSPF area ID as a decimal value\n" |
| 1924 | "Filter networks between OSPF areas\n" |
| 1925 | "Filter prefixes between OSPF areas\n" |
| 1926 | "Name of an IP prefix-list\n" |
| 1927 | "Filter networks sent to this area\n" |
| 1928 | "Filter networks sent from this area\n") |
| 1929 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1930 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1931 | struct ospf_area *area; |
| 1932 | struct in_addr area_id; |
| 1933 | struct prefix_list *plist; |
| 1934 | int format; |
| 1935 | |
| 1936 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1937 | |
Paul Jakma | 1a8ec2b | 2006-05-11 13:34:08 +0000 | [diff] [blame] | 1938 | if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) |
| 1939 | return CMD_SUCCESS; |
| 1940 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1941 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1942 | if (strncmp (argv[2], "in", 2) == 0) |
| 1943 | { |
| 1944 | if (PREFIX_NAME_IN (area)) |
| 1945 | if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) |
| 1946 | return CMD_SUCCESS; |
| 1947 | |
| 1948 | PREFIX_LIST_IN (area) = NULL; |
| 1949 | if (PREFIX_NAME_IN (area)) |
| 1950 | free (PREFIX_NAME_IN (area)); |
| 1951 | |
| 1952 | PREFIX_NAME_IN (area) = NULL; |
| 1953 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1954 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1955 | } |
| 1956 | else |
| 1957 | { |
| 1958 | if (PREFIX_NAME_OUT (area)) |
| 1959 | if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) |
| 1960 | return CMD_SUCCESS; |
| 1961 | |
| 1962 | PREFIX_LIST_OUT (area) = NULL; |
| 1963 | if (PREFIX_NAME_OUT (area)) |
| 1964 | free (PREFIX_NAME_OUT (area)); |
| 1965 | |
| 1966 | PREFIX_NAME_OUT (area) = NULL; |
| 1967 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1968 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1969 | } |
| 1970 | |
| 1971 | return CMD_SUCCESS; |
| 1972 | } |
| 1973 | |
| 1974 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1975 | DEFUN (ospf_area_authentication_message_digest, |
| 1976 | ospf_area_authentication_message_digest_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1977 | "area (A.B.C.D|<0-4294967295>) authentication message-digest", |
| 1978 | "OSPF area parameters\n" |
| 1979 | "Enable authentication\n" |
| 1980 | "Use message-digest authentication\n") |
| 1981 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1982 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1983 | struct ospf_area *area; |
| 1984 | struct in_addr area_id; |
| 1985 | int format; |
| 1986 | |
| 1987 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1988 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1989 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1990 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1991 | |
| 1992 | return CMD_SUCCESS; |
| 1993 | } |
| 1994 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1995 | DEFUN (ospf_area_authentication, |
| 1996 | ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1997 | "area (A.B.C.D|<0-4294967295>) authentication", |
| 1998 | "OSPF area parameters\n" |
| 1999 | "OSPF area ID in IP address format\n" |
| 2000 | "OSPF area ID as a decimal value\n" |
| 2001 | "Enable authentication\n") |
| 2002 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2003 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2004 | struct ospf_area *area; |
| 2005 | struct in_addr area_id; |
| 2006 | int format; |
| 2007 | |
| 2008 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2009 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2010 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2011 | area->auth_type = OSPF_AUTH_SIMPLE; |
| 2012 | |
| 2013 | return CMD_SUCCESS; |
| 2014 | } |
| 2015 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2016 | DEFUN (no_ospf_area_authentication, |
| 2017 | no_ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2018 | "no area (A.B.C.D|<0-4294967295>) authentication", |
| 2019 | NO_STR |
| 2020 | "OSPF area parameters\n" |
| 2021 | "OSPF area ID in IP address format\n" |
| 2022 | "OSPF area ID as a decimal value\n" |
| 2023 | "Enable authentication\n") |
| 2024 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2025 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2026 | struct ospf_area *area; |
| 2027 | struct in_addr area_id; |
| 2028 | int format; |
| 2029 | |
| 2030 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2031 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2032 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2033 | if (area == NULL) |
| 2034 | return CMD_SUCCESS; |
| 2035 | |
| 2036 | area->auth_type = OSPF_AUTH_NULL; |
| 2037 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2038 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2039 | |
| 2040 | return CMD_SUCCESS; |
| 2041 | } |
| 2042 | |
| 2043 | |
| 2044 | DEFUN (ospf_abr_type, |
| 2045 | ospf_abr_type_cmd, |
| 2046 | "ospf abr-type (cisco|ibm|shortcut|standard)", |
| 2047 | "OSPF specific commands\n" |
| 2048 | "Set OSPF ABR type\n" |
| 2049 | "Alternative ABR, cisco implementation\n" |
| 2050 | "Alternative ABR, IBM implementation\n" |
| 2051 | "Shortcut ABR\n" |
| 2052 | "Standard behavior (RFC2328)\n") |
| 2053 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2054 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2055 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2056 | |
| 2057 | if (strncmp (argv[0], "c", 1) == 0) |
| 2058 | abr_type = OSPF_ABR_CISCO; |
| 2059 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2060 | abr_type = OSPF_ABR_IBM; |
| 2061 | else if (strncmp (argv[0], "sh", 2) == 0) |
| 2062 | abr_type = OSPF_ABR_SHORTCUT; |
| 2063 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2064 | abr_type = OSPF_ABR_STAND; |
| 2065 | else |
| 2066 | return CMD_WARNING; |
| 2067 | |
| 2068 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2069 | if (ospf->abr_type != abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2070 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2071 | ospf->abr_type = abr_type; |
| 2072 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2073 | } |
| 2074 | |
| 2075 | return CMD_SUCCESS; |
| 2076 | } |
| 2077 | |
| 2078 | DEFUN (no_ospf_abr_type, |
| 2079 | no_ospf_abr_type_cmd, |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2080 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2081 | NO_STR |
| 2082 | "OSPF specific commands\n" |
| 2083 | "Set OSPF ABR type\n" |
| 2084 | "Alternative ABR, cisco implementation\n" |
| 2085 | "Alternative ABR, IBM implementation\n" |
| 2086 | "Shortcut ABR\n") |
| 2087 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2088 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2089 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2090 | |
| 2091 | if (strncmp (argv[0], "c", 1) == 0) |
| 2092 | abr_type = OSPF_ABR_CISCO; |
| 2093 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2094 | abr_type = OSPF_ABR_IBM; |
Francesco Dolcini | 04d2331 | 2009-06-02 18:20:09 +0100 | [diff] [blame] | 2095 | else if (strncmp (argv[0], "sh", 2) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2096 | abr_type = OSPF_ABR_SHORTCUT; |
Francesco Dolcini | 04d2331 | 2009-06-02 18:20:09 +0100 | [diff] [blame] | 2097 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2098 | abr_type = OSPF_ABR_STAND; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2099 | else |
| 2100 | return CMD_WARNING; |
| 2101 | |
| 2102 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2103 | if (ospf->abr_type == abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2104 | { |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2105 | ospf->abr_type = OSPF_ABR_DEFAULT; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2106 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2107 | } |
| 2108 | |
| 2109 | return CMD_SUCCESS; |
| 2110 | } |
| 2111 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 2112 | DEFUN (ospf_log_adjacency_changes, |
| 2113 | ospf_log_adjacency_changes_cmd, |
| 2114 | "log-adjacency-changes", |
| 2115 | "Log changes in adjacency state\n") |
| 2116 | { |
| 2117 | struct ospf *ospf = vty->index; |
| 2118 | |
| 2119 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2120 | return CMD_SUCCESS; |
| 2121 | } |
| 2122 | |
| 2123 | DEFUN (ospf_log_adjacency_changes_detail, |
| 2124 | ospf_log_adjacency_changes_detail_cmd, |
| 2125 | "log-adjacency-changes detail", |
| 2126 | "Log changes in adjacency state\n" |
| 2127 | "Log all state changes\n") |
| 2128 | { |
| 2129 | struct ospf *ospf = vty->index; |
| 2130 | |
| 2131 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2132 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2133 | return CMD_SUCCESS; |
| 2134 | } |
| 2135 | |
| 2136 | DEFUN (no_ospf_log_adjacency_changes, |
| 2137 | no_ospf_log_adjacency_changes_cmd, |
| 2138 | "no log-adjacency-changes", |
| 2139 | NO_STR |
| 2140 | "Log changes in adjacency state\n") |
| 2141 | { |
| 2142 | struct ospf *ospf = vty->index; |
| 2143 | |
| 2144 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2145 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2146 | return CMD_SUCCESS; |
| 2147 | } |
| 2148 | |
| 2149 | DEFUN (no_ospf_log_adjacency_changes_detail, |
| 2150 | no_ospf_log_adjacency_changes_detail_cmd, |
| 2151 | "no log-adjacency-changes detail", |
| 2152 | NO_STR |
| 2153 | "Log changes in adjacency state\n" |
| 2154 | "Log all state changes\n") |
| 2155 | { |
| 2156 | struct ospf *ospf = vty->index; |
| 2157 | |
| 2158 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2159 | return CMD_SUCCESS; |
| 2160 | } |
| 2161 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2162 | DEFUN (ospf_compatible_rfc1583, |
| 2163 | ospf_compatible_rfc1583_cmd, |
| 2164 | "compatible rfc1583", |
| 2165 | "OSPF compatibility list\n" |
| 2166 | "compatible with RFC 1583\n") |
| 2167 | { |
| 2168 | struct ospf *ospf = vty->index; |
| 2169 | |
| 2170 | if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2171 | { |
| 2172 | SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2173 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2174 | } |
| 2175 | return CMD_SUCCESS; |
| 2176 | } |
| 2177 | |
| 2178 | DEFUN (no_ospf_compatible_rfc1583, |
| 2179 | no_ospf_compatible_rfc1583_cmd, |
| 2180 | "no compatible rfc1583", |
| 2181 | NO_STR |
| 2182 | "OSPF compatibility list\n" |
| 2183 | "compatible with RFC 1583\n") |
| 2184 | { |
| 2185 | struct ospf *ospf = vty->index; |
| 2186 | |
| 2187 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2188 | { |
| 2189 | UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2190 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2191 | } |
| 2192 | return CMD_SUCCESS; |
| 2193 | } |
| 2194 | |
| 2195 | ALIAS (ospf_compatible_rfc1583, |
| 2196 | ospf_rfc1583_flag_cmd, |
| 2197 | "ospf rfc1583compatibility", |
| 2198 | "OSPF specific commands\n" |
| 2199 | "Enable the RFC1583Compatibility flag\n") |
| 2200 | |
| 2201 | ALIAS (no_ospf_compatible_rfc1583, |
| 2202 | no_ospf_rfc1583_flag_cmd, |
| 2203 | "no ospf rfc1583compatibility", |
| 2204 | NO_STR |
| 2205 | "OSPF specific commands\n" |
| 2206 | "Disable the RFC1583Compatibility flag\n") |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2207 | |
| 2208 | static int |
| 2209 | ospf_timers_spf_set (struct vty *vty, unsigned int delay, |
| 2210 | unsigned int hold, |
| 2211 | unsigned int max) |
| 2212 | { |
| 2213 | struct ospf *ospf = vty->index; |
| 2214 | |
| 2215 | ospf->spf_delay = delay; |
| 2216 | ospf->spf_holdtime = hold; |
| 2217 | ospf->spf_max_holdtime = max; |
| 2218 | |
| 2219 | return CMD_SUCCESS; |
| 2220 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2221 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2222 | DEFUN (ospf_timers_throttle_spf, |
| 2223 | ospf_timers_throttle_spf_cmd, |
| 2224 | "timers throttle spf <0-600000> <0-600000> <0-600000>", |
| 2225 | "Adjust routing timers\n" |
| 2226 | "Throttling adaptive timer\n" |
| 2227 | "OSPF SPF timers\n" |
| 2228 | "Delay (msec) from first change received till SPF calculation\n" |
| 2229 | "Initial hold time (msec) between consecutive SPF calculations\n" |
| 2230 | "Maximum hold time (msec)\n") |
| 2231 | { |
| 2232 | unsigned int delay, hold, max; |
| 2233 | |
| 2234 | if (argc != 3) |
| 2235 | { |
| 2236 | vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); |
| 2237 | return CMD_WARNING; |
| 2238 | } |
| 2239 | |
| 2240 | VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); |
| 2241 | VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); |
| 2242 | VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); |
| 2243 | |
| 2244 | return ospf_timers_spf_set (vty, delay, hold, max); |
| 2245 | } |
| 2246 | |
| 2247 | DEFUN_DEPRECATED (ospf_timers_spf, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2248 | ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2249 | "timers spf <0-4294967295> <0-4294967295>", |
| 2250 | "Adjust routing timers\n" |
| 2251 | "OSPF SPF timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2252 | "Delay (s) between receiving a change to SPF calculation\n" |
| 2253 | "Hold time (s) between consecutive SPF calculations\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2254 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2255 | unsigned int delay, hold; |
| 2256 | |
| 2257 | if (argc != 2) |
| 2258 | { |
| 2259 | vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); |
| 2260 | return CMD_WARNING; |
| 2261 | } |
| 2262 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2263 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
| 2264 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2265 | |
| 2266 | /* truncate down the second values if they're greater than 600000ms */ |
| 2267 | if (delay > (600000 / 1000)) |
| 2268 | delay = 600000; |
| 2269 | else if (delay == 0) |
| 2270 | /* 0s delay was probably specified because of lack of ms resolution */ |
| 2271 | delay = OSPF_SPF_DELAY_DEFAULT; |
| 2272 | if (hold > (600000 / 1000)) |
| 2273 | hold = 600000; |
| 2274 | |
| 2275 | return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2276 | } |
| 2277 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2278 | DEFUN (no_ospf_timers_throttle_spf, |
| 2279 | no_ospf_timers_throttle_spf_cmd, |
| 2280 | "no timers throttle spf", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2281 | NO_STR |
| 2282 | "Adjust routing timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2283 | "Throttling adaptive timer\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2284 | "OSPF SPF timers\n") |
| 2285 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2286 | return ospf_timers_spf_set (vty, |
| 2287 | OSPF_SPF_DELAY_DEFAULT, |
| 2288 | OSPF_SPF_HOLDTIME_DEFAULT, |
| 2289 | OSPF_SPF_MAX_HOLDTIME_DEFAULT); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2290 | } |
| 2291 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2292 | ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, |
| 2293 | no_ospf_timers_spf_cmd, |
| 2294 | "no timers spf", |
| 2295 | NO_STR |
| 2296 | "Adjust routing timers\n" |
| 2297 | "OSPF SPF timers\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2298 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2299 | DEFUN (ospf_neighbor, |
| 2300 | ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2301 | "neighbor A.B.C.D", |
| 2302 | NEIGHBOR_STR |
| 2303 | "Neighbor IP address\n") |
| 2304 | { |
| 2305 | struct ospf *ospf = vty->index; |
| 2306 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2307 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2308 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2309 | |
| 2310 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2311 | |
| 2312 | if (argc > 1) |
| 2313 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); |
| 2314 | |
| 2315 | if (argc > 2) |
| 2316 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); |
| 2317 | |
| 2318 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2319 | if (argc > 1) |
| 2320 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2321 | if (argc > 2) |
| 2322 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, priority); |
| 2323 | |
| 2324 | return CMD_SUCCESS; |
| 2325 | } |
| 2326 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2327 | ALIAS (ospf_neighbor, |
| 2328 | ospf_neighbor_priority_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2329 | "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2330 | NEIGHBOR_STR |
| 2331 | "Neighbor IP address\n" |
| 2332 | "Neighbor Priority\n" |
| 2333 | "Priority\n" |
| 2334 | "Dead Neighbor Polling interval\n" |
| 2335 | "Seconds\n") |
| 2336 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2337 | ALIAS (ospf_neighbor, |
| 2338 | ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2339 | "neighbor A.B.C.D priority <0-255>", |
| 2340 | NEIGHBOR_STR |
| 2341 | "Neighbor IP address\n" |
| 2342 | "Neighbor Priority\n" |
| 2343 | "Seconds\n") |
| 2344 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2345 | DEFUN (ospf_neighbor_poll_interval, |
| 2346 | ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2347 | "neighbor A.B.C.D poll-interval <1-65535>", |
| 2348 | NEIGHBOR_STR |
| 2349 | "Neighbor IP address\n" |
| 2350 | "Dead Neighbor Polling interval\n" |
| 2351 | "Seconds\n") |
| 2352 | { |
| 2353 | struct ospf *ospf = vty->index; |
| 2354 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2355 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2356 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2357 | |
| 2358 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2359 | |
| 2360 | if (argc > 1) |
| 2361 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); |
| 2362 | |
| 2363 | if (argc > 2) |
| 2364 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); |
| 2365 | |
| 2366 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2367 | if (argc > 1) |
| 2368 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); |
| 2369 | if (argc > 2) |
| 2370 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2371 | |
| 2372 | return CMD_SUCCESS; |
| 2373 | } |
| 2374 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2375 | ALIAS (ospf_neighbor_poll_interval, |
| 2376 | ospf_neighbor_poll_interval_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2377 | "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", |
| 2378 | NEIGHBOR_STR |
| 2379 | "Neighbor address\n" |
| 2380 | "OSPF dead-router polling interval\n" |
| 2381 | "Seconds\n" |
| 2382 | "OSPF priority of non-broadcast neighbor\n" |
| 2383 | "Priority\n") |
| 2384 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2385 | DEFUN (no_ospf_neighbor, |
| 2386 | no_ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2387 | "no neighbor A.B.C.D", |
| 2388 | NO_STR |
| 2389 | NEIGHBOR_STR |
| 2390 | "Neighbor IP address\n") |
| 2391 | { |
| 2392 | struct ospf *ospf = vty->index; |
| 2393 | struct in_addr nbr_addr; |
| 2394 | int ret; |
| 2395 | |
| 2396 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2397 | |
| 2398 | ret = ospf_nbr_nbma_unset (ospf, nbr_addr); |
| 2399 | |
| 2400 | return CMD_SUCCESS; |
| 2401 | } |
| 2402 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2403 | ALIAS (no_ospf_neighbor, |
| 2404 | no_ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2405 | "no neighbor A.B.C.D priority <0-255>", |
| 2406 | NO_STR |
| 2407 | NEIGHBOR_STR |
| 2408 | "Neighbor IP address\n" |
| 2409 | "Neighbor Priority\n" |
| 2410 | "Priority\n") |
| 2411 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2412 | ALIAS (no_ospf_neighbor, |
| 2413 | no_ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2414 | "no neighbor A.B.C.D poll-interval <1-65535>", |
| 2415 | NO_STR |
| 2416 | NEIGHBOR_STR |
| 2417 | "Neighbor IP address\n" |
| 2418 | "Dead Neighbor Polling interval\n" |
| 2419 | "Seconds\n") |
| 2420 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2421 | ALIAS (no_ospf_neighbor, |
| 2422 | no_ospf_neighbor_priority_pollinterval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2423 | "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2424 | NO_STR |
| 2425 | NEIGHBOR_STR |
| 2426 | "Neighbor IP address\n" |
| 2427 | "Neighbor Priority\n" |
| 2428 | "Priority\n" |
| 2429 | "Dead Neighbor Polling interval\n" |
| 2430 | "Seconds\n") |
| 2431 | |
| 2432 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2433 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2434 | "refresh timer <10-1800>", |
| 2435 | "Adjust refresh parameters\n" |
| 2436 | "Set refresh timer\n" |
| 2437 | "Timer value in seconds\n") |
| 2438 | { |
| 2439 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2440 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2441 | |
| 2442 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2443 | interval = (interval / 10) * 10; |
| 2444 | |
| 2445 | ospf_timers_refresh_set (ospf, interval); |
| 2446 | |
| 2447 | return CMD_SUCCESS; |
| 2448 | } |
| 2449 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2450 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2451 | "no refresh timer <10-1800>", |
| 2452 | "Adjust refresh parameters\n" |
| 2453 | "Unset refresh timer\n" |
| 2454 | "Timer value in seconds\n") |
| 2455 | { |
| 2456 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2457 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2458 | |
| 2459 | if (argc == 1) |
| 2460 | { |
| 2461 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2462 | |
| 2463 | if (ospf->lsa_refresh_interval != interval || |
| 2464 | interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
| 2465 | return CMD_SUCCESS; |
| 2466 | } |
| 2467 | |
| 2468 | ospf_timers_refresh_unset (ospf); |
| 2469 | |
| 2470 | return CMD_SUCCESS; |
| 2471 | } |
| 2472 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2473 | ALIAS (no_ospf_refresh_timer, |
| 2474 | no_ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2475 | "no refresh timer", |
| 2476 | "Adjust refresh parameters\n" |
| 2477 | "Unset refresh timer\n") |
| 2478 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2479 | DEFUN (ospf_auto_cost_reference_bandwidth, |
| 2480 | ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2481 | "auto-cost reference-bandwidth <1-4294967>", |
| 2482 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2483 | "Use reference bandwidth method to assign OSPF cost\n" |
| 2484 | "The reference bandwidth in terms of Mbits per second\n") |
| 2485 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2486 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2487 | u_int32_t refbw; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2488 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2489 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2490 | |
| 2491 | refbw = strtol (argv[0], NULL, 10); |
| 2492 | if (refbw < 1 || refbw > 4294967) |
| 2493 | { |
| 2494 | vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); |
| 2495 | return CMD_WARNING; |
| 2496 | } |
| 2497 | |
| 2498 | /* If reference bandwidth is changed. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2499 | if ((refbw * 1000) == ospf->ref_bandwidth) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2500 | return CMD_SUCCESS; |
| 2501 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2502 | ospf->ref_bandwidth = refbw * 1000; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2503 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 2504 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2505 | |
| 2506 | return CMD_SUCCESS; |
| 2507 | } |
| 2508 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2509 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
| 2510 | no_ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2511 | "no auto-cost reference-bandwidth", |
| 2512 | NO_STR |
| 2513 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2514 | "Use reference bandwidth method to assign OSPF cost\n") |
| 2515 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2516 | struct ospf *ospf = vty->index; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2517 | struct listnode *node, *nnode; |
| 2518 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2519 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2520 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2521 | return CMD_SUCCESS; |
| 2522 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2523 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2524 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
| 2525 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); |
| 2526 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2527 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
| 2528 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2529 | |
| 2530 | return CMD_SUCCESS; |
| 2531 | } |
| 2532 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2533 | const char *ospf_abr_type_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2534 | { |
| 2535 | "Unknown", |
| 2536 | "Standard (RFC2328)", |
| 2537 | "Alternative IBM", |
| 2538 | "Alternative Cisco", |
| 2539 | "Alternative Shortcut" |
| 2540 | }; |
| 2541 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2542 | const char *ospf_shortcut_mode_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2543 | { |
| 2544 | "Default", |
| 2545 | "Enabled", |
| 2546 | "Disabled" |
| 2547 | }; |
| 2548 | |
| 2549 | |
| 2550 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2551 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2552 | show_ip_ospf_area (struct vty *vty, struct ospf_area *area) |
| 2553 | { |
| 2554 | /* Show Area ID. */ |
| 2555 | vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); |
| 2556 | |
| 2557 | /* Show Area type/mode. */ |
| 2558 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 2559 | vty_out (vty, " (Backbone)%s", VTY_NEWLINE); |
| 2560 | else |
| 2561 | { |
| 2562 | if (area->external_routing == OSPF_AREA_STUB) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2563 | vty_out (vty, " (Stub%s%s)", |
| 2564 | area->no_summary ? ", no summary" : "", |
| 2565 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2566 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2567 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 2568 | vty_out (vty, " (NSSA%s%s)", |
| 2569 | area->no_summary ? ", no summary" : "", |
| 2570 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2571 | |
| 2572 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2573 | vty_out (vty, " Shortcutting mode: %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2574 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2575 | vty_out (vty, ", S-bit consensus: %s%s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2576 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2577 | } |
| 2578 | |
| 2579 | /* Show number of interfaces. */ |
| 2580 | vty_out (vty, " Number of interfaces in this area: Total: %d, " |
| 2581 | "Active: %d%s", listcount (area->oiflist), |
| 2582 | area->act_ints, VTY_NEWLINE); |
| 2583 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2584 | if (area->external_routing == OSPF_AREA_NSSA) |
| 2585 | { |
| 2586 | 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] | 2587 | if (! IS_OSPF_ABR (area->ospf)) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2588 | vty_out (vty, " It is not ABR, therefore not Translator. %s", |
| 2589 | VTY_NEWLINE); |
| 2590 | else if (area->NSSATranslatorState) |
| 2591 | { |
| 2592 | vty_out (vty, " We are an ABR and "); |
| 2593 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2594 | vty_out (vty, "the NSSA Elected Translator. %s", |
| 2595 | VTY_NEWLINE); |
| 2596 | else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) |
| 2597 | vty_out (vty, "always an NSSA Translator. %s", |
| 2598 | VTY_NEWLINE); |
| 2599 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2600 | else |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2601 | { |
| 2602 | vty_out (vty, " We are an ABR, but "); |
| 2603 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2604 | vty_out (vty, "not the NSSA Elected Translator. %s", |
| 2605 | VTY_NEWLINE); |
| 2606 | else |
hasso | c6b8781 | 2004-12-22 13:09:59 +0000 | [diff] [blame] | 2607 | vty_out (vty, "never an NSSA Translator. %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2608 | VTY_NEWLINE); |
| 2609 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2610 | } |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2611 | /* Stub-router state for this area */ |
| 2612 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
| 2613 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2614 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2615 | vty_out (vty, " Originating stub / maximum-distance Router-LSA%s", |
| 2616 | VTY_NEWLINE); |
| 2617 | if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 2618 | vty_out (vty, " Administratively activated (indefinitely)%s", |
| 2619 | VTY_NEWLINE); |
| 2620 | if (area->t_stub_router) |
| 2621 | vty_out (vty, " Active from startup, %s remaining%s", |
| 2622 | ospf_timer_dump (area->t_stub_router, timebuf, |
| 2623 | sizeof(timebuf)), VTY_NEWLINE); |
| 2624 | } |
| 2625 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2626 | /* Show number of fully adjacent neighbors. */ |
| 2627 | vty_out (vty, " Number of fully adjacent neighbors in this area:" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2628 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2629 | |
| 2630 | /* Show authentication type. */ |
| 2631 | vty_out (vty, " Area has "); |
| 2632 | if (area->auth_type == OSPF_AUTH_NULL) |
| 2633 | vty_out (vty, "no authentication%s", VTY_NEWLINE); |
| 2634 | else if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 2635 | vty_out (vty, "simple password authentication%s", VTY_NEWLINE); |
| 2636 | else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC) |
| 2637 | vty_out (vty, "message digest authentication%s", VTY_NEWLINE); |
| 2638 | |
| 2639 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 2640 | vty_out (vty, " Number of full virtual adjacencies going through" |
| 2641 | " this area: %d%s", area->full_vls, VTY_NEWLINE); |
| 2642 | |
| 2643 | /* Show SPF calculation times. */ |
| 2644 | vty_out (vty, " SPF algorithm executed %d times%s", |
| 2645 | area->spf_calculation, VTY_NEWLINE); |
| 2646 | |
| 2647 | /* Show number of LSA. */ |
| 2648 | vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE); |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2649 | vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s", |
| 2650 | ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA), |
| 2651 | ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE); |
| 2652 | vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s", |
| 2653 | ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA), |
| 2654 | ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE); |
| 2655 | vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2656 | ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA), |
| 2657 | ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE); |
| 2658 | vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2659 | ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA), |
| 2660 | ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE); |
| 2661 | vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s", |
| 2662 | ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA), |
| 2663 | ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE); |
| 2664 | #ifdef HAVE_OPAQUE_LSA |
| 2665 | vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s", |
| 2666 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA), |
| 2667 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE); |
| 2668 | vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s", |
| 2669 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA), |
| 2670 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE); |
| 2671 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2672 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2673 | } |
| 2674 | |
| 2675 | DEFUN (show_ip_ospf, |
| 2676 | show_ip_ospf_cmd, |
| 2677 | "show ip ospf", |
| 2678 | SHOW_STR |
| 2679 | IP_STR |
| 2680 | "OSPF information\n") |
| 2681 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2682 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2683 | struct ospf_area * area; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2684 | struct ospf *ospf; |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2685 | struct timeval result; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2686 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2687 | |
| 2688 | /* Check OSPF is enable. */ |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2689 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2690 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2691 | { |
| 2692 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2693 | return CMD_SUCCESS; |
| 2694 | } |
| 2695 | |
| 2696 | /* Show Router ID. */ |
| 2697 | vty_out (vty, " OSPF Routing Process, Router ID: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2698 | inet_ntoa (ospf->router_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2699 | VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2700 | |
| 2701 | /* Graceful shutdown */ |
paul | c9c93d5 | 2005-11-26 13:31:11 +0000 | [diff] [blame] | 2702 | if (ospf->t_deferred_shutdown) |
| 2703 | vty_out (vty, " Deferred shutdown in progress, %s remaining%s", |
| 2704 | ospf_timer_dump (ospf->t_deferred_shutdown, |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2705 | timebuf, sizeof (timebuf)), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2706 | /* Show capability. */ |
| 2707 | vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE); |
| 2708 | vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE); |
| 2709 | vty_out (vty, " RFC1583Compatibility flag is %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2710 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2711 | "enabled" : "disabled", VTY_NEWLINE); |
| 2712 | #ifdef HAVE_OPAQUE_LSA |
| 2713 | vty_out (vty, " OpaqueCapability flag is %s%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2714 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2715 | "enabled" : "disabled", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2716 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2717 | " (origination blocked)" : "", |
| 2718 | VTY_NEWLINE); |
| 2719 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2720 | |
| 2721 | /* Show stub-router configuration */ |
| 2722 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED |
| 2723 | || ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2724 | { |
| 2725 | vty_out (vty, " Stub router advertisement is configured%s", |
| 2726 | VTY_NEWLINE); |
| 2727 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2728 | vty_out (vty, " Enabled for %us after start-up%s", |
| 2729 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 2730 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2731 | vty_out (vty, " Enabled for %us prior to full shutdown%s", |
| 2732 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 2733 | } |
| 2734 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2735 | /* Show SPF timers. */ |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2736 | vty_out (vty, " Initial SPF scheduling delay %d millisec(s)%s" |
| 2737 | " Minimum hold time between consecutive SPFs %d millisec(s)%s" |
| 2738 | " Maximum hold time between consecutive SPFs %d millisec(s)%s" |
| 2739 | " Hold time multiplier is currently %d%s", |
| 2740 | ospf->spf_delay, VTY_NEWLINE, |
| 2741 | ospf->spf_holdtime, VTY_NEWLINE, |
| 2742 | ospf->spf_max_holdtime, VTY_NEWLINE, |
| 2743 | ospf->spf_hold_multiplier, VTY_NEWLINE); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2744 | vty_out (vty, " SPF algorithm "); |
| 2745 | if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec) |
| 2746 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 2747 | result = tv_sub (recent_relative_time (), ospf->ts_spf); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2748 | vty_out (vty, "last executed %s ago%s", |
| 2749 | ospf_timeval_dump (&result, timebuf, sizeof (timebuf)), |
| 2750 | VTY_NEWLINE); |
| 2751 | } |
| 2752 | else |
| 2753 | vty_out (vty, "has not been run%s", VTY_NEWLINE); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2754 | vty_out (vty, " SPF timer %s%s%s", |
| 2755 | (ospf->t_spf_calc ? "due in " : "is "), |
| 2756 | ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)), |
| 2757 | VTY_NEWLINE); |
| 2758 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2759 | /* Show refresh parameters. */ |
| 2760 | vty_out (vty, " Refresh timer %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2761 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2762 | |
| 2763 | /* Show ABR/ASBR flags. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2764 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2765 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2766 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2767 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2768 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2769 | vty_out (vty, " This router is an ASBR " |
| 2770 | "(injecting external routing information)%s", VTY_NEWLINE); |
| 2771 | |
| 2772 | /* Show Number of AS-external-LSAs. */ |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2773 | vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s", |
| 2774 | ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), |
| 2775 | ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE); |
| 2776 | #ifdef HAVE_OPAQUE_LSA |
| 2777 | vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s", |
| 2778 | ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA), |
| 2779 | ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE); |
| 2780 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2781 | /* Show number of areas attached. */ |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 2782 | vty_out (vty, " Number of areas attached to this router: %d%s", |
| 2783 | listcount (ospf->areas), VTY_NEWLINE); |
| 2784 | |
| 2785 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 2786 | { |
| 2787 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 2788 | vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE); |
| 2789 | else |
| 2790 | vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE); |
| 2791 | } |
| 2792 | |
| 2793 | vty_out (vty, "%s",VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2794 | |
| 2795 | /* Show each area status. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2796 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 2797 | show_ip_ospf_area (vty, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2798 | |
| 2799 | return CMD_SUCCESS; |
| 2800 | } |
| 2801 | |
| 2802 | |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2803 | static void |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2804 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
| 2805 | struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2806 | { |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2807 | int is_up; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2808 | struct ospf_neighbor *nbr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2809 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2810 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2811 | /* Is interface up? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2812 | vty_out (vty, "%s is %s%s", ifp->name, |
| 2813 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 2814 | vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s", |
| 2815 | ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), |
| 2816 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2817 | |
| 2818 | /* Is interface OSPF enabled? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2819 | if (ospf_oi_count(ifp) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2820 | { |
| 2821 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); |
| 2822 | return; |
| 2823 | } |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2824 | else if (!is_up) |
| 2825 | { |
| 2826 | vty_out (vty, " OSPF is enabled, but not running on this interface%s", |
| 2827 | VTY_NEWLINE); |
| 2828 | return; |
| 2829 | } |
| 2830 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2831 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 2832 | { |
| 2833 | struct ospf_interface *oi = rn->info; |
| 2834 | |
| 2835 | if (oi == NULL) |
| 2836 | continue; |
| 2837 | |
| 2838 | /* Show OSPF interface information. */ |
| 2839 | vty_out (vty, " Internet Address %s/%d,", |
| 2840 | inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen); |
| 2841 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 2842 | if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
| 2843 | { |
| 2844 | struct in_addr *dest; |
| 2845 | const char *dstr; |
| 2846 | |
Andrew J. Schorr | e452963 | 2006-12-12 19:18:21 +0000 | [diff] [blame] | 2847 | if (CONNECTED_PEER(oi->connected) |
| 2848 | || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 2849 | dstr = "Peer"; |
| 2850 | else |
| 2851 | dstr = "Broadcast"; |
| 2852 | |
| 2853 | /* For Vlinks, showing the peer address is probably more |
| 2854 | * informative than the local interface that is being used |
| 2855 | */ |
| 2856 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) |
| 2857 | dest = &oi->vl_data->peer_addr; |
| 2858 | else |
| 2859 | dest = &oi->connected->destination->u.prefix4; |
| 2860 | |
| 2861 | vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest)); |
| 2862 | } |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 2863 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2864 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
| 2865 | VTY_NEWLINE); |
| 2866 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2867 | vty_out (vty, " MTU mismatch detection:%s%s", |
| 2868 | OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE); |
| 2869 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2870 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2871 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2872 | oi->output_cost, VTY_NEWLINE); |
| 2873 | |
| 2874 | vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s", |
| 2875 | OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state), |
| 2876 | PRIORITY (oi), VTY_NEWLINE); |
| 2877 | |
| 2878 | /* Show DR information. */ |
| 2879 | if (DR (oi).s_addr == 0) |
| 2880 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2881 | else |
| 2882 | { |
| 2883 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi)); |
| 2884 | if (nbr == NULL) |
| 2885 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2886 | else |
| 2887 | { |
| 2888 | vty_out (vty, " Designated Router (ID) %s,", |
| 2889 | inet_ntoa (nbr->router_id)); |
| 2890 | vty_out (vty, " Interface Address %s%s", |
| 2891 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2892 | } |
| 2893 | } |
| 2894 | |
| 2895 | /* Show BDR information. */ |
| 2896 | if (BDR (oi).s_addr == 0) |
| 2897 | vty_out (vty, " No backup designated router on this network%s", |
| 2898 | VTY_NEWLINE); |
| 2899 | else |
| 2900 | { |
| 2901 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi)); |
| 2902 | if (nbr == NULL) |
| 2903 | vty_out (vty, " No backup designated router on this network%s", |
| 2904 | VTY_NEWLINE); |
| 2905 | else |
| 2906 | { |
| 2907 | vty_out (vty, " Backup Designated Router (ID) %s,", |
| 2908 | inet_ntoa (nbr->router_id)); |
| 2909 | vty_out (vty, " Interface Address %s%s", |
| 2910 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2911 | } |
| 2912 | } |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2913 | |
| 2914 | vty_out (vty, " Multicast group memberships:"); |
Paul Jakma | 429ac78 | 2006-06-15 18:40:49 +0000 | [diff] [blame] | 2915 | if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS) |
| 2916 | || OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) |
| 2917 | { |
| 2918 | if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)) |
| 2919 | vty_out (vty, " OSPFAllRouters"); |
| 2920 | if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) |
| 2921 | vty_out (vty, " OSPFDesignatedRouters"); |
| 2922 | } |
| 2923 | else |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2924 | vty_out (vty, " <None>"); |
| 2925 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2926 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2927 | vty_out (vty, " Timer intervals configured,"); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2928 | vty_out (vty, " Hello "); |
| 2929 | if (OSPF_IF_PARAM (oi, fast_hello) == 0) |
| 2930 | vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello)); |
| 2931 | else |
| 2932 | vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello)); |
| 2933 | vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s", |
| 2934 | OSPF_IF_PARAM (oi, v_wait), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2935 | OSPF_IF_PARAM (oi, v_wait), |
| 2936 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 2937 | VTY_NEWLINE); |
| 2938 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 2939 | if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_ACTIVE) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2940 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2941 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2942 | vty_out (vty, " Hello due in %s%s", |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2943 | ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)), |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2944 | VTY_NEWLINE); |
| 2945 | } |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 2946 | else /* passive-interface is set */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2947 | vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); |
| 2948 | |
| 2949 | vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2950 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2951 | VTY_NEWLINE); |
| 2952 | } |
| 2953 | } |
| 2954 | |
| 2955 | DEFUN (show_ip_ospf_interface, |
| 2956 | show_ip_ospf_interface_cmd, |
| 2957 | "show ip ospf interface [INTERFACE]", |
| 2958 | SHOW_STR |
| 2959 | IP_STR |
| 2960 | "OSPF information\n" |
| 2961 | "Interface information\n" |
| 2962 | "Interface name\n") |
| 2963 | { |
| 2964 | struct interface *ifp; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2965 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2966 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2967 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2968 | ospf = ospf_lookup (); |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 2969 | if (ospf == NULL) |
| 2970 | { |
| 2971 | vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2972 | return CMD_SUCCESS; |
| 2973 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2974 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2975 | /* Show All Interfaces. */ |
| 2976 | if (argc == 0) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2977 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 2978 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2979 | /* Interface name is specified. */ |
| 2980 | else |
| 2981 | { |
| 2982 | if ((ifp = if_lookup_by_name (argv[0])) == NULL) |
| 2983 | vty_out (vty, "No such interface name%s", VTY_NEWLINE); |
| 2984 | else |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2985 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2986 | } |
| 2987 | |
| 2988 | return CMD_SUCCESS; |
| 2989 | } |
| 2990 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2991 | static void |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2992 | show_ip_ospf_neighbour_header (struct vty *vty) |
| 2993 | { |
| 2994 | vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s", |
| 2995 | VTY_NEWLINE, |
| 2996 | "Neighbor ID", "Pri", "State", "Dead Time", |
| 2997 | "Address", "Interface", "RXmtL", "RqstL", "DBsmL", |
| 2998 | VTY_NEWLINE); |
| 2999 | } |
| 3000 | |
| 3001 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3002 | show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) |
| 3003 | { |
| 3004 | struct route_node *rn; |
| 3005 | struct ospf_neighbor *nbr; |
| 3006 | char msgbuf[16]; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3007 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3008 | |
| 3009 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3010 | if ((nbr = rn->info)) |
| 3011 | /* Do not show myself. */ |
| 3012 | if (nbr != oi->nbr_self) |
| 3013 | /* Down state is not shown. */ |
| 3014 | if (nbr->state != NSM_Down) |
| 3015 | { |
| 3016 | ospf_nbr_state_message (nbr, msgbuf, 16); |
| 3017 | |
| 3018 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3019 | vty_out (vty, "%-15s %3d %-15s ", |
| 3020 | "-", nbr->priority, |
| 3021 | msgbuf); |
| 3022 | else |
| 3023 | vty_out (vty, "%-15s %3d %-15s ", |
| 3024 | inet_ntoa (nbr->router_id), nbr->priority, |
| 3025 | msgbuf); |
| 3026 | |
| 3027 | vty_out (vty, "%9s ", |
| 3028 | ospf_timer_dump (nbr->t_inactivity, timebuf, |
| 3029 | sizeof(timebuf))); |
| 3030 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3031 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3032 | vty_out (vty, "%-20s %5ld %5ld %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3033 | IF_NAME (oi), ospf_ls_retransmit_count (nbr), |
| 3034 | ospf_ls_request_count (nbr), ospf_db_summary_count (nbr), |
| 3035 | VTY_NEWLINE); |
| 3036 | } |
| 3037 | } |
| 3038 | |
| 3039 | DEFUN (show_ip_ospf_neighbor, |
| 3040 | show_ip_ospf_neighbor_cmd, |
| 3041 | "show ip ospf neighbor", |
| 3042 | SHOW_STR |
| 3043 | IP_STR |
| 3044 | "OSPF information\n" |
| 3045 | "Neighbor list\n") |
| 3046 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3047 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3048 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3049 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3050 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3051 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3052 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3053 | { |
| 3054 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3055 | return CMD_SUCCESS; |
| 3056 | } |
| 3057 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3058 | show_ip_ospf_neighbour_header (vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3059 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3060 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3061 | show_ip_ospf_neighbor_sub (vty, oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3062 | |
| 3063 | return CMD_SUCCESS; |
| 3064 | } |
| 3065 | |
| 3066 | DEFUN (show_ip_ospf_neighbor_all, |
| 3067 | show_ip_ospf_neighbor_all_cmd, |
| 3068 | "show ip ospf neighbor all", |
| 3069 | SHOW_STR |
| 3070 | IP_STR |
| 3071 | "OSPF information\n" |
| 3072 | "Neighbor list\n" |
| 3073 | "include down status neighbor\n") |
| 3074 | { |
Joakim Tjernlund | 35f8914 | 2008-07-01 16:54:07 +0200 | [diff] [blame] | 3075 | struct ospf *ospf = ospf_lookup (); |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3076 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3077 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3078 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3079 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3080 | { |
| 3081 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3082 | return CMD_SUCCESS; |
| 3083 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3084 | |
| 3085 | show_ip_ospf_neighbour_header (vty); |
| 3086 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3087 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3088 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3089 | struct listnode *nbr_node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3090 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3091 | |
| 3092 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3093 | |
| 3094 | /* print Down neighbor status */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3095 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3096 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3097 | if (nbr_nbma->nbr == NULL |
| 3098 | || nbr_nbma->nbr->state == NSM_Down) |
| 3099 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3100 | vty_out (vty, "%-15s %3d %-15s %9s ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3101 | "-", nbr_nbma->priority, "Down", "-"); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3102 | vty_out (vty, "%-15s %-20s %5d %5d %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3103 | inet_ntoa (nbr_nbma->addr), IF_NAME (oi), |
| 3104 | 0, 0, 0, VTY_NEWLINE); |
| 3105 | } |
| 3106 | } |
| 3107 | } |
| 3108 | |
| 3109 | return CMD_SUCCESS; |
| 3110 | } |
| 3111 | |
| 3112 | DEFUN (show_ip_ospf_neighbor_int, |
| 3113 | show_ip_ospf_neighbor_int_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3114 | "show ip ospf neighbor IFNAME", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3115 | SHOW_STR |
| 3116 | IP_STR |
| 3117 | "OSPF information\n" |
| 3118 | "Neighbor list\n" |
| 3119 | "Interface name\n") |
| 3120 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3121 | struct ospf *ospf; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3122 | struct interface *ifp; |
| 3123 | struct route_node *rn; |
| 3124 | |
| 3125 | ifp = if_lookup_by_name (argv[0]); |
| 3126 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3127 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3128 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3129 | return CMD_WARNING; |
| 3130 | } |
| 3131 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3132 | ospf = ospf_lookup (); |
| 3133 | if (ospf == NULL) |
| 3134 | { |
| 3135 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3136 | return CMD_SUCCESS; |
| 3137 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3138 | |
| 3139 | show_ip_ospf_neighbour_header (vty); |
| 3140 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3141 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3142 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3143 | struct ospf_interface *oi = rn->info; |
| 3144 | |
| 3145 | if (oi == NULL) |
| 3146 | continue; |
| 3147 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3148 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3149 | } |
| 3150 | |
| 3151 | return CMD_SUCCESS; |
| 3152 | } |
| 3153 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3154 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3155 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3156 | struct ospf_nbr_nbma *nbr_nbma) |
| 3157 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3158 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3159 | |
| 3160 | /* Show neighbor ID. */ |
| 3161 | vty_out (vty, " Neighbor %s,", "-"); |
| 3162 | |
| 3163 | /* Show interface address. */ |
| 3164 | vty_out (vty, " interface address %s%s", |
| 3165 | inet_ntoa (nbr_nbma->addr), VTY_NEWLINE); |
| 3166 | /* Show Area ID. */ |
| 3167 | vty_out (vty, " In the area %s via interface %s%s", |
| 3168 | ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE); |
| 3169 | /* Show neighbor priority and state. */ |
| 3170 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3171 | nbr_nbma->priority, "Down"); |
| 3172 | /* Show state changes. */ |
| 3173 | vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE); |
| 3174 | |
| 3175 | /* Show PollInterval */ |
| 3176 | vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE); |
| 3177 | |
| 3178 | /* Show poll-interval timer. */ |
| 3179 | vty_out (vty, " Poll timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3180 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)), |
| 3181 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3182 | |
| 3183 | /* Show poll-interval timer thread. */ |
| 3184 | vty_out (vty, " Thread Poll Timer %s%s", |
| 3185 | nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); |
| 3186 | } |
| 3187 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3188 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3189 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3190 | struct ospf_neighbor *nbr) |
| 3191 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3192 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3193 | |
| 3194 | /* Show neighbor ID. */ |
| 3195 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
| 3196 | vty_out (vty, " Neighbor %s,", "-"); |
| 3197 | else |
| 3198 | vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id)); |
| 3199 | |
| 3200 | /* Show interface address. */ |
| 3201 | vty_out (vty, " interface address %s%s", |
| 3202 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 3203 | /* Show Area ID. */ |
| 3204 | vty_out (vty, " In the area %s via interface %s%s", |
| 3205 | ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE); |
| 3206 | /* Show neighbor priority and state. */ |
| 3207 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3208 | nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state)); |
| 3209 | /* Show state changes. */ |
| 3210 | vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3211 | 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] | 3212 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 3213 | struct timeval res |
| 3214 | = tv_sub (recent_relative_time (), nbr->ts_last_progress); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3215 | vty_out (vty, " Most recent state change statistics:%s", |
| 3216 | VTY_NEWLINE); |
| 3217 | vty_out (vty, " Progressive change %s ago%s", |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3218 | ospf_timeval_dump (&res, timebuf, sizeof(timebuf)), |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3219 | VTY_NEWLINE); |
| 3220 | } |
| 3221 | if (nbr->ts_last_regress.tv_sec || nbr->ts_last_regress.tv_usec) |
| 3222 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 3223 | struct timeval res |
| 3224 | = tv_sub (recent_relative_time (), nbr->ts_last_regress); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3225 | vty_out (vty, " Regressive change %s ago, due to %s%s", |
| 3226 | ospf_timeval_dump (&res, timebuf, sizeof(timebuf)), |
| 3227 | (nbr->last_regress_str ? nbr->last_regress_str : "??"), |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3228 | VTY_NEWLINE); |
| 3229 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3230 | /* Show Designated Rotuer ID. */ |
| 3231 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); |
| 3232 | /* Show Backup Designated Rotuer ID. */ |
| 3233 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); |
| 3234 | /* Show options. */ |
| 3235 | vty_out (vty, " Options %d %s%s", nbr->options, |
| 3236 | ospf_options_dump (nbr->options), VTY_NEWLINE); |
| 3237 | /* Show Router Dead interval timer. */ |
| 3238 | vty_out (vty, " Dead timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3239 | ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)), |
| 3240 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3241 | /* Show Database Summary list. */ |
| 3242 | vty_out (vty, " Database Summary List %d%s", |
| 3243 | ospf_db_summary_count (nbr), VTY_NEWLINE); |
| 3244 | /* Show Link State Request list. */ |
| 3245 | vty_out (vty, " Link State Request List %ld%s", |
| 3246 | ospf_ls_request_count (nbr), VTY_NEWLINE); |
| 3247 | /* Show Link State Retransmission list. */ |
| 3248 | vty_out (vty, " Link State Retransmission List %ld%s", |
| 3249 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); |
| 3250 | /* Show inactivity timer thread. */ |
| 3251 | vty_out (vty, " Thread Inactivity Timer %s%s", |
| 3252 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); |
| 3253 | /* Show Database Description retransmission thread. */ |
| 3254 | vty_out (vty, " Thread Database Description Retransmision %s%s", |
| 3255 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); |
| 3256 | /* Show Link State Request Retransmission thread. */ |
| 3257 | vty_out (vty, " Thread Link State Request Retransmission %s%s", |
| 3258 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); |
| 3259 | /* Show Link State Update Retransmission thread. */ |
| 3260 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", |
| 3261 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); |
| 3262 | } |
| 3263 | |
| 3264 | DEFUN (show_ip_ospf_neighbor_id, |
| 3265 | show_ip_ospf_neighbor_id_cmd, |
| 3266 | "show ip ospf neighbor A.B.C.D", |
| 3267 | SHOW_STR |
| 3268 | IP_STR |
| 3269 | "OSPF information\n" |
| 3270 | "Neighbor list\n" |
| 3271 | "Neighbor ID\n") |
| 3272 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3273 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3274 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3275 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3276 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3277 | struct in_addr router_id; |
| 3278 | int ret; |
| 3279 | |
| 3280 | ret = inet_aton (argv[0], &router_id); |
| 3281 | if (!ret) |
| 3282 | { |
| 3283 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); |
| 3284 | return CMD_WARNING; |
| 3285 | } |
| 3286 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3287 | ospf = ospf_lookup (); |
| 3288 | if (ospf == NULL) |
| 3289 | { |
| 3290 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3291 | return CMD_SUCCESS; |
| 3292 | } |
| 3293 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3294 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3295 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) |
Andrew J. Schorr | 1c066bf | 2006-06-30 16:53:47 +0000 | [diff] [blame] | 3296 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3297 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3298 | return CMD_SUCCESS; |
| 3299 | } |
| 3300 | |
| 3301 | DEFUN (show_ip_ospf_neighbor_detail, |
| 3302 | show_ip_ospf_neighbor_detail_cmd, |
| 3303 | "show ip ospf neighbor detail", |
| 3304 | SHOW_STR |
| 3305 | IP_STR |
| 3306 | "OSPF information\n" |
| 3307 | "Neighbor list\n" |
| 3308 | "detail of all neighbors\n") |
| 3309 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3310 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3311 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3312 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3313 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3314 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3315 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3316 | { |
| 3317 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3318 | return CMD_SUCCESS; |
| 3319 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3320 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3321 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3322 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3323 | struct route_node *rn; |
| 3324 | struct ospf_neighbor *nbr; |
| 3325 | |
| 3326 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3327 | if ((nbr = rn->info)) |
| 3328 | if (nbr != oi->nbr_self) |
| 3329 | if (nbr->state != NSM_Down) |
| 3330 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3331 | } |
| 3332 | |
| 3333 | return CMD_SUCCESS; |
| 3334 | } |
| 3335 | |
| 3336 | DEFUN (show_ip_ospf_neighbor_detail_all, |
| 3337 | show_ip_ospf_neighbor_detail_all_cmd, |
| 3338 | "show ip ospf neighbor detail all", |
| 3339 | SHOW_STR |
| 3340 | IP_STR |
| 3341 | "OSPF information\n" |
| 3342 | "Neighbor list\n" |
| 3343 | "detail of all neighbors\n" |
| 3344 | "include down status neighbor\n") |
| 3345 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3346 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3347 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3348 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3349 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3350 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3351 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3352 | { |
| 3353 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3354 | return CMD_SUCCESS; |
| 3355 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3356 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3357 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3358 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3359 | struct route_node *rn; |
| 3360 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3361 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3362 | |
| 3363 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3364 | if ((nbr = rn->info)) |
| 3365 | if (nbr != oi->nbr_self) |
| 3366 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) |
| 3367 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); |
| 3368 | |
| 3369 | if (oi->type == OSPF_IFTYPE_NBMA) |
| 3370 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3371 | struct listnode *nd; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3372 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3373 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
| 3374 | if (nbr_nbma->nbr == NULL |
| 3375 | || nbr_nbma->nbr->state == NSM_Down) |
| 3376 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3377 | } |
| 3378 | } |
| 3379 | |
| 3380 | return CMD_SUCCESS; |
| 3381 | } |
| 3382 | |
| 3383 | DEFUN (show_ip_ospf_neighbor_int_detail, |
| 3384 | show_ip_ospf_neighbor_int_detail_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3385 | "show ip ospf neighbor IFNAME detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3386 | SHOW_STR |
| 3387 | IP_STR |
| 3388 | "OSPF information\n" |
| 3389 | "Neighbor list\n" |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3390 | "Interface name\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3391 | "detail of all neighbors") |
| 3392 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3393 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3394 | struct ospf_interface *oi; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3395 | struct interface *ifp; |
| 3396 | struct route_node *rn, *nrn; |
| 3397 | struct ospf_neighbor *nbr; |
| 3398 | |
| 3399 | ifp = if_lookup_by_name (argv[0]); |
| 3400 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3401 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3402 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3403 | return CMD_WARNING; |
| 3404 | } |
| 3405 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3406 | ospf = ospf_lookup (); |
| 3407 | if (ospf == NULL) |
| 3408 | { |
| 3409 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3410 | return CMD_SUCCESS; |
| 3411 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3412 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3413 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3414 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 3415 | if ((oi = rn->info)) |
| 3416 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) |
| 3417 | if ((nbr = nrn->info)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3418 | if (nbr != oi->nbr_self) |
| 3419 | if (nbr->state != NSM_Down) |
| 3420 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3421 | |
| 3422 | return CMD_SUCCESS; |
| 3423 | } |
| 3424 | |
| 3425 | |
| 3426 | /* Show functions */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3427 | static int |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3428 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3429 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3430 | struct router_lsa *rl; |
| 3431 | struct summary_lsa *sl; |
| 3432 | struct as_external_lsa *asel; |
| 3433 | struct prefix_ipv4 p; |
| 3434 | |
| 3435 | if (lsa != NULL) |
| 3436 | /* If self option is set, check LSA self flag. */ |
| 3437 | if (self == 0 || IS_LSA_SELF (lsa)) |
| 3438 | { |
| 3439 | /* LSA common part show. */ |
| 3440 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); |
| 3441 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", |
| 3442 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), |
| 3443 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); |
| 3444 | /* LSA specific part show. */ |
| 3445 | switch (lsa->data->type) |
| 3446 | { |
| 3447 | case OSPF_ROUTER_LSA: |
| 3448 | rl = (struct router_lsa *) lsa->data; |
| 3449 | vty_out (vty, " %-d", ntohs (rl->links)); |
| 3450 | break; |
| 3451 | case OSPF_SUMMARY_LSA: |
| 3452 | sl = (struct summary_lsa *) lsa->data; |
| 3453 | |
| 3454 | p.family = AF_INET; |
| 3455 | p.prefix = sl->header.id; |
| 3456 | p.prefixlen = ip_masklen (sl->mask); |
| 3457 | apply_mask_ipv4 (&p); |
| 3458 | |
| 3459 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); |
| 3460 | break; |
| 3461 | case OSPF_AS_EXTERNAL_LSA: |
paul | 551a897 | 2003-05-18 15:22:55 +0000 | [diff] [blame] | 3462 | case OSPF_AS_NSSA_LSA: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3463 | asel = (struct as_external_lsa *) lsa->data; |
| 3464 | |
| 3465 | p.family = AF_INET; |
| 3466 | p.prefix = asel->header.id; |
| 3467 | p.prefixlen = ip_masklen (asel->mask); |
| 3468 | apply_mask_ipv4 (&p); |
| 3469 | |
| 3470 | vty_out (vty, " %s %s/%d [0x%lx]", |
| 3471 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", |
| 3472 | inet_ntoa (p.prefix), p.prefixlen, |
| 3473 | (u_long)ntohl (asel->e[0].route_tag)); |
| 3474 | break; |
| 3475 | case OSPF_NETWORK_LSA: |
| 3476 | case OSPF_ASBR_SUMMARY_LSA: |
| 3477 | #ifdef HAVE_OPAQUE_LSA |
| 3478 | case OSPF_OPAQUE_LINK_LSA: |
| 3479 | case OSPF_OPAQUE_AREA_LSA: |
| 3480 | case OSPF_OPAQUE_AS_LSA: |
| 3481 | #endif /* HAVE_OPAQUE_LSA */ |
| 3482 | default: |
| 3483 | break; |
| 3484 | } |
| 3485 | vty_out (vty, VTY_NEWLINE); |
| 3486 | } |
| 3487 | |
| 3488 | return 0; |
| 3489 | } |
| 3490 | |
Stephen Hemminger | 8b6a15b | 2009-12-03 19:25:04 +0300 | [diff] [blame] | 3491 | static const char *show_database_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3492 | { |
| 3493 | "unknown", |
| 3494 | "Router Link States", |
| 3495 | "Net Link States", |
| 3496 | "Summary Link States", |
| 3497 | "ASBR-Summary Link States", |
| 3498 | "AS External Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3499 | "Group Membership LSA", |
| 3500 | "NSSA-external Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3501 | #ifdef HAVE_OPAQUE_LSA |
| 3502 | "Type-8 LSA", |
| 3503 | "Link-Local Opaque-LSA", |
| 3504 | "Area-Local Opaque-LSA", |
| 3505 | "AS-external Opaque-LSA", |
| 3506 | #endif /* HAVE_OPAQUE_LSA */ |
| 3507 | }; |
| 3508 | |
Stephen Hemminger | 8b6a15b | 2009-12-03 19:25:04 +0300 | [diff] [blame] | 3509 | static const char *show_database_header[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3510 | { |
| 3511 | "", |
| 3512 | "Link ID ADV Router Age Seq# CkSum Link count", |
| 3513 | "Link ID ADV Router Age Seq# CkSum", |
| 3514 | "Link ID ADV Router Age Seq# CkSum Route", |
| 3515 | "Link ID ADV Router Age Seq# CkSum", |
| 3516 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3517 | " --- header for Group Member ----", |
| 3518 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3519 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3520 | " --- type-8 ---", |
| 3521 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3522 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3523 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3524 | #endif /* HAVE_OPAQUE_LSA */ |
| 3525 | }; |
| 3526 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3527 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3528 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
| 3529 | { |
| 3530 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3531 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3532 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3533 | vty_out (vty, " Options: 0x%-2x : %s%s", |
| 3534 | lsa->data->options, |
| 3535 | ospf_options_dump(lsa->data->options), |
| 3536 | VTY_NEWLINE); |
| 3537 | vty_out (vty, " LS Flags: 0x%-2x %s%s", |
paul | 9d52603 | 2003-06-30 22:46:14 +0000 | [diff] [blame] | 3538 | lsa->flags, |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3539 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
| 3540 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3541 | |
| 3542 | if (lsa->data->type == OSPF_ROUTER_LSA) |
| 3543 | { |
| 3544 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); |
| 3545 | |
| 3546 | if (rlsa->flags) |
| 3547 | vty_out (vty, " :%s%s%s%s", |
| 3548 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", |
| 3549 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", |
| 3550 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", |
| 3551 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); |
| 3552 | |
| 3553 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3554 | } |
| 3555 | vty_out (vty, " LS Type: %s%s", |
| 3556 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3557 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), |
| 3558 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3559 | vty_out (vty, " Advertising Router: %s%s", |
| 3560 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3561 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), |
| 3562 | VTY_NEWLINE); |
| 3563 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), |
| 3564 | VTY_NEWLINE); |
| 3565 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); |
| 3566 | } |
| 3567 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3568 | const char *link_type_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3569 | { |
| 3570 | "(null)", |
| 3571 | "another Router (point-to-point)", |
| 3572 | "a Transit Network", |
| 3573 | "Stub Network", |
| 3574 | "a Virtual Link", |
| 3575 | }; |
| 3576 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3577 | const char *link_id_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3578 | { |
| 3579 | "(null)", |
| 3580 | "Neighboring Router ID", |
| 3581 | "Designated Router address", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3582 | "Net", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3583 | "Neighboring Router ID", |
| 3584 | }; |
| 3585 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3586 | const char *link_data_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3587 | { |
| 3588 | "(null)", |
| 3589 | "Router Interface address", |
| 3590 | "Router Interface address", |
| 3591 | "Network Mask", |
| 3592 | "Router Interface address", |
| 3593 | }; |
| 3594 | |
| 3595 | /* Show router-LSA each Link information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3596 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3597 | show_ip_ospf_database_router_links (struct vty *vty, |
| 3598 | struct router_lsa *rl) |
| 3599 | { |
| 3600 | int len, i, type; |
| 3601 | |
| 3602 | len = ntohs (rl->header.length) - 4; |
| 3603 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) |
| 3604 | { |
| 3605 | type = rl->link[i].type; |
| 3606 | |
| 3607 | vty_out (vty, " Link connected to: %s%s", |
| 3608 | link_type_desc[type], VTY_NEWLINE); |
| 3609 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], |
| 3610 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); |
| 3611 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], |
| 3612 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); |
| 3613 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); |
| 3614 | vty_out (vty, " TOS 0 Metric: %d%s", |
| 3615 | ntohs (rl->link[i].metric), VTY_NEWLINE); |
| 3616 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3617 | } |
| 3618 | } |
| 3619 | |
| 3620 | /* Show router-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3621 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3622 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3623 | { |
| 3624 | if (lsa != NULL) |
| 3625 | { |
| 3626 | struct router_lsa *rl = (struct router_lsa *) lsa->data; |
| 3627 | |
| 3628 | show_ip_ospf_database_header (vty, lsa); |
| 3629 | |
| 3630 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), |
| 3631 | VTY_NEWLINE, VTY_NEWLINE); |
| 3632 | |
| 3633 | show_ip_ospf_database_router_links (vty, rl); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3634 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3635 | } |
| 3636 | |
| 3637 | return 0; |
| 3638 | } |
| 3639 | |
| 3640 | /* Show network-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3641 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3642 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3643 | { |
| 3644 | int length, i; |
| 3645 | |
| 3646 | if (lsa != NULL) |
| 3647 | { |
| 3648 | struct network_lsa *nl = (struct network_lsa *) lsa->data; |
| 3649 | |
| 3650 | show_ip_ospf_database_header (vty, lsa); |
| 3651 | |
| 3652 | vty_out (vty, " Network Mask: /%d%s", |
| 3653 | ip_masklen (nl->mask), VTY_NEWLINE); |
| 3654 | |
| 3655 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; |
| 3656 | |
| 3657 | for (i = 0; length > 0; i++, length -= 4) |
| 3658 | vty_out (vty, " Attached Router: %s%s", |
| 3659 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); |
| 3660 | |
| 3661 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3662 | } |
| 3663 | |
| 3664 | return 0; |
| 3665 | } |
| 3666 | |
| 3667 | /* Show summary-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3668 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3669 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3670 | { |
| 3671 | if (lsa != NULL) |
| 3672 | { |
| 3673 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3674 | |
| 3675 | show_ip_ospf_database_header (vty, lsa); |
| 3676 | |
| 3677 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), |
| 3678 | VTY_NEWLINE); |
| 3679 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3680 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3681 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3682 | } |
| 3683 | |
| 3684 | return 0; |
| 3685 | } |
| 3686 | |
| 3687 | /* Show summary-ASBR-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3688 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3689 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3690 | { |
| 3691 | if (lsa != NULL) |
| 3692 | { |
| 3693 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3694 | |
| 3695 | show_ip_ospf_database_header (vty, lsa); |
| 3696 | |
| 3697 | vty_out (vty, " Network Mask: /%d%s", |
| 3698 | ip_masklen (sl->mask), VTY_NEWLINE); |
| 3699 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3700 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3701 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3702 | } |
| 3703 | |
| 3704 | return 0; |
| 3705 | } |
| 3706 | |
| 3707 | /* Show AS-external-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3708 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3709 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3710 | { |
| 3711 | if (lsa != NULL) |
| 3712 | { |
| 3713 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3714 | |
| 3715 | show_ip_ospf_database_header (vty, lsa); |
| 3716 | |
| 3717 | vty_out (vty, " Network Mask: /%d%s", |
| 3718 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3719 | vty_out (vty, " Metric Type: %s%s", |
| 3720 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3721 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3722 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3723 | vty_out (vty, " Metric: %d%s", |
| 3724 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3725 | vty_out (vty, " Forward Address: %s%s", |
| 3726 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3727 | |
| 3728 | vty_out (vty, " External Route Tag: %lu%s%s", |
| 3729 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3730 | } |
| 3731 | |
| 3732 | return 0; |
| 3733 | } |
| 3734 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3735 | /* N.B. This function currently seems to be unused. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3736 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3737 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
| 3738 | { |
| 3739 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3740 | |
| 3741 | /* show_ip_ospf_database_header (vty, lsa); */ |
| 3742 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3743 | zlog_debug( " Network Mask: /%d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3744 | ip_masklen (al->mask), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3745 | zlog_debug( " Metric Type: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3746 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3747 | "2 (Larger than any link state path)" : "1", "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3748 | zlog_debug( " TOS: 0%s", "\n"); |
| 3749 | zlog_debug( " Metric: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3750 | GET_METRIC (al->e[0].metric), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3751 | zlog_debug( " Forward Address: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3752 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
| 3753 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3754 | zlog_debug( " External Route Tag: %u%s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3755 | ntohl (al->e[0].route_tag), "\n", "\n"); |
| 3756 | |
| 3757 | return 0; |
| 3758 | } |
| 3759 | |
| 3760 | /* Show AS-NSSA-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3761 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3762 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3763 | { |
| 3764 | if (lsa != NULL) |
| 3765 | { |
| 3766 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3767 | |
| 3768 | show_ip_ospf_database_header (vty, lsa); |
| 3769 | |
| 3770 | vty_out (vty, " Network Mask: /%d%s", |
| 3771 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3772 | vty_out (vty, " Metric Type: %s%s", |
| 3773 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3774 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3775 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3776 | vty_out (vty, " Metric: %d%s", |
| 3777 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3778 | vty_out (vty, " NSSA: Forward Address: %s%s", |
| 3779 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3780 | |
| 3781 | vty_out (vty, " External Route Tag: %u%s%s", |
| 3782 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3783 | } |
| 3784 | |
| 3785 | return 0; |
| 3786 | } |
| 3787 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3788 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3789 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
| 3790 | { |
| 3791 | return 0; |
| 3792 | } |
| 3793 | |
| 3794 | #ifdef HAVE_OPAQUE_LSA |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3795 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3796 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3797 | { |
| 3798 | if (lsa != NULL) |
| 3799 | { |
| 3800 | show_ip_ospf_database_header (vty, lsa); |
| 3801 | show_opaque_info_detail (vty, lsa); |
| 3802 | |
| 3803 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3804 | } |
| 3805 | return 0; |
| 3806 | } |
| 3807 | #endif /* HAVE_OPAQUE_LSA */ |
| 3808 | |
| 3809 | int (*show_function[])(struct vty *, struct ospf_lsa *) = |
| 3810 | { |
| 3811 | NULL, |
| 3812 | show_router_lsa_detail, |
| 3813 | show_network_lsa_detail, |
| 3814 | show_summary_lsa_detail, |
| 3815 | show_summary_asbr_lsa_detail, |
| 3816 | show_as_external_lsa_detail, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3817 | show_func_dummy, |
| 3818 | show_as_nssa_lsa_detail, /* almost same as external */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3819 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3820 | NULL, /* type-8 */ |
| 3821 | show_opaque_lsa_detail, |
| 3822 | show_opaque_lsa_detail, |
| 3823 | show_opaque_lsa_detail, |
| 3824 | #endif /* HAVE_OPAQUE_LSA */ |
| 3825 | }; |
| 3826 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3827 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3828 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
| 3829 | struct in_addr *adv_router) |
| 3830 | { |
| 3831 | memset (lp, 0, sizeof (struct prefix_ls)); |
| 3832 | lp->family = 0; |
| 3833 | if (id == NULL) |
| 3834 | lp->prefixlen = 0; |
| 3835 | else if (adv_router == NULL) |
| 3836 | { |
| 3837 | lp->prefixlen = 32; |
| 3838 | lp->id = *id; |
| 3839 | } |
| 3840 | else |
| 3841 | { |
| 3842 | lp->prefixlen = 64; |
| 3843 | lp->id = *id; |
| 3844 | lp->adv_router = *adv_router; |
| 3845 | } |
| 3846 | } |
| 3847 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3848 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3849 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
| 3850 | struct in_addr *id, struct in_addr *adv_router) |
| 3851 | { |
| 3852 | struct prefix_ls lp; |
| 3853 | struct route_node *rn, *start; |
| 3854 | struct ospf_lsa *lsa; |
| 3855 | |
| 3856 | show_lsa_prefix_set (vty, &lp, id, adv_router); |
| 3857 | start = route_node_get (rt, (struct prefix *) &lp); |
| 3858 | if (start) |
| 3859 | { |
| 3860 | route_lock_node (start); |
| 3861 | for (rn = start; rn; rn = route_next_until (rn, start)) |
| 3862 | if ((lsa = rn->info)) |
| 3863 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3864 | if (show_function[lsa->data->type] != NULL) |
| 3865 | show_function[lsa->data->type] (vty, lsa); |
| 3866 | } |
| 3867 | route_unlock_node (start); |
| 3868 | } |
| 3869 | } |
| 3870 | |
| 3871 | /* Show detail LSA information |
| 3872 | -- if id is NULL then show all LSAs. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3873 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3874 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3875 | struct in_addr *id, struct in_addr *adv_router) |
| 3876 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3877 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3878 | struct ospf_area *area; |
| 3879 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3880 | switch (type) |
| 3881 | { |
| 3882 | case OSPF_AS_EXTERNAL_LSA: |
| 3883 | #ifdef HAVE_OPAQUE_LSA |
| 3884 | case OSPF_OPAQUE_AS_LSA: |
| 3885 | #endif /* HAVE_OPAQUE_LSA */ |
| 3886 | vty_out (vty, " %s %s%s", |
| 3887 | show_database_desc[type], |
| 3888 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3889 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3890 | break; |
| 3891 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3892 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3893 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3894 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3895 | VTY_NEWLINE, show_database_desc[type], |
| 3896 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3897 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); |
| 3898 | } |
| 3899 | break; |
| 3900 | } |
| 3901 | } |
| 3902 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3903 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3904 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
| 3905 | struct in_addr *adv_router) |
| 3906 | { |
| 3907 | struct route_node *rn; |
| 3908 | struct ospf_lsa *lsa; |
| 3909 | |
| 3910 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 3911 | if ((lsa = rn->info)) |
| 3912 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) |
| 3913 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3914 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
| 3915 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3916 | if (show_function[lsa->data->type] != NULL) |
| 3917 | show_function[lsa->data->type] (vty, lsa); |
| 3918 | } |
| 3919 | } |
| 3920 | |
| 3921 | /* Show detail LSA information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3922 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3923 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3924 | struct in_addr *adv_router) |
| 3925 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3926 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3927 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3928 | |
| 3929 | switch (type) |
| 3930 | { |
| 3931 | case OSPF_AS_EXTERNAL_LSA: |
| 3932 | #ifdef HAVE_OPAQUE_LSA |
| 3933 | case OSPF_OPAQUE_AS_LSA: |
| 3934 | #endif /* HAVE_OPAQUE_LSA */ |
| 3935 | vty_out (vty, " %s %s%s", |
| 3936 | show_database_desc[type], |
| 3937 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3938 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3939 | adv_router); |
| 3940 | break; |
| 3941 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3942 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3943 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3944 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3945 | VTY_NEWLINE, show_database_desc[type], |
| 3946 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3947 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), |
| 3948 | adv_router); |
| 3949 | } |
| 3950 | break; |
| 3951 | } |
| 3952 | } |
| 3953 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3954 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3955 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3956 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3957 | struct ospf_lsa *lsa; |
| 3958 | struct route_node *rn; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3959 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3960 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3961 | int type; |
| 3962 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3963 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3964 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3965 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3966 | { |
| 3967 | switch (type) |
| 3968 | { |
| 3969 | case OSPF_AS_EXTERNAL_LSA: |
| 3970 | #ifdef HAVE_OPAQUE_LSA |
| 3971 | case OSPF_OPAQUE_AS_LSA: |
| 3972 | #endif /* HAVE_OPAQUE_LSA */ |
| 3973 | continue; |
| 3974 | default: |
| 3975 | break; |
| 3976 | } |
| 3977 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || |
| 3978 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) |
| 3979 | { |
| 3980 | vty_out (vty, " %s (Area %s)%s%s", |
| 3981 | show_database_desc[type], |
| 3982 | ospf_area_desc_string (area), |
| 3983 | VTY_NEWLINE, VTY_NEWLINE); |
| 3984 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); |
| 3985 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3986 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
| 3987 | show_lsa_summary (vty, lsa, self); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3988 | |
| 3989 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3990 | } |
| 3991 | } |
| 3992 | } |
| 3993 | |
| 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 */ |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4002 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4003 | default: |
| 4004 | continue; |
| 4005 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4006 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
| 4007 | (!self && ospf_lsdb_count (ospf->lsdb, type))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4008 | { |
| 4009 | vty_out (vty, " %s%s%s", |
| 4010 | show_database_desc[type], |
| 4011 | VTY_NEWLINE, VTY_NEWLINE); |
| 4012 | vty_out (vty, "%s%s", show_database_header[type], |
| 4013 | VTY_NEWLINE); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4014 | |
| 4015 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) |
| 4016 | show_lsa_summary (vty, lsa, self); |
| 4017 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4018 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4019 | } |
| 4020 | } |
| 4021 | |
| 4022 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4023 | } |
| 4024 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4025 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4026 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4027 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 4028 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4029 | struct ospf_lsa *lsa; |
| 4030 | |
| 4031 | vty_out (vty, "%s MaxAge Link States:%s%s", |
| 4032 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); |
| 4033 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4034 | for (ALL_LIST_ELEMENTS_RO (ospf->maxage_lsa, node, lsa)) |
| 4035 | { |
| 4036 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); |
| 4037 | vty_out (vty, "Link State ID: %s%s", |
| 4038 | inet_ntoa (lsa->data->id), VTY_NEWLINE); |
| 4039 | vty_out (vty, "Advertising Router: %s%s", |
| 4040 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 4041 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); |
| 4042 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4043 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4044 | } |
| 4045 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4046 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
| 4047 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4048 | |
| 4049 | #ifdef HAVE_OPAQUE_LSA |
| 4050 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" |
| 4051 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" |
| 4052 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" |
| 4053 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" |
| 4054 | #else /* HAVE_OPAQUE_LSA */ |
| 4055 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" |
| 4056 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" |
| 4057 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" |
| 4058 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" |
| 4059 | #endif /* HAVE_OPAQUE_LSA */ |
| 4060 | |
| 4061 | #define OSPF_LSA_TYPES_CMD_STR \ |
| 4062 | "asbr-summary|external|network|router|summary" \ |
| 4063 | OSPF_LSA_TYPE_NSSA_CMD_STR \ |
| 4064 | OSPF_LSA_TYPE_OPAQUE_CMD_STR |
| 4065 | |
| 4066 | #define OSPF_LSA_TYPES_DESC \ |
| 4067 | "ASBR summary link states\n" \ |
| 4068 | "External link states\n" \ |
| 4069 | "Network link states\n" \ |
| 4070 | "Router link states\n" \ |
| 4071 | "Network summary link states\n" \ |
| 4072 | OSPF_LSA_TYPE_NSSA_DESC \ |
| 4073 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ |
| 4074 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ |
| 4075 | OSPF_LSA_TYPE_OPAQUE_AS_DESC |
| 4076 | |
| 4077 | DEFUN (show_ip_ospf_database, |
| 4078 | show_ip_ospf_database_cmd, |
| 4079 | "show ip ospf database", |
| 4080 | SHOW_STR |
| 4081 | IP_STR |
| 4082 | "OSPF information\n" |
| 4083 | "Database summary\n") |
| 4084 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4085 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4086 | int type, ret; |
| 4087 | struct in_addr id, adv_router; |
| 4088 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4089 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4090 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4091 | { |
| 4092 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4093 | return CMD_SUCCESS; |
| 4094 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4095 | |
| 4096 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4097 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4098 | |
| 4099 | /* Show all LSA. */ |
| 4100 | if (argc == 0) |
| 4101 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4102 | show_ip_ospf_database_summary (vty, ospf, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4103 | return CMD_SUCCESS; |
| 4104 | } |
| 4105 | |
| 4106 | /* Set database type to show. */ |
| 4107 | if (strncmp (argv[0], "r", 1) == 0) |
| 4108 | type = OSPF_ROUTER_LSA; |
| 4109 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4110 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4111 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4112 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4113 | else if (strncmp (argv[0], "su", 2) == 0) |
| 4114 | type = OSPF_SUMMARY_LSA; |
| 4115 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4116 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4117 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4118 | type = OSPF_AS_EXTERNAL_LSA; |
| 4119 | else if (strncmp (argv[0], "se", 2) == 0) |
| 4120 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4121 | show_ip_ospf_database_summary (vty, ospf, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4122 | return CMD_SUCCESS; |
| 4123 | } |
| 4124 | else if (strncmp (argv[0], "m", 1) == 0) |
| 4125 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4126 | show_ip_ospf_database_maxage (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4127 | return CMD_SUCCESS; |
| 4128 | } |
| 4129 | #ifdef HAVE_OPAQUE_LSA |
| 4130 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4131 | type = OSPF_OPAQUE_LINK_LSA; |
| 4132 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4133 | type = OSPF_OPAQUE_AREA_LSA; |
| 4134 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4135 | type = OSPF_OPAQUE_AS_LSA; |
| 4136 | #endif /* HAVE_OPAQUE_LSA */ |
| 4137 | else |
| 4138 | return CMD_WARNING; |
| 4139 | |
| 4140 | /* `show ip ospf database LSA'. */ |
| 4141 | if (argc == 1) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4142 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4143 | else if (argc >= 2) |
| 4144 | { |
| 4145 | ret = inet_aton (argv[1], &id); |
| 4146 | if (!ret) |
| 4147 | return CMD_WARNING; |
| 4148 | |
| 4149 | /* `show ip ospf database LSA ID'. */ |
| 4150 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4151 | show_lsa_detail (vty, ospf, type, &id, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4152 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
| 4153 | else if (argc == 3) |
| 4154 | { |
| 4155 | if (strncmp (argv[2], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4156 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4157 | else |
| 4158 | { |
| 4159 | ret = inet_aton (argv[2], &adv_router); |
| 4160 | if (!ret) |
| 4161 | return CMD_WARNING; |
| 4162 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4163 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4164 | } |
| 4165 | } |
| 4166 | |
| 4167 | return CMD_SUCCESS; |
| 4168 | } |
| 4169 | |
| 4170 | ALIAS (show_ip_ospf_database, |
| 4171 | show_ip_ospf_database_type_cmd, |
| 4172 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", |
| 4173 | SHOW_STR |
| 4174 | IP_STR |
| 4175 | "OSPF information\n" |
| 4176 | "Database summary\n" |
| 4177 | OSPF_LSA_TYPES_DESC |
| 4178 | "LSAs in MaxAge list\n" |
| 4179 | "Self-originated link states\n") |
| 4180 | |
| 4181 | ALIAS (show_ip_ospf_database, |
| 4182 | show_ip_ospf_database_type_id_cmd, |
| 4183 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", |
| 4184 | SHOW_STR |
| 4185 | IP_STR |
| 4186 | "OSPF information\n" |
| 4187 | "Database summary\n" |
| 4188 | OSPF_LSA_TYPES_DESC |
| 4189 | "Link State ID (as an IP address)\n") |
| 4190 | |
| 4191 | ALIAS (show_ip_ospf_database, |
| 4192 | show_ip_ospf_database_type_id_adv_router_cmd, |
| 4193 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", |
| 4194 | SHOW_STR |
| 4195 | IP_STR |
| 4196 | "OSPF information\n" |
| 4197 | "Database summary\n" |
| 4198 | OSPF_LSA_TYPES_DESC |
| 4199 | "Link State ID (as an IP address)\n" |
| 4200 | "Advertising Router link states\n" |
| 4201 | "Advertising Router (as an IP address)\n") |
| 4202 | |
| 4203 | ALIAS (show_ip_ospf_database, |
| 4204 | show_ip_ospf_database_type_id_self_cmd, |
| 4205 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", |
| 4206 | SHOW_STR |
| 4207 | IP_STR |
| 4208 | "OSPF information\n" |
| 4209 | "Database summary\n" |
| 4210 | OSPF_LSA_TYPES_DESC |
| 4211 | "Link State ID (as an IP address)\n" |
| 4212 | "Self-originated link states\n" |
| 4213 | "\n") |
| 4214 | |
| 4215 | DEFUN (show_ip_ospf_database_type_adv_router, |
| 4216 | show_ip_ospf_database_type_adv_router_cmd, |
| 4217 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", |
| 4218 | SHOW_STR |
| 4219 | IP_STR |
| 4220 | "OSPF information\n" |
| 4221 | "Database summary\n" |
| 4222 | OSPF_LSA_TYPES_DESC |
| 4223 | "Advertising Router link states\n" |
| 4224 | "Advertising Router (as an IP address)\n") |
| 4225 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4226 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4227 | int type, ret; |
| 4228 | struct in_addr adv_router; |
| 4229 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4230 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4231 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4232 | { |
| 4233 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4234 | return CMD_SUCCESS; |
| 4235 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4236 | |
| 4237 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4238 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4239 | |
| 4240 | if (argc != 2) |
| 4241 | return CMD_WARNING; |
| 4242 | |
| 4243 | /* Set database type to show. */ |
| 4244 | if (strncmp (argv[0], "r", 1) == 0) |
| 4245 | type = OSPF_ROUTER_LSA; |
| 4246 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4247 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4248 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4249 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4250 | else if (strncmp (argv[0], "s", 1) == 0) |
| 4251 | type = OSPF_SUMMARY_LSA; |
| 4252 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4253 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4254 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4255 | type = OSPF_AS_EXTERNAL_LSA; |
| 4256 | #ifdef HAVE_OPAQUE_LSA |
| 4257 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4258 | type = OSPF_OPAQUE_LINK_LSA; |
| 4259 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4260 | type = OSPF_OPAQUE_AREA_LSA; |
| 4261 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4262 | type = OSPF_OPAQUE_AS_LSA; |
| 4263 | #endif /* HAVE_OPAQUE_LSA */ |
| 4264 | else |
| 4265 | return CMD_WARNING; |
| 4266 | |
| 4267 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ |
| 4268 | if (strncmp (argv[1], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4269 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4270 | else |
| 4271 | { |
| 4272 | ret = inet_aton (argv[1], &adv_router); |
| 4273 | if (!ret) |
| 4274 | return CMD_WARNING; |
| 4275 | } |
| 4276 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4277 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4278 | |
| 4279 | return CMD_SUCCESS; |
| 4280 | } |
| 4281 | |
| 4282 | ALIAS (show_ip_ospf_database_type_adv_router, |
| 4283 | show_ip_ospf_database_type_self_cmd, |
| 4284 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", |
| 4285 | SHOW_STR |
| 4286 | IP_STR |
| 4287 | "OSPF information\n" |
| 4288 | "Database summary\n" |
| 4289 | OSPF_LSA_TYPES_DESC |
| 4290 | "Self-originated link states\n") |
| 4291 | |
| 4292 | |
| 4293 | DEFUN (ip_ospf_authentication_args, |
| 4294 | ip_ospf_authentication_args_addr_cmd, |
| 4295 | "ip ospf authentication (null|message-digest) A.B.C.D", |
| 4296 | "IP Information\n" |
| 4297 | "OSPF interface commands\n" |
| 4298 | "Enable authentication on this interface\n" |
| 4299 | "Use null authentication\n" |
| 4300 | "Use message-digest authentication\n" |
| 4301 | "Address of interface") |
| 4302 | { |
| 4303 | struct interface *ifp; |
| 4304 | struct in_addr addr; |
| 4305 | int ret; |
| 4306 | struct ospf_if_params *params; |
| 4307 | |
| 4308 | ifp = vty->index; |
| 4309 | params = IF_DEF_PARAMS (ifp); |
| 4310 | |
| 4311 | if (argc == 2) |
| 4312 | { |
| 4313 | ret = inet_aton(argv[1], &addr); |
| 4314 | if (!ret) |
| 4315 | { |
| 4316 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4317 | VTY_NEWLINE); |
| 4318 | return CMD_WARNING; |
| 4319 | } |
| 4320 | |
| 4321 | params = ospf_get_if_params (ifp, addr); |
| 4322 | ospf_if_update_params (ifp, addr); |
| 4323 | } |
| 4324 | |
| 4325 | /* Handle null authentication */ |
| 4326 | if ( argv[0][0] == 'n' ) |
| 4327 | { |
| 4328 | SET_IF_PARAM (params, auth_type); |
| 4329 | params->auth_type = OSPF_AUTH_NULL; |
| 4330 | return CMD_SUCCESS; |
| 4331 | } |
| 4332 | |
| 4333 | /* Handle message-digest authentication */ |
| 4334 | if ( argv[0][0] == 'm' ) |
| 4335 | { |
| 4336 | SET_IF_PARAM (params, auth_type); |
| 4337 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 4338 | return CMD_SUCCESS; |
| 4339 | } |
| 4340 | |
| 4341 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); |
| 4342 | return CMD_WARNING; |
| 4343 | } |
| 4344 | |
| 4345 | ALIAS (ip_ospf_authentication_args, |
| 4346 | ip_ospf_authentication_args_cmd, |
| 4347 | "ip ospf authentication (null|message-digest)", |
| 4348 | "IP Information\n" |
| 4349 | "OSPF interface commands\n" |
| 4350 | "Enable authentication on this interface\n" |
| 4351 | "Use null authentication\n" |
| 4352 | "Use message-digest authentication\n") |
| 4353 | |
| 4354 | DEFUN (ip_ospf_authentication, |
| 4355 | ip_ospf_authentication_addr_cmd, |
| 4356 | "ip ospf authentication A.B.C.D", |
| 4357 | "IP Information\n" |
| 4358 | "OSPF interface commands\n" |
| 4359 | "Enable authentication on this interface\n" |
| 4360 | "Address of interface") |
| 4361 | { |
| 4362 | struct interface *ifp; |
| 4363 | struct in_addr addr; |
| 4364 | int ret; |
| 4365 | struct ospf_if_params *params; |
| 4366 | |
| 4367 | ifp = vty->index; |
| 4368 | params = IF_DEF_PARAMS (ifp); |
| 4369 | |
| 4370 | if (argc == 1) |
| 4371 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4372 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4373 | if (!ret) |
| 4374 | { |
| 4375 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4376 | VTY_NEWLINE); |
| 4377 | return CMD_WARNING; |
| 4378 | } |
| 4379 | |
| 4380 | params = ospf_get_if_params (ifp, addr); |
| 4381 | ospf_if_update_params (ifp, addr); |
| 4382 | } |
| 4383 | |
| 4384 | SET_IF_PARAM (params, auth_type); |
| 4385 | params->auth_type = OSPF_AUTH_SIMPLE; |
| 4386 | |
| 4387 | return CMD_SUCCESS; |
| 4388 | } |
| 4389 | |
| 4390 | ALIAS (ip_ospf_authentication, |
| 4391 | ip_ospf_authentication_cmd, |
| 4392 | "ip ospf authentication", |
| 4393 | "IP Information\n" |
| 4394 | "OSPF interface commands\n" |
| 4395 | "Enable authentication on this interface\n") |
| 4396 | |
| 4397 | DEFUN (no_ip_ospf_authentication, |
| 4398 | no_ip_ospf_authentication_addr_cmd, |
| 4399 | "no ip ospf authentication A.B.C.D", |
| 4400 | NO_STR |
| 4401 | "IP Information\n" |
| 4402 | "OSPF interface commands\n" |
| 4403 | "Enable authentication on this interface\n" |
| 4404 | "Address of interface") |
| 4405 | { |
| 4406 | struct interface *ifp; |
| 4407 | struct in_addr addr; |
| 4408 | int ret; |
| 4409 | struct ospf_if_params *params; |
| 4410 | |
| 4411 | ifp = vty->index; |
| 4412 | params = IF_DEF_PARAMS (ifp); |
| 4413 | |
| 4414 | if (argc == 1) |
| 4415 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4416 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4417 | if (!ret) |
| 4418 | { |
| 4419 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4420 | VTY_NEWLINE); |
| 4421 | return CMD_WARNING; |
| 4422 | } |
| 4423 | |
| 4424 | params = ospf_lookup_if_params (ifp, addr); |
| 4425 | if (params == NULL) |
| 4426 | return CMD_SUCCESS; |
| 4427 | } |
| 4428 | |
| 4429 | params->auth_type = OSPF_AUTH_NOTSET; |
| 4430 | UNSET_IF_PARAM (params, auth_type); |
| 4431 | |
| 4432 | if (params != IF_DEF_PARAMS (ifp)) |
| 4433 | { |
| 4434 | ospf_free_if_params (ifp, addr); |
| 4435 | ospf_if_update_params (ifp, addr); |
| 4436 | } |
| 4437 | |
| 4438 | return CMD_SUCCESS; |
| 4439 | } |
| 4440 | |
| 4441 | ALIAS (no_ip_ospf_authentication, |
| 4442 | no_ip_ospf_authentication_cmd, |
| 4443 | "no ip ospf authentication", |
| 4444 | NO_STR |
| 4445 | "IP Information\n" |
| 4446 | "OSPF interface commands\n" |
| 4447 | "Enable authentication on this interface\n") |
| 4448 | |
| 4449 | DEFUN (ip_ospf_authentication_key, |
| 4450 | ip_ospf_authentication_key_addr_cmd, |
| 4451 | "ip ospf authentication-key AUTH_KEY A.B.C.D", |
| 4452 | "IP Information\n" |
| 4453 | "OSPF interface commands\n" |
| 4454 | "Authentication password (key)\n" |
| 4455 | "The OSPF password (key)\n" |
| 4456 | "Address of interface") |
| 4457 | { |
| 4458 | struct interface *ifp; |
| 4459 | struct in_addr addr; |
| 4460 | int ret; |
| 4461 | struct ospf_if_params *params; |
| 4462 | |
| 4463 | ifp = vty->index; |
| 4464 | params = IF_DEF_PARAMS (ifp); |
| 4465 | |
| 4466 | if (argc == 2) |
| 4467 | { |
| 4468 | ret = inet_aton(argv[1], &addr); |
| 4469 | if (!ret) |
| 4470 | { |
| 4471 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4472 | VTY_NEWLINE); |
| 4473 | return CMD_WARNING; |
| 4474 | } |
| 4475 | |
| 4476 | params = ospf_get_if_params (ifp, addr); |
| 4477 | ospf_if_update_params (ifp, addr); |
| 4478 | } |
| 4479 | |
| 4480 | |
| 4481 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4482 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4483 | SET_IF_PARAM (params, auth_simple); |
| 4484 | |
| 4485 | return CMD_SUCCESS; |
| 4486 | } |
| 4487 | |
| 4488 | ALIAS (ip_ospf_authentication_key, |
| 4489 | ip_ospf_authentication_key_cmd, |
| 4490 | "ip ospf authentication-key AUTH_KEY", |
| 4491 | "IP Information\n" |
| 4492 | "OSPF interface commands\n" |
| 4493 | "Authentication password (key)\n" |
| 4494 | "The OSPF password (key)") |
| 4495 | |
| 4496 | ALIAS (ip_ospf_authentication_key, |
| 4497 | ospf_authentication_key_cmd, |
| 4498 | "ospf authentication-key AUTH_KEY", |
| 4499 | "OSPF interface commands\n" |
| 4500 | "Authentication password (key)\n" |
| 4501 | "The OSPF password (key)") |
| 4502 | |
| 4503 | DEFUN (no_ip_ospf_authentication_key, |
| 4504 | no_ip_ospf_authentication_key_addr_cmd, |
| 4505 | "no ip ospf authentication-key A.B.C.D", |
| 4506 | NO_STR |
| 4507 | "IP Information\n" |
| 4508 | "OSPF interface commands\n" |
| 4509 | "Authentication password (key)\n" |
| 4510 | "Address of interface") |
| 4511 | { |
| 4512 | struct interface *ifp; |
| 4513 | struct in_addr addr; |
| 4514 | int ret; |
| 4515 | struct ospf_if_params *params; |
| 4516 | |
| 4517 | ifp = vty->index; |
| 4518 | params = IF_DEF_PARAMS (ifp); |
| 4519 | |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4520 | if (argc == 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4521 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4522 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4523 | if (!ret) |
| 4524 | { |
| 4525 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4526 | VTY_NEWLINE); |
| 4527 | return CMD_WARNING; |
| 4528 | } |
| 4529 | |
| 4530 | params = ospf_lookup_if_params (ifp, addr); |
| 4531 | if (params == NULL) |
| 4532 | return CMD_SUCCESS; |
| 4533 | } |
| 4534 | |
| 4535 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); |
| 4536 | UNSET_IF_PARAM (params, auth_simple); |
| 4537 | |
| 4538 | if (params != IF_DEF_PARAMS (ifp)) |
| 4539 | { |
| 4540 | ospf_free_if_params (ifp, addr); |
| 4541 | ospf_if_update_params (ifp, addr); |
| 4542 | } |
| 4543 | |
| 4544 | return CMD_SUCCESS; |
| 4545 | } |
| 4546 | |
| 4547 | ALIAS (no_ip_ospf_authentication_key, |
| 4548 | no_ip_ospf_authentication_key_cmd, |
| 4549 | "no ip ospf authentication-key", |
| 4550 | NO_STR |
| 4551 | "IP Information\n" |
| 4552 | "OSPF interface commands\n" |
| 4553 | "Authentication password (key)\n") |
| 4554 | |
| 4555 | ALIAS (no_ip_ospf_authentication_key, |
| 4556 | no_ospf_authentication_key_cmd, |
| 4557 | "no ospf authentication-key", |
| 4558 | NO_STR |
| 4559 | "OSPF interface commands\n" |
| 4560 | "Authentication password (key)\n") |
| 4561 | |
| 4562 | DEFUN (ip_ospf_message_digest_key, |
| 4563 | ip_ospf_message_digest_key_addr_cmd, |
| 4564 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", |
| 4565 | "IP Information\n" |
| 4566 | "OSPF interface commands\n" |
| 4567 | "Message digest authentication password (key)\n" |
| 4568 | "Key ID\n" |
| 4569 | "Use MD5 algorithm\n" |
| 4570 | "The OSPF password (key)" |
| 4571 | "Address of interface") |
| 4572 | { |
| 4573 | struct interface *ifp; |
| 4574 | struct crypt_key *ck; |
| 4575 | u_char key_id; |
| 4576 | struct in_addr addr; |
| 4577 | int ret; |
| 4578 | struct ospf_if_params *params; |
| 4579 | |
| 4580 | ifp = vty->index; |
| 4581 | params = IF_DEF_PARAMS (ifp); |
| 4582 | |
| 4583 | if (argc == 3) |
| 4584 | { |
| 4585 | ret = inet_aton(argv[2], &addr); |
| 4586 | if (!ret) |
| 4587 | { |
| 4588 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4589 | VTY_NEWLINE); |
| 4590 | return CMD_WARNING; |
| 4591 | } |
| 4592 | |
| 4593 | params = ospf_get_if_params (ifp, addr); |
| 4594 | ospf_if_update_params (ifp, addr); |
| 4595 | } |
| 4596 | |
| 4597 | key_id = strtol (argv[0], NULL, 10); |
| 4598 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) |
| 4599 | { |
| 4600 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); |
| 4601 | return CMD_WARNING; |
| 4602 | } |
| 4603 | |
| 4604 | ck = ospf_crypt_key_new (); |
| 4605 | ck->key_id = (u_char) key_id; |
| 4606 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4607 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4608 | |
| 4609 | ospf_crypt_key_add (params->auth_crypt, ck); |
| 4610 | SET_IF_PARAM (params, auth_crypt); |
| 4611 | |
| 4612 | return CMD_SUCCESS; |
| 4613 | } |
| 4614 | |
| 4615 | ALIAS (ip_ospf_message_digest_key, |
| 4616 | ip_ospf_message_digest_key_cmd, |
| 4617 | "ip ospf message-digest-key <1-255> md5 KEY", |
| 4618 | "IP Information\n" |
| 4619 | "OSPF interface commands\n" |
| 4620 | "Message digest authentication password (key)\n" |
| 4621 | "Key ID\n" |
| 4622 | "Use MD5 algorithm\n" |
| 4623 | "The OSPF password (key)") |
| 4624 | |
| 4625 | ALIAS (ip_ospf_message_digest_key, |
| 4626 | ospf_message_digest_key_cmd, |
| 4627 | "ospf message-digest-key <1-255> md5 KEY", |
| 4628 | "OSPF interface commands\n" |
| 4629 | "Message digest authentication password (key)\n" |
| 4630 | "Key ID\n" |
| 4631 | "Use MD5 algorithm\n" |
| 4632 | "The OSPF password (key)") |
| 4633 | |
| 4634 | DEFUN (no_ip_ospf_message_digest_key, |
| 4635 | no_ip_ospf_message_digest_key_addr_cmd, |
| 4636 | "no ip ospf message-digest-key <1-255> A.B.C.D", |
| 4637 | NO_STR |
| 4638 | "IP Information\n" |
| 4639 | "OSPF interface commands\n" |
| 4640 | "Message digest authentication password (key)\n" |
| 4641 | "Key ID\n" |
| 4642 | "Address of interface") |
| 4643 | { |
| 4644 | struct interface *ifp; |
| 4645 | struct crypt_key *ck; |
| 4646 | int key_id; |
| 4647 | struct in_addr addr; |
| 4648 | int ret; |
| 4649 | struct ospf_if_params *params; |
| 4650 | |
| 4651 | ifp = vty->index; |
| 4652 | params = IF_DEF_PARAMS (ifp); |
| 4653 | |
| 4654 | if (argc == 2) |
| 4655 | { |
| 4656 | ret = inet_aton(argv[1], &addr); |
| 4657 | if (!ret) |
| 4658 | { |
| 4659 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4660 | VTY_NEWLINE); |
| 4661 | return CMD_WARNING; |
| 4662 | } |
| 4663 | |
| 4664 | params = ospf_lookup_if_params (ifp, addr); |
| 4665 | if (params == NULL) |
| 4666 | return CMD_SUCCESS; |
| 4667 | } |
| 4668 | |
| 4669 | key_id = strtol (argv[0], NULL, 10); |
| 4670 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); |
| 4671 | if (ck == NULL) |
| 4672 | { |
| 4673 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); |
| 4674 | return CMD_WARNING; |
| 4675 | } |
| 4676 | |
| 4677 | ospf_crypt_key_delete (params->auth_crypt, key_id); |
| 4678 | |
| 4679 | if (params != IF_DEF_PARAMS (ifp)) |
| 4680 | { |
| 4681 | ospf_free_if_params (ifp, addr); |
| 4682 | ospf_if_update_params (ifp, addr); |
| 4683 | } |
| 4684 | |
| 4685 | return CMD_SUCCESS; |
| 4686 | } |
| 4687 | |
| 4688 | ALIAS (no_ip_ospf_message_digest_key, |
| 4689 | no_ip_ospf_message_digest_key_cmd, |
| 4690 | "no ip ospf message-digest-key <1-255>", |
| 4691 | NO_STR |
| 4692 | "IP Information\n" |
| 4693 | "OSPF interface commands\n" |
| 4694 | "Message digest authentication password (key)\n" |
| 4695 | "Key ID\n") |
| 4696 | |
| 4697 | ALIAS (no_ip_ospf_message_digest_key, |
| 4698 | no_ospf_message_digest_key_cmd, |
| 4699 | "no ospf message-digest-key <1-255>", |
| 4700 | NO_STR |
| 4701 | "OSPF interface commands\n" |
| 4702 | "Message digest authentication password (key)\n" |
| 4703 | "Key ID\n") |
| 4704 | |
| 4705 | DEFUN (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4706 | ip_ospf_cost_u32_inet4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4707 | "ip ospf cost <1-65535> A.B.C.D", |
| 4708 | "IP Information\n" |
| 4709 | "OSPF interface commands\n" |
| 4710 | "Interface cost\n" |
| 4711 | "Cost\n" |
| 4712 | "Address of interface") |
| 4713 | { |
| 4714 | struct interface *ifp = vty->index; |
| 4715 | u_int32_t cost; |
| 4716 | struct in_addr addr; |
| 4717 | int ret; |
| 4718 | struct ospf_if_params *params; |
| 4719 | |
| 4720 | params = IF_DEF_PARAMS (ifp); |
| 4721 | |
| 4722 | cost = strtol (argv[0], NULL, 10); |
| 4723 | |
| 4724 | /* cost range is <1-65535>. */ |
| 4725 | if (cost < 1 || cost > 65535) |
| 4726 | { |
| 4727 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4728 | return CMD_WARNING; |
| 4729 | } |
| 4730 | |
| 4731 | if (argc == 2) |
| 4732 | { |
| 4733 | ret = inet_aton(argv[1], &addr); |
| 4734 | if (!ret) |
| 4735 | { |
| 4736 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4737 | VTY_NEWLINE); |
| 4738 | return CMD_WARNING; |
| 4739 | } |
| 4740 | |
| 4741 | params = ospf_get_if_params (ifp, addr); |
| 4742 | ospf_if_update_params (ifp, addr); |
| 4743 | } |
| 4744 | |
| 4745 | SET_IF_PARAM (params, output_cost_cmd); |
| 4746 | params->output_cost_cmd = cost; |
| 4747 | |
| 4748 | ospf_if_recalculate_output_cost (ifp); |
| 4749 | |
| 4750 | return CMD_SUCCESS; |
| 4751 | } |
| 4752 | |
| 4753 | ALIAS (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4754 | ip_ospf_cost_u32_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4755 | "ip ospf cost <1-65535>", |
| 4756 | "IP Information\n" |
| 4757 | "OSPF interface commands\n" |
| 4758 | "Interface cost\n" |
| 4759 | "Cost") |
| 4760 | |
| 4761 | ALIAS (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4762 | ospf_cost_u32_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4763 | "ospf cost <1-65535>", |
| 4764 | "OSPF interface commands\n" |
| 4765 | "Interface cost\n" |
| 4766 | "Cost") |
| 4767 | |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4768 | ALIAS (ip_ospf_cost, |
| 4769 | ospf_cost_u32_inet4_cmd, |
| 4770 | "ospf cost <1-65535> A.B.C.D", |
| 4771 | "OSPF interface commands\n" |
| 4772 | "Interface cost\n" |
| 4773 | "Cost\n" |
| 4774 | "Address of interface") |
| 4775 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4776 | DEFUN (no_ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4777 | no_ip_ospf_cost_inet4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4778 | "no ip ospf cost A.B.C.D", |
| 4779 | NO_STR |
| 4780 | "IP Information\n" |
| 4781 | "OSPF interface commands\n" |
| 4782 | "Interface cost\n" |
| 4783 | "Address of interface") |
| 4784 | { |
| 4785 | struct interface *ifp = vty->index; |
| 4786 | struct in_addr addr; |
| 4787 | int ret; |
| 4788 | struct ospf_if_params *params; |
| 4789 | |
| 4790 | ifp = vty->index; |
| 4791 | params = IF_DEF_PARAMS (ifp); |
| 4792 | |
| 4793 | if (argc == 1) |
| 4794 | { |
| 4795 | ret = inet_aton(argv[0], &addr); |
| 4796 | if (!ret) |
| 4797 | { |
| 4798 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4799 | VTY_NEWLINE); |
| 4800 | return CMD_WARNING; |
| 4801 | } |
| 4802 | |
| 4803 | params = ospf_lookup_if_params (ifp, addr); |
| 4804 | if (params == NULL) |
| 4805 | return CMD_SUCCESS; |
| 4806 | } |
| 4807 | |
| 4808 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4809 | |
| 4810 | if (params != IF_DEF_PARAMS (ifp)) |
| 4811 | { |
| 4812 | ospf_free_if_params (ifp, addr); |
| 4813 | ospf_if_update_params (ifp, addr); |
| 4814 | } |
| 4815 | |
| 4816 | ospf_if_recalculate_output_cost (ifp); |
| 4817 | |
| 4818 | return CMD_SUCCESS; |
| 4819 | } |
| 4820 | |
| 4821 | ALIAS (no_ip_ospf_cost, |
| 4822 | no_ip_ospf_cost_cmd, |
| 4823 | "no ip ospf cost", |
| 4824 | NO_STR |
| 4825 | "IP Information\n" |
| 4826 | "OSPF interface commands\n" |
| 4827 | "Interface cost\n") |
| 4828 | |
| 4829 | ALIAS (no_ip_ospf_cost, |
| 4830 | no_ospf_cost_cmd, |
| 4831 | "no ospf cost", |
| 4832 | NO_STR |
| 4833 | "OSPF interface commands\n" |
| 4834 | "Interface cost\n") |
| 4835 | |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4836 | ALIAS (no_ip_ospf_cost, |
| 4837 | no_ospf_cost_inet4_cmd, |
| 4838 | "no ospf cost A.B.C.D", |
| 4839 | NO_STR |
| 4840 | "OSPF interface commands\n" |
| 4841 | "Interface cost\n" |
| 4842 | "Address of interface") |
| 4843 | |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 4844 | DEFUN (no_ip_ospf_cost2, |
| 4845 | no_ip_ospf_cost_u32_cmd, |
| 4846 | "no ip ospf cost <1-65535>", |
| 4847 | NO_STR |
| 4848 | "IP Information\n" |
| 4849 | "OSPF interface commands\n" |
| 4850 | "Interface cost\n" |
| 4851 | "Cost") |
| 4852 | { |
| 4853 | struct interface *ifp = vty->index; |
| 4854 | struct in_addr addr; |
| 4855 | u_int32_t cost; |
| 4856 | int ret; |
| 4857 | struct ospf_if_params *params; |
| 4858 | |
| 4859 | ifp = vty->index; |
| 4860 | params = IF_DEF_PARAMS (ifp); |
| 4861 | |
| 4862 | /* According to the semantics we are mimicking "no ip ospf cost N" is |
| 4863 | * always treated as "no ip ospf cost" regardless of the actual value |
| 4864 | * of N already configured for the interface. Thus the first argument |
| 4865 | * is always checked to be a number, but is ignored after that. |
| 4866 | */ |
| 4867 | cost = strtol (argv[0], NULL, 10); |
| 4868 | if (cost < 1 || cost > 65535) |
| 4869 | { |
| 4870 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4871 | return CMD_WARNING; |
| 4872 | } |
| 4873 | |
| 4874 | if (argc == 2) |
| 4875 | { |
| 4876 | ret = inet_aton(argv[1], &addr); |
| 4877 | if (!ret) |
| 4878 | { |
| 4879 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4880 | VTY_NEWLINE); |
| 4881 | return CMD_WARNING; |
| 4882 | } |
| 4883 | |
| 4884 | params = ospf_lookup_if_params (ifp, addr); |
| 4885 | if (params == NULL) |
| 4886 | return CMD_SUCCESS; |
| 4887 | } |
| 4888 | |
| 4889 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4890 | |
| 4891 | if (params != IF_DEF_PARAMS (ifp)) |
| 4892 | { |
| 4893 | ospf_free_if_params (ifp, addr); |
| 4894 | ospf_if_update_params (ifp, addr); |
| 4895 | } |
| 4896 | |
| 4897 | ospf_if_recalculate_output_cost (ifp); |
| 4898 | |
| 4899 | return CMD_SUCCESS; |
| 4900 | } |
| 4901 | |
| 4902 | ALIAS (no_ip_ospf_cost2, |
| 4903 | no_ospf_cost_u32_cmd, |
| 4904 | "no ospf cost <1-65535>", |
| 4905 | NO_STR |
| 4906 | "OSPF interface commands\n" |
| 4907 | "Interface cost\n" |
| 4908 | "Cost") |
| 4909 | |
| 4910 | ALIAS (no_ip_ospf_cost2, |
| 4911 | no_ip_ospf_cost_u32_inet4_cmd, |
| 4912 | "no ip ospf cost <1-65535> A.B.C.D", |
| 4913 | NO_STR |
| 4914 | "IP Information\n" |
| 4915 | "OSPF interface commands\n" |
| 4916 | "Interface cost\n" |
| 4917 | "Cost\n" |
| 4918 | "Address of interface") |
| 4919 | |
| 4920 | ALIAS (no_ip_ospf_cost2, |
| 4921 | no_ospf_cost_u32_inet4_cmd, |
| 4922 | "no ospf cost <1-65535> A.B.C.D", |
| 4923 | NO_STR |
| 4924 | "OSPF interface commands\n" |
| 4925 | "Interface cost\n" |
| 4926 | "Cost\n" |
| 4927 | "Address of interface") |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4928 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4929 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4930 | ospf_nbr_timer_update (struct ospf_interface *oi) |
| 4931 | { |
| 4932 | struct route_node *rn; |
| 4933 | struct ospf_neighbor *nbr; |
| 4934 | |
| 4935 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 4936 | if ((nbr = rn->info)) |
| 4937 | { |
| 4938 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); |
| 4939 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4940 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4941 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4942 | } |
| 4943 | } |
| 4944 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4945 | static int |
| 4946 | ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, |
| 4947 | const char *nbr_str, |
| 4948 | const char *fast_hello_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4949 | { |
| 4950 | struct interface *ifp = vty->index; |
| 4951 | u_int32_t seconds; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4952 | u_char hellomult; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4953 | struct in_addr addr; |
| 4954 | int ret; |
| 4955 | struct ospf_if_params *params; |
| 4956 | struct ospf_interface *oi; |
| 4957 | struct route_node *rn; |
| 4958 | |
| 4959 | params = IF_DEF_PARAMS (ifp); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4960 | |
| 4961 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4962 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4963 | ret = inet_aton(nbr_str, &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4964 | if (!ret) |
| 4965 | { |
| 4966 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4967 | VTY_NEWLINE); |
| 4968 | return CMD_WARNING; |
| 4969 | } |
| 4970 | |
| 4971 | params = ospf_get_if_params (ifp, addr); |
| 4972 | ospf_if_update_params (ifp, addr); |
| 4973 | } |
| 4974 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4975 | if (interval_str) |
| 4976 | { |
| 4977 | VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str, |
| 4978 | 1, 65535); |
| 4979 | |
| 4980 | /* reset fast_hello too, just to be sure */ |
| 4981 | UNSET_IF_PARAM (params, fast_hello); |
| 4982 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 4983 | } |
| 4984 | else if (fast_hello_str) |
| 4985 | { |
| 4986 | VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str, |
| 4987 | 1, 10); |
| 4988 | /* 1s dead-interval with sub-second hellos desired */ |
| 4989 | seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL; |
| 4990 | SET_IF_PARAM (params, fast_hello); |
| 4991 | params->fast_hello = hellomult; |
| 4992 | } |
| 4993 | else |
| 4994 | { |
| 4995 | vty_out (vty, "Please specify dead-interval or hello-multiplier%s", |
| 4996 | VTY_NEWLINE); |
| 4997 | return CMD_WARNING; |
| 4998 | } |
| 4999 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5000 | SET_IF_PARAM (params, v_wait); |
| 5001 | params->v_wait = seconds; |
| 5002 | |
| 5003 | /* Update timer values in neighbor structure. */ |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5004 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5005 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 5006 | struct ospf *ospf; |
| 5007 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5008 | { |
| 5009 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 5010 | if (oi) |
| 5011 | ospf_nbr_timer_update (oi); |
| 5012 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5013 | } |
| 5014 | else |
| 5015 | { |
| 5016 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5017 | if ((oi = rn->info)) |
| 5018 | ospf_nbr_timer_update (oi); |
| 5019 | } |
| 5020 | |
| 5021 | return CMD_SUCCESS; |
| 5022 | } |
| 5023 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5024 | |
| 5025 | DEFUN (ip_ospf_dead_interval, |
| 5026 | ip_ospf_dead_interval_addr_cmd, |
| 5027 | "ip ospf dead-interval <1-65535> A.B.C.D", |
| 5028 | "IP Information\n" |
| 5029 | "OSPF interface commands\n" |
| 5030 | "Interval after which a neighbor is declared dead\n" |
| 5031 | "Seconds\n" |
| 5032 | "Address of interface\n") |
| 5033 | { |
| 5034 | if (argc == 2) |
| 5035 | return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); |
| 5036 | else |
| 5037 | return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); |
| 5038 | } |
| 5039 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5040 | ALIAS (ip_ospf_dead_interval, |
| 5041 | ip_ospf_dead_interval_cmd, |
| 5042 | "ip ospf dead-interval <1-65535>", |
| 5043 | "IP Information\n" |
| 5044 | "OSPF interface commands\n" |
| 5045 | "Interval after which a neighbor is declared dead\n" |
| 5046 | "Seconds\n") |
| 5047 | |
| 5048 | ALIAS (ip_ospf_dead_interval, |
| 5049 | ospf_dead_interval_cmd, |
| 5050 | "ospf dead-interval <1-65535>", |
| 5051 | "OSPF interface commands\n" |
| 5052 | "Interval after which a neighbor is declared dead\n" |
| 5053 | "Seconds\n") |
| 5054 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5055 | DEFUN (ip_ospf_dead_interval_minimal, |
| 5056 | ip_ospf_dead_interval_minimal_addr_cmd, |
| 5057 | "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", |
| 5058 | "IP Information\n" |
| 5059 | "OSPF interface commands\n" |
| 5060 | "Interval after which a neighbor is declared dead\n" |
| 5061 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 5062 | "Hello multiplier factor\n" |
| 5063 | "Number of Hellos to send each second\n" |
| 5064 | "Address of interface\n") |
| 5065 | { |
| 5066 | if (argc == 2) |
| 5067 | return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); |
| 5068 | else |
| 5069 | return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); |
| 5070 | } |
| 5071 | |
| 5072 | ALIAS (ip_ospf_dead_interval_minimal, |
| 5073 | ip_ospf_dead_interval_minimal_cmd, |
| 5074 | "ip ospf dead-interval minimal hello-multiplier <1-10>", |
| 5075 | "IP Information\n" |
| 5076 | "OSPF interface commands\n" |
| 5077 | "Interval after which a neighbor is declared dead\n" |
| 5078 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 5079 | "Hello multiplier factor\n" |
| 5080 | "Number of Hellos to send each second\n") |
| 5081 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5082 | DEFUN (no_ip_ospf_dead_interval, |
| 5083 | no_ip_ospf_dead_interval_addr_cmd, |
| 5084 | "no ip ospf dead-interval A.B.C.D", |
| 5085 | NO_STR |
| 5086 | "IP Information\n" |
| 5087 | "OSPF interface commands\n" |
| 5088 | "Interval after which a neighbor is declared dead\n" |
| 5089 | "Address of interface") |
| 5090 | { |
| 5091 | struct interface *ifp = vty->index; |
| 5092 | struct in_addr addr; |
| 5093 | int ret; |
| 5094 | struct ospf_if_params *params; |
| 5095 | struct ospf_interface *oi; |
| 5096 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5097 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5098 | ifp = vty->index; |
| 5099 | params = IF_DEF_PARAMS (ifp); |
| 5100 | |
| 5101 | if (argc == 1) |
| 5102 | { |
| 5103 | ret = inet_aton(argv[0], &addr); |
| 5104 | if (!ret) |
| 5105 | { |
| 5106 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5107 | VTY_NEWLINE); |
| 5108 | return CMD_WARNING; |
| 5109 | } |
| 5110 | |
| 5111 | params = ospf_lookup_if_params (ifp, addr); |
| 5112 | if (params == NULL) |
| 5113 | return CMD_SUCCESS; |
| 5114 | } |
| 5115 | |
| 5116 | UNSET_IF_PARAM (params, v_wait); |
| 5117 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5118 | |
| 5119 | UNSET_IF_PARAM (params, fast_hello); |
| 5120 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 5121 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5122 | if (params != IF_DEF_PARAMS (ifp)) |
| 5123 | { |
| 5124 | ospf_free_if_params (ifp, addr); |
| 5125 | ospf_if_update_params (ifp, addr); |
| 5126 | } |
| 5127 | |
| 5128 | /* Update timer values in neighbor structure. */ |
| 5129 | if (argc == 1) |
| 5130 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 5131 | struct ospf *ospf; |
| 5132 | |
| 5133 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5134 | { |
| 5135 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 5136 | if (oi) |
| 5137 | ospf_nbr_timer_update (oi); |
| 5138 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5139 | } |
| 5140 | else |
| 5141 | { |
| 5142 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5143 | if ((oi = rn->info)) |
| 5144 | ospf_nbr_timer_update (oi); |
| 5145 | } |
| 5146 | |
| 5147 | return CMD_SUCCESS; |
| 5148 | } |
| 5149 | |
| 5150 | ALIAS (no_ip_ospf_dead_interval, |
| 5151 | no_ip_ospf_dead_interval_cmd, |
| 5152 | "no ip ospf dead-interval", |
| 5153 | NO_STR |
| 5154 | "IP Information\n" |
| 5155 | "OSPF interface commands\n" |
| 5156 | "Interval after which a neighbor is declared dead\n") |
| 5157 | |
| 5158 | ALIAS (no_ip_ospf_dead_interval, |
| 5159 | no_ospf_dead_interval_cmd, |
| 5160 | "no ospf dead-interval", |
| 5161 | NO_STR |
| 5162 | "OSPF interface commands\n" |
| 5163 | "Interval after which a neighbor is declared dead\n") |
| 5164 | |
| 5165 | DEFUN (ip_ospf_hello_interval, |
| 5166 | ip_ospf_hello_interval_addr_cmd, |
| 5167 | "ip ospf hello-interval <1-65535> A.B.C.D", |
| 5168 | "IP Information\n" |
| 5169 | "OSPF interface commands\n" |
| 5170 | "Time between HELLO packets\n" |
| 5171 | "Seconds\n" |
| 5172 | "Address of interface") |
| 5173 | { |
| 5174 | struct interface *ifp = vty->index; |
| 5175 | u_int32_t seconds; |
| 5176 | struct in_addr addr; |
| 5177 | int ret; |
| 5178 | struct ospf_if_params *params; |
| 5179 | |
| 5180 | params = IF_DEF_PARAMS (ifp); |
| 5181 | |
| 5182 | seconds = strtol (argv[0], NULL, 10); |
| 5183 | |
| 5184 | /* HelloInterval range is <1-65535>. */ |
| 5185 | if (seconds < 1 || seconds > 65535) |
| 5186 | { |
| 5187 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); |
| 5188 | return CMD_WARNING; |
| 5189 | } |
| 5190 | |
| 5191 | if (argc == 2) |
| 5192 | { |
| 5193 | ret = inet_aton(argv[1], &addr); |
| 5194 | if (!ret) |
| 5195 | { |
| 5196 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5197 | VTY_NEWLINE); |
| 5198 | return CMD_WARNING; |
| 5199 | } |
| 5200 | |
| 5201 | params = ospf_get_if_params (ifp, addr); |
| 5202 | ospf_if_update_params (ifp, addr); |
| 5203 | } |
| 5204 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5205 | SET_IF_PARAM (params, v_hello); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5206 | params->v_hello = seconds; |
| 5207 | |
| 5208 | return CMD_SUCCESS; |
| 5209 | } |
| 5210 | |
| 5211 | ALIAS (ip_ospf_hello_interval, |
| 5212 | ip_ospf_hello_interval_cmd, |
| 5213 | "ip ospf hello-interval <1-65535>", |
| 5214 | "IP Information\n" |
| 5215 | "OSPF interface commands\n" |
| 5216 | "Time between HELLO packets\n" |
| 5217 | "Seconds\n") |
| 5218 | |
| 5219 | ALIAS (ip_ospf_hello_interval, |
| 5220 | ospf_hello_interval_cmd, |
| 5221 | "ospf hello-interval <1-65535>", |
| 5222 | "OSPF interface commands\n" |
| 5223 | "Time between HELLO packets\n" |
| 5224 | "Seconds\n") |
| 5225 | |
| 5226 | DEFUN (no_ip_ospf_hello_interval, |
| 5227 | no_ip_ospf_hello_interval_addr_cmd, |
| 5228 | "no ip ospf hello-interval A.B.C.D", |
| 5229 | NO_STR |
| 5230 | "IP Information\n" |
| 5231 | "OSPF interface commands\n" |
| 5232 | "Time between HELLO packets\n" |
| 5233 | "Address of interface") |
| 5234 | { |
| 5235 | struct interface *ifp = vty->index; |
| 5236 | struct in_addr addr; |
| 5237 | int ret; |
| 5238 | struct ospf_if_params *params; |
| 5239 | |
| 5240 | ifp = vty->index; |
| 5241 | params = IF_DEF_PARAMS (ifp); |
| 5242 | |
| 5243 | if (argc == 1) |
| 5244 | { |
| 5245 | ret = inet_aton(argv[0], &addr); |
| 5246 | if (!ret) |
| 5247 | { |
| 5248 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5249 | VTY_NEWLINE); |
| 5250 | return CMD_WARNING; |
| 5251 | } |
| 5252 | |
| 5253 | params = ospf_lookup_if_params (ifp, addr); |
| 5254 | if (params == NULL) |
| 5255 | return CMD_SUCCESS; |
| 5256 | } |
| 5257 | |
| 5258 | UNSET_IF_PARAM (params, v_hello); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5259 | params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5260 | |
| 5261 | if (params != IF_DEF_PARAMS (ifp)) |
| 5262 | { |
| 5263 | ospf_free_if_params (ifp, addr); |
| 5264 | ospf_if_update_params (ifp, addr); |
| 5265 | } |
| 5266 | |
| 5267 | return CMD_SUCCESS; |
| 5268 | } |
| 5269 | |
| 5270 | ALIAS (no_ip_ospf_hello_interval, |
| 5271 | no_ip_ospf_hello_interval_cmd, |
| 5272 | "no ip ospf hello-interval", |
| 5273 | NO_STR |
| 5274 | "IP Information\n" |
| 5275 | "OSPF interface commands\n" |
| 5276 | "Time between HELLO packets\n") |
| 5277 | |
| 5278 | ALIAS (no_ip_ospf_hello_interval, |
| 5279 | no_ospf_hello_interval_cmd, |
| 5280 | "no ospf hello-interval", |
| 5281 | NO_STR |
| 5282 | "OSPF interface commands\n" |
| 5283 | "Time between HELLO packets\n") |
| 5284 | |
| 5285 | DEFUN (ip_ospf_network, |
| 5286 | ip_ospf_network_cmd, |
| 5287 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5288 | "IP Information\n" |
| 5289 | "OSPF interface commands\n" |
| 5290 | "Network type\n" |
| 5291 | "Specify OSPF broadcast multi-access network\n" |
| 5292 | "Specify OSPF NBMA network\n" |
| 5293 | "Specify OSPF point-to-multipoint network\n" |
| 5294 | "Specify OSPF point-to-point network\n") |
| 5295 | { |
| 5296 | struct interface *ifp = vty->index; |
| 5297 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5298 | struct route_node *rn; |
| 5299 | |
| 5300 | if (strncmp (argv[0], "b", 1) == 0) |
| 5301 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; |
| 5302 | else if (strncmp (argv[0], "n", 1) == 0) |
| 5303 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; |
| 5304 | else if (strncmp (argv[0], "point-to-m", 10) == 0) |
| 5305 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; |
| 5306 | else if (strncmp (argv[0], "point-to-p", 10) == 0) |
| 5307 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; |
| 5308 | |
| 5309 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5310 | return CMD_SUCCESS; |
| 5311 | |
| 5312 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); |
| 5313 | |
| 5314 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5315 | { |
| 5316 | struct ospf_interface *oi = rn->info; |
| 5317 | |
| 5318 | if (!oi) |
| 5319 | continue; |
| 5320 | |
| 5321 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5322 | |
| 5323 | if (oi->state > ISM_Down) |
| 5324 | { |
| 5325 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5326 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5327 | } |
| 5328 | } |
| 5329 | |
| 5330 | return CMD_SUCCESS; |
| 5331 | } |
| 5332 | |
| 5333 | ALIAS (ip_ospf_network, |
| 5334 | ospf_network_cmd, |
| 5335 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5336 | "OSPF interface commands\n" |
| 5337 | "Network type\n" |
| 5338 | "Specify OSPF broadcast multi-access network\n" |
| 5339 | "Specify OSPF NBMA network\n" |
| 5340 | "Specify OSPF point-to-multipoint network\n" |
| 5341 | "Specify OSPF point-to-point network\n") |
| 5342 | |
| 5343 | DEFUN (no_ip_ospf_network, |
| 5344 | no_ip_ospf_network_cmd, |
| 5345 | "no ip ospf network", |
| 5346 | NO_STR |
| 5347 | "IP Information\n" |
| 5348 | "OSPF interface commands\n" |
| 5349 | "Network type\n") |
| 5350 | { |
| 5351 | struct interface *ifp = vty->index; |
| 5352 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5353 | struct route_node *rn; |
| 5354 | |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 5355 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5356 | |
| 5357 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5358 | return CMD_SUCCESS; |
| 5359 | |
| 5360 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5361 | { |
| 5362 | struct ospf_interface *oi = rn->info; |
| 5363 | |
| 5364 | if (!oi) |
| 5365 | continue; |
| 5366 | |
| 5367 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5368 | |
| 5369 | if (oi->state > ISM_Down) |
| 5370 | { |
| 5371 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5372 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5373 | } |
| 5374 | } |
| 5375 | |
| 5376 | return CMD_SUCCESS; |
| 5377 | } |
| 5378 | |
| 5379 | ALIAS (no_ip_ospf_network, |
| 5380 | no_ospf_network_cmd, |
| 5381 | "no ospf network", |
| 5382 | NO_STR |
| 5383 | "OSPF interface commands\n" |
| 5384 | "Network type\n") |
| 5385 | |
| 5386 | DEFUN (ip_ospf_priority, |
| 5387 | ip_ospf_priority_addr_cmd, |
| 5388 | "ip ospf priority <0-255> A.B.C.D", |
| 5389 | "IP Information\n" |
| 5390 | "OSPF interface commands\n" |
| 5391 | "Router priority\n" |
| 5392 | "Priority\n" |
| 5393 | "Address of interface") |
| 5394 | { |
| 5395 | struct interface *ifp = vty->index; |
| 5396 | u_int32_t priority; |
| 5397 | struct route_node *rn; |
| 5398 | struct in_addr addr; |
| 5399 | int ret; |
| 5400 | struct ospf_if_params *params; |
| 5401 | |
| 5402 | params = IF_DEF_PARAMS (ifp); |
| 5403 | |
| 5404 | priority = strtol (argv[0], NULL, 10); |
| 5405 | |
| 5406 | /* Router Priority range is <0-255>. */ |
| 5407 | if (priority < 0 || priority > 255) |
| 5408 | { |
| 5409 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); |
| 5410 | return CMD_WARNING; |
| 5411 | } |
| 5412 | |
| 5413 | if (argc == 2) |
| 5414 | { |
| 5415 | ret = inet_aton(argv[1], &addr); |
| 5416 | if (!ret) |
| 5417 | { |
| 5418 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5419 | VTY_NEWLINE); |
| 5420 | return CMD_WARNING; |
| 5421 | } |
| 5422 | |
| 5423 | params = ospf_get_if_params (ifp, addr); |
| 5424 | ospf_if_update_params (ifp, addr); |
| 5425 | } |
| 5426 | |
| 5427 | SET_IF_PARAM (params, priority); |
| 5428 | params->priority = priority; |
| 5429 | |
| 5430 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5431 | { |
| 5432 | struct ospf_interface *oi = rn->info; |
| 5433 | |
| 5434 | if (!oi) |
| 5435 | continue; |
| 5436 | |
| 5437 | |
| 5438 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5439 | { |
| 5440 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5441 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5442 | } |
| 5443 | } |
| 5444 | |
| 5445 | return CMD_SUCCESS; |
| 5446 | } |
| 5447 | |
| 5448 | ALIAS (ip_ospf_priority, |
| 5449 | ip_ospf_priority_cmd, |
| 5450 | "ip ospf priority <0-255>", |
| 5451 | "IP Information\n" |
| 5452 | "OSPF interface commands\n" |
| 5453 | "Router priority\n" |
| 5454 | "Priority\n") |
| 5455 | |
| 5456 | ALIAS (ip_ospf_priority, |
| 5457 | ospf_priority_cmd, |
| 5458 | "ospf priority <0-255>", |
| 5459 | "OSPF interface commands\n" |
| 5460 | "Router priority\n" |
| 5461 | "Priority\n") |
| 5462 | |
| 5463 | DEFUN (no_ip_ospf_priority, |
| 5464 | no_ip_ospf_priority_addr_cmd, |
| 5465 | "no ip ospf priority A.B.C.D", |
| 5466 | NO_STR |
| 5467 | "IP Information\n" |
| 5468 | "OSPF interface commands\n" |
| 5469 | "Router priority\n" |
| 5470 | "Address of interface") |
| 5471 | { |
| 5472 | struct interface *ifp = vty->index; |
| 5473 | struct route_node *rn; |
| 5474 | struct in_addr addr; |
| 5475 | int ret; |
| 5476 | struct ospf_if_params *params; |
| 5477 | |
| 5478 | ifp = vty->index; |
| 5479 | params = IF_DEF_PARAMS (ifp); |
| 5480 | |
| 5481 | if (argc == 1) |
| 5482 | { |
| 5483 | ret = inet_aton(argv[0], &addr); |
| 5484 | if (!ret) |
| 5485 | { |
| 5486 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5487 | VTY_NEWLINE); |
| 5488 | return CMD_WARNING; |
| 5489 | } |
| 5490 | |
| 5491 | params = ospf_lookup_if_params (ifp, addr); |
| 5492 | if (params == NULL) |
| 5493 | return CMD_SUCCESS; |
| 5494 | } |
| 5495 | |
| 5496 | UNSET_IF_PARAM (params, priority); |
| 5497 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; |
| 5498 | |
| 5499 | if (params != IF_DEF_PARAMS (ifp)) |
| 5500 | { |
| 5501 | ospf_free_if_params (ifp, addr); |
| 5502 | ospf_if_update_params (ifp, addr); |
| 5503 | } |
| 5504 | |
| 5505 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5506 | { |
| 5507 | struct ospf_interface *oi = rn->info; |
| 5508 | |
| 5509 | if (!oi) |
| 5510 | continue; |
| 5511 | |
| 5512 | |
| 5513 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5514 | { |
| 5515 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5516 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5517 | } |
| 5518 | } |
| 5519 | |
| 5520 | return CMD_SUCCESS; |
| 5521 | } |
| 5522 | |
| 5523 | ALIAS (no_ip_ospf_priority, |
| 5524 | no_ip_ospf_priority_cmd, |
| 5525 | "no ip ospf priority", |
| 5526 | NO_STR |
| 5527 | "IP Information\n" |
| 5528 | "OSPF interface commands\n" |
| 5529 | "Router priority\n") |
| 5530 | |
| 5531 | ALIAS (no_ip_ospf_priority, |
| 5532 | no_ospf_priority_cmd, |
| 5533 | "no ospf priority", |
| 5534 | NO_STR |
| 5535 | "OSPF interface commands\n" |
| 5536 | "Router priority\n") |
| 5537 | |
| 5538 | DEFUN (ip_ospf_retransmit_interval, |
| 5539 | ip_ospf_retransmit_interval_addr_cmd, |
| 5540 | "ip ospf retransmit-interval <3-65535> A.B.C.D", |
| 5541 | "IP Information\n" |
| 5542 | "OSPF interface commands\n" |
| 5543 | "Time between retransmitting lost link state advertisements\n" |
| 5544 | "Seconds\n" |
| 5545 | "Address of interface") |
| 5546 | { |
| 5547 | struct interface *ifp = vty->index; |
| 5548 | u_int32_t seconds; |
| 5549 | struct in_addr addr; |
| 5550 | int ret; |
| 5551 | struct ospf_if_params *params; |
| 5552 | |
| 5553 | params = IF_DEF_PARAMS (ifp); |
| 5554 | seconds = strtol (argv[0], NULL, 10); |
| 5555 | |
| 5556 | /* Retransmit Interval range is <3-65535>. */ |
| 5557 | if (seconds < 3 || seconds > 65535) |
| 5558 | { |
| 5559 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); |
| 5560 | return CMD_WARNING; |
| 5561 | } |
| 5562 | |
| 5563 | |
| 5564 | if (argc == 2) |
| 5565 | { |
| 5566 | ret = inet_aton(argv[1], &addr); |
| 5567 | if (!ret) |
| 5568 | { |
| 5569 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5570 | VTY_NEWLINE); |
| 5571 | return CMD_WARNING; |
| 5572 | } |
| 5573 | |
| 5574 | params = ospf_get_if_params (ifp, addr); |
| 5575 | ospf_if_update_params (ifp, addr); |
| 5576 | } |
| 5577 | |
| 5578 | SET_IF_PARAM (params, retransmit_interval); |
| 5579 | params->retransmit_interval = seconds; |
| 5580 | |
| 5581 | return CMD_SUCCESS; |
| 5582 | } |
| 5583 | |
| 5584 | ALIAS (ip_ospf_retransmit_interval, |
| 5585 | ip_ospf_retransmit_interval_cmd, |
| 5586 | "ip ospf retransmit-interval <3-65535>", |
| 5587 | "IP Information\n" |
| 5588 | "OSPF interface commands\n" |
| 5589 | "Time between retransmitting lost link state advertisements\n" |
| 5590 | "Seconds\n") |
| 5591 | |
| 5592 | ALIAS (ip_ospf_retransmit_interval, |
| 5593 | ospf_retransmit_interval_cmd, |
| 5594 | "ospf retransmit-interval <3-65535>", |
| 5595 | "OSPF interface commands\n" |
| 5596 | "Time between retransmitting lost link state advertisements\n" |
| 5597 | "Seconds\n") |
| 5598 | |
| 5599 | DEFUN (no_ip_ospf_retransmit_interval, |
| 5600 | no_ip_ospf_retransmit_interval_addr_cmd, |
| 5601 | "no ip ospf retransmit-interval A.B.C.D", |
| 5602 | NO_STR |
| 5603 | "IP Information\n" |
| 5604 | "OSPF interface commands\n" |
| 5605 | "Time between retransmitting lost link state advertisements\n" |
| 5606 | "Address of interface") |
| 5607 | { |
| 5608 | struct interface *ifp = vty->index; |
| 5609 | struct in_addr addr; |
| 5610 | int ret; |
| 5611 | struct ospf_if_params *params; |
| 5612 | |
| 5613 | ifp = vty->index; |
| 5614 | params = IF_DEF_PARAMS (ifp); |
| 5615 | |
| 5616 | if (argc == 1) |
| 5617 | { |
| 5618 | ret = inet_aton(argv[0], &addr); |
| 5619 | if (!ret) |
| 5620 | { |
| 5621 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5622 | VTY_NEWLINE); |
| 5623 | return CMD_WARNING; |
| 5624 | } |
| 5625 | |
| 5626 | params = ospf_lookup_if_params (ifp, addr); |
| 5627 | if (params == NULL) |
| 5628 | return CMD_SUCCESS; |
| 5629 | } |
| 5630 | |
| 5631 | UNSET_IF_PARAM (params, retransmit_interval); |
| 5632 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 5633 | |
| 5634 | if (params != IF_DEF_PARAMS (ifp)) |
| 5635 | { |
| 5636 | ospf_free_if_params (ifp, addr); |
| 5637 | ospf_if_update_params (ifp, addr); |
| 5638 | } |
| 5639 | |
| 5640 | return CMD_SUCCESS; |
| 5641 | } |
| 5642 | |
| 5643 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5644 | no_ip_ospf_retransmit_interval_cmd, |
| 5645 | "no ip ospf retransmit-interval", |
| 5646 | NO_STR |
| 5647 | "IP Information\n" |
| 5648 | "OSPF interface commands\n" |
| 5649 | "Time between retransmitting lost link state advertisements\n") |
| 5650 | |
| 5651 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5652 | no_ospf_retransmit_interval_cmd, |
| 5653 | "no ospf retransmit-interval", |
| 5654 | NO_STR |
| 5655 | "OSPF interface commands\n" |
| 5656 | "Time between retransmitting lost link state advertisements\n") |
| 5657 | |
| 5658 | DEFUN (ip_ospf_transmit_delay, |
| 5659 | ip_ospf_transmit_delay_addr_cmd, |
| 5660 | "ip ospf transmit-delay <1-65535> A.B.C.D", |
| 5661 | "IP Information\n" |
| 5662 | "OSPF interface commands\n" |
| 5663 | "Link state transmit delay\n" |
| 5664 | "Seconds\n" |
| 5665 | "Address of interface") |
| 5666 | { |
| 5667 | struct interface *ifp = vty->index; |
| 5668 | u_int32_t seconds; |
| 5669 | struct in_addr addr; |
| 5670 | int ret; |
| 5671 | struct ospf_if_params *params; |
| 5672 | |
| 5673 | params = IF_DEF_PARAMS (ifp); |
| 5674 | seconds = strtol (argv[0], NULL, 10); |
| 5675 | |
| 5676 | /* Transmit Delay range is <1-65535>. */ |
| 5677 | if (seconds < 1 || seconds > 65535) |
| 5678 | { |
| 5679 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); |
| 5680 | return CMD_WARNING; |
| 5681 | } |
| 5682 | |
| 5683 | if (argc == 2) |
| 5684 | { |
| 5685 | ret = inet_aton(argv[1], &addr); |
| 5686 | if (!ret) |
| 5687 | { |
| 5688 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5689 | VTY_NEWLINE); |
| 5690 | return CMD_WARNING; |
| 5691 | } |
| 5692 | |
| 5693 | params = ospf_get_if_params (ifp, addr); |
| 5694 | ospf_if_update_params (ifp, addr); |
| 5695 | } |
| 5696 | |
| 5697 | SET_IF_PARAM (params, transmit_delay); |
| 5698 | params->transmit_delay = seconds; |
| 5699 | |
| 5700 | return CMD_SUCCESS; |
| 5701 | } |
| 5702 | |
| 5703 | ALIAS (ip_ospf_transmit_delay, |
| 5704 | ip_ospf_transmit_delay_cmd, |
| 5705 | "ip ospf transmit-delay <1-65535>", |
| 5706 | "IP Information\n" |
| 5707 | "OSPF interface commands\n" |
| 5708 | "Link state transmit delay\n" |
| 5709 | "Seconds\n") |
| 5710 | |
| 5711 | ALIAS (ip_ospf_transmit_delay, |
| 5712 | ospf_transmit_delay_cmd, |
| 5713 | "ospf transmit-delay <1-65535>", |
| 5714 | "OSPF interface commands\n" |
| 5715 | "Link state transmit delay\n" |
| 5716 | "Seconds\n") |
| 5717 | |
| 5718 | DEFUN (no_ip_ospf_transmit_delay, |
| 5719 | no_ip_ospf_transmit_delay_addr_cmd, |
| 5720 | "no ip ospf transmit-delay A.B.C.D", |
| 5721 | NO_STR |
| 5722 | "IP Information\n" |
| 5723 | "OSPF interface commands\n" |
| 5724 | "Link state transmit delay\n" |
| 5725 | "Address of interface") |
| 5726 | { |
| 5727 | struct interface *ifp = vty->index; |
| 5728 | struct in_addr addr; |
| 5729 | int ret; |
| 5730 | struct ospf_if_params *params; |
| 5731 | |
| 5732 | ifp = vty->index; |
| 5733 | params = IF_DEF_PARAMS (ifp); |
| 5734 | |
| 5735 | if (argc == 1) |
| 5736 | { |
| 5737 | ret = inet_aton(argv[0], &addr); |
| 5738 | if (!ret) |
| 5739 | { |
| 5740 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5741 | VTY_NEWLINE); |
| 5742 | return CMD_WARNING; |
| 5743 | } |
| 5744 | |
| 5745 | params = ospf_lookup_if_params (ifp, addr); |
| 5746 | if (params == NULL) |
| 5747 | return CMD_SUCCESS; |
| 5748 | } |
| 5749 | |
| 5750 | UNSET_IF_PARAM (params, transmit_delay); |
| 5751 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 5752 | |
| 5753 | if (params != IF_DEF_PARAMS (ifp)) |
| 5754 | { |
| 5755 | ospf_free_if_params (ifp, addr); |
| 5756 | ospf_if_update_params (ifp, addr); |
| 5757 | } |
| 5758 | |
| 5759 | return CMD_SUCCESS; |
| 5760 | } |
| 5761 | |
| 5762 | ALIAS (no_ip_ospf_transmit_delay, |
| 5763 | no_ip_ospf_transmit_delay_cmd, |
| 5764 | "no ip ospf transmit-delay", |
| 5765 | NO_STR |
| 5766 | "IP Information\n" |
| 5767 | "OSPF interface commands\n" |
| 5768 | "Link state transmit delay\n") |
| 5769 | |
| 5770 | ALIAS (no_ip_ospf_transmit_delay, |
| 5771 | no_ospf_transmit_delay_cmd, |
| 5772 | "no ospf transmit-delay", |
| 5773 | NO_STR |
| 5774 | "OSPF interface commands\n" |
| 5775 | "Link state transmit delay\n") |
| 5776 | |
| 5777 | |
| 5778 | DEFUN (ospf_redistribute_source_metric_type, |
| 5779 | ospf_redistribute_source_metric_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5780 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5781 | " metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5782 | REDIST_STR |
| 5783 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5784 | "Metric for redistributed routes\n" |
| 5785 | "OSPF default metric\n" |
| 5786 | "OSPF exterior metric type for redistributed routes\n" |
| 5787 | "Set OSPF External Type 1 metrics\n" |
| 5788 | "Set OSPF External Type 2 metrics\n" |
| 5789 | "Route map reference\n" |
| 5790 | "Pointer to route-map entries\n") |
| 5791 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5792 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5793 | int source; |
| 5794 | int type = -1; |
| 5795 | int metric = -1; |
| 5796 | |
| 5797 | /* Get distribute source. */ |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5798 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5799 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5800 | return CMD_WARNING; |
| 5801 | |
| 5802 | /* Get metric value. */ |
| 5803 | if (argc >= 2) |
| 5804 | if (!str2metric (argv[1], &metric)) |
| 5805 | return CMD_WARNING; |
| 5806 | |
| 5807 | /* Get metric type. */ |
| 5808 | if (argc >= 3) |
| 5809 | if (!str2metric_type (argv[2], &type)) |
| 5810 | return CMD_WARNING; |
| 5811 | |
| 5812 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5813 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5814 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5815 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5816 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5817 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5818 | } |
| 5819 | |
| 5820 | ALIAS (ospf_redistribute_source_metric_type, |
| 5821 | ospf_redistribute_source_metric_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5822 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5823 | " metric <0-16777214> metric-type (1|2)", |
| 5824 | REDIST_STR |
| 5825 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5826 | "Metric for redistributed routes\n" |
| 5827 | "OSPF default metric\n" |
| 5828 | "OSPF exterior metric type for redistributed routes\n" |
| 5829 | "Set OSPF External Type 1 metrics\n" |
| 5830 | "Set OSPF External Type 2 metrics\n") |
| 5831 | |
| 5832 | ALIAS (ospf_redistribute_source_metric_type, |
| 5833 | ospf_redistribute_source_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5834 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric <0-16777214>", |
| 5835 | REDIST_STR |
| 5836 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5837 | "Metric for redistributed routes\n" |
| 5838 | "OSPF default metric\n") |
| 5839 | |
| 5840 | DEFUN (ospf_redistribute_source_type_metric, |
| 5841 | ospf_redistribute_source_type_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5842 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5843 | " metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5844 | REDIST_STR |
| 5845 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5846 | "OSPF exterior metric type for redistributed routes\n" |
| 5847 | "Set OSPF External Type 1 metrics\n" |
| 5848 | "Set OSPF External Type 2 metrics\n" |
| 5849 | "Metric for redistributed routes\n" |
| 5850 | "OSPF default metric\n" |
| 5851 | "Route map reference\n" |
| 5852 | "Pointer to route-map entries\n") |
| 5853 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5854 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5855 | int source; |
| 5856 | int type = -1; |
| 5857 | int metric = -1; |
| 5858 | |
| 5859 | /* Get distribute source. */ |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5860 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5861 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5862 | return CMD_WARNING; |
| 5863 | |
| 5864 | /* Get metric value. */ |
| 5865 | if (argc >= 2) |
| 5866 | if (!str2metric_type (argv[1], &type)) |
| 5867 | return CMD_WARNING; |
| 5868 | |
| 5869 | /* Get metric type. */ |
| 5870 | if (argc >= 3) |
| 5871 | if (!str2metric (argv[2], &metric)) |
| 5872 | return CMD_WARNING; |
| 5873 | |
| 5874 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5875 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5876 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5877 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5878 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5879 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5880 | } |
| 5881 | |
| 5882 | ALIAS (ospf_redistribute_source_type_metric, |
| 5883 | ospf_redistribute_source_type_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5884 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5885 | " metric-type (1|2) metric <0-16777214>", |
| 5886 | REDIST_STR |
| 5887 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5888 | "OSPF exterior metric type for redistributed routes\n" |
| 5889 | "Set OSPF External Type 1 metrics\n" |
| 5890 | "Set OSPF External Type 2 metrics\n" |
| 5891 | "Metric for redistributed routes\n" |
| 5892 | "OSPF default metric\n") |
| 5893 | |
| 5894 | ALIAS (ospf_redistribute_source_type_metric, |
| 5895 | ospf_redistribute_source_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5896 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric-type (1|2)", |
| 5897 | REDIST_STR |
| 5898 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5899 | "OSPF exterior metric type for redistributed routes\n" |
| 5900 | "Set OSPF External Type 1 metrics\n" |
| 5901 | "Set OSPF External Type 2 metrics\n") |
| 5902 | |
| 5903 | ALIAS (ospf_redistribute_source_type_metric, |
| 5904 | ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5905 | "redistribute " QUAGGA_REDIST_STR_OSPFD, |
| 5906 | REDIST_STR |
| 5907 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5908 | |
| 5909 | DEFUN (ospf_redistribute_source_metric_routemap, |
| 5910 | ospf_redistribute_source_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5911 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5912 | " metric <0-16777214> route-map WORD", |
| 5913 | REDIST_STR |
| 5914 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5915 | "Metric for redistributed routes\n" |
| 5916 | "OSPF default metric\n" |
| 5917 | "Route map reference\n" |
| 5918 | "Pointer to route-map entries\n") |
| 5919 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5920 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5921 | int source; |
| 5922 | int metric = -1; |
| 5923 | |
| 5924 | /* Get distribute source. */ |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5925 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5926 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5927 | return CMD_WARNING; |
| 5928 | |
| 5929 | /* Get metric value. */ |
| 5930 | if (argc >= 2) |
| 5931 | if (!str2metric (argv[1], &metric)) |
| 5932 | return CMD_WARNING; |
| 5933 | |
| 5934 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5935 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5936 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5937 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5938 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5939 | return ospf_redistribute_set (ospf, source, -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5940 | } |
| 5941 | |
| 5942 | DEFUN (ospf_redistribute_source_type_routemap, |
| 5943 | ospf_redistribute_source_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5944 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5945 | " metric-type (1|2) route-map WORD", |
| 5946 | REDIST_STR |
| 5947 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5948 | "OSPF exterior metric type for redistributed routes\n" |
| 5949 | "Set OSPF External Type 1 metrics\n" |
| 5950 | "Set OSPF External Type 2 metrics\n" |
| 5951 | "Route map reference\n" |
| 5952 | "Pointer to route-map entries\n") |
| 5953 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5954 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5955 | int source; |
| 5956 | int type = -1; |
| 5957 | |
| 5958 | /* Get distribute source. */ |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5959 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5960 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5961 | return CMD_WARNING; |
| 5962 | |
| 5963 | /* Get metric value. */ |
| 5964 | if (argc >= 2) |
| 5965 | if (!str2metric_type (argv[1], &type)) |
| 5966 | return CMD_WARNING; |
| 5967 | |
| 5968 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5969 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5970 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5971 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5972 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5973 | return ospf_redistribute_set (ospf, source, type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5974 | } |
| 5975 | |
| 5976 | DEFUN (ospf_redistribute_source_routemap, |
| 5977 | ospf_redistribute_source_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5978 | "redistribute " QUAGGA_REDIST_STR_OSPFD " route-map WORD", |
| 5979 | REDIST_STR |
| 5980 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5981 | "Route map reference\n" |
| 5982 | "Pointer to route-map entries\n") |
| 5983 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5984 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5985 | int source; |
| 5986 | |
| 5987 | /* Get distribute source. */ |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5988 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5989 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5990 | return CMD_WARNING; |
| 5991 | |
| 5992 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5993 | ospf_routemap_set (ospf, source, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5994 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5995 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5996 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5997 | return ospf_redistribute_set (ospf, source, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5998 | } |
| 5999 | |
| 6000 | DEFUN (no_ospf_redistribute_source, |
| 6001 | no_ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6002 | "no redistribute " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6003 | NO_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6004 | REDIST_STR |
| 6005 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6006 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6007 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6008 | int source; |
| 6009 | |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6010 | source = proto_redistnum(AFI_IP, argv[0]); |
| 6011 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6012 | return CMD_WARNING; |
| 6013 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6014 | ospf_routemap_unset (ospf, source); |
| 6015 | return ospf_redistribute_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6016 | } |
| 6017 | |
| 6018 | DEFUN (ospf_distribute_list_out, |
| 6019 | ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6020 | "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6021 | "Filter networks in routing updates\n" |
| 6022 | "Access-list name\n" |
| 6023 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6024 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6025 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6026 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6027 | int source; |
| 6028 | |
| 6029 | /* Get distribute source. */ |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6030 | source = proto_redistnum(AFI_IP, argv[0]); |
| 6031 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6032 | return CMD_WARNING; |
| 6033 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6034 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6035 | } |
| 6036 | |
| 6037 | DEFUN (no_ospf_distribute_list_out, |
| 6038 | no_ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6039 | "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6040 | NO_STR |
| 6041 | "Filter networks in routing updates\n" |
| 6042 | "Access-list name\n" |
| 6043 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6044 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6045 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6046 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6047 | int source; |
| 6048 | |
David Lamparter | daca2cf | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6049 | source = proto_redistnum(AFI_IP, argv[0]); |
| 6050 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6051 | return CMD_WARNING; |
| 6052 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6053 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6054 | } |
| 6055 | |
| 6056 | /* Default information originate. */ |
| 6057 | DEFUN (ospf_default_information_originate_metric_type_routemap, |
| 6058 | ospf_default_information_originate_metric_type_routemap_cmd, |
| 6059 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6060 | "Control distribution of default information\n" |
| 6061 | "Distribute a default route\n" |
| 6062 | "OSPF default metric\n" |
| 6063 | "OSPF metric\n" |
| 6064 | "OSPF metric type for default routes\n" |
| 6065 | "Set OSPF External Type 1 metrics\n" |
| 6066 | "Set OSPF External Type 2 metrics\n" |
| 6067 | "Route map reference\n" |
| 6068 | "Pointer to route-map entries\n") |
| 6069 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6070 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6071 | int type = -1; |
| 6072 | int metric = -1; |
| 6073 | |
| 6074 | /* Get metric value. */ |
| 6075 | if (argc >= 1) |
| 6076 | if (!str2metric (argv[0], &metric)) |
| 6077 | return CMD_WARNING; |
| 6078 | |
| 6079 | /* Get metric type. */ |
| 6080 | if (argc >= 2) |
| 6081 | if (!str2metric_type (argv[1], &type)) |
| 6082 | return CMD_WARNING; |
| 6083 | |
| 6084 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6085 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6086 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6087 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6088 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6089 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6090 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6091 | } |
| 6092 | |
| 6093 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6094 | ospf_default_information_originate_metric_type_cmd, |
| 6095 | "default-information originate metric <0-16777214> metric-type (1|2)", |
| 6096 | "Control distribution of default information\n" |
| 6097 | "Distribute a default route\n" |
| 6098 | "OSPF default metric\n" |
| 6099 | "OSPF metric\n" |
| 6100 | "OSPF metric type for default routes\n" |
| 6101 | "Set OSPF External Type 1 metrics\n" |
| 6102 | "Set OSPF External Type 2 metrics\n") |
| 6103 | |
| 6104 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6105 | ospf_default_information_originate_metric_cmd, |
| 6106 | "default-information originate metric <0-16777214>", |
| 6107 | "Control distribution of default information\n" |
| 6108 | "Distribute a default route\n" |
| 6109 | "OSPF default metric\n" |
| 6110 | "OSPF metric\n") |
| 6111 | |
| 6112 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6113 | ospf_default_information_originate_cmd, |
| 6114 | "default-information originate", |
| 6115 | "Control distribution of default information\n" |
| 6116 | "Distribute a default route\n") |
| 6117 | |
| 6118 | /* Default information originate. */ |
| 6119 | DEFUN (ospf_default_information_originate_metric_routemap, |
| 6120 | ospf_default_information_originate_metric_routemap_cmd, |
| 6121 | "default-information originate metric <0-16777214> route-map WORD", |
| 6122 | "Control distribution of default information\n" |
| 6123 | "Distribute a default route\n" |
| 6124 | "OSPF default metric\n" |
| 6125 | "OSPF metric\n" |
| 6126 | "Route map reference\n" |
| 6127 | "Pointer to route-map entries\n") |
| 6128 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6129 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6130 | int metric = -1; |
| 6131 | |
| 6132 | /* Get metric value. */ |
| 6133 | if (argc >= 1) |
| 6134 | if (!str2metric (argv[0], &metric)) |
| 6135 | return CMD_WARNING; |
| 6136 | |
| 6137 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6138 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6139 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6140 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6141 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6142 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6143 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6144 | } |
| 6145 | |
| 6146 | /* Default information originate. */ |
| 6147 | DEFUN (ospf_default_information_originate_routemap, |
| 6148 | ospf_default_information_originate_routemap_cmd, |
| 6149 | "default-information originate route-map WORD", |
| 6150 | "Control distribution of default information\n" |
| 6151 | "Distribute a default route\n" |
| 6152 | "Route map reference\n" |
| 6153 | "Pointer to route-map entries\n") |
| 6154 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6155 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6156 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6157 | if (argc == 1) |
| 6158 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6159 | else |
| 6160 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6161 | |
| 6162 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6163 | } |
| 6164 | |
| 6165 | DEFUN (ospf_default_information_originate_type_metric_routemap, |
| 6166 | ospf_default_information_originate_type_metric_routemap_cmd, |
| 6167 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6168 | "Control distribution of default information\n" |
| 6169 | "Distribute a default route\n" |
| 6170 | "OSPF metric type for default routes\n" |
| 6171 | "Set OSPF External Type 1 metrics\n" |
| 6172 | "Set OSPF External Type 2 metrics\n" |
| 6173 | "OSPF default metric\n" |
| 6174 | "OSPF metric\n" |
| 6175 | "Route map reference\n" |
| 6176 | "Pointer to route-map entries\n") |
| 6177 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6178 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6179 | int type = -1; |
| 6180 | int metric = -1; |
| 6181 | |
| 6182 | /* Get metric type. */ |
| 6183 | if (argc >= 1) |
| 6184 | if (!str2metric_type (argv[0], &type)) |
| 6185 | return CMD_WARNING; |
| 6186 | |
| 6187 | /* Get metric value. */ |
| 6188 | if (argc >= 2) |
| 6189 | if (!str2metric (argv[1], &metric)) |
| 6190 | return CMD_WARNING; |
| 6191 | |
| 6192 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6193 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6194 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6195 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6196 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6197 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6198 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6199 | } |
| 6200 | |
| 6201 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6202 | ospf_default_information_originate_type_metric_cmd, |
| 6203 | "default-information originate metric-type (1|2) metric <0-16777214>", |
| 6204 | "Control distribution of default information\n" |
| 6205 | "Distribute a default route\n" |
| 6206 | "OSPF metric type for default routes\n" |
| 6207 | "Set OSPF External Type 1 metrics\n" |
| 6208 | "Set OSPF External Type 2 metrics\n" |
| 6209 | "OSPF default metric\n" |
| 6210 | "OSPF metric\n") |
| 6211 | |
| 6212 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6213 | ospf_default_information_originate_type_cmd, |
| 6214 | "default-information originate metric-type (1|2)", |
| 6215 | "Control distribution of default information\n" |
| 6216 | "Distribute a default route\n" |
| 6217 | "OSPF metric type for default routes\n" |
| 6218 | "Set OSPF External Type 1 metrics\n" |
| 6219 | "Set OSPF External Type 2 metrics\n") |
| 6220 | |
| 6221 | DEFUN (ospf_default_information_originate_type_routemap, |
| 6222 | ospf_default_information_originate_type_routemap_cmd, |
| 6223 | "default-information originate metric-type (1|2) route-map WORD", |
| 6224 | "Control distribution of default information\n" |
| 6225 | "Distribute a default route\n" |
| 6226 | "OSPF metric type for default routes\n" |
| 6227 | "Set OSPF External Type 1 metrics\n" |
| 6228 | "Set OSPF External Type 2 metrics\n" |
| 6229 | "Route map reference\n" |
| 6230 | "Pointer to route-map entries\n") |
| 6231 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6232 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6233 | int type = -1; |
| 6234 | |
| 6235 | /* Get metric type. */ |
| 6236 | if (argc >= 1) |
| 6237 | if (!str2metric_type (argv[0], &type)) |
| 6238 | return CMD_WARNING; |
| 6239 | |
| 6240 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6241 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6242 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6243 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6244 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6245 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6246 | type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6247 | } |
| 6248 | |
| 6249 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, |
| 6250 | ospf_default_information_originate_always_metric_type_routemap_cmd, |
| 6251 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6252 | "Control distribution of default information\n" |
| 6253 | "Distribute a default route\n" |
| 6254 | "Always advertise default route\n" |
| 6255 | "OSPF default metric\n" |
| 6256 | "OSPF metric\n" |
| 6257 | "OSPF metric type for default routes\n" |
| 6258 | "Set OSPF External Type 1 metrics\n" |
| 6259 | "Set OSPF External Type 2 metrics\n" |
| 6260 | "Route map reference\n" |
| 6261 | "Pointer to route-map entries\n") |
| 6262 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6263 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6264 | int type = -1; |
| 6265 | int metric = -1; |
| 6266 | |
| 6267 | /* Get metric value. */ |
| 6268 | if (argc >= 1) |
| 6269 | if (!str2metric (argv[0], &metric)) |
| 6270 | return CMD_WARNING; |
| 6271 | |
| 6272 | /* Get metric type. */ |
| 6273 | if (argc >= 2) |
| 6274 | if (!str2metric_type (argv[1], &type)) |
| 6275 | return CMD_WARNING; |
| 6276 | |
| 6277 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6278 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6279 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6280 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6281 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6282 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6283 | type, metric); |
| 6284 | } |
| 6285 | |
| 6286 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6287 | ospf_default_information_originate_always_metric_type_cmd, |
| 6288 | "default-information originate always metric <0-16777214> metric-type (1|2)", |
| 6289 | "Control distribution of default information\n" |
| 6290 | "Distribute a default route\n" |
| 6291 | "Always advertise default route\n" |
| 6292 | "OSPF default metric\n" |
| 6293 | "OSPF metric\n" |
| 6294 | "OSPF metric type for default routes\n" |
| 6295 | "Set OSPF External Type 1 metrics\n" |
| 6296 | "Set OSPF External Type 2 metrics\n") |
| 6297 | |
| 6298 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6299 | ospf_default_information_originate_always_metric_cmd, |
| 6300 | "default-information originate always metric <0-16777214>", |
| 6301 | "Control distribution of default information\n" |
| 6302 | "Distribute a default route\n" |
| 6303 | "Always advertise default route\n" |
| 6304 | "OSPF default metric\n" |
| 6305 | "OSPF metric\n" |
| 6306 | "OSPF metric type for default routes\n") |
| 6307 | |
| 6308 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6309 | ospf_default_information_originate_always_cmd, |
| 6310 | "default-information originate always", |
| 6311 | "Control distribution of default information\n" |
| 6312 | "Distribute a default route\n" |
| 6313 | "Always advertise default route\n") |
| 6314 | |
| 6315 | DEFUN (ospf_default_information_originate_always_metric_routemap, |
| 6316 | ospf_default_information_originate_always_metric_routemap_cmd, |
| 6317 | "default-information originate always metric <0-16777214> route-map WORD", |
| 6318 | "Control distribution of default information\n" |
| 6319 | "Distribute a default route\n" |
| 6320 | "Always advertise default route\n" |
| 6321 | "OSPF default metric\n" |
| 6322 | "OSPF metric\n" |
| 6323 | "Route map reference\n" |
| 6324 | "Pointer to route-map entries\n") |
| 6325 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6326 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6327 | int metric = -1; |
| 6328 | |
| 6329 | /* Get metric value. */ |
| 6330 | if (argc >= 1) |
| 6331 | if (!str2metric (argv[0], &metric)) |
| 6332 | return CMD_WARNING; |
| 6333 | |
| 6334 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6335 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6336 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6337 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6338 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6339 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
| 6340 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6341 | } |
| 6342 | |
| 6343 | DEFUN (ospf_default_information_originate_always_routemap, |
| 6344 | ospf_default_information_originate_always_routemap_cmd, |
| 6345 | "default-information originate always route-map WORD", |
| 6346 | "Control distribution of default information\n" |
| 6347 | "Distribute a default route\n" |
| 6348 | "Always advertise default route\n" |
| 6349 | "Route map reference\n" |
| 6350 | "Pointer to route-map entries\n") |
| 6351 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6352 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6353 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6354 | if (argc == 1) |
| 6355 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6356 | else |
| 6357 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6358 | |
| 6359 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6360 | } |
| 6361 | |
| 6362 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, |
| 6363 | ospf_default_information_originate_always_type_metric_routemap_cmd, |
| 6364 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6365 | "Control distribution of default information\n" |
| 6366 | "Distribute a default route\n" |
| 6367 | "Always advertise default route\n" |
| 6368 | "OSPF metric type for default routes\n" |
| 6369 | "Set OSPF External Type 1 metrics\n" |
| 6370 | "Set OSPF External Type 2 metrics\n" |
| 6371 | "OSPF default metric\n" |
| 6372 | "OSPF metric\n" |
| 6373 | "Route map reference\n" |
| 6374 | "Pointer to route-map entries\n") |
| 6375 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6376 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6377 | int type = -1; |
| 6378 | int metric = -1; |
| 6379 | |
| 6380 | /* Get metric type. */ |
| 6381 | if (argc >= 1) |
| 6382 | if (!str2metric_type (argv[0], &type)) |
| 6383 | return CMD_WARNING; |
| 6384 | |
| 6385 | /* Get metric value. */ |
| 6386 | if (argc >= 2) |
| 6387 | if (!str2metric (argv[1], &metric)) |
| 6388 | return CMD_WARNING; |
| 6389 | |
| 6390 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6391 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6392 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6393 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6394 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6395 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6396 | type, metric); |
| 6397 | } |
| 6398 | |
| 6399 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6400 | ospf_default_information_originate_always_type_metric_cmd, |
| 6401 | "default-information originate always metric-type (1|2) metric <0-16777214>", |
| 6402 | "Control distribution of default information\n" |
| 6403 | "Distribute a default route\n" |
| 6404 | "Always advertise default route\n" |
| 6405 | "OSPF metric type for default routes\n" |
| 6406 | "Set OSPF External Type 1 metrics\n" |
| 6407 | "Set OSPF External Type 2 metrics\n" |
| 6408 | "OSPF default metric\n" |
| 6409 | "OSPF metric\n") |
| 6410 | |
| 6411 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6412 | ospf_default_information_originate_always_type_cmd, |
| 6413 | "default-information originate always metric-type (1|2)", |
| 6414 | "Control distribution of default information\n" |
| 6415 | "Distribute a default route\n" |
| 6416 | "Always advertise default route\n" |
| 6417 | "OSPF metric type for default routes\n" |
| 6418 | "Set OSPF External Type 1 metrics\n" |
| 6419 | "Set OSPF External Type 2 metrics\n") |
| 6420 | |
| 6421 | DEFUN (ospf_default_information_originate_always_type_routemap, |
| 6422 | ospf_default_information_originate_always_type_routemap_cmd, |
| 6423 | "default-information originate always metric-type (1|2) route-map WORD", |
| 6424 | "Control distribution of default information\n" |
| 6425 | "Distribute a default route\n" |
| 6426 | "Always advertise default route\n" |
| 6427 | "OSPF metric type for default routes\n" |
| 6428 | "Set OSPF External Type 1 metrics\n" |
| 6429 | "Set OSPF External Type 2 metrics\n" |
| 6430 | "Route map reference\n" |
| 6431 | "Pointer to route-map entries\n") |
| 6432 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6433 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6434 | int type = -1; |
| 6435 | |
| 6436 | /* Get metric type. */ |
| 6437 | if (argc >= 1) |
| 6438 | if (!str2metric_type (argv[0], &type)) |
| 6439 | return CMD_WARNING; |
| 6440 | |
| 6441 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6442 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6443 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6444 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6445 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6446 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6447 | type, -1); |
| 6448 | } |
| 6449 | |
| 6450 | DEFUN (no_ospf_default_information_originate, |
| 6451 | no_ospf_default_information_originate_cmd, |
| 6452 | "no default-information originate", |
| 6453 | NO_STR |
| 6454 | "Control distribution of default information\n" |
| 6455 | "Distribute a default route\n") |
| 6456 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6457 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6458 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6459 | |
| 6460 | p.family = AF_INET; |
| 6461 | p.prefix.s_addr = 0; |
| 6462 | p.prefixlen = 0; |
| 6463 | |
ajs | 5339cfd | 2005-09-19 13:28:05 +0000 | [diff] [blame] | 6464 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6465 | |
| 6466 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { |
| 6467 | ospf_external_info_delete (DEFAULT_ROUTE, p); |
| 6468 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); |
| 6469 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; |
| 6470 | } |
| 6471 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6472 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6473 | return ospf_redistribute_default_unset (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6474 | } |
| 6475 | |
| 6476 | DEFUN (ospf_default_metric, |
| 6477 | ospf_default_metric_cmd, |
| 6478 | "default-metric <0-16777214>", |
| 6479 | "Set metric of redistributed routes\n" |
| 6480 | "Default metric\n") |
| 6481 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6482 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6483 | int metric = -1; |
| 6484 | |
| 6485 | if (!str2metric (argv[0], &metric)) |
| 6486 | return CMD_WARNING; |
| 6487 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6488 | ospf->default_metric = metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6489 | |
| 6490 | return CMD_SUCCESS; |
| 6491 | } |
| 6492 | |
| 6493 | DEFUN (no_ospf_default_metric, |
| 6494 | no_ospf_default_metric_cmd, |
| 6495 | "no default-metric", |
| 6496 | NO_STR |
| 6497 | "Set metric of redistributed routes\n") |
| 6498 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6499 | struct ospf *ospf = vty->index; |
| 6500 | |
| 6501 | ospf->default_metric = -1; |
| 6502 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6503 | return CMD_SUCCESS; |
| 6504 | } |
| 6505 | |
| 6506 | ALIAS (no_ospf_default_metric, |
| 6507 | no_ospf_default_metric_val_cmd, |
| 6508 | "no default-metric <0-16777214>", |
| 6509 | NO_STR |
| 6510 | "Set metric of redistributed routes\n" |
| 6511 | "Default metric\n") |
| 6512 | |
| 6513 | DEFUN (ospf_distance, |
| 6514 | ospf_distance_cmd, |
| 6515 | "distance <1-255>", |
| 6516 | "Define an administrative distance\n" |
| 6517 | "OSPF Administrative distance\n") |
| 6518 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6519 | struct ospf *ospf = vty->index; |
| 6520 | |
| 6521 | ospf->distance_all = atoi (argv[0]); |
| 6522 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6523 | return CMD_SUCCESS; |
| 6524 | } |
| 6525 | |
| 6526 | DEFUN (no_ospf_distance, |
| 6527 | no_ospf_distance_cmd, |
| 6528 | "no distance <1-255>", |
| 6529 | NO_STR |
| 6530 | "Define an administrative distance\n" |
| 6531 | "OSPF Administrative distance\n") |
| 6532 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6533 | struct ospf *ospf = vty->index; |
| 6534 | |
| 6535 | ospf->distance_all = 0; |
| 6536 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6537 | return CMD_SUCCESS; |
| 6538 | } |
| 6539 | |
| 6540 | DEFUN (no_ospf_distance_ospf, |
| 6541 | no_ospf_distance_ospf_cmd, |
| 6542 | "no distance ospf", |
| 6543 | NO_STR |
| 6544 | "Define an administrative distance\n" |
| 6545 | "OSPF Administrative distance\n" |
| 6546 | "OSPF Distance\n") |
| 6547 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6548 | struct ospf *ospf = vty->index; |
| 6549 | |
| 6550 | ospf->distance_intra = 0; |
| 6551 | ospf->distance_inter = 0; |
| 6552 | ospf->distance_external = 0; |
| 6553 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6554 | return CMD_SUCCESS; |
| 6555 | } |
| 6556 | |
| 6557 | DEFUN (ospf_distance_ospf_intra, |
| 6558 | ospf_distance_ospf_intra_cmd, |
| 6559 | "distance ospf intra-area <1-255>", |
| 6560 | "Define an administrative distance\n" |
| 6561 | "OSPF Administrative distance\n" |
| 6562 | "Intra-area routes\n" |
| 6563 | "Distance for intra-area routes\n") |
| 6564 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6565 | struct ospf *ospf = vty->index; |
| 6566 | |
| 6567 | ospf->distance_intra = atoi (argv[0]); |
| 6568 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6569 | return CMD_SUCCESS; |
| 6570 | } |
| 6571 | |
| 6572 | DEFUN (ospf_distance_ospf_intra_inter, |
| 6573 | ospf_distance_ospf_intra_inter_cmd, |
| 6574 | "distance ospf intra-area <1-255> inter-area <1-255>", |
| 6575 | "Define an administrative distance\n" |
| 6576 | "OSPF Administrative distance\n" |
| 6577 | "Intra-area routes\n" |
| 6578 | "Distance for intra-area routes\n" |
| 6579 | "Inter-area routes\n" |
| 6580 | "Distance for inter-area routes\n") |
| 6581 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6582 | struct ospf *ospf = vty->index; |
| 6583 | |
| 6584 | ospf->distance_intra = atoi (argv[0]); |
| 6585 | ospf->distance_inter = atoi (argv[1]); |
| 6586 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6587 | return CMD_SUCCESS; |
| 6588 | } |
| 6589 | |
| 6590 | DEFUN (ospf_distance_ospf_intra_external, |
| 6591 | ospf_distance_ospf_intra_external_cmd, |
| 6592 | "distance ospf intra-area <1-255> external <1-255>", |
| 6593 | "Define an administrative distance\n" |
| 6594 | "OSPF Administrative distance\n" |
| 6595 | "Intra-area routes\n" |
| 6596 | "Distance for intra-area routes\n" |
| 6597 | "External routes\n" |
| 6598 | "Distance for external routes\n") |
| 6599 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6600 | struct ospf *ospf = vty->index; |
| 6601 | |
| 6602 | ospf->distance_intra = atoi (argv[0]); |
| 6603 | ospf->distance_external = atoi (argv[1]); |
| 6604 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6605 | return CMD_SUCCESS; |
| 6606 | } |
| 6607 | |
| 6608 | DEFUN (ospf_distance_ospf_intra_inter_external, |
| 6609 | ospf_distance_ospf_intra_inter_external_cmd, |
| 6610 | "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>", |
| 6611 | "Define an administrative distance\n" |
| 6612 | "OSPF Administrative distance\n" |
| 6613 | "Intra-area routes\n" |
| 6614 | "Distance for intra-area routes\n" |
| 6615 | "Inter-area routes\n" |
| 6616 | "Distance for inter-area routes\n" |
| 6617 | "External routes\n" |
| 6618 | "Distance for external routes\n") |
| 6619 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6620 | struct ospf *ospf = vty->index; |
| 6621 | |
| 6622 | ospf->distance_intra = atoi (argv[0]); |
| 6623 | ospf->distance_inter = atoi (argv[1]); |
| 6624 | ospf->distance_external = atoi (argv[2]); |
| 6625 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6626 | return CMD_SUCCESS; |
| 6627 | } |
| 6628 | |
| 6629 | DEFUN (ospf_distance_ospf_intra_external_inter, |
| 6630 | ospf_distance_ospf_intra_external_inter_cmd, |
| 6631 | "distance ospf intra-area <1-255> external <1-255> inter-area <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 | "External routes\n" |
| 6637 | "Distance for external routes\n" |
| 6638 | "Inter-area routes\n" |
| 6639 | "Distance for inter-area 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_external = atoi (argv[1]); |
| 6645 | ospf->distance_inter = 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_inter, |
| 6651 | ospf_distance_ospf_inter_cmd, |
| 6652 | "distance ospf inter-area <1-255>", |
| 6653 | "Define an administrative distance\n" |
| 6654 | "OSPF Administrative distance\n" |
| 6655 | "Inter-area routes\n" |
| 6656 | "Distance for inter-area routes\n") |
| 6657 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6658 | struct ospf *ospf = vty->index; |
| 6659 | |
| 6660 | ospf->distance_inter = atoi (argv[0]); |
| 6661 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6662 | return CMD_SUCCESS; |
| 6663 | } |
| 6664 | |
| 6665 | DEFUN (ospf_distance_ospf_inter_intra, |
| 6666 | ospf_distance_ospf_inter_intra_cmd, |
| 6667 | "distance ospf inter-area <1-255> intra-area <1-255>", |
| 6668 | "Define an administrative distance\n" |
| 6669 | "OSPF Administrative distance\n" |
| 6670 | "Inter-area routes\n" |
| 6671 | "Distance for inter-area routes\n" |
| 6672 | "Intra-area routes\n" |
| 6673 | "Distance for intra-area routes\n") |
| 6674 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6675 | struct ospf *ospf = vty->index; |
| 6676 | |
| 6677 | ospf->distance_inter = atoi (argv[0]); |
| 6678 | ospf->distance_intra = atoi (argv[1]); |
| 6679 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6680 | return CMD_SUCCESS; |
| 6681 | } |
| 6682 | |
| 6683 | DEFUN (ospf_distance_ospf_inter_external, |
| 6684 | ospf_distance_ospf_inter_external_cmd, |
| 6685 | "distance ospf inter-area <1-255> external <1-255>", |
| 6686 | "Define an administrative distance\n" |
| 6687 | "OSPF Administrative distance\n" |
| 6688 | "Inter-area routes\n" |
| 6689 | "Distance for inter-area routes\n" |
| 6690 | "External routes\n" |
| 6691 | "Distance for external routes\n") |
| 6692 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6693 | struct ospf *ospf = vty->index; |
| 6694 | |
| 6695 | ospf->distance_inter = atoi (argv[0]); |
| 6696 | ospf->distance_external = atoi (argv[1]); |
| 6697 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6698 | return CMD_SUCCESS; |
| 6699 | } |
| 6700 | |
| 6701 | DEFUN (ospf_distance_ospf_inter_intra_external, |
| 6702 | ospf_distance_ospf_inter_intra_external_cmd, |
| 6703 | "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", |
| 6704 | "Define an administrative distance\n" |
| 6705 | "OSPF Administrative distance\n" |
| 6706 | "Inter-area routes\n" |
| 6707 | "Distance for inter-area routes\n" |
| 6708 | "Intra-area routes\n" |
| 6709 | "Distance for intra-area routes\n" |
| 6710 | "External routes\n" |
| 6711 | "Distance for external routes\n") |
| 6712 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6713 | struct ospf *ospf = vty->index; |
| 6714 | |
| 6715 | ospf->distance_inter = atoi (argv[0]); |
| 6716 | ospf->distance_intra = atoi (argv[1]); |
| 6717 | ospf->distance_external = atoi (argv[2]); |
| 6718 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6719 | return CMD_SUCCESS; |
| 6720 | } |
| 6721 | |
| 6722 | DEFUN (ospf_distance_ospf_inter_external_intra, |
| 6723 | ospf_distance_ospf_inter_external_intra_cmd, |
| 6724 | "distance ospf inter-area <1-255> external <1-255> intra-area <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 | "External routes\n" |
| 6730 | "Distance for external routes\n" |
| 6731 | "Intra-area routes\n" |
| 6732 | "Distance for intra-area 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_external = atoi (argv[1]); |
| 6738 | ospf->distance_intra = 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_external, |
| 6744 | ospf_distance_ospf_external_cmd, |
| 6745 | "distance ospf external <1-255>", |
| 6746 | "Define an administrative distance\n" |
| 6747 | "OSPF Administrative distance\n" |
| 6748 | "External routes\n" |
| 6749 | "Distance for external routes\n") |
| 6750 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6751 | struct ospf *ospf = vty->index; |
| 6752 | |
| 6753 | ospf->distance_external = atoi (argv[0]); |
| 6754 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6755 | return CMD_SUCCESS; |
| 6756 | } |
| 6757 | |
| 6758 | DEFUN (ospf_distance_ospf_external_intra, |
| 6759 | ospf_distance_ospf_external_intra_cmd, |
| 6760 | "distance ospf external <1-255> intra-area <1-255>", |
| 6761 | "Define an administrative distance\n" |
| 6762 | "OSPF Administrative distance\n" |
| 6763 | "External routes\n" |
| 6764 | "Distance for external routes\n" |
| 6765 | "Intra-area routes\n" |
| 6766 | "Distance for intra-area routes\n") |
| 6767 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6768 | struct ospf *ospf = vty->index; |
| 6769 | |
| 6770 | ospf->distance_external = atoi (argv[0]); |
| 6771 | ospf->distance_intra = atoi (argv[1]); |
| 6772 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6773 | return CMD_SUCCESS; |
| 6774 | } |
| 6775 | |
| 6776 | DEFUN (ospf_distance_ospf_external_inter, |
| 6777 | ospf_distance_ospf_external_inter_cmd, |
| 6778 | "distance ospf external <1-255> inter-area <1-255>", |
| 6779 | "Define an administrative distance\n" |
| 6780 | "OSPF Administrative distance\n" |
| 6781 | "External routes\n" |
| 6782 | "Distance for external routes\n" |
| 6783 | "Inter-area routes\n" |
| 6784 | "Distance for inter-area routes\n") |
| 6785 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6786 | struct ospf *ospf = vty->index; |
| 6787 | |
| 6788 | ospf->distance_external = atoi (argv[0]); |
| 6789 | ospf->distance_inter = atoi (argv[1]); |
| 6790 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6791 | return CMD_SUCCESS; |
| 6792 | } |
| 6793 | |
| 6794 | DEFUN (ospf_distance_ospf_external_intra_inter, |
| 6795 | ospf_distance_ospf_external_intra_inter_cmd, |
| 6796 | "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>", |
| 6797 | "Define an administrative distance\n" |
| 6798 | "OSPF Administrative distance\n" |
| 6799 | "External routes\n" |
| 6800 | "Distance for external routes\n" |
| 6801 | "Intra-area routes\n" |
| 6802 | "Distance for intra-area routes\n" |
| 6803 | "Inter-area routes\n" |
| 6804 | "Distance for inter-area routes\n") |
| 6805 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6806 | struct ospf *ospf = vty->index; |
| 6807 | |
| 6808 | ospf->distance_external = atoi (argv[0]); |
| 6809 | ospf->distance_intra = atoi (argv[1]); |
| 6810 | ospf->distance_inter = atoi (argv[2]); |
| 6811 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6812 | return CMD_SUCCESS; |
| 6813 | } |
| 6814 | |
| 6815 | DEFUN (ospf_distance_ospf_external_inter_intra, |
| 6816 | ospf_distance_ospf_external_inter_intra_cmd, |
| 6817 | "distance ospf external <1-255> inter-area <1-255> intra-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 | "Inter-area routes\n" |
| 6823 | "Distance for inter-area routes\n" |
| 6824 | "Intra-area routes\n" |
| 6825 | "Distance for intra-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_inter = atoi (argv[1]); |
| 6831 | ospf->distance_intra = 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_source, |
| 6837 | ospf_distance_source_cmd, |
| 6838 | "distance <1-255> A.B.C.D/M", |
| 6839 | "Administrative distance\n" |
| 6840 | "Distance value\n" |
| 6841 | "IP source prefix\n") |
| 6842 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6843 | struct ospf *ospf = vty->index; |
| 6844 | |
| 6845 | ospf_distance_set (vty, ospf, argv[0], argv[1], NULL); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6846 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6847 | return CMD_SUCCESS; |
| 6848 | } |
| 6849 | |
| 6850 | DEFUN (no_ospf_distance_source, |
| 6851 | no_ospf_distance_source_cmd, |
| 6852 | "no distance <1-255> A.B.C.D/M", |
| 6853 | NO_STR |
| 6854 | "Administrative distance\n" |
| 6855 | "Distance value\n" |
| 6856 | "IP source prefix\n") |
| 6857 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6858 | struct ospf *ospf = vty->index; |
| 6859 | |
| 6860 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); |
| 6861 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6862 | return CMD_SUCCESS; |
| 6863 | } |
| 6864 | |
| 6865 | DEFUN (ospf_distance_source_access_list, |
| 6866 | ospf_distance_source_access_list_cmd, |
| 6867 | "distance <1-255> A.B.C.D/M WORD", |
| 6868 | "Administrative distance\n" |
| 6869 | "Distance value\n" |
| 6870 | "IP source prefix\n" |
| 6871 | "Access list name\n") |
| 6872 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6873 | struct ospf *ospf = vty->index; |
| 6874 | |
| 6875 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); |
| 6876 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6877 | return CMD_SUCCESS; |
| 6878 | } |
| 6879 | |
| 6880 | DEFUN (no_ospf_distance_source_access_list, |
| 6881 | no_ospf_distance_source_access_list_cmd, |
| 6882 | "no distance <1-255> A.B.C.D/M WORD", |
| 6883 | NO_STR |
| 6884 | "Administrative distance\n" |
| 6885 | "Distance value\n" |
| 6886 | "IP source prefix\n" |
| 6887 | "Access list name\n") |
| 6888 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6889 | struct ospf *ospf = vty->index; |
| 6890 | |
| 6891 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); |
| 6892 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6893 | return CMD_SUCCESS; |
| 6894 | } |
| 6895 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 6896 | DEFUN (ip_ospf_mtu_ignore, |
| 6897 | ip_ospf_mtu_ignore_addr_cmd, |
| 6898 | "ip ospf mtu-ignore A.B.C.D", |
| 6899 | "IP Information\n" |
| 6900 | "OSPF interface commands\n" |
| 6901 | "Disable mtu mismatch detection\n" |
| 6902 | "Address of interface") |
| 6903 | { |
| 6904 | struct interface *ifp = vty->index; |
| 6905 | struct in_addr addr; |
| 6906 | int ret; |
| 6907 | |
| 6908 | struct ospf_if_params *params; |
| 6909 | params = IF_DEF_PARAMS (ifp); |
| 6910 | |
| 6911 | if (argc == 1) |
| 6912 | { |
| 6913 | ret = inet_aton(argv[0], &addr); |
| 6914 | if (!ret) |
| 6915 | { |
| 6916 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6917 | VTY_NEWLINE); |
| 6918 | return CMD_WARNING; |
| 6919 | } |
| 6920 | params = ospf_get_if_params (ifp, addr); |
| 6921 | ospf_if_update_params (ifp, addr); |
| 6922 | } |
| 6923 | params->mtu_ignore = 1; |
| 6924 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6925 | SET_IF_PARAM (params, mtu_ignore); |
| 6926 | else |
| 6927 | { |
| 6928 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6929 | if (params != IF_DEF_PARAMS (ifp)) |
| 6930 | { |
| 6931 | ospf_free_if_params (ifp, addr); |
| 6932 | ospf_if_update_params (ifp, addr); |
| 6933 | } |
| 6934 | } |
| 6935 | return CMD_SUCCESS; |
| 6936 | } |
| 6937 | |
| 6938 | ALIAS (ip_ospf_mtu_ignore, |
| 6939 | ip_ospf_mtu_ignore_cmd, |
| 6940 | "ip ospf mtu-ignore", |
| 6941 | "IP Information\n" |
| 6942 | "OSPF interface commands\n" |
| 6943 | "Disable mtu mismatch detection\n") |
| 6944 | |
| 6945 | |
| 6946 | DEFUN (no_ip_ospf_mtu_ignore, |
| 6947 | no_ip_ospf_mtu_ignore_addr_cmd, |
| 6948 | "no ip ospf mtu-ignore A.B.C.D", |
| 6949 | "IP Information\n" |
| 6950 | "OSPF interface commands\n" |
| 6951 | "Disable mtu mismatch detection\n" |
| 6952 | "Address of interface") |
| 6953 | { |
| 6954 | struct interface *ifp = vty->index; |
| 6955 | struct in_addr addr; |
| 6956 | int ret; |
| 6957 | |
| 6958 | struct ospf_if_params *params; |
| 6959 | params = IF_DEF_PARAMS (ifp); |
| 6960 | |
| 6961 | if (argc == 1) |
| 6962 | { |
| 6963 | ret = inet_aton(argv[0], &addr); |
| 6964 | if (!ret) |
| 6965 | { |
| 6966 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6967 | VTY_NEWLINE); |
| 6968 | return CMD_WARNING; |
| 6969 | } |
| 6970 | params = ospf_get_if_params (ifp, addr); |
| 6971 | ospf_if_update_params (ifp, addr); |
| 6972 | } |
| 6973 | params->mtu_ignore = 0; |
| 6974 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6975 | SET_IF_PARAM (params, mtu_ignore); |
| 6976 | else |
| 6977 | { |
| 6978 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6979 | if (params != IF_DEF_PARAMS (ifp)) |
| 6980 | { |
| 6981 | ospf_free_if_params (ifp, addr); |
| 6982 | ospf_if_update_params (ifp, addr); |
| 6983 | } |
| 6984 | } |
| 6985 | return CMD_SUCCESS; |
| 6986 | } |
| 6987 | |
| 6988 | ALIAS (no_ip_ospf_mtu_ignore, |
| 6989 | no_ip_ospf_mtu_ignore_cmd, |
| 6990 | "no ip ospf mtu-ignore", |
| 6991 | "IP Information\n" |
| 6992 | "OSPF interface commands\n" |
| 6993 | "Disable mtu mismatch detection\n") |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 6994 | |
| 6995 | DEFUN (ospf_max_metric_router_lsa_admin, |
| 6996 | ospf_max_metric_router_lsa_admin_cmd, |
| 6997 | "max-metric router-lsa administrative", |
| 6998 | "OSPF maximum / infinite-distance metric\n" |
| 6999 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7000 | "Administratively applied, for an indefinite period\n") |
| 7001 | { |
| 7002 | struct listnode *ln; |
| 7003 | struct ospf_area *area; |
| 7004 | struct ospf *ospf = vty->index; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7005 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7006 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7007 | { |
| 7008 | SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 7009 | |
| 7010 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
| 7011 | ospf_router_lsa_timer_add (area); |
| 7012 | } |
| 7013 | return CMD_SUCCESS; |
| 7014 | } |
| 7015 | |
| 7016 | DEFUN (no_ospf_max_metric_router_lsa_admin, |
| 7017 | no_ospf_max_metric_router_lsa_admin_cmd, |
| 7018 | "no max-metric router-lsa administrative", |
| 7019 | NO_STR |
| 7020 | "OSPF maximum / infinite-distance metric\n" |
| 7021 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7022 | "Administratively applied, for an indefinite period\n") |
| 7023 | { |
| 7024 | struct listnode *ln; |
| 7025 | struct ospf_area *area; |
| 7026 | struct ospf *ospf = vty->index; |
| 7027 | |
| 7028 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7029 | { |
| 7030 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 7031 | |
| 7032 | /* Don't trample on the start-up stub timer */ |
| 7033 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED) |
| 7034 | && !area->t_stub_router) |
| 7035 | { |
| 7036 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
| 7037 | ospf_router_lsa_timer_add (area); |
| 7038 | } |
| 7039 | } |
| 7040 | return CMD_SUCCESS; |
| 7041 | } |
| 7042 | |
| 7043 | DEFUN (ospf_max_metric_router_lsa_startup, |
| 7044 | ospf_max_metric_router_lsa_startup_cmd, |
| 7045 | "max-metric router-lsa on-startup <5-86400>", |
| 7046 | "OSPF maximum / infinite-distance metric\n" |
| 7047 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7048 | "Automatically advertise stub Router-LSA on startup of OSPF\n" |
| 7049 | "Time (seconds) to advertise self as stub-router\n") |
| 7050 | { |
| 7051 | unsigned int seconds; |
| 7052 | struct ospf *ospf = vty->index; |
| 7053 | |
| 7054 | if (argc != 1) |
| 7055 | { |
| 7056 | vty_out (vty, "%% Must supply stub-router period"); |
| 7057 | return CMD_WARNING; |
| 7058 | } |
| 7059 | |
| 7060 | VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); |
| 7061 | |
| 7062 | ospf->stub_router_startup_time = seconds; |
| 7063 | |
| 7064 | return CMD_SUCCESS; |
| 7065 | } |
| 7066 | |
| 7067 | DEFUN (no_ospf_max_metric_router_lsa_startup, |
| 7068 | no_ospf_max_metric_router_lsa_startup_cmd, |
| 7069 | "no max-metric router-lsa on-startup", |
| 7070 | NO_STR |
| 7071 | "OSPF maximum / infinite-distance metric\n" |
| 7072 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7073 | "Automatically advertise stub Router-LSA on startup of OSPF\n") |
| 7074 | { |
| 7075 | struct listnode *ln; |
| 7076 | struct ospf_area *area; |
| 7077 | struct ospf *ospf = vty->index; |
| 7078 | |
| 7079 | ospf->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 7080 | |
| 7081 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7082 | { |
| 7083 | SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED); |
| 7084 | OSPF_TIMER_OFF (area->t_stub_router); |
| 7085 | |
| 7086 | /* Don't trample on admin stub routed */ |
| 7087 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 7088 | { |
| 7089 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
| 7090 | ospf_router_lsa_timer_add (area); |
| 7091 | } |
| 7092 | } |
| 7093 | return CMD_SUCCESS; |
| 7094 | } |
| 7095 | |
| 7096 | DEFUN (ospf_max_metric_router_lsa_shutdown, |
| 7097 | ospf_max_metric_router_lsa_shutdown_cmd, |
| 7098 | "max-metric router-lsa on-shutdown <5-86400>", |
| 7099 | "OSPF maximum / infinite-distance metric\n" |
| 7100 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7101 | "Advertise stub-router prior to full shutdown of OSPF\n" |
| 7102 | "Time (seconds) to wait till full shutdown\n") |
| 7103 | { |
| 7104 | unsigned int seconds; |
| 7105 | struct ospf *ospf = vty->index; |
| 7106 | |
| 7107 | if (argc != 1) |
| 7108 | { |
| 7109 | vty_out (vty, "%% Must supply stub-router shutdown period"); |
| 7110 | return CMD_WARNING; |
| 7111 | } |
| 7112 | |
| 7113 | VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); |
| 7114 | |
| 7115 | ospf->stub_router_shutdown_time = seconds; |
| 7116 | |
| 7117 | return CMD_SUCCESS; |
| 7118 | } |
| 7119 | |
| 7120 | DEFUN (no_ospf_max_metric_router_lsa_shutdown, |
| 7121 | no_ospf_max_metric_router_lsa_shutdown_cmd, |
| 7122 | "no max-metric router-lsa on-shutdown", |
| 7123 | NO_STR |
| 7124 | "OSPF maximum / infinite-distance metric\n" |
| 7125 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7126 | "Advertise stub-router prior to full shutdown of OSPF\n") |
| 7127 | { |
| 7128 | struct ospf *ospf = vty->index; |
| 7129 | |
| 7130 | ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 7131 | |
| 7132 | return CMD_SUCCESS; |
| 7133 | } |
| 7134 | |
| 7135 | static void |
| 7136 | config_write_stub_router (struct vty *vty, struct ospf *ospf) |
| 7137 | { |
| 7138 | struct listnode *ln; |
| 7139 | struct ospf_area *area; |
| 7140 | |
| 7141 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 7142 | vty_out (vty, " max-metric router-lsa on-startup %u%s", |
| 7143 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 7144 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 7145 | vty_out (vty, " max-metric router-lsa on-shutdown %u%s", |
| 7146 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 7147 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7148 | { |
| 7149 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 7150 | { |
| 7151 | vty_out (vty, " max-metric router-lsa administrative%s", |
| 7152 | VTY_NEWLINE); |
| 7153 | break; |
| 7154 | } |
| 7155 | } |
| 7156 | return; |
| 7157 | } |
| 7158 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7159 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7160 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
| 7161 | { |
| 7162 | struct route_node *rn; |
| 7163 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7164 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7165 | struct ospf_path *path; |
| 7166 | |
| 7167 | vty_out (vty, "============ OSPF network routing table ============%s", |
| 7168 | VTY_NEWLINE); |
| 7169 | |
| 7170 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7171 | if ((or = rn->info) != NULL) |
| 7172 | { |
| 7173 | char buf1[19]; |
| 7174 | snprintf (buf1, 19, "%s/%d", |
| 7175 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7176 | |
| 7177 | switch (or->path_type) |
| 7178 | { |
| 7179 | case OSPF_PATH_INTER_AREA: |
| 7180 | if (or->type == OSPF_DESTINATION_NETWORK) |
| 7181 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, |
| 7182 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7183 | else if (or->type == OSPF_DESTINATION_DISCARD) |
| 7184 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); |
| 7185 | break; |
| 7186 | case OSPF_PATH_INTRA_AREA: |
| 7187 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, |
| 7188 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7189 | break; |
| 7190 | default: |
| 7191 | break; |
| 7192 | } |
| 7193 | |
| 7194 | if (or->type == OSPF_DESTINATION_NETWORK) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7195 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7196 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7197 | if (if_lookup_by_index(path->ifindex)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7198 | { |
| 7199 | if (path->nexthop.s_addr == 0) |
| 7200 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7201 | "", ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7202 | else |
| 7203 | vty_out (vty, "%24s via %s, %s%s", "", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7204 | inet_ntoa (path->nexthop), |
| 7205 | ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7206 | } |
| 7207 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7208 | } |
| 7209 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7210 | } |
| 7211 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7212 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7213 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
| 7214 | { |
| 7215 | struct route_node *rn; |
| 7216 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7217 | struct listnode *pnode; |
| 7218 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7219 | struct ospf_path *path; |
| 7220 | |
| 7221 | vty_out (vty, "============ OSPF router routing table =============%s", |
| 7222 | VTY_NEWLINE); |
| 7223 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) |
| 7224 | if (rn->info) |
| 7225 | { |
| 7226 | int flag = 0; |
| 7227 | |
| 7228 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); |
| 7229 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7230 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
| 7231 | { |
| 7232 | if (flag++) |
| 7233 | vty_out (vty, "%24s", ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7234 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7235 | /* Show path. */ |
| 7236 | vty_out (vty, "%s [%d] area: %s", |
| 7237 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), |
| 7238 | or->cost, inet_ntoa (or->u.std.area_id)); |
| 7239 | /* Show flags. */ |
| 7240 | vty_out (vty, "%s%s%s", |
| 7241 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), |
| 7242 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), |
| 7243 | VTY_NEWLINE); |
| 7244 | |
| 7245 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) |
| 7246 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7247 | if (if_lookup_by_index(path->ifindex)) |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7248 | { |
| 7249 | if (path->nexthop.s_addr == 0) |
| 7250 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7251 | "", ifindex2ifname (path->ifindex), |
| 7252 | VTY_NEWLINE); |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7253 | else |
| 7254 | vty_out (vty, "%24s via %s, %s%s", "", |
| 7255 | inet_ntoa (path->nexthop), |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7256 | ifindex2ifname (path->ifindex), |
| 7257 | VTY_NEWLINE); |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7258 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7259 | } |
| 7260 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7261 | } |
| 7262 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7263 | } |
| 7264 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7265 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7266 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
| 7267 | { |
| 7268 | struct route_node *rn; |
| 7269 | struct ospf_route *er; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7270 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7271 | struct ospf_path *path; |
| 7272 | |
| 7273 | vty_out (vty, "============ OSPF external routing table ===========%s", |
| 7274 | VTY_NEWLINE); |
| 7275 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7276 | if ((er = rn->info) != NULL) |
| 7277 | { |
| 7278 | char buf1[19]; |
| 7279 | snprintf (buf1, 19, "%s/%d", |
| 7280 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7281 | |
| 7282 | switch (er->path_type) |
| 7283 | { |
| 7284 | case OSPF_PATH_TYPE1_EXTERNAL: |
| 7285 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, |
| 7286 | er->cost, er->u.ext.tag, VTY_NEWLINE); |
| 7287 | break; |
| 7288 | case OSPF_PATH_TYPE2_EXTERNAL: |
| 7289 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, |
| 7290 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); |
| 7291 | break; |
| 7292 | } |
| 7293 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7294 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7295 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7296 | if (if_lookup_by_index(path->ifindex)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7297 | { |
| 7298 | if (path->nexthop.s_addr == 0) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7299 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7300 | "", ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7301 | else |
| 7302 | vty_out (vty, "%24s via %s, %s%s", "", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7303 | inet_ntoa (path->nexthop), |
| 7304 | ifindex2ifname (path->ifindex), |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7305 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7306 | } |
| 7307 | } |
| 7308 | } |
| 7309 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7310 | } |
| 7311 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7312 | DEFUN (show_ip_ospf_border_routers, |
| 7313 | show_ip_ospf_border_routers_cmd, |
| 7314 | "show ip ospf border-routers", |
| 7315 | SHOW_STR |
| 7316 | IP_STR |
| 7317 | "show all the ABR's and ASBR's\n" |
| 7318 | "for this area\n") |
| 7319 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7320 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7321 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7322 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7323 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7324 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7325 | return CMD_SUCCESS; |
| 7326 | } |
| 7327 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7328 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7329 | { |
| 7330 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7331 | return CMD_SUCCESS; |
| 7332 | } |
| 7333 | |
| 7334 | /* Show Network routes. |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7335 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7336 | |
| 7337 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7338 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7339 | |
| 7340 | return CMD_SUCCESS; |
| 7341 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7342 | |
| 7343 | DEFUN (show_ip_ospf_route, |
| 7344 | show_ip_ospf_route_cmd, |
| 7345 | "show ip ospf route", |
| 7346 | SHOW_STR |
| 7347 | IP_STR |
| 7348 | "OSPF information\n" |
| 7349 | "OSPF routing table\n") |
| 7350 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7351 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7352 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7353 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7354 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7355 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7356 | return CMD_SUCCESS; |
| 7357 | } |
| 7358 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7359 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7360 | { |
| 7361 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7362 | return CMD_SUCCESS; |
| 7363 | } |
| 7364 | |
| 7365 | /* Show Network routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7366 | show_ip_ospf_route_network (vty, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7367 | |
| 7368 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7369 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7370 | |
| 7371 | /* Show AS External routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7372 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7373 | |
| 7374 | return CMD_SUCCESS; |
| 7375 | } |
| 7376 | |
| 7377 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7378 | const char *ospf_abr_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7379 | { |
| 7380 | "unknown", |
| 7381 | "standard", |
| 7382 | "ibm", |
| 7383 | "cisco", |
| 7384 | "shortcut" |
| 7385 | }; |
| 7386 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7387 | const char *ospf_shortcut_mode_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7388 | { |
| 7389 | "default", |
| 7390 | "enable", |
| 7391 | "disable" |
| 7392 | }; |
| 7393 | |
| 7394 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7395 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7396 | area_id2str (char *buf, int length, struct ospf_area *area) |
| 7397 | { |
| 7398 | memset (buf, 0, length); |
| 7399 | |
| 7400 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 7401 | strncpy (buf, inet_ntoa (area->area_id), length); |
| 7402 | else |
| 7403 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); |
| 7404 | } |
| 7405 | |
| 7406 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7407 | const char *ospf_int_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7408 | { |
| 7409 | "unknown", /* should never be used. */ |
| 7410 | "point-to-point", |
| 7411 | "broadcast", |
| 7412 | "non-broadcast", |
| 7413 | "point-to-multipoint", |
| 7414 | "virtual-link", /* should never be used. */ |
| 7415 | "loopback" |
| 7416 | }; |
| 7417 | |
| 7418 | /* Configuration write function for ospfd. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7419 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7420 | config_write_interface (struct vty *vty) |
| 7421 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7422 | struct listnode *n1, *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7423 | struct interface *ifp; |
| 7424 | struct crypt_key *ck; |
| 7425 | int write = 0; |
| 7426 | struct route_node *rn = NULL; |
| 7427 | struct ospf_if_params *params; |
| 7428 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7429 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7430 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7431 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
| 7432 | continue; |
| 7433 | |
| 7434 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 7435 | vty_out (vty, "interface %s%s", ifp->name, |
| 7436 | VTY_NEWLINE); |
| 7437 | if (ifp->desc) |
| 7438 | vty_out (vty, " description %s%s", ifp->desc, |
| 7439 | VTY_NEWLINE); |
| 7440 | |
| 7441 | write++; |
| 7442 | |
| 7443 | params = IF_DEF_PARAMS (ifp); |
| 7444 | |
| 7445 | do { |
| 7446 | /* Interface Network print. */ |
| 7447 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7448 | params->type != OSPF_IFTYPE_LOOPBACK) |
| 7449 | { |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 7450 | if (params->type != ospf_default_iftype(ifp)) |
hasso | 7b90143 | 2004-08-31 13:37:42 +0000 | [diff] [blame] | 7451 | { |
| 7452 | vty_out (vty, " ip ospf network %s", |
| 7453 | ospf_int_type_str[params->type]); |
| 7454 | if (params != IF_DEF_PARAMS (ifp)) |
| 7455 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7456 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7457 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7458 | } |
| 7459 | |
| 7460 | /* OSPF interface authentication print */ |
| 7461 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && |
| 7462 | params->auth_type != OSPF_AUTH_NOTSET) |
| 7463 | { |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7464 | const char *auth_str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7465 | |
| 7466 | /* Translation tables are not that much help here due to syntax |
| 7467 | of the simple option */ |
| 7468 | switch (params->auth_type) |
| 7469 | { |
| 7470 | |
| 7471 | case OSPF_AUTH_NULL: |
| 7472 | auth_str = " null"; |
| 7473 | break; |
| 7474 | |
| 7475 | case OSPF_AUTH_SIMPLE: |
| 7476 | auth_str = ""; |
| 7477 | break; |
| 7478 | |
| 7479 | case OSPF_AUTH_CRYPTOGRAPHIC: |
| 7480 | auth_str = " message-digest"; |
| 7481 | break; |
| 7482 | |
| 7483 | default: |
| 7484 | auth_str = ""; |
| 7485 | break; |
| 7486 | } |
| 7487 | |
| 7488 | vty_out (vty, " ip ospf authentication%s", auth_str); |
| 7489 | if (params != IF_DEF_PARAMS (ifp)) |
| 7490 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7491 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7492 | } |
| 7493 | |
| 7494 | /* Simple Authentication Password print. */ |
| 7495 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && |
| 7496 | params->auth_simple[0] != '\0') |
| 7497 | { |
| 7498 | vty_out (vty, " ip ospf authentication-key %s", |
| 7499 | params->auth_simple); |
| 7500 | if (params != IF_DEF_PARAMS (ifp)) |
| 7501 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7502 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7503 | } |
| 7504 | |
| 7505 | /* Cryptographic Authentication Key print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7506 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7507 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7508 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
| 7509 | ck->key_id, ck->auth_key); |
| 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 | /* Interface Output Cost print. */ |
| 7516 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) |
| 7517 | { |
| 7518 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); |
| 7519 | if (params != IF_DEF_PARAMS (ifp)) |
| 7520 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7521 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7522 | } |
| 7523 | |
| 7524 | /* Hello Interval print. */ |
| 7525 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && |
| 7526 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) |
| 7527 | { |
| 7528 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); |
| 7529 | if (params != IF_DEF_PARAMS (ifp)) |
| 7530 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7531 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7532 | } |
| 7533 | |
| 7534 | |
| 7535 | /* Router Dead Interval print. */ |
| 7536 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && |
| 7537 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) |
| 7538 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7539 | vty_out (vty, " ip ospf dead-interval "); |
| 7540 | |
| 7541 | /* fast hello ? */ |
| 7542 | if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello)) |
| 7543 | vty_out (vty, "minimal hello-multiplier %d", |
| 7544 | params->fast_hello); |
| 7545 | else |
| 7546 | vty_out (vty, "%u", params->v_wait); |
| 7547 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7548 | if (params != IF_DEF_PARAMS (ifp)) |
| 7549 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7550 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7551 | } |
| 7552 | |
| 7553 | /* Router Priority print. */ |
| 7554 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && |
| 7555 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) |
| 7556 | { |
| 7557 | vty_out (vty, " ip ospf priority %u", params->priority); |
| 7558 | if (params != IF_DEF_PARAMS (ifp)) |
| 7559 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7560 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7561 | } |
| 7562 | |
| 7563 | /* Retransmit Interval print. */ |
| 7564 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && |
| 7565 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) |
| 7566 | { |
| 7567 | vty_out (vty, " ip ospf retransmit-interval %u", |
| 7568 | params->retransmit_interval); |
| 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 | /* Transmit Delay print. */ |
| 7575 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && |
| 7576 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7577 | { |
| 7578 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); |
| 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 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7584 | /* MTU ignore print. */ |
| 7585 | if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) && |
| 7586 | params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 7587 | { |
| 7588 | if (params->mtu_ignore == 0) |
| 7589 | vty_out (vty, " no ip ospf mtu-ignore"); |
| 7590 | else |
| 7591 | vty_out (vty, " ip ospf mtu-ignore"); |
| 7592 | if (params != IF_DEF_PARAMS (ifp)) |
| 7593 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7594 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7595 | } |
| 7596 | |
| 7597 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7598 | while (1) |
| 7599 | { |
| 7600 | if (rn == NULL) |
| 7601 | rn = route_top (IF_OIFS_PARAMS (ifp)); |
| 7602 | else |
| 7603 | rn = route_next (rn); |
| 7604 | |
| 7605 | if (rn == NULL) |
| 7606 | break; |
| 7607 | params = rn->info; |
| 7608 | if (params != NULL) |
| 7609 | break; |
| 7610 | } |
| 7611 | } while (rn); |
| 7612 | |
| 7613 | #ifdef HAVE_OPAQUE_LSA |
| 7614 | ospf_opaque_config_write_if (vty, ifp); |
| 7615 | #endif /* HAVE_OPAQUE_LSA */ |
| 7616 | } |
| 7617 | |
| 7618 | return write; |
| 7619 | } |
| 7620 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7621 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7622 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7623 | { |
| 7624 | struct route_node *rn; |
| 7625 | u_char buf[INET_ADDRSTRLEN]; |
| 7626 | |
| 7627 | /* `network area' print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7628 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7629 | if (rn->info) |
| 7630 | { |
| 7631 | struct ospf_network *n = rn->info; |
| 7632 | |
| 7633 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7634 | |
| 7635 | /* Create Area ID string by specified Area ID format. */ |
| 7636 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7637 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7638 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7639 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7640 | (unsigned long int) ntohl (n->area_id.s_addr)); |
| 7641 | |
| 7642 | /* Network print. */ |
| 7643 | vty_out (vty, " network %s/%d area %s%s", |
| 7644 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7645 | buf, VTY_NEWLINE); |
| 7646 | } |
| 7647 | |
| 7648 | return 0; |
| 7649 | } |
| 7650 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7651 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7652 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7653 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7654 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7655 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7656 | u_char buf[INET_ADDRSTRLEN]; |
| 7657 | |
| 7658 | /* Area configuration print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7659 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7660 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7661 | struct route_node *rn1; |
| 7662 | |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7663 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7664 | |
| 7665 | if (area->auth_type != OSPF_AUTH_NULL) |
| 7666 | { |
| 7667 | if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 7668 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); |
| 7669 | else |
| 7670 | vty_out (vty, " area %s authentication message-digest%s", |
| 7671 | buf, VTY_NEWLINE); |
| 7672 | } |
| 7673 | |
| 7674 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) |
| 7675 | vty_out (vty, " area %s shortcut %s%s", buf, |
| 7676 | ospf_shortcut_mode_str[area->shortcut_configured], |
| 7677 | VTY_NEWLINE); |
| 7678 | |
| 7679 | if ((area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7680 | || (area->external_routing == OSPF_AREA_NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7681 | ) |
| 7682 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7683 | if (area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7684 | vty_out (vty, " area %s stub", buf); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7685 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 7686 | { |
| 7687 | vty_out (vty, " area %s nssa", buf); |
| 7688 | switch (area->NSSATranslatorRole) |
| 7689 | { |
| 7690 | case OSPF_NSSA_ROLE_NEVER: |
| 7691 | vty_out (vty, " translate-never"); |
| 7692 | break; |
| 7693 | case OSPF_NSSA_ROLE_ALWAYS: |
| 7694 | vty_out (vty, " translate-always"); |
| 7695 | break; |
| 7696 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 7697 | default: |
| 7698 | vty_out (vty, " translate-candidate"); |
| 7699 | } |
| 7700 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7701 | |
| 7702 | if (area->no_summary) |
| 7703 | vty_out (vty, " no-summary"); |
| 7704 | |
| 7705 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7706 | |
| 7707 | if (area->default_cost != 1) |
| 7708 | vty_out (vty, " area %s default-cost %d%s", buf, |
| 7709 | area->default_cost, VTY_NEWLINE); |
| 7710 | } |
| 7711 | |
| 7712 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) |
| 7713 | if (rn1->info) |
| 7714 | { |
| 7715 | struct ospf_area_range *range = rn1->info; |
| 7716 | |
| 7717 | vty_out (vty, " area %s range %s/%d", buf, |
| 7718 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); |
| 7719 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 7720 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7721 | vty_out (vty, " cost %d", range->cost_config); |
| 7722 | |
| 7723 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 7724 | vty_out (vty, " not-advertise"); |
| 7725 | |
| 7726 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 7727 | vty_out (vty, " substitute %s/%d", |
| 7728 | inet_ntoa (range->subst_addr), range->subst_masklen); |
| 7729 | |
| 7730 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7731 | } |
| 7732 | |
| 7733 | if (EXPORT_NAME (area)) |
| 7734 | vty_out (vty, " area %s export-list %s%s", buf, |
| 7735 | EXPORT_NAME (area), VTY_NEWLINE); |
| 7736 | |
| 7737 | if (IMPORT_NAME (area)) |
| 7738 | vty_out (vty, " area %s import-list %s%s", buf, |
| 7739 | IMPORT_NAME (area), VTY_NEWLINE); |
| 7740 | |
| 7741 | if (PREFIX_NAME_IN (area)) |
| 7742 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, |
| 7743 | PREFIX_NAME_IN (area), VTY_NEWLINE); |
| 7744 | |
| 7745 | if (PREFIX_NAME_OUT (area)) |
| 7746 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, |
| 7747 | PREFIX_NAME_OUT (area), VTY_NEWLINE); |
| 7748 | } |
| 7749 | |
| 7750 | return 0; |
| 7751 | } |
| 7752 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7753 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7754 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7755 | { |
| 7756 | struct ospf_nbr_nbma *nbr_nbma; |
| 7757 | struct route_node *rn; |
| 7758 | |
| 7759 | /* Static Neighbor configuration print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7760 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7761 | if ((nbr_nbma = rn->info)) |
| 7762 | { |
| 7763 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); |
| 7764 | |
| 7765 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) |
| 7766 | vty_out (vty, " priority %d", nbr_nbma->priority); |
| 7767 | |
| 7768 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) |
| 7769 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); |
| 7770 | |
| 7771 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7772 | } |
| 7773 | |
| 7774 | return 0; |
| 7775 | } |
| 7776 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7777 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7778 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7779 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7780 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7781 | struct ospf_vl_data *vl_data; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7782 | u_char buf[INET_ADDRSTRLEN]; |
| 7783 | |
| 7784 | /* Virtual-Link print */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7785 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7786 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7787 | struct listnode *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7788 | struct crypt_key *ck; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7789 | struct ospf_interface *oi; |
| 7790 | |
| 7791 | if (vl_data != NULL) |
| 7792 | { |
| 7793 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7794 | |
| 7795 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7796 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7797 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7798 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7799 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
| 7800 | oi = vl_data->vl_oi; |
| 7801 | |
| 7802 | /* timers */ |
| 7803 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || |
| 7804 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || |
| 7805 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || |
| 7806 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7807 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", |
| 7808 | buf, |
| 7809 | inet_ntoa (vl_data->vl_peer), |
| 7810 | OSPF_IF_PARAM (oi, v_hello), |
| 7811 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 7812 | OSPF_IF_PARAM (oi, transmit_delay), |
| 7813 | OSPF_IF_PARAM (oi, v_wait), |
| 7814 | VTY_NEWLINE); |
| 7815 | else |
| 7816 | vty_out (vty, " area %s virtual-link %s%s", buf, |
| 7817 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); |
| 7818 | /* Auth key */ |
| 7819 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') |
| 7820 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", |
| 7821 | buf, |
| 7822 | inet_ntoa (vl_data->vl_peer), |
| 7823 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, |
| 7824 | VTY_NEWLINE); |
| 7825 | /* md5 keys */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7826 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
| 7827 | n2, ck)) |
| 7828 | vty_out (vty, " area %s virtual-link %s" |
| 7829 | " message-digest-key %d md5 %s%s", |
| 7830 | buf, |
| 7831 | inet_ntoa (vl_data->vl_peer), |
| 7832 | ck->key_id, ck->auth_key, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7833 | |
| 7834 | } |
| 7835 | } |
| 7836 | |
| 7837 | return 0; |
| 7838 | } |
| 7839 | |
| 7840 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7841 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7842 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7843 | { |
| 7844 | int type; |
| 7845 | |
| 7846 | /* redistribute print. */ |
| 7847 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
| 7848 | if (type != zclient->redist_default && zclient->redist[type]) |
| 7849 | { |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7850 | vty_out (vty, " redistribute %s", zebra_route_string(type)); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7851 | if (ospf->dmetric[type].value >= 0) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7852 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7853 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7854 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7855 | vty_out (vty, " metric-type 1"); |
| 7856 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7857 | if (ROUTEMAP_NAME (ospf, type)) |
| 7858 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7859 | |
| 7860 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7861 | } |
| 7862 | |
| 7863 | return 0; |
| 7864 | } |
| 7865 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7866 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7867 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7868 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7869 | if (ospf->default_metric != -1) |
| 7870 | vty_out (vty, " default-metric %d%s", ospf->default_metric, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7871 | VTY_NEWLINE); |
| 7872 | return 0; |
| 7873 | } |
| 7874 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7875 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7876 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7877 | { |
| 7878 | int type; |
| 7879 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7880 | if (ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7881 | { |
| 7882 | /* distribute-list print. */ |
| 7883 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
Denis Ovsienko | 4f151e5 | 2011-09-10 16:40:23 +0400 | [diff] [blame] | 7884 | if (DISTRIBUTE_NAME (ospf, type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7885 | vty_out (vty, " distribute-list %s out %s%s", |
Denis Ovsienko | 4f151e5 | 2011-09-10 16:40:23 +0400 | [diff] [blame] | 7886 | DISTRIBUTE_NAME (ospf, type), |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7887 | zebra_route_string(type), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7888 | |
| 7889 | /* default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7890 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7891 | { |
paul | c42c177 | 2006-01-10 20:36:49 +0000 | [diff] [blame] | 7892 | vty_out (vty, " default-information originate"); |
| 7893 | if (ospf->default_originate == DEFAULT_ORIGINATE_ALWAYS) |
| 7894 | vty_out (vty, " always"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7895 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7896 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7897 | vty_out (vty, " metric %d", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7898 | ospf->dmetric[DEFAULT_ROUTE].value); |
| 7899 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7900 | vty_out (vty, " metric-type 1"); |
| 7901 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7902 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
| 7903 | vty_out (vty, " route-map %s", |
| 7904 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7905 | |
| 7906 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7907 | } |
| 7908 | |
| 7909 | } |
| 7910 | |
| 7911 | return 0; |
| 7912 | } |
| 7913 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7914 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7915 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7916 | { |
| 7917 | struct route_node *rn; |
| 7918 | struct ospf_distance *odistance; |
| 7919 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7920 | if (ospf->distance_all) |
| 7921 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7922 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7923 | if (ospf->distance_intra |
| 7924 | || ospf->distance_inter |
| 7925 | || ospf->distance_external) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7926 | { |
| 7927 | vty_out (vty, " distance ospf"); |
| 7928 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7929 | if (ospf->distance_intra) |
| 7930 | vty_out (vty, " intra-area %d", ospf->distance_intra); |
| 7931 | if (ospf->distance_inter) |
| 7932 | vty_out (vty, " inter-area %d", ospf->distance_inter); |
| 7933 | if (ospf->distance_external) |
| 7934 | vty_out (vty, " external %d", ospf->distance_external); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7935 | |
| 7936 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7937 | } |
| 7938 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7939 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7940 | if ((odistance = rn->info) != NULL) |
| 7941 | { |
| 7942 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, |
| 7943 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7944 | odistance->access_list ? odistance->access_list : "", |
| 7945 | VTY_NEWLINE); |
| 7946 | } |
| 7947 | return 0; |
| 7948 | } |
| 7949 | |
| 7950 | /* OSPF configuration write function. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7951 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7952 | ospf_config_write (struct vty *vty) |
| 7953 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7954 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7955 | struct interface *ifp; |
| 7956 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7957 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7958 | int write = 0; |
| 7959 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7960 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7961 | if (ospf != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7962 | { |
| 7963 | /* `router ospf' print. */ |
| 7964 | vty_out (vty, "router ospf%s", VTY_NEWLINE); |
| 7965 | |
| 7966 | write++; |
| 7967 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7968 | if (!ospf->networks) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7969 | return write; |
| 7970 | |
| 7971 | /* Router ID print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7972 | if (ospf->router_id_static.s_addr != 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7973 | vty_out (vty, " ospf router-id %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7974 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7975 | |
| 7976 | /* ABR type print. */ |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 7977 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7978 | vty_out (vty, " ospf abr-type %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7979 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7980 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 7981 | /* log-adjacency-changes flag print. */ |
| 7982 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 7983 | { |
| 7984 | vty_out(vty, " log-adjacency-changes"); |
| 7985 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 7986 | vty_out(vty, " detail"); |
| 7987 | vty_out(vty, "%s", VTY_NEWLINE); |
| 7988 | } |
| 7989 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7990 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7991 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7992 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
| 7993 | |
| 7994 | /* auto-cost reference-bandwidth configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7995 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7996 | { |
| 7997 | vty_out (vty, "! Important: ensure reference bandwidth " |
| 7998 | "is consistent across all routers%s", VTY_NEWLINE); |
| 7999 | vty_out (vty, " auto-cost reference-bandwidth %d%s", |
| 8000 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); |
| 8001 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8002 | |
| 8003 | /* SPF timers print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8004 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 8005 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT || |
| 8006 | ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT) |
| 8007 | vty_out (vty, " timers throttle spf %d %d %d%s", |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8008 | ospf->spf_delay, ospf->spf_holdtime, |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 8009 | ospf->spf_max_holdtime, VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8010 | |
| 8011 | /* Max-metric router-lsa print */ |
| 8012 | config_write_stub_router (vty, ospf); |
| 8013 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8014 | /* SPF refresh parameters print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8015 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8016 | vty_out (vty, " refresh timer %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8017 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8018 | |
| 8019 | /* Redistribute information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8020 | config_write_ospf_redistribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8021 | |
| 8022 | /* passive-interface print. */ |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8023 | if (ospf->passive_interface_default == OSPF_IF_PASSIVE) |
| 8024 | vty_out (vty, " passive-interface default%s", VTY_NEWLINE); |
| 8025 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8026 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8027 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface) |
| 8028 | && IF_DEF_PARAMS (ifp)->passive_interface != |
| 8029 | ospf->passive_interface_default) |
| 8030 | { |
| 8031 | vty_out (vty, " %spassive-interface %s%s", |
| 8032 | IF_DEF_PARAMS (ifp)->passive_interface ? "" : "no ", |
| 8033 | ifp->name, VTY_NEWLINE); |
| 8034 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8035 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8036 | { |
| 8037 | if (!OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) |
| 8038 | continue; |
| 8039 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi->ifp), |
| 8040 | passive_interface)) |
| 8041 | { |
| 8042 | if (oi->params->passive_interface == IF_DEF_PARAMS (oi->ifp)->passive_interface) |
| 8043 | continue; |
| 8044 | } |
| 8045 | else if (oi->params->passive_interface == ospf->passive_interface_default) |
| 8046 | continue; |
| 8047 | |
| 8048 | vty_out (vty, " %spassive-interface %s %s%s", |
| 8049 | oi->params->passive_interface ? "" : "no ", |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8050 | oi->ifp->name, |
| 8051 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8052 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8053 | |
| 8054 | /* Network area print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8055 | config_write_network_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8056 | |
| 8057 | /* Area config print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8058 | config_write_ospf_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8059 | |
| 8060 | /* static neighbor print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8061 | config_write_ospf_nbr_nbma (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8062 | |
| 8063 | /* Virtual-Link print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8064 | config_write_virtual_link (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8065 | |
| 8066 | /* Default metric configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8067 | config_write_ospf_default_metric (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8068 | |
| 8069 | /* Distribute-list and default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8070 | config_write_ospf_distribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8071 | |
| 8072 | /* Distance configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8073 | config_write_ospf_distance (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8074 | |
| 8075 | #ifdef HAVE_OPAQUE_LSA |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8076 | ospf_opaque_config_write_router (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8077 | #endif /* HAVE_OPAQUE_LSA */ |
| 8078 | } |
| 8079 | |
| 8080 | return write; |
| 8081 | } |
| 8082 | |
| 8083 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8084 | ospf_vty_show_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8085 | { |
| 8086 | /* "show ip ospf" commands. */ |
| 8087 | install_element (VIEW_NODE, &show_ip_ospf_cmd); |
| 8088 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); |
| 8089 | |
| 8090 | /* "show ip ospf database" commands. */ |
| 8091 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); |
| 8092 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); |
| 8093 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 8094 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 8095 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 8096 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); |
| 8097 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); |
| 8098 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); |
| 8099 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); |
| 8100 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 8101 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 8102 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 8103 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); |
| 8104 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); |
| 8105 | |
| 8106 | /* "show ip ospf interface" commands. */ |
| 8107 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); |
| 8108 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); |
| 8109 | |
| 8110 | /* "show ip ospf neighbor" commands. */ |
| 8111 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 8112 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 8113 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 8114 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 8115 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 8116 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); |
| 8117 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 8118 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 8119 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 8120 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 8121 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 8122 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 8123 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); |
| 8124 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 8125 | |
| 8126 | /* "show ip ospf route" commands. */ |
| 8127 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); |
| 8128 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8129 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
| 8130 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8131 | } |
| 8132 | |
| 8133 | |
| 8134 | /* ospfd's interface node. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8135 | static struct cmd_node interface_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8136 | { |
| 8137 | INTERFACE_NODE, |
| 8138 | "%s(config-if)# ", |
| 8139 | 1 |
| 8140 | }; |
| 8141 | |
| 8142 | /* Initialization of OSPF interface. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8143 | static void |
| 8144 | ospf_vty_if_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8145 | { |
| 8146 | /* Install interface node. */ |
| 8147 | install_node (&interface_node, config_write_interface); |
| 8148 | |
| 8149 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 8150 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8151 | install_default (INTERFACE_NODE); |
| 8152 | |
| 8153 | /* "description" commands. */ |
| 8154 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 8155 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 8156 | |
| 8157 | /* "ip ospf authentication" commands. */ |
| 8158 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); |
| 8159 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); |
| 8160 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); |
| 8161 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); |
| 8162 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); |
| 8163 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); |
| 8164 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); |
| 8165 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); |
| 8166 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); |
| 8167 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); |
| 8168 | |
| 8169 | /* "ip ospf message-digest-key" commands. */ |
| 8170 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); |
| 8171 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); |
| 8172 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); |
| 8173 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); |
| 8174 | |
| 8175 | /* "ip ospf cost" commands. */ |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8176 | install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd); |
| 8177 | install_element (INTERFACE_NODE, &ip_ospf_cost_u32_cmd); |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 8178 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd); |
| 8179 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_inet4_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8180 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8181 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); |
| 8182 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 8183 | /* "ip ospf mtu-ignore" commands. */ |
| 8184 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); |
| 8185 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); |
| 8186 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); |
| 8187 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); |
| 8188 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8189 | /* "ip ospf dead-interval" commands. */ |
| 8190 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); |
| 8191 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8192 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); |
| 8193 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8194 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
| 8195 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8196 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8197 | /* "ip ospf hello-interval" commands. */ |
| 8198 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); |
| 8199 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); |
| 8200 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); |
| 8201 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); |
| 8202 | |
| 8203 | /* "ip ospf network" commands. */ |
| 8204 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); |
| 8205 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); |
| 8206 | |
| 8207 | /* "ip ospf priority" commands. */ |
| 8208 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); |
| 8209 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); |
| 8210 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); |
| 8211 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); |
| 8212 | |
| 8213 | /* "ip ospf retransmit-interval" commands. */ |
| 8214 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); |
| 8215 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); |
| 8216 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); |
| 8217 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); |
| 8218 | |
| 8219 | /* "ip ospf transmit-delay" commands. */ |
| 8220 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); |
| 8221 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); |
| 8222 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); |
| 8223 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); |
| 8224 | |
| 8225 | /* These commands are compatibitliy for previous version. */ |
| 8226 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); |
| 8227 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); |
| 8228 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); |
| 8229 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8230 | install_element (INTERFACE_NODE, &ospf_cost_u32_cmd); |
| 8231 | install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8232 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 8233 | install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd); |
| 8234 | install_element (INTERFACE_NODE, &no_ospf_cost_u32_inet4_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8235 | install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8236 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); |
| 8237 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); |
| 8238 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); |
| 8239 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); |
| 8240 | install_element (INTERFACE_NODE, &ospf_network_cmd); |
| 8241 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); |
| 8242 | install_element (INTERFACE_NODE, &ospf_priority_cmd); |
| 8243 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); |
| 8244 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); |
| 8245 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); |
| 8246 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); |
| 8247 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); |
| 8248 | } |
| 8249 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8250 | static void |
| 8251 | ospf_vty_zebra_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8252 | { |
| 8253 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); |
| 8254 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); |
| 8255 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); |
| 8256 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); |
| 8257 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); |
| 8258 | install_element (OSPF_NODE, |
| 8259 | &ospf_redistribute_source_metric_type_routemap_cmd); |
| 8260 | install_element (OSPF_NODE, |
| 8261 | &ospf_redistribute_source_type_metric_routemap_cmd); |
| 8262 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); |
| 8263 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); |
| 8264 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); |
| 8265 | |
| 8266 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); |
| 8267 | |
| 8268 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); |
| 8269 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); |
| 8270 | |
| 8271 | install_element (OSPF_NODE, |
| 8272 | &ospf_default_information_originate_metric_type_cmd); |
| 8273 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); |
| 8274 | install_element (OSPF_NODE, |
| 8275 | &ospf_default_information_originate_type_metric_cmd); |
| 8276 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); |
| 8277 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); |
| 8278 | install_element (OSPF_NODE, |
| 8279 | &ospf_default_information_originate_always_metric_type_cmd); |
| 8280 | install_element (OSPF_NODE, |
| 8281 | &ospf_default_information_originate_always_metric_cmd); |
| 8282 | install_element (OSPF_NODE, |
| 8283 | &ospf_default_information_originate_always_cmd); |
| 8284 | install_element (OSPF_NODE, |
| 8285 | &ospf_default_information_originate_always_type_metric_cmd); |
| 8286 | install_element (OSPF_NODE, |
| 8287 | &ospf_default_information_originate_always_type_cmd); |
| 8288 | |
| 8289 | install_element (OSPF_NODE, |
| 8290 | &ospf_default_information_originate_metric_type_routemap_cmd); |
| 8291 | install_element (OSPF_NODE, |
| 8292 | &ospf_default_information_originate_metric_routemap_cmd); |
| 8293 | install_element (OSPF_NODE, |
| 8294 | &ospf_default_information_originate_routemap_cmd); |
| 8295 | install_element (OSPF_NODE, |
| 8296 | &ospf_default_information_originate_type_metric_routemap_cmd); |
| 8297 | install_element (OSPF_NODE, |
| 8298 | &ospf_default_information_originate_type_routemap_cmd); |
| 8299 | install_element (OSPF_NODE, |
| 8300 | &ospf_default_information_originate_always_metric_type_routemap_cmd); |
| 8301 | install_element (OSPF_NODE, |
| 8302 | &ospf_default_information_originate_always_metric_routemap_cmd); |
| 8303 | install_element (OSPF_NODE, |
| 8304 | &ospf_default_information_originate_always_routemap_cmd); |
| 8305 | install_element (OSPF_NODE, |
| 8306 | &ospf_default_information_originate_always_type_metric_routemap_cmd); |
| 8307 | install_element (OSPF_NODE, |
| 8308 | &ospf_default_information_originate_always_type_routemap_cmd); |
| 8309 | |
| 8310 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); |
| 8311 | |
| 8312 | install_element (OSPF_NODE, &ospf_default_metric_cmd); |
| 8313 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); |
| 8314 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); |
| 8315 | |
| 8316 | install_element (OSPF_NODE, &ospf_distance_cmd); |
| 8317 | install_element (OSPF_NODE, &no_ospf_distance_cmd); |
| 8318 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); |
| 8319 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); |
| 8320 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); |
| 8321 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); |
| 8322 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); |
| 8323 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); |
| 8324 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); |
| 8325 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); |
| 8326 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); |
| 8327 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); |
| 8328 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); |
| 8329 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); |
| 8330 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); |
| 8331 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); |
| 8332 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); |
| 8333 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); |
| 8334 | #if 0 |
| 8335 | install_element (OSPF_NODE, &ospf_distance_source_cmd); |
| 8336 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); |
| 8337 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); |
| 8338 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); |
| 8339 | #endif /* 0 */ |
| 8340 | } |
| 8341 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8342 | static struct cmd_node ospf_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8343 | { |
| 8344 | OSPF_NODE, |
| 8345 | "%s(config-router)# ", |
| 8346 | 1 |
| 8347 | }; |
| 8348 | |
| 8349 | |
| 8350 | /* Install OSPF related vty commands. */ |
| 8351 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8352 | ospf_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8353 | { |
| 8354 | /* Install ospf top node. */ |
| 8355 | install_node (&ospf_node, ospf_config_write); |
| 8356 | |
| 8357 | /* "router ospf" commands. */ |
| 8358 | install_element (CONFIG_NODE, &router_ospf_cmd); |
| 8359 | install_element (CONFIG_NODE, &no_router_ospf_cmd); |
| 8360 | |
| 8361 | install_default (OSPF_NODE); |
| 8362 | |
| 8363 | /* "ospf router-id" commands. */ |
| 8364 | install_element (OSPF_NODE, &ospf_router_id_cmd); |
| 8365 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8366 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
| 8367 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8368 | |
| 8369 | /* "passive-interface" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8370 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
| 8371 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8372 | install_element (OSPF_NODE, &ospf_passive_interface_default_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8373 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); |
| 8374 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8375 | install_element (OSPF_NODE, &no_ospf_passive_interface_default_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8376 | |
| 8377 | /* "ospf abr-type" commands. */ |
| 8378 | install_element (OSPF_NODE, &ospf_abr_type_cmd); |
| 8379 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); |
| 8380 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 8381 | /* "ospf log-adjacency-changes" commands. */ |
| 8382 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_cmd); |
| 8383 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_detail_cmd); |
| 8384 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_cmd); |
| 8385 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_detail_cmd); |
| 8386 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8387 | /* "ospf rfc1583-compatible" commands. */ |
| 8388 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); |
| 8389 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); |
| 8390 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); |
| 8391 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); |
| 8392 | |
| 8393 | /* "network area" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8394 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
| 8395 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8396 | |
| 8397 | /* "area authentication" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8398 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
| 8399 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); |
| 8400 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8401 | |
| 8402 | /* "area range" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8403 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
| 8404 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); |
| 8405 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); |
| 8406 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); |
| 8407 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); |
| 8408 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); |
| 8409 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); |
| 8410 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); |
| 8411 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); |
| 8412 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); |
| 8413 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8414 | |
| 8415 | /* "area virtual-link" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8416 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
| 8417 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8418 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8419 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
| 8420 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8421 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8422 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
| 8423 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8424 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8425 | install_element (OSPF_NODE, &ospf_area_vlink_param3_cmd); |
| 8426 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8427 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8428 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
| 8429 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8430 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8431 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
| 8432 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); |
| 8433 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8434 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8435 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
| 8436 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8437 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8438 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
| 8439 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8440 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8441 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
| 8442 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); |
| 8443 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8444 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8445 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
| 8446 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); |
| 8447 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8448 | |
| 8449 | /* "area stub" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8450 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
| 8451 | install_element (OSPF_NODE, &ospf_area_stub_cmd); |
| 8452 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); |
| 8453 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8454 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8455 | /* "area nssa" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8456 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
| 8457 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); |
| 8458 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); |
| 8459 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); |
| 8460 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); |
| 8461 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8462 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8463 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
| 8464 | install_element (OSPF_NODE, &no_ospf_area_default_cost_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_shortcut_cmd); |
| 8467 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8468 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8469 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
| 8470 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8471 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8472 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
| 8473 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8474 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8475 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
| 8476 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8477 | |
| 8478 | /* SPF timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8479 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
| 8480 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 8481 | install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); |
| 8482 | install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); |
| 8483 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8484 | /* refresh timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8485 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
| 8486 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); |
| 8487 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8488 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8489 | /* max-metric commands */ |
| 8490 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd); |
| 8491 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd); |
| 8492 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd); |
| 8493 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd); |
| 8494 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd); |
| 8495 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd); |
| 8496 | |
| 8497 | /* reference bandwidth commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8498 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
| 8499 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8500 | |
| 8501 | /* "neighbor" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8502 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
| 8503 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); |
| 8504 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); |
| 8505 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); |
| 8506 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); |
| 8507 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); |
| 8508 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); |
| 8509 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8510 | |
| 8511 | /* Init interface related vty commands. */ |
| 8512 | ospf_vty_if_init (); |
| 8513 | |
| 8514 | /* Init zebra related vty commands. */ |
| 8515 | ospf_vty_zebra_init (); |
| 8516 | } |