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 | { |
Ulrich Weber | 664711c | 2011-12-21 02:24:11 +0400 | [diff] [blame] | 83 | if (*str == '-') |
| 84 | return -1; |
| 85 | errno = 0; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 86 | ret = strtoul (str, &endptr, 10); |
Ulrich Weber | 664711c | 2011-12-21 02:24:11 +0400 | [diff] [blame] | 87 | if (*endptr != '\0' || errno || ret > UINT32_MAX) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 88 | return -1; |
| 89 | |
| 90 | area_id->s_addr = htonl (ret); |
| 91 | *format = OSPF_AREA_ID_FORMAT_DECIMAL; |
| 92 | } |
| 93 | |
| 94 | return 0; |
| 95 | } |
| 96 | |
| 97 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 98 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 99 | str2metric (const char *str, int *metric) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 100 | { |
| 101 | /* Sanity check. */ |
| 102 | if (str == NULL) |
| 103 | return 0; |
| 104 | |
| 105 | *metric = strtol (str, NULL, 10); |
| 106 | if (*metric < 0 && *metric > 16777214) |
| 107 | { |
| 108 | /* vty_out (vty, "OSPF metric value is invalid%s", VTY_NEWLINE); */ |
| 109 | return 0; |
| 110 | } |
| 111 | |
| 112 | return 1; |
| 113 | } |
| 114 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 115 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 116 | str2metric_type (const char *str, int *metric_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 117 | { |
| 118 | /* Sanity check. */ |
| 119 | if (str == NULL) |
| 120 | return 0; |
| 121 | |
| 122 | if (strncmp (str, "1", 1) == 0) |
| 123 | *metric_type = EXTERNAL_METRIC_TYPE_1; |
| 124 | else if (strncmp (str, "2", 1) == 0) |
| 125 | *metric_type = EXTERNAL_METRIC_TYPE_2; |
| 126 | else |
| 127 | return 0; |
| 128 | |
| 129 | return 1; |
| 130 | } |
| 131 | |
| 132 | int |
| 133 | ospf_oi_count (struct interface *ifp) |
| 134 | { |
| 135 | struct route_node *rn; |
| 136 | int i = 0; |
| 137 | |
| 138 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 139 | if (rn->info) |
| 140 | i++; |
| 141 | |
| 142 | return i; |
| 143 | } |
| 144 | |
| 145 | |
| 146 | DEFUN (router_ospf, |
| 147 | router_ospf_cmd, |
| 148 | "router ospf", |
| 149 | "Enable a routing process\n" |
| 150 | "Start OSPF configuration\n") |
| 151 | { |
| 152 | vty->node = OSPF_NODE; |
| 153 | vty->index = ospf_get (); |
| 154 | |
| 155 | return CMD_SUCCESS; |
| 156 | } |
| 157 | |
| 158 | DEFUN (no_router_ospf, |
| 159 | no_router_ospf_cmd, |
| 160 | "no router ospf", |
| 161 | NO_STR |
| 162 | "Enable a routing process\n" |
| 163 | "Start OSPF configuration\n") |
| 164 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 165 | struct ospf *ospf; |
| 166 | |
| 167 | ospf = ospf_lookup (); |
| 168 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 169 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 170 | vty_out (vty, "There isn't active ospf instance%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 171 | return CMD_WARNING; |
| 172 | } |
| 173 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 174 | ospf_finish (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 175 | |
| 176 | return CMD_SUCCESS; |
| 177 | } |
| 178 | |
| 179 | DEFUN (ospf_router_id, |
| 180 | ospf_router_id_cmd, |
| 181 | "ospf router-id A.B.C.D", |
| 182 | "OSPF specific commands\n" |
| 183 | "router-id for the OSPF process\n" |
| 184 | "OSPF router-id in IP address format\n") |
| 185 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 186 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 187 | struct in_addr router_id; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 188 | int ret; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 189 | |
| 190 | ret = inet_aton (argv[0], &router_id); |
| 191 | if (!ret) |
| 192 | { |
| 193 | vty_out (vty, "Please specify Router ID by A.B.C.D%s", VTY_NEWLINE); |
| 194 | return CMD_WARNING; |
| 195 | } |
| 196 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 197 | ospf->router_id_static = router_id; |
paul | b29800a | 2005-11-20 14:50:45 +0000 | [diff] [blame] | 198 | |
| 199 | ospf_router_id_update (ospf); |
| 200 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 201 | return CMD_SUCCESS; |
| 202 | } |
| 203 | |
| 204 | ALIAS (ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 205 | router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 206 | "router-id A.B.C.D", |
| 207 | "router-id for the OSPF process\n" |
| 208 | "OSPF router-id in IP address format\n") |
| 209 | |
| 210 | DEFUN (no_ospf_router_id, |
| 211 | no_ospf_router_id_cmd, |
| 212 | "no ospf router-id", |
| 213 | NO_STR |
| 214 | "OSPF specific commands\n" |
| 215 | "router-id for the OSPF process\n") |
| 216 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 217 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 218 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 219 | ospf->router_id_static.s_addr = 0; |
| 220 | |
| 221 | ospf_router_id_update (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 222 | |
| 223 | return CMD_SUCCESS; |
| 224 | } |
| 225 | |
| 226 | ALIAS (no_ospf_router_id, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 227 | no_router_ospf_id_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 228 | "no router-id", |
| 229 | NO_STR |
| 230 | "router-id for the OSPF process\n") |
| 231 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 232 | static void |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 233 | ospf_passive_interface_default (struct ospf *ospf, u_char newval) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 234 | { |
| 235 | struct listnode *ln; |
| 236 | struct interface *ifp; |
| 237 | struct ospf_interface *oi; |
| 238 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 239 | ospf->passive_interface_default = newval; |
| 240 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 241 | for (ALL_LIST_ELEMENTS_RO (om->iflist, ln, ifp)) |
| 242 | { |
| 243 | if (ifp && |
| 244 | OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) |
| 245 | UNSET_IF_PARAM (IF_DEF_PARAMS (ifp), passive_interface); |
| 246 | } |
| 247 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, ln, oi)) |
| 248 | { |
| 249 | if (OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) |
| 250 | UNSET_IF_PARAM (oi->params, passive_interface); |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 251 | /* update multicast memberships */ |
| 252 | ospf_if_set_multicast(oi); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 253 | } |
| 254 | } |
| 255 | |
| 256 | static void |
| 257 | ospf_passive_interface_update (struct ospf *ospf, struct interface *ifp, |
| 258 | struct in_addr addr, |
| 259 | struct ospf_if_params *params, u_char value) |
| 260 | { |
| 261 | u_char dflt; |
| 262 | |
| 263 | params->passive_interface = value; |
| 264 | if (params != IF_DEF_PARAMS (ifp)) |
| 265 | { |
| 266 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface)) |
| 267 | dflt = IF_DEF_PARAMS (ifp)->passive_interface; |
| 268 | else |
| 269 | dflt = ospf->passive_interface_default; |
| 270 | |
| 271 | if (value != dflt) |
| 272 | SET_IF_PARAM (params, passive_interface); |
| 273 | else |
| 274 | UNSET_IF_PARAM (params, passive_interface); |
| 275 | |
| 276 | ospf_free_if_params (ifp, addr); |
| 277 | ospf_if_update_params (ifp, addr); |
| 278 | } |
| 279 | else |
| 280 | { |
| 281 | if (value != ospf->passive_interface_default) |
| 282 | SET_IF_PARAM (params, passive_interface); |
| 283 | else |
| 284 | UNSET_IF_PARAM (params, passive_interface); |
| 285 | } |
| 286 | } |
| 287 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 288 | DEFUN (ospf_passive_interface, |
| 289 | ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 290 | "passive-interface IFNAME A.B.C.D", |
| 291 | "Suppress routing updates on an interface\n" |
| 292 | "Interface's name\n") |
| 293 | { |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 294 | struct interface *ifp; |
| 295 | struct in_addr addr; |
| 296 | int ret; |
| 297 | struct ospf_if_params *params; |
| 298 | struct route_node *rn; |
| 299 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 300 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 301 | if (argc == 0) |
| 302 | { |
| 303 | ospf_passive_interface_default (ospf, OSPF_IF_PASSIVE); |
| 304 | return CMD_SUCCESS; |
| 305 | } |
| 306 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 307 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 308 | |
| 309 | params = IF_DEF_PARAMS (ifp); |
| 310 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 311 | if (argc == 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 312 | { |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 313 | ret = inet_aton(argv[1], &addr); |
| 314 | if (!ret) |
| 315 | { |
| 316 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 317 | VTY_NEWLINE); |
| 318 | return CMD_WARNING; |
| 319 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 320 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 321 | params = ospf_get_if_params (ifp, addr); |
| 322 | ospf_if_update_params (ifp, addr); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 323 | } |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 324 | ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_PASSIVE); |
| 325 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 326 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 327 | * interfaces for which the passive property changed. It is too much |
| 328 | * work to determine this set, so we do this for every interface. |
| 329 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 330 | * record of joined groups to avoid systems calls if the desired |
| 331 | * memberships match the current memership. |
| 332 | */ |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 333 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 334 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 335 | { |
| 336 | struct ospf_interface *oi = rn->info; |
| 337 | |
| 338 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_PASSIVE)) |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 339 | ospf_if_set_multicast(oi); |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 340 | } |
| 341 | /* |
| 342 | * XXX It is not clear what state transitions the interface needs to |
| 343 | * undergo when going from active to passive. Fixing this will |
| 344 | * require precise identification of interfaces having such a |
| 345 | * transition. |
| 346 | */ |
| 347 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 348 | return CMD_SUCCESS; |
| 349 | } |
| 350 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 351 | ALIAS (ospf_passive_interface, |
| 352 | ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 353 | "passive-interface IFNAME", |
| 354 | "Suppress routing updates on an interface\n" |
| 355 | "Interface's name\n") |
| 356 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 357 | ALIAS (ospf_passive_interface, |
| 358 | ospf_passive_interface_default_cmd, |
| 359 | "passive-interface default", |
| 360 | "Suppress routing updates on an interface\n" |
| 361 | "Suppress routing updates on interfaces by default\n") |
| 362 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 363 | DEFUN (no_ospf_passive_interface, |
| 364 | no_ospf_passive_interface_addr_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 365 | "no passive-interface IFNAME A.B.C.D", |
| 366 | NO_STR |
| 367 | "Allow routing updates on an interface\n" |
| 368 | "Interface's name\n") |
| 369 | { |
| 370 | struct interface *ifp; |
| 371 | struct in_addr addr; |
| 372 | struct ospf_if_params *params; |
| 373 | int ret; |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 374 | struct route_node *rn; |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 375 | struct ospf *ospf = vty->index; |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 376 | |
| 377 | if (argc == 0) |
| 378 | { |
| 379 | ospf_passive_interface_default (ospf, OSPF_IF_ACTIVE); |
| 380 | return CMD_SUCCESS; |
| 381 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 382 | |
Andrew J. Schorr | 6e72cb6 | 2006-06-18 00:45:48 +0000 | [diff] [blame] | 383 | ifp = if_get_by_name (argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 384 | |
| 385 | params = IF_DEF_PARAMS (ifp); |
| 386 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 387 | if (argc == 2) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 388 | { |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 389 | ret = inet_aton(argv[1], &addr); |
| 390 | if (!ret) |
| 391 | { |
| 392 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 393 | VTY_NEWLINE); |
| 394 | return CMD_WARNING; |
| 395 | } |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 396 | |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 397 | params = ospf_lookup_if_params (ifp, addr); |
| 398 | if (params == NULL) |
| 399 | return CMD_SUCCESS; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 400 | } |
Andrew J. Schorr | 4354088 | 2006-11-28 16:36:39 +0000 | [diff] [blame] | 401 | ospf_passive_interface_update (ospf, ifp, addr, params, OSPF_IF_ACTIVE); |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 402 | |
| 403 | /* XXX We should call ospf_if_set_multicast on exactly those |
| 404 | * interfaces for which the passive property changed. It is too much |
| 405 | * work to determine this set, so we do this for every interface. |
| 406 | * This is safe and reasonable because ospf_if_set_multicast uses a |
| 407 | * record of joined groups to avoid systems calls if the desired |
| 408 | * memberships match the current memership. |
| 409 | */ |
| 410 | for (rn = route_top(IF_OIFS(ifp)); rn; rn = route_next (rn)) |
| 411 | { |
| 412 | struct ospf_interface *oi = rn->info; |
| 413 | |
| 414 | if (oi && (OSPF_IF_PARAM(oi, passive_interface) == OSPF_IF_ACTIVE)) |
| 415 | ospf_if_set_multicast(oi); |
| 416 | } |
| 417 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 418 | return CMD_SUCCESS; |
| 419 | } |
| 420 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 421 | ALIAS (no_ospf_passive_interface, |
| 422 | no_ospf_passive_interface_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 423 | "no passive-interface IFNAME", |
| 424 | NO_STR |
| 425 | "Allow routing updates on an interface\n" |
| 426 | "Interface's name\n") |
| 427 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 428 | ALIAS (no_ospf_passive_interface, |
| 429 | no_ospf_passive_interface_default_cmd, |
| 430 | "no passive-interface default", |
| 431 | NO_STR |
| 432 | "Allow routing updates on an interface\n" |
| 433 | "Allow routing updates on interfaces by default\n") |
| 434 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 435 | DEFUN (ospf_network_area, |
| 436 | ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 437 | "network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 438 | "Enable routing on an IP network\n" |
| 439 | "OSPF network prefix\n" |
| 440 | "Set the OSPF area ID\n" |
| 441 | "OSPF area ID in IP address format\n" |
| 442 | "OSPF area ID as a decimal value\n") |
| 443 | { |
| 444 | struct ospf *ospf= vty->index; |
| 445 | struct prefix_ipv4 p; |
| 446 | struct in_addr area_id; |
| 447 | int ret, format; |
| 448 | |
| 449 | /* Get network prefix and Area ID. */ |
| 450 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 451 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 452 | |
| 453 | ret = ospf_network_set (ospf, &p, area_id); |
| 454 | if (ret == 0) |
| 455 | { |
| 456 | vty_out (vty, "There is already same network statement.%s", VTY_NEWLINE); |
| 457 | return CMD_WARNING; |
| 458 | } |
| 459 | |
| 460 | return CMD_SUCCESS; |
| 461 | } |
| 462 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 463 | DEFUN (no_ospf_network_area, |
| 464 | no_ospf_network_area_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 465 | "no network A.B.C.D/M area (A.B.C.D|<0-4294967295>)", |
| 466 | NO_STR |
| 467 | "Enable routing on an IP network\n" |
| 468 | "OSPF network prefix\n" |
| 469 | "Set the OSPF area ID\n" |
| 470 | "OSPF area ID in IP address format\n" |
| 471 | "OSPF area ID as a decimal value\n") |
| 472 | { |
| 473 | struct ospf *ospf = (struct ospf *) vty->index; |
| 474 | struct prefix_ipv4 p; |
| 475 | struct in_addr area_id; |
| 476 | int ret, format; |
| 477 | |
| 478 | /* Get network prefix and Area ID. */ |
| 479 | VTY_GET_IPV4_PREFIX ("network prefix", p, argv[0]); |
| 480 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[1]); |
| 481 | |
| 482 | ret = ospf_network_unset (ospf, &p, area_id); |
| 483 | if (ret == 0) |
| 484 | { |
| 485 | vty_out (vty, "Can't find specified network area configuration.%s", |
| 486 | VTY_NEWLINE); |
| 487 | return CMD_WARNING; |
| 488 | } |
| 489 | |
| 490 | return CMD_SUCCESS; |
| 491 | } |
| 492 | |
| 493 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 494 | DEFUN (ospf_area_range, |
| 495 | ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 496 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 497 | "OSPF area parameters\n" |
| 498 | "OSPF area ID in IP address format\n" |
| 499 | "OSPF area ID as a decimal value\n" |
| 500 | "Summarize routes matching address/mask (border routers only)\n" |
| 501 | "Area range prefix\n") |
| 502 | { |
| 503 | struct ospf *ospf = vty->index; |
| 504 | struct prefix_ipv4 p; |
| 505 | struct in_addr area_id; |
| 506 | int format; |
| 507 | u_int32_t cost; |
| 508 | |
| 509 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 510 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 511 | |
| 512 | ospf_area_range_set (ospf, area_id, &p, OSPF_AREA_RANGE_ADVERTISE); |
| 513 | if (argc > 2) |
| 514 | { |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 515 | VTY_GET_INTEGER ("range cost", cost, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 516 | ospf_area_range_cost_set (ospf, area_id, &p, cost); |
| 517 | } |
| 518 | |
| 519 | return CMD_SUCCESS; |
| 520 | } |
| 521 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 522 | ALIAS (ospf_area_range, |
| 523 | ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 524 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise", |
| 525 | "OSPF area parameters\n" |
| 526 | "OSPF area ID in IP address format\n" |
| 527 | "OSPF area ID as a decimal value\n" |
| 528 | "OSPF area range for route advertise (default)\n" |
| 529 | "Area range prefix\n" |
| 530 | "Advertise this range (default)\n") |
| 531 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 532 | ALIAS (ospf_area_range, |
| 533 | ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 534 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 535 | "OSPF area parameters\n" |
| 536 | "OSPF area ID in IP address format\n" |
| 537 | "OSPF area ID as a decimal value\n" |
| 538 | "Summarize routes matching address/mask (border routers only)\n" |
| 539 | "Area range prefix\n" |
| 540 | "User specified metric for this range\n" |
| 541 | "Advertised metric for this range\n") |
| 542 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 543 | ALIAS (ospf_area_range, |
| 544 | ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 545 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 546 | "OSPF area parameters\n" |
| 547 | "OSPF area ID in IP address format\n" |
| 548 | "OSPF area ID as a decimal value\n" |
| 549 | "Summarize routes matching address/mask (border routers only)\n" |
| 550 | "Area range prefix\n" |
| 551 | "Advertise this range (default)\n" |
| 552 | "User specified metric for this range\n" |
| 553 | "Advertised metric for this range\n") |
| 554 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 555 | DEFUN (ospf_area_range_not_advertise, |
| 556 | ospf_area_range_not_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 557 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M not-advertise", |
| 558 | "OSPF area parameters\n" |
| 559 | "OSPF area ID in IP address format\n" |
| 560 | "OSPF area ID as a decimal value\n" |
| 561 | "Summarize routes matching address/mask (border routers only)\n" |
| 562 | "Area range prefix\n" |
| 563 | "DoNotAdvertise this range\n") |
| 564 | { |
| 565 | struct ospf *ospf = vty->index; |
| 566 | struct prefix_ipv4 p; |
| 567 | struct in_addr area_id; |
| 568 | int format; |
| 569 | |
| 570 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 571 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 572 | |
| 573 | ospf_area_range_set (ospf, area_id, &p, 0); |
| 574 | |
| 575 | return CMD_SUCCESS; |
| 576 | } |
| 577 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 578 | DEFUN (no_ospf_area_range, |
| 579 | no_ospf_area_range_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 580 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M", |
| 581 | NO_STR |
| 582 | "OSPF area parameters\n" |
| 583 | "OSPF area ID in IP address format\n" |
| 584 | "OSPF area ID as a decimal value\n" |
| 585 | "Summarize routes matching address/mask (border routers only)\n" |
| 586 | "Area range prefix\n") |
| 587 | { |
| 588 | struct ospf *ospf = vty->index; |
| 589 | struct prefix_ipv4 p; |
| 590 | struct in_addr area_id; |
| 591 | int format; |
| 592 | |
| 593 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 594 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 595 | |
| 596 | ospf_area_range_unset (ospf, area_id, &p); |
| 597 | |
| 598 | return CMD_SUCCESS; |
| 599 | } |
| 600 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 601 | ALIAS (no_ospf_area_range, |
| 602 | no_ospf_area_range_advertise_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 603 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M (advertise|not-advertise)", |
| 604 | NO_STR |
| 605 | "OSPF area parameters\n" |
| 606 | "OSPF area ID in IP address format\n" |
| 607 | "OSPF area ID as a decimal value\n" |
| 608 | "Summarize routes matching address/mask (border routers only)\n" |
| 609 | "Area range prefix\n" |
| 610 | "Advertise this range (default)\n" |
| 611 | "DoNotAdvertise this range\n") |
| 612 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 613 | ALIAS (no_ospf_area_range, |
| 614 | no_ospf_area_range_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 615 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M cost <0-16777215>", |
| 616 | NO_STR |
| 617 | "OSPF area parameters\n" |
| 618 | "OSPF area ID in IP address format\n" |
| 619 | "OSPF area ID as a decimal value\n" |
| 620 | "Summarize routes matching address/mask (border routers only)\n" |
| 621 | "Area range prefix\n" |
| 622 | "User specified metric for this range\n" |
| 623 | "Advertised metric for this range\n") |
| 624 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 625 | ALIAS (no_ospf_area_range, |
| 626 | no_ospf_area_range_advertise_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 627 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M advertise cost <0-16777215>", |
| 628 | NO_STR |
| 629 | "OSPF area parameters\n" |
| 630 | "OSPF area ID in IP address format\n" |
| 631 | "OSPF area ID as a decimal value\n" |
| 632 | "Summarize routes matching address/mask (border routers only)\n" |
| 633 | "Area range prefix\n" |
| 634 | "Advertise this range (default)\n" |
| 635 | "User specified metric for this range\n" |
| 636 | "Advertised metric for this range\n") |
| 637 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 638 | DEFUN (ospf_area_range_substitute, |
| 639 | ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 640 | "area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 641 | "OSPF area parameters\n" |
| 642 | "OSPF area ID in IP address format\n" |
| 643 | "OSPF area ID as a decimal value\n" |
| 644 | "Summarize routes matching address/mask (border routers only)\n" |
| 645 | "Area range prefix\n" |
| 646 | "Announce area range as another prefix\n" |
| 647 | "Network prefix to be announced instead of range\n") |
| 648 | { |
| 649 | struct ospf *ospf = vty->index; |
| 650 | struct prefix_ipv4 p, s; |
| 651 | struct in_addr area_id; |
| 652 | int format; |
| 653 | |
| 654 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 655 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 656 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 657 | |
| 658 | ospf_area_range_substitute_set (ospf, area_id, &p, &s); |
| 659 | |
| 660 | return CMD_SUCCESS; |
| 661 | } |
| 662 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 663 | DEFUN (no_ospf_area_range_substitute, |
| 664 | no_ospf_area_range_substitute_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 665 | "no area (A.B.C.D|<0-4294967295>) range A.B.C.D/M substitute A.B.C.D/M", |
| 666 | NO_STR |
| 667 | "OSPF area parameters\n" |
| 668 | "OSPF area ID in IP address format\n" |
| 669 | "OSPF area ID as a decimal value\n" |
| 670 | "Summarize routes matching address/mask (border routers only)\n" |
| 671 | "Area range prefix\n" |
| 672 | "Announce area range as another prefix\n" |
| 673 | "Network prefix to be announced instead of range\n") |
| 674 | { |
| 675 | struct ospf *ospf = vty->index; |
| 676 | struct prefix_ipv4 p, s; |
| 677 | struct in_addr area_id; |
| 678 | int format; |
| 679 | |
| 680 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 681 | VTY_GET_IPV4_PREFIX ("area range", p, argv[1]); |
| 682 | VTY_GET_IPV4_PREFIX ("substituted network prefix", s, argv[2]); |
| 683 | |
| 684 | ospf_area_range_substitute_unset (ospf, area_id, &p); |
| 685 | |
| 686 | return CMD_SUCCESS; |
| 687 | } |
| 688 | |
| 689 | |
| 690 | /* Command Handler Logic in VLink stuff is delicate!! |
| 691 | |
| 692 | ALTER AT YOUR OWN RISK!!!! |
| 693 | |
| 694 | Various dummy values are used to represent 'NoChange' state for |
| 695 | VLink configuration NOT being changed by a VLink command, and |
| 696 | special syntax is used within the command strings so that the |
| 697 | typed in command verbs can be seen in the configuration command |
| 698 | bacckend handler. This is to drastically reduce the verbeage |
| 699 | required to coe up with a reasonably compatible Cisco VLink command |
| 700 | |
| 701 | - Matthew Grant <grantma@anathoth.gen.nz> |
| 702 | Wed, 21 Feb 2001 15:13:52 +1300 |
| 703 | */ |
| 704 | |
| 705 | |
| 706 | /* Configuration data for virtual links |
| 707 | */ |
| 708 | struct ospf_vl_config_data { |
| 709 | struct vty *vty; /* vty stuff */ |
| 710 | struct in_addr area_id; /* area ID from command line */ |
| 711 | int format; /* command line area ID format */ |
| 712 | struct in_addr vl_peer; /* command line vl_peer */ |
| 713 | int auth_type; /* Authehntication type, if given */ |
| 714 | char *auth_key; /* simple password if present */ |
| 715 | int crypto_key_id; /* Cryptographic key ID */ |
| 716 | char *md5_key; /* MD5 authentication key */ |
| 717 | int hello_interval; /* Obvious what these are... */ |
| 718 | int retransmit_interval; |
| 719 | int transmit_delay; |
| 720 | int dead_interval; |
| 721 | }; |
| 722 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 723 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 724 | ospf_vl_config_data_init (struct ospf_vl_config_data *vl_config, |
| 725 | struct vty *vty) |
| 726 | { |
| 727 | memset (vl_config, 0, sizeof (struct ospf_vl_config_data)); |
| 728 | vl_config->auth_type = OSPF_AUTH_CMD_NOTSEEN; |
| 729 | vl_config->vty = vty; |
| 730 | } |
| 731 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 732 | static struct ospf_vl_data * |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 733 | 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] | 734 | { |
| 735 | struct ospf_area *area; |
| 736 | struct ospf_vl_data *vl_data; |
| 737 | struct vty *vty; |
| 738 | struct in_addr area_id; |
| 739 | |
| 740 | vty = vl_config->vty; |
| 741 | area_id = vl_config->area_id; |
| 742 | |
| 743 | if (area_id.s_addr == OSPF_AREA_BACKBONE) |
| 744 | { |
| 745 | vty_out (vty, |
| 746 | "Configuring VLs over the backbone is not allowed%s", |
| 747 | VTY_NEWLINE); |
| 748 | return NULL; |
| 749 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 750 | area = ospf_area_get (ospf, area_id, vl_config->format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 751 | |
| 752 | if (area->external_routing != OSPF_AREA_DEFAULT) |
| 753 | { |
| 754 | if (vl_config->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 755 | vty_out (vty, "Area %s is %s%s", |
| 756 | inet_ntoa (area_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 757 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 758 | VTY_NEWLINE); |
| 759 | else |
| 760 | vty_out (vty, "Area %ld is %s%s", |
| 761 | (u_long)ntohl (area_id.s_addr), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 762 | area->external_routing == OSPF_AREA_NSSA?"nssa":"stub", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 763 | VTY_NEWLINE); |
| 764 | return NULL; |
| 765 | } |
| 766 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 767 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config->vl_peer)) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 768 | { |
| 769 | vl_data = ospf_vl_data_new (area, vl_config->vl_peer); |
| 770 | if (vl_data->vl_oi == NULL) |
| 771 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 772 | vl_data->vl_oi = ospf_vl_new (ospf, vl_data); |
| 773 | ospf_vl_add (ospf, vl_data); |
| 774 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 775 | } |
| 776 | } |
| 777 | return vl_data; |
| 778 | } |
| 779 | |
| 780 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 781 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 782 | ospf_vl_set_security (struct ospf_vl_data *vl_data, |
| 783 | struct ospf_vl_config_data *vl_config) |
| 784 | { |
| 785 | struct crypt_key *ck; |
| 786 | struct vty *vty; |
| 787 | struct interface *ifp = vl_data->vl_oi->ifp; |
| 788 | |
| 789 | vty = vl_config->vty; |
| 790 | |
| 791 | if (vl_config->auth_type != OSPF_AUTH_CMD_NOTSEEN) |
| 792 | { |
| 793 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), auth_type); |
| 794 | IF_DEF_PARAMS (ifp)->auth_type = vl_config->auth_type; |
| 795 | } |
| 796 | |
| 797 | if (vl_config->auth_key) |
| 798 | { |
| 799 | memset(IF_DEF_PARAMS (ifp)->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 800 | strncpy ((char *) IF_DEF_PARAMS (ifp)->auth_simple, vl_config->auth_key, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 801 | OSPF_AUTH_SIMPLE_SIZE); |
| 802 | } |
| 803 | else if (vl_config->md5_key) |
| 804 | { |
| 805 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id) |
| 806 | != NULL) |
| 807 | { |
| 808 | vty_out (vty, "OSPF: Key %d already exists%s", |
| 809 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 810 | return CMD_WARNING; |
| 811 | } |
| 812 | ck = ospf_crypt_key_new (); |
| 813 | ck->key_id = vl_config->crypto_key_id; |
| 814 | memset(ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 815 | strncpy ((char *) ck->auth_key, vl_config->md5_key, OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 816 | |
| 817 | ospf_crypt_key_add (IF_DEF_PARAMS (ifp)->auth_crypt, ck); |
| 818 | } |
| 819 | else if (vl_config->crypto_key_id != 0) |
| 820 | { |
| 821 | /* Delete a key */ |
| 822 | |
| 823 | if (ospf_crypt_key_lookup (IF_DEF_PARAMS (ifp)->auth_crypt, |
| 824 | vl_config->crypto_key_id) == NULL) |
| 825 | { |
| 826 | vty_out (vty, "OSPF: Key %d does not exist%s", |
| 827 | vl_config->crypto_key_id, VTY_NEWLINE); |
| 828 | return CMD_WARNING; |
| 829 | } |
| 830 | |
| 831 | ospf_crypt_key_delete (IF_DEF_PARAMS (ifp)->auth_crypt, vl_config->crypto_key_id); |
| 832 | |
| 833 | } |
| 834 | |
| 835 | return CMD_SUCCESS; |
| 836 | } |
| 837 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 838 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 839 | ospf_vl_set_timers (struct ospf_vl_data *vl_data, |
| 840 | struct ospf_vl_config_data *vl_config) |
| 841 | { |
| 842 | struct interface *ifp = ifp = vl_data->vl_oi->ifp; |
| 843 | /* Virtual Link data initialised to defaults, so only set |
| 844 | if a value given */ |
| 845 | if (vl_config->hello_interval) |
| 846 | { |
| 847 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_hello); |
| 848 | IF_DEF_PARAMS (ifp)->v_hello = vl_config->hello_interval; |
| 849 | } |
| 850 | |
| 851 | if (vl_config->dead_interval) |
| 852 | { |
| 853 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), v_wait); |
| 854 | IF_DEF_PARAMS (ifp)->v_wait = vl_config->dead_interval; |
| 855 | } |
| 856 | |
| 857 | if (vl_config->retransmit_interval) |
| 858 | { |
| 859 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), retransmit_interval); |
| 860 | IF_DEF_PARAMS (ifp)->retransmit_interval = vl_config->retransmit_interval; |
| 861 | } |
| 862 | |
| 863 | if (vl_config->transmit_delay) |
| 864 | { |
| 865 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), transmit_delay); |
| 866 | IF_DEF_PARAMS (ifp)->transmit_delay = vl_config->transmit_delay; |
| 867 | } |
| 868 | |
| 869 | return CMD_SUCCESS; |
| 870 | } |
| 871 | |
| 872 | |
| 873 | |
| 874 | /* The business end of all of the above */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 875 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 876 | ospf_vl_set (struct ospf *ospf, struct ospf_vl_config_data *vl_config) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 877 | { |
| 878 | struct ospf_vl_data *vl_data; |
| 879 | int ret; |
| 880 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 881 | vl_data = ospf_find_vl_data (ospf, vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 882 | if (!vl_data) |
| 883 | return CMD_WARNING; |
| 884 | |
| 885 | /* Process this one first as it can have a fatal result, which can |
| 886 | only logically occur if the virtual link exists already |
| 887 | Thus a command error does not result in a change to the |
| 888 | running configuration such as unexpectedly altered timer |
| 889 | values etc.*/ |
| 890 | ret = ospf_vl_set_security (vl_data, vl_config); |
| 891 | if (ret != CMD_SUCCESS) |
| 892 | return ret; |
| 893 | |
| 894 | /* Set any time based parameters, these area already range checked */ |
| 895 | |
| 896 | ret = ospf_vl_set_timers (vl_data, vl_config); |
| 897 | if (ret != CMD_SUCCESS) |
| 898 | return ret; |
| 899 | |
| 900 | return CMD_SUCCESS; |
| 901 | |
| 902 | } |
| 903 | |
| 904 | /* This stuff exists to make specifying all the alias commands A LOT simpler |
| 905 | */ |
| 906 | #define VLINK_HELPSTR_IPADDR \ |
| 907 | "OSPF area parameters\n" \ |
| 908 | "OSPF area ID in IP address format\n" \ |
| 909 | "OSPF area ID as a decimal value\n" \ |
| 910 | "Configure a virtual link\n" \ |
| 911 | "Router ID of the remote ABR\n" |
| 912 | |
| 913 | #define VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 914 | "Enable authentication on this virtual link\n" \ |
| 915 | "dummy string \n" |
| 916 | |
| 917 | #define VLINK_HELPSTR_AUTHTYPE_ALL \ |
| 918 | VLINK_HELPSTR_AUTHTYPE_SIMPLE \ |
| 919 | "Use null authentication\n" \ |
| 920 | "Use message-digest authentication\n" |
| 921 | |
| 922 | #define VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 923 | "Time between HELLO packets\n" \ |
| 924 | "Time between retransmitting lost link state advertisements\n" \ |
| 925 | "Link state transmit delay\n" \ |
| 926 | "Interval after which a neighbor is declared dead\n" |
| 927 | |
| 928 | #define VLINK_HELPSTR_TIME_PARAM \ |
| 929 | VLINK_HELPSTR_TIME_PARAM_NOSECS \ |
| 930 | "Seconds\n" |
| 931 | |
| 932 | #define VLINK_HELPSTR_AUTH_SIMPLE \ |
| 933 | "Authentication password (key)\n" \ |
| 934 | "The OSPF password (key)" |
| 935 | |
| 936 | #define VLINK_HELPSTR_AUTH_MD5 \ |
| 937 | "Message digest authentication password (key)\n" \ |
| 938 | "dummy string \n" \ |
| 939 | "Key ID\n" \ |
| 940 | "Use MD5 algorithm\n" \ |
| 941 | "The OSPF password (key)" |
| 942 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 943 | DEFUN (ospf_area_vlink, |
| 944 | ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 945 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 946 | VLINK_HELPSTR_IPADDR) |
| 947 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 948 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 949 | struct ospf_vl_config_data vl_config; |
| 950 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 951 | char md5_key[OSPF_AUTH_MD5_SIZE+1]; |
| 952 | int i; |
| 953 | int ret; |
| 954 | |
| 955 | ospf_vl_config_data_init(&vl_config, vty); |
| 956 | |
| 957 | /* Read off first 2 parameters and check them */ |
| 958 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &vl_config.format); |
| 959 | if (ret < 0) |
| 960 | { |
| 961 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 962 | return CMD_WARNING; |
| 963 | } |
| 964 | |
| 965 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 966 | if (! ret) |
| 967 | { |
| 968 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 969 | VTY_NEWLINE); |
| 970 | return CMD_WARNING; |
| 971 | } |
| 972 | |
| 973 | if (argc <=2) |
| 974 | { |
| 975 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
| 976 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 977 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 978 | } |
| 979 | |
| 980 | /* Deal with other parameters */ |
| 981 | for (i=2; i < argc; i++) |
| 982 | { |
| 983 | |
| 984 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 985 | |
| 986 | switch (argv[i][0]) |
| 987 | { |
| 988 | |
| 989 | case 'a': |
| 990 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 991 | { |
| 992 | /* authentication-key - this option can occur anywhere on |
| 993 | command line. At start of command line |
| 994 | must check for authentication option. */ |
| 995 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 996 | strncpy (auth_key, argv[i+1], OSPF_AUTH_SIMPLE_SIZE); |
| 997 | vl_config.auth_key = auth_key; |
| 998 | i++; |
| 999 | } |
| 1000 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1001 | { |
| 1002 | /* authentication - this option can only occur at start |
| 1003 | of command line */ |
| 1004 | vl_config.auth_type = OSPF_AUTH_SIMPLE; |
| 1005 | if ((i+1) < argc) |
| 1006 | { |
| 1007 | if (strncmp (argv[i+1], "n", 1) == 0) |
| 1008 | { |
| 1009 | /* "authentication null" */ |
| 1010 | vl_config.auth_type = OSPF_AUTH_NULL; |
| 1011 | i++; |
| 1012 | } |
| 1013 | else if (strncmp (argv[i+1], "m", 1) == 0 |
| 1014 | && strcmp (argv[i+1], "message-digest-") != 0) |
| 1015 | { |
| 1016 | /* "authentication message-digest" */ |
| 1017 | vl_config.auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1018 | i++; |
| 1019 | } |
| 1020 | } |
| 1021 | } |
| 1022 | break; |
| 1023 | |
| 1024 | case 'm': |
| 1025 | /* message-digest-key */ |
| 1026 | i++; |
| 1027 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1028 | if (vl_config.crypto_key_id < 0) |
| 1029 | return CMD_WARNING; |
| 1030 | i++; |
| 1031 | memset(md5_key, 0, OSPF_AUTH_MD5_SIZE+1); |
| 1032 | strncpy (md5_key, argv[i], OSPF_AUTH_MD5_SIZE); |
| 1033 | vl_config.md5_key = md5_key; |
| 1034 | break; |
| 1035 | |
| 1036 | case 'h': |
| 1037 | /* Hello interval */ |
| 1038 | i++; |
| 1039 | vl_config.hello_interval = strtol (argv[i], NULL, 10); |
| 1040 | if (vl_config.hello_interval < 0) |
| 1041 | return CMD_WARNING; |
| 1042 | break; |
| 1043 | |
| 1044 | case 'r': |
| 1045 | /* Retransmit Interval */ |
| 1046 | i++; |
| 1047 | vl_config.retransmit_interval = strtol (argv[i], NULL, 10); |
| 1048 | if (vl_config.retransmit_interval < 0) |
| 1049 | return CMD_WARNING; |
| 1050 | break; |
| 1051 | |
| 1052 | case 't': |
| 1053 | /* Transmit Delay */ |
| 1054 | i++; |
| 1055 | vl_config.transmit_delay = strtol (argv[i], NULL, 10); |
| 1056 | if (vl_config.transmit_delay < 0) |
| 1057 | return CMD_WARNING; |
| 1058 | break; |
| 1059 | |
| 1060 | case 'd': |
| 1061 | /* Dead Interval */ |
| 1062 | i++; |
| 1063 | vl_config.dead_interval = strtol (argv[i], NULL, 10); |
| 1064 | if (vl_config.dead_interval < 0) |
| 1065 | return CMD_WARNING; |
| 1066 | break; |
| 1067 | } |
| 1068 | } |
| 1069 | |
| 1070 | |
| 1071 | /* Action configuration */ |
| 1072 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1073 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1074 | |
| 1075 | } |
| 1076 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1077 | DEFUN (no_ospf_area_vlink, |
| 1078 | no_ospf_area_vlink_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1079 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D", |
| 1080 | NO_STR |
| 1081 | VLINK_HELPSTR_IPADDR) |
| 1082 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1083 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1084 | struct ospf_area *area; |
| 1085 | struct ospf_vl_config_data vl_config; |
| 1086 | struct ospf_vl_data *vl_data = NULL; |
| 1087 | char auth_key[OSPF_AUTH_SIMPLE_SIZE+1]; |
| 1088 | int i; |
| 1089 | int ret, format; |
| 1090 | |
| 1091 | ospf_vl_config_data_init(&vl_config, vty); |
| 1092 | |
| 1093 | ret = ospf_str2area_id (argv[0], &vl_config.area_id, &format); |
| 1094 | if (ret < 0) |
| 1095 | { |
| 1096 | vty_out (vty, "OSPF area ID is invalid%s", VTY_NEWLINE); |
| 1097 | return CMD_WARNING; |
| 1098 | } |
| 1099 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1100 | area = ospf_area_lookup_by_area_id (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1101 | if (!area) |
| 1102 | { |
| 1103 | vty_out (vty, "Area does not exist%s", VTY_NEWLINE); |
| 1104 | return CMD_WARNING; |
| 1105 | } |
| 1106 | |
| 1107 | ret = inet_aton (argv[1], &vl_config.vl_peer); |
| 1108 | if (! ret) |
| 1109 | { |
| 1110 | vty_out (vty, "Please specify valid Router ID as a.b.c.d%s", |
| 1111 | VTY_NEWLINE); |
| 1112 | return CMD_WARNING; |
| 1113 | } |
| 1114 | |
| 1115 | if (argc <=2) |
| 1116 | { |
| 1117 | /* Basic VLink no command */ |
| 1118 | /* Thats all folks! - BUGS B. strikes again!!!*/ |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 1119 | if ((vl_data = ospf_vl_lookup (ospf, area, vl_config.vl_peer))) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1120 | ospf_vl_delete (ospf, vl_data); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1121 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1122 | ospf_area_check_free (ospf, vl_config.area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1123 | |
| 1124 | return CMD_SUCCESS; |
| 1125 | } |
| 1126 | |
| 1127 | /* If we are down here, we are reseting parameters */ |
| 1128 | |
| 1129 | /* Deal with other parameters */ |
| 1130 | for (i=2; i < argc; i++) |
| 1131 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1132 | /* vty_out (vty, "argv[%d] - %s%s", i, argv[i], VTY_NEWLINE); */ |
| 1133 | |
| 1134 | switch (argv[i][0]) |
| 1135 | { |
| 1136 | |
| 1137 | case 'a': |
| 1138 | if (i > 2 || strncmp (argv[i], "authentication-", 15) == 0) |
| 1139 | { |
| 1140 | /* authentication-key - this option can occur anywhere on |
| 1141 | command line. At start of command line |
| 1142 | must check for authentication option. */ |
| 1143 | memset (auth_key, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
| 1144 | vl_config.auth_key = auth_key; |
| 1145 | } |
| 1146 | else if (strncmp (argv[i], "authentication", 14) == 0) |
| 1147 | { |
| 1148 | /* authentication - this option can only occur at start |
| 1149 | of command line */ |
| 1150 | vl_config.auth_type = OSPF_AUTH_NOTSET; |
| 1151 | } |
| 1152 | break; |
| 1153 | |
| 1154 | case 'm': |
| 1155 | /* message-digest-key */ |
| 1156 | /* Delete one key */ |
| 1157 | i++; |
| 1158 | vl_config.crypto_key_id = strtol (argv[i], NULL, 10); |
| 1159 | if (vl_config.crypto_key_id < 0) |
| 1160 | return CMD_WARNING; |
| 1161 | vl_config.md5_key = NULL; |
| 1162 | break; |
| 1163 | |
| 1164 | case 'h': |
| 1165 | /* Hello interval */ |
| 1166 | vl_config.hello_interval = OSPF_HELLO_INTERVAL_DEFAULT; |
| 1167 | break; |
| 1168 | |
| 1169 | case 'r': |
| 1170 | /* Retransmit Interval */ |
| 1171 | vl_config.retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 1172 | break; |
| 1173 | |
| 1174 | case 't': |
| 1175 | /* Transmit Delay */ |
| 1176 | vl_config.transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 1177 | break; |
| 1178 | |
| 1179 | case 'd': |
| 1180 | /* Dead Interval */ |
| 1181 | i++; |
| 1182 | vl_config.dead_interval = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
| 1183 | break; |
| 1184 | } |
| 1185 | } |
| 1186 | |
| 1187 | |
| 1188 | /* Action configuration */ |
| 1189 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1190 | return ospf_vl_set (ospf, &vl_config); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1191 | } |
| 1192 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1193 | ALIAS (ospf_area_vlink, |
| 1194 | ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1195 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1196 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1197 | VLINK_HELPSTR_IPADDR |
| 1198 | VLINK_HELPSTR_TIME_PARAM) |
| 1199 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1200 | ALIAS (no_ospf_area_vlink, |
| 1201 | no_ospf_area_vlink_param1_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1202 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1203 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1204 | NO_STR |
| 1205 | VLINK_HELPSTR_IPADDR |
| 1206 | VLINK_HELPSTR_TIME_PARAM) |
| 1207 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1208 | ALIAS (ospf_area_vlink, |
| 1209 | ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1210 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1211 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1212 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1213 | VLINK_HELPSTR_IPADDR |
| 1214 | VLINK_HELPSTR_TIME_PARAM |
| 1215 | VLINK_HELPSTR_TIME_PARAM) |
| 1216 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1217 | ALIAS (no_ospf_area_vlink, |
| 1218 | no_ospf_area_vlink_param2_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1219 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1220 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1221 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1222 | NO_STR |
| 1223 | VLINK_HELPSTR_IPADDR |
| 1224 | VLINK_HELPSTR_TIME_PARAM |
| 1225 | VLINK_HELPSTR_TIME_PARAM) |
| 1226 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1227 | ALIAS (ospf_area_vlink, |
| 1228 | ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1229 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1230 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1231 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1232 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1233 | VLINK_HELPSTR_IPADDR |
| 1234 | VLINK_HELPSTR_TIME_PARAM |
| 1235 | VLINK_HELPSTR_TIME_PARAM |
| 1236 | VLINK_HELPSTR_TIME_PARAM) |
| 1237 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1238 | ALIAS (no_ospf_area_vlink, |
| 1239 | no_ospf_area_vlink_param3_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1240 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1241 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1242 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1243 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1244 | NO_STR |
| 1245 | VLINK_HELPSTR_IPADDR |
| 1246 | VLINK_HELPSTR_TIME_PARAM |
| 1247 | VLINK_HELPSTR_TIME_PARAM |
| 1248 | VLINK_HELPSTR_TIME_PARAM) |
| 1249 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1250 | ALIAS (ospf_area_vlink, |
| 1251 | ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1252 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1253 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1254 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1255 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535> " |
| 1256 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) <1-65535>", |
| 1257 | VLINK_HELPSTR_IPADDR |
| 1258 | VLINK_HELPSTR_TIME_PARAM |
| 1259 | VLINK_HELPSTR_TIME_PARAM |
| 1260 | VLINK_HELPSTR_TIME_PARAM |
| 1261 | VLINK_HELPSTR_TIME_PARAM) |
| 1262 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1263 | ALIAS (no_ospf_area_vlink, |
| 1264 | no_ospf_area_vlink_param4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1265 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1266 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1267 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1268 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval) " |
| 1269 | "(hello-interval|retransmit-interval|transmit-delay|dead-interval)", |
| 1270 | NO_STR |
| 1271 | VLINK_HELPSTR_IPADDR |
| 1272 | VLINK_HELPSTR_TIME_PARAM |
| 1273 | VLINK_HELPSTR_TIME_PARAM |
| 1274 | VLINK_HELPSTR_TIME_PARAM |
| 1275 | VLINK_HELPSTR_TIME_PARAM) |
| 1276 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1277 | ALIAS (ospf_area_vlink, |
| 1278 | ospf_area_vlink_authtype_args_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1279 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1280 | "(authentication|) (message-digest|null)", |
| 1281 | VLINK_HELPSTR_IPADDR |
| 1282 | VLINK_HELPSTR_AUTHTYPE_ALL) |
| 1283 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1284 | ALIAS (ospf_area_vlink, |
| 1285 | ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1286 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1287 | "(authentication|)", |
| 1288 | VLINK_HELPSTR_IPADDR |
| 1289 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1290 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1291 | ALIAS (no_ospf_area_vlink, |
| 1292 | no_ospf_area_vlink_authtype_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1293 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1294 | "(authentication|)", |
| 1295 | NO_STR |
| 1296 | VLINK_HELPSTR_IPADDR |
| 1297 | VLINK_HELPSTR_AUTHTYPE_SIMPLE) |
| 1298 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1299 | ALIAS (ospf_area_vlink, |
| 1300 | ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1301 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1302 | "(message-digest-key|) <1-255> md5 KEY", |
| 1303 | VLINK_HELPSTR_IPADDR |
| 1304 | VLINK_HELPSTR_AUTH_MD5) |
| 1305 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1306 | ALIAS (no_ospf_area_vlink, |
| 1307 | no_ospf_area_vlink_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1308 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1309 | "(message-digest-key|) <1-255>", |
| 1310 | NO_STR |
| 1311 | VLINK_HELPSTR_IPADDR |
| 1312 | VLINK_HELPSTR_AUTH_MD5) |
| 1313 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1314 | ALIAS (ospf_area_vlink, |
| 1315 | ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1316 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1317 | "(authentication-key|) AUTH_KEY", |
| 1318 | VLINK_HELPSTR_IPADDR |
| 1319 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1320 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1321 | ALIAS (no_ospf_area_vlink, |
| 1322 | no_ospf_area_vlink_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1323 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1324 | "(authentication-key|)", |
| 1325 | NO_STR |
| 1326 | VLINK_HELPSTR_IPADDR |
| 1327 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1328 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1329 | ALIAS (ospf_area_vlink, |
| 1330 | ospf_area_vlink_authtype_args_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1331 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1332 | "(authentication|) (message-digest|null) " |
| 1333 | "(authentication-key|) AUTH_KEY", |
| 1334 | VLINK_HELPSTR_IPADDR |
| 1335 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1336 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1337 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1338 | ALIAS (ospf_area_vlink, |
| 1339 | ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1340 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1341 | "(authentication|) " |
| 1342 | "(authentication-key|) AUTH_KEY", |
| 1343 | VLINK_HELPSTR_IPADDR |
| 1344 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1345 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1346 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1347 | ALIAS (no_ospf_area_vlink, |
| 1348 | no_ospf_area_vlink_authtype_authkey_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1349 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1350 | "(authentication|) " |
| 1351 | "(authentication-key|)", |
| 1352 | NO_STR |
| 1353 | VLINK_HELPSTR_IPADDR |
| 1354 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1355 | VLINK_HELPSTR_AUTH_SIMPLE) |
| 1356 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1357 | ALIAS (ospf_area_vlink, |
| 1358 | ospf_area_vlink_authtype_args_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1359 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1360 | "(authentication|) (message-digest|null) " |
| 1361 | "(message-digest-key|) <1-255> md5 KEY", |
| 1362 | VLINK_HELPSTR_IPADDR |
| 1363 | VLINK_HELPSTR_AUTHTYPE_ALL |
| 1364 | VLINK_HELPSTR_AUTH_MD5) |
| 1365 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1366 | ALIAS (ospf_area_vlink, |
| 1367 | ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1368 | "area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1369 | "(authentication|) " |
| 1370 | "(message-digest-key|) <1-255> md5 KEY", |
| 1371 | VLINK_HELPSTR_IPADDR |
| 1372 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1373 | VLINK_HELPSTR_AUTH_MD5) |
| 1374 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1375 | ALIAS (no_ospf_area_vlink, |
| 1376 | no_ospf_area_vlink_authtype_md5_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1377 | "no area (A.B.C.D|<0-4294967295>) virtual-link A.B.C.D " |
| 1378 | "(authentication|) " |
| 1379 | "(message-digest-key|)", |
| 1380 | NO_STR |
| 1381 | VLINK_HELPSTR_IPADDR |
| 1382 | VLINK_HELPSTR_AUTHTYPE_SIMPLE |
| 1383 | VLINK_HELPSTR_AUTH_MD5) |
| 1384 | |
| 1385 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1386 | DEFUN (ospf_area_shortcut, |
| 1387 | ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1388 | "area (A.B.C.D|<0-4294967295>) shortcut (default|enable|disable)", |
| 1389 | "OSPF area parameters\n" |
| 1390 | "OSPF area ID in IP address format\n" |
| 1391 | "OSPF area ID as a decimal value\n" |
| 1392 | "Configure the area's shortcutting mode\n" |
| 1393 | "Set default shortcutting behavior\n" |
| 1394 | "Enable shortcutting through the area\n" |
| 1395 | "Disable shortcutting through the area\n") |
| 1396 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1397 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1398 | struct ospf_area *area; |
| 1399 | struct in_addr area_id; |
| 1400 | int mode; |
| 1401 | int format; |
| 1402 | |
| 1403 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1404 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1405 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1406 | |
| 1407 | if (strncmp (argv[1], "de", 2) == 0) |
| 1408 | mode = OSPF_SHORTCUT_DEFAULT; |
| 1409 | else if (strncmp (argv[1], "di", 2) == 0) |
| 1410 | mode = OSPF_SHORTCUT_DISABLE; |
| 1411 | else if (strncmp (argv[1], "e", 1) == 0) |
| 1412 | mode = OSPF_SHORTCUT_ENABLE; |
| 1413 | else |
| 1414 | return CMD_WARNING; |
| 1415 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1416 | ospf_area_shortcut_set (ospf, area, mode); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1417 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1418 | if (ospf->abr_type != OSPF_ABR_SHORTCUT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1419 | vty_out (vty, "Shortcut area setting will take effect " |
| 1420 | "only when the router is configured as Shortcut ABR%s", |
| 1421 | VTY_NEWLINE); |
| 1422 | |
| 1423 | return CMD_SUCCESS; |
| 1424 | } |
| 1425 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1426 | DEFUN (no_ospf_area_shortcut, |
| 1427 | no_ospf_area_shortcut_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1428 | "no area (A.B.C.D|<0-4294967295>) shortcut (enable|disable)", |
| 1429 | NO_STR |
| 1430 | "OSPF area parameters\n" |
| 1431 | "OSPF area ID in IP address format\n" |
| 1432 | "OSPF area ID as a decimal value\n" |
| 1433 | "Deconfigure the area's shortcutting mode\n" |
| 1434 | "Deconfigure enabled shortcutting through the area\n" |
| 1435 | "Deconfigure disabled shortcutting through the area\n") |
| 1436 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1437 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1438 | struct ospf_area *area; |
| 1439 | struct in_addr area_id; |
| 1440 | int format; |
| 1441 | |
| 1442 | VTY_GET_OSPF_AREA_ID_NO_BB ("shortcut", area_id, format, argv[0]); |
| 1443 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1444 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1445 | if (!area) |
| 1446 | return CMD_SUCCESS; |
| 1447 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1448 | ospf_area_shortcut_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1449 | |
| 1450 | return CMD_SUCCESS; |
| 1451 | } |
| 1452 | |
| 1453 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1454 | DEFUN (ospf_area_stub, |
| 1455 | ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1456 | "area (A.B.C.D|<0-4294967295>) stub", |
| 1457 | "OSPF area parameters\n" |
| 1458 | "OSPF area ID in IP address format\n" |
| 1459 | "OSPF area ID as a decimal value\n" |
| 1460 | "Configure OSPF area as stub\n") |
| 1461 | { |
| 1462 | struct ospf *ospf = vty->index; |
| 1463 | struct in_addr area_id; |
| 1464 | int ret, format; |
| 1465 | |
| 1466 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1467 | |
| 1468 | ret = ospf_area_stub_set (ospf, area_id); |
| 1469 | if (ret == 0) |
| 1470 | { |
| 1471 | vty_out (vty, "First deconfigure all virtual link through this area%s", |
| 1472 | VTY_NEWLINE); |
| 1473 | return CMD_WARNING; |
| 1474 | } |
| 1475 | |
| 1476 | ospf_area_no_summary_unset (ospf, area_id); |
| 1477 | |
| 1478 | return CMD_SUCCESS; |
| 1479 | } |
| 1480 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1481 | DEFUN (ospf_area_stub_no_summary, |
| 1482 | ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1483 | "area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1484 | "OSPF stub parameters\n" |
| 1485 | "OSPF area ID in IP address format\n" |
| 1486 | "OSPF area ID as a decimal value\n" |
| 1487 | "Configure OSPF area as stub\n" |
| 1488 | "Do not inject inter-area routes into stub\n") |
| 1489 | { |
| 1490 | struct ospf *ospf = vty->index; |
| 1491 | struct in_addr area_id; |
| 1492 | int ret, format; |
| 1493 | |
| 1494 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1495 | |
| 1496 | ret = ospf_area_stub_set (ospf, area_id); |
| 1497 | if (ret == 0) |
| 1498 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1499 | 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] | 1500 | VTY_NEWLINE); |
| 1501 | return CMD_WARNING; |
| 1502 | } |
| 1503 | |
| 1504 | ospf_area_no_summary_set (ospf, area_id); |
| 1505 | |
| 1506 | return CMD_SUCCESS; |
| 1507 | } |
| 1508 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1509 | DEFUN (no_ospf_area_stub, |
| 1510 | no_ospf_area_stub_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1511 | "no area (A.B.C.D|<0-4294967295>) stub", |
| 1512 | NO_STR |
| 1513 | "OSPF area parameters\n" |
| 1514 | "OSPF area ID in IP address format\n" |
| 1515 | "OSPF area ID as a decimal value\n" |
| 1516 | "Configure OSPF area as stub\n") |
| 1517 | { |
| 1518 | struct ospf *ospf = vty->index; |
| 1519 | struct in_addr area_id; |
| 1520 | int format; |
| 1521 | |
| 1522 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1523 | |
| 1524 | ospf_area_stub_unset (ospf, area_id); |
| 1525 | ospf_area_no_summary_unset (ospf, area_id); |
| 1526 | |
| 1527 | return CMD_SUCCESS; |
| 1528 | } |
| 1529 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1530 | DEFUN (no_ospf_area_stub_no_summary, |
| 1531 | no_ospf_area_stub_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1532 | "no area (A.B.C.D|<0-4294967295>) stub no-summary", |
| 1533 | NO_STR |
| 1534 | "OSPF area parameters\n" |
| 1535 | "OSPF area ID in IP address format\n" |
| 1536 | "OSPF area ID as a decimal value\n" |
| 1537 | "Configure OSPF area as stub\n" |
| 1538 | "Do not inject inter-area routes into area\n") |
| 1539 | { |
| 1540 | struct ospf *ospf = vty->index; |
| 1541 | struct in_addr area_id; |
| 1542 | int format; |
| 1543 | |
| 1544 | VTY_GET_OSPF_AREA_ID_NO_BB ("stub", area_id, format, argv[0]); |
| 1545 | ospf_area_no_summary_unset (ospf, area_id); |
| 1546 | |
| 1547 | return CMD_SUCCESS; |
| 1548 | } |
| 1549 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 1550 | static int |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 1551 | ospf_area_nssa_cmd_handler (struct vty *vty, int argc, const char *argv[], |
| 1552 | int nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1553 | { |
| 1554 | struct ospf *ospf = vty->index; |
| 1555 | struct in_addr area_id; |
| 1556 | int ret, format; |
| 1557 | |
| 1558 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1559 | |
| 1560 | ret = ospf_area_nssa_set (ospf, area_id); |
| 1561 | if (ret == 0) |
| 1562 | { |
| 1563 | vty_out (vty, "%% Area cannot be nssa as it contains a virtual link%s", |
| 1564 | VTY_NEWLINE); |
| 1565 | return CMD_WARNING; |
| 1566 | } |
| 1567 | |
| 1568 | if (argc > 1) |
| 1569 | { |
| 1570 | if (strncmp (argv[1], "translate-c", 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_CANDIDATE); |
| 1573 | else if (strncmp (argv[1], "translate-n", 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_NEVER); |
| 1576 | else if (strncmp (argv[1], "translate-a", 11) == 0) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1577 | ospf_area_nssa_translator_role_set (ospf, area_id, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1578 | OSPF_NSSA_ROLE_ALWAYS); |
| 1579 | } |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1580 | else |
| 1581 | { |
| 1582 | ospf_area_nssa_translator_role_set (ospf, area_id, |
| 1583 | OSPF_NSSA_ROLE_CANDIDATE); |
| 1584 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1585 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1586 | if (nosum) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1587 | ospf_area_no_summary_set (ospf, area_id); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1588 | else |
| 1589 | ospf_area_no_summary_unset (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1590 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1591 | ospf_schedule_abr_task (ospf); |
| 1592 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1593 | return CMD_SUCCESS; |
| 1594 | } |
| 1595 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1596 | DEFUN (ospf_area_nssa_translate_no_summary, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1597 | ospf_area_nssa_translate_no_summary_cmd, |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1598 | "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] | 1599 | "OSPF area parameters\n" |
| 1600 | "OSPF area ID in IP address format\n" |
| 1601 | "OSPF area ID as a decimal value\n" |
| 1602 | "Configure OSPF area as nssa\n" |
| 1603 | "Configure NSSA-ABR for translate election (default)\n" |
| 1604 | "Configure NSSA-ABR to never translate\n" |
| 1605 | "Configure NSSA-ABR to always translate\n" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1606 | "Do not inject inter-area routes into nssa\n") |
| 1607 | { |
| 1608 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
| 1609 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1610 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1611 | DEFUN (ospf_area_nssa_translate, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1612 | ospf_area_nssa_translate_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1613 | "area (A.B.C.D|<0-4294967295>) nssa (translate-candidate|translate-never|translate-always)", |
| 1614 | "OSPF area parameters\n" |
| 1615 | "OSPF area ID in IP address format\n" |
| 1616 | "OSPF area ID as a decimal value\n" |
| 1617 | "Configure OSPF area as nssa\n" |
| 1618 | "Configure NSSA-ABR for translate election (default)\n" |
| 1619 | "Configure NSSA-ABR to never translate\n" |
| 1620 | "Configure NSSA-ABR to always translate\n") |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1621 | { |
| 1622 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1623 | } |
| 1624 | |
| 1625 | DEFUN (ospf_area_nssa, |
| 1626 | ospf_area_nssa_cmd, |
| 1627 | "area (A.B.C.D|<0-4294967295>) nssa", |
| 1628 | "OSPF area parameters\n" |
| 1629 | "OSPF area ID in IP address format\n" |
| 1630 | "OSPF area ID as a decimal value\n" |
| 1631 | "Configure OSPF area as nssa\n") |
| 1632 | { |
| 1633 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 0); |
| 1634 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1635 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1636 | DEFUN (ospf_area_nssa_no_summary, |
| 1637 | ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1638 | "area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1639 | "OSPF area parameters\n" |
| 1640 | "OSPF area ID in IP address format\n" |
| 1641 | "OSPF area ID as a decimal value\n" |
| 1642 | "Configure OSPF area as nssa\n" |
| 1643 | "Do not inject inter-area routes into nssa\n") |
| 1644 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1645 | return ospf_area_nssa_cmd_handler (vty, argc, argv, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1646 | } |
| 1647 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1648 | DEFUN (no_ospf_area_nssa, |
| 1649 | no_ospf_area_nssa_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1650 | "no area (A.B.C.D|<0-4294967295>) nssa", |
| 1651 | NO_STR |
| 1652 | "OSPF area parameters\n" |
| 1653 | "OSPF area ID in IP address format\n" |
| 1654 | "OSPF area ID as a decimal value\n" |
| 1655 | "Configure OSPF area as nssa\n") |
| 1656 | { |
| 1657 | struct ospf *ospf = vty->index; |
| 1658 | struct in_addr area_id; |
| 1659 | int format; |
| 1660 | |
| 1661 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1662 | |
| 1663 | ospf_area_nssa_unset (ospf, area_id); |
| 1664 | ospf_area_no_summary_unset (ospf, area_id); |
| 1665 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 1666 | ospf_schedule_abr_task (ospf); |
| 1667 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1668 | return CMD_SUCCESS; |
| 1669 | } |
| 1670 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1671 | DEFUN (no_ospf_area_nssa_no_summary, |
| 1672 | no_ospf_area_nssa_no_summary_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1673 | "no area (A.B.C.D|<0-4294967295>) nssa no-summary", |
| 1674 | NO_STR |
| 1675 | "OSPF area parameters\n" |
| 1676 | "OSPF area ID in IP address format\n" |
| 1677 | "OSPF area ID as a decimal value\n" |
| 1678 | "Configure OSPF area as nssa\n" |
| 1679 | "Do not inject inter-area routes into nssa\n") |
| 1680 | { |
| 1681 | struct ospf *ospf = vty->index; |
| 1682 | struct in_addr area_id; |
| 1683 | int format; |
| 1684 | |
| 1685 | VTY_GET_OSPF_AREA_ID_NO_BB ("NSSA", area_id, format, argv[0]); |
| 1686 | ospf_area_no_summary_unset (ospf, area_id); |
| 1687 | |
| 1688 | return CMD_SUCCESS; |
| 1689 | } |
| 1690 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1691 | DEFUN (ospf_area_default_cost, |
| 1692 | ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1693 | "area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1694 | "OSPF area parameters\n" |
| 1695 | "OSPF area ID in IP address format\n" |
| 1696 | "OSPF area ID as a decimal value\n" |
| 1697 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1698 | "Stub's advertised default summary cost\n") |
| 1699 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1700 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1701 | struct ospf_area *area; |
| 1702 | struct in_addr area_id; |
| 1703 | u_int32_t cost; |
| 1704 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1705 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1706 | |
| 1707 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1708 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1709 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1710 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1711 | |
| 1712 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1713 | { |
| 1714 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1715 | return CMD_WARNING; |
| 1716 | } |
| 1717 | |
| 1718 | area->default_cost = cost; |
| 1719 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1720 | p.family = AF_INET; |
| 1721 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1722 | p.prefixlen = 0; |
| 1723 | if (IS_DEBUG_OSPF_EVENT) |
| 1724 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1725 | "announcing 0.0.0.0/0 to area %s", |
| 1726 | inet_ntoa (area->area_id)); |
| 1727 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1728 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1729 | return CMD_SUCCESS; |
| 1730 | } |
| 1731 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1732 | DEFUN (no_ospf_area_default_cost, |
| 1733 | no_ospf_area_default_cost_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1734 | "no area (A.B.C.D|<0-4294967295>) default-cost <0-16777215>", |
| 1735 | NO_STR |
| 1736 | "OSPF area parameters\n" |
| 1737 | "OSPF area ID in IP address format\n" |
| 1738 | "OSPF area ID as a decimal value\n" |
| 1739 | "Set the summary-default cost of a NSSA or stub area\n" |
| 1740 | "Stub's advertised default summary cost\n") |
| 1741 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1742 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1743 | struct ospf_area *area; |
| 1744 | struct in_addr area_id; |
| 1745 | u_int32_t cost; |
| 1746 | int format; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1747 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1748 | |
| 1749 | VTY_GET_OSPF_AREA_ID_NO_BB ("default-cost", area_id, format, argv[0]); |
| 1750 | VTY_GET_INTEGER_RANGE ("stub default cost", cost, argv[1], 0, 16777215); |
| 1751 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1752 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1753 | if (area == NULL) |
| 1754 | return CMD_SUCCESS; |
| 1755 | |
| 1756 | if (area->external_routing == OSPF_AREA_DEFAULT) |
| 1757 | { |
| 1758 | vty_out (vty, "The area is neither stub, nor NSSA%s", VTY_NEWLINE); |
| 1759 | return CMD_WARNING; |
| 1760 | } |
| 1761 | |
| 1762 | area->default_cost = 1; |
| 1763 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 1764 | p.family = AF_INET; |
| 1765 | p.prefix.s_addr = OSPF_DEFAULT_DESTINATION; |
| 1766 | p.prefixlen = 0; |
| 1767 | if (IS_DEBUG_OSPF_EVENT) |
| 1768 | zlog_debug ("ospf_abr_announce_stub_defaults(): " |
| 1769 | "announcing 0.0.0.0/0 to area %s", |
| 1770 | inet_ntoa (area->area_id)); |
| 1771 | ospf_abr_announce_network_to_area (&p, area->default_cost, area); |
| 1772 | |
| 1773 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1774 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1775 | |
| 1776 | return CMD_SUCCESS; |
| 1777 | } |
| 1778 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1779 | DEFUN (ospf_area_export_list, |
| 1780 | ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1781 | "area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1782 | "OSPF area parameters\n" |
| 1783 | "OSPF area ID in IP address format\n" |
| 1784 | "OSPF area ID as a decimal value\n" |
| 1785 | "Set the filter for networks announced to other areas\n" |
| 1786 | "Name of the access-list\n") |
| 1787 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1788 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1789 | struct ospf_area *area; |
| 1790 | struct in_addr area_id; |
| 1791 | int format; |
| 1792 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1793 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1794 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1795 | area = ospf_area_get (ospf, area_id, format); |
| 1796 | ospf_area_export_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1797 | |
| 1798 | return CMD_SUCCESS; |
| 1799 | } |
| 1800 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1801 | DEFUN (no_ospf_area_export_list, |
| 1802 | no_ospf_area_export_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1803 | "no area (A.B.C.D|<0-4294967295>) export-list NAME", |
| 1804 | NO_STR |
| 1805 | "OSPF area parameters\n" |
| 1806 | "OSPF area ID in IP address format\n" |
| 1807 | "OSPF area ID as a decimal value\n" |
| 1808 | "Unset the filter for networks announced to other areas\n" |
| 1809 | "Name of the access-list\n") |
| 1810 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1811 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1812 | struct ospf_area *area; |
| 1813 | struct in_addr area_id; |
| 1814 | int format; |
| 1815 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1816 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1817 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1818 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1819 | if (area == NULL) |
| 1820 | return CMD_SUCCESS; |
| 1821 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1822 | ospf_area_export_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1823 | |
| 1824 | return CMD_SUCCESS; |
| 1825 | } |
| 1826 | |
| 1827 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1828 | DEFUN (ospf_area_import_list, |
| 1829 | ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1830 | "area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1831 | "OSPF area parameters\n" |
| 1832 | "OSPF area ID in IP address format\n" |
| 1833 | "OSPF area ID as a decimal value\n" |
| 1834 | "Set the filter for networks from other areas announced to the specified one\n" |
| 1835 | "Name of the access-list\n") |
| 1836 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1837 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1838 | struct ospf_area *area; |
| 1839 | struct in_addr area_id; |
| 1840 | int format; |
| 1841 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1842 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1843 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1844 | area = ospf_area_get (ospf, area_id, format); |
| 1845 | ospf_area_import_list_set (ospf, area, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1846 | |
| 1847 | return CMD_SUCCESS; |
| 1848 | } |
| 1849 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1850 | DEFUN (no_ospf_area_import_list, |
| 1851 | no_ospf_area_import_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1852 | "no area (A.B.C.D|<0-4294967295>) import-list NAME", |
| 1853 | NO_STR |
| 1854 | "OSPF area parameters\n" |
| 1855 | "OSPF area ID in IP address format\n" |
| 1856 | "OSPF area ID as a decimal value\n" |
| 1857 | "Unset the filter for networks announced to other areas\n" |
| 1858 | "Name of the access-list\n") |
| 1859 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1860 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1861 | struct ospf_area *area; |
| 1862 | struct in_addr area_id; |
| 1863 | int format; |
| 1864 | |
hasso | 5293076 | 2004-04-19 18:26:53 +0000 | [diff] [blame] | 1865 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1866 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1867 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1868 | if (area == NULL) |
| 1869 | return CMD_SUCCESS; |
| 1870 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1871 | ospf_area_import_list_unset (ospf, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1872 | |
| 1873 | return CMD_SUCCESS; |
| 1874 | } |
| 1875 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1876 | DEFUN (ospf_area_filter_list, |
| 1877 | ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1878 | "area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1879 | "OSPF area parameters\n" |
| 1880 | "OSPF area ID in IP address format\n" |
| 1881 | "OSPF area ID as a decimal value\n" |
| 1882 | "Filter networks between OSPF areas\n" |
| 1883 | "Filter prefixes between OSPF areas\n" |
| 1884 | "Name of an IP prefix-list\n" |
| 1885 | "Filter networks sent to this area\n" |
| 1886 | "Filter networks sent from this area\n") |
| 1887 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1888 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1889 | struct ospf_area *area; |
| 1890 | struct in_addr area_id; |
| 1891 | struct prefix_list *plist; |
| 1892 | int format; |
| 1893 | |
| 1894 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1895 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1896 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1897 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1898 | if (strncmp (argv[2], "in", 2) == 0) |
| 1899 | { |
| 1900 | PREFIX_LIST_IN (area) = plist; |
| 1901 | if (PREFIX_NAME_IN (area)) |
| 1902 | free (PREFIX_NAME_IN (area)); |
| 1903 | |
| 1904 | PREFIX_NAME_IN (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1905 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1906 | } |
| 1907 | else |
| 1908 | { |
| 1909 | PREFIX_LIST_OUT (area) = plist; |
| 1910 | if (PREFIX_NAME_OUT (area)) |
| 1911 | free (PREFIX_NAME_OUT (area)); |
| 1912 | |
| 1913 | PREFIX_NAME_OUT (area) = strdup (argv[1]); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1914 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1915 | } |
| 1916 | |
| 1917 | return CMD_SUCCESS; |
| 1918 | } |
| 1919 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1920 | DEFUN (no_ospf_area_filter_list, |
| 1921 | no_ospf_area_filter_list_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1922 | "no area (A.B.C.D|<0-4294967295>) filter-list prefix WORD (in|out)", |
| 1923 | NO_STR |
| 1924 | "OSPF area parameters\n" |
| 1925 | "OSPF area ID in IP address format\n" |
| 1926 | "OSPF area ID as a decimal value\n" |
| 1927 | "Filter networks between OSPF areas\n" |
| 1928 | "Filter prefixes between OSPF areas\n" |
| 1929 | "Name of an IP prefix-list\n" |
| 1930 | "Filter networks sent to this area\n" |
| 1931 | "Filter networks sent from this area\n") |
| 1932 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1933 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1934 | struct ospf_area *area; |
| 1935 | struct in_addr area_id; |
| 1936 | struct prefix_list *plist; |
| 1937 | int format; |
| 1938 | |
| 1939 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1940 | |
Paul Jakma | 1a8ec2b | 2006-05-11 13:34:08 +0000 | [diff] [blame] | 1941 | if ((area = ospf_area_lookup_by_area_id (ospf, area_id)) == NULL) |
| 1942 | return CMD_SUCCESS; |
| 1943 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1944 | plist = prefix_list_lookup (AFI_IP, argv[1]); |
| 1945 | if (strncmp (argv[2], "in", 2) == 0) |
| 1946 | { |
| 1947 | if (PREFIX_NAME_IN (area)) |
| 1948 | if (strcmp (PREFIX_NAME_IN (area), argv[1]) != 0) |
| 1949 | return CMD_SUCCESS; |
| 1950 | |
| 1951 | PREFIX_LIST_IN (area) = NULL; |
| 1952 | if (PREFIX_NAME_IN (area)) |
| 1953 | free (PREFIX_NAME_IN (area)); |
| 1954 | |
| 1955 | PREFIX_NAME_IN (area) = NULL; |
| 1956 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1957 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1958 | } |
| 1959 | else |
| 1960 | { |
| 1961 | if (PREFIX_NAME_OUT (area)) |
| 1962 | if (strcmp (PREFIX_NAME_OUT (area), argv[1]) != 0) |
| 1963 | return CMD_SUCCESS; |
| 1964 | |
| 1965 | PREFIX_LIST_OUT (area) = NULL; |
| 1966 | if (PREFIX_NAME_OUT (area)) |
| 1967 | free (PREFIX_NAME_OUT (area)); |
| 1968 | |
| 1969 | PREFIX_NAME_OUT (area) = NULL; |
| 1970 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1971 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1972 | } |
| 1973 | |
| 1974 | return CMD_SUCCESS; |
| 1975 | } |
| 1976 | |
| 1977 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1978 | DEFUN (ospf_area_authentication_message_digest, |
| 1979 | ospf_area_authentication_message_digest_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1980 | "area (A.B.C.D|<0-4294967295>) authentication message-digest", |
| 1981 | "OSPF area parameters\n" |
| 1982 | "Enable authentication\n" |
| 1983 | "Use message-digest authentication\n") |
| 1984 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1985 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1986 | struct ospf_area *area; |
| 1987 | struct in_addr area_id; |
| 1988 | int format; |
| 1989 | |
| 1990 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 1991 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 1992 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 1993 | area->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 1994 | |
| 1995 | return CMD_SUCCESS; |
| 1996 | } |
| 1997 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 1998 | DEFUN (ospf_area_authentication, |
| 1999 | ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2000 | "area (A.B.C.D|<0-4294967295>) authentication", |
| 2001 | "OSPF area parameters\n" |
| 2002 | "OSPF area ID in IP address format\n" |
| 2003 | "OSPF area ID as a decimal value\n" |
| 2004 | "Enable authentication\n") |
| 2005 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2006 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2007 | struct ospf_area *area; |
| 2008 | struct in_addr area_id; |
| 2009 | int format; |
| 2010 | |
| 2011 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2012 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2013 | area = ospf_area_get (ospf, area_id, format); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2014 | area->auth_type = OSPF_AUTH_SIMPLE; |
| 2015 | |
| 2016 | return CMD_SUCCESS; |
| 2017 | } |
| 2018 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2019 | DEFUN (no_ospf_area_authentication, |
| 2020 | no_ospf_area_authentication_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2021 | "no area (A.B.C.D|<0-4294967295>) authentication", |
| 2022 | NO_STR |
| 2023 | "OSPF area parameters\n" |
| 2024 | "OSPF area ID in IP address format\n" |
| 2025 | "OSPF area ID as a decimal value\n" |
| 2026 | "Enable authentication\n") |
| 2027 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2028 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2029 | struct ospf_area *area; |
| 2030 | struct in_addr area_id; |
| 2031 | int format; |
| 2032 | |
| 2033 | VTY_GET_OSPF_AREA_ID (area_id, format, argv[0]); |
| 2034 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2035 | area = ospf_area_lookup_by_area_id (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2036 | if (area == NULL) |
| 2037 | return CMD_SUCCESS; |
| 2038 | |
| 2039 | area->auth_type = OSPF_AUTH_NULL; |
| 2040 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2041 | ospf_area_check_free (ospf, area_id); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2042 | |
| 2043 | return CMD_SUCCESS; |
| 2044 | } |
| 2045 | |
| 2046 | |
| 2047 | DEFUN (ospf_abr_type, |
| 2048 | ospf_abr_type_cmd, |
| 2049 | "ospf abr-type (cisco|ibm|shortcut|standard)", |
| 2050 | "OSPF specific commands\n" |
| 2051 | "Set OSPF ABR type\n" |
| 2052 | "Alternative ABR, cisco implementation\n" |
| 2053 | "Alternative ABR, IBM implementation\n" |
| 2054 | "Shortcut ABR\n" |
| 2055 | "Standard behavior (RFC2328)\n") |
| 2056 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2057 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2058 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2059 | |
| 2060 | if (strncmp (argv[0], "c", 1) == 0) |
| 2061 | abr_type = OSPF_ABR_CISCO; |
| 2062 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2063 | abr_type = OSPF_ABR_IBM; |
| 2064 | else if (strncmp (argv[0], "sh", 2) == 0) |
| 2065 | abr_type = OSPF_ABR_SHORTCUT; |
| 2066 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2067 | abr_type = OSPF_ABR_STAND; |
| 2068 | else |
| 2069 | return CMD_WARNING; |
| 2070 | |
| 2071 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2072 | if (ospf->abr_type != abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2073 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2074 | ospf->abr_type = abr_type; |
| 2075 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2076 | } |
| 2077 | |
| 2078 | return CMD_SUCCESS; |
| 2079 | } |
| 2080 | |
| 2081 | DEFUN (no_ospf_abr_type, |
| 2082 | no_ospf_abr_type_cmd, |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2083 | "no ospf abr-type (cisco|ibm|shortcut|standard)", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2084 | NO_STR |
| 2085 | "OSPF specific commands\n" |
| 2086 | "Set OSPF ABR type\n" |
| 2087 | "Alternative ABR, cisco implementation\n" |
| 2088 | "Alternative ABR, IBM implementation\n" |
| 2089 | "Shortcut ABR\n") |
| 2090 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2091 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2092 | u_char abr_type = OSPF_ABR_UNKNOWN; |
| 2093 | |
| 2094 | if (strncmp (argv[0], "c", 1) == 0) |
| 2095 | abr_type = OSPF_ABR_CISCO; |
| 2096 | else if (strncmp (argv[0], "i", 1) == 0) |
| 2097 | abr_type = OSPF_ABR_IBM; |
Francesco Dolcini | 04d2331 | 2009-06-02 18:20:09 +0100 | [diff] [blame] | 2098 | else if (strncmp (argv[0], "sh", 2) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2099 | abr_type = OSPF_ABR_SHORTCUT; |
Francesco Dolcini | 04d2331 | 2009-06-02 18:20:09 +0100 | [diff] [blame] | 2100 | else if (strncmp (argv[0], "st", 2) == 0) |
| 2101 | abr_type = OSPF_ABR_STAND; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2102 | else |
| 2103 | return CMD_WARNING; |
| 2104 | |
| 2105 | /* If ABR type value is changed, schedule ABR task. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2106 | if (ospf->abr_type == abr_type) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2107 | { |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 2108 | ospf->abr_type = OSPF_ABR_DEFAULT; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2109 | ospf_schedule_abr_task (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2110 | } |
| 2111 | |
| 2112 | return CMD_SUCCESS; |
| 2113 | } |
| 2114 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 2115 | DEFUN (ospf_log_adjacency_changes, |
| 2116 | ospf_log_adjacency_changes_cmd, |
| 2117 | "log-adjacency-changes", |
| 2118 | "Log changes in adjacency state\n") |
| 2119 | { |
| 2120 | struct ospf *ospf = vty->index; |
| 2121 | |
| 2122 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2123 | return CMD_SUCCESS; |
| 2124 | } |
| 2125 | |
| 2126 | DEFUN (ospf_log_adjacency_changes_detail, |
| 2127 | ospf_log_adjacency_changes_detail_cmd, |
| 2128 | "log-adjacency-changes detail", |
| 2129 | "Log changes in adjacency state\n" |
| 2130 | "Log all state changes\n") |
| 2131 | { |
| 2132 | struct ospf *ospf = vty->index; |
| 2133 | |
| 2134 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2135 | SET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2136 | return CMD_SUCCESS; |
| 2137 | } |
| 2138 | |
| 2139 | DEFUN (no_ospf_log_adjacency_changes, |
| 2140 | no_ospf_log_adjacency_changes_cmd, |
| 2141 | "no log-adjacency-changes", |
| 2142 | NO_STR |
| 2143 | "Log changes in adjacency state\n") |
| 2144 | { |
| 2145 | struct ospf *ospf = vty->index; |
| 2146 | |
| 2147 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2148 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES); |
| 2149 | return CMD_SUCCESS; |
| 2150 | } |
| 2151 | |
| 2152 | DEFUN (no_ospf_log_adjacency_changes_detail, |
| 2153 | no_ospf_log_adjacency_changes_detail_cmd, |
| 2154 | "no log-adjacency-changes detail", |
| 2155 | NO_STR |
| 2156 | "Log changes in adjacency state\n" |
| 2157 | "Log all state changes\n") |
| 2158 | { |
| 2159 | struct ospf *ospf = vty->index; |
| 2160 | |
| 2161 | UNSET_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL); |
| 2162 | return CMD_SUCCESS; |
| 2163 | } |
| 2164 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2165 | DEFUN (ospf_compatible_rfc1583, |
| 2166 | ospf_compatible_rfc1583_cmd, |
| 2167 | "compatible rfc1583", |
| 2168 | "OSPF compatibility list\n" |
| 2169 | "compatible with RFC 1583\n") |
| 2170 | { |
| 2171 | struct ospf *ospf = vty->index; |
| 2172 | |
| 2173 | if (!CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2174 | { |
| 2175 | SET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2176 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2177 | } |
| 2178 | return CMD_SUCCESS; |
| 2179 | } |
| 2180 | |
| 2181 | DEFUN (no_ospf_compatible_rfc1583, |
| 2182 | no_ospf_compatible_rfc1583_cmd, |
| 2183 | "no compatible rfc1583", |
| 2184 | NO_STR |
| 2185 | "OSPF compatibility list\n" |
| 2186 | "compatible with RFC 1583\n") |
| 2187 | { |
| 2188 | struct ospf *ospf = vty->index; |
| 2189 | |
| 2190 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
| 2191 | { |
| 2192 | UNSET_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2193 | ospf_spf_calculate_schedule (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2194 | } |
| 2195 | return CMD_SUCCESS; |
| 2196 | } |
| 2197 | |
| 2198 | ALIAS (ospf_compatible_rfc1583, |
| 2199 | ospf_rfc1583_flag_cmd, |
| 2200 | "ospf rfc1583compatibility", |
| 2201 | "OSPF specific commands\n" |
| 2202 | "Enable the RFC1583Compatibility flag\n") |
| 2203 | |
| 2204 | ALIAS (no_ospf_compatible_rfc1583, |
| 2205 | no_ospf_rfc1583_flag_cmd, |
| 2206 | "no ospf rfc1583compatibility", |
| 2207 | NO_STR |
| 2208 | "OSPF specific commands\n" |
| 2209 | "Disable the RFC1583Compatibility flag\n") |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2210 | |
| 2211 | static int |
| 2212 | ospf_timers_spf_set (struct vty *vty, unsigned int delay, |
| 2213 | unsigned int hold, |
| 2214 | unsigned int max) |
| 2215 | { |
| 2216 | struct ospf *ospf = vty->index; |
| 2217 | |
| 2218 | ospf->spf_delay = delay; |
| 2219 | ospf->spf_holdtime = hold; |
| 2220 | ospf->spf_max_holdtime = max; |
| 2221 | |
| 2222 | return CMD_SUCCESS; |
| 2223 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2224 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2225 | DEFUN (ospf_timers_throttle_spf, |
| 2226 | ospf_timers_throttle_spf_cmd, |
| 2227 | "timers throttle spf <0-600000> <0-600000> <0-600000>", |
| 2228 | "Adjust routing timers\n" |
| 2229 | "Throttling adaptive timer\n" |
| 2230 | "OSPF SPF timers\n" |
| 2231 | "Delay (msec) from first change received till SPF calculation\n" |
| 2232 | "Initial hold time (msec) between consecutive SPF calculations\n" |
| 2233 | "Maximum hold time (msec)\n") |
| 2234 | { |
| 2235 | unsigned int delay, hold, max; |
| 2236 | |
| 2237 | if (argc != 3) |
| 2238 | { |
| 2239 | vty_out (vty, "Insufficient arguments%s", VTY_NEWLINE); |
| 2240 | return CMD_WARNING; |
| 2241 | } |
| 2242 | |
| 2243 | VTY_GET_INTEGER_RANGE ("SPF delay timer", delay, argv[0], 0, 600000); |
| 2244 | VTY_GET_INTEGER_RANGE ("SPF hold timer", hold, argv[1], 0, 600000); |
| 2245 | VTY_GET_INTEGER_RANGE ("SPF max-hold timer", max, argv[2], 0, 600000); |
| 2246 | |
| 2247 | return ospf_timers_spf_set (vty, delay, hold, max); |
| 2248 | } |
| 2249 | |
| 2250 | DEFUN_DEPRECATED (ospf_timers_spf, |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2251 | ospf_timers_spf_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2252 | "timers spf <0-4294967295> <0-4294967295>", |
| 2253 | "Adjust routing timers\n" |
| 2254 | "OSPF SPF timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2255 | "Delay (s) between receiving a change to SPF calculation\n" |
| 2256 | "Hold time (s) between consecutive SPF calculations\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2257 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2258 | unsigned int delay, hold; |
| 2259 | |
| 2260 | if (argc != 2) |
| 2261 | { |
| 2262 | vty_out (vty, "Insufficient number of arguments%s", VTY_NEWLINE); |
| 2263 | return CMD_WARNING; |
| 2264 | } |
| 2265 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2266 | VTY_GET_INTEGER ("SPF delay timer", delay, argv[0]); |
| 2267 | VTY_GET_INTEGER ("SPF hold timer", hold, argv[1]); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2268 | |
| 2269 | /* truncate down the second values if they're greater than 600000ms */ |
| 2270 | if (delay > (600000 / 1000)) |
| 2271 | delay = 600000; |
| 2272 | else if (delay == 0) |
| 2273 | /* 0s delay was probably specified because of lack of ms resolution */ |
| 2274 | delay = OSPF_SPF_DELAY_DEFAULT; |
| 2275 | if (hold > (600000 / 1000)) |
| 2276 | hold = 600000; |
| 2277 | |
| 2278 | return ospf_timers_spf_set (vty, delay * 1000, hold * 1000, hold * 1000); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2279 | } |
| 2280 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2281 | DEFUN (no_ospf_timers_throttle_spf, |
| 2282 | no_ospf_timers_throttle_spf_cmd, |
| 2283 | "no timers throttle spf", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2284 | NO_STR |
| 2285 | "Adjust routing timers\n" |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2286 | "Throttling adaptive timer\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2287 | "OSPF SPF timers\n") |
| 2288 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2289 | return ospf_timers_spf_set (vty, |
| 2290 | OSPF_SPF_DELAY_DEFAULT, |
| 2291 | OSPF_SPF_HOLDTIME_DEFAULT, |
| 2292 | OSPF_SPF_MAX_HOLDTIME_DEFAULT); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2293 | } |
| 2294 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2295 | ALIAS_DEPRECATED (no_ospf_timers_throttle_spf, |
| 2296 | no_ospf_timers_spf_cmd, |
| 2297 | "no timers spf", |
| 2298 | NO_STR |
| 2299 | "Adjust routing timers\n" |
| 2300 | "OSPF SPF timers\n") |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2301 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2302 | DEFUN (ospf_neighbor, |
| 2303 | ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2304 | "neighbor A.B.C.D", |
| 2305 | NEIGHBOR_STR |
| 2306 | "Neighbor IP address\n") |
| 2307 | { |
| 2308 | struct ospf *ospf = vty->index; |
| 2309 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2310 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2311 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2312 | |
| 2313 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2314 | |
| 2315 | if (argc > 1) |
| 2316 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[1], 0, 255); |
| 2317 | |
| 2318 | if (argc > 2) |
| 2319 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[2], 1, 65535); |
| 2320 | |
| 2321 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2322 | if (argc > 1) |
| 2323 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2324 | if (argc > 2) |
Andrew Certain | 1a61ad1 | 2012-12-04 12:50:23 -0800 | [diff] [blame^] | 2325 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2326 | |
| 2327 | return CMD_SUCCESS; |
| 2328 | } |
| 2329 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2330 | ALIAS (ospf_neighbor, |
| 2331 | ospf_neighbor_priority_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2332 | "neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2333 | NEIGHBOR_STR |
| 2334 | "Neighbor IP address\n" |
| 2335 | "Neighbor Priority\n" |
| 2336 | "Priority\n" |
| 2337 | "Dead Neighbor Polling interval\n" |
| 2338 | "Seconds\n") |
| 2339 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2340 | ALIAS (ospf_neighbor, |
| 2341 | ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2342 | "neighbor A.B.C.D priority <0-255>", |
| 2343 | NEIGHBOR_STR |
| 2344 | "Neighbor IP address\n" |
| 2345 | "Neighbor Priority\n" |
| 2346 | "Seconds\n") |
| 2347 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2348 | DEFUN (ospf_neighbor_poll_interval, |
| 2349 | ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2350 | "neighbor A.B.C.D poll-interval <1-65535>", |
| 2351 | NEIGHBOR_STR |
| 2352 | "Neighbor IP address\n" |
| 2353 | "Dead Neighbor Polling interval\n" |
| 2354 | "Seconds\n") |
| 2355 | { |
| 2356 | struct ospf *ospf = vty->index; |
| 2357 | struct in_addr nbr_addr; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2358 | unsigned int priority = OSPF_NEIGHBOR_PRIORITY_DEFAULT; |
| 2359 | unsigned int interval = OSPF_POLL_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2360 | |
| 2361 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2362 | |
| 2363 | if (argc > 1) |
| 2364 | VTY_GET_INTEGER_RANGE ("poll interval", interval, argv[1], 1, 65535); |
| 2365 | |
| 2366 | if (argc > 2) |
| 2367 | VTY_GET_INTEGER_RANGE ("neighbor priority", priority, argv[2], 0, 255); |
| 2368 | |
| 2369 | ospf_nbr_nbma_set (ospf, nbr_addr); |
| 2370 | if (argc > 1) |
| 2371 | ospf_nbr_nbma_poll_interval_set (ospf, nbr_addr, interval); |
| 2372 | if (argc > 2) |
| 2373 | ospf_nbr_nbma_priority_set (ospf, nbr_addr, priority); |
| 2374 | |
| 2375 | return CMD_SUCCESS; |
| 2376 | } |
| 2377 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2378 | ALIAS (ospf_neighbor_poll_interval, |
| 2379 | ospf_neighbor_poll_interval_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2380 | "neighbor A.B.C.D poll-interval <1-65535> priority <0-255>", |
| 2381 | NEIGHBOR_STR |
| 2382 | "Neighbor address\n" |
| 2383 | "OSPF dead-router polling interval\n" |
| 2384 | "Seconds\n" |
| 2385 | "OSPF priority of non-broadcast neighbor\n" |
| 2386 | "Priority\n") |
| 2387 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2388 | DEFUN (no_ospf_neighbor, |
| 2389 | no_ospf_neighbor_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2390 | "no neighbor A.B.C.D", |
| 2391 | NO_STR |
| 2392 | NEIGHBOR_STR |
| 2393 | "Neighbor IP address\n") |
| 2394 | { |
| 2395 | struct ospf *ospf = vty->index; |
| 2396 | struct in_addr nbr_addr; |
| 2397 | int ret; |
| 2398 | |
| 2399 | VTY_GET_IPV4_ADDRESS ("neighbor address", nbr_addr, argv[0]); |
| 2400 | |
| 2401 | ret = ospf_nbr_nbma_unset (ospf, nbr_addr); |
| 2402 | |
| 2403 | return CMD_SUCCESS; |
| 2404 | } |
| 2405 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2406 | ALIAS (no_ospf_neighbor, |
| 2407 | no_ospf_neighbor_priority_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2408 | "no neighbor A.B.C.D priority <0-255>", |
| 2409 | NO_STR |
| 2410 | NEIGHBOR_STR |
| 2411 | "Neighbor IP address\n" |
| 2412 | "Neighbor Priority\n" |
| 2413 | "Priority\n") |
| 2414 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2415 | ALIAS (no_ospf_neighbor, |
| 2416 | no_ospf_neighbor_poll_interval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2417 | "no neighbor A.B.C.D poll-interval <1-65535>", |
| 2418 | NO_STR |
| 2419 | NEIGHBOR_STR |
| 2420 | "Neighbor IP address\n" |
| 2421 | "Dead Neighbor Polling interval\n" |
| 2422 | "Seconds\n") |
| 2423 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2424 | ALIAS (no_ospf_neighbor, |
| 2425 | no_ospf_neighbor_priority_pollinterval_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2426 | "no neighbor A.B.C.D priority <0-255> poll-interval <1-65535>", |
| 2427 | NO_STR |
| 2428 | NEIGHBOR_STR |
| 2429 | "Neighbor IP address\n" |
| 2430 | "Neighbor Priority\n" |
| 2431 | "Priority\n" |
| 2432 | "Dead Neighbor Polling interval\n" |
| 2433 | "Seconds\n") |
| 2434 | |
| 2435 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2436 | DEFUN (ospf_refresh_timer, ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2437 | "refresh timer <10-1800>", |
| 2438 | "Adjust refresh parameters\n" |
| 2439 | "Set refresh timer\n" |
| 2440 | "Timer value in seconds\n") |
| 2441 | { |
| 2442 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2443 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2444 | |
| 2445 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2446 | interval = (interval / 10) * 10; |
| 2447 | |
| 2448 | ospf_timers_refresh_set (ospf, interval); |
| 2449 | |
| 2450 | return CMD_SUCCESS; |
| 2451 | } |
| 2452 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2453 | DEFUN (no_ospf_refresh_timer, no_ospf_refresh_timer_val_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2454 | "no refresh timer <10-1800>", |
| 2455 | "Adjust refresh parameters\n" |
| 2456 | "Unset refresh timer\n" |
| 2457 | "Timer value in seconds\n") |
| 2458 | { |
| 2459 | struct ospf *ospf = vty->index; |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2460 | unsigned int interval; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2461 | |
| 2462 | if (argc == 1) |
| 2463 | { |
| 2464 | VTY_GET_INTEGER_RANGE ("refresh timer", interval, argv[0], 10, 1800); |
| 2465 | |
| 2466 | if (ospf->lsa_refresh_interval != interval || |
| 2467 | interval == OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
| 2468 | return CMD_SUCCESS; |
| 2469 | } |
| 2470 | |
| 2471 | ospf_timers_refresh_unset (ospf); |
| 2472 | |
| 2473 | return CMD_SUCCESS; |
| 2474 | } |
| 2475 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2476 | ALIAS (no_ospf_refresh_timer, |
| 2477 | no_ospf_refresh_timer_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2478 | "no refresh timer", |
| 2479 | "Adjust refresh parameters\n" |
| 2480 | "Unset refresh timer\n") |
| 2481 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2482 | DEFUN (ospf_auto_cost_reference_bandwidth, |
| 2483 | ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2484 | "auto-cost reference-bandwidth <1-4294967>", |
| 2485 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2486 | "Use reference bandwidth method to assign OSPF cost\n" |
| 2487 | "The reference bandwidth in terms of Mbits per second\n") |
| 2488 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2489 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2490 | u_int32_t refbw; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2491 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2492 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2493 | |
| 2494 | refbw = strtol (argv[0], NULL, 10); |
| 2495 | if (refbw < 1 || refbw > 4294967) |
| 2496 | { |
| 2497 | vty_out (vty, "reference-bandwidth value is invalid%s", VTY_NEWLINE); |
| 2498 | return CMD_WARNING; |
| 2499 | } |
| 2500 | |
| 2501 | /* If reference bandwidth is changed. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2502 | if ((refbw * 1000) == ospf->ref_bandwidth) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2503 | return CMD_SUCCESS; |
| 2504 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2505 | ospf->ref_bandwidth = refbw * 1000; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2506 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
| 2507 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2508 | |
| 2509 | return CMD_SUCCESS; |
| 2510 | } |
| 2511 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 2512 | DEFUN (no_ospf_auto_cost_reference_bandwidth, |
| 2513 | no_ospf_auto_cost_reference_bandwidth_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2514 | "no auto-cost reference-bandwidth", |
| 2515 | NO_STR |
| 2516 | "Calculate OSPF interface cost according to bandwidth\n" |
| 2517 | "Use reference bandwidth method to assign OSPF cost\n") |
| 2518 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2519 | struct ospf *ospf = vty->index; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2520 | struct listnode *node, *nnode; |
| 2521 | struct interface *ifp; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2522 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2523 | if (ospf->ref_bandwidth == OSPF_DEFAULT_REF_BANDWIDTH) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2524 | return CMD_SUCCESS; |
| 2525 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2526 | ospf->ref_bandwidth = OSPF_DEFAULT_REF_BANDWIDTH; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2527 | vty_out (vty, "%% OSPF: Reference bandwidth is changed.%s", VTY_NEWLINE); |
| 2528 | vty_out (vty, " Please ensure reference bandwidth is consistent across all routers%s", VTY_NEWLINE); |
| 2529 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2530 | for (ALL_LIST_ELEMENTS (om->iflist, node, nnode, ifp)) |
| 2531 | ospf_if_recalculate_output_cost (ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2532 | |
| 2533 | return CMD_SUCCESS; |
| 2534 | } |
| 2535 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2536 | const char *ospf_abr_type_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2537 | { |
| 2538 | "Unknown", |
| 2539 | "Standard (RFC2328)", |
| 2540 | "Alternative IBM", |
| 2541 | "Alternative Cisco", |
| 2542 | "Alternative Shortcut" |
| 2543 | }; |
| 2544 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 2545 | const char *ospf_shortcut_mode_descr_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2546 | { |
| 2547 | "Default", |
| 2548 | "Enabled", |
| 2549 | "Disabled" |
| 2550 | }; |
| 2551 | |
| 2552 | |
| 2553 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 2554 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2555 | show_ip_ospf_area (struct vty *vty, struct ospf_area *area) |
| 2556 | { |
| 2557 | /* Show Area ID. */ |
| 2558 | vty_out (vty, " Area ID: %s", inet_ntoa (area->area_id)); |
| 2559 | |
| 2560 | /* Show Area type/mode. */ |
| 2561 | if (OSPF_IS_AREA_BACKBONE (area)) |
| 2562 | vty_out (vty, " (Backbone)%s", VTY_NEWLINE); |
| 2563 | else |
| 2564 | { |
| 2565 | if (area->external_routing == OSPF_AREA_STUB) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2566 | vty_out (vty, " (Stub%s%s)", |
| 2567 | area->no_summary ? ", no summary" : "", |
| 2568 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2569 | |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2570 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 2571 | vty_out (vty, " (NSSA%s%s)", |
| 2572 | area->no_summary ? ", no summary" : "", |
| 2573 | area->shortcut_configured ? "; " : ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2574 | |
| 2575 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2576 | vty_out (vty, " Shortcutting mode: %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2577 | ospf_shortcut_mode_descr_str[area->shortcut_configured]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2578 | vty_out (vty, ", S-bit consensus: %s%s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2579 | area->shortcut_capability ? "ok" : "no", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2580 | } |
| 2581 | |
| 2582 | /* Show number of interfaces. */ |
| 2583 | vty_out (vty, " Number of interfaces in this area: Total: %d, " |
| 2584 | "Active: %d%s", listcount (area->oiflist), |
| 2585 | area->act_ints, VTY_NEWLINE); |
| 2586 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2587 | if (area->external_routing == OSPF_AREA_NSSA) |
| 2588 | { |
| 2589 | 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] | 2590 | if (! IS_OSPF_ABR (area->ospf)) |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2591 | vty_out (vty, " It is not ABR, therefore not Translator. %s", |
| 2592 | VTY_NEWLINE); |
| 2593 | else if (area->NSSATranslatorState) |
| 2594 | { |
| 2595 | vty_out (vty, " We are an ABR and "); |
| 2596 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2597 | vty_out (vty, "the NSSA Elected Translator. %s", |
| 2598 | VTY_NEWLINE); |
| 2599 | else if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_ALWAYS) |
| 2600 | vty_out (vty, "always an NSSA Translator. %s", |
| 2601 | VTY_NEWLINE); |
| 2602 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2603 | else |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2604 | { |
| 2605 | vty_out (vty, " We are an ABR, but "); |
| 2606 | if (area->NSSATranslatorRole == OSPF_NSSA_ROLE_CANDIDATE) |
| 2607 | vty_out (vty, "not the NSSA Elected Translator. %s", |
| 2608 | VTY_NEWLINE); |
| 2609 | else |
hasso | c6b8781 | 2004-12-22 13:09:59 +0000 | [diff] [blame] | 2610 | vty_out (vty, "never an NSSA Translator. %s", |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2611 | VTY_NEWLINE); |
| 2612 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2613 | } |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2614 | /* Stub-router state for this area */ |
| 2615 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
| 2616 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2617 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2618 | vty_out (vty, " Originating stub / maximum-distance Router-LSA%s", |
| 2619 | VTY_NEWLINE); |
| 2620 | if (CHECK_FLAG(area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 2621 | vty_out (vty, " Administratively activated (indefinitely)%s", |
| 2622 | VTY_NEWLINE); |
| 2623 | if (area->t_stub_router) |
| 2624 | vty_out (vty, " Active from startup, %s remaining%s", |
| 2625 | ospf_timer_dump (area->t_stub_router, timebuf, |
| 2626 | sizeof(timebuf)), VTY_NEWLINE); |
| 2627 | } |
| 2628 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2629 | /* Show number of fully adjacent neighbors. */ |
| 2630 | vty_out (vty, " Number of fully adjacent neighbors in this area:" |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 2631 | " %d%s", area->full_nbrs, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2632 | |
| 2633 | /* Show authentication type. */ |
| 2634 | vty_out (vty, " Area has "); |
| 2635 | if (area->auth_type == OSPF_AUTH_NULL) |
| 2636 | vty_out (vty, "no authentication%s", VTY_NEWLINE); |
| 2637 | else if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 2638 | vty_out (vty, "simple password authentication%s", VTY_NEWLINE); |
| 2639 | else if (area->auth_type == OSPF_AUTH_CRYPTOGRAPHIC) |
| 2640 | vty_out (vty, "message digest authentication%s", VTY_NEWLINE); |
| 2641 | |
| 2642 | if (!OSPF_IS_AREA_BACKBONE (area)) |
| 2643 | vty_out (vty, " Number of full virtual adjacencies going through" |
| 2644 | " this area: %d%s", area->full_vls, VTY_NEWLINE); |
| 2645 | |
| 2646 | /* Show SPF calculation times. */ |
| 2647 | vty_out (vty, " SPF algorithm executed %d times%s", |
| 2648 | area->spf_calculation, VTY_NEWLINE); |
| 2649 | |
| 2650 | /* Show number of LSA. */ |
| 2651 | vty_out (vty, " Number of LSA %ld%s", area->lsdb->total, VTY_NEWLINE); |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2652 | vty_out (vty, " Number of router LSA %ld. Checksum Sum 0x%08x%s", |
| 2653 | ospf_lsdb_count (area->lsdb, OSPF_ROUTER_LSA), |
| 2654 | ospf_lsdb_checksum (area->lsdb, OSPF_ROUTER_LSA), VTY_NEWLINE); |
| 2655 | vty_out (vty, " Number of network LSA %ld. Checksum Sum 0x%08x%s", |
| 2656 | ospf_lsdb_count (area->lsdb, OSPF_NETWORK_LSA), |
| 2657 | ospf_lsdb_checksum (area->lsdb, OSPF_NETWORK_LSA), VTY_NEWLINE); |
| 2658 | vty_out (vty, " Number of summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2659 | ospf_lsdb_count (area->lsdb, OSPF_SUMMARY_LSA), |
| 2660 | ospf_lsdb_checksum (area->lsdb, OSPF_SUMMARY_LSA), VTY_NEWLINE); |
| 2661 | vty_out (vty, " Number of ASBR summary LSA %ld. Checksum Sum 0x%08x%s", |
| 2662 | ospf_lsdb_count (area->lsdb, OSPF_ASBR_SUMMARY_LSA), |
| 2663 | ospf_lsdb_checksum (area->lsdb, OSPF_ASBR_SUMMARY_LSA), VTY_NEWLINE); |
| 2664 | vty_out (vty, " Number of NSSA LSA %ld. Checksum Sum 0x%08x%s", |
| 2665 | ospf_lsdb_count (area->lsdb, OSPF_AS_NSSA_LSA), |
| 2666 | ospf_lsdb_checksum (area->lsdb, OSPF_AS_NSSA_LSA), VTY_NEWLINE); |
| 2667 | #ifdef HAVE_OPAQUE_LSA |
| 2668 | vty_out (vty, " Number of opaque link LSA %ld. Checksum Sum 0x%08x%s", |
| 2669 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_LINK_LSA), |
| 2670 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_LINK_LSA), VTY_NEWLINE); |
| 2671 | vty_out (vty, " Number of opaque area LSA %ld. Checksum Sum 0x%08x%s", |
| 2672 | ospf_lsdb_count (area->lsdb, OSPF_OPAQUE_AREA_LSA), |
| 2673 | ospf_lsdb_checksum (area->lsdb, OSPF_OPAQUE_AREA_LSA), VTY_NEWLINE); |
| 2674 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2675 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2676 | } |
| 2677 | |
| 2678 | DEFUN (show_ip_ospf, |
| 2679 | show_ip_ospf_cmd, |
| 2680 | "show ip ospf", |
| 2681 | SHOW_STR |
| 2682 | IP_STR |
| 2683 | "OSPF information\n") |
| 2684 | { |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2685 | struct listnode *node, *nnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2686 | struct ospf_area * area; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2687 | struct ospf *ospf; |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2688 | struct timeval result; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2689 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2690 | |
| 2691 | /* Check OSPF is enable. */ |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2692 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2693 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2694 | { |
| 2695 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2696 | return CMD_SUCCESS; |
| 2697 | } |
| 2698 | |
| 2699 | /* Show Router ID. */ |
| 2700 | vty_out (vty, " OSPF Routing Process, Router ID: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2701 | inet_ntoa (ospf->router_id), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2702 | VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2703 | |
| 2704 | /* Graceful shutdown */ |
paul | c9c93d5 | 2005-11-26 13:31:11 +0000 | [diff] [blame] | 2705 | if (ospf->t_deferred_shutdown) |
| 2706 | vty_out (vty, " Deferred shutdown in progress, %s remaining%s", |
| 2707 | ospf_timer_dump (ospf->t_deferred_shutdown, |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2708 | timebuf, sizeof (timebuf)), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2709 | /* Show capability. */ |
| 2710 | vty_out (vty, " Supports only single TOS (TOS0) routes%s", VTY_NEWLINE); |
| 2711 | vty_out (vty, " This implementation conforms to RFC2328%s", VTY_NEWLINE); |
| 2712 | vty_out (vty, " RFC1583Compatibility flag is %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2713 | CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2714 | "enabled" : "disabled", VTY_NEWLINE); |
| 2715 | #ifdef HAVE_OPAQUE_LSA |
| 2716 | vty_out (vty, " OpaqueCapability flag is %s%s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2717 | CHECK_FLAG (ospf->config, OSPF_OPAQUE_CAPABLE) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2718 | "enabled" : "disabled", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2719 | IS_OPAQUE_LSA_ORIGINATION_BLOCKED (ospf->opaque) ? |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2720 | " (origination blocked)" : "", |
| 2721 | VTY_NEWLINE); |
| 2722 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 2723 | |
| 2724 | /* Show stub-router configuration */ |
| 2725 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED |
| 2726 | || ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2727 | { |
| 2728 | vty_out (vty, " Stub router advertisement is configured%s", |
| 2729 | VTY_NEWLINE); |
| 2730 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2731 | vty_out (vty, " Enabled for %us after start-up%s", |
| 2732 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 2733 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 2734 | vty_out (vty, " Enabled for %us prior to full shutdown%s", |
| 2735 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 2736 | } |
| 2737 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2738 | /* Show SPF timers. */ |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2739 | vty_out (vty, " Initial SPF scheduling delay %d millisec(s)%s" |
| 2740 | " Minimum hold time between consecutive SPFs %d millisec(s)%s" |
| 2741 | " Maximum hold time between consecutive SPFs %d millisec(s)%s" |
| 2742 | " Hold time multiplier is currently %d%s", |
| 2743 | ospf->spf_delay, VTY_NEWLINE, |
| 2744 | ospf->spf_holdtime, VTY_NEWLINE, |
| 2745 | ospf->spf_max_holdtime, VTY_NEWLINE, |
| 2746 | ospf->spf_hold_multiplier, VTY_NEWLINE); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2747 | vty_out (vty, " SPF algorithm "); |
| 2748 | if (ospf->ts_spf.tv_sec || ospf->ts_spf.tv_usec) |
| 2749 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 2750 | result = tv_sub (recent_relative_time (), ospf->ts_spf); |
paul | b8ad39d | 2005-10-23 15:23:05 +0000 | [diff] [blame] | 2751 | vty_out (vty, "last executed %s ago%s", |
| 2752 | ospf_timeval_dump (&result, timebuf, sizeof (timebuf)), |
| 2753 | VTY_NEWLINE); |
| 2754 | } |
| 2755 | else |
| 2756 | vty_out (vty, "has not been run%s", VTY_NEWLINE); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 2757 | vty_out (vty, " SPF timer %s%s%s", |
| 2758 | (ospf->t_spf_calc ? "due in " : "is "), |
| 2759 | ospf_timer_dump (ospf->t_spf_calc, timebuf, sizeof (timebuf)), |
| 2760 | VTY_NEWLINE); |
| 2761 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2762 | /* Show refresh parameters. */ |
| 2763 | vty_out (vty, " Refresh timer %d secs%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2764 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2765 | |
| 2766 | /* Show ABR/ASBR flags. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2767 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ABR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2768 | vty_out (vty, " This router is an ABR, ABR type is: %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2769 | ospf_abr_type_descr_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2770 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2771 | if (CHECK_FLAG (ospf->flags, OSPF_FLAG_ASBR)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2772 | vty_out (vty, " This router is an ASBR " |
| 2773 | "(injecting external routing information)%s", VTY_NEWLINE); |
| 2774 | |
| 2775 | /* Show Number of AS-external-LSAs. */ |
hasso | fe71a97 | 2004-12-22 16:16:02 +0000 | [diff] [blame] | 2776 | vty_out (vty, " Number of external LSA %ld. Checksum Sum 0x%08x%s", |
| 2777 | ospf_lsdb_count (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), |
| 2778 | ospf_lsdb_checksum (ospf->lsdb, OSPF_AS_EXTERNAL_LSA), VTY_NEWLINE); |
| 2779 | #ifdef HAVE_OPAQUE_LSA |
| 2780 | vty_out (vty, " Number of opaque AS LSA %ld. Checksum Sum 0x%08x%s", |
| 2781 | ospf_lsdb_count (ospf->lsdb, OSPF_OPAQUE_AS_LSA), |
| 2782 | ospf_lsdb_checksum (ospf->lsdb, OSPF_OPAQUE_AS_LSA), VTY_NEWLINE); |
| 2783 | #endif /* HAVE_OPAQUE_LSA */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2784 | /* Show number of areas attached. */ |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 2785 | vty_out (vty, " Number of areas attached to this router: %d%s", |
| 2786 | listcount (ospf->areas), VTY_NEWLINE); |
| 2787 | |
| 2788 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 2789 | { |
| 2790 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 2791 | vty_out(vty, " All adjacency changes are logged%s",VTY_NEWLINE); |
| 2792 | else |
| 2793 | vty_out(vty, " Adjacency changes are logged%s",VTY_NEWLINE); |
| 2794 | } |
| 2795 | |
| 2796 | vty_out (vty, "%s",VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2797 | |
| 2798 | /* Show each area status. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2799 | for (ALL_LIST_ELEMENTS (ospf->areas, node, nnode, area)) |
| 2800 | show_ip_ospf_area (vty, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2801 | |
| 2802 | return CMD_SUCCESS; |
| 2803 | } |
| 2804 | |
| 2805 | |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2806 | static void |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2807 | show_ip_ospf_interface_sub (struct vty *vty, struct ospf *ospf, |
| 2808 | struct interface *ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2809 | { |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2810 | int is_up; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2811 | struct ospf_neighbor *nbr; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2812 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2813 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2814 | /* Is interface up? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2815 | vty_out (vty, "%s is %s%s", ifp->name, |
| 2816 | ((is_up = if_is_operative(ifp)) ? "up" : "down"), VTY_NEWLINE); |
ajs | d2fc889 | 2005-04-02 18:38:43 +0000 | [diff] [blame] | 2817 | vty_out (vty, " ifindex %u, MTU %u bytes, BW %u Kbit %s%s", |
| 2818 | ifp->ifindex, ifp->mtu, ifp->bandwidth, if_flag_dump(ifp->flags), |
| 2819 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2820 | |
| 2821 | /* Is interface OSPF enabled? */ |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2822 | if (ospf_oi_count(ifp) == 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2823 | { |
| 2824 | vty_out (vty, " OSPF not enabled on this interface%s", VTY_NEWLINE); |
| 2825 | return; |
| 2826 | } |
ajs | fd651fa | 2005-03-29 16:08:16 +0000 | [diff] [blame] | 2827 | else if (!is_up) |
| 2828 | { |
| 2829 | vty_out (vty, " OSPF is enabled, but not running on this interface%s", |
| 2830 | VTY_NEWLINE); |
| 2831 | return; |
| 2832 | } |
| 2833 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2834 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 2835 | { |
| 2836 | struct ospf_interface *oi = rn->info; |
| 2837 | |
| 2838 | if (oi == NULL) |
| 2839 | continue; |
| 2840 | |
| 2841 | /* Show OSPF interface information. */ |
| 2842 | vty_out (vty, " Internet Address %s/%d,", |
| 2843 | inet_ntoa (oi->address->u.prefix4), oi->address->prefixlen); |
| 2844 | |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 2845 | if (oi->connected->destination || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
| 2846 | { |
| 2847 | struct in_addr *dest; |
| 2848 | const char *dstr; |
| 2849 | |
Andrew J. Schorr | e452963 | 2006-12-12 19:18:21 +0000 | [diff] [blame] | 2850 | if (CONNECTED_PEER(oi->connected) |
| 2851 | || oi->type == OSPF_IFTYPE_VIRTUALLINK) |
Paul Jakma | 9c27ef9 | 2006-05-04 07:32:57 +0000 | [diff] [blame] | 2852 | dstr = "Peer"; |
| 2853 | else |
| 2854 | dstr = "Broadcast"; |
| 2855 | |
| 2856 | /* For Vlinks, showing the peer address is probably more |
| 2857 | * informative than the local interface that is being used |
| 2858 | */ |
| 2859 | if (oi->type == OSPF_IFTYPE_VIRTUALLINK) |
| 2860 | dest = &oi->vl_data->peer_addr; |
| 2861 | else |
| 2862 | dest = &oi->connected->destination->u.prefix4; |
| 2863 | |
| 2864 | vty_out (vty, " %s %s,", dstr, inet_ntoa (*dest)); |
| 2865 | } |
hasso | 3fb9cd6 | 2004-10-19 19:44:43 +0000 | [diff] [blame] | 2866 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2867 | vty_out (vty, " Area %s%s", ospf_area_desc_string (oi->area), |
| 2868 | VTY_NEWLINE); |
| 2869 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 2870 | vty_out (vty, " MTU mismatch detection:%s%s", |
| 2871 | OSPF_IF_PARAM(oi, mtu_ignore) ? "disabled" : "enabled", VTY_NEWLINE); |
| 2872 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2873 | vty_out (vty, " Router ID %s, Network Type %s, Cost: %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2874 | inet_ntoa (ospf->router_id), ospf_network_type_str[oi->type], |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2875 | oi->output_cost, VTY_NEWLINE); |
| 2876 | |
| 2877 | vty_out (vty, " Transmit Delay is %d sec, State %s, Priority %d%s", |
| 2878 | OSPF_IF_PARAM (oi,transmit_delay), LOOKUP (ospf_ism_state_msg, oi->state), |
| 2879 | PRIORITY (oi), VTY_NEWLINE); |
| 2880 | |
| 2881 | /* Show DR information. */ |
| 2882 | if (DR (oi).s_addr == 0) |
| 2883 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2884 | else |
| 2885 | { |
| 2886 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &DR (oi)); |
| 2887 | if (nbr == NULL) |
| 2888 | vty_out (vty, " No designated router on this network%s", VTY_NEWLINE); |
| 2889 | else |
| 2890 | { |
| 2891 | vty_out (vty, " Designated Router (ID) %s,", |
| 2892 | inet_ntoa (nbr->router_id)); |
| 2893 | vty_out (vty, " Interface Address %s%s", |
| 2894 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2895 | } |
| 2896 | } |
| 2897 | |
| 2898 | /* Show BDR information. */ |
| 2899 | if (BDR (oi).s_addr == 0) |
| 2900 | vty_out (vty, " No backup designated router on this network%s", |
| 2901 | VTY_NEWLINE); |
| 2902 | else |
| 2903 | { |
| 2904 | nbr = ospf_nbr_lookup_by_addr (oi->nbrs, &BDR (oi)); |
| 2905 | if (nbr == NULL) |
| 2906 | vty_out (vty, " No backup designated router on this network%s", |
| 2907 | VTY_NEWLINE); |
| 2908 | else |
| 2909 | { |
| 2910 | vty_out (vty, " Backup Designated Router (ID) %s,", |
| 2911 | inet_ntoa (nbr->router_id)); |
| 2912 | vty_out (vty, " Interface Address %s%s", |
| 2913 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 2914 | } |
| 2915 | } |
Paul Jakma | 7eb5b47 | 2009-10-13 16:13:13 +0100 | [diff] [blame] | 2916 | |
| 2917 | /* Next network-LSA sequence number we'll use, if we're elected DR */ |
| 2918 | if (oi->params && ntohl (oi->params->network_lsa_seqnum) |
| 2919 | != OSPF_INITIAL_SEQUENCE_NUMBER) |
| 2920 | vty_out (vty, " Saved Network-LSA sequence number 0x%x%s", |
| 2921 | ntohl (oi->params->network_lsa_seqnum), VTY_NEWLINE); |
| 2922 | |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2923 | vty_out (vty, " Multicast group memberships:"); |
Paul Jakma | 429ac78 | 2006-06-15 18:40:49 +0000 | [diff] [blame] | 2924 | if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS) |
| 2925 | || OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) |
| 2926 | { |
| 2927 | if (OI_MEMBER_CHECK(oi, MEMBER_ALLROUTERS)) |
| 2928 | vty_out (vty, " OSPFAllRouters"); |
| 2929 | if (OI_MEMBER_CHECK(oi, MEMBER_DROUTERS)) |
| 2930 | vty_out (vty, " OSPFDesignatedRouters"); |
| 2931 | } |
| 2932 | else |
ajs | ba6454e | 2005-02-08 15:37:30 +0000 | [diff] [blame] | 2933 | vty_out (vty, " <None>"); |
| 2934 | vty_out (vty, "%s", VTY_NEWLINE); |
| 2935 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2936 | vty_out (vty, " Timer intervals configured,"); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2937 | vty_out (vty, " Hello "); |
| 2938 | if (OSPF_IF_PARAM (oi, fast_hello) == 0) |
| 2939 | vty_out (vty, "%ds,", OSPF_IF_PARAM (oi, v_hello)); |
| 2940 | else |
| 2941 | vty_out (vty, "%dms,", 1000 / OSPF_IF_PARAM (oi, fast_hello)); |
| 2942 | vty_out (vty, " Dead %ds, Wait %ds, Retransmit %d%s", |
| 2943 | OSPF_IF_PARAM (oi, v_wait), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2944 | OSPF_IF_PARAM (oi, v_wait), |
| 2945 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 2946 | VTY_NEWLINE); |
| 2947 | |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 2948 | if (OSPF_IF_PASSIVE_STATUS (oi) == OSPF_IF_ACTIVE) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2949 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2950 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2951 | vty_out (vty, " Hello due in %s%s", |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 2952 | ospf_timer_dump (oi->t_hello, timebuf, sizeof(timebuf)), |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 2953 | VTY_NEWLINE); |
| 2954 | } |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 2955 | else /* passive-interface is set */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2956 | vty_out (vty, " No Hellos (Passive interface)%s", VTY_NEWLINE); |
| 2957 | |
| 2958 | vty_out (vty, " Neighbor Count is %d, Adjacent neighbor count is %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2959 | ospf_nbr_count (oi, 0), ospf_nbr_count (oi, NSM_Full), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2960 | VTY_NEWLINE); |
| 2961 | } |
| 2962 | } |
| 2963 | |
| 2964 | DEFUN (show_ip_ospf_interface, |
| 2965 | show_ip_ospf_interface_cmd, |
| 2966 | "show ip ospf interface [INTERFACE]", |
| 2967 | SHOW_STR |
| 2968 | IP_STR |
| 2969 | "OSPF information\n" |
| 2970 | "Interface information\n" |
| 2971 | "Interface name\n") |
| 2972 | { |
| 2973 | struct interface *ifp; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2974 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 2975 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2976 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2977 | ospf = ospf_lookup (); |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 2978 | if (ospf == NULL) |
| 2979 | { |
| 2980 | vty_out (vty, "OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 2981 | return CMD_SUCCESS; |
| 2982 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 2983 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2984 | /* Show All Interfaces. */ |
| 2985 | if (argc == 0) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 2986 | for (ALL_LIST_ELEMENTS_RO (iflist, node, ifp)) |
| 2987 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2988 | /* Interface name is specified. */ |
| 2989 | else |
| 2990 | { |
| 2991 | if ((ifp = if_lookup_by_name (argv[0])) == NULL) |
| 2992 | vty_out (vty, "No such interface name%s", VTY_NEWLINE); |
| 2993 | else |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 2994 | show_ip_ospf_interface_sub (vty, ospf, ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 2995 | } |
| 2996 | |
| 2997 | return CMD_SUCCESS; |
| 2998 | } |
| 2999 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3000 | static void |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3001 | show_ip_ospf_neighbour_header (struct vty *vty) |
| 3002 | { |
| 3003 | vty_out (vty, "%s%15s %3s %-15s %9s %-15s %-20s %5s %5s %5s%s", |
| 3004 | VTY_NEWLINE, |
| 3005 | "Neighbor ID", "Pri", "State", "Dead Time", |
| 3006 | "Address", "Interface", "RXmtL", "RqstL", "DBsmL", |
| 3007 | VTY_NEWLINE); |
| 3008 | } |
| 3009 | |
| 3010 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3011 | show_ip_ospf_neighbor_sub (struct vty *vty, struct ospf_interface *oi) |
| 3012 | { |
| 3013 | struct route_node *rn; |
| 3014 | struct ospf_neighbor *nbr; |
| 3015 | char msgbuf[16]; |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3016 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3017 | |
| 3018 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3019 | if ((nbr = rn->info)) |
| 3020 | /* Do not show myself. */ |
| 3021 | if (nbr != oi->nbr_self) |
| 3022 | /* Down state is not shown. */ |
| 3023 | if (nbr->state != NSM_Down) |
| 3024 | { |
| 3025 | ospf_nbr_state_message (nbr, msgbuf, 16); |
| 3026 | |
| 3027 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3028 | vty_out (vty, "%-15s %3d %-15s ", |
| 3029 | "-", nbr->priority, |
| 3030 | msgbuf); |
| 3031 | else |
| 3032 | vty_out (vty, "%-15s %3d %-15s ", |
| 3033 | inet_ntoa (nbr->router_id), nbr->priority, |
| 3034 | msgbuf); |
| 3035 | |
| 3036 | vty_out (vty, "%9s ", |
| 3037 | ospf_timer_dump (nbr->t_inactivity, timebuf, |
| 3038 | sizeof(timebuf))); |
| 3039 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3040 | vty_out (vty, "%-15s ", inet_ntoa (nbr->src)); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3041 | vty_out (vty, "%-20s %5ld %5ld %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3042 | IF_NAME (oi), ospf_ls_retransmit_count (nbr), |
| 3043 | ospf_ls_request_count (nbr), ospf_db_summary_count (nbr), |
| 3044 | VTY_NEWLINE); |
| 3045 | } |
| 3046 | } |
| 3047 | |
| 3048 | DEFUN (show_ip_ospf_neighbor, |
| 3049 | show_ip_ospf_neighbor_cmd, |
| 3050 | "show ip ospf neighbor", |
| 3051 | SHOW_STR |
| 3052 | IP_STR |
| 3053 | "OSPF information\n" |
| 3054 | "Neighbor list\n") |
| 3055 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3056 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3057 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3058 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3059 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3060 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3061 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3062 | { |
| 3063 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3064 | return CMD_SUCCESS; |
| 3065 | } |
| 3066 | |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3067 | show_ip_ospf_neighbour_header (vty); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3068 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3069 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3070 | show_ip_ospf_neighbor_sub (vty, oi); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3071 | |
| 3072 | return CMD_SUCCESS; |
| 3073 | } |
| 3074 | |
| 3075 | DEFUN (show_ip_ospf_neighbor_all, |
| 3076 | show_ip_ospf_neighbor_all_cmd, |
| 3077 | "show ip ospf neighbor all", |
| 3078 | SHOW_STR |
| 3079 | IP_STR |
| 3080 | "OSPF information\n" |
| 3081 | "Neighbor list\n" |
| 3082 | "include down status neighbor\n") |
| 3083 | { |
Joakim Tjernlund | 35f8914 | 2008-07-01 16:54:07 +0200 | [diff] [blame] | 3084 | struct ospf *ospf = ospf_lookup (); |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3085 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3086 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3087 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3088 | if (ospf == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3089 | { |
| 3090 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3091 | return CMD_SUCCESS; |
| 3092 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3093 | |
| 3094 | show_ip_ospf_neighbour_header (vty); |
| 3095 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3096 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3097 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3098 | struct listnode *nbr_node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3099 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3100 | |
| 3101 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3102 | |
| 3103 | /* print Down neighbor status */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3104 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nbr_node, nbr_nbma)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3105 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3106 | if (nbr_nbma->nbr == NULL |
| 3107 | || nbr_nbma->nbr->state == NSM_Down) |
| 3108 | { |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3109 | vty_out (vty, "%-15s %3d %-15s %9s ", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3110 | "-", nbr_nbma->priority, "Down", "-"); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3111 | vty_out (vty, "%-15s %-20s %5d %5d %5d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3112 | inet_ntoa (nbr_nbma->addr), IF_NAME (oi), |
| 3113 | 0, 0, 0, VTY_NEWLINE); |
| 3114 | } |
| 3115 | } |
| 3116 | } |
| 3117 | |
| 3118 | return CMD_SUCCESS; |
| 3119 | } |
| 3120 | |
| 3121 | DEFUN (show_ip_ospf_neighbor_int, |
| 3122 | show_ip_ospf_neighbor_int_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3123 | "show ip ospf neighbor IFNAME", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3124 | SHOW_STR |
| 3125 | IP_STR |
| 3126 | "OSPF information\n" |
| 3127 | "Neighbor list\n" |
| 3128 | "Interface name\n") |
| 3129 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3130 | struct ospf *ospf; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3131 | struct interface *ifp; |
| 3132 | struct route_node *rn; |
| 3133 | |
| 3134 | ifp = if_lookup_by_name (argv[0]); |
| 3135 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3136 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3137 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3138 | return CMD_WARNING; |
| 3139 | } |
| 3140 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3141 | ospf = ospf_lookup (); |
| 3142 | if (ospf == NULL) |
| 3143 | { |
| 3144 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3145 | return CMD_SUCCESS; |
| 3146 | } |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3147 | |
| 3148 | show_ip_ospf_neighbour_header (vty); |
| 3149 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3150 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3151 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3152 | struct ospf_interface *oi = rn->info; |
| 3153 | |
| 3154 | if (oi == NULL) |
| 3155 | continue; |
| 3156 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3157 | show_ip_ospf_neighbor_sub (vty, oi); |
| 3158 | } |
| 3159 | |
| 3160 | return CMD_SUCCESS; |
| 3161 | } |
| 3162 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3163 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3164 | show_ip_ospf_nbr_nbma_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3165 | struct ospf_nbr_nbma *nbr_nbma) |
| 3166 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3167 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3168 | |
| 3169 | /* Show neighbor ID. */ |
| 3170 | vty_out (vty, " Neighbor %s,", "-"); |
| 3171 | |
| 3172 | /* Show interface address. */ |
| 3173 | vty_out (vty, " interface address %s%s", |
| 3174 | inet_ntoa (nbr_nbma->addr), VTY_NEWLINE); |
| 3175 | /* Show Area ID. */ |
| 3176 | vty_out (vty, " In the area %s via interface %s%s", |
| 3177 | ospf_area_desc_string (oi->area), IF_NAME (oi), VTY_NEWLINE); |
| 3178 | /* Show neighbor priority and state. */ |
| 3179 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3180 | nbr_nbma->priority, "Down"); |
| 3181 | /* Show state changes. */ |
| 3182 | vty_out (vty, " %d state changes%s", nbr_nbma->state_change, VTY_NEWLINE); |
| 3183 | |
| 3184 | /* Show PollInterval */ |
| 3185 | vty_out (vty, " Poll interval %d%s", nbr_nbma->v_poll, VTY_NEWLINE); |
| 3186 | |
| 3187 | /* Show poll-interval timer. */ |
| 3188 | vty_out (vty, " Poll timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3189 | ospf_timer_dump (nbr_nbma->t_poll, timebuf, sizeof(timebuf)), |
| 3190 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3191 | |
| 3192 | /* Show poll-interval timer thread. */ |
| 3193 | vty_out (vty, " Thread Poll Timer %s%s", |
| 3194 | nbr_nbma->t_poll != NULL ? "on" : "off", VTY_NEWLINE); |
| 3195 | } |
| 3196 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3197 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3198 | show_ip_ospf_neighbor_detail_sub (struct vty *vty, struct ospf_interface *oi, |
| 3199 | struct ospf_neighbor *nbr) |
| 3200 | { |
ajs | 649654a | 2005-11-16 20:17:52 +0000 | [diff] [blame] | 3201 | char timebuf[OSPF_TIME_DUMP_SIZE]; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3202 | |
| 3203 | /* Show neighbor ID. */ |
| 3204 | if (nbr->state == NSM_Attempt && nbr->router_id.s_addr == 0) |
| 3205 | vty_out (vty, " Neighbor %s,", "-"); |
| 3206 | else |
| 3207 | vty_out (vty, " Neighbor %s,", inet_ntoa (nbr->router_id)); |
| 3208 | |
| 3209 | /* Show interface address. */ |
| 3210 | vty_out (vty, " interface address %s%s", |
| 3211 | inet_ntoa (nbr->address.u.prefix4), VTY_NEWLINE); |
| 3212 | /* Show Area ID. */ |
| 3213 | vty_out (vty, " In the area %s via interface %s%s", |
| 3214 | ospf_area_desc_string (oi->area), oi->ifp->name, VTY_NEWLINE); |
| 3215 | /* Show neighbor priority and state. */ |
| 3216 | vty_out (vty, " Neighbor priority is %d, State is %s,", |
| 3217 | nbr->priority, LOOKUP (ospf_nsm_state_msg, nbr->state)); |
| 3218 | /* Show state changes. */ |
| 3219 | vty_out (vty, " %d state changes%s", nbr->state_change, VTY_NEWLINE); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3220 | 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] | 3221 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 3222 | struct timeval res |
| 3223 | = tv_sub (recent_relative_time (), nbr->ts_last_progress); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3224 | vty_out (vty, " Most recent state change statistics:%s", |
| 3225 | VTY_NEWLINE); |
| 3226 | vty_out (vty, " Progressive change %s ago%s", |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3227 | ospf_timeval_dump (&res, timebuf, sizeof(timebuf)), |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3228 | VTY_NEWLINE); |
| 3229 | } |
| 3230 | if (nbr->ts_last_regress.tv_sec || nbr->ts_last_regress.tv_usec) |
| 3231 | { |
Paul Jakma | 2518efd | 2006-08-27 06:49:29 +0000 | [diff] [blame] | 3232 | struct timeval res |
| 3233 | = tv_sub (recent_relative_time (), nbr->ts_last_regress); |
Paul Jakma | 3fed416 | 2006-07-25 20:44:12 +0000 | [diff] [blame] | 3234 | vty_out (vty, " Regressive change %s ago, due to %s%s", |
| 3235 | ospf_timeval_dump (&res, timebuf, sizeof(timebuf)), |
| 3236 | (nbr->last_regress_str ? nbr->last_regress_str : "??"), |
Paul Jakma | 90c3317 | 2006-07-11 17:57:25 +0000 | [diff] [blame] | 3237 | VTY_NEWLINE); |
| 3238 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3239 | /* Show Designated Rotuer ID. */ |
| 3240 | vty_out (vty, " DR is %s,", inet_ntoa (nbr->d_router)); |
| 3241 | /* Show Backup Designated Rotuer ID. */ |
| 3242 | vty_out (vty, " BDR is %s%s", inet_ntoa (nbr->bd_router), VTY_NEWLINE); |
| 3243 | /* Show options. */ |
| 3244 | vty_out (vty, " Options %d %s%s", nbr->options, |
| 3245 | ospf_options_dump (nbr->options), VTY_NEWLINE); |
| 3246 | /* Show Router Dead interval timer. */ |
| 3247 | vty_out (vty, " Dead timer due in %s%s", |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 3248 | ospf_timer_dump (nbr->t_inactivity, timebuf, sizeof (timebuf)), |
| 3249 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3250 | /* Show Database Summary list. */ |
| 3251 | vty_out (vty, " Database Summary List %d%s", |
| 3252 | ospf_db_summary_count (nbr), VTY_NEWLINE); |
| 3253 | /* Show Link State Request list. */ |
| 3254 | vty_out (vty, " Link State Request List %ld%s", |
| 3255 | ospf_ls_request_count (nbr), VTY_NEWLINE); |
| 3256 | /* Show Link State Retransmission list. */ |
| 3257 | vty_out (vty, " Link State Retransmission List %ld%s", |
| 3258 | ospf_ls_retransmit_count (nbr), VTY_NEWLINE); |
| 3259 | /* Show inactivity timer thread. */ |
| 3260 | vty_out (vty, " Thread Inactivity Timer %s%s", |
| 3261 | nbr->t_inactivity != NULL ? "on" : "off", VTY_NEWLINE); |
| 3262 | /* Show Database Description retransmission thread. */ |
| 3263 | vty_out (vty, " Thread Database Description Retransmision %s%s", |
| 3264 | nbr->t_db_desc != NULL ? "on" : "off", VTY_NEWLINE); |
| 3265 | /* Show Link State Request Retransmission thread. */ |
| 3266 | vty_out (vty, " Thread Link State Request Retransmission %s%s", |
| 3267 | nbr->t_ls_req != NULL ? "on" : "off", VTY_NEWLINE); |
| 3268 | /* Show Link State Update Retransmission thread. */ |
| 3269 | vty_out (vty, " Thread Link State Update Retransmission %s%s%s", |
| 3270 | nbr->t_ls_upd != NULL ? "on" : "off", VTY_NEWLINE, VTY_NEWLINE); |
| 3271 | } |
| 3272 | |
| 3273 | DEFUN (show_ip_ospf_neighbor_id, |
| 3274 | show_ip_ospf_neighbor_id_cmd, |
| 3275 | "show ip ospf neighbor A.B.C.D", |
| 3276 | SHOW_STR |
| 3277 | IP_STR |
| 3278 | "OSPF information\n" |
| 3279 | "Neighbor list\n" |
| 3280 | "Neighbor ID\n") |
| 3281 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3282 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3283 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3284 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3285 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3286 | struct in_addr router_id; |
| 3287 | int ret; |
| 3288 | |
| 3289 | ret = inet_aton (argv[0], &router_id); |
| 3290 | if (!ret) |
| 3291 | { |
| 3292 | vty_out (vty, "Please specify Neighbor ID by A.B.C.D%s", VTY_NEWLINE); |
| 3293 | return CMD_WARNING; |
| 3294 | } |
| 3295 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3296 | ospf = ospf_lookup (); |
| 3297 | if (ospf == NULL) |
| 3298 | { |
| 3299 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3300 | return CMD_SUCCESS; |
| 3301 | } |
| 3302 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3303 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
| 3304 | if ((nbr = ospf_nbr_lookup_by_routerid (oi->nbrs, &router_id))) |
Andrew J. Schorr | 1c066bf | 2006-06-30 16:53:47 +0000 | [diff] [blame] | 3305 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3306 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3307 | return CMD_SUCCESS; |
| 3308 | } |
| 3309 | |
| 3310 | DEFUN (show_ip_ospf_neighbor_detail, |
| 3311 | show_ip_ospf_neighbor_detail_cmd, |
| 3312 | "show ip ospf neighbor detail", |
| 3313 | SHOW_STR |
| 3314 | IP_STR |
| 3315 | "OSPF information\n" |
| 3316 | "Neighbor list\n" |
| 3317 | "detail of all neighbors\n") |
| 3318 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3319 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3320 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3321 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3322 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3323 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3324 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3325 | { |
| 3326 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3327 | return CMD_SUCCESS; |
| 3328 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3329 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3330 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3331 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3332 | struct route_node *rn; |
| 3333 | struct ospf_neighbor *nbr; |
| 3334 | |
| 3335 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3336 | if ((nbr = rn->info)) |
| 3337 | if (nbr != oi->nbr_self) |
| 3338 | if (nbr->state != NSM_Down) |
| 3339 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
| 3340 | } |
| 3341 | |
| 3342 | return CMD_SUCCESS; |
| 3343 | } |
| 3344 | |
| 3345 | DEFUN (show_ip_ospf_neighbor_detail_all, |
| 3346 | show_ip_ospf_neighbor_detail_all_cmd, |
| 3347 | "show ip ospf neighbor detail all", |
| 3348 | SHOW_STR |
| 3349 | IP_STR |
| 3350 | "OSPF information\n" |
| 3351 | "Neighbor list\n" |
| 3352 | "detail of all neighbors\n" |
| 3353 | "include down status neighbor\n") |
| 3354 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3355 | struct ospf *ospf; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3356 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3357 | struct ospf_interface *oi; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3358 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3359 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3360 | if (ospf == NULL) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3361 | { |
| 3362 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3363 | return CMD_SUCCESS; |
| 3364 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3365 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3366 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3367 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3368 | struct route_node *rn; |
| 3369 | struct ospf_neighbor *nbr; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3370 | struct ospf_nbr_nbma *nbr_nbma; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3371 | |
| 3372 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 3373 | if ((nbr = rn->info)) |
| 3374 | if (nbr != oi->nbr_self) |
| 3375 | if (oi->type == OSPF_IFTYPE_NBMA && nbr->state != NSM_Down) |
| 3376 | show_ip_ospf_neighbor_detail_sub (vty, oi, rn->info); |
| 3377 | |
| 3378 | if (oi->type == OSPF_IFTYPE_NBMA) |
| 3379 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3380 | struct listnode *nd; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3381 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3382 | for (ALL_LIST_ELEMENTS_RO (oi->nbr_nbma, nd, nbr_nbma)) |
| 3383 | if (nbr_nbma->nbr == NULL |
| 3384 | || nbr_nbma->nbr->state == NSM_Down) |
| 3385 | show_ip_ospf_nbr_nbma_detail_sub (vty, oi, nbr_nbma); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3386 | } |
| 3387 | } |
| 3388 | |
| 3389 | return CMD_SUCCESS; |
| 3390 | } |
| 3391 | |
| 3392 | DEFUN (show_ip_ospf_neighbor_int_detail, |
| 3393 | show_ip_ospf_neighbor_int_detail_cmd, |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3394 | "show ip ospf neighbor IFNAME detail", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3395 | SHOW_STR |
| 3396 | IP_STR |
| 3397 | "OSPF information\n" |
| 3398 | "Neighbor list\n" |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3399 | "Interface name\n" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3400 | "detail of all neighbors") |
| 3401 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3402 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3403 | struct ospf_interface *oi; |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3404 | struct interface *ifp; |
| 3405 | struct route_node *rn, *nrn; |
| 3406 | struct ospf_neighbor *nbr; |
| 3407 | |
| 3408 | ifp = if_lookup_by_name (argv[0]); |
| 3409 | if (!ifp) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3410 | { |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3411 | vty_out (vty, "No such interface.%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3412 | return CMD_WARNING; |
| 3413 | } |
| 3414 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3415 | ospf = ospf_lookup (); |
| 3416 | if (ospf == NULL) |
| 3417 | { |
| 3418 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 3419 | return CMD_SUCCESS; |
| 3420 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3421 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3422 | |
hasso | bb5b755 | 2005-08-21 20:01:15 +0000 | [diff] [blame] | 3423 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 3424 | if ((oi = rn->info)) |
| 3425 | for (nrn = route_top (oi->nbrs); nrn; nrn = route_next (nrn)) |
| 3426 | if ((nbr = nrn->info)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3427 | if (nbr != oi->nbr_self) |
| 3428 | if (nbr->state != NSM_Down) |
| 3429 | show_ip_ospf_neighbor_detail_sub (vty, oi, nbr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3430 | |
| 3431 | return CMD_SUCCESS; |
| 3432 | } |
| 3433 | |
| 3434 | |
| 3435 | /* Show functions */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3436 | static int |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3437 | show_lsa_summary (struct vty *vty, struct ospf_lsa *lsa, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3438 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3439 | struct router_lsa *rl; |
| 3440 | struct summary_lsa *sl; |
| 3441 | struct as_external_lsa *asel; |
| 3442 | struct prefix_ipv4 p; |
| 3443 | |
| 3444 | if (lsa != NULL) |
| 3445 | /* If self option is set, check LSA self flag. */ |
| 3446 | if (self == 0 || IS_LSA_SELF (lsa)) |
| 3447 | { |
| 3448 | /* LSA common part show. */ |
| 3449 | vty_out (vty, "%-15s ", inet_ntoa (lsa->data->id)); |
| 3450 | vty_out (vty, "%-15s %4d 0x%08lx 0x%04x", |
| 3451 | inet_ntoa (lsa->data->adv_router), LS_AGE (lsa), |
| 3452 | (u_long)ntohl (lsa->data->ls_seqnum), ntohs (lsa->data->checksum)); |
| 3453 | /* LSA specific part show. */ |
| 3454 | switch (lsa->data->type) |
| 3455 | { |
| 3456 | case OSPF_ROUTER_LSA: |
| 3457 | rl = (struct router_lsa *) lsa->data; |
| 3458 | vty_out (vty, " %-d", ntohs (rl->links)); |
| 3459 | break; |
| 3460 | case OSPF_SUMMARY_LSA: |
| 3461 | sl = (struct summary_lsa *) lsa->data; |
| 3462 | |
| 3463 | p.family = AF_INET; |
| 3464 | p.prefix = sl->header.id; |
| 3465 | p.prefixlen = ip_masklen (sl->mask); |
| 3466 | apply_mask_ipv4 (&p); |
| 3467 | |
| 3468 | vty_out (vty, " %s/%d", inet_ntoa (p.prefix), p.prefixlen); |
| 3469 | break; |
| 3470 | case OSPF_AS_EXTERNAL_LSA: |
paul | 551a897 | 2003-05-18 15:22:55 +0000 | [diff] [blame] | 3471 | case OSPF_AS_NSSA_LSA: |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3472 | asel = (struct as_external_lsa *) lsa->data; |
| 3473 | |
| 3474 | p.family = AF_INET; |
| 3475 | p.prefix = asel->header.id; |
| 3476 | p.prefixlen = ip_masklen (asel->mask); |
| 3477 | apply_mask_ipv4 (&p); |
| 3478 | |
| 3479 | vty_out (vty, " %s %s/%d [0x%lx]", |
| 3480 | IS_EXTERNAL_METRIC (asel->e[0].tos) ? "E2" : "E1", |
| 3481 | inet_ntoa (p.prefix), p.prefixlen, |
| 3482 | (u_long)ntohl (asel->e[0].route_tag)); |
| 3483 | break; |
| 3484 | case OSPF_NETWORK_LSA: |
| 3485 | case OSPF_ASBR_SUMMARY_LSA: |
| 3486 | #ifdef HAVE_OPAQUE_LSA |
| 3487 | case OSPF_OPAQUE_LINK_LSA: |
| 3488 | case OSPF_OPAQUE_AREA_LSA: |
| 3489 | case OSPF_OPAQUE_AS_LSA: |
| 3490 | #endif /* HAVE_OPAQUE_LSA */ |
| 3491 | default: |
| 3492 | break; |
| 3493 | } |
| 3494 | vty_out (vty, VTY_NEWLINE); |
| 3495 | } |
| 3496 | |
| 3497 | return 0; |
| 3498 | } |
| 3499 | |
Stephen Hemminger | 8b6a15b | 2009-12-03 19:25:04 +0300 | [diff] [blame] | 3500 | static const char *show_database_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3501 | { |
| 3502 | "unknown", |
| 3503 | "Router Link States", |
| 3504 | "Net Link States", |
| 3505 | "Summary Link States", |
| 3506 | "ASBR-Summary Link States", |
| 3507 | "AS External Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3508 | "Group Membership LSA", |
| 3509 | "NSSA-external Link States", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3510 | #ifdef HAVE_OPAQUE_LSA |
| 3511 | "Type-8 LSA", |
| 3512 | "Link-Local Opaque-LSA", |
| 3513 | "Area-Local Opaque-LSA", |
| 3514 | "AS-external Opaque-LSA", |
| 3515 | #endif /* HAVE_OPAQUE_LSA */ |
| 3516 | }; |
| 3517 | |
Stephen Hemminger | 8b6a15b | 2009-12-03 19:25:04 +0300 | [diff] [blame] | 3518 | static const char *show_database_header[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3519 | { |
| 3520 | "", |
| 3521 | "Link ID ADV Router Age Seq# CkSum Link count", |
| 3522 | "Link ID ADV Router Age Seq# CkSum", |
| 3523 | "Link ID ADV Router Age Seq# CkSum Route", |
| 3524 | "Link ID ADV Router Age Seq# CkSum", |
| 3525 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3526 | " --- header for Group Member ----", |
| 3527 | "Link ID ADV Router Age Seq# CkSum Route", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3528 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3529 | " --- type-8 ---", |
| 3530 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3531 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3532 | "Opaque-Type/Id ADV Router Age Seq# CkSum", |
| 3533 | #endif /* HAVE_OPAQUE_LSA */ |
| 3534 | }; |
| 3535 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3536 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3537 | show_ip_ospf_database_header (struct vty *vty, struct ospf_lsa *lsa) |
| 3538 | { |
| 3539 | struct router_lsa *rlsa = (struct router_lsa*) lsa->data; |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3540 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3541 | vty_out (vty, " LS age: %d%s", LS_AGE (lsa), VTY_NEWLINE); |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3542 | vty_out (vty, " Options: 0x%-2x : %s%s", |
| 3543 | lsa->data->options, |
| 3544 | ospf_options_dump(lsa->data->options), |
| 3545 | VTY_NEWLINE); |
| 3546 | vty_out (vty, " LS Flags: 0x%-2x %s%s", |
paul | 9d52603 | 2003-06-30 22:46:14 +0000 | [diff] [blame] | 3547 | lsa->flags, |
paul | 4957f49 | 2003-06-27 01:28:45 +0000 | [diff] [blame] | 3548 | ((lsa->flags & OSPF_LSA_LOCAL_XLT) ? "(Translated from Type-7)" : ""), |
| 3549 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3550 | |
| 3551 | if (lsa->data->type == OSPF_ROUTER_LSA) |
| 3552 | { |
| 3553 | vty_out (vty, " Flags: 0x%x" , rlsa->flags); |
| 3554 | |
| 3555 | if (rlsa->flags) |
| 3556 | vty_out (vty, " :%s%s%s%s", |
| 3557 | IS_ROUTER_LSA_BORDER (rlsa) ? " ABR" : "", |
| 3558 | IS_ROUTER_LSA_EXTERNAL (rlsa) ? " ASBR" : "", |
| 3559 | IS_ROUTER_LSA_VIRTUAL (rlsa) ? " VL-endpoint" : "", |
| 3560 | IS_ROUTER_LSA_SHORTCUT (rlsa) ? " Shortcut" : ""); |
| 3561 | |
| 3562 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3563 | } |
| 3564 | vty_out (vty, " LS Type: %s%s", |
| 3565 | LOOKUP (ospf_lsa_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3566 | vty_out (vty, " Link State ID: %s %s%s", inet_ntoa (lsa->data->id), |
| 3567 | LOOKUP (ospf_link_state_id_type_msg, lsa->data->type), VTY_NEWLINE); |
| 3568 | vty_out (vty, " Advertising Router: %s%s", |
| 3569 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 3570 | vty_out (vty, " LS Seq Number: %08lx%s", (u_long)ntohl (lsa->data->ls_seqnum), |
| 3571 | VTY_NEWLINE); |
| 3572 | vty_out (vty, " Checksum: 0x%04x%s", ntohs (lsa->data->checksum), |
| 3573 | VTY_NEWLINE); |
| 3574 | vty_out (vty, " Length: %d%s", ntohs (lsa->data->length), VTY_NEWLINE); |
| 3575 | } |
| 3576 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3577 | const char *link_type_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3578 | { |
| 3579 | "(null)", |
| 3580 | "another Router (point-to-point)", |
| 3581 | "a Transit Network", |
| 3582 | "Stub Network", |
| 3583 | "a Virtual Link", |
| 3584 | }; |
| 3585 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3586 | const char *link_id_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3587 | { |
| 3588 | "(null)", |
| 3589 | "Neighboring Router ID", |
| 3590 | "Designated Router address", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3591 | "Net", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3592 | "Neighboring Router ID", |
| 3593 | }; |
| 3594 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 3595 | const char *link_data_desc[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3596 | { |
| 3597 | "(null)", |
| 3598 | "Router Interface address", |
| 3599 | "Router Interface address", |
| 3600 | "Network Mask", |
| 3601 | "Router Interface address", |
| 3602 | }; |
| 3603 | |
| 3604 | /* Show router-LSA each Link information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3605 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3606 | show_ip_ospf_database_router_links (struct vty *vty, |
| 3607 | struct router_lsa *rl) |
| 3608 | { |
| 3609 | int len, i, type; |
| 3610 | |
| 3611 | len = ntohs (rl->header.length) - 4; |
| 3612 | for (i = 0; i < ntohs (rl->links) && len > 0; len -= 12, i++) |
| 3613 | { |
| 3614 | type = rl->link[i].type; |
| 3615 | |
| 3616 | vty_out (vty, " Link connected to: %s%s", |
| 3617 | link_type_desc[type], VTY_NEWLINE); |
| 3618 | vty_out (vty, " (Link ID) %s: %s%s", link_id_desc[type], |
| 3619 | inet_ntoa (rl->link[i].link_id), VTY_NEWLINE); |
| 3620 | vty_out (vty, " (Link Data) %s: %s%s", link_data_desc[type], |
| 3621 | inet_ntoa (rl->link[i].link_data), VTY_NEWLINE); |
| 3622 | vty_out (vty, " Number of TOS metrics: 0%s", VTY_NEWLINE); |
| 3623 | vty_out (vty, " TOS 0 Metric: %d%s", |
| 3624 | ntohs (rl->link[i].metric), VTY_NEWLINE); |
| 3625 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3626 | } |
| 3627 | } |
| 3628 | |
| 3629 | /* Show router-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3630 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3631 | show_router_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3632 | { |
| 3633 | if (lsa != NULL) |
| 3634 | { |
| 3635 | struct router_lsa *rl = (struct router_lsa *) lsa->data; |
| 3636 | |
| 3637 | show_ip_ospf_database_header (vty, lsa); |
| 3638 | |
| 3639 | vty_out (vty, " Number of Links: %d%s%s", ntohs (rl->links), |
| 3640 | VTY_NEWLINE, VTY_NEWLINE); |
| 3641 | |
| 3642 | show_ip_ospf_database_router_links (vty, rl); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3643 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3644 | } |
| 3645 | |
| 3646 | return 0; |
| 3647 | } |
| 3648 | |
| 3649 | /* Show network-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3650 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3651 | show_network_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3652 | { |
| 3653 | int length, i; |
| 3654 | |
| 3655 | if (lsa != NULL) |
| 3656 | { |
| 3657 | struct network_lsa *nl = (struct network_lsa *) lsa->data; |
| 3658 | |
| 3659 | show_ip_ospf_database_header (vty, lsa); |
| 3660 | |
| 3661 | vty_out (vty, " Network Mask: /%d%s", |
| 3662 | ip_masklen (nl->mask), VTY_NEWLINE); |
| 3663 | |
| 3664 | length = ntohs (lsa->data->length) - OSPF_LSA_HEADER_SIZE - 4; |
| 3665 | |
| 3666 | for (i = 0; length > 0; i++, length -= 4) |
| 3667 | vty_out (vty, " Attached Router: %s%s", |
| 3668 | inet_ntoa (nl->routers[i]), VTY_NEWLINE); |
| 3669 | |
| 3670 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3671 | } |
| 3672 | |
| 3673 | return 0; |
| 3674 | } |
| 3675 | |
| 3676 | /* Show summary-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3677 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3678 | show_summary_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3679 | { |
| 3680 | if (lsa != NULL) |
| 3681 | { |
| 3682 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3683 | |
| 3684 | show_ip_ospf_database_header (vty, lsa); |
| 3685 | |
| 3686 | vty_out (vty, " Network Mask: /%d%s", ip_masklen (sl->mask), |
| 3687 | VTY_NEWLINE); |
| 3688 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3689 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3690 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3691 | } |
| 3692 | |
| 3693 | return 0; |
| 3694 | } |
| 3695 | |
| 3696 | /* Show summary-ASBR-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3697 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3698 | show_summary_asbr_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3699 | { |
| 3700 | if (lsa != NULL) |
| 3701 | { |
| 3702 | struct summary_lsa *sl = (struct summary_lsa *) lsa->data; |
| 3703 | |
| 3704 | show_ip_ospf_database_header (vty, lsa); |
| 3705 | |
| 3706 | vty_out (vty, " Network Mask: /%d%s", |
| 3707 | ip_masklen (sl->mask), VTY_NEWLINE); |
| 3708 | vty_out (vty, " TOS: 0 Metric: %d%s", GET_METRIC (sl->metric), |
| 3709 | VTY_NEWLINE); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 3710 | vty_out (vty, "%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3711 | } |
| 3712 | |
| 3713 | return 0; |
| 3714 | } |
| 3715 | |
| 3716 | /* Show AS-external-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3717 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3718 | show_as_external_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3719 | { |
| 3720 | if (lsa != NULL) |
| 3721 | { |
| 3722 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3723 | |
| 3724 | show_ip_ospf_database_header (vty, lsa); |
| 3725 | |
| 3726 | vty_out (vty, " Network Mask: /%d%s", |
| 3727 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3728 | vty_out (vty, " Metric Type: %s%s", |
| 3729 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3730 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3731 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3732 | vty_out (vty, " Metric: %d%s", |
| 3733 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3734 | vty_out (vty, " Forward Address: %s%s", |
| 3735 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3736 | |
| 3737 | vty_out (vty, " External Route Tag: %lu%s%s", |
| 3738 | (u_long)ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3739 | } |
| 3740 | |
| 3741 | return 0; |
| 3742 | } |
| 3743 | |
Stephen Hemminger | 075e12f | 2011-12-06 23:54:17 +0400 | [diff] [blame] | 3744 | #if 0 |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3745 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3746 | show_as_external_lsa_stdvty (struct ospf_lsa *lsa) |
| 3747 | { |
| 3748 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3749 | |
| 3750 | /* show_ip_ospf_database_header (vty, lsa); */ |
| 3751 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3752 | zlog_debug( " Network Mask: /%d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3753 | ip_masklen (al->mask), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3754 | zlog_debug( " Metric Type: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3755 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3756 | "2 (Larger than any link state path)" : "1", "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3757 | zlog_debug( " TOS: 0%s", "\n"); |
| 3758 | zlog_debug( " Metric: %d%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3759 | GET_METRIC (al->e[0].metric), "\n"); |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3760 | zlog_debug( " Forward Address: %s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3761 | inet_ntoa (al->e[0].fwd_addr), "\n"); |
| 3762 | |
ajs | 2a42e28 | 2004-12-08 18:43:03 +0000 | [diff] [blame] | 3763 | zlog_debug( " External Route Tag: %u%s%s", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3764 | ntohl (al->e[0].route_tag), "\n", "\n"); |
| 3765 | |
| 3766 | return 0; |
| 3767 | } |
Stephen Hemminger | 075e12f | 2011-12-06 23:54:17 +0400 | [diff] [blame] | 3768 | #endif |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3769 | |
| 3770 | /* Show AS-NSSA-LSA detail information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3771 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3772 | show_as_nssa_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3773 | { |
| 3774 | if (lsa != NULL) |
| 3775 | { |
| 3776 | struct as_external_lsa *al = (struct as_external_lsa *) lsa->data; |
| 3777 | |
| 3778 | show_ip_ospf_database_header (vty, lsa); |
| 3779 | |
| 3780 | vty_out (vty, " Network Mask: /%d%s", |
| 3781 | ip_masklen (al->mask), VTY_NEWLINE); |
| 3782 | vty_out (vty, " Metric Type: %s%s", |
| 3783 | IS_EXTERNAL_METRIC (al->e[0].tos) ? |
| 3784 | "2 (Larger than any link state path)" : "1", VTY_NEWLINE); |
| 3785 | vty_out (vty, " TOS: 0%s", VTY_NEWLINE); |
| 3786 | vty_out (vty, " Metric: %d%s", |
| 3787 | GET_METRIC (al->e[0].metric), VTY_NEWLINE); |
| 3788 | vty_out (vty, " NSSA: Forward Address: %s%s", |
| 3789 | inet_ntoa (al->e[0].fwd_addr), VTY_NEWLINE); |
| 3790 | |
| 3791 | vty_out (vty, " External Route Tag: %u%s%s", |
| 3792 | ntohl (al->e[0].route_tag), VTY_NEWLINE, VTY_NEWLINE); |
| 3793 | } |
| 3794 | |
| 3795 | return 0; |
| 3796 | } |
| 3797 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3798 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3799 | show_func_dummy (struct vty *vty, struct ospf_lsa *lsa) |
| 3800 | { |
| 3801 | return 0; |
| 3802 | } |
| 3803 | |
| 3804 | #ifdef HAVE_OPAQUE_LSA |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3805 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3806 | show_opaque_lsa_detail (struct vty *vty, struct ospf_lsa *lsa) |
| 3807 | { |
| 3808 | if (lsa != NULL) |
| 3809 | { |
| 3810 | show_ip_ospf_database_header (vty, lsa); |
| 3811 | show_opaque_info_detail (vty, lsa); |
| 3812 | |
| 3813 | vty_out (vty, "%s", VTY_NEWLINE); |
| 3814 | } |
| 3815 | return 0; |
| 3816 | } |
| 3817 | #endif /* HAVE_OPAQUE_LSA */ |
| 3818 | |
| 3819 | int (*show_function[])(struct vty *, struct ospf_lsa *) = |
| 3820 | { |
| 3821 | NULL, |
| 3822 | show_router_lsa_detail, |
| 3823 | show_network_lsa_detail, |
| 3824 | show_summary_lsa_detail, |
| 3825 | show_summary_asbr_lsa_detail, |
| 3826 | show_as_external_lsa_detail, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3827 | show_func_dummy, |
| 3828 | show_as_nssa_lsa_detail, /* almost same as external */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3829 | #ifdef HAVE_OPAQUE_LSA |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3830 | NULL, /* type-8 */ |
| 3831 | show_opaque_lsa_detail, |
| 3832 | show_opaque_lsa_detail, |
| 3833 | show_opaque_lsa_detail, |
| 3834 | #endif /* HAVE_OPAQUE_LSA */ |
| 3835 | }; |
| 3836 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3837 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3838 | show_lsa_prefix_set (struct vty *vty, struct prefix_ls *lp, struct in_addr *id, |
| 3839 | struct in_addr *adv_router) |
| 3840 | { |
| 3841 | memset (lp, 0, sizeof (struct prefix_ls)); |
| 3842 | lp->family = 0; |
| 3843 | if (id == NULL) |
| 3844 | lp->prefixlen = 0; |
| 3845 | else if (adv_router == NULL) |
| 3846 | { |
| 3847 | lp->prefixlen = 32; |
| 3848 | lp->id = *id; |
| 3849 | } |
| 3850 | else |
| 3851 | { |
| 3852 | lp->prefixlen = 64; |
| 3853 | lp->id = *id; |
| 3854 | lp->adv_router = *adv_router; |
| 3855 | } |
| 3856 | } |
| 3857 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3858 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3859 | show_lsa_detail_proc (struct vty *vty, struct route_table *rt, |
| 3860 | struct in_addr *id, struct in_addr *adv_router) |
| 3861 | { |
| 3862 | struct prefix_ls lp; |
| 3863 | struct route_node *rn, *start; |
| 3864 | struct ospf_lsa *lsa; |
| 3865 | |
| 3866 | show_lsa_prefix_set (vty, &lp, id, adv_router); |
| 3867 | start = route_node_get (rt, (struct prefix *) &lp); |
| 3868 | if (start) |
| 3869 | { |
| 3870 | route_lock_node (start); |
| 3871 | for (rn = start; rn; rn = route_next_until (rn, start)) |
| 3872 | if ((lsa = rn->info)) |
| 3873 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3874 | if (show_function[lsa->data->type] != NULL) |
| 3875 | show_function[lsa->data->type] (vty, lsa); |
| 3876 | } |
| 3877 | route_unlock_node (start); |
| 3878 | } |
| 3879 | } |
| 3880 | |
| 3881 | /* Show detail LSA information |
| 3882 | -- if id is NULL then show all LSAs. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3883 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3884 | show_lsa_detail (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3885 | struct in_addr *id, struct in_addr *adv_router) |
| 3886 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3887 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3888 | struct ospf_area *area; |
| 3889 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3890 | switch (type) |
| 3891 | { |
| 3892 | case OSPF_AS_EXTERNAL_LSA: |
| 3893 | #ifdef HAVE_OPAQUE_LSA |
| 3894 | case OSPF_OPAQUE_AS_LSA: |
| 3895 | #endif /* HAVE_OPAQUE_LSA */ |
| 3896 | vty_out (vty, " %s %s%s", |
| 3897 | show_database_desc[type], |
| 3898 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3899 | show_lsa_detail_proc (vty, AS_LSDB (ospf, type), id, adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3900 | break; |
| 3901 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3902 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3903 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3904 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3905 | VTY_NEWLINE, show_database_desc[type], |
| 3906 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3907 | show_lsa_detail_proc (vty, AREA_LSDB (area, type), id, adv_router); |
| 3908 | } |
| 3909 | break; |
| 3910 | } |
| 3911 | } |
| 3912 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3913 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3914 | show_lsa_detail_adv_router_proc (struct vty *vty, struct route_table *rt, |
| 3915 | struct in_addr *adv_router) |
| 3916 | { |
| 3917 | struct route_node *rn; |
| 3918 | struct ospf_lsa *lsa; |
| 3919 | |
| 3920 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 3921 | if ((lsa = rn->info)) |
| 3922 | if (IPV4_ADDR_SAME (adv_router, &lsa->data->adv_router)) |
| 3923 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3924 | if (CHECK_FLAG (lsa->flags, OSPF_LSA_LOCAL_XLT)) |
| 3925 | continue; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3926 | if (show_function[lsa->data->type] != NULL) |
| 3927 | show_function[lsa->data->type] (vty, lsa); |
| 3928 | } |
| 3929 | } |
| 3930 | |
| 3931 | /* Show detail LSA information. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3932 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3933 | show_lsa_detail_adv_router (struct vty *vty, struct ospf *ospf, int type, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3934 | struct in_addr *adv_router) |
| 3935 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3936 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3937 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3938 | |
| 3939 | switch (type) |
| 3940 | { |
| 3941 | case OSPF_AS_EXTERNAL_LSA: |
| 3942 | #ifdef HAVE_OPAQUE_LSA |
| 3943 | case OSPF_OPAQUE_AS_LSA: |
| 3944 | #endif /* HAVE_OPAQUE_LSA */ |
| 3945 | vty_out (vty, " %s %s%s", |
| 3946 | show_database_desc[type], |
| 3947 | VTY_NEWLINE, VTY_NEWLINE); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 3948 | show_lsa_detail_adv_router_proc (vty, AS_LSDB (ospf, type), |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3949 | adv_router); |
| 3950 | break; |
| 3951 | default: |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3952 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3953 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3954 | vty_out (vty, "%s %s (Area %s)%s%s", |
| 3955 | VTY_NEWLINE, show_database_desc[type], |
| 3956 | ospf_area_desc_string (area), VTY_NEWLINE, VTY_NEWLINE); |
| 3957 | show_lsa_detail_adv_router_proc (vty, AREA_LSDB (area, type), |
| 3958 | adv_router); |
| 3959 | } |
| 3960 | break; |
| 3961 | } |
| 3962 | } |
| 3963 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 3964 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3965 | show_ip_ospf_database_summary (struct vty *vty, struct ospf *ospf, int self) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3966 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3967 | struct ospf_lsa *lsa; |
| 3968 | struct route_node *rn; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3969 | struct ospf_area *area; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 3970 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3971 | int type; |
| 3972 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 3973 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3974 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3975 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 3976 | { |
| 3977 | switch (type) |
| 3978 | { |
| 3979 | case OSPF_AS_EXTERNAL_LSA: |
| 3980 | #ifdef HAVE_OPAQUE_LSA |
| 3981 | case OSPF_OPAQUE_AS_LSA: |
| 3982 | #endif /* HAVE_OPAQUE_LSA */ |
| 3983 | continue; |
| 3984 | default: |
| 3985 | break; |
| 3986 | } |
| 3987 | if (ospf_lsdb_count_self (area->lsdb, type) > 0 || |
| 3988 | (!self && ospf_lsdb_count (area->lsdb, type) > 0)) |
| 3989 | { |
| 3990 | vty_out (vty, " %s (Area %s)%s%s", |
| 3991 | show_database_desc[type], |
| 3992 | ospf_area_desc_string (area), |
| 3993 | VTY_NEWLINE, VTY_NEWLINE); |
| 3994 | vty_out (vty, "%s%s", show_database_header[type], VTY_NEWLINE); |
| 3995 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 3996 | LSDB_LOOP (AREA_LSDB (area, type), rn, lsa) |
| 3997 | show_lsa_summary (vty, lsa, self); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 3998 | |
| 3999 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4000 | } |
| 4001 | } |
| 4002 | } |
| 4003 | |
| 4004 | for (type = OSPF_MIN_LSA; type < OSPF_MAX_LSA; type++) |
| 4005 | { |
| 4006 | switch (type) |
| 4007 | { |
| 4008 | case OSPF_AS_EXTERNAL_LSA: |
| 4009 | #ifdef HAVE_OPAQUE_LSA |
| 4010 | case OSPF_OPAQUE_AS_LSA: |
| 4011 | #endif /* HAVE_OPAQUE_LSA */ |
paul | e8e1946 | 2006-01-19 20:16:55 +0000 | [diff] [blame] | 4012 | break; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4013 | default: |
| 4014 | continue; |
| 4015 | } |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4016 | if (ospf_lsdb_count_self (ospf->lsdb, type) || |
| 4017 | (!self && ospf_lsdb_count (ospf->lsdb, type))) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4018 | { |
| 4019 | vty_out (vty, " %s%s%s", |
| 4020 | show_database_desc[type], |
| 4021 | VTY_NEWLINE, VTY_NEWLINE); |
| 4022 | vty_out (vty, "%s%s", show_database_header[type], |
| 4023 | VTY_NEWLINE); |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4024 | |
| 4025 | LSDB_LOOP (AS_LSDB (ospf, type), rn, lsa) |
| 4026 | show_lsa_summary (vty, lsa, self); |
| 4027 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4028 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4029 | } |
| 4030 | } |
| 4031 | |
| 4032 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4033 | } |
| 4034 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4035 | static void |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4036 | show_ip_ospf_database_maxage (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4037 | { |
Dinesh Dutt | 91e6a0e | 2012-12-04 10:46:37 -0800 | [diff] [blame] | 4038 | struct route_node *rn; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4039 | struct ospf_lsa *lsa; |
| 4040 | |
| 4041 | vty_out (vty, "%s MaxAge Link States:%s%s", |
| 4042 | VTY_NEWLINE, VTY_NEWLINE, VTY_NEWLINE); |
| 4043 | |
Dinesh Dutt | 91e6a0e | 2012-12-04 10:46:37 -0800 | [diff] [blame] | 4044 | for (rn = route_top (ospf->maxage_lsa); rn; rn = route_next (rn)) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4045 | { |
Dinesh Dutt | 91e6a0e | 2012-12-04 10:46:37 -0800 | [diff] [blame] | 4046 | struct ospf_lsa *lsa; |
| 4047 | |
| 4048 | if ((lsa = rn->info) != NULL) |
| 4049 | { |
| 4050 | vty_out (vty, "Link type: %d%s", lsa->data->type, VTY_NEWLINE); |
| 4051 | vty_out (vty, "Link State ID: %s%s", |
| 4052 | inet_ntoa (lsa->data->id), VTY_NEWLINE); |
| 4053 | vty_out (vty, "Advertising Router: %s%s", |
| 4054 | inet_ntoa (lsa->data->adv_router), VTY_NEWLINE); |
| 4055 | vty_out (vty, "LSA lock count: %d%s", lsa->lock, VTY_NEWLINE); |
| 4056 | vty_out (vty, "%s", VTY_NEWLINE); |
| 4057 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 4058 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4059 | } |
| 4060 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4061 | #define OSPF_LSA_TYPE_NSSA_DESC "NSSA external link state\n" |
| 4062 | #define OSPF_LSA_TYPE_NSSA_CMD_STR "|nssa-external" |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4063 | |
| 4064 | #ifdef HAVE_OPAQUE_LSA |
| 4065 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "Link local Opaque-LSA\n" |
| 4066 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "Link area Opaque-LSA\n" |
| 4067 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "Link AS Opaque-LSA\n" |
| 4068 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "|opaque-link|opaque-area|opaque-as" |
| 4069 | #else /* HAVE_OPAQUE_LSA */ |
| 4070 | #define OSPF_LSA_TYPE_OPAQUE_LINK_DESC "" |
| 4071 | #define OSPF_LSA_TYPE_OPAQUE_AREA_DESC "" |
| 4072 | #define OSPF_LSA_TYPE_OPAQUE_AS_DESC "" |
| 4073 | #define OSPF_LSA_TYPE_OPAQUE_CMD_STR "" |
| 4074 | #endif /* HAVE_OPAQUE_LSA */ |
| 4075 | |
| 4076 | #define OSPF_LSA_TYPES_CMD_STR \ |
| 4077 | "asbr-summary|external|network|router|summary" \ |
| 4078 | OSPF_LSA_TYPE_NSSA_CMD_STR \ |
| 4079 | OSPF_LSA_TYPE_OPAQUE_CMD_STR |
| 4080 | |
| 4081 | #define OSPF_LSA_TYPES_DESC \ |
| 4082 | "ASBR summary link states\n" \ |
| 4083 | "External link states\n" \ |
| 4084 | "Network link states\n" \ |
| 4085 | "Router link states\n" \ |
| 4086 | "Network summary link states\n" \ |
| 4087 | OSPF_LSA_TYPE_NSSA_DESC \ |
| 4088 | OSPF_LSA_TYPE_OPAQUE_LINK_DESC \ |
| 4089 | OSPF_LSA_TYPE_OPAQUE_AREA_DESC \ |
| 4090 | OSPF_LSA_TYPE_OPAQUE_AS_DESC |
| 4091 | |
| 4092 | DEFUN (show_ip_ospf_database, |
| 4093 | show_ip_ospf_database_cmd, |
| 4094 | "show ip ospf database", |
| 4095 | SHOW_STR |
| 4096 | IP_STR |
| 4097 | "OSPF information\n" |
| 4098 | "Database summary\n") |
| 4099 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4100 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4101 | int type, ret; |
| 4102 | struct in_addr id, adv_router; |
| 4103 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4104 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4105 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4106 | { |
| 4107 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4108 | return CMD_SUCCESS; |
| 4109 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4110 | |
| 4111 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4112 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4113 | |
| 4114 | /* Show all LSA. */ |
| 4115 | if (argc == 0) |
| 4116 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4117 | show_ip_ospf_database_summary (vty, ospf, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4118 | return CMD_SUCCESS; |
| 4119 | } |
| 4120 | |
| 4121 | /* Set database type to show. */ |
| 4122 | if (strncmp (argv[0], "r", 1) == 0) |
| 4123 | type = OSPF_ROUTER_LSA; |
| 4124 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4125 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4126 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4127 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4128 | else if (strncmp (argv[0], "su", 2) == 0) |
| 4129 | type = OSPF_SUMMARY_LSA; |
| 4130 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4131 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4132 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4133 | type = OSPF_AS_EXTERNAL_LSA; |
| 4134 | else if (strncmp (argv[0], "se", 2) == 0) |
| 4135 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4136 | show_ip_ospf_database_summary (vty, ospf, 1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4137 | return CMD_SUCCESS; |
| 4138 | } |
| 4139 | else if (strncmp (argv[0], "m", 1) == 0) |
| 4140 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4141 | show_ip_ospf_database_maxage (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4142 | return CMD_SUCCESS; |
| 4143 | } |
| 4144 | #ifdef HAVE_OPAQUE_LSA |
| 4145 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4146 | type = OSPF_OPAQUE_LINK_LSA; |
| 4147 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4148 | type = OSPF_OPAQUE_AREA_LSA; |
| 4149 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4150 | type = OSPF_OPAQUE_AS_LSA; |
| 4151 | #endif /* HAVE_OPAQUE_LSA */ |
| 4152 | else |
| 4153 | return CMD_WARNING; |
| 4154 | |
| 4155 | /* `show ip ospf database LSA'. */ |
| 4156 | if (argc == 1) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4157 | show_lsa_detail (vty, ospf, type, NULL, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4158 | else if (argc >= 2) |
| 4159 | { |
| 4160 | ret = inet_aton (argv[1], &id); |
| 4161 | if (!ret) |
| 4162 | return CMD_WARNING; |
| 4163 | |
| 4164 | /* `show ip ospf database LSA ID'. */ |
| 4165 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4166 | show_lsa_detail (vty, ospf, type, &id, NULL); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4167 | /* `show ip ospf database LSA ID adv-router ADV_ROUTER'. */ |
| 4168 | else if (argc == 3) |
| 4169 | { |
| 4170 | if (strncmp (argv[2], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4171 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4172 | else |
| 4173 | { |
| 4174 | ret = inet_aton (argv[2], &adv_router); |
| 4175 | if (!ret) |
| 4176 | return CMD_WARNING; |
| 4177 | } |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4178 | show_lsa_detail (vty, ospf, type, &id, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4179 | } |
| 4180 | } |
| 4181 | |
| 4182 | return CMD_SUCCESS; |
| 4183 | } |
| 4184 | |
| 4185 | ALIAS (show_ip_ospf_database, |
| 4186 | show_ip_ospf_database_type_cmd, |
| 4187 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR "|max-age|self-originate)", |
| 4188 | SHOW_STR |
| 4189 | IP_STR |
| 4190 | "OSPF information\n" |
| 4191 | "Database summary\n" |
| 4192 | OSPF_LSA_TYPES_DESC |
| 4193 | "LSAs in MaxAge list\n" |
| 4194 | "Self-originated link states\n") |
| 4195 | |
| 4196 | ALIAS (show_ip_ospf_database, |
| 4197 | show_ip_ospf_database_type_id_cmd, |
| 4198 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D", |
| 4199 | SHOW_STR |
| 4200 | IP_STR |
| 4201 | "OSPF information\n" |
| 4202 | "Database summary\n" |
| 4203 | OSPF_LSA_TYPES_DESC |
| 4204 | "Link State ID (as an IP address)\n") |
| 4205 | |
| 4206 | ALIAS (show_ip_ospf_database, |
| 4207 | show_ip_ospf_database_type_id_adv_router_cmd, |
| 4208 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D adv-router A.B.C.D", |
| 4209 | SHOW_STR |
| 4210 | IP_STR |
| 4211 | "OSPF information\n" |
| 4212 | "Database summary\n" |
| 4213 | OSPF_LSA_TYPES_DESC |
| 4214 | "Link State ID (as an IP address)\n" |
| 4215 | "Advertising Router link states\n" |
| 4216 | "Advertising Router (as an IP address)\n") |
| 4217 | |
| 4218 | ALIAS (show_ip_ospf_database, |
| 4219 | show_ip_ospf_database_type_id_self_cmd, |
| 4220 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") A.B.C.D (self-originate|)", |
| 4221 | SHOW_STR |
| 4222 | IP_STR |
| 4223 | "OSPF information\n" |
| 4224 | "Database summary\n" |
| 4225 | OSPF_LSA_TYPES_DESC |
| 4226 | "Link State ID (as an IP address)\n" |
| 4227 | "Self-originated link states\n" |
| 4228 | "\n") |
| 4229 | |
| 4230 | DEFUN (show_ip_ospf_database_type_adv_router, |
| 4231 | show_ip_ospf_database_type_adv_router_cmd, |
| 4232 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") adv-router A.B.C.D", |
| 4233 | SHOW_STR |
| 4234 | IP_STR |
| 4235 | "OSPF information\n" |
| 4236 | "Database summary\n" |
| 4237 | OSPF_LSA_TYPES_DESC |
| 4238 | "Advertising Router link states\n" |
| 4239 | "Advertising Router (as an IP address)\n") |
| 4240 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4241 | struct ospf *ospf; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4242 | int type, ret; |
| 4243 | struct in_addr adv_router; |
| 4244 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4245 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4246 | if (ospf == NULL) |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 4247 | { |
| 4248 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
| 4249 | return CMD_SUCCESS; |
| 4250 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4251 | |
| 4252 | vty_out (vty, "%s OSPF Router with ID (%s)%s%s", VTY_NEWLINE, |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4253 | inet_ntoa (ospf->router_id), VTY_NEWLINE, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4254 | |
| 4255 | if (argc != 2) |
| 4256 | return CMD_WARNING; |
| 4257 | |
| 4258 | /* Set database type to show. */ |
| 4259 | if (strncmp (argv[0], "r", 1) == 0) |
| 4260 | type = OSPF_ROUTER_LSA; |
| 4261 | else if (strncmp (argv[0], "ne", 2) == 0) |
| 4262 | type = OSPF_NETWORK_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4263 | else if (strncmp (argv[0], "ns", 2) == 0) |
| 4264 | type = OSPF_AS_NSSA_LSA; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4265 | else if (strncmp (argv[0], "s", 1) == 0) |
| 4266 | type = OSPF_SUMMARY_LSA; |
| 4267 | else if (strncmp (argv[0], "a", 1) == 0) |
| 4268 | type = OSPF_ASBR_SUMMARY_LSA; |
| 4269 | else if (strncmp (argv[0], "e", 1) == 0) |
| 4270 | type = OSPF_AS_EXTERNAL_LSA; |
| 4271 | #ifdef HAVE_OPAQUE_LSA |
| 4272 | else if (strncmp (argv[0], "opaque-l", 8) == 0) |
| 4273 | type = OSPF_OPAQUE_LINK_LSA; |
| 4274 | else if (strncmp (argv[0], "opaque-ar", 9) == 0) |
| 4275 | type = OSPF_OPAQUE_AREA_LSA; |
| 4276 | else if (strncmp (argv[0], "opaque-as", 9) == 0) |
| 4277 | type = OSPF_OPAQUE_AS_LSA; |
| 4278 | #endif /* HAVE_OPAQUE_LSA */ |
| 4279 | else |
| 4280 | return CMD_WARNING; |
| 4281 | |
| 4282 | /* `show ip ospf database LSA adv-router ADV_ROUTER'. */ |
| 4283 | if (strncmp (argv[1], "s", 1) == 0) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 4284 | adv_router = ospf->router_id; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4285 | else |
| 4286 | { |
| 4287 | ret = inet_aton (argv[1], &adv_router); |
| 4288 | if (!ret) |
| 4289 | return CMD_WARNING; |
| 4290 | } |
| 4291 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 4292 | show_lsa_detail_adv_router (vty, ospf, type, &adv_router); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4293 | |
| 4294 | return CMD_SUCCESS; |
| 4295 | } |
| 4296 | |
| 4297 | ALIAS (show_ip_ospf_database_type_adv_router, |
| 4298 | show_ip_ospf_database_type_self_cmd, |
| 4299 | "show ip ospf database (" OSPF_LSA_TYPES_CMD_STR ") (self-originate|)", |
| 4300 | SHOW_STR |
| 4301 | IP_STR |
| 4302 | "OSPF information\n" |
| 4303 | "Database summary\n" |
| 4304 | OSPF_LSA_TYPES_DESC |
| 4305 | "Self-originated link states\n") |
| 4306 | |
| 4307 | |
| 4308 | DEFUN (ip_ospf_authentication_args, |
| 4309 | ip_ospf_authentication_args_addr_cmd, |
| 4310 | "ip ospf authentication (null|message-digest) A.B.C.D", |
| 4311 | "IP Information\n" |
| 4312 | "OSPF interface commands\n" |
| 4313 | "Enable authentication on this interface\n" |
| 4314 | "Use null authentication\n" |
| 4315 | "Use message-digest authentication\n" |
| 4316 | "Address of interface") |
| 4317 | { |
| 4318 | struct interface *ifp; |
| 4319 | struct in_addr addr; |
| 4320 | int ret; |
| 4321 | struct ospf_if_params *params; |
| 4322 | |
| 4323 | ifp = vty->index; |
| 4324 | params = IF_DEF_PARAMS (ifp); |
| 4325 | |
| 4326 | if (argc == 2) |
| 4327 | { |
| 4328 | ret = inet_aton(argv[1], &addr); |
| 4329 | if (!ret) |
| 4330 | { |
| 4331 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4332 | VTY_NEWLINE); |
| 4333 | return CMD_WARNING; |
| 4334 | } |
| 4335 | |
| 4336 | params = ospf_get_if_params (ifp, addr); |
| 4337 | ospf_if_update_params (ifp, addr); |
| 4338 | } |
| 4339 | |
| 4340 | /* Handle null authentication */ |
| 4341 | if ( argv[0][0] == 'n' ) |
| 4342 | { |
| 4343 | SET_IF_PARAM (params, auth_type); |
| 4344 | params->auth_type = OSPF_AUTH_NULL; |
| 4345 | return CMD_SUCCESS; |
| 4346 | } |
| 4347 | |
| 4348 | /* Handle message-digest authentication */ |
| 4349 | if ( argv[0][0] == 'm' ) |
| 4350 | { |
| 4351 | SET_IF_PARAM (params, auth_type); |
| 4352 | params->auth_type = OSPF_AUTH_CRYPTOGRAPHIC; |
| 4353 | return CMD_SUCCESS; |
| 4354 | } |
| 4355 | |
| 4356 | vty_out (vty, "You shouldn't get here!%s", VTY_NEWLINE); |
| 4357 | return CMD_WARNING; |
| 4358 | } |
| 4359 | |
| 4360 | ALIAS (ip_ospf_authentication_args, |
| 4361 | ip_ospf_authentication_args_cmd, |
| 4362 | "ip ospf authentication (null|message-digest)", |
| 4363 | "IP Information\n" |
| 4364 | "OSPF interface commands\n" |
| 4365 | "Enable authentication on this interface\n" |
| 4366 | "Use null authentication\n" |
| 4367 | "Use message-digest authentication\n") |
| 4368 | |
| 4369 | DEFUN (ip_ospf_authentication, |
| 4370 | ip_ospf_authentication_addr_cmd, |
| 4371 | "ip ospf authentication A.B.C.D", |
| 4372 | "IP Information\n" |
| 4373 | "OSPF interface commands\n" |
| 4374 | "Enable authentication on this interface\n" |
| 4375 | "Address of interface") |
| 4376 | { |
| 4377 | struct interface *ifp; |
| 4378 | struct in_addr addr; |
| 4379 | int ret; |
| 4380 | struct ospf_if_params *params; |
| 4381 | |
| 4382 | ifp = vty->index; |
| 4383 | params = IF_DEF_PARAMS (ifp); |
| 4384 | |
| 4385 | if (argc == 1) |
| 4386 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4387 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4388 | if (!ret) |
| 4389 | { |
| 4390 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4391 | VTY_NEWLINE); |
| 4392 | return CMD_WARNING; |
| 4393 | } |
| 4394 | |
| 4395 | params = ospf_get_if_params (ifp, addr); |
| 4396 | ospf_if_update_params (ifp, addr); |
| 4397 | } |
| 4398 | |
| 4399 | SET_IF_PARAM (params, auth_type); |
| 4400 | params->auth_type = OSPF_AUTH_SIMPLE; |
| 4401 | |
| 4402 | return CMD_SUCCESS; |
| 4403 | } |
| 4404 | |
| 4405 | ALIAS (ip_ospf_authentication, |
| 4406 | ip_ospf_authentication_cmd, |
| 4407 | "ip ospf authentication", |
| 4408 | "IP Information\n" |
| 4409 | "OSPF interface commands\n" |
| 4410 | "Enable authentication on this interface\n") |
| 4411 | |
| 4412 | DEFUN (no_ip_ospf_authentication, |
| 4413 | no_ip_ospf_authentication_addr_cmd, |
| 4414 | "no ip ospf authentication A.B.C.D", |
| 4415 | NO_STR |
| 4416 | "IP Information\n" |
| 4417 | "OSPF interface commands\n" |
| 4418 | "Enable authentication on this interface\n" |
| 4419 | "Address of interface") |
| 4420 | { |
| 4421 | struct interface *ifp; |
| 4422 | struct in_addr addr; |
| 4423 | int ret; |
| 4424 | struct ospf_if_params *params; |
| 4425 | |
| 4426 | ifp = vty->index; |
| 4427 | params = IF_DEF_PARAMS (ifp); |
| 4428 | |
| 4429 | if (argc == 1) |
| 4430 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4431 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4432 | if (!ret) |
| 4433 | { |
| 4434 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4435 | VTY_NEWLINE); |
| 4436 | return CMD_WARNING; |
| 4437 | } |
| 4438 | |
| 4439 | params = ospf_lookup_if_params (ifp, addr); |
| 4440 | if (params == NULL) |
| 4441 | return CMD_SUCCESS; |
| 4442 | } |
| 4443 | |
| 4444 | params->auth_type = OSPF_AUTH_NOTSET; |
| 4445 | UNSET_IF_PARAM (params, auth_type); |
| 4446 | |
| 4447 | if (params != IF_DEF_PARAMS (ifp)) |
| 4448 | { |
| 4449 | ospf_free_if_params (ifp, addr); |
| 4450 | ospf_if_update_params (ifp, addr); |
| 4451 | } |
| 4452 | |
| 4453 | return CMD_SUCCESS; |
| 4454 | } |
| 4455 | |
| 4456 | ALIAS (no_ip_ospf_authentication, |
| 4457 | no_ip_ospf_authentication_cmd, |
| 4458 | "no ip ospf authentication", |
| 4459 | NO_STR |
| 4460 | "IP Information\n" |
| 4461 | "OSPF interface commands\n" |
| 4462 | "Enable authentication on this interface\n") |
| 4463 | |
| 4464 | DEFUN (ip_ospf_authentication_key, |
| 4465 | ip_ospf_authentication_key_addr_cmd, |
| 4466 | "ip ospf authentication-key AUTH_KEY A.B.C.D", |
| 4467 | "IP Information\n" |
| 4468 | "OSPF interface commands\n" |
| 4469 | "Authentication password (key)\n" |
| 4470 | "The OSPF password (key)\n" |
| 4471 | "Address of interface") |
| 4472 | { |
| 4473 | struct interface *ifp; |
| 4474 | struct in_addr addr; |
| 4475 | int ret; |
| 4476 | struct ospf_if_params *params; |
| 4477 | |
| 4478 | ifp = vty->index; |
| 4479 | params = IF_DEF_PARAMS (ifp); |
| 4480 | |
| 4481 | if (argc == 2) |
| 4482 | { |
| 4483 | ret = inet_aton(argv[1], &addr); |
| 4484 | if (!ret) |
| 4485 | { |
| 4486 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4487 | VTY_NEWLINE); |
| 4488 | return CMD_WARNING; |
| 4489 | } |
| 4490 | |
| 4491 | params = ospf_get_if_params (ifp, addr); |
| 4492 | ospf_if_update_params (ifp, addr); |
| 4493 | } |
| 4494 | |
| 4495 | |
| 4496 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE + 1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4497 | strncpy ((char *) params->auth_simple, argv[0], OSPF_AUTH_SIMPLE_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4498 | SET_IF_PARAM (params, auth_simple); |
| 4499 | |
| 4500 | return CMD_SUCCESS; |
| 4501 | } |
| 4502 | |
| 4503 | ALIAS (ip_ospf_authentication_key, |
| 4504 | ip_ospf_authentication_key_cmd, |
| 4505 | "ip ospf authentication-key AUTH_KEY", |
| 4506 | "IP Information\n" |
| 4507 | "OSPF interface commands\n" |
| 4508 | "Authentication password (key)\n" |
| 4509 | "The OSPF password (key)") |
| 4510 | |
| 4511 | ALIAS (ip_ospf_authentication_key, |
| 4512 | ospf_authentication_key_cmd, |
| 4513 | "ospf authentication-key AUTH_KEY", |
| 4514 | "OSPF interface commands\n" |
| 4515 | "Authentication password (key)\n" |
| 4516 | "The OSPF password (key)") |
| 4517 | |
| 4518 | DEFUN (no_ip_ospf_authentication_key, |
| 4519 | no_ip_ospf_authentication_key_addr_cmd, |
| 4520 | "no ip ospf authentication-key A.B.C.D", |
| 4521 | NO_STR |
| 4522 | "IP Information\n" |
| 4523 | "OSPF interface commands\n" |
| 4524 | "Authentication password (key)\n" |
| 4525 | "Address of interface") |
| 4526 | { |
| 4527 | struct interface *ifp; |
| 4528 | struct in_addr addr; |
| 4529 | int ret; |
| 4530 | struct ospf_if_params *params; |
| 4531 | |
| 4532 | ifp = vty->index; |
| 4533 | params = IF_DEF_PARAMS (ifp); |
| 4534 | |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4535 | if (argc == 1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4536 | { |
Paul Jakma | 5dcf71d | 2007-05-10 03:00:09 +0000 | [diff] [blame] | 4537 | ret = inet_aton(argv[0], &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4538 | if (!ret) |
| 4539 | { |
| 4540 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4541 | VTY_NEWLINE); |
| 4542 | return CMD_WARNING; |
| 4543 | } |
| 4544 | |
| 4545 | params = ospf_lookup_if_params (ifp, addr); |
| 4546 | if (params == NULL) |
| 4547 | return CMD_SUCCESS; |
| 4548 | } |
| 4549 | |
| 4550 | memset (params->auth_simple, 0, OSPF_AUTH_SIMPLE_SIZE); |
| 4551 | UNSET_IF_PARAM (params, auth_simple); |
| 4552 | |
| 4553 | if (params != IF_DEF_PARAMS (ifp)) |
| 4554 | { |
| 4555 | ospf_free_if_params (ifp, addr); |
| 4556 | ospf_if_update_params (ifp, addr); |
| 4557 | } |
| 4558 | |
| 4559 | return CMD_SUCCESS; |
| 4560 | } |
| 4561 | |
| 4562 | ALIAS (no_ip_ospf_authentication_key, |
| 4563 | no_ip_ospf_authentication_key_cmd, |
| 4564 | "no ip ospf authentication-key", |
| 4565 | NO_STR |
| 4566 | "IP Information\n" |
| 4567 | "OSPF interface commands\n" |
| 4568 | "Authentication password (key)\n") |
| 4569 | |
| 4570 | ALIAS (no_ip_ospf_authentication_key, |
| 4571 | no_ospf_authentication_key_cmd, |
| 4572 | "no ospf authentication-key", |
| 4573 | NO_STR |
| 4574 | "OSPF interface commands\n" |
| 4575 | "Authentication password (key)\n") |
| 4576 | |
| 4577 | DEFUN (ip_ospf_message_digest_key, |
| 4578 | ip_ospf_message_digest_key_addr_cmd, |
| 4579 | "ip ospf message-digest-key <1-255> md5 KEY A.B.C.D", |
| 4580 | "IP Information\n" |
| 4581 | "OSPF interface commands\n" |
| 4582 | "Message digest authentication password (key)\n" |
| 4583 | "Key ID\n" |
| 4584 | "Use MD5 algorithm\n" |
| 4585 | "The OSPF password (key)" |
| 4586 | "Address of interface") |
| 4587 | { |
| 4588 | struct interface *ifp; |
| 4589 | struct crypt_key *ck; |
| 4590 | u_char key_id; |
| 4591 | struct in_addr addr; |
| 4592 | int ret; |
| 4593 | struct ospf_if_params *params; |
| 4594 | |
| 4595 | ifp = vty->index; |
| 4596 | params = IF_DEF_PARAMS (ifp); |
| 4597 | |
| 4598 | if (argc == 3) |
| 4599 | { |
| 4600 | ret = inet_aton(argv[2], &addr); |
| 4601 | if (!ret) |
| 4602 | { |
| 4603 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4604 | VTY_NEWLINE); |
| 4605 | return CMD_WARNING; |
| 4606 | } |
| 4607 | |
| 4608 | params = ospf_get_if_params (ifp, addr); |
| 4609 | ospf_if_update_params (ifp, addr); |
| 4610 | } |
| 4611 | |
| 4612 | key_id = strtol (argv[0], NULL, 10); |
| 4613 | if (ospf_crypt_key_lookup (params->auth_crypt, key_id) != NULL) |
| 4614 | { |
| 4615 | vty_out (vty, "OSPF: Key %d already exists%s", key_id, VTY_NEWLINE); |
| 4616 | return CMD_WARNING; |
| 4617 | } |
| 4618 | |
| 4619 | ck = ospf_crypt_key_new (); |
| 4620 | ck->key_id = (u_char) key_id; |
| 4621 | memset (ck->auth_key, 0, OSPF_AUTH_MD5_SIZE+1); |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 4622 | strncpy ((char *) ck->auth_key, argv[1], OSPF_AUTH_MD5_SIZE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4623 | |
| 4624 | ospf_crypt_key_add (params->auth_crypt, ck); |
| 4625 | SET_IF_PARAM (params, auth_crypt); |
| 4626 | |
| 4627 | return CMD_SUCCESS; |
| 4628 | } |
| 4629 | |
| 4630 | ALIAS (ip_ospf_message_digest_key, |
| 4631 | ip_ospf_message_digest_key_cmd, |
| 4632 | "ip ospf message-digest-key <1-255> md5 KEY", |
| 4633 | "IP Information\n" |
| 4634 | "OSPF interface commands\n" |
| 4635 | "Message digest authentication password (key)\n" |
| 4636 | "Key ID\n" |
| 4637 | "Use MD5 algorithm\n" |
| 4638 | "The OSPF password (key)") |
| 4639 | |
| 4640 | ALIAS (ip_ospf_message_digest_key, |
| 4641 | ospf_message_digest_key_cmd, |
| 4642 | "ospf message-digest-key <1-255> md5 KEY", |
| 4643 | "OSPF interface commands\n" |
| 4644 | "Message digest authentication password (key)\n" |
| 4645 | "Key ID\n" |
| 4646 | "Use MD5 algorithm\n" |
| 4647 | "The OSPF password (key)") |
| 4648 | |
| 4649 | DEFUN (no_ip_ospf_message_digest_key, |
| 4650 | no_ip_ospf_message_digest_key_addr_cmd, |
| 4651 | "no ip ospf message-digest-key <1-255> A.B.C.D", |
| 4652 | NO_STR |
| 4653 | "IP Information\n" |
| 4654 | "OSPF interface commands\n" |
| 4655 | "Message digest authentication password (key)\n" |
| 4656 | "Key ID\n" |
| 4657 | "Address of interface") |
| 4658 | { |
| 4659 | struct interface *ifp; |
| 4660 | struct crypt_key *ck; |
| 4661 | int key_id; |
| 4662 | struct in_addr addr; |
| 4663 | int ret; |
| 4664 | struct ospf_if_params *params; |
| 4665 | |
| 4666 | ifp = vty->index; |
| 4667 | params = IF_DEF_PARAMS (ifp); |
| 4668 | |
| 4669 | if (argc == 2) |
| 4670 | { |
| 4671 | ret = inet_aton(argv[1], &addr); |
| 4672 | if (!ret) |
| 4673 | { |
| 4674 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4675 | VTY_NEWLINE); |
| 4676 | return CMD_WARNING; |
| 4677 | } |
| 4678 | |
| 4679 | params = ospf_lookup_if_params (ifp, addr); |
| 4680 | if (params == NULL) |
| 4681 | return CMD_SUCCESS; |
| 4682 | } |
| 4683 | |
| 4684 | key_id = strtol (argv[0], NULL, 10); |
| 4685 | ck = ospf_crypt_key_lookup (params->auth_crypt, key_id); |
| 4686 | if (ck == NULL) |
| 4687 | { |
| 4688 | vty_out (vty, "OSPF: Key %d does not exist%s", key_id, VTY_NEWLINE); |
| 4689 | return CMD_WARNING; |
| 4690 | } |
| 4691 | |
| 4692 | ospf_crypt_key_delete (params->auth_crypt, key_id); |
| 4693 | |
| 4694 | if (params != IF_DEF_PARAMS (ifp)) |
| 4695 | { |
| 4696 | ospf_free_if_params (ifp, addr); |
| 4697 | ospf_if_update_params (ifp, addr); |
| 4698 | } |
| 4699 | |
| 4700 | return CMD_SUCCESS; |
| 4701 | } |
| 4702 | |
| 4703 | ALIAS (no_ip_ospf_message_digest_key, |
| 4704 | no_ip_ospf_message_digest_key_cmd, |
| 4705 | "no ip ospf message-digest-key <1-255>", |
| 4706 | NO_STR |
| 4707 | "IP Information\n" |
| 4708 | "OSPF interface commands\n" |
| 4709 | "Message digest authentication password (key)\n" |
| 4710 | "Key ID\n") |
| 4711 | |
| 4712 | ALIAS (no_ip_ospf_message_digest_key, |
| 4713 | no_ospf_message_digest_key_cmd, |
| 4714 | "no ospf message-digest-key <1-255>", |
| 4715 | NO_STR |
| 4716 | "OSPF interface commands\n" |
| 4717 | "Message digest authentication password (key)\n" |
| 4718 | "Key ID\n") |
| 4719 | |
| 4720 | DEFUN (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4721 | ip_ospf_cost_u32_inet4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4722 | "ip ospf cost <1-65535> A.B.C.D", |
| 4723 | "IP Information\n" |
| 4724 | "OSPF interface commands\n" |
| 4725 | "Interface cost\n" |
| 4726 | "Cost\n" |
| 4727 | "Address of interface") |
| 4728 | { |
| 4729 | struct interface *ifp = vty->index; |
| 4730 | u_int32_t cost; |
| 4731 | struct in_addr addr; |
| 4732 | int ret; |
| 4733 | struct ospf_if_params *params; |
| 4734 | |
| 4735 | params = IF_DEF_PARAMS (ifp); |
| 4736 | |
| 4737 | cost = strtol (argv[0], NULL, 10); |
| 4738 | |
| 4739 | /* cost range is <1-65535>. */ |
| 4740 | if (cost < 1 || cost > 65535) |
| 4741 | { |
| 4742 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4743 | return CMD_WARNING; |
| 4744 | } |
| 4745 | |
| 4746 | if (argc == 2) |
| 4747 | { |
| 4748 | ret = inet_aton(argv[1], &addr); |
| 4749 | if (!ret) |
| 4750 | { |
| 4751 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4752 | VTY_NEWLINE); |
| 4753 | return CMD_WARNING; |
| 4754 | } |
| 4755 | |
| 4756 | params = ospf_get_if_params (ifp, addr); |
| 4757 | ospf_if_update_params (ifp, addr); |
| 4758 | } |
| 4759 | |
| 4760 | SET_IF_PARAM (params, output_cost_cmd); |
| 4761 | params->output_cost_cmd = cost; |
| 4762 | |
| 4763 | ospf_if_recalculate_output_cost (ifp); |
| 4764 | |
| 4765 | return CMD_SUCCESS; |
| 4766 | } |
| 4767 | |
| 4768 | ALIAS (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4769 | ip_ospf_cost_u32_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4770 | "ip ospf cost <1-65535>", |
| 4771 | "IP Information\n" |
| 4772 | "OSPF interface commands\n" |
| 4773 | "Interface cost\n" |
| 4774 | "Cost") |
| 4775 | |
| 4776 | ALIAS (ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4777 | ospf_cost_u32_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4778 | "ospf cost <1-65535>", |
| 4779 | "OSPF interface commands\n" |
| 4780 | "Interface cost\n" |
| 4781 | "Cost") |
| 4782 | |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4783 | ALIAS (ip_ospf_cost, |
| 4784 | ospf_cost_u32_inet4_cmd, |
| 4785 | "ospf cost <1-65535> A.B.C.D", |
| 4786 | "OSPF interface commands\n" |
| 4787 | "Interface cost\n" |
| 4788 | "Cost\n" |
| 4789 | "Address of interface") |
| 4790 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4791 | DEFUN (no_ip_ospf_cost, |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4792 | no_ip_ospf_cost_inet4_cmd, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4793 | "no ip ospf cost A.B.C.D", |
| 4794 | NO_STR |
| 4795 | "IP Information\n" |
| 4796 | "OSPF interface commands\n" |
| 4797 | "Interface cost\n" |
| 4798 | "Address of interface") |
| 4799 | { |
| 4800 | struct interface *ifp = vty->index; |
| 4801 | struct in_addr addr; |
| 4802 | int ret; |
| 4803 | struct ospf_if_params *params; |
| 4804 | |
| 4805 | ifp = vty->index; |
| 4806 | params = IF_DEF_PARAMS (ifp); |
| 4807 | |
| 4808 | if (argc == 1) |
| 4809 | { |
| 4810 | ret = inet_aton(argv[0], &addr); |
| 4811 | if (!ret) |
| 4812 | { |
| 4813 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4814 | VTY_NEWLINE); |
| 4815 | return CMD_WARNING; |
| 4816 | } |
| 4817 | |
| 4818 | params = ospf_lookup_if_params (ifp, addr); |
| 4819 | if (params == NULL) |
| 4820 | return CMD_SUCCESS; |
| 4821 | } |
| 4822 | |
| 4823 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4824 | |
| 4825 | if (params != IF_DEF_PARAMS (ifp)) |
| 4826 | { |
| 4827 | ospf_free_if_params (ifp, addr); |
| 4828 | ospf_if_update_params (ifp, addr); |
| 4829 | } |
| 4830 | |
| 4831 | ospf_if_recalculate_output_cost (ifp); |
| 4832 | |
| 4833 | return CMD_SUCCESS; |
| 4834 | } |
| 4835 | |
| 4836 | ALIAS (no_ip_ospf_cost, |
| 4837 | no_ip_ospf_cost_cmd, |
| 4838 | "no ip ospf cost", |
| 4839 | NO_STR |
| 4840 | "IP Information\n" |
| 4841 | "OSPF interface commands\n" |
| 4842 | "Interface cost\n") |
| 4843 | |
| 4844 | ALIAS (no_ip_ospf_cost, |
| 4845 | no_ospf_cost_cmd, |
| 4846 | "no ospf cost", |
| 4847 | NO_STR |
| 4848 | "OSPF interface commands\n" |
| 4849 | "Interface cost\n") |
| 4850 | |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4851 | ALIAS (no_ip_ospf_cost, |
| 4852 | no_ospf_cost_inet4_cmd, |
| 4853 | "no ospf cost A.B.C.D", |
| 4854 | NO_STR |
| 4855 | "OSPF interface commands\n" |
| 4856 | "Interface cost\n" |
| 4857 | "Address of interface") |
| 4858 | |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 4859 | DEFUN (no_ip_ospf_cost2, |
| 4860 | no_ip_ospf_cost_u32_cmd, |
| 4861 | "no ip ospf cost <1-65535>", |
| 4862 | NO_STR |
| 4863 | "IP Information\n" |
| 4864 | "OSPF interface commands\n" |
| 4865 | "Interface cost\n" |
| 4866 | "Cost") |
| 4867 | { |
| 4868 | struct interface *ifp = vty->index; |
| 4869 | struct in_addr addr; |
| 4870 | u_int32_t cost; |
| 4871 | int ret; |
| 4872 | struct ospf_if_params *params; |
| 4873 | |
| 4874 | ifp = vty->index; |
| 4875 | params = IF_DEF_PARAMS (ifp); |
| 4876 | |
| 4877 | /* According to the semantics we are mimicking "no ip ospf cost N" is |
| 4878 | * always treated as "no ip ospf cost" regardless of the actual value |
| 4879 | * of N already configured for the interface. Thus the first argument |
| 4880 | * is always checked to be a number, but is ignored after that. |
| 4881 | */ |
| 4882 | cost = strtol (argv[0], NULL, 10); |
| 4883 | if (cost < 1 || cost > 65535) |
| 4884 | { |
| 4885 | vty_out (vty, "Interface output cost is invalid%s", VTY_NEWLINE); |
| 4886 | return CMD_WARNING; |
| 4887 | } |
| 4888 | |
| 4889 | if (argc == 2) |
| 4890 | { |
| 4891 | ret = inet_aton(argv[1], &addr); |
| 4892 | if (!ret) |
| 4893 | { |
| 4894 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4895 | VTY_NEWLINE); |
| 4896 | return CMD_WARNING; |
| 4897 | } |
| 4898 | |
| 4899 | params = ospf_lookup_if_params (ifp, addr); |
| 4900 | if (params == NULL) |
| 4901 | return CMD_SUCCESS; |
| 4902 | } |
| 4903 | |
| 4904 | UNSET_IF_PARAM (params, output_cost_cmd); |
| 4905 | |
| 4906 | if (params != IF_DEF_PARAMS (ifp)) |
| 4907 | { |
| 4908 | ospf_free_if_params (ifp, addr); |
| 4909 | ospf_if_update_params (ifp, addr); |
| 4910 | } |
| 4911 | |
| 4912 | ospf_if_recalculate_output_cost (ifp); |
| 4913 | |
| 4914 | return CMD_SUCCESS; |
| 4915 | } |
| 4916 | |
| 4917 | ALIAS (no_ip_ospf_cost2, |
| 4918 | no_ospf_cost_u32_cmd, |
| 4919 | "no ospf cost <1-65535>", |
| 4920 | NO_STR |
| 4921 | "OSPF interface commands\n" |
| 4922 | "Interface cost\n" |
| 4923 | "Cost") |
| 4924 | |
| 4925 | ALIAS (no_ip_ospf_cost2, |
| 4926 | no_ip_ospf_cost_u32_inet4_cmd, |
| 4927 | "no ip ospf cost <1-65535> A.B.C.D", |
| 4928 | NO_STR |
| 4929 | "IP Information\n" |
| 4930 | "OSPF interface commands\n" |
| 4931 | "Interface cost\n" |
| 4932 | "Cost\n" |
| 4933 | "Address of interface") |
| 4934 | |
| 4935 | ALIAS (no_ip_ospf_cost2, |
| 4936 | no_ospf_cost_u32_inet4_cmd, |
| 4937 | "no ospf cost <1-65535> A.B.C.D", |
| 4938 | NO_STR |
| 4939 | "OSPF interface commands\n" |
| 4940 | "Interface cost\n" |
| 4941 | "Cost\n" |
| 4942 | "Address of interface") |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 4943 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 4944 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4945 | ospf_nbr_timer_update (struct ospf_interface *oi) |
| 4946 | { |
| 4947 | struct route_node *rn; |
| 4948 | struct ospf_neighbor *nbr; |
| 4949 | |
| 4950 | for (rn = route_top (oi->nbrs); rn; rn = route_next (rn)) |
| 4951 | if ((nbr = rn->info)) |
| 4952 | { |
| 4953 | nbr->v_inactivity = OSPF_IF_PARAM (oi, v_wait); |
| 4954 | nbr->v_db_desc = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4955 | nbr->v_ls_req = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4956 | nbr->v_ls_upd = OSPF_IF_PARAM (oi, retransmit_interval); |
| 4957 | } |
| 4958 | } |
| 4959 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4960 | static int |
| 4961 | ospf_vty_dead_interval_set (struct vty *vty, const char *interval_str, |
| 4962 | const char *nbr_str, |
| 4963 | const char *fast_hello_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4964 | { |
| 4965 | struct interface *ifp = vty->index; |
| 4966 | u_int32_t seconds; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4967 | u_char hellomult; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4968 | struct in_addr addr; |
| 4969 | int ret; |
| 4970 | struct ospf_if_params *params; |
| 4971 | struct ospf_interface *oi; |
| 4972 | struct route_node *rn; |
| 4973 | |
| 4974 | params = IF_DEF_PARAMS (ifp); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4975 | |
| 4976 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4977 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4978 | ret = inet_aton(nbr_str, &addr); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 4979 | if (!ret) |
| 4980 | { |
| 4981 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 4982 | VTY_NEWLINE); |
| 4983 | return CMD_WARNING; |
| 4984 | } |
| 4985 | |
| 4986 | params = ospf_get_if_params (ifp, addr); |
| 4987 | ospf_if_update_params (ifp, addr); |
| 4988 | } |
| 4989 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 4990 | if (interval_str) |
| 4991 | { |
| 4992 | VTY_GET_INTEGER_RANGE ("Router Dead Interval", seconds, interval_str, |
| 4993 | 1, 65535); |
| 4994 | |
| 4995 | /* reset fast_hello too, just to be sure */ |
| 4996 | UNSET_IF_PARAM (params, fast_hello); |
| 4997 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 4998 | } |
| 4999 | else if (fast_hello_str) |
| 5000 | { |
| 5001 | VTY_GET_INTEGER_RANGE ("Hello Multiplier", hellomult, fast_hello_str, |
| 5002 | 1, 10); |
| 5003 | /* 1s dead-interval with sub-second hellos desired */ |
| 5004 | seconds = OSPF_ROUTER_DEAD_INTERVAL_MINIMAL; |
| 5005 | SET_IF_PARAM (params, fast_hello); |
| 5006 | params->fast_hello = hellomult; |
| 5007 | } |
| 5008 | else |
| 5009 | { |
| 5010 | vty_out (vty, "Please specify dead-interval or hello-multiplier%s", |
| 5011 | VTY_NEWLINE); |
| 5012 | return CMD_WARNING; |
| 5013 | } |
| 5014 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5015 | SET_IF_PARAM (params, v_wait); |
| 5016 | params->v_wait = seconds; |
| 5017 | |
| 5018 | /* Update timer values in neighbor structure. */ |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5019 | if (nbr_str) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5020 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 5021 | struct ospf *ospf; |
| 5022 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5023 | { |
| 5024 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 5025 | if (oi) |
| 5026 | ospf_nbr_timer_update (oi); |
| 5027 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5028 | } |
| 5029 | else |
| 5030 | { |
| 5031 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5032 | if ((oi = rn->info)) |
| 5033 | ospf_nbr_timer_update (oi); |
| 5034 | } |
| 5035 | |
| 5036 | return CMD_SUCCESS; |
| 5037 | } |
| 5038 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5039 | |
| 5040 | DEFUN (ip_ospf_dead_interval, |
| 5041 | ip_ospf_dead_interval_addr_cmd, |
| 5042 | "ip ospf dead-interval <1-65535> A.B.C.D", |
| 5043 | "IP Information\n" |
| 5044 | "OSPF interface commands\n" |
| 5045 | "Interval after which a neighbor is declared dead\n" |
| 5046 | "Seconds\n" |
| 5047 | "Address of interface\n") |
| 5048 | { |
| 5049 | if (argc == 2) |
| 5050 | return ospf_vty_dead_interval_set (vty, argv[0], argv[1], NULL); |
| 5051 | else |
| 5052 | return ospf_vty_dead_interval_set (vty, argv[0], NULL, NULL); |
| 5053 | } |
| 5054 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5055 | ALIAS (ip_ospf_dead_interval, |
| 5056 | ip_ospf_dead_interval_cmd, |
| 5057 | "ip ospf dead-interval <1-65535>", |
| 5058 | "IP Information\n" |
| 5059 | "OSPF interface commands\n" |
| 5060 | "Interval after which a neighbor is declared dead\n" |
| 5061 | "Seconds\n") |
| 5062 | |
| 5063 | ALIAS (ip_ospf_dead_interval, |
| 5064 | ospf_dead_interval_cmd, |
| 5065 | "ospf dead-interval <1-65535>", |
| 5066 | "OSPF interface commands\n" |
| 5067 | "Interval after which a neighbor is declared dead\n" |
| 5068 | "Seconds\n") |
| 5069 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5070 | DEFUN (ip_ospf_dead_interval_minimal, |
| 5071 | ip_ospf_dead_interval_minimal_addr_cmd, |
| 5072 | "ip ospf dead-interval minimal hello-multiplier <1-10> A.B.C.D", |
| 5073 | "IP Information\n" |
| 5074 | "OSPF interface commands\n" |
| 5075 | "Interval after which a neighbor is declared dead\n" |
| 5076 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 5077 | "Hello multiplier factor\n" |
| 5078 | "Number of Hellos to send each second\n" |
| 5079 | "Address of interface\n") |
| 5080 | { |
| 5081 | if (argc == 2) |
| 5082 | return ospf_vty_dead_interval_set (vty, NULL, argv[1], argv[0]); |
| 5083 | else |
| 5084 | return ospf_vty_dead_interval_set (vty, NULL, NULL, argv[0]); |
| 5085 | } |
| 5086 | |
| 5087 | ALIAS (ip_ospf_dead_interval_minimal, |
| 5088 | ip_ospf_dead_interval_minimal_cmd, |
| 5089 | "ip ospf dead-interval minimal hello-multiplier <1-10>", |
| 5090 | "IP Information\n" |
| 5091 | "OSPF interface commands\n" |
| 5092 | "Interval after which a neighbor is declared dead\n" |
| 5093 | "Minimal 1s dead-interval with fast sub-second hellos\n" |
| 5094 | "Hello multiplier factor\n" |
| 5095 | "Number of Hellos to send each second\n") |
| 5096 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5097 | DEFUN (no_ip_ospf_dead_interval, |
| 5098 | no_ip_ospf_dead_interval_addr_cmd, |
| 5099 | "no ip ospf dead-interval A.B.C.D", |
| 5100 | NO_STR |
| 5101 | "IP Information\n" |
| 5102 | "OSPF interface commands\n" |
| 5103 | "Interval after which a neighbor is declared dead\n" |
| 5104 | "Address of interface") |
| 5105 | { |
| 5106 | struct interface *ifp = vty->index; |
| 5107 | struct in_addr addr; |
| 5108 | int ret; |
| 5109 | struct ospf_if_params *params; |
| 5110 | struct ospf_interface *oi; |
| 5111 | struct route_node *rn; |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5112 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5113 | ifp = vty->index; |
| 5114 | params = IF_DEF_PARAMS (ifp); |
| 5115 | |
| 5116 | if (argc == 1) |
| 5117 | { |
| 5118 | ret = inet_aton(argv[0], &addr); |
| 5119 | if (!ret) |
| 5120 | { |
| 5121 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5122 | VTY_NEWLINE); |
| 5123 | return CMD_WARNING; |
| 5124 | } |
| 5125 | |
| 5126 | params = ospf_lookup_if_params (ifp, addr); |
| 5127 | if (params == NULL) |
| 5128 | return CMD_SUCCESS; |
| 5129 | } |
| 5130 | |
| 5131 | UNSET_IF_PARAM (params, v_wait); |
| 5132 | params->v_wait = OSPF_ROUTER_DEAD_INTERVAL_DEFAULT; |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5133 | |
| 5134 | UNSET_IF_PARAM (params, fast_hello); |
| 5135 | params->fast_hello = OSPF_FAST_HELLO_DEFAULT; |
| 5136 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5137 | if (params != IF_DEF_PARAMS (ifp)) |
| 5138 | { |
| 5139 | ospf_free_if_params (ifp, addr); |
| 5140 | ospf_if_update_params (ifp, addr); |
| 5141 | } |
| 5142 | |
| 5143 | /* Update timer values in neighbor structure. */ |
| 5144 | if (argc == 1) |
| 5145 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 5146 | struct ospf *ospf; |
| 5147 | |
| 5148 | if ((ospf = ospf_lookup())) |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 5149 | { |
| 5150 | oi = ospf_if_lookup_by_local_addr (ospf, ifp, addr); |
| 5151 | if (oi) |
| 5152 | ospf_nbr_timer_update (oi); |
| 5153 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5154 | } |
| 5155 | else |
| 5156 | { |
| 5157 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5158 | if ((oi = rn->info)) |
| 5159 | ospf_nbr_timer_update (oi); |
| 5160 | } |
| 5161 | |
| 5162 | return CMD_SUCCESS; |
| 5163 | } |
| 5164 | |
| 5165 | ALIAS (no_ip_ospf_dead_interval, |
| 5166 | no_ip_ospf_dead_interval_cmd, |
| 5167 | "no ip ospf dead-interval", |
| 5168 | NO_STR |
| 5169 | "IP Information\n" |
| 5170 | "OSPF interface commands\n" |
| 5171 | "Interval after which a neighbor is declared dead\n") |
| 5172 | |
| 5173 | ALIAS (no_ip_ospf_dead_interval, |
| 5174 | no_ospf_dead_interval_cmd, |
| 5175 | "no ospf dead-interval", |
| 5176 | NO_STR |
| 5177 | "OSPF interface commands\n" |
| 5178 | "Interval after which a neighbor is declared dead\n") |
| 5179 | |
| 5180 | DEFUN (ip_ospf_hello_interval, |
| 5181 | ip_ospf_hello_interval_addr_cmd, |
| 5182 | "ip ospf hello-interval <1-65535> A.B.C.D", |
| 5183 | "IP Information\n" |
| 5184 | "OSPF interface commands\n" |
| 5185 | "Time between HELLO packets\n" |
| 5186 | "Seconds\n" |
| 5187 | "Address of interface") |
| 5188 | { |
| 5189 | struct interface *ifp = vty->index; |
| 5190 | u_int32_t seconds; |
| 5191 | struct in_addr addr; |
| 5192 | int ret; |
| 5193 | struct ospf_if_params *params; |
| 5194 | |
| 5195 | params = IF_DEF_PARAMS (ifp); |
| 5196 | |
| 5197 | seconds = strtol (argv[0], NULL, 10); |
| 5198 | |
| 5199 | /* HelloInterval range is <1-65535>. */ |
| 5200 | if (seconds < 1 || seconds > 65535) |
| 5201 | { |
| 5202 | vty_out (vty, "Hello Interval is invalid%s", VTY_NEWLINE); |
| 5203 | return CMD_WARNING; |
| 5204 | } |
| 5205 | |
| 5206 | if (argc == 2) |
| 5207 | { |
| 5208 | ret = inet_aton(argv[1], &addr); |
| 5209 | if (!ret) |
| 5210 | { |
| 5211 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5212 | VTY_NEWLINE); |
| 5213 | return CMD_WARNING; |
| 5214 | } |
| 5215 | |
| 5216 | params = ospf_get_if_params (ifp, addr); |
| 5217 | ospf_if_update_params (ifp, addr); |
| 5218 | } |
| 5219 | |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5220 | SET_IF_PARAM (params, v_hello); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5221 | params->v_hello = seconds; |
| 5222 | |
| 5223 | return CMD_SUCCESS; |
| 5224 | } |
| 5225 | |
| 5226 | ALIAS (ip_ospf_hello_interval, |
| 5227 | ip_ospf_hello_interval_cmd, |
| 5228 | "ip ospf hello-interval <1-65535>", |
| 5229 | "IP Information\n" |
| 5230 | "OSPF interface commands\n" |
| 5231 | "Time between HELLO packets\n" |
| 5232 | "Seconds\n") |
| 5233 | |
| 5234 | ALIAS (ip_ospf_hello_interval, |
| 5235 | ospf_hello_interval_cmd, |
| 5236 | "ospf hello-interval <1-65535>", |
| 5237 | "OSPF interface commands\n" |
| 5238 | "Time between HELLO packets\n" |
| 5239 | "Seconds\n") |
| 5240 | |
| 5241 | DEFUN (no_ip_ospf_hello_interval, |
| 5242 | no_ip_ospf_hello_interval_addr_cmd, |
| 5243 | "no ip ospf hello-interval A.B.C.D", |
| 5244 | NO_STR |
| 5245 | "IP Information\n" |
| 5246 | "OSPF interface commands\n" |
| 5247 | "Time between HELLO packets\n" |
| 5248 | "Address of interface") |
| 5249 | { |
| 5250 | struct interface *ifp = vty->index; |
| 5251 | struct in_addr addr; |
| 5252 | int ret; |
| 5253 | struct ospf_if_params *params; |
| 5254 | |
| 5255 | ifp = vty->index; |
| 5256 | params = IF_DEF_PARAMS (ifp); |
| 5257 | |
| 5258 | if (argc == 1) |
| 5259 | { |
| 5260 | ret = inet_aton(argv[0], &addr); |
| 5261 | if (!ret) |
| 5262 | { |
| 5263 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5264 | VTY_NEWLINE); |
| 5265 | return CMD_WARNING; |
| 5266 | } |
| 5267 | |
| 5268 | params = ospf_lookup_if_params (ifp, addr); |
| 5269 | if (params == NULL) |
| 5270 | return CMD_SUCCESS; |
| 5271 | } |
| 5272 | |
| 5273 | UNSET_IF_PARAM (params, v_hello); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 5274 | params->v_hello = OSPF_HELLO_INTERVAL_DEFAULT; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5275 | |
| 5276 | if (params != IF_DEF_PARAMS (ifp)) |
| 5277 | { |
| 5278 | ospf_free_if_params (ifp, addr); |
| 5279 | ospf_if_update_params (ifp, addr); |
| 5280 | } |
| 5281 | |
| 5282 | return CMD_SUCCESS; |
| 5283 | } |
| 5284 | |
| 5285 | ALIAS (no_ip_ospf_hello_interval, |
| 5286 | no_ip_ospf_hello_interval_cmd, |
| 5287 | "no ip ospf hello-interval", |
| 5288 | NO_STR |
| 5289 | "IP Information\n" |
| 5290 | "OSPF interface commands\n" |
| 5291 | "Time between HELLO packets\n") |
| 5292 | |
| 5293 | ALIAS (no_ip_ospf_hello_interval, |
| 5294 | no_ospf_hello_interval_cmd, |
| 5295 | "no ospf hello-interval", |
| 5296 | NO_STR |
| 5297 | "OSPF interface commands\n" |
| 5298 | "Time between HELLO packets\n") |
| 5299 | |
| 5300 | DEFUN (ip_ospf_network, |
| 5301 | ip_ospf_network_cmd, |
| 5302 | "ip ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5303 | "IP Information\n" |
| 5304 | "OSPF interface commands\n" |
| 5305 | "Network type\n" |
| 5306 | "Specify OSPF broadcast multi-access network\n" |
| 5307 | "Specify OSPF NBMA network\n" |
| 5308 | "Specify OSPF point-to-multipoint network\n" |
| 5309 | "Specify OSPF point-to-point network\n") |
| 5310 | { |
| 5311 | struct interface *ifp = vty->index; |
| 5312 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5313 | struct route_node *rn; |
| 5314 | |
| 5315 | if (strncmp (argv[0], "b", 1) == 0) |
| 5316 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_BROADCAST; |
| 5317 | else if (strncmp (argv[0], "n", 1) == 0) |
| 5318 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_NBMA; |
| 5319 | else if (strncmp (argv[0], "point-to-m", 10) == 0) |
| 5320 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOMULTIPOINT; |
| 5321 | else if (strncmp (argv[0], "point-to-p", 10) == 0) |
| 5322 | IF_DEF_PARAMS (ifp)->type = OSPF_IFTYPE_POINTOPOINT; |
| 5323 | |
| 5324 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5325 | return CMD_SUCCESS; |
| 5326 | |
| 5327 | SET_IF_PARAM (IF_DEF_PARAMS (ifp), type); |
| 5328 | |
| 5329 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5330 | { |
| 5331 | struct ospf_interface *oi = rn->info; |
| 5332 | |
| 5333 | if (!oi) |
| 5334 | continue; |
| 5335 | |
| 5336 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5337 | |
| 5338 | if (oi->state > ISM_Down) |
| 5339 | { |
| 5340 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5341 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5342 | } |
| 5343 | } |
| 5344 | |
| 5345 | return CMD_SUCCESS; |
| 5346 | } |
| 5347 | |
| 5348 | ALIAS (ip_ospf_network, |
| 5349 | ospf_network_cmd, |
| 5350 | "ospf network (broadcast|non-broadcast|point-to-multipoint|point-to-point)", |
| 5351 | "OSPF interface commands\n" |
| 5352 | "Network type\n" |
| 5353 | "Specify OSPF broadcast multi-access network\n" |
| 5354 | "Specify OSPF NBMA network\n" |
| 5355 | "Specify OSPF point-to-multipoint network\n" |
| 5356 | "Specify OSPF point-to-point network\n") |
| 5357 | |
| 5358 | DEFUN (no_ip_ospf_network, |
| 5359 | no_ip_ospf_network_cmd, |
| 5360 | "no ip ospf network", |
| 5361 | NO_STR |
| 5362 | "IP Information\n" |
| 5363 | "OSPF interface commands\n" |
| 5364 | "Network type\n") |
| 5365 | { |
| 5366 | struct interface *ifp = vty->index; |
| 5367 | int old_type = IF_DEF_PARAMS (ifp)->type; |
| 5368 | struct route_node *rn; |
| 5369 | |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 5370 | IF_DEF_PARAMS (ifp)->type = ospf_default_iftype(ifp); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5371 | |
| 5372 | if (IF_DEF_PARAMS (ifp)->type == old_type) |
| 5373 | return CMD_SUCCESS; |
| 5374 | |
| 5375 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5376 | { |
| 5377 | struct ospf_interface *oi = rn->info; |
| 5378 | |
| 5379 | if (!oi) |
| 5380 | continue; |
| 5381 | |
| 5382 | oi->type = IF_DEF_PARAMS (ifp)->type; |
| 5383 | |
| 5384 | if (oi->state > ISM_Down) |
| 5385 | { |
| 5386 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceDown); |
| 5387 | OSPF_ISM_EVENT_EXECUTE (oi, ISM_InterfaceUp); |
| 5388 | } |
| 5389 | } |
| 5390 | |
| 5391 | return CMD_SUCCESS; |
| 5392 | } |
| 5393 | |
| 5394 | ALIAS (no_ip_ospf_network, |
| 5395 | no_ospf_network_cmd, |
| 5396 | "no ospf network", |
| 5397 | NO_STR |
| 5398 | "OSPF interface commands\n" |
| 5399 | "Network type\n") |
| 5400 | |
| 5401 | DEFUN (ip_ospf_priority, |
| 5402 | ip_ospf_priority_addr_cmd, |
| 5403 | "ip ospf priority <0-255> A.B.C.D", |
| 5404 | "IP Information\n" |
| 5405 | "OSPF interface commands\n" |
| 5406 | "Router priority\n" |
| 5407 | "Priority\n" |
| 5408 | "Address of interface") |
| 5409 | { |
| 5410 | struct interface *ifp = vty->index; |
| 5411 | u_int32_t priority; |
| 5412 | struct route_node *rn; |
| 5413 | struct in_addr addr; |
| 5414 | int ret; |
| 5415 | struct ospf_if_params *params; |
| 5416 | |
| 5417 | params = IF_DEF_PARAMS (ifp); |
| 5418 | |
| 5419 | priority = strtol (argv[0], NULL, 10); |
| 5420 | |
| 5421 | /* Router Priority range is <0-255>. */ |
| 5422 | if (priority < 0 || priority > 255) |
| 5423 | { |
| 5424 | vty_out (vty, "Router Priority is invalid%s", VTY_NEWLINE); |
| 5425 | return CMD_WARNING; |
| 5426 | } |
| 5427 | |
| 5428 | if (argc == 2) |
| 5429 | { |
| 5430 | ret = inet_aton(argv[1], &addr); |
| 5431 | if (!ret) |
| 5432 | { |
| 5433 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5434 | VTY_NEWLINE); |
| 5435 | return CMD_WARNING; |
| 5436 | } |
| 5437 | |
| 5438 | params = ospf_get_if_params (ifp, addr); |
| 5439 | ospf_if_update_params (ifp, addr); |
| 5440 | } |
| 5441 | |
| 5442 | SET_IF_PARAM (params, priority); |
| 5443 | params->priority = priority; |
| 5444 | |
| 5445 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5446 | { |
| 5447 | struct ospf_interface *oi = rn->info; |
| 5448 | |
| 5449 | if (!oi) |
| 5450 | continue; |
| 5451 | |
| 5452 | |
| 5453 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5454 | { |
| 5455 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5456 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5457 | } |
| 5458 | } |
| 5459 | |
| 5460 | return CMD_SUCCESS; |
| 5461 | } |
| 5462 | |
| 5463 | ALIAS (ip_ospf_priority, |
| 5464 | ip_ospf_priority_cmd, |
| 5465 | "ip ospf priority <0-255>", |
| 5466 | "IP Information\n" |
| 5467 | "OSPF interface commands\n" |
| 5468 | "Router priority\n" |
| 5469 | "Priority\n") |
| 5470 | |
| 5471 | ALIAS (ip_ospf_priority, |
| 5472 | ospf_priority_cmd, |
| 5473 | "ospf priority <0-255>", |
| 5474 | "OSPF interface commands\n" |
| 5475 | "Router priority\n" |
| 5476 | "Priority\n") |
| 5477 | |
| 5478 | DEFUN (no_ip_ospf_priority, |
| 5479 | no_ip_ospf_priority_addr_cmd, |
| 5480 | "no ip ospf priority A.B.C.D", |
| 5481 | NO_STR |
| 5482 | "IP Information\n" |
| 5483 | "OSPF interface commands\n" |
| 5484 | "Router priority\n" |
| 5485 | "Address of interface") |
| 5486 | { |
| 5487 | struct interface *ifp = vty->index; |
| 5488 | struct route_node *rn; |
| 5489 | struct in_addr addr; |
| 5490 | int ret; |
| 5491 | struct ospf_if_params *params; |
| 5492 | |
| 5493 | ifp = vty->index; |
| 5494 | params = IF_DEF_PARAMS (ifp); |
| 5495 | |
| 5496 | if (argc == 1) |
| 5497 | { |
| 5498 | ret = inet_aton(argv[0], &addr); |
| 5499 | if (!ret) |
| 5500 | { |
| 5501 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5502 | VTY_NEWLINE); |
| 5503 | return CMD_WARNING; |
| 5504 | } |
| 5505 | |
| 5506 | params = ospf_lookup_if_params (ifp, addr); |
| 5507 | if (params == NULL) |
| 5508 | return CMD_SUCCESS; |
| 5509 | } |
| 5510 | |
| 5511 | UNSET_IF_PARAM (params, priority); |
| 5512 | params->priority = OSPF_ROUTER_PRIORITY_DEFAULT; |
| 5513 | |
| 5514 | if (params != IF_DEF_PARAMS (ifp)) |
| 5515 | { |
| 5516 | ospf_free_if_params (ifp, addr); |
| 5517 | ospf_if_update_params (ifp, addr); |
| 5518 | } |
| 5519 | |
| 5520 | for (rn = route_top (IF_OIFS (ifp)); rn; rn = route_next (rn)) |
| 5521 | { |
| 5522 | struct ospf_interface *oi = rn->info; |
| 5523 | |
| 5524 | if (!oi) |
| 5525 | continue; |
| 5526 | |
| 5527 | |
| 5528 | if (PRIORITY (oi) != OSPF_IF_PARAM (oi, priority)) |
| 5529 | { |
| 5530 | PRIORITY (oi) = OSPF_IF_PARAM (oi, priority); |
| 5531 | OSPF_ISM_EVENT_SCHEDULE (oi, ISM_NeighborChange); |
| 5532 | } |
| 5533 | } |
| 5534 | |
| 5535 | return CMD_SUCCESS; |
| 5536 | } |
| 5537 | |
| 5538 | ALIAS (no_ip_ospf_priority, |
| 5539 | no_ip_ospf_priority_cmd, |
| 5540 | "no ip ospf priority", |
| 5541 | NO_STR |
| 5542 | "IP Information\n" |
| 5543 | "OSPF interface commands\n" |
| 5544 | "Router priority\n") |
| 5545 | |
| 5546 | ALIAS (no_ip_ospf_priority, |
| 5547 | no_ospf_priority_cmd, |
| 5548 | "no ospf priority", |
| 5549 | NO_STR |
| 5550 | "OSPF interface commands\n" |
| 5551 | "Router priority\n") |
| 5552 | |
| 5553 | DEFUN (ip_ospf_retransmit_interval, |
| 5554 | ip_ospf_retransmit_interval_addr_cmd, |
| 5555 | "ip ospf retransmit-interval <3-65535> A.B.C.D", |
| 5556 | "IP Information\n" |
| 5557 | "OSPF interface commands\n" |
| 5558 | "Time between retransmitting lost link state advertisements\n" |
| 5559 | "Seconds\n" |
| 5560 | "Address of interface") |
| 5561 | { |
| 5562 | struct interface *ifp = vty->index; |
| 5563 | u_int32_t seconds; |
| 5564 | struct in_addr addr; |
| 5565 | int ret; |
| 5566 | struct ospf_if_params *params; |
| 5567 | |
| 5568 | params = IF_DEF_PARAMS (ifp); |
| 5569 | seconds = strtol (argv[0], NULL, 10); |
| 5570 | |
| 5571 | /* Retransmit Interval range is <3-65535>. */ |
| 5572 | if (seconds < 3 || seconds > 65535) |
| 5573 | { |
| 5574 | vty_out (vty, "Retransmit Interval is invalid%s", VTY_NEWLINE); |
| 5575 | return CMD_WARNING; |
| 5576 | } |
| 5577 | |
| 5578 | |
| 5579 | if (argc == 2) |
| 5580 | { |
| 5581 | ret = inet_aton(argv[1], &addr); |
| 5582 | if (!ret) |
| 5583 | { |
| 5584 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5585 | VTY_NEWLINE); |
| 5586 | return CMD_WARNING; |
| 5587 | } |
| 5588 | |
| 5589 | params = ospf_get_if_params (ifp, addr); |
| 5590 | ospf_if_update_params (ifp, addr); |
| 5591 | } |
| 5592 | |
| 5593 | SET_IF_PARAM (params, retransmit_interval); |
| 5594 | params->retransmit_interval = seconds; |
| 5595 | |
| 5596 | return CMD_SUCCESS; |
| 5597 | } |
| 5598 | |
| 5599 | ALIAS (ip_ospf_retransmit_interval, |
| 5600 | ip_ospf_retransmit_interval_cmd, |
| 5601 | "ip ospf retransmit-interval <3-65535>", |
| 5602 | "IP Information\n" |
| 5603 | "OSPF interface commands\n" |
| 5604 | "Time between retransmitting lost link state advertisements\n" |
| 5605 | "Seconds\n") |
| 5606 | |
| 5607 | ALIAS (ip_ospf_retransmit_interval, |
| 5608 | ospf_retransmit_interval_cmd, |
| 5609 | "ospf retransmit-interval <3-65535>", |
| 5610 | "OSPF interface commands\n" |
| 5611 | "Time between retransmitting lost link state advertisements\n" |
| 5612 | "Seconds\n") |
| 5613 | |
| 5614 | DEFUN (no_ip_ospf_retransmit_interval, |
| 5615 | no_ip_ospf_retransmit_interval_addr_cmd, |
| 5616 | "no ip ospf retransmit-interval A.B.C.D", |
| 5617 | NO_STR |
| 5618 | "IP Information\n" |
| 5619 | "OSPF interface commands\n" |
| 5620 | "Time between retransmitting lost link state advertisements\n" |
| 5621 | "Address of interface") |
| 5622 | { |
| 5623 | struct interface *ifp = vty->index; |
| 5624 | struct in_addr addr; |
| 5625 | int ret; |
| 5626 | struct ospf_if_params *params; |
| 5627 | |
| 5628 | ifp = vty->index; |
| 5629 | params = IF_DEF_PARAMS (ifp); |
| 5630 | |
| 5631 | if (argc == 1) |
| 5632 | { |
| 5633 | ret = inet_aton(argv[0], &addr); |
| 5634 | if (!ret) |
| 5635 | { |
| 5636 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5637 | VTY_NEWLINE); |
| 5638 | return CMD_WARNING; |
| 5639 | } |
| 5640 | |
| 5641 | params = ospf_lookup_if_params (ifp, addr); |
| 5642 | if (params == NULL) |
| 5643 | return CMD_SUCCESS; |
| 5644 | } |
| 5645 | |
| 5646 | UNSET_IF_PARAM (params, retransmit_interval); |
| 5647 | params->retransmit_interval = OSPF_RETRANSMIT_INTERVAL_DEFAULT; |
| 5648 | |
| 5649 | if (params != IF_DEF_PARAMS (ifp)) |
| 5650 | { |
| 5651 | ospf_free_if_params (ifp, addr); |
| 5652 | ospf_if_update_params (ifp, addr); |
| 5653 | } |
| 5654 | |
| 5655 | return CMD_SUCCESS; |
| 5656 | } |
| 5657 | |
| 5658 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5659 | no_ip_ospf_retransmit_interval_cmd, |
| 5660 | "no ip ospf retransmit-interval", |
| 5661 | NO_STR |
| 5662 | "IP Information\n" |
| 5663 | "OSPF interface commands\n" |
| 5664 | "Time between retransmitting lost link state advertisements\n") |
| 5665 | |
| 5666 | ALIAS (no_ip_ospf_retransmit_interval, |
| 5667 | no_ospf_retransmit_interval_cmd, |
| 5668 | "no ospf retransmit-interval", |
| 5669 | NO_STR |
| 5670 | "OSPF interface commands\n" |
| 5671 | "Time between retransmitting lost link state advertisements\n") |
| 5672 | |
| 5673 | DEFUN (ip_ospf_transmit_delay, |
| 5674 | ip_ospf_transmit_delay_addr_cmd, |
| 5675 | "ip ospf transmit-delay <1-65535> A.B.C.D", |
| 5676 | "IP Information\n" |
| 5677 | "OSPF interface commands\n" |
| 5678 | "Link state transmit delay\n" |
| 5679 | "Seconds\n" |
| 5680 | "Address of interface") |
| 5681 | { |
| 5682 | struct interface *ifp = vty->index; |
| 5683 | u_int32_t seconds; |
| 5684 | struct in_addr addr; |
| 5685 | int ret; |
| 5686 | struct ospf_if_params *params; |
| 5687 | |
| 5688 | params = IF_DEF_PARAMS (ifp); |
| 5689 | seconds = strtol (argv[0], NULL, 10); |
| 5690 | |
| 5691 | /* Transmit Delay range is <1-65535>. */ |
| 5692 | if (seconds < 1 || seconds > 65535) |
| 5693 | { |
| 5694 | vty_out (vty, "Transmit Delay is invalid%s", VTY_NEWLINE); |
| 5695 | return CMD_WARNING; |
| 5696 | } |
| 5697 | |
| 5698 | if (argc == 2) |
| 5699 | { |
| 5700 | ret = inet_aton(argv[1], &addr); |
| 5701 | if (!ret) |
| 5702 | { |
| 5703 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5704 | VTY_NEWLINE); |
| 5705 | return CMD_WARNING; |
| 5706 | } |
| 5707 | |
| 5708 | params = ospf_get_if_params (ifp, addr); |
| 5709 | ospf_if_update_params (ifp, addr); |
| 5710 | } |
| 5711 | |
| 5712 | SET_IF_PARAM (params, transmit_delay); |
| 5713 | params->transmit_delay = seconds; |
| 5714 | |
| 5715 | return CMD_SUCCESS; |
| 5716 | } |
| 5717 | |
| 5718 | ALIAS (ip_ospf_transmit_delay, |
| 5719 | ip_ospf_transmit_delay_cmd, |
| 5720 | "ip ospf transmit-delay <1-65535>", |
| 5721 | "IP Information\n" |
| 5722 | "OSPF interface commands\n" |
| 5723 | "Link state transmit delay\n" |
| 5724 | "Seconds\n") |
| 5725 | |
| 5726 | ALIAS (ip_ospf_transmit_delay, |
| 5727 | ospf_transmit_delay_cmd, |
| 5728 | "ospf transmit-delay <1-65535>", |
| 5729 | "OSPF interface commands\n" |
| 5730 | "Link state transmit delay\n" |
| 5731 | "Seconds\n") |
| 5732 | |
| 5733 | DEFUN (no_ip_ospf_transmit_delay, |
| 5734 | no_ip_ospf_transmit_delay_addr_cmd, |
| 5735 | "no ip ospf transmit-delay A.B.C.D", |
| 5736 | NO_STR |
| 5737 | "IP Information\n" |
| 5738 | "OSPF interface commands\n" |
| 5739 | "Link state transmit delay\n" |
| 5740 | "Address of interface") |
| 5741 | { |
| 5742 | struct interface *ifp = vty->index; |
| 5743 | struct in_addr addr; |
| 5744 | int ret; |
| 5745 | struct ospf_if_params *params; |
| 5746 | |
| 5747 | ifp = vty->index; |
| 5748 | params = IF_DEF_PARAMS (ifp); |
| 5749 | |
| 5750 | if (argc == 1) |
| 5751 | { |
| 5752 | ret = inet_aton(argv[0], &addr); |
| 5753 | if (!ret) |
| 5754 | { |
| 5755 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 5756 | VTY_NEWLINE); |
| 5757 | return CMD_WARNING; |
| 5758 | } |
| 5759 | |
| 5760 | params = ospf_lookup_if_params (ifp, addr); |
| 5761 | if (params == NULL) |
| 5762 | return CMD_SUCCESS; |
| 5763 | } |
| 5764 | |
| 5765 | UNSET_IF_PARAM (params, transmit_delay); |
| 5766 | params->transmit_delay = OSPF_TRANSMIT_DELAY_DEFAULT; |
| 5767 | |
| 5768 | if (params != IF_DEF_PARAMS (ifp)) |
| 5769 | { |
| 5770 | ospf_free_if_params (ifp, addr); |
| 5771 | ospf_if_update_params (ifp, addr); |
| 5772 | } |
| 5773 | |
| 5774 | return CMD_SUCCESS; |
| 5775 | } |
| 5776 | |
| 5777 | ALIAS (no_ip_ospf_transmit_delay, |
| 5778 | no_ip_ospf_transmit_delay_cmd, |
| 5779 | "no ip ospf transmit-delay", |
| 5780 | NO_STR |
| 5781 | "IP Information\n" |
| 5782 | "OSPF interface commands\n" |
| 5783 | "Link state transmit delay\n") |
| 5784 | |
| 5785 | ALIAS (no_ip_ospf_transmit_delay, |
| 5786 | no_ospf_transmit_delay_cmd, |
| 5787 | "no ospf transmit-delay", |
| 5788 | NO_STR |
| 5789 | "OSPF interface commands\n" |
| 5790 | "Link state transmit delay\n") |
| 5791 | |
| 5792 | |
| 5793 | DEFUN (ospf_redistribute_source_metric_type, |
| 5794 | ospf_redistribute_source_metric_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5795 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5796 | " metric <0-16777214> metric-type (1|2) route-map WORD", |
| 5797 | REDIST_STR |
| 5798 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5799 | "Metric for redistributed routes\n" |
| 5800 | "OSPF default metric\n" |
| 5801 | "OSPF exterior metric type for redistributed routes\n" |
| 5802 | "Set OSPF External Type 1 metrics\n" |
| 5803 | "Set OSPF External Type 2 metrics\n" |
| 5804 | "Route map reference\n" |
| 5805 | "Pointer to route-map entries\n") |
| 5806 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5807 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5808 | int source; |
| 5809 | int type = -1; |
| 5810 | int metric = -1; |
| 5811 | |
| 5812 | /* Get distribute source. */ |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5813 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5814 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5815 | return CMD_WARNING; |
| 5816 | |
| 5817 | /* Get metric value. */ |
| 5818 | if (argc >= 2) |
| 5819 | if (!str2metric (argv[1], &metric)) |
| 5820 | return CMD_WARNING; |
| 5821 | |
| 5822 | /* Get metric type. */ |
| 5823 | if (argc >= 3) |
| 5824 | if (!str2metric_type (argv[2], &type)) |
| 5825 | return CMD_WARNING; |
| 5826 | |
| 5827 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5828 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5829 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5830 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5831 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5832 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5833 | } |
| 5834 | |
| 5835 | ALIAS (ospf_redistribute_source_metric_type, |
| 5836 | ospf_redistribute_source_metric_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5837 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5838 | " metric <0-16777214> metric-type (1|2)", |
| 5839 | REDIST_STR |
| 5840 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5841 | "Metric for redistributed routes\n" |
| 5842 | "OSPF default metric\n" |
| 5843 | "OSPF exterior metric type for redistributed routes\n" |
| 5844 | "Set OSPF External Type 1 metrics\n" |
| 5845 | "Set OSPF External Type 2 metrics\n") |
| 5846 | |
| 5847 | ALIAS (ospf_redistribute_source_metric_type, |
| 5848 | ospf_redistribute_source_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5849 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric <0-16777214>", |
| 5850 | REDIST_STR |
| 5851 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5852 | "Metric for redistributed routes\n" |
| 5853 | "OSPF default metric\n") |
| 5854 | |
| 5855 | DEFUN (ospf_redistribute_source_type_metric, |
| 5856 | ospf_redistribute_source_type_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5857 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5858 | " metric-type (1|2) metric <0-16777214> route-map WORD", |
| 5859 | REDIST_STR |
| 5860 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5861 | "OSPF exterior metric type for redistributed routes\n" |
| 5862 | "Set OSPF External Type 1 metrics\n" |
| 5863 | "Set OSPF External Type 2 metrics\n" |
| 5864 | "Metric for redistributed routes\n" |
| 5865 | "OSPF default metric\n" |
| 5866 | "Route map reference\n" |
| 5867 | "Pointer to route-map entries\n") |
| 5868 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5869 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5870 | int source; |
| 5871 | int type = -1; |
| 5872 | int metric = -1; |
| 5873 | |
| 5874 | /* Get distribute source. */ |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5875 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5876 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5877 | return CMD_WARNING; |
| 5878 | |
| 5879 | /* Get metric value. */ |
| 5880 | if (argc >= 2) |
| 5881 | if (!str2metric_type (argv[1], &type)) |
| 5882 | return CMD_WARNING; |
| 5883 | |
| 5884 | /* Get metric type. */ |
| 5885 | if (argc >= 3) |
| 5886 | if (!str2metric (argv[2], &metric)) |
| 5887 | return CMD_WARNING; |
| 5888 | |
| 5889 | if (argc == 4) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5890 | ospf_routemap_set (ospf, source, argv[3]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5891 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5892 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5893 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5894 | return ospf_redistribute_set (ospf, source, type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5895 | } |
| 5896 | |
| 5897 | ALIAS (ospf_redistribute_source_type_metric, |
| 5898 | ospf_redistribute_source_type_metric_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5899 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5900 | " metric-type (1|2) metric <0-16777214>", |
| 5901 | REDIST_STR |
| 5902 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5903 | "OSPF exterior metric type for redistributed routes\n" |
| 5904 | "Set OSPF External Type 1 metrics\n" |
| 5905 | "Set OSPF External Type 2 metrics\n" |
| 5906 | "Metric for redistributed routes\n" |
| 5907 | "OSPF default metric\n") |
| 5908 | |
| 5909 | ALIAS (ospf_redistribute_source_type_metric, |
| 5910 | ospf_redistribute_source_type_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5911 | "redistribute " QUAGGA_REDIST_STR_OSPFD " metric-type (1|2)", |
| 5912 | REDIST_STR |
| 5913 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5914 | "OSPF exterior metric type for redistributed routes\n" |
| 5915 | "Set OSPF External Type 1 metrics\n" |
| 5916 | "Set OSPF External Type 2 metrics\n") |
| 5917 | |
| 5918 | ALIAS (ospf_redistribute_source_type_metric, |
| 5919 | ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5920 | "redistribute " QUAGGA_REDIST_STR_OSPFD, |
| 5921 | REDIST_STR |
| 5922 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5923 | |
| 5924 | DEFUN (ospf_redistribute_source_metric_routemap, |
| 5925 | ospf_redistribute_source_metric_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5926 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5927 | " metric <0-16777214> route-map WORD", |
| 5928 | REDIST_STR |
| 5929 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5930 | "Metric for redistributed routes\n" |
| 5931 | "OSPF default metric\n" |
| 5932 | "Route map reference\n" |
| 5933 | "Pointer to route-map entries\n") |
| 5934 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5935 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5936 | int source; |
| 5937 | int metric = -1; |
| 5938 | |
| 5939 | /* Get distribute source. */ |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5940 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5941 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5942 | return CMD_WARNING; |
| 5943 | |
| 5944 | /* Get metric value. */ |
| 5945 | if (argc >= 2) |
| 5946 | if (!str2metric (argv[1], &metric)) |
| 5947 | return CMD_WARNING; |
| 5948 | |
| 5949 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5950 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5951 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5952 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5953 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5954 | return ospf_redistribute_set (ospf, source, -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5955 | } |
| 5956 | |
| 5957 | DEFUN (ospf_redistribute_source_type_routemap, |
| 5958 | ospf_redistribute_source_type_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5959 | "redistribute " QUAGGA_REDIST_STR_OSPFD |
| 5960 | " metric-type (1|2) route-map WORD", |
| 5961 | REDIST_STR |
| 5962 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5963 | "OSPF exterior metric type for redistributed routes\n" |
| 5964 | "Set OSPF External Type 1 metrics\n" |
| 5965 | "Set OSPF External Type 2 metrics\n" |
| 5966 | "Route map reference\n" |
| 5967 | "Pointer to route-map entries\n") |
| 5968 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5969 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5970 | int source; |
| 5971 | int type = -1; |
| 5972 | |
| 5973 | /* Get distribute source. */ |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 5974 | source = proto_redistnum(AFI_IP, argv[0]); |
| 5975 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5976 | return CMD_WARNING; |
| 5977 | |
| 5978 | /* Get metric value. */ |
| 5979 | if (argc >= 2) |
| 5980 | if (!str2metric_type (argv[1], &type)) |
| 5981 | return CMD_WARNING; |
| 5982 | |
| 5983 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5984 | ospf_routemap_set (ospf, source, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5985 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5986 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5987 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5988 | return ospf_redistribute_set (ospf, source, type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5989 | } |
| 5990 | |
| 5991 | DEFUN (ospf_redistribute_source_routemap, |
| 5992 | ospf_redistribute_source_routemap_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 5993 | "redistribute " QUAGGA_REDIST_STR_OSPFD " route-map WORD", |
| 5994 | REDIST_STR |
| 5995 | QUAGGA_REDIST_HELP_STR_OSPFD |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 5996 | "Route map reference\n" |
| 5997 | "Pointer to route-map entries\n") |
| 5998 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 5999 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6000 | int source; |
| 6001 | |
| 6002 | /* Get distribute source. */ |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6003 | source = proto_redistnum(AFI_IP, argv[0]); |
| 6004 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6005 | return CMD_WARNING; |
| 6006 | |
| 6007 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6008 | ospf_routemap_set (ospf, source, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6009 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6010 | ospf_routemap_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6011 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6012 | return ospf_redistribute_set (ospf, source, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6013 | } |
| 6014 | |
| 6015 | DEFUN (no_ospf_redistribute_source, |
| 6016 | no_ospf_redistribute_source_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6017 | "no redistribute " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6018 | NO_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6019 | REDIST_STR |
| 6020 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6021 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6022 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6023 | int source; |
| 6024 | |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6025 | source = proto_redistnum(AFI_IP, argv[0]); |
| 6026 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6027 | return CMD_WARNING; |
| 6028 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6029 | ospf_routemap_unset (ospf, source); |
| 6030 | return ospf_redistribute_unset (ospf, source); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6031 | } |
| 6032 | |
| 6033 | DEFUN (ospf_distribute_list_out, |
| 6034 | ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6035 | "distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6036 | "Filter networks in routing updates\n" |
| 6037 | "Access-list name\n" |
| 6038 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6039 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6040 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6041 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6042 | int source; |
| 6043 | |
| 6044 | /* Get distribute source. */ |
Christian Franke | bda3c32 | 2012-12-04 11:31:16 -0800 | [diff] [blame] | 6045 | source = proto_redistnum(AFI_IP, argv[1]); |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6046 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6047 | return CMD_WARNING; |
| 6048 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6049 | return ospf_distribute_list_out_set (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6050 | } |
| 6051 | |
| 6052 | DEFUN (no_ospf_distribute_list_out, |
| 6053 | no_ospf_distribute_list_out_cmd, |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6054 | "no distribute-list WORD out " QUAGGA_REDIST_STR_OSPFD, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6055 | NO_STR |
| 6056 | "Filter networks in routing updates\n" |
| 6057 | "Access-list name\n" |
| 6058 | OUT_STR |
Paul Jakma | d1c65c2 | 2006-06-27 08:01:43 +0000 | [diff] [blame] | 6059 | QUAGGA_REDIST_HELP_STR_OSPFD) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6060 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6061 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6062 | int source; |
| 6063 | |
Christian Franke | bda3c32 | 2012-12-04 11:31:16 -0800 | [diff] [blame] | 6064 | source = proto_redistnum(AFI_IP, argv[1]); |
David Lamparter | e0ca5fd | 2009-09-16 01:52:42 +0200 | [diff] [blame] | 6065 | if (source < 0 || source == ZEBRA_ROUTE_OSPF) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6066 | return CMD_WARNING; |
| 6067 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6068 | return ospf_distribute_list_out_unset (ospf, source, argv[0]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6069 | } |
| 6070 | |
| 6071 | /* Default information originate. */ |
| 6072 | DEFUN (ospf_default_information_originate_metric_type_routemap, |
| 6073 | ospf_default_information_originate_metric_type_routemap_cmd, |
| 6074 | "default-information originate metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6075 | "Control distribution of default information\n" |
| 6076 | "Distribute a default route\n" |
| 6077 | "OSPF default metric\n" |
| 6078 | "OSPF metric\n" |
| 6079 | "OSPF metric type for default routes\n" |
| 6080 | "Set OSPF External Type 1 metrics\n" |
| 6081 | "Set OSPF External Type 2 metrics\n" |
| 6082 | "Route map reference\n" |
| 6083 | "Pointer to route-map entries\n") |
| 6084 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6085 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6086 | int type = -1; |
| 6087 | int metric = -1; |
| 6088 | |
| 6089 | /* Get metric value. */ |
| 6090 | if (argc >= 1) |
| 6091 | if (!str2metric (argv[0], &metric)) |
| 6092 | return CMD_WARNING; |
| 6093 | |
| 6094 | /* Get metric type. */ |
| 6095 | if (argc >= 2) |
| 6096 | if (!str2metric_type (argv[1], &type)) |
| 6097 | return CMD_WARNING; |
| 6098 | |
| 6099 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6100 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6101 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6102 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6103 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6104 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6105 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6106 | } |
| 6107 | |
| 6108 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6109 | ospf_default_information_originate_metric_type_cmd, |
| 6110 | "default-information originate metric <0-16777214> metric-type (1|2)", |
| 6111 | "Control distribution of default information\n" |
| 6112 | "Distribute a default route\n" |
| 6113 | "OSPF default metric\n" |
| 6114 | "OSPF metric\n" |
| 6115 | "OSPF metric type for default routes\n" |
| 6116 | "Set OSPF External Type 1 metrics\n" |
| 6117 | "Set OSPF External Type 2 metrics\n") |
| 6118 | |
| 6119 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6120 | ospf_default_information_originate_metric_cmd, |
| 6121 | "default-information originate metric <0-16777214>", |
| 6122 | "Control distribution of default information\n" |
| 6123 | "Distribute a default route\n" |
| 6124 | "OSPF default metric\n" |
| 6125 | "OSPF metric\n") |
| 6126 | |
| 6127 | ALIAS (ospf_default_information_originate_metric_type_routemap, |
| 6128 | ospf_default_information_originate_cmd, |
| 6129 | "default-information originate", |
| 6130 | "Control distribution of default information\n" |
| 6131 | "Distribute a default route\n") |
| 6132 | |
| 6133 | /* Default information originate. */ |
| 6134 | DEFUN (ospf_default_information_originate_metric_routemap, |
| 6135 | ospf_default_information_originate_metric_routemap_cmd, |
| 6136 | "default-information originate metric <0-16777214> route-map WORD", |
| 6137 | "Control distribution of default information\n" |
| 6138 | "Distribute a default route\n" |
| 6139 | "OSPF default metric\n" |
| 6140 | "OSPF metric\n" |
| 6141 | "Route map reference\n" |
| 6142 | "Pointer to route-map entries\n") |
| 6143 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6144 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6145 | int metric = -1; |
| 6146 | |
| 6147 | /* Get metric value. */ |
| 6148 | if (argc >= 1) |
| 6149 | if (!str2metric (argv[0], &metric)) |
| 6150 | return CMD_WARNING; |
| 6151 | |
| 6152 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6153 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6154 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6155 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6156 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6157 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6158 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6159 | } |
| 6160 | |
| 6161 | /* Default information originate. */ |
| 6162 | DEFUN (ospf_default_information_originate_routemap, |
| 6163 | ospf_default_information_originate_routemap_cmd, |
| 6164 | "default-information originate route-map WORD", |
| 6165 | "Control distribution of default information\n" |
| 6166 | "Distribute a default route\n" |
| 6167 | "Route map reference\n" |
| 6168 | "Pointer to route-map entries\n") |
| 6169 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6170 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6171 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6172 | if (argc == 1) |
| 6173 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6174 | else |
| 6175 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6176 | |
| 6177 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6178 | } |
| 6179 | |
| 6180 | DEFUN (ospf_default_information_originate_type_metric_routemap, |
| 6181 | ospf_default_information_originate_type_metric_routemap_cmd, |
| 6182 | "default-information originate metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6183 | "Control distribution of default information\n" |
| 6184 | "Distribute a default route\n" |
| 6185 | "OSPF metric type for default routes\n" |
| 6186 | "Set OSPF External Type 1 metrics\n" |
| 6187 | "Set OSPF External Type 2 metrics\n" |
| 6188 | "OSPF default metric\n" |
| 6189 | "OSPF metric\n" |
| 6190 | "Route map reference\n" |
| 6191 | "Pointer to route-map entries\n") |
| 6192 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6193 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6194 | int type = -1; |
| 6195 | int metric = -1; |
| 6196 | |
| 6197 | /* Get metric type. */ |
| 6198 | if (argc >= 1) |
| 6199 | if (!str2metric_type (argv[0], &type)) |
| 6200 | return CMD_WARNING; |
| 6201 | |
| 6202 | /* Get metric value. */ |
| 6203 | if (argc >= 2) |
| 6204 | if (!str2metric (argv[1], &metric)) |
| 6205 | return CMD_WARNING; |
| 6206 | |
| 6207 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6208 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6209 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6210 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6211 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6212 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6213 | type, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6214 | } |
| 6215 | |
| 6216 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6217 | ospf_default_information_originate_type_metric_cmd, |
| 6218 | "default-information originate metric-type (1|2) metric <0-16777214>", |
| 6219 | "Control distribution of default information\n" |
| 6220 | "Distribute a default route\n" |
| 6221 | "OSPF metric type for default routes\n" |
| 6222 | "Set OSPF External Type 1 metrics\n" |
| 6223 | "Set OSPF External Type 2 metrics\n" |
| 6224 | "OSPF default metric\n" |
| 6225 | "OSPF metric\n") |
| 6226 | |
| 6227 | ALIAS (ospf_default_information_originate_type_metric_routemap, |
| 6228 | ospf_default_information_originate_type_cmd, |
| 6229 | "default-information originate metric-type (1|2)", |
| 6230 | "Control distribution of default information\n" |
| 6231 | "Distribute a default route\n" |
| 6232 | "OSPF metric type for default routes\n" |
| 6233 | "Set OSPF External Type 1 metrics\n" |
| 6234 | "Set OSPF External Type 2 metrics\n") |
| 6235 | |
| 6236 | DEFUN (ospf_default_information_originate_type_routemap, |
| 6237 | ospf_default_information_originate_type_routemap_cmd, |
| 6238 | "default-information originate metric-type (1|2) route-map WORD", |
| 6239 | "Control distribution of default information\n" |
| 6240 | "Distribute a default route\n" |
| 6241 | "OSPF metric type for default routes\n" |
| 6242 | "Set OSPF External Type 1 metrics\n" |
| 6243 | "Set OSPF External Type 2 metrics\n" |
| 6244 | "Route map reference\n" |
| 6245 | "Pointer to route-map entries\n") |
| 6246 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6247 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6248 | int type = -1; |
| 6249 | |
| 6250 | /* Get metric type. */ |
| 6251 | if (argc >= 1) |
| 6252 | if (!str2metric_type (argv[0], &type)) |
| 6253 | return CMD_WARNING; |
| 6254 | |
| 6255 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6256 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6257 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6258 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6259 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6260 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ZEBRA, |
| 6261 | type, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6262 | } |
| 6263 | |
| 6264 | DEFUN (ospf_default_information_originate_always_metric_type_routemap, |
| 6265 | ospf_default_information_originate_always_metric_type_routemap_cmd, |
| 6266 | "default-information originate always metric <0-16777214> metric-type (1|2) route-map WORD", |
| 6267 | "Control distribution of default information\n" |
| 6268 | "Distribute a default route\n" |
| 6269 | "Always advertise default route\n" |
| 6270 | "OSPF default metric\n" |
| 6271 | "OSPF metric\n" |
| 6272 | "OSPF metric type for default routes\n" |
| 6273 | "Set OSPF External Type 1 metrics\n" |
| 6274 | "Set OSPF External Type 2 metrics\n" |
| 6275 | "Route map reference\n" |
| 6276 | "Pointer to route-map entries\n") |
| 6277 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6278 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6279 | int type = -1; |
| 6280 | int metric = -1; |
| 6281 | |
| 6282 | /* Get metric value. */ |
| 6283 | if (argc >= 1) |
| 6284 | if (!str2metric (argv[0], &metric)) |
| 6285 | return CMD_WARNING; |
| 6286 | |
| 6287 | /* Get metric type. */ |
| 6288 | if (argc >= 2) |
| 6289 | if (!str2metric_type (argv[1], &type)) |
| 6290 | return CMD_WARNING; |
| 6291 | |
| 6292 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6293 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6294 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6295 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6296 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6297 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6298 | type, metric); |
| 6299 | } |
| 6300 | |
| 6301 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6302 | ospf_default_information_originate_always_metric_type_cmd, |
| 6303 | "default-information originate always metric <0-16777214> metric-type (1|2)", |
| 6304 | "Control distribution of default information\n" |
| 6305 | "Distribute a default route\n" |
| 6306 | "Always advertise default route\n" |
| 6307 | "OSPF default metric\n" |
| 6308 | "OSPF metric\n" |
| 6309 | "OSPF metric type for default routes\n" |
| 6310 | "Set OSPF External Type 1 metrics\n" |
| 6311 | "Set OSPF External Type 2 metrics\n") |
| 6312 | |
| 6313 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6314 | ospf_default_information_originate_always_metric_cmd, |
| 6315 | "default-information originate always metric <0-16777214>", |
| 6316 | "Control distribution of default information\n" |
| 6317 | "Distribute a default route\n" |
| 6318 | "Always advertise default route\n" |
| 6319 | "OSPF default metric\n" |
| 6320 | "OSPF metric\n" |
| 6321 | "OSPF metric type for default routes\n") |
| 6322 | |
| 6323 | ALIAS (ospf_default_information_originate_always_metric_type_routemap, |
| 6324 | ospf_default_information_originate_always_cmd, |
| 6325 | "default-information originate always", |
| 6326 | "Control distribution of default information\n" |
| 6327 | "Distribute a default route\n" |
| 6328 | "Always advertise default route\n") |
| 6329 | |
| 6330 | DEFUN (ospf_default_information_originate_always_metric_routemap, |
| 6331 | ospf_default_information_originate_always_metric_routemap_cmd, |
| 6332 | "default-information originate always metric <0-16777214> route-map WORD", |
| 6333 | "Control distribution of default information\n" |
| 6334 | "Distribute a default route\n" |
| 6335 | "Always advertise default route\n" |
| 6336 | "OSPF default metric\n" |
| 6337 | "OSPF metric\n" |
| 6338 | "Route map reference\n" |
| 6339 | "Pointer to route-map entries\n") |
| 6340 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6341 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6342 | int metric = -1; |
| 6343 | |
| 6344 | /* Get metric value. */ |
| 6345 | if (argc >= 1) |
| 6346 | if (!str2metric (argv[0], &metric)) |
| 6347 | return CMD_WARNING; |
| 6348 | |
| 6349 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6350 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6351 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6352 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6353 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6354 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
| 6355 | -1, metric); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6356 | } |
| 6357 | |
| 6358 | DEFUN (ospf_default_information_originate_always_routemap, |
| 6359 | ospf_default_information_originate_always_routemap_cmd, |
| 6360 | "default-information originate always route-map WORD", |
| 6361 | "Control distribution of default information\n" |
| 6362 | "Distribute a default route\n" |
| 6363 | "Always advertise default route\n" |
| 6364 | "Route map reference\n" |
| 6365 | "Pointer to route-map entries\n") |
| 6366 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6367 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6368 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6369 | if (argc == 1) |
| 6370 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[0]); |
| 6371 | else |
| 6372 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6373 | |
| 6374 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, -1, -1); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6375 | } |
| 6376 | |
| 6377 | DEFUN (ospf_default_information_originate_always_type_metric_routemap, |
| 6378 | ospf_default_information_originate_always_type_metric_routemap_cmd, |
| 6379 | "default-information originate always metric-type (1|2) metric <0-16777214> route-map WORD", |
| 6380 | "Control distribution of default information\n" |
| 6381 | "Distribute a default route\n" |
| 6382 | "Always advertise default route\n" |
| 6383 | "OSPF metric type for default routes\n" |
| 6384 | "Set OSPF External Type 1 metrics\n" |
| 6385 | "Set OSPF External Type 2 metrics\n" |
| 6386 | "OSPF default metric\n" |
| 6387 | "OSPF metric\n" |
| 6388 | "Route map reference\n" |
| 6389 | "Pointer to route-map entries\n") |
| 6390 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6391 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6392 | int type = -1; |
| 6393 | int metric = -1; |
| 6394 | |
| 6395 | /* Get metric type. */ |
| 6396 | if (argc >= 1) |
| 6397 | if (!str2metric_type (argv[0], &type)) |
| 6398 | return CMD_WARNING; |
| 6399 | |
| 6400 | /* Get metric value. */ |
| 6401 | if (argc >= 2) |
| 6402 | if (!str2metric (argv[1], &metric)) |
| 6403 | return CMD_WARNING; |
| 6404 | |
| 6405 | if (argc == 3) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6406 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[2]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6407 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6408 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6409 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6410 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6411 | type, metric); |
| 6412 | } |
| 6413 | |
| 6414 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6415 | ospf_default_information_originate_always_type_metric_cmd, |
| 6416 | "default-information originate always metric-type (1|2) metric <0-16777214>", |
| 6417 | "Control distribution of default information\n" |
| 6418 | "Distribute a default route\n" |
| 6419 | "Always advertise default route\n" |
| 6420 | "OSPF metric type for default routes\n" |
| 6421 | "Set OSPF External Type 1 metrics\n" |
| 6422 | "Set OSPF External Type 2 metrics\n" |
| 6423 | "OSPF default metric\n" |
| 6424 | "OSPF metric\n") |
| 6425 | |
| 6426 | ALIAS (ospf_default_information_originate_always_type_metric_routemap, |
| 6427 | ospf_default_information_originate_always_type_cmd, |
| 6428 | "default-information originate always metric-type (1|2)", |
| 6429 | "Control distribution of default information\n" |
| 6430 | "Distribute a default route\n" |
| 6431 | "Always advertise default route\n" |
| 6432 | "OSPF metric type for default routes\n" |
| 6433 | "Set OSPF External Type 1 metrics\n" |
| 6434 | "Set OSPF External Type 2 metrics\n") |
| 6435 | |
| 6436 | DEFUN (ospf_default_information_originate_always_type_routemap, |
| 6437 | ospf_default_information_originate_always_type_routemap_cmd, |
| 6438 | "default-information originate always metric-type (1|2) route-map WORD", |
| 6439 | "Control distribution of default information\n" |
| 6440 | "Distribute a default route\n" |
| 6441 | "Always advertise default route\n" |
| 6442 | "OSPF metric type for default routes\n" |
| 6443 | "Set OSPF External Type 1 metrics\n" |
| 6444 | "Set OSPF External Type 2 metrics\n" |
| 6445 | "Route map reference\n" |
| 6446 | "Pointer to route-map entries\n") |
| 6447 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6448 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6449 | int type = -1; |
| 6450 | |
| 6451 | /* Get metric type. */ |
| 6452 | if (argc >= 1) |
| 6453 | if (!str2metric_type (argv[0], &type)) |
| 6454 | return CMD_WARNING; |
| 6455 | |
| 6456 | if (argc == 2) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6457 | ospf_routemap_set (ospf, DEFAULT_ROUTE, argv[1]); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6458 | else |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6459 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6460 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6461 | return ospf_redistribute_default_set (ospf, DEFAULT_ORIGINATE_ALWAYS, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6462 | type, -1); |
| 6463 | } |
| 6464 | |
| 6465 | DEFUN (no_ospf_default_information_originate, |
| 6466 | no_ospf_default_information_originate_cmd, |
| 6467 | "no default-information originate", |
| 6468 | NO_STR |
| 6469 | "Control distribution of default information\n" |
| 6470 | "Distribute a default route\n") |
| 6471 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6472 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6473 | struct prefix_ipv4 p; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6474 | |
| 6475 | p.family = AF_INET; |
| 6476 | p.prefix.s_addr = 0; |
| 6477 | p.prefixlen = 0; |
| 6478 | |
ajs | 5339cfd | 2005-09-19 13:28:05 +0000 | [diff] [blame] | 6479 | ospf_external_lsa_flush (ospf, DEFAULT_ROUTE, &p, 0); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6480 | |
| 6481 | if (EXTERNAL_INFO (DEFAULT_ROUTE)) { |
| 6482 | ospf_external_info_delete (DEFAULT_ROUTE, p); |
| 6483 | route_table_finish (EXTERNAL_INFO (DEFAULT_ROUTE)); |
| 6484 | EXTERNAL_INFO (DEFAULT_ROUTE) = NULL; |
| 6485 | } |
| 6486 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6487 | ospf_routemap_unset (ospf, DEFAULT_ROUTE); |
| 6488 | return ospf_redistribute_default_unset (ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6489 | } |
| 6490 | |
| 6491 | DEFUN (ospf_default_metric, |
| 6492 | ospf_default_metric_cmd, |
| 6493 | "default-metric <0-16777214>", |
| 6494 | "Set metric of redistributed routes\n" |
| 6495 | "Default metric\n") |
| 6496 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6497 | struct ospf *ospf = vty->index; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6498 | int metric = -1; |
| 6499 | |
| 6500 | if (!str2metric (argv[0], &metric)) |
| 6501 | return CMD_WARNING; |
| 6502 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6503 | ospf->default_metric = metric; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6504 | |
| 6505 | return CMD_SUCCESS; |
| 6506 | } |
| 6507 | |
| 6508 | DEFUN (no_ospf_default_metric, |
| 6509 | no_ospf_default_metric_cmd, |
| 6510 | "no default-metric", |
| 6511 | NO_STR |
| 6512 | "Set metric of redistributed routes\n") |
| 6513 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6514 | struct ospf *ospf = vty->index; |
| 6515 | |
| 6516 | ospf->default_metric = -1; |
| 6517 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6518 | return CMD_SUCCESS; |
| 6519 | } |
| 6520 | |
| 6521 | ALIAS (no_ospf_default_metric, |
| 6522 | no_ospf_default_metric_val_cmd, |
| 6523 | "no default-metric <0-16777214>", |
| 6524 | NO_STR |
| 6525 | "Set metric of redistributed routes\n" |
| 6526 | "Default metric\n") |
| 6527 | |
| 6528 | DEFUN (ospf_distance, |
| 6529 | ospf_distance_cmd, |
| 6530 | "distance <1-255>", |
| 6531 | "Define an administrative distance\n" |
| 6532 | "OSPF Administrative distance\n") |
| 6533 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6534 | struct ospf *ospf = vty->index; |
| 6535 | |
| 6536 | ospf->distance_all = atoi (argv[0]); |
| 6537 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6538 | return CMD_SUCCESS; |
| 6539 | } |
| 6540 | |
| 6541 | DEFUN (no_ospf_distance, |
| 6542 | no_ospf_distance_cmd, |
| 6543 | "no distance <1-255>", |
| 6544 | NO_STR |
| 6545 | "Define an administrative distance\n" |
| 6546 | "OSPF Administrative distance\n") |
| 6547 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6548 | struct ospf *ospf = vty->index; |
| 6549 | |
| 6550 | ospf->distance_all = 0; |
| 6551 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6552 | return CMD_SUCCESS; |
| 6553 | } |
| 6554 | |
| 6555 | DEFUN (no_ospf_distance_ospf, |
| 6556 | no_ospf_distance_ospf_cmd, |
| 6557 | "no distance ospf", |
| 6558 | NO_STR |
| 6559 | "Define an administrative distance\n" |
| 6560 | "OSPF Administrative distance\n" |
| 6561 | "OSPF Distance\n") |
| 6562 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6563 | struct ospf *ospf = vty->index; |
| 6564 | |
| 6565 | ospf->distance_intra = 0; |
| 6566 | ospf->distance_inter = 0; |
| 6567 | ospf->distance_external = 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, |
| 6573 | ospf_distance_ospf_intra_cmd, |
| 6574 | "distance ospf intra-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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6580 | struct ospf *ospf = vty->index; |
| 6581 | |
| 6582 | ospf->distance_intra = atoi (argv[0]); |
| 6583 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6584 | return CMD_SUCCESS; |
| 6585 | } |
| 6586 | |
| 6587 | DEFUN (ospf_distance_ospf_intra_inter, |
| 6588 | ospf_distance_ospf_intra_inter_cmd, |
| 6589 | "distance ospf intra-area <1-255> inter-area <1-255>", |
| 6590 | "Define an administrative distance\n" |
| 6591 | "OSPF Administrative distance\n" |
| 6592 | "Intra-area routes\n" |
| 6593 | "Distance for intra-area routes\n" |
| 6594 | "Inter-area routes\n" |
| 6595 | "Distance for inter-area routes\n") |
| 6596 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6597 | struct ospf *ospf = vty->index; |
| 6598 | |
| 6599 | ospf->distance_intra = atoi (argv[0]); |
| 6600 | ospf->distance_inter = atoi (argv[1]); |
| 6601 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6602 | return CMD_SUCCESS; |
| 6603 | } |
| 6604 | |
| 6605 | DEFUN (ospf_distance_ospf_intra_external, |
| 6606 | ospf_distance_ospf_intra_external_cmd, |
| 6607 | "distance ospf intra-area <1-255> external <1-255>", |
| 6608 | "Define an administrative distance\n" |
| 6609 | "OSPF Administrative distance\n" |
| 6610 | "Intra-area routes\n" |
| 6611 | "Distance for intra-area routes\n" |
| 6612 | "External routes\n" |
| 6613 | "Distance for external routes\n") |
| 6614 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6615 | struct ospf *ospf = vty->index; |
| 6616 | |
| 6617 | ospf->distance_intra = atoi (argv[0]); |
| 6618 | ospf->distance_external = atoi (argv[1]); |
| 6619 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6620 | return CMD_SUCCESS; |
| 6621 | } |
| 6622 | |
| 6623 | DEFUN (ospf_distance_ospf_intra_inter_external, |
| 6624 | ospf_distance_ospf_intra_inter_external_cmd, |
| 6625 | "distance ospf intra-area <1-255> inter-area <1-255> external <1-255>", |
| 6626 | "Define an administrative distance\n" |
| 6627 | "OSPF Administrative distance\n" |
| 6628 | "Intra-area routes\n" |
| 6629 | "Distance for intra-area routes\n" |
| 6630 | "Inter-area routes\n" |
| 6631 | "Distance for inter-area routes\n" |
| 6632 | "External routes\n" |
| 6633 | "Distance for external routes\n") |
| 6634 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6635 | struct ospf *ospf = vty->index; |
| 6636 | |
| 6637 | ospf->distance_intra = atoi (argv[0]); |
| 6638 | ospf->distance_inter = atoi (argv[1]); |
| 6639 | ospf->distance_external = atoi (argv[2]); |
| 6640 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6641 | return CMD_SUCCESS; |
| 6642 | } |
| 6643 | |
| 6644 | DEFUN (ospf_distance_ospf_intra_external_inter, |
| 6645 | ospf_distance_ospf_intra_external_inter_cmd, |
| 6646 | "distance ospf intra-area <1-255> external <1-255> inter-area <1-255>", |
| 6647 | "Define an administrative distance\n" |
| 6648 | "OSPF Administrative distance\n" |
| 6649 | "Intra-area routes\n" |
| 6650 | "Distance for intra-area routes\n" |
| 6651 | "External routes\n" |
| 6652 | "Distance for external routes\n" |
| 6653 | "Inter-area routes\n" |
| 6654 | "Distance for inter-area routes\n") |
| 6655 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6656 | struct ospf *ospf = vty->index; |
| 6657 | |
| 6658 | ospf->distance_intra = atoi (argv[0]); |
| 6659 | ospf->distance_external = atoi (argv[1]); |
| 6660 | ospf->distance_inter = atoi (argv[2]); |
| 6661 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6662 | return CMD_SUCCESS; |
| 6663 | } |
| 6664 | |
| 6665 | DEFUN (ospf_distance_ospf_inter, |
| 6666 | ospf_distance_ospf_inter_cmd, |
| 6667 | "distance ospf inter-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 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6673 | struct ospf *ospf = vty->index; |
| 6674 | |
| 6675 | ospf->distance_inter = atoi (argv[0]); |
| 6676 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6677 | return CMD_SUCCESS; |
| 6678 | } |
| 6679 | |
| 6680 | DEFUN (ospf_distance_ospf_inter_intra, |
| 6681 | ospf_distance_ospf_inter_intra_cmd, |
| 6682 | "distance ospf inter-area <1-255> intra-area <1-255>", |
| 6683 | "Define an administrative distance\n" |
| 6684 | "OSPF Administrative distance\n" |
| 6685 | "Inter-area routes\n" |
| 6686 | "Distance for inter-area routes\n" |
| 6687 | "Intra-area routes\n" |
| 6688 | "Distance for intra-area routes\n") |
| 6689 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6690 | struct ospf *ospf = vty->index; |
| 6691 | |
| 6692 | ospf->distance_inter = atoi (argv[0]); |
| 6693 | ospf->distance_intra = atoi (argv[1]); |
| 6694 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6695 | return CMD_SUCCESS; |
| 6696 | } |
| 6697 | |
| 6698 | DEFUN (ospf_distance_ospf_inter_external, |
| 6699 | ospf_distance_ospf_inter_external_cmd, |
| 6700 | "distance ospf inter-area <1-255> external <1-255>", |
| 6701 | "Define an administrative distance\n" |
| 6702 | "OSPF Administrative distance\n" |
| 6703 | "Inter-area routes\n" |
| 6704 | "Distance for inter-area routes\n" |
| 6705 | "External routes\n" |
| 6706 | "Distance for external routes\n") |
| 6707 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6708 | struct ospf *ospf = vty->index; |
| 6709 | |
| 6710 | ospf->distance_inter = atoi (argv[0]); |
| 6711 | ospf->distance_external = atoi (argv[1]); |
| 6712 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6713 | return CMD_SUCCESS; |
| 6714 | } |
| 6715 | |
| 6716 | DEFUN (ospf_distance_ospf_inter_intra_external, |
| 6717 | ospf_distance_ospf_inter_intra_external_cmd, |
| 6718 | "distance ospf inter-area <1-255> intra-area <1-255> external <1-255>", |
| 6719 | "Define an administrative distance\n" |
| 6720 | "OSPF Administrative distance\n" |
| 6721 | "Inter-area routes\n" |
| 6722 | "Distance for inter-area routes\n" |
| 6723 | "Intra-area routes\n" |
| 6724 | "Distance for intra-area routes\n" |
| 6725 | "External routes\n" |
| 6726 | "Distance for external routes\n") |
| 6727 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6728 | struct ospf *ospf = vty->index; |
| 6729 | |
| 6730 | ospf->distance_inter = atoi (argv[0]); |
| 6731 | ospf->distance_intra = atoi (argv[1]); |
| 6732 | ospf->distance_external = atoi (argv[2]); |
| 6733 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6734 | return CMD_SUCCESS; |
| 6735 | } |
| 6736 | |
| 6737 | DEFUN (ospf_distance_ospf_inter_external_intra, |
| 6738 | ospf_distance_ospf_inter_external_intra_cmd, |
| 6739 | "distance ospf inter-area <1-255> external <1-255> intra-area <1-255>", |
| 6740 | "Define an administrative distance\n" |
| 6741 | "OSPF Administrative distance\n" |
| 6742 | "Inter-area routes\n" |
| 6743 | "Distance for inter-area routes\n" |
| 6744 | "External routes\n" |
| 6745 | "Distance for external routes\n" |
| 6746 | "Intra-area routes\n" |
| 6747 | "Distance for intra-area routes\n") |
| 6748 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6749 | struct ospf *ospf = vty->index; |
| 6750 | |
| 6751 | ospf->distance_inter = atoi (argv[0]); |
| 6752 | ospf->distance_external = atoi (argv[1]); |
| 6753 | ospf->distance_intra = atoi (argv[2]); |
| 6754 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6755 | return CMD_SUCCESS; |
| 6756 | } |
| 6757 | |
| 6758 | DEFUN (ospf_distance_ospf_external, |
| 6759 | ospf_distance_ospf_external_cmd, |
| 6760 | "distance ospf external <1-255>", |
| 6761 | "Define an administrative distance\n" |
| 6762 | "OSPF Administrative distance\n" |
| 6763 | "External routes\n" |
| 6764 | "Distance for external routes\n") |
| 6765 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6766 | struct ospf *ospf = vty->index; |
| 6767 | |
| 6768 | ospf->distance_external = atoi (argv[0]); |
| 6769 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6770 | return CMD_SUCCESS; |
| 6771 | } |
| 6772 | |
| 6773 | DEFUN (ospf_distance_ospf_external_intra, |
| 6774 | ospf_distance_ospf_external_intra_cmd, |
| 6775 | "distance ospf external <1-255> intra-area <1-255>", |
| 6776 | "Define an administrative distance\n" |
| 6777 | "OSPF Administrative distance\n" |
| 6778 | "External routes\n" |
| 6779 | "Distance for external routes\n" |
| 6780 | "Intra-area routes\n" |
| 6781 | "Distance for intra-area routes\n") |
| 6782 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6783 | struct ospf *ospf = vty->index; |
| 6784 | |
| 6785 | ospf->distance_external = atoi (argv[0]); |
| 6786 | ospf->distance_intra = atoi (argv[1]); |
| 6787 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6788 | return CMD_SUCCESS; |
| 6789 | } |
| 6790 | |
| 6791 | DEFUN (ospf_distance_ospf_external_inter, |
| 6792 | ospf_distance_ospf_external_inter_cmd, |
| 6793 | "distance ospf external <1-255> inter-area <1-255>", |
| 6794 | "Define an administrative distance\n" |
| 6795 | "OSPF Administrative distance\n" |
| 6796 | "External routes\n" |
| 6797 | "Distance for external routes\n" |
| 6798 | "Inter-area routes\n" |
| 6799 | "Distance for inter-area routes\n") |
| 6800 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6801 | struct ospf *ospf = vty->index; |
| 6802 | |
| 6803 | ospf->distance_external = atoi (argv[0]); |
| 6804 | ospf->distance_inter = atoi (argv[1]); |
| 6805 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6806 | return CMD_SUCCESS; |
| 6807 | } |
| 6808 | |
| 6809 | DEFUN (ospf_distance_ospf_external_intra_inter, |
| 6810 | ospf_distance_ospf_external_intra_inter_cmd, |
| 6811 | "distance ospf external <1-255> intra-area <1-255> inter-area <1-255>", |
| 6812 | "Define an administrative distance\n" |
| 6813 | "OSPF Administrative distance\n" |
| 6814 | "External routes\n" |
| 6815 | "Distance for external routes\n" |
| 6816 | "Intra-area routes\n" |
| 6817 | "Distance for intra-area routes\n" |
| 6818 | "Inter-area routes\n" |
| 6819 | "Distance for inter-area routes\n") |
| 6820 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6821 | struct ospf *ospf = vty->index; |
| 6822 | |
| 6823 | ospf->distance_external = atoi (argv[0]); |
| 6824 | ospf->distance_intra = atoi (argv[1]); |
| 6825 | ospf->distance_inter = atoi (argv[2]); |
| 6826 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6827 | return CMD_SUCCESS; |
| 6828 | } |
| 6829 | |
| 6830 | DEFUN (ospf_distance_ospf_external_inter_intra, |
| 6831 | ospf_distance_ospf_external_inter_intra_cmd, |
| 6832 | "distance ospf external <1-255> inter-area <1-255> intra-area <1-255>", |
| 6833 | "Define an administrative distance\n" |
| 6834 | "OSPF Administrative distance\n" |
| 6835 | "External routes\n" |
| 6836 | "Distance for external routes\n" |
| 6837 | "Inter-area routes\n" |
| 6838 | "Distance for inter-area routes\n" |
| 6839 | "Intra-area routes\n" |
| 6840 | "Distance for intra-area routes\n") |
| 6841 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6842 | struct ospf *ospf = vty->index; |
| 6843 | |
| 6844 | ospf->distance_external = atoi (argv[0]); |
| 6845 | ospf->distance_inter = atoi (argv[1]); |
| 6846 | ospf->distance_intra = atoi (argv[2]); |
| 6847 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6848 | return CMD_SUCCESS; |
| 6849 | } |
| 6850 | |
| 6851 | DEFUN (ospf_distance_source, |
| 6852 | ospf_distance_source_cmd, |
| 6853 | "distance <1-255> A.B.C.D/M", |
| 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_set (vty, ospf, argv[0], argv[1], NULL); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 6861 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6862 | return CMD_SUCCESS; |
| 6863 | } |
| 6864 | |
| 6865 | DEFUN (no_ospf_distance_source, |
| 6866 | no_ospf_distance_source_cmd, |
| 6867 | "no distance <1-255> A.B.C.D/M", |
| 6868 | NO_STR |
| 6869 | "Administrative distance\n" |
| 6870 | "Distance value\n" |
| 6871 | "IP source prefix\n") |
| 6872 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6873 | struct ospf *ospf = vty->index; |
| 6874 | |
| 6875 | ospf_distance_unset (vty, ospf, argv[0], argv[1], NULL); |
| 6876 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6877 | return CMD_SUCCESS; |
| 6878 | } |
| 6879 | |
| 6880 | DEFUN (ospf_distance_source_access_list, |
| 6881 | ospf_distance_source_access_list_cmd, |
| 6882 | "distance <1-255> A.B.C.D/M WORD", |
| 6883 | "Administrative distance\n" |
| 6884 | "Distance value\n" |
| 6885 | "IP source prefix\n" |
| 6886 | "Access list name\n") |
| 6887 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6888 | struct ospf *ospf = vty->index; |
| 6889 | |
| 6890 | ospf_distance_set (vty, ospf, argv[0], argv[1], argv[2]); |
| 6891 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6892 | return CMD_SUCCESS; |
| 6893 | } |
| 6894 | |
| 6895 | DEFUN (no_ospf_distance_source_access_list, |
| 6896 | no_ospf_distance_source_access_list_cmd, |
| 6897 | "no distance <1-255> A.B.C.D/M WORD", |
| 6898 | NO_STR |
| 6899 | "Administrative distance\n" |
| 6900 | "Distance value\n" |
| 6901 | "IP source prefix\n" |
| 6902 | "Access list name\n") |
| 6903 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 6904 | struct ospf *ospf = vty->index; |
| 6905 | |
| 6906 | ospf_distance_unset (vty, ospf, argv[0], argv[1], argv[2]); |
| 6907 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 6908 | return CMD_SUCCESS; |
| 6909 | } |
| 6910 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 6911 | DEFUN (ip_ospf_mtu_ignore, |
| 6912 | ip_ospf_mtu_ignore_addr_cmd, |
| 6913 | "ip ospf mtu-ignore A.B.C.D", |
| 6914 | "IP Information\n" |
| 6915 | "OSPF interface commands\n" |
| 6916 | "Disable mtu mismatch detection\n" |
| 6917 | "Address of interface") |
| 6918 | { |
| 6919 | struct interface *ifp = vty->index; |
| 6920 | struct in_addr addr; |
| 6921 | int ret; |
| 6922 | |
| 6923 | struct ospf_if_params *params; |
| 6924 | params = IF_DEF_PARAMS (ifp); |
| 6925 | |
| 6926 | if (argc == 1) |
| 6927 | { |
| 6928 | ret = inet_aton(argv[0], &addr); |
| 6929 | if (!ret) |
| 6930 | { |
| 6931 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6932 | VTY_NEWLINE); |
| 6933 | return CMD_WARNING; |
| 6934 | } |
| 6935 | params = ospf_get_if_params (ifp, addr); |
| 6936 | ospf_if_update_params (ifp, addr); |
| 6937 | } |
| 6938 | params->mtu_ignore = 1; |
| 6939 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6940 | SET_IF_PARAM (params, mtu_ignore); |
| 6941 | else |
| 6942 | { |
| 6943 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6944 | if (params != IF_DEF_PARAMS (ifp)) |
| 6945 | { |
| 6946 | ospf_free_if_params (ifp, addr); |
| 6947 | ospf_if_update_params (ifp, addr); |
| 6948 | } |
| 6949 | } |
| 6950 | return CMD_SUCCESS; |
| 6951 | } |
| 6952 | |
| 6953 | ALIAS (ip_ospf_mtu_ignore, |
| 6954 | ip_ospf_mtu_ignore_cmd, |
| 6955 | "ip ospf mtu-ignore", |
| 6956 | "IP Information\n" |
| 6957 | "OSPF interface commands\n" |
| 6958 | "Disable mtu mismatch detection\n") |
| 6959 | |
| 6960 | |
| 6961 | DEFUN (no_ip_ospf_mtu_ignore, |
| 6962 | no_ip_ospf_mtu_ignore_addr_cmd, |
| 6963 | "no ip ospf mtu-ignore A.B.C.D", |
| 6964 | "IP Information\n" |
| 6965 | "OSPF interface commands\n" |
| 6966 | "Disable mtu mismatch detection\n" |
| 6967 | "Address of interface") |
| 6968 | { |
| 6969 | struct interface *ifp = vty->index; |
| 6970 | struct in_addr addr; |
| 6971 | int ret; |
| 6972 | |
| 6973 | struct ospf_if_params *params; |
| 6974 | params = IF_DEF_PARAMS (ifp); |
| 6975 | |
| 6976 | if (argc == 1) |
| 6977 | { |
| 6978 | ret = inet_aton(argv[0], &addr); |
| 6979 | if (!ret) |
| 6980 | { |
| 6981 | vty_out (vty, "Please specify interface address by A.B.C.D%s", |
| 6982 | VTY_NEWLINE); |
| 6983 | return CMD_WARNING; |
| 6984 | } |
| 6985 | params = ospf_get_if_params (ifp, addr); |
| 6986 | ospf_if_update_params (ifp, addr); |
| 6987 | } |
| 6988 | params->mtu_ignore = 0; |
| 6989 | if (params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 6990 | SET_IF_PARAM (params, mtu_ignore); |
| 6991 | else |
| 6992 | { |
| 6993 | UNSET_IF_PARAM (params, mtu_ignore); |
| 6994 | if (params != IF_DEF_PARAMS (ifp)) |
| 6995 | { |
| 6996 | ospf_free_if_params (ifp, addr); |
| 6997 | ospf_if_update_params (ifp, addr); |
| 6998 | } |
| 6999 | } |
| 7000 | return CMD_SUCCESS; |
| 7001 | } |
| 7002 | |
| 7003 | ALIAS (no_ip_ospf_mtu_ignore, |
| 7004 | no_ip_ospf_mtu_ignore_cmd, |
| 7005 | "no ip ospf mtu-ignore", |
| 7006 | "IP Information\n" |
| 7007 | "OSPF interface commands\n" |
| 7008 | "Disable mtu mismatch detection\n") |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7009 | |
| 7010 | DEFUN (ospf_max_metric_router_lsa_admin, |
| 7011 | ospf_max_metric_router_lsa_admin_cmd, |
| 7012 | "max-metric router-lsa administrative", |
| 7013 | "OSPF maximum / infinite-distance metric\n" |
| 7014 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7015 | "Administratively applied, for an indefinite period\n") |
| 7016 | { |
| 7017 | struct listnode *ln; |
| 7018 | struct ospf_area *area; |
| 7019 | struct ospf *ospf = vty->index; |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7020 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7021 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7022 | { |
| 7023 | SET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 7024 | |
| 7025 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED)) |
Paul Jakma | c363d38 | 2010-01-24 22:42:13 +0000 | [diff] [blame] | 7026 | ospf_router_lsa_update_area (area); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7027 | } |
Ayan Banerjee | 4ba4fc8 | 2012-12-03 11:17:24 -0800 | [diff] [blame] | 7028 | |
| 7029 | /* Allows for areas configured later to get the property */ |
| 7030 | ospf->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_SET; |
| 7031 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7032 | return CMD_SUCCESS; |
| 7033 | } |
| 7034 | |
| 7035 | DEFUN (no_ospf_max_metric_router_lsa_admin, |
| 7036 | no_ospf_max_metric_router_lsa_admin_cmd, |
| 7037 | "no max-metric router-lsa administrative", |
| 7038 | NO_STR |
| 7039 | "OSPF maximum / infinite-distance metric\n" |
| 7040 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7041 | "Administratively applied, for an indefinite period\n") |
| 7042 | { |
| 7043 | struct listnode *ln; |
| 7044 | struct ospf_area *area; |
| 7045 | struct ospf *ospf = vty->index; |
| 7046 | |
| 7047 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7048 | { |
| 7049 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED); |
| 7050 | |
| 7051 | /* Don't trample on the start-up stub timer */ |
| 7052 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED) |
| 7053 | && !area->t_stub_router) |
| 7054 | { |
| 7055 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
Paul Jakma | c363d38 | 2010-01-24 22:42:13 +0000 | [diff] [blame] | 7056 | ospf_router_lsa_update_area (area); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7057 | } |
| 7058 | } |
Ayan Banerjee | 4ba4fc8 | 2012-12-03 11:17:24 -0800 | [diff] [blame] | 7059 | ospf->stub_router_admin_set = OSPF_STUB_ROUTER_ADMINISTRATIVE_UNSET; |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7060 | return CMD_SUCCESS; |
| 7061 | } |
| 7062 | |
| 7063 | DEFUN (ospf_max_metric_router_lsa_startup, |
| 7064 | ospf_max_metric_router_lsa_startup_cmd, |
| 7065 | "max-metric router-lsa on-startup <5-86400>", |
| 7066 | "OSPF maximum / infinite-distance metric\n" |
| 7067 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7068 | "Automatically advertise stub Router-LSA on startup of OSPF\n" |
| 7069 | "Time (seconds) to advertise self as stub-router\n") |
| 7070 | { |
| 7071 | unsigned int seconds; |
| 7072 | struct ospf *ospf = vty->index; |
| 7073 | |
| 7074 | if (argc != 1) |
| 7075 | { |
| 7076 | vty_out (vty, "%% Must supply stub-router period"); |
| 7077 | return CMD_WARNING; |
| 7078 | } |
| 7079 | |
| 7080 | VTY_GET_INTEGER ("stub-router startup period", seconds, argv[0]); |
| 7081 | |
| 7082 | ospf->stub_router_startup_time = seconds; |
| 7083 | |
| 7084 | return CMD_SUCCESS; |
| 7085 | } |
| 7086 | |
| 7087 | DEFUN (no_ospf_max_metric_router_lsa_startup, |
| 7088 | no_ospf_max_metric_router_lsa_startup_cmd, |
| 7089 | "no max-metric router-lsa on-startup", |
| 7090 | NO_STR |
| 7091 | "OSPF maximum / infinite-distance metric\n" |
| 7092 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7093 | "Automatically advertise stub Router-LSA on startup of OSPF\n") |
| 7094 | { |
| 7095 | struct listnode *ln; |
| 7096 | struct ospf_area *area; |
| 7097 | struct ospf *ospf = vty->index; |
| 7098 | |
| 7099 | ospf->stub_router_startup_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 7100 | |
| 7101 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7102 | { |
| 7103 | SET_FLAG (area->stub_router_state, OSPF_AREA_WAS_START_STUB_ROUTED); |
| 7104 | OSPF_TIMER_OFF (area->t_stub_router); |
| 7105 | |
| 7106 | /* Don't trample on admin stub routed */ |
| 7107 | if (!CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 7108 | { |
| 7109 | UNSET_FLAG (area->stub_router_state, OSPF_AREA_IS_STUB_ROUTED); |
Paul Jakma | c363d38 | 2010-01-24 22:42:13 +0000 | [diff] [blame] | 7110 | ospf_router_lsa_update_area (area); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 7111 | } |
| 7112 | } |
| 7113 | return CMD_SUCCESS; |
| 7114 | } |
| 7115 | |
| 7116 | DEFUN (ospf_max_metric_router_lsa_shutdown, |
| 7117 | ospf_max_metric_router_lsa_shutdown_cmd, |
| 7118 | "max-metric router-lsa on-shutdown <5-86400>", |
| 7119 | "OSPF maximum / infinite-distance metric\n" |
| 7120 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7121 | "Advertise stub-router prior to full shutdown of OSPF\n" |
| 7122 | "Time (seconds) to wait till full shutdown\n") |
| 7123 | { |
| 7124 | unsigned int seconds; |
| 7125 | struct ospf *ospf = vty->index; |
| 7126 | |
| 7127 | if (argc != 1) |
| 7128 | { |
| 7129 | vty_out (vty, "%% Must supply stub-router shutdown period"); |
| 7130 | return CMD_WARNING; |
| 7131 | } |
| 7132 | |
| 7133 | VTY_GET_INTEGER ("stub-router shutdown wait period", seconds, argv[0]); |
| 7134 | |
| 7135 | ospf->stub_router_shutdown_time = seconds; |
| 7136 | |
| 7137 | return CMD_SUCCESS; |
| 7138 | } |
| 7139 | |
| 7140 | DEFUN (no_ospf_max_metric_router_lsa_shutdown, |
| 7141 | no_ospf_max_metric_router_lsa_shutdown_cmd, |
| 7142 | "no max-metric router-lsa on-shutdown", |
| 7143 | NO_STR |
| 7144 | "OSPF maximum / infinite-distance metric\n" |
| 7145 | "Advertise own Router-LSA with infinite distance (stub router)\n" |
| 7146 | "Advertise stub-router prior to full shutdown of OSPF\n") |
| 7147 | { |
| 7148 | struct ospf *ospf = vty->index; |
| 7149 | |
| 7150 | ospf->stub_router_shutdown_time = OSPF_STUB_ROUTER_UNCONFIGURED; |
| 7151 | |
| 7152 | return CMD_SUCCESS; |
| 7153 | } |
| 7154 | |
| 7155 | static void |
| 7156 | config_write_stub_router (struct vty *vty, struct ospf *ospf) |
| 7157 | { |
| 7158 | struct listnode *ln; |
| 7159 | struct ospf_area *area; |
| 7160 | |
| 7161 | if (ospf->stub_router_startup_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 7162 | vty_out (vty, " max-metric router-lsa on-startup %u%s", |
| 7163 | ospf->stub_router_startup_time, VTY_NEWLINE); |
| 7164 | if (ospf->stub_router_shutdown_time != OSPF_STUB_ROUTER_UNCONFIGURED) |
| 7165 | vty_out (vty, " max-metric router-lsa on-shutdown %u%s", |
| 7166 | ospf->stub_router_shutdown_time, VTY_NEWLINE); |
| 7167 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, ln, area)) |
| 7168 | { |
| 7169 | if (CHECK_FLAG (area->stub_router_state, OSPF_AREA_ADMIN_STUB_ROUTED)) |
| 7170 | { |
| 7171 | vty_out (vty, " max-metric router-lsa administrative%s", |
| 7172 | VTY_NEWLINE); |
| 7173 | break; |
| 7174 | } |
| 7175 | } |
| 7176 | return; |
| 7177 | } |
| 7178 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7179 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7180 | show_ip_ospf_route_network (struct vty *vty, struct route_table *rt) |
| 7181 | { |
| 7182 | struct route_node *rn; |
| 7183 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7184 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7185 | struct ospf_path *path; |
| 7186 | |
| 7187 | vty_out (vty, "============ OSPF network routing table ============%s", |
| 7188 | VTY_NEWLINE); |
| 7189 | |
| 7190 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7191 | if ((or = rn->info) != NULL) |
| 7192 | { |
| 7193 | char buf1[19]; |
| 7194 | snprintf (buf1, 19, "%s/%d", |
| 7195 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7196 | |
| 7197 | switch (or->path_type) |
| 7198 | { |
| 7199 | case OSPF_PATH_INTER_AREA: |
| 7200 | if (or->type == OSPF_DESTINATION_NETWORK) |
| 7201 | vty_out (vty, "N IA %-18s [%d] area: %s%s", buf1, or->cost, |
| 7202 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7203 | else if (or->type == OSPF_DESTINATION_DISCARD) |
| 7204 | vty_out (vty, "D IA %-18s Discard entry%s", buf1, VTY_NEWLINE); |
| 7205 | break; |
| 7206 | case OSPF_PATH_INTRA_AREA: |
| 7207 | vty_out (vty, "N %-18s [%d] area: %s%s", buf1, or->cost, |
| 7208 | inet_ntoa (or->u.std.area_id), VTY_NEWLINE); |
| 7209 | break; |
| 7210 | default: |
| 7211 | break; |
| 7212 | } |
| 7213 | |
| 7214 | if (or->type == OSPF_DESTINATION_NETWORK) |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7215 | for (ALL_LIST_ELEMENTS (or->paths, pnode, pnnode, path)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7216 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7217 | if (if_lookup_by_index(path->ifindex)) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7218 | { |
| 7219 | if (path->nexthop.s_addr == 0) |
| 7220 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7221 | "", ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7222 | else |
| 7223 | vty_out (vty, "%24s via %s, %s%s", "", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7224 | inet_ntoa (path->nexthop), |
| 7225 | ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7226 | } |
| 7227 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7228 | } |
| 7229 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7230 | } |
| 7231 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7232 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7233 | show_ip_ospf_route_router (struct vty *vty, struct route_table *rtrs) |
| 7234 | { |
| 7235 | struct route_node *rn; |
| 7236 | struct ospf_route *or; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7237 | struct listnode *pnode; |
| 7238 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7239 | struct ospf_path *path; |
| 7240 | |
| 7241 | vty_out (vty, "============ OSPF router routing table =============%s", |
| 7242 | VTY_NEWLINE); |
| 7243 | for (rn = route_top (rtrs); rn; rn = route_next (rn)) |
| 7244 | if (rn->info) |
| 7245 | { |
| 7246 | int flag = 0; |
| 7247 | |
| 7248 | vty_out (vty, "R %-15s ", inet_ntoa (rn->p.u.prefix4)); |
| 7249 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7250 | for (ALL_LIST_ELEMENTS_RO ((struct list *)rn->info, node, or)) |
| 7251 | { |
| 7252 | if (flag++) |
| 7253 | vty_out (vty, "%24s", ""); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7254 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7255 | /* Show path. */ |
| 7256 | vty_out (vty, "%s [%d] area: %s", |
| 7257 | (or->path_type == OSPF_PATH_INTER_AREA ? "IA" : " "), |
| 7258 | or->cost, inet_ntoa (or->u.std.area_id)); |
| 7259 | /* Show flags. */ |
| 7260 | vty_out (vty, "%s%s%s", |
| 7261 | (or->u.std.flags & ROUTER_LSA_BORDER ? ", ABR" : ""), |
| 7262 | (or->u.std.flags & ROUTER_LSA_EXTERNAL ? ", ASBR" : ""), |
| 7263 | VTY_NEWLINE); |
| 7264 | |
| 7265 | for (ALL_LIST_ELEMENTS_RO (or->paths, pnode, path)) |
| 7266 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7267 | if (if_lookup_by_index(path->ifindex)) |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7268 | { |
| 7269 | if (path->nexthop.s_addr == 0) |
| 7270 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7271 | "", ifindex2ifname (path->ifindex), |
| 7272 | VTY_NEWLINE); |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7273 | else |
| 7274 | vty_out (vty, "%24s via %s, %s%s", "", |
| 7275 | inet_ntoa (path->nexthop), |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7276 | ifindex2ifname (path->ifindex), |
| 7277 | VTY_NEWLINE); |
hasso | 54bedb5 | 2005-08-17 13:31:47 +0000 | [diff] [blame] | 7278 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7279 | } |
| 7280 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7281 | } |
| 7282 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7283 | } |
| 7284 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7285 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7286 | show_ip_ospf_route_external (struct vty *vty, struct route_table *rt) |
| 7287 | { |
| 7288 | struct route_node *rn; |
| 7289 | struct ospf_route *er; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7290 | struct listnode *pnode, *pnnode; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7291 | struct ospf_path *path; |
| 7292 | |
| 7293 | vty_out (vty, "============ OSPF external routing table ===========%s", |
| 7294 | VTY_NEWLINE); |
| 7295 | for (rn = route_top (rt); rn; rn = route_next (rn)) |
| 7296 | if ((er = rn->info) != NULL) |
| 7297 | { |
| 7298 | char buf1[19]; |
| 7299 | snprintf (buf1, 19, "%s/%d", |
| 7300 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen); |
| 7301 | |
| 7302 | switch (er->path_type) |
| 7303 | { |
| 7304 | case OSPF_PATH_TYPE1_EXTERNAL: |
| 7305 | vty_out (vty, "N E1 %-18s [%d] tag: %u%s", buf1, |
| 7306 | er->cost, er->u.ext.tag, VTY_NEWLINE); |
| 7307 | break; |
| 7308 | case OSPF_PATH_TYPE2_EXTERNAL: |
| 7309 | vty_out (vty, "N E2 %-18s [%d/%d] tag: %u%s", buf1, er->cost, |
| 7310 | er->u.ext.type2_cost, er->u.ext.tag, VTY_NEWLINE); |
| 7311 | break; |
| 7312 | } |
| 7313 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7314 | for (ALL_LIST_ELEMENTS (er->paths, pnode, pnnode, path)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7315 | { |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7316 | if (if_lookup_by_index(path->ifindex)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7317 | { |
| 7318 | if (path->nexthop.s_addr == 0) |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7319 | vty_out (vty, "%24s directly attached to %s%s", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7320 | "", ifindex2ifname (path->ifindex), VTY_NEWLINE); |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7321 | else |
| 7322 | vty_out (vty, "%24s via %s, %s%s", "", |
Joakim Tjernlund | a8ba847 | 2009-07-27 12:42:34 +0200 | [diff] [blame] | 7323 | inet_ntoa (path->nexthop), |
| 7324 | ifindex2ifname (path->ifindex), |
paul | 96735ee | 2003-08-10 02:51:22 +0000 | [diff] [blame] | 7325 | VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7326 | } |
| 7327 | } |
| 7328 | } |
| 7329 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7330 | } |
| 7331 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7332 | DEFUN (show_ip_ospf_border_routers, |
| 7333 | show_ip_ospf_border_routers_cmd, |
| 7334 | "show ip ospf border-routers", |
| 7335 | SHOW_STR |
| 7336 | IP_STR |
| 7337 | "show all the ABR's and ASBR's\n" |
| 7338 | "for this area\n") |
| 7339 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7340 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7341 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7342 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7343 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7344 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7345 | return CMD_SUCCESS; |
| 7346 | } |
| 7347 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7348 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7349 | { |
| 7350 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7351 | return CMD_SUCCESS; |
| 7352 | } |
| 7353 | |
| 7354 | /* Show Network routes. |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7355 | show_ip_ospf_route_network (vty, ospf->new_table); */ |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7356 | |
| 7357 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7358 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7359 | |
| 7360 | return CMD_SUCCESS; |
| 7361 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7362 | |
| 7363 | DEFUN (show_ip_ospf_route, |
| 7364 | show_ip_ospf_route_cmd, |
| 7365 | "show ip ospf route", |
| 7366 | SHOW_STR |
| 7367 | IP_STR |
| 7368 | "OSPF information\n" |
| 7369 | "OSPF routing table\n") |
| 7370 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7371 | struct ospf *ospf; |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7372 | |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7373 | if ((ospf = ospf_lookup ()) == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7374 | { |
Paul Jakma | cac3b5c | 2006-05-11 13:31:11 +0000 | [diff] [blame] | 7375 | vty_out (vty, " OSPF Routing Process not enabled%s", VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7376 | return CMD_SUCCESS; |
| 7377 | } |
| 7378 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7379 | if (ospf->new_table == NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7380 | { |
| 7381 | vty_out (vty, "No OSPF routing information exist%s", VTY_NEWLINE); |
| 7382 | return CMD_SUCCESS; |
| 7383 | } |
| 7384 | |
| 7385 | /* Show Network routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7386 | show_ip_ospf_route_network (vty, ospf->new_table); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7387 | |
| 7388 | /* Show Router routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7389 | show_ip_ospf_route_router (vty, ospf->new_rtrs); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7390 | |
| 7391 | /* Show AS External routes. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7392 | show_ip_ospf_route_external (vty, ospf->old_external_route); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7393 | |
| 7394 | return CMD_SUCCESS; |
| 7395 | } |
| 7396 | |
| 7397 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7398 | const char *ospf_abr_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7399 | { |
| 7400 | "unknown", |
| 7401 | "standard", |
| 7402 | "ibm", |
| 7403 | "cisco", |
| 7404 | "shortcut" |
| 7405 | }; |
| 7406 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7407 | const char *ospf_shortcut_mode_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7408 | { |
| 7409 | "default", |
| 7410 | "enable", |
| 7411 | "disable" |
| 7412 | }; |
| 7413 | |
| 7414 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7415 | static void |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7416 | area_id2str (char *buf, int length, struct ospf_area *area) |
| 7417 | { |
| 7418 | memset (buf, 0, length); |
| 7419 | |
| 7420 | if (area->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
| 7421 | strncpy (buf, inet_ntoa (area->area_id), length); |
| 7422 | else |
| 7423 | sprintf (buf, "%lu", (unsigned long) ntohl (area->area_id.s_addr)); |
| 7424 | } |
| 7425 | |
| 7426 | |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7427 | const char *ospf_int_type_str[] = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7428 | { |
| 7429 | "unknown", /* should never be used. */ |
| 7430 | "point-to-point", |
| 7431 | "broadcast", |
| 7432 | "non-broadcast", |
| 7433 | "point-to-multipoint", |
| 7434 | "virtual-link", /* should never be used. */ |
| 7435 | "loopback" |
| 7436 | }; |
| 7437 | |
| 7438 | /* Configuration write function for ospfd. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7439 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7440 | config_write_interface (struct vty *vty) |
| 7441 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7442 | struct listnode *n1, *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7443 | struct interface *ifp; |
| 7444 | struct crypt_key *ck; |
| 7445 | int write = 0; |
| 7446 | struct route_node *rn = NULL; |
| 7447 | struct ospf_if_params *params; |
| 7448 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7449 | for (ALL_LIST_ELEMENTS_RO (iflist, n1, ifp)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7450 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7451 | if (memcmp (ifp->name, "VLINK", 5) == 0) |
| 7452 | continue; |
| 7453 | |
| 7454 | vty_out (vty, "!%s", VTY_NEWLINE); |
| 7455 | vty_out (vty, "interface %s%s", ifp->name, |
| 7456 | VTY_NEWLINE); |
| 7457 | if (ifp->desc) |
| 7458 | vty_out (vty, " description %s%s", ifp->desc, |
| 7459 | VTY_NEWLINE); |
| 7460 | |
| 7461 | write++; |
| 7462 | |
| 7463 | params = IF_DEF_PARAMS (ifp); |
| 7464 | |
| 7465 | do { |
| 7466 | /* Interface Network print. */ |
| 7467 | if (OSPF_IF_PARAM_CONFIGURED (params, type) && |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7468 | params->type != OSPF_IFTYPE_LOOPBACK) |
| 7469 | { |
ajs | bc18d61 | 2004-12-15 15:07:19 +0000 | [diff] [blame] | 7470 | if (params->type != ospf_default_iftype(ifp)) |
hasso | 7b90143 | 2004-08-31 13:37:42 +0000 | [diff] [blame] | 7471 | { |
| 7472 | vty_out (vty, " ip ospf network %s", |
| 7473 | ospf_int_type_str[params->type]); |
| 7474 | if (params != IF_DEF_PARAMS (ifp)) |
| 7475 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7476 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7477 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7478 | } |
| 7479 | |
| 7480 | /* OSPF interface authentication print */ |
| 7481 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_type) && |
| 7482 | params->auth_type != OSPF_AUTH_NOTSET) |
| 7483 | { |
hasso | eb1ce60 | 2004-10-08 08:17:22 +0000 | [diff] [blame] | 7484 | const char *auth_str; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7485 | |
| 7486 | /* Translation tables are not that much help here due to syntax |
| 7487 | of the simple option */ |
| 7488 | switch (params->auth_type) |
| 7489 | { |
| 7490 | |
| 7491 | case OSPF_AUTH_NULL: |
| 7492 | auth_str = " null"; |
| 7493 | break; |
| 7494 | |
| 7495 | case OSPF_AUTH_SIMPLE: |
| 7496 | auth_str = ""; |
| 7497 | break; |
| 7498 | |
| 7499 | case OSPF_AUTH_CRYPTOGRAPHIC: |
| 7500 | auth_str = " message-digest"; |
| 7501 | break; |
| 7502 | |
| 7503 | default: |
| 7504 | auth_str = ""; |
| 7505 | break; |
| 7506 | } |
| 7507 | |
| 7508 | vty_out (vty, " ip ospf authentication%s", auth_str); |
| 7509 | if (params != IF_DEF_PARAMS (ifp)) |
| 7510 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7511 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7512 | } |
| 7513 | |
| 7514 | /* Simple Authentication Password print. */ |
| 7515 | if (OSPF_IF_PARAM_CONFIGURED (params, auth_simple) && |
| 7516 | params->auth_simple[0] != '\0') |
| 7517 | { |
| 7518 | vty_out (vty, " ip ospf authentication-key %s", |
| 7519 | params->auth_simple); |
| 7520 | if (params != IF_DEF_PARAMS (ifp)) |
| 7521 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7522 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7523 | } |
| 7524 | |
| 7525 | /* Cryptographic Authentication Key print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7526 | for (ALL_LIST_ELEMENTS_RO (params->auth_crypt, n2, ck)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7527 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7528 | vty_out (vty, " ip ospf message-digest-key %d md5 %s", |
| 7529 | ck->key_id, ck->auth_key); |
| 7530 | if (params != IF_DEF_PARAMS (ifp)) |
| 7531 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7532 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7533 | } |
| 7534 | |
| 7535 | /* Interface Output Cost print. */ |
| 7536 | if (OSPF_IF_PARAM_CONFIGURED (params, output_cost_cmd)) |
| 7537 | { |
| 7538 | vty_out (vty, " ip ospf cost %u", params->output_cost_cmd); |
| 7539 | if (params != IF_DEF_PARAMS (ifp)) |
| 7540 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7541 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7542 | } |
| 7543 | |
| 7544 | /* Hello Interval print. */ |
| 7545 | if (OSPF_IF_PARAM_CONFIGURED (params, v_hello) && |
| 7546 | params->v_hello != OSPF_HELLO_INTERVAL_DEFAULT) |
| 7547 | { |
| 7548 | vty_out (vty, " ip ospf hello-interval %u", params->v_hello); |
| 7549 | if (params != IF_DEF_PARAMS (ifp)) |
| 7550 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7551 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7552 | } |
| 7553 | |
| 7554 | |
| 7555 | /* Router Dead Interval print. */ |
| 7556 | if (OSPF_IF_PARAM_CONFIGURED (params, v_wait) && |
| 7557 | params->v_wait != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT) |
| 7558 | { |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 7559 | vty_out (vty, " ip ospf dead-interval "); |
| 7560 | |
| 7561 | /* fast hello ? */ |
| 7562 | if (OSPF_IF_PARAM_CONFIGURED (params, fast_hello)) |
| 7563 | vty_out (vty, "minimal hello-multiplier %d", |
| 7564 | params->fast_hello); |
| 7565 | else |
| 7566 | vty_out (vty, "%u", params->v_wait); |
| 7567 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7568 | if (params != IF_DEF_PARAMS (ifp)) |
| 7569 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7570 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7571 | } |
| 7572 | |
| 7573 | /* Router Priority print. */ |
| 7574 | if (OSPF_IF_PARAM_CONFIGURED (params, priority) && |
| 7575 | params->priority != OSPF_ROUTER_PRIORITY_DEFAULT) |
| 7576 | { |
| 7577 | vty_out (vty, " ip ospf priority %u", params->priority); |
| 7578 | if (params != IF_DEF_PARAMS (ifp)) |
| 7579 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7580 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7581 | } |
| 7582 | |
| 7583 | /* Retransmit Interval print. */ |
| 7584 | if (OSPF_IF_PARAM_CONFIGURED (params, retransmit_interval) && |
| 7585 | params->retransmit_interval != OSPF_RETRANSMIT_INTERVAL_DEFAULT) |
| 7586 | { |
| 7587 | vty_out (vty, " ip ospf retransmit-interval %u", |
| 7588 | params->retransmit_interval); |
| 7589 | if (params != IF_DEF_PARAMS (ifp)) |
| 7590 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7591 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7592 | } |
| 7593 | |
| 7594 | /* Transmit Delay print. */ |
| 7595 | if (OSPF_IF_PARAM_CONFIGURED (params, transmit_delay) && |
| 7596 | params->transmit_delay != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7597 | { |
| 7598 | vty_out (vty, " ip ospf transmit-delay %u", params->transmit_delay); |
| 7599 | if (params != IF_DEF_PARAMS (ifp)) |
| 7600 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7601 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7602 | } |
| 7603 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 7604 | /* MTU ignore print. */ |
| 7605 | if (OSPF_IF_PARAM_CONFIGURED (params, mtu_ignore) && |
| 7606 | params->mtu_ignore != OSPF_MTU_IGNORE_DEFAULT) |
| 7607 | { |
| 7608 | if (params->mtu_ignore == 0) |
| 7609 | vty_out (vty, " no ip ospf mtu-ignore"); |
| 7610 | else |
| 7611 | vty_out (vty, " ip ospf mtu-ignore"); |
| 7612 | if (params != IF_DEF_PARAMS (ifp)) |
| 7613 | vty_out (vty, " %s", inet_ntoa (rn->p.u.prefix4)); |
| 7614 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7615 | } |
| 7616 | |
| 7617 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7618 | while (1) |
| 7619 | { |
| 7620 | if (rn == NULL) |
| 7621 | rn = route_top (IF_OIFS_PARAMS (ifp)); |
| 7622 | else |
| 7623 | rn = route_next (rn); |
| 7624 | |
| 7625 | if (rn == NULL) |
| 7626 | break; |
| 7627 | params = rn->info; |
| 7628 | if (params != NULL) |
| 7629 | break; |
| 7630 | } |
| 7631 | } while (rn); |
| 7632 | |
| 7633 | #ifdef HAVE_OPAQUE_LSA |
| 7634 | ospf_opaque_config_write_if (vty, ifp); |
| 7635 | #endif /* HAVE_OPAQUE_LSA */ |
| 7636 | } |
| 7637 | |
| 7638 | return write; |
| 7639 | } |
| 7640 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7641 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7642 | config_write_network_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7643 | { |
| 7644 | struct route_node *rn; |
| 7645 | u_char buf[INET_ADDRSTRLEN]; |
| 7646 | |
| 7647 | /* `network area' print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7648 | for (rn = route_top (ospf->networks); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7649 | if (rn->info) |
| 7650 | { |
| 7651 | struct ospf_network *n = rn->info; |
| 7652 | |
| 7653 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7654 | |
| 7655 | /* Create Area ID string by specified Area ID format. */ |
| 7656 | if (n->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7657 | strncpy ((char *) buf, inet_ntoa (n->area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7658 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7659 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7660 | (unsigned long int) ntohl (n->area_id.s_addr)); |
| 7661 | |
| 7662 | /* Network print. */ |
| 7663 | vty_out (vty, " network %s/%d area %s%s", |
| 7664 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7665 | buf, VTY_NEWLINE); |
| 7666 | } |
| 7667 | |
| 7668 | return 0; |
| 7669 | } |
| 7670 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7671 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7672 | config_write_ospf_area (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7673 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7674 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7675 | struct ospf_area *area; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7676 | u_char buf[INET_ADDRSTRLEN]; |
| 7677 | |
| 7678 | /* Area configuration print. */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7679 | for (ALL_LIST_ELEMENTS_RO (ospf->areas, node, area)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7680 | { |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7681 | struct route_node *rn1; |
| 7682 | |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7683 | area_id2str ((char *) buf, INET_ADDRSTRLEN, area); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7684 | |
| 7685 | if (area->auth_type != OSPF_AUTH_NULL) |
| 7686 | { |
| 7687 | if (area->auth_type == OSPF_AUTH_SIMPLE) |
| 7688 | vty_out (vty, " area %s authentication%s", buf, VTY_NEWLINE); |
| 7689 | else |
| 7690 | vty_out (vty, " area %s authentication message-digest%s", |
| 7691 | buf, VTY_NEWLINE); |
| 7692 | } |
| 7693 | |
| 7694 | if (area->shortcut_configured != OSPF_SHORTCUT_DEFAULT) |
| 7695 | vty_out (vty, " area %s shortcut %s%s", buf, |
| 7696 | ospf_shortcut_mode_str[area->shortcut_configured], |
| 7697 | VTY_NEWLINE); |
| 7698 | |
| 7699 | if ((area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7700 | || (area->external_routing == OSPF_AREA_NSSA) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7701 | ) |
| 7702 | { |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7703 | if (area->external_routing == OSPF_AREA_STUB) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7704 | vty_out (vty, " area %s stub", buf); |
paul | b0a053b | 2003-06-22 09:04:47 +0000 | [diff] [blame] | 7705 | else if (area->external_routing == OSPF_AREA_NSSA) |
| 7706 | { |
| 7707 | vty_out (vty, " area %s nssa", buf); |
| 7708 | switch (area->NSSATranslatorRole) |
| 7709 | { |
| 7710 | case OSPF_NSSA_ROLE_NEVER: |
| 7711 | vty_out (vty, " translate-never"); |
| 7712 | break; |
| 7713 | case OSPF_NSSA_ROLE_ALWAYS: |
| 7714 | vty_out (vty, " translate-always"); |
| 7715 | break; |
| 7716 | case OSPF_NSSA_ROLE_CANDIDATE: |
| 7717 | default: |
| 7718 | vty_out (vty, " translate-candidate"); |
| 7719 | } |
| 7720 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7721 | |
| 7722 | if (area->no_summary) |
| 7723 | vty_out (vty, " no-summary"); |
| 7724 | |
| 7725 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7726 | |
| 7727 | if (area->default_cost != 1) |
| 7728 | vty_out (vty, " area %s default-cost %d%s", buf, |
| 7729 | area->default_cost, VTY_NEWLINE); |
| 7730 | } |
| 7731 | |
| 7732 | for (rn1 = route_top (area->ranges); rn1; rn1 = route_next (rn1)) |
| 7733 | if (rn1->info) |
| 7734 | { |
| 7735 | struct ospf_area_range *range = rn1->info; |
| 7736 | |
| 7737 | vty_out (vty, " area %s range %s/%d", buf, |
| 7738 | inet_ntoa (rn1->p.u.prefix4), rn1->p.prefixlen); |
| 7739 | |
paul | 6c83567 | 2004-10-11 11:00:30 +0000 | [diff] [blame] | 7740 | if (range->cost_config != OSPF_AREA_RANGE_COST_UNSPEC) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7741 | vty_out (vty, " cost %d", range->cost_config); |
| 7742 | |
| 7743 | if (!CHECK_FLAG (range->flags, OSPF_AREA_RANGE_ADVERTISE)) |
| 7744 | vty_out (vty, " not-advertise"); |
| 7745 | |
| 7746 | if (CHECK_FLAG (range->flags, OSPF_AREA_RANGE_SUBSTITUTE)) |
| 7747 | vty_out (vty, " substitute %s/%d", |
| 7748 | inet_ntoa (range->subst_addr), range->subst_masklen); |
| 7749 | |
| 7750 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7751 | } |
| 7752 | |
| 7753 | if (EXPORT_NAME (area)) |
| 7754 | vty_out (vty, " area %s export-list %s%s", buf, |
| 7755 | EXPORT_NAME (area), VTY_NEWLINE); |
| 7756 | |
| 7757 | if (IMPORT_NAME (area)) |
| 7758 | vty_out (vty, " area %s import-list %s%s", buf, |
| 7759 | IMPORT_NAME (area), VTY_NEWLINE); |
| 7760 | |
| 7761 | if (PREFIX_NAME_IN (area)) |
| 7762 | vty_out (vty, " area %s filter-list prefix %s in%s", buf, |
| 7763 | PREFIX_NAME_IN (area), VTY_NEWLINE); |
| 7764 | |
| 7765 | if (PREFIX_NAME_OUT (area)) |
| 7766 | vty_out (vty, " area %s filter-list prefix %s out%s", buf, |
| 7767 | PREFIX_NAME_OUT (area), VTY_NEWLINE); |
| 7768 | } |
| 7769 | |
| 7770 | return 0; |
| 7771 | } |
| 7772 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7773 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7774 | config_write_ospf_nbr_nbma (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7775 | { |
| 7776 | struct ospf_nbr_nbma *nbr_nbma; |
| 7777 | struct route_node *rn; |
| 7778 | |
| 7779 | /* Static Neighbor configuration print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7780 | for (rn = route_top (ospf->nbr_nbma); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7781 | if ((nbr_nbma = rn->info)) |
| 7782 | { |
| 7783 | vty_out (vty, " neighbor %s", inet_ntoa (nbr_nbma->addr)); |
| 7784 | |
| 7785 | if (nbr_nbma->priority != OSPF_NEIGHBOR_PRIORITY_DEFAULT) |
| 7786 | vty_out (vty, " priority %d", nbr_nbma->priority); |
| 7787 | |
| 7788 | if (nbr_nbma->v_poll != OSPF_POLL_INTERVAL_DEFAULT) |
| 7789 | vty_out (vty, " poll-interval %d", nbr_nbma->v_poll); |
| 7790 | |
| 7791 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7792 | } |
| 7793 | |
| 7794 | return 0; |
| 7795 | } |
| 7796 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7797 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7798 | config_write_virtual_link (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7799 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7800 | struct listnode *node; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7801 | struct ospf_vl_data *vl_data; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7802 | u_char buf[INET_ADDRSTRLEN]; |
| 7803 | |
| 7804 | /* Virtual-Link print */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7805 | for (ALL_LIST_ELEMENTS_RO (ospf->vlinks, node, vl_data)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7806 | { |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7807 | struct listnode *n2; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7808 | struct crypt_key *ck; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7809 | struct ospf_interface *oi; |
| 7810 | |
| 7811 | if (vl_data != NULL) |
| 7812 | { |
| 7813 | memset (buf, 0, INET_ADDRSTRLEN); |
| 7814 | |
| 7815 | if (vl_data->format == OSPF_AREA_ID_FORMAT_ADDRESS) |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7816 | strncpy ((char *) buf, inet_ntoa (vl_data->vl_area_id), INET_ADDRSTRLEN); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7817 | else |
hasso | c9e52be | 2004-09-26 16:09:34 +0000 | [diff] [blame] | 7818 | sprintf ((char *) buf, "%lu", |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7819 | (unsigned long int) ntohl (vl_data->vl_area_id.s_addr)); |
| 7820 | oi = vl_data->vl_oi; |
| 7821 | |
| 7822 | /* timers */ |
| 7823 | if (OSPF_IF_PARAM (oi, v_hello) != OSPF_HELLO_INTERVAL_DEFAULT || |
| 7824 | OSPF_IF_PARAM (oi, v_wait) != OSPF_ROUTER_DEAD_INTERVAL_DEFAULT || |
| 7825 | OSPF_IF_PARAM (oi, retransmit_interval) != OSPF_RETRANSMIT_INTERVAL_DEFAULT || |
| 7826 | OSPF_IF_PARAM (oi, transmit_delay) != OSPF_TRANSMIT_DELAY_DEFAULT) |
| 7827 | vty_out (vty, " area %s virtual-link %s hello-interval %d retransmit-interval %d transmit-delay %d dead-interval %d%s", |
| 7828 | buf, |
| 7829 | inet_ntoa (vl_data->vl_peer), |
| 7830 | OSPF_IF_PARAM (oi, v_hello), |
| 7831 | OSPF_IF_PARAM (oi, retransmit_interval), |
| 7832 | OSPF_IF_PARAM (oi, transmit_delay), |
| 7833 | OSPF_IF_PARAM (oi, v_wait), |
| 7834 | VTY_NEWLINE); |
| 7835 | else |
| 7836 | vty_out (vty, " area %s virtual-link %s%s", buf, |
| 7837 | inet_ntoa (vl_data->vl_peer), VTY_NEWLINE); |
| 7838 | /* Auth key */ |
| 7839 | if (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple[0] != '\0') |
| 7840 | vty_out (vty, " area %s virtual-link %s authentication-key %s%s", |
| 7841 | buf, |
| 7842 | inet_ntoa (vl_data->vl_peer), |
| 7843 | IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_simple, |
| 7844 | VTY_NEWLINE); |
| 7845 | /* md5 keys */ |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7846 | for (ALL_LIST_ELEMENTS_RO (IF_DEF_PARAMS (vl_data->vl_oi->ifp)->auth_crypt, |
| 7847 | n2, ck)) |
| 7848 | vty_out (vty, " area %s virtual-link %s" |
| 7849 | " message-digest-key %d md5 %s%s", |
| 7850 | buf, |
| 7851 | inet_ntoa (vl_data->vl_peer), |
| 7852 | ck->key_id, ck->auth_key, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7853 | |
| 7854 | } |
| 7855 | } |
| 7856 | |
| 7857 | return 0; |
| 7858 | } |
| 7859 | |
| 7860 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7861 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7862 | config_write_ospf_redistribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7863 | { |
| 7864 | int type; |
| 7865 | |
| 7866 | /* redistribute print. */ |
| 7867 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
| 7868 | if (type != zclient->redist_default && zclient->redist[type]) |
| 7869 | { |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7870 | vty_out (vty, " redistribute %s", zebra_route_string(type)); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7871 | if (ospf->dmetric[type].value >= 0) |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7872 | vty_out (vty, " metric %d", ospf->dmetric[type].value); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7873 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7874 | if (ospf->dmetric[type].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7875 | vty_out (vty, " metric-type 1"); |
| 7876 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7877 | if (ROUTEMAP_NAME (ospf, type)) |
| 7878 | vty_out (vty, " route-map %s", ROUTEMAP_NAME (ospf, type)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7879 | |
| 7880 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7881 | } |
| 7882 | |
| 7883 | return 0; |
| 7884 | } |
| 7885 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7886 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7887 | config_write_ospf_default_metric (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7888 | { |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7889 | if (ospf->default_metric != -1) |
| 7890 | vty_out (vty, " default-metric %d%s", ospf->default_metric, |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7891 | VTY_NEWLINE); |
| 7892 | return 0; |
| 7893 | } |
| 7894 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7895 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7896 | config_write_ospf_distribute (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7897 | { |
| 7898 | int type; |
| 7899 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7900 | if (ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7901 | { |
| 7902 | /* distribute-list print. */ |
| 7903 | for (type = 0; type < ZEBRA_ROUTE_MAX; type++) |
Denis Ovsienko | 171c9a9 | 2011-09-10 16:40:23 +0400 | [diff] [blame] | 7904 | if (DISTRIBUTE_NAME (ospf, type)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7905 | vty_out (vty, " distribute-list %s out %s%s", |
Denis Ovsienko | 171c9a9 | 2011-09-10 16:40:23 +0400 | [diff] [blame] | 7906 | DISTRIBUTE_NAME (ospf, type), |
ajs | f52d13c | 2005-10-01 17:38:06 +0000 | [diff] [blame] | 7907 | zebra_route_string(type), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7908 | |
| 7909 | /* default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7910 | if (ospf->default_originate != DEFAULT_ORIGINATE_NONE) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7911 | { |
paul | c42c177 | 2006-01-10 20:36:49 +0000 | [diff] [blame] | 7912 | vty_out (vty, " default-information originate"); |
| 7913 | if (ospf->default_originate == DEFAULT_ORIGINATE_ALWAYS) |
| 7914 | vty_out (vty, " always"); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7915 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7916 | if (ospf->dmetric[DEFAULT_ROUTE].value >= 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7917 | vty_out (vty, " metric %d", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7918 | ospf->dmetric[DEFAULT_ROUTE].value); |
| 7919 | if (ospf->dmetric[DEFAULT_ROUTE].type == EXTERNAL_METRIC_TYPE_1) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7920 | vty_out (vty, " metric-type 1"); |
| 7921 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7922 | if (ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)) |
| 7923 | vty_out (vty, " route-map %s", |
| 7924 | ROUTEMAP_NAME (ospf, DEFAULT_ROUTE)); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7925 | |
| 7926 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7927 | } |
| 7928 | |
| 7929 | } |
| 7930 | |
| 7931 | return 0; |
| 7932 | } |
| 7933 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7934 | static int |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7935 | config_write_ospf_distance (struct vty *vty, struct ospf *ospf) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7936 | { |
| 7937 | struct route_node *rn; |
| 7938 | struct ospf_distance *odistance; |
| 7939 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7940 | if (ospf->distance_all) |
| 7941 | vty_out (vty, " distance %d%s", ospf->distance_all, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7942 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7943 | if (ospf->distance_intra |
| 7944 | || ospf->distance_inter |
| 7945 | || ospf->distance_external) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7946 | { |
| 7947 | vty_out (vty, " distance ospf"); |
| 7948 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7949 | if (ospf->distance_intra) |
| 7950 | vty_out (vty, " intra-area %d", ospf->distance_intra); |
| 7951 | if (ospf->distance_inter) |
| 7952 | vty_out (vty, " inter-area %d", ospf->distance_inter); |
| 7953 | if (ospf->distance_external) |
| 7954 | vty_out (vty, " external %d", ospf->distance_external); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7955 | |
| 7956 | vty_out (vty, "%s", VTY_NEWLINE); |
| 7957 | } |
| 7958 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7959 | for (rn = route_top (ospf->distance_table); rn; rn = route_next (rn)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7960 | if ((odistance = rn->info) != NULL) |
| 7961 | { |
| 7962 | vty_out (vty, " distance %d %s/%d %s%s", odistance->distance, |
| 7963 | inet_ntoa (rn->p.u.prefix4), rn->p.prefixlen, |
| 7964 | odistance->access_list ? odistance->access_list : "", |
| 7965 | VTY_NEWLINE); |
| 7966 | } |
| 7967 | return 0; |
| 7968 | } |
| 7969 | |
| 7970 | /* OSPF configuration write function. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 7971 | static int |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7972 | ospf_config_write (struct vty *vty) |
| 7973 | { |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7974 | struct ospf *ospf; |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 7975 | struct interface *ifp; |
| 7976 | struct ospf_interface *oi; |
hasso | 52dc7ee | 2004-09-23 19:18:23 +0000 | [diff] [blame] | 7977 | struct listnode *node; |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7978 | int write = 0; |
| 7979 | |
paul | 020709f | 2003-04-04 02:44:16 +0000 | [diff] [blame] | 7980 | ospf = ospf_lookup (); |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7981 | if (ospf != NULL) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7982 | { |
| 7983 | /* `router ospf' print. */ |
| 7984 | vty_out (vty, "router ospf%s", VTY_NEWLINE); |
| 7985 | |
| 7986 | write++; |
| 7987 | |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7988 | if (!ospf->networks) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7989 | return write; |
| 7990 | |
| 7991 | /* Router ID print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7992 | if (ospf->router_id_static.s_addr != 0) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7993 | vty_out (vty, " ospf router-id %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7994 | inet_ntoa (ospf->router_id_static), VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7995 | |
| 7996 | /* ABR type print. */ |
paul | d57834f | 2005-07-12 20:04:22 +0000 | [diff] [blame] | 7997 | if (ospf->abr_type != OSPF_ABR_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 7998 | vty_out (vty, " ospf abr-type %s%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 7999 | ospf_abr_type_str[ospf->abr_type], VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8000 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 8001 | /* log-adjacency-changes flag print. */ |
| 8002 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_CHANGES)) |
| 8003 | { |
| 8004 | vty_out(vty, " log-adjacency-changes"); |
| 8005 | if (CHECK_FLAG(ospf->config, OSPF_LOG_ADJACENCY_DETAIL)) |
| 8006 | vty_out(vty, " detail"); |
| 8007 | vty_out(vty, "%s", VTY_NEWLINE); |
| 8008 | } |
| 8009 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8010 | /* RFC1583 compatibility flag print -- Compatible with CISCO 12.1. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8011 | if (CHECK_FLAG (ospf->config, OSPF_RFC1583_COMPATIBLE)) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8012 | vty_out (vty, " compatible rfc1583%s", VTY_NEWLINE); |
| 8013 | |
| 8014 | /* auto-cost reference-bandwidth configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8015 | if (ospf->ref_bandwidth != OSPF_DEFAULT_REF_BANDWIDTH) |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8016 | { |
| 8017 | vty_out (vty, "! Important: ensure reference bandwidth " |
| 8018 | "is consistent across all routers%s", VTY_NEWLINE); |
| 8019 | vty_out (vty, " auto-cost reference-bandwidth %d%s", |
| 8020 | ospf->ref_bandwidth / 1000, VTY_NEWLINE); |
| 8021 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8022 | |
| 8023 | /* SPF timers print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8024 | if (ospf->spf_delay != OSPF_SPF_DELAY_DEFAULT || |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 8025 | ospf->spf_holdtime != OSPF_SPF_HOLDTIME_DEFAULT || |
| 8026 | ospf->spf_max_holdtime != OSPF_SPF_MAX_HOLDTIME_DEFAULT) |
| 8027 | vty_out (vty, " timers throttle spf %d %d %d%s", |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8028 | ospf->spf_delay, ospf->spf_holdtime, |
paul | ea4ffc9 | 2005-10-21 20:04:41 +0000 | [diff] [blame] | 8029 | ospf->spf_max_holdtime, VTY_NEWLINE); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8030 | |
| 8031 | /* Max-metric router-lsa print */ |
| 8032 | config_write_stub_router (vty, ospf); |
| 8033 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8034 | /* SPF refresh parameters print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8035 | if (ospf->lsa_refresh_interval != OSPF_LSA_REFRESH_INTERVAL_DEFAULT) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8036 | vty_out (vty, " refresh timer %d%s", |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8037 | ospf->lsa_refresh_interval, VTY_NEWLINE); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8038 | |
| 8039 | /* Redistribute information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8040 | config_write_ospf_redistribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8041 | |
| 8042 | /* passive-interface print. */ |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8043 | if (ospf->passive_interface_default == OSPF_IF_PASSIVE) |
| 8044 | vty_out (vty, " passive-interface default%s", VTY_NEWLINE); |
| 8045 | |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8046 | for (ALL_LIST_ELEMENTS_RO (om->iflist, node, ifp)) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8047 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (ifp), passive_interface) |
| 8048 | && IF_DEF_PARAMS (ifp)->passive_interface != |
| 8049 | ospf->passive_interface_default) |
| 8050 | { |
| 8051 | vty_out (vty, " %spassive-interface %s%s", |
| 8052 | IF_DEF_PARAMS (ifp)->passive_interface ? "" : "no ", |
| 8053 | ifp->name, VTY_NEWLINE); |
| 8054 | } |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8055 | for (ALL_LIST_ELEMENTS_RO (ospf->oiflist, node, oi)) |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8056 | { |
| 8057 | if (!OSPF_IF_PARAM_CONFIGURED (oi->params, passive_interface)) |
| 8058 | continue; |
| 8059 | if (OSPF_IF_PARAM_CONFIGURED (IF_DEF_PARAMS (oi->ifp), |
| 8060 | passive_interface)) |
| 8061 | { |
| 8062 | if (oi->params->passive_interface == IF_DEF_PARAMS (oi->ifp)->passive_interface) |
| 8063 | continue; |
| 8064 | } |
| 8065 | else if (oi->params->passive_interface == ospf->passive_interface_default) |
| 8066 | continue; |
| 8067 | |
| 8068 | vty_out (vty, " %spassive-interface %s %s%s", |
| 8069 | oi->params->passive_interface ? "" : "no ", |
paul | 1eb8ef2 | 2005-04-07 07:30:20 +0000 | [diff] [blame] | 8070 | oi->ifp->name, |
| 8071 | inet_ntoa (oi->address->u.prefix4), VTY_NEWLINE); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8072 | } |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8073 | |
| 8074 | /* Network area print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8075 | config_write_network_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8076 | |
| 8077 | /* Area config print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8078 | config_write_ospf_area (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8079 | |
| 8080 | /* static neighbor print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8081 | config_write_ospf_nbr_nbma (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8082 | |
| 8083 | /* Virtual-Link print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8084 | config_write_virtual_link (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8085 | |
| 8086 | /* Default metric configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8087 | config_write_ospf_default_metric (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8088 | |
| 8089 | /* Distribute-list and default-information print. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8090 | config_write_ospf_distribute (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8091 | |
| 8092 | /* Distance configuration. */ |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8093 | config_write_ospf_distance (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8094 | |
| 8095 | #ifdef HAVE_OPAQUE_LSA |
paul | 6898008 | 2003-03-25 05:07:42 +0000 | [diff] [blame] | 8096 | ospf_opaque_config_write_router (vty, ospf); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8097 | #endif /* HAVE_OPAQUE_LSA */ |
| 8098 | } |
| 8099 | |
| 8100 | return write; |
| 8101 | } |
| 8102 | |
| 8103 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8104 | ospf_vty_show_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8105 | { |
| 8106 | /* "show ip ospf" commands. */ |
| 8107 | install_element (VIEW_NODE, &show_ip_ospf_cmd); |
| 8108 | install_element (ENABLE_NODE, &show_ip_ospf_cmd); |
| 8109 | |
| 8110 | /* "show ip ospf database" commands. */ |
| 8111 | install_element (VIEW_NODE, &show_ip_ospf_database_type_cmd); |
| 8112 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_cmd); |
| 8113 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 8114 | install_element (VIEW_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 8115 | install_element (VIEW_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 8116 | install_element (VIEW_NODE, &show_ip_ospf_database_type_self_cmd); |
| 8117 | install_element (VIEW_NODE, &show_ip_ospf_database_cmd); |
| 8118 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_cmd); |
| 8119 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_cmd); |
| 8120 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_adv_router_cmd); |
| 8121 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_adv_router_cmd); |
| 8122 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_id_self_cmd); |
| 8123 | install_element (ENABLE_NODE, &show_ip_ospf_database_type_self_cmd); |
| 8124 | install_element (ENABLE_NODE, &show_ip_ospf_database_cmd); |
| 8125 | |
| 8126 | /* "show ip ospf interface" commands. */ |
| 8127 | install_element (VIEW_NODE, &show_ip_ospf_interface_cmd); |
| 8128 | install_element (ENABLE_NODE, &show_ip_ospf_interface_cmd); |
| 8129 | |
| 8130 | /* "show ip ospf neighbor" commands. */ |
| 8131 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 8132 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 8133 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 8134 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 8135 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 8136 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_cmd); |
| 8137 | install_element (VIEW_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 8138 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_detail_cmd); |
| 8139 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_int_cmd); |
| 8140 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_id_cmd); |
| 8141 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_all_cmd); |
| 8142 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_detail_cmd); |
| 8143 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_cmd); |
| 8144 | install_element (ENABLE_NODE, &show_ip_ospf_neighbor_all_cmd); |
| 8145 | |
| 8146 | /* "show ip ospf route" commands. */ |
| 8147 | install_element (VIEW_NODE, &show_ip_ospf_route_cmd); |
| 8148 | install_element (ENABLE_NODE, &show_ip_ospf_route_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8149 | install_element (VIEW_NODE, &show_ip_ospf_border_routers_cmd); |
| 8150 | install_element (ENABLE_NODE, &show_ip_ospf_border_routers_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8151 | } |
| 8152 | |
| 8153 | |
| 8154 | /* ospfd's interface node. */ |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8155 | static struct cmd_node interface_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8156 | { |
| 8157 | INTERFACE_NODE, |
| 8158 | "%s(config-if)# ", |
| 8159 | 1 |
| 8160 | }; |
| 8161 | |
| 8162 | /* Initialization of OSPF interface. */ |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8163 | static void |
| 8164 | ospf_vty_if_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8165 | { |
| 8166 | /* Install interface node. */ |
| 8167 | install_node (&interface_node, config_write_interface); |
| 8168 | |
| 8169 | install_element (CONFIG_NODE, &interface_cmd); |
paul | 32d2463 | 2003-05-23 09:25:20 +0000 | [diff] [blame] | 8170 | install_element (CONFIG_NODE, &no_interface_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8171 | install_default (INTERFACE_NODE); |
| 8172 | |
| 8173 | /* "description" commands. */ |
| 8174 | install_element (INTERFACE_NODE, &interface_desc_cmd); |
| 8175 | install_element (INTERFACE_NODE, &no_interface_desc_cmd); |
| 8176 | |
| 8177 | /* "ip ospf authentication" commands. */ |
| 8178 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_addr_cmd); |
| 8179 | install_element (INTERFACE_NODE, &ip_ospf_authentication_args_cmd); |
| 8180 | install_element (INTERFACE_NODE, &ip_ospf_authentication_addr_cmd); |
| 8181 | install_element (INTERFACE_NODE, &ip_ospf_authentication_cmd); |
| 8182 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_addr_cmd); |
| 8183 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_cmd); |
| 8184 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_addr_cmd); |
| 8185 | install_element (INTERFACE_NODE, &ip_ospf_authentication_key_cmd); |
| 8186 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_addr_cmd); |
| 8187 | install_element (INTERFACE_NODE, &no_ip_ospf_authentication_key_cmd); |
| 8188 | |
| 8189 | /* "ip ospf message-digest-key" commands. */ |
| 8190 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_addr_cmd); |
| 8191 | install_element (INTERFACE_NODE, &ip_ospf_message_digest_key_cmd); |
| 8192 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_addr_cmd); |
| 8193 | install_element (INTERFACE_NODE, &no_ip_ospf_message_digest_key_cmd); |
| 8194 | |
| 8195 | /* "ip ospf cost" commands. */ |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8196 | install_element (INTERFACE_NODE, &ip_ospf_cost_u32_inet4_cmd); |
| 8197 | install_element (INTERFACE_NODE, &ip_ospf_cost_u32_cmd); |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 8198 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_cmd); |
| 8199 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_u32_inet4_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8200 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8201 | install_element (INTERFACE_NODE, &no_ip_ospf_cost_cmd); |
| 8202 | |
vincent | ba68253 | 2005-09-29 13:52:57 +0000 | [diff] [blame] | 8203 | /* "ip ospf mtu-ignore" commands. */ |
| 8204 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_addr_cmd); |
| 8205 | install_element (INTERFACE_NODE, &ip_ospf_mtu_ignore_cmd); |
| 8206 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_addr_cmd); |
| 8207 | install_element (INTERFACE_NODE, &no_ip_ospf_mtu_ignore_cmd); |
| 8208 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8209 | /* "ip ospf dead-interval" commands. */ |
| 8210 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_addr_cmd); |
| 8211 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8212 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_addr_cmd); |
| 8213 | install_element (INTERFACE_NODE, &ip_ospf_dead_interval_minimal_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8214 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_addr_cmd); |
| 8215 | install_element (INTERFACE_NODE, &no_ip_ospf_dead_interval_cmd); |
paul | f9ad937 | 2005-10-21 00:45:17 +0000 | [diff] [blame] | 8216 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8217 | /* "ip ospf hello-interval" commands. */ |
| 8218 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_addr_cmd); |
| 8219 | install_element (INTERFACE_NODE, &ip_ospf_hello_interval_cmd); |
| 8220 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_addr_cmd); |
| 8221 | install_element (INTERFACE_NODE, &no_ip_ospf_hello_interval_cmd); |
| 8222 | |
| 8223 | /* "ip ospf network" commands. */ |
| 8224 | install_element (INTERFACE_NODE, &ip_ospf_network_cmd); |
| 8225 | install_element (INTERFACE_NODE, &no_ip_ospf_network_cmd); |
| 8226 | |
| 8227 | /* "ip ospf priority" commands. */ |
| 8228 | install_element (INTERFACE_NODE, &ip_ospf_priority_addr_cmd); |
| 8229 | install_element (INTERFACE_NODE, &ip_ospf_priority_cmd); |
| 8230 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_addr_cmd); |
| 8231 | install_element (INTERFACE_NODE, &no_ip_ospf_priority_cmd); |
| 8232 | |
| 8233 | /* "ip ospf retransmit-interval" commands. */ |
| 8234 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_addr_cmd); |
| 8235 | install_element (INTERFACE_NODE, &ip_ospf_retransmit_interval_cmd); |
| 8236 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_addr_cmd); |
| 8237 | install_element (INTERFACE_NODE, &no_ip_ospf_retransmit_interval_cmd); |
| 8238 | |
| 8239 | /* "ip ospf transmit-delay" commands. */ |
| 8240 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_addr_cmd); |
| 8241 | install_element (INTERFACE_NODE, &ip_ospf_transmit_delay_cmd); |
| 8242 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_addr_cmd); |
| 8243 | install_element (INTERFACE_NODE, &no_ip_ospf_transmit_delay_cmd); |
| 8244 | |
| 8245 | /* These commands are compatibitliy for previous version. */ |
| 8246 | install_element (INTERFACE_NODE, &ospf_authentication_key_cmd); |
| 8247 | install_element (INTERFACE_NODE, &no_ospf_authentication_key_cmd); |
| 8248 | install_element (INTERFACE_NODE, &ospf_message_digest_key_cmd); |
| 8249 | install_element (INTERFACE_NODE, &no_ospf_message_digest_key_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8250 | install_element (INTERFACE_NODE, &ospf_cost_u32_cmd); |
| 8251 | install_element (INTERFACE_NODE, &ospf_cost_u32_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8252 | install_element (INTERFACE_NODE, &no_ospf_cost_cmd); |
Denis Ovsienko | 827341b | 2009-09-28 19:34:59 +0400 | [diff] [blame] | 8253 | install_element (INTERFACE_NODE, &no_ospf_cost_u32_cmd); |
| 8254 | install_element (INTERFACE_NODE, &no_ospf_cost_u32_inet4_cmd); |
Denis Ovsienko | 9eff36b | 2009-04-10 18:51:24 +0400 | [diff] [blame] | 8255 | install_element (INTERFACE_NODE, &no_ospf_cost_inet4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8256 | install_element (INTERFACE_NODE, &ospf_dead_interval_cmd); |
| 8257 | install_element (INTERFACE_NODE, &no_ospf_dead_interval_cmd); |
| 8258 | install_element (INTERFACE_NODE, &ospf_hello_interval_cmd); |
| 8259 | install_element (INTERFACE_NODE, &no_ospf_hello_interval_cmd); |
| 8260 | install_element (INTERFACE_NODE, &ospf_network_cmd); |
| 8261 | install_element (INTERFACE_NODE, &no_ospf_network_cmd); |
| 8262 | install_element (INTERFACE_NODE, &ospf_priority_cmd); |
| 8263 | install_element (INTERFACE_NODE, &no_ospf_priority_cmd); |
| 8264 | install_element (INTERFACE_NODE, &ospf_retransmit_interval_cmd); |
| 8265 | install_element (INTERFACE_NODE, &no_ospf_retransmit_interval_cmd); |
| 8266 | install_element (INTERFACE_NODE, &ospf_transmit_delay_cmd); |
| 8267 | install_element (INTERFACE_NODE, &no_ospf_transmit_delay_cmd); |
| 8268 | } |
| 8269 | |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8270 | static void |
| 8271 | ospf_vty_zebra_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8272 | { |
| 8273 | install_element (OSPF_NODE, &ospf_redistribute_source_type_metric_cmd); |
| 8274 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_type_cmd); |
| 8275 | install_element (OSPF_NODE, &ospf_redistribute_source_type_cmd); |
| 8276 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_cmd); |
| 8277 | install_element (OSPF_NODE, &ospf_redistribute_source_cmd); |
| 8278 | install_element (OSPF_NODE, |
| 8279 | &ospf_redistribute_source_metric_type_routemap_cmd); |
| 8280 | install_element (OSPF_NODE, |
| 8281 | &ospf_redistribute_source_type_metric_routemap_cmd); |
| 8282 | install_element (OSPF_NODE, &ospf_redistribute_source_metric_routemap_cmd); |
| 8283 | install_element (OSPF_NODE, &ospf_redistribute_source_type_routemap_cmd); |
| 8284 | install_element (OSPF_NODE, &ospf_redistribute_source_routemap_cmd); |
| 8285 | |
| 8286 | install_element (OSPF_NODE, &no_ospf_redistribute_source_cmd); |
| 8287 | |
| 8288 | install_element (OSPF_NODE, &ospf_distribute_list_out_cmd); |
| 8289 | install_element (OSPF_NODE, &no_ospf_distribute_list_out_cmd); |
| 8290 | |
| 8291 | install_element (OSPF_NODE, |
| 8292 | &ospf_default_information_originate_metric_type_cmd); |
| 8293 | install_element (OSPF_NODE, &ospf_default_information_originate_metric_cmd); |
| 8294 | install_element (OSPF_NODE, |
| 8295 | &ospf_default_information_originate_type_metric_cmd); |
| 8296 | install_element (OSPF_NODE, &ospf_default_information_originate_type_cmd); |
| 8297 | install_element (OSPF_NODE, &ospf_default_information_originate_cmd); |
| 8298 | install_element (OSPF_NODE, |
| 8299 | &ospf_default_information_originate_always_metric_type_cmd); |
| 8300 | install_element (OSPF_NODE, |
| 8301 | &ospf_default_information_originate_always_metric_cmd); |
| 8302 | install_element (OSPF_NODE, |
| 8303 | &ospf_default_information_originate_always_cmd); |
| 8304 | install_element (OSPF_NODE, |
| 8305 | &ospf_default_information_originate_always_type_metric_cmd); |
| 8306 | install_element (OSPF_NODE, |
| 8307 | &ospf_default_information_originate_always_type_cmd); |
| 8308 | |
| 8309 | install_element (OSPF_NODE, |
| 8310 | &ospf_default_information_originate_metric_type_routemap_cmd); |
| 8311 | install_element (OSPF_NODE, |
| 8312 | &ospf_default_information_originate_metric_routemap_cmd); |
| 8313 | install_element (OSPF_NODE, |
| 8314 | &ospf_default_information_originate_routemap_cmd); |
| 8315 | install_element (OSPF_NODE, |
| 8316 | &ospf_default_information_originate_type_metric_routemap_cmd); |
| 8317 | install_element (OSPF_NODE, |
| 8318 | &ospf_default_information_originate_type_routemap_cmd); |
| 8319 | install_element (OSPF_NODE, |
| 8320 | &ospf_default_information_originate_always_metric_type_routemap_cmd); |
| 8321 | install_element (OSPF_NODE, |
| 8322 | &ospf_default_information_originate_always_metric_routemap_cmd); |
| 8323 | install_element (OSPF_NODE, |
| 8324 | &ospf_default_information_originate_always_routemap_cmd); |
| 8325 | install_element (OSPF_NODE, |
| 8326 | &ospf_default_information_originate_always_type_metric_routemap_cmd); |
| 8327 | install_element (OSPF_NODE, |
| 8328 | &ospf_default_information_originate_always_type_routemap_cmd); |
| 8329 | |
| 8330 | install_element (OSPF_NODE, &no_ospf_default_information_originate_cmd); |
| 8331 | |
| 8332 | install_element (OSPF_NODE, &ospf_default_metric_cmd); |
| 8333 | install_element (OSPF_NODE, &no_ospf_default_metric_cmd); |
| 8334 | install_element (OSPF_NODE, &no_ospf_default_metric_val_cmd); |
| 8335 | |
| 8336 | install_element (OSPF_NODE, &ospf_distance_cmd); |
| 8337 | install_element (OSPF_NODE, &no_ospf_distance_cmd); |
| 8338 | install_element (OSPF_NODE, &no_ospf_distance_ospf_cmd); |
| 8339 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_cmd); |
| 8340 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_cmd); |
| 8341 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_cmd); |
| 8342 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_inter_external_cmd); |
| 8343 | install_element (OSPF_NODE, &ospf_distance_ospf_intra_external_inter_cmd); |
| 8344 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_cmd); |
| 8345 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_cmd); |
| 8346 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_cmd); |
| 8347 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_intra_external_cmd); |
| 8348 | install_element (OSPF_NODE, &ospf_distance_ospf_inter_external_intra_cmd); |
| 8349 | install_element (OSPF_NODE, &ospf_distance_ospf_external_cmd); |
| 8350 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_cmd); |
| 8351 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_cmd); |
| 8352 | install_element (OSPF_NODE, &ospf_distance_ospf_external_intra_inter_cmd); |
| 8353 | install_element (OSPF_NODE, &ospf_distance_ospf_external_inter_intra_cmd); |
| 8354 | #if 0 |
| 8355 | install_element (OSPF_NODE, &ospf_distance_source_cmd); |
| 8356 | install_element (OSPF_NODE, &no_ospf_distance_source_cmd); |
| 8357 | install_element (OSPF_NODE, &ospf_distance_source_access_list_cmd); |
| 8358 | install_element (OSPF_NODE, &no_ospf_distance_source_access_list_cmd); |
| 8359 | #endif /* 0 */ |
| 8360 | } |
| 8361 | |
Stephen Hemminger | 7fc626d | 2008-12-01 11:10:34 -0800 | [diff] [blame] | 8362 | static struct cmd_node ospf_node = |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8363 | { |
| 8364 | OSPF_NODE, |
| 8365 | "%s(config-router)# ", |
| 8366 | 1 |
| 8367 | }; |
| 8368 | |
| 8369 | |
| 8370 | /* Install OSPF related vty commands. */ |
| 8371 | void |
paul | 4dadc29 | 2005-05-06 21:37:42 +0000 | [diff] [blame] | 8372 | ospf_vty_init (void) |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8373 | { |
| 8374 | /* Install ospf top node. */ |
| 8375 | install_node (&ospf_node, ospf_config_write); |
| 8376 | |
| 8377 | /* "router ospf" commands. */ |
| 8378 | install_element (CONFIG_NODE, &router_ospf_cmd); |
| 8379 | install_element (CONFIG_NODE, &no_router_ospf_cmd); |
| 8380 | |
| 8381 | install_default (OSPF_NODE); |
| 8382 | |
| 8383 | /* "ospf router-id" commands. */ |
| 8384 | install_element (OSPF_NODE, &ospf_router_id_cmd); |
| 8385 | install_element (OSPF_NODE, &no_ospf_router_id_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8386 | install_element (OSPF_NODE, &router_ospf_id_cmd); |
| 8387 | install_element (OSPF_NODE, &no_router_ospf_id_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8388 | |
| 8389 | /* "passive-interface" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8390 | install_element (OSPF_NODE, &ospf_passive_interface_addr_cmd); |
| 8391 | install_element (OSPF_NODE, &ospf_passive_interface_cmd); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8392 | install_element (OSPF_NODE, &ospf_passive_interface_default_cmd); |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8393 | install_element (OSPF_NODE, &no_ospf_passive_interface_addr_cmd); |
| 8394 | install_element (OSPF_NODE, &no_ospf_passive_interface_cmd); |
Paul Jakma | 7ffa8fa | 2006-10-22 20:07:53 +0000 | [diff] [blame] | 8395 | install_element (OSPF_NODE, &no_ospf_passive_interface_default_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8396 | |
| 8397 | /* "ospf abr-type" commands. */ |
| 8398 | install_element (OSPF_NODE, &ospf_abr_type_cmd); |
| 8399 | install_element (OSPF_NODE, &no_ospf_abr_type_cmd); |
| 8400 | |
Andrew J. Schorr | d7e60dd | 2006-06-29 20:20:52 +0000 | [diff] [blame] | 8401 | /* "ospf log-adjacency-changes" commands. */ |
| 8402 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_cmd); |
| 8403 | install_element (OSPF_NODE, &ospf_log_adjacency_changes_detail_cmd); |
| 8404 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_cmd); |
| 8405 | install_element (OSPF_NODE, &no_ospf_log_adjacency_changes_detail_cmd); |
| 8406 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8407 | /* "ospf rfc1583-compatible" commands. */ |
| 8408 | install_element (OSPF_NODE, &ospf_rfc1583_flag_cmd); |
| 8409 | install_element (OSPF_NODE, &no_ospf_rfc1583_flag_cmd); |
| 8410 | install_element (OSPF_NODE, &ospf_compatible_rfc1583_cmd); |
| 8411 | install_element (OSPF_NODE, &no_ospf_compatible_rfc1583_cmd); |
| 8412 | |
| 8413 | /* "network area" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8414 | install_element (OSPF_NODE, &ospf_network_area_cmd); |
| 8415 | install_element (OSPF_NODE, &no_ospf_network_area_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8416 | |
| 8417 | /* "area authentication" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8418 | install_element (OSPF_NODE, &ospf_area_authentication_message_digest_cmd); |
| 8419 | install_element (OSPF_NODE, &ospf_area_authentication_cmd); |
| 8420 | install_element (OSPF_NODE, &no_ospf_area_authentication_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8421 | |
| 8422 | /* "area range" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8423 | install_element (OSPF_NODE, &ospf_area_range_cmd); |
| 8424 | install_element (OSPF_NODE, &ospf_area_range_advertise_cmd); |
| 8425 | install_element (OSPF_NODE, &ospf_area_range_cost_cmd); |
| 8426 | install_element (OSPF_NODE, &ospf_area_range_advertise_cost_cmd); |
| 8427 | install_element (OSPF_NODE, &ospf_area_range_not_advertise_cmd); |
| 8428 | install_element (OSPF_NODE, &no_ospf_area_range_cmd); |
| 8429 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cmd); |
| 8430 | install_element (OSPF_NODE, &no_ospf_area_range_cost_cmd); |
| 8431 | install_element (OSPF_NODE, &no_ospf_area_range_advertise_cost_cmd); |
| 8432 | install_element (OSPF_NODE, &ospf_area_range_substitute_cmd); |
| 8433 | install_element (OSPF_NODE, &no_ospf_area_range_substitute_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8434 | |
| 8435 | /* "area virtual-link" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8436 | install_element (OSPF_NODE, &ospf_area_vlink_cmd); |
| 8437 | install_element (OSPF_NODE, &no_ospf_area_vlink_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8438 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8439 | install_element (OSPF_NODE, &ospf_area_vlink_param1_cmd); |
| 8440 | install_element (OSPF_NODE, &no_ospf_area_vlink_param1_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8441 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8442 | install_element (OSPF_NODE, &ospf_area_vlink_param2_cmd); |
| 8443 | install_element (OSPF_NODE, &no_ospf_area_vlink_param2_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_param3_cmd); |
| 8446 | install_element (OSPF_NODE, &no_ospf_area_vlink_param3_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8447 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8448 | install_element (OSPF_NODE, &ospf_area_vlink_param4_cmd); |
| 8449 | install_element (OSPF_NODE, &no_ospf_area_vlink_param4_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8450 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8451 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_cmd); |
| 8452 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_cmd); |
| 8453 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8454 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8455 | install_element (OSPF_NODE, &ospf_area_vlink_md5_cmd); |
| 8456 | install_element (OSPF_NODE, &no_ospf_area_vlink_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8457 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8458 | install_element (OSPF_NODE, &ospf_area_vlink_authkey_cmd); |
| 8459 | install_element (OSPF_NODE, &no_ospf_area_vlink_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8460 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8461 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_authkey_cmd); |
| 8462 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_authkey_cmd); |
| 8463 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_authkey_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8464 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8465 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_args_md5_cmd); |
| 8466 | install_element (OSPF_NODE, &ospf_area_vlink_authtype_md5_cmd); |
| 8467 | install_element (OSPF_NODE, &no_ospf_area_vlink_authtype_md5_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8468 | |
| 8469 | /* "area stub" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8470 | install_element (OSPF_NODE, &ospf_area_stub_no_summary_cmd); |
| 8471 | install_element (OSPF_NODE, &ospf_area_stub_cmd); |
| 8472 | install_element (OSPF_NODE, &no_ospf_area_stub_no_summary_cmd); |
| 8473 | install_element (OSPF_NODE, &no_ospf_area_stub_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8474 | |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8475 | /* "area nssa" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8476 | install_element (OSPF_NODE, &ospf_area_nssa_cmd); |
| 8477 | install_element (OSPF_NODE, &ospf_area_nssa_translate_no_summary_cmd); |
| 8478 | install_element (OSPF_NODE, &ospf_area_nssa_translate_cmd); |
| 8479 | install_element (OSPF_NODE, &ospf_area_nssa_no_summary_cmd); |
| 8480 | install_element (OSPF_NODE, &no_ospf_area_nssa_cmd); |
| 8481 | install_element (OSPF_NODE, &no_ospf_area_nssa_no_summary_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8482 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8483 | install_element (OSPF_NODE, &ospf_area_default_cost_cmd); |
| 8484 | install_element (OSPF_NODE, &no_ospf_area_default_cost_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8485 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8486 | install_element (OSPF_NODE, &ospf_area_shortcut_cmd); |
| 8487 | install_element (OSPF_NODE, &no_ospf_area_shortcut_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8488 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8489 | install_element (OSPF_NODE, &ospf_area_export_list_cmd); |
| 8490 | install_element (OSPF_NODE, &no_ospf_area_export_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8491 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8492 | install_element (OSPF_NODE, &ospf_area_filter_list_cmd); |
| 8493 | install_element (OSPF_NODE, &no_ospf_area_filter_list_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8494 | |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8495 | install_element (OSPF_NODE, &ospf_area_import_list_cmd); |
| 8496 | install_element (OSPF_NODE, &no_ospf_area_import_list_cmd); |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8497 | |
| 8498 | /* SPF timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8499 | install_element (OSPF_NODE, &ospf_timers_spf_cmd); |
| 8500 | install_element (OSPF_NODE, &no_ospf_timers_spf_cmd); |
paul | d24f6e2 | 2005-10-21 09:23:12 +0000 | [diff] [blame] | 8501 | install_element (OSPF_NODE, &ospf_timers_throttle_spf_cmd); |
| 8502 | install_element (OSPF_NODE, &no_ospf_timers_throttle_spf_cmd); |
| 8503 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8504 | /* refresh timer commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8505 | install_element (OSPF_NODE, &ospf_refresh_timer_cmd); |
| 8506 | install_element (OSPF_NODE, &no_ospf_refresh_timer_val_cmd); |
| 8507 | install_element (OSPF_NODE, &no_ospf_refresh_timer_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8508 | |
paul | 88d6cf3 | 2005-10-29 12:50:09 +0000 | [diff] [blame] | 8509 | /* max-metric commands */ |
| 8510 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_admin_cmd); |
| 8511 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_admin_cmd); |
| 8512 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_startup_cmd); |
| 8513 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_startup_cmd); |
| 8514 | install_element (OSPF_NODE, &ospf_max_metric_router_lsa_shutdown_cmd); |
| 8515 | install_element (OSPF_NODE, &no_ospf_max_metric_router_lsa_shutdown_cmd); |
| 8516 | |
| 8517 | /* reference bandwidth commands */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8518 | install_element (OSPF_NODE, &ospf_auto_cost_reference_bandwidth_cmd); |
| 8519 | install_element (OSPF_NODE, &no_ospf_auto_cost_reference_bandwidth_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8520 | |
| 8521 | /* "neighbor" commands. */ |
paul | a2c6283 | 2003-04-23 17:01:31 +0000 | [diff] [blame] | 8522 | install_element (OSPF_NODE, &ospf_neighbor_cmd); |
| 8523 | install_element (OSPF_NODE, &ospf_neighbor_priority_poll_interval_cmd); |
| 8524 | install_element (OSPF_NODE, &ospf_neighbor_priority_cmd); |
| 8525 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_cmd); |
| 8526 | install_element (OSPF_NODE, &ospf_neighbor_poll_interval_priority_cmd); |
| 8527 | install_element (OSPF_NODE, &no_ospf_neighbor_cmd); |
| 8528 | install_element (OSPF_NODE, &no_ospf_neighbor_priority_cmd); |
| 8529 | install_element (OSPF_NODE, &no_ospf_neighbor_poll_interval_cmd); |
paul | 718e374 | 2002-12-13 20:15:29 +0000 | [diff] [blame] | 8530 | |
| 8531 | /* Init interface related vty commands. */ |
| 8532 | ospf_vty_if_init (); |
| 8533 | |
| 8534 | /* Init zebra related vty commands. */ |
| 8535 | ospf_vty_zebra_init (); |
| 8536 | } |