jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1 | /* |
| 2 | * IS-IS Rout(e)ing protocol - isisd.c |
| 3 | * |
| 4 | * Copyright (C) 2001,2002 Sampo Saaristo |
| 5 | * Tampere University of Technology |
| 6 | * Institute of Communications Engineering |
| 7 | * |
| 8 | * This program is free software; you can redistribute it and/or modify it |
| 9 | * under the terms of the GNU General Public Licenseas published by the Free |
| 10 | * Software Foundation; either version 2 of the License, or (at your option) |
| 11 | * any later version. |
| 12 | * |
| 13 | * This program is distributed in the hope that it will be useful,but WITHOUT |
| 14 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
| 15 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for |
| 16 | * more details. |
| 17 | |
| 18 | * You should have received a copy of the GNU General Public License along |
| 19 | * with this program; if not, write to the Free Software Foundation, Inc., |
| 20 | * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 21 | */ |
| 22 | |
| 23 | #include <string.h> |
| 24 | #include <zebra.h> |
| 25 | #include <net/ethernet.h> |
| 26 | |
| 27 | #include "thread.h" |
| 28 | #include "vty.h" |
| 29 | #include "command.h" |
| 30 | #include "log.h" |
| 31 | #include "memory.h" |
| 32 | #include "linklist.h" |
| 33 | #include "if.h" |
| 34 | #include "hash.h" |
| 35 | #include "stream.h" |
| 36 | #include "prefix.h" |
| 37 | #include "table.h" |
| 38 | |
| 39 | #include "isisd/dict.h" |
| 40 | #include "isisd/include-netbsd/iso.h" |
| 41 | #include "isisd/isis_constants.h" |
| 42 | #include "isisd/isis_common.h" |
| 43 | #include "isisd/isis_circuit.h" |
| 44 | #include "isisd/isis_flags.h" |
| 45 | #include "isisd/isisd.h" |
| 46 | #include "isisd/isis_dynhn.h" |
| 47 | #include "isisd/isis_adjacency.h" |
| 48 | #include "isisd/isis_pdu.h" |
| 49 | #include "isisd/isis_misc.h" |
| 50 | #include "isisd/isis_constants.h" |
| 51 | #include "isisd/isis_tlv.h" |
| 52 | #include "isisd/isis_lsp.h" |
| 53 | #include "isisd/isis_spf.h" |
| 54 | #include "isisd/isis_route.h" |
| 55 | #include "isisd/isis_zebra.h" |
| 56 | #include "isisd/isis_events.h" |
| 57 | |
| 58 | #ifdef TOPOLOGY_GENERATE |
| 59 | #include "spgrid.h" |
| 60 | u_char DEFAULT_TOPOLOGY_BASEIS[6] = {0xFE, 0xED, 0xFE, 0xED, 0x00, 0x00}; |
| 61 | #endif /* TOPOLOGY_GENERATE */ |
| 62 | |
| 63 | |
| 64 | struct isis *isis = NULL; |
| 65 | struct thread_master *master; |
| 66 | |
| 67 | |
| 68 | void |
| 69 | isis_new (unsigned long process_id) |
| 70 | { |
| 71 | |
| 72 | isis = XMALLOC (MTYPE_ISIS, sizeof(struct isis)); |
| 73 | bzero (isis, sizeof (struct isis)); |
| 74 | /* |
| 75 | * Default values |
| 76 | */ |
| 77 | isis->max_area_addrs = 3; |
| 78 | |
| 79 | isis->process_id = process_id; |
| 80 | isis->area_list = list_new (); |
| 81 | isis->init_circ_list = list_new (); |
| 82 | isis->uptime = time (NULL); |
| 83 | isis->nexthops = list_new (); |
| 84 | #ifdef HAVE_IPV6 |
| 85 | isis->nexthops6 = list_new (); |
| 86 | #endif /* HAVE_IPV6 */ |
| 87 | /* |
| 88 | * uncomment the next line for full debugs |
| 89 | */ |
| 90 | /* isis->debugs = 0xFFFF; */ |
| 91 | } |
| 92 | |
| 93 | struct isis_area * |
| 94 | isis_area_create () |
| 95 | { |
| 96 | |
| 97 | struct isis_area *area; |
| 98 | |
| 99 | area = XMALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area)); |
| 100 | memset (area, 0, sizeof (struct isis_area)); |
| 101 | |
| 102 | /* |
| 103 | * The first instance is level-1-2 rest are level-1, unless otherwise |
| 104 | * configured |
| 105 | */ |
| 106 | if (listcount (isis->area_list) > 0) |
| 107 | area->is_type = IS_LEVEL_1; |
| 108 | else |
| 109 | area->is_type = IS_LEVEL_1_AND_2; |
| 110 | /* |
| 111 | * intialize the databases |
| 112 | */ |
| 113 | area->lspdb[0] = lsp_db_init (); |
| 114 | area->lspdb[1] = lsp_db_init (); |
| 115 | |
| 116 | spftree_area_init (area); |
| 117 | area->route_table = route_table_init (); |
| 118 | #ifdef HAVE_IPV6 |
| 119 | area->route_table6 = route_table_init (); |
| 120 | #endif /* HAVE_IPV6 */ |
| 121 | area->circuit_list = list_new (); |
| 122 | area->area_addrs = list_new (); |
| 123 | area->t_tick = thread_add_timer (master, lsp_tick, area, 1); |
| 124 | area->flags.maxindex = -1; |
| 125 | /* |
| 126 | * Default values |
| 127 | */ |
| 128 | area->max_lsp_lifetime[0] = MAX_AGE; /* 1200 */ |
| 129 | area->max_lsp_lifetime[1] = MAX_AGE; /* 1200 */ |
| 130 | area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT; |
| 131 | area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; |
| 132 | area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900 */ |
| 133 | area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900 */ |
| 134 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 135 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
| 136 | area->dynhostname = 1; |
| 137 | area->lsp_frag_threshold = 90; |
| 138 | #ifdef TOPOLOGY_GENERATE |
| 139 | memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
| 140 | #endif /* TOPOLOGY_GENERATE */ |
| 141 | |
| 142 | /* FIXME: Think of a better way... */ |
| 143 | area->min_bcast_mtu = 1497; |
| 144 | |
| 145 | return area; |
| 146 | } |
| 147 | |
| 148 | struct isis_area * |
| 149 | isis_area_lookup (char *area_tag) |
| 150 | { |
| 151 | struct isis_area *area; |
| 152 | struct listnode *node; |
| 153 | |
| 154 | LIST_LOOP (isis->area_list, area, node) |
| 155 | if ((area->area_tag == NULL && area_tag == NULL) || |
| 156 | (area->area_tag && area_tag && strcmp (area->area_tag, area_tag) == 0)) |
| 157 | return area; |
| 158 | |
| 159 | return NULL; |
| 160 | } |
| 161 | |
| 162 | int |
| 163 | isis_area_get (struct vty *vty, char *area_tag) |
| 164 | { |
| 165 | |
| 166 | struct isis_area *area; |
| 167 | |
| 168 | area = isis_area_lookup (area_tag); |
| 169 | |
| 170 | if (area) { |
| 171 | vty->node = ISIS_NODE; |
| 172 | vty->index = area; |
| 173 | return CMD_SUCCESS; |
| 174 | } |
| 175 | |
| 176 | area = isis_area_create (); |
| 177 | area->area_tag = strdup (area_tag); |
| 178 | listnode_add (isis->area_list, area); |
| 179 | |
| 180 | zlog_info ("new IS-IS area instance %s", area->area_tag); |
| 181 | |
| 182 | vty->node = ISIS_NODE; |
| 183 | vty->index = area; |
| 184 | |
| 185 | return CMD_SUCCESS; |
| 186 | } |
| 187 | |
| 188 | int |
| 189 | isis_area_destroy (struct vty *vty, char *area_tag) |
| 190 | { |
| 191 | |
| 192 | struct isis_area *area; |
| 193 | struct listnode *node; |
| 194 | struct isis_circuit *circuit; |
| 195 | |
| 196 | area = isis_area_lookup (area_tag); |
| 197 | |
| 198 | if (area == NULL) { |
| 199 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 200 | return CMD_WARNING; |
| 201 | } |
| 202 | |
| 203 | if (area->circuit_list) { |
| 204 | node = listhead (area->circuit_list); |
| 205 | while (node) { |
| 206 | circuit = getdata (node); |
| 207 | nextnode (node); |
| 208 | isis_circuit_del (circuit); |
| 209 | } |
| 210 | list_delete (area->circuit_list); |
| 211 | } |
| 212 | listnode_delete (isis->area_list, area); |
| 213 | if (area->t_tick) |
| 214 | thread_cancel (area->t_tick); |
| 215 | if (area->t_remove_aged) |
| 216 | thread_cancel (area->t_remove_aged); |
| 217 | if (area->t_lsp_refresh[0]) |
| 218 | thread_cancel (area->t_lsp_refresh[0]); |
| 219 | if (area->t_lsp_refresh[1]) |
| 220 | thread_cancel (area->t_lsp_refresh[1]); |
| 221 | |
| 222 | XFREE (MTYPE_ISIS_AREA, area); |
| 223 | |
| 224 | return CMD_SUCCESS; |
| 225 | } |
| 226 | |
| 227 | int |
| 228 | area_net_title (struct vty *vty , char *net_title) |
| 229 | { |
| 230 | |
| 231 | struct isis_area *area; |
| 232 | struct area_addr *addr; |
| 233 | struct area_addr *addrp; |
| 234 | struct listnode *node; |
| 235 | |
| 236 | u_char buff[255]; |
| 237 | area = vty->index; |
| 238 | |
| 239 | if (!area) { |
| 240 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 241 | return CMD_WARNING; |
| 242 | } |
| 243 | |
| 244 | /* We check that we are not over the maximal number of addresses */ |
| 245 | if (listcount (area->area_addrs) >= isis->max_area_addrs) { |
| 246 | vty_out (vty, "Maximum of area addresses (%d) already reached %s", |
| 247 | isis->max_area_addrs, VTY_NEWLINE); |
| 248 | return CMD_WARNING; |
| 249 | } |
| 250 | |
| 251 | addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr)); |
| 252 | addr->addr_len = dotformat2buff (buff, net_title); |
| 253 | memcpy (addr->area_addr, buff, addr->addr_len); |
| 254 | #ifdef EXTREME_DEBUG |
| 255 | zlog_info ("added area address %s for area %s (address length %d)", |
| 256 | net_title, area->area_tag, addr->addr_len); |
| 257 | #endif /* EXTREME_DEBUG */ |
| 258 | if (addr->addr_len < 8 || addr->addr_len > 20) { |
| 259 | zlog_warn ("area address must be at least 8..20 octets long (%d)", |
| 260 | addr->addr_len); |
| 261 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 262 | return CMD_WARNING; |
| 263 | } |
| 264 | |
| 265 | if (isis->sysid_set == 0) { |
| 266 | /* |
| 267 | * First area address - get the SystemID for this router |
| 268 | */ |
| 269 | memcpy (isis->sysid, GETSYSID(addr, ISIS_SYS_ID_LEN), ISIS_SYS_ID_LEN); |
| 270 | isis->sysid_set = 1; |
| 271 | zlog_info ("Router has SystemID %s", sysid_print (isis->sysid)); |
| 272 | } else { |
| 273 | /* |
| 274 | * Check that the SystemID portions match |
| 275 | */ |
| 276 | if (memcmp (isis->sysid, GETSYSID(addr, ISIS_SYS_ID_LEN), |
| 277 | ISIS_SYS_ID_LEN)) { |
| 278 | vty_out (vty, "System ID must not change when defining additional area" |
| 279 | " addresses%s", VTY_NEWLINE); |
| 280 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 281 | return CMD_WARNING; |
| 282 | } |
| 283 | |
| 284 | /* now we see that we don't already have this address */ |
| 285 | LIST_LOOP (area->area_addrs, addrp, node) { |
| 286 | if ((addrp->addr_len+ ISIS_SYS_ID_LEN + 1) == (addr->addr_len)) { |
| 287 | if (!memcmp (addrp->area_addr, addr->area_addr,addr->addr_len)) { |
| 288 | XFREE (MTYPE_ISIS_AREA_ADDR, addr); |
| 289 | return CMD_SUCCESS; /* silent fail */ |
| 290 | } |
| 291 | } |
| 292 | } |
| 293 | |
| 294 | } |
| 295 | /* |
| 296 | * Forget the systemID part of the address |
| 297 | */ |
| 298 | addr->addr_len -= (ISIS_SYS_ID_LEN + 1); |
| 299 | listnode_add (area->area_addrs, addr); |
| 300 | |
| 301 | /* only now we can safely generate our LSPs for this area */ |
| 302 | if (listcount(area->area_addrs) > 0) { |
| 303 | lsp_l1_generate (area); |
| 304 | lsp_l2_generate (area); |
| 305 | } |
| 306 | |
| 307 | return CMD_SUCCESS; |
| 308 | } |
| 309 | |
| 310 | int |
| 311 | area_clear_net_title (struct vty *vty, char *net_title) |
| 312 | { |
| 313 | struct isis_area *area; |
| 314 | struct area_addr addr, *addrp = NULL; |
| 315 | struct listnode *node; |
| 316 | u_char buff[255]; |
| 317 | |
| 318 | area = vty->index; |
| 319 | if (!area) { |
| 320 | vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE); |
| 321 | return CMD_WARNING; |
| 322 | } |
| 323 | |
| 324 | addr.addr_len = dotformat2buff (buff, net_title); |
| 325 | if (addr.addr_len < 8 || addr.addr_len > 20) { |
| 326 | vty_out (vty, "Unsupported area address length %d, should be 8...20 %s", |
| 327 | addr.addr_len, VTY_NEWLINE); |
| 328 | return CMD_WARNING; |
| 329 | } |
| 330 | |
| 331 | memcpy(addr.area_addr, buff, (int)addr.addr_len); |
| 332 | |
| 333 | LIST_LOOP (area->area_addrs, addrp, node) |
| 334 | if (addrp->addr_len == addr.addr_len && |
| 335 | !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len)) |
| 336 | break; |
| 337 | |
| 338 | if (!addrp) { |
| 339 | vty_out (vty, "No area address %s for area %s %s", net_title, |
| 340 | area->area_tag, VTY_NEWLINE); |
| 341 | return CMD_WARNING; |
| 342 | } |
| 343 | |
| 344 | listnode_delete (area->area_addrs, addrp); |
| 345 | |
| 346 | return CMD_SUCCESS; |
| 347 | } |
| 348 | |
| 349 | |
| 350 | /* |
| 351 | * 'show clns neighbors' command |
| 352 | */ |
| 353 | |
| 354 | int |
| 355 | show_clns_neigh (struct vty *vty, char detail) |
| 356 | { |
| 357 | struct listnode *node_area, *node_circ; |
| 358 | struct isis_area *area; |
| 359 | struct isis_circuit *circuit; |
| 360 | struct list *db; |
| 361 | int i; |
| 362 | |
| 363 | if (!isis) { |
| 364 | vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE); |
| 365 | return CMD_SUCCESS; |
| 366 | } |
| 367 | |
| 368 | for (node_area = listhead (isis->area_list); node_area; |
| 369 | nextnode (node_area)) { |
| 370 | area = getdata (node_area); |
| 371 | vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE); |
| 372 | |
| 373 | if (detail==ISIS_UI_LEVEL_BRIEF) |
| 374 | vty_out (vty, " System Id Interface L State " |
| 375 | "Holdtime SNPA%s", VTY_NEWLINE); |
| 376 | |
| 377 | for (node_circ = listhead (area->circuit_list); node_circ; |
| 378 | nextnode (node_circ)) { |
| 379 | circuit = getdata (node_circ); |
| 380 | if (circuit->circ_type == CIRCUIT_T_BROADCAST) { |
| 381 | for (i = 0; i < 2; i++) { |
| 382 | db = circuit->u.bc.adjdb[i]; |
| 383 | if (db && db->count) { |
| 384 | if (detail == ISIS_UI_LEVEL_BRIEF) |
| 385 | isis_adjdb_iterate (db, (void (*) (struct isis_adjacency *, |
| 386 | void *)) |
| 387 | isis_adj_print_vty, vty); |
| 388 | if (detail == ISIS_UI_LEVEL_DETAIL) |
| 389 | isis_adjdb_iterate (db, (void (*) (struct isis_adjacency *, |
| 390 | void *)) |
| 391 | isis_adj_print_vty_detail, vty); |
| 392 | if (detail == ISIS_UI_LEVEL_EXTENSIVE) |
| 393 | isis_adjdb_iterate (db, (void (*) (struct isis_adjacency *, |
| 394 | void *)) |
| 395 | isis_adj_print_vty_extensive, vty); |
| 396 | } |
| 397 | } |
| 398 | } else if (circuit->circ_type == CIRCUIT_T_P2P && |
| 399 | circuit->u.p2p.neighbor) { |
| 400 | if (detail==ISIS_UI_LEVEL_BRIEF) |
| 401 | isis_adj_p2p_print_vty (circuit->u.p2p.neighbor, vty); |
| 402 | if (detail==ISIS_UI_LEVEL_DETAIL) |
| 403 | isis_adj_p2p_print_vty_detail (circuit->u.p2p.neighbor, vty); |
| 404 | if (detail==ISIS_UI_LEVEL_EXTENSIVE) |
| 405 | isis_adj_p2p_print_vty_extensive (circuit->u.p2p.neighbor, vty); |
| 406 | } |
| 407 | } |
| 408 | } |
| 409 | |
| 410 | return CMD_SUCCESS; |
| 411 | } |
| 412 | |
| 413 | DEFUN (show_clns_neighbors, |
| 414 | show_clns_neighbors_cmd, |
| 415 | "show clns neighbors", |
| 416 | SHOW_STR |
| 417 | "clns network information\n" |
| 418 | "CLNS neighbor adjacencies\n") |
| 419 | { |
| 420 | return show_clns_neigh(vty, ISIS_UI_LEVEL_BRIEF); |
| 421 | } |
| 422 | |
| 423 | ALIAS (show_clns_neighbors, |
| 424 | show_isis_neighbors_cmd, |
| 425 | "show isis neighbors", |
| 426 | SHOW_STR |
| 427 | "IS-IS network information\n" |
| 428 | "IS-IS neighbor adjacencies\n") |
| 429 | |
| 430 | DEFUN (show_clns_neighbors_detail, |
| 431 | show_clns_neighbors_detail_cmd, |
| 432 | "show clns neighbors detail", |
| 433 | SHOW_STR |
| 434 | "clns network information\n" |
| 435 | "CLNS neighbor adjacencies\n" |
| 436 | "show detailed information\n") |
| 437 | { |
| 438 | return show_clns_neigh(vty, ISIS_UI_LEVEL_DETAIL); |
| 439 | } |
| 440 | |
| 441 | ALIAS (show_clns_neighbors_detail, |
| 442 | show_isis_neighbors_detail_cmd, |
| 443 | "show isis neighbors detail", |
| 444 | SHOW_STR |
| 445 | "IS-IS network information\n" |
| 446 | "IS-IS neighbor adjacencies\n" |
| 447 | "show detailed information\n") |
| 448 | |
| 449 | /* |
| 450 | * 'isis debug', 'show debugging' |
| 451 | */ |
| 452 | |
| 453 | void |
| 454 | print_debug (struct vty *vty, int flags, int onoff) |
| 455 | { |
| 456 | char onoffs[4]; |
| 457 | if (onoff) |
| 458 | strcpy (onoffs,"on"); |
| 459 | else |
| 460 | strcpy (onoffs,"off"); |
| 461 | |
| 462 | if (flags & DEBUG_ADJ_PACKETS) |
| 463 | vty_out (vty,"IS-IS Adjacency related packets debugging is %s%s", onoffs, |
| 464 | VTY_NEWLINE); |
| 465 | if (flags & DEBUG_CHECKSUM_ERRORS) |
| 466 | vty_out (vty,"IS-IS checksum errors debugging is %s%s", onoffs, |
| 467 | VTY_NEWLINE); |
| 468 | if (flags & DEBUG_LOCAL_UPDATES) |
| 469 | vty_out (vty,"IS-IS local updates debugging is %s%s", onoffs, |
| 470 | VTY_NEWLINE); |
| 471 | if (flags & DEBUG_PROTOCOL_ERRORS) |
| 472 | vty_out (vty,"IS-IS protocol errors debugging is %s%s", onoffs, |
| 473 | VTY_NEWLINE); |
| 474 | if (flags & DEBUG_SNP_PACKETS) |
| 475 | vty_out (vty,"IS-IS CSNP/PSNP packets debugging is %s%s", onoffs, |
| 476 | VTY_NEWLINE); |
| 477 | if (flags & DEBUG_SPF_EVENTS) |
| 478 | vty_out (vty,"IS-IS SPF events debugging is %s%s", onoffs, |
| 479 | VTY_NEWLINE); |
| 480 | if (flags & DEBUG_SPF_STATS) |
| 481 | vty_out (vty,"IS-IS SPF Timing and Statistics Data debugging is %s%s", |
| 482 | onoffs, VTY_NEWLINE); |
| 483 | if (flags & DEBUG_SPF_TRIGGERS) |
| 484 | vty_out (vty,"IS-IS SPF triggering events debugging is %s%s", onoffs, |
| 485 | VTY_NEWLINE); |
| 486 | if (flags & DEBUG_UPDATE_PACKETS) |
| 487 | vty_out (vty,"IS-IS Update related packet debugging is %s%s", onoffs, |
| 488 | VTY_NEWLINE); |
| 489 | if (flags & DEBUG_RTE_EVENTS) |
| 490 | vty_out (vty,"IS-IS Route related debuggin is %s%s", onoffs, |
| 491 | VTY_NEWLINE); |
| 492 | if (flags & DEBUG_EVENTS) |
| 493 | vty_out (vty,"IS-IS Event debugging is %s%s", onoffs, |
| 494 | VTY_NEWLINE); |
| 495 | |
| 496 | } |
| 497 | |
| 498 | DEFUN (show_debugging, |
| 499 | show_debugging_cmd, |
| 500 | "show debugging", |
| 501 | SHOW_STR |
| 502 | "State of each debugging option\n") |
| 503 | { |
| 504 | vty_out (vty,"IS-IS:%s", VTY_NEWLINE); |
| 505 | print_debug (vty, isis->debugs, 1); |
| 506 | return CMD_SUCCESS; |
| 507 | } |
| 508 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 509 | /* Debug node. */ |
| 510 | static struct cmd_node debug_node = |
| 511 | { |
| 512 | DEBUG_NODE, |
| 513 | "", |
| 514 | 1 |
| 515 | }; |
| 516 | |
| 517 | static int |
| 518 | config_write_debug (struct vty *vty) |
| 519 | { |
| 520 | int write = 0; |
| 521 | int flags = isis->debugs; |
| 522 | |
| 523 | if (flags & DEBUG_ADJ_PACKETS) { |
| 524 | vty_out (vty, "debug isis adj-packets%s", |
| 525 | VTY_NEWLINE); |
| 526 | write++; |
| 527 | } |
| 528 | if (flags & DEBUG_CHECKSUM_ERRORS) { |
| 529 | vty_out (vty, "debug isis checksum-errors%s", |
| 530 | VTY_NEWLINE); |
| 531 | write++; |
| 532 | } |
| 533 | if (flags & DEBUG_LOCAL_UPDATES) { |
| 534 | vty_out (vty, "debug isis local-updates%s", |
| 535 | VTY_NEWLINE); |
| 536 | write++; |
| 537 | } |
| 538 | if (flags & DEBUG_PROTOCOL_ERRORS) { |
| 539 | vty_out (vty, "debug isis protocol-errors%s", |
| 540 | VTY_NEWLINE); |
| 541 | write++; |
| 542 | } |
| 543 | if (flags & DEBUG_SNP_PACKETS) { |
| 544 | vty_out (vty, "debug isis snp-packets%s", |
| 545 | VTY_NEWLINE); |
| 546 | write++; |
| 547 | } |
| 548 | if (flags & DEBUG_SPF_EVENTS) { |
| 549 | vty_out (vty, "debug isis spf-events%s", |
| 550 | VTY_NEWLINE); |
| 551 | write++; |
| 552 | } |
| 553 | if (flags & DEBUG_SPF_STATS) { |
| 554 | vty_out (vty, "debug isis spf-statistics%s", |
| 555 | VTY_NEWLINE); |
| 556 | write++; |
| 557 | } |
| 558 | if (flags & DEBUG_SPF_TRIGGERS) { |
| 559 | vty_out (vty, "debug isis spf-triggers%s", |
| 560 | VTY_NEWLINE); |
| 561 | write++; |
| 562 | } |
| 563 | if (flags & DEBUG_UPDATE_PACKETS) { |
| 564 | vty_out (vty, "debug isis update-packets%s", |
| 565 | VTY_NEWLINE); |
| 566 | write++; |
| 567 | } |
| 568 | if (flags & DEBUG_RTE_EVENTS) { |
| 569 | vty_out (vty, "debug isis route-events%s", |
| 570 | VTY_NEWLINE); |
| 571 | write++; |
| 572 | } |
| 573 | if (flags & DEBUG_EVENTS) { |
| 574 | vty_out (vty, "debug isis events%s", |
| 575 | VTY_NEWLINE); |
| 576 | write++; |
| 577 | } |
| 578 | |
| 579 | return write; |
| 580 | } |
| 581 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 582 | DEFUN (debug_isis_adj, |
| 583 | debug_isis_adj_cmd, |
| 584 | "debug isis adj-packets", |
| 585 | DEBUG_STR |
| 586 | "IS-IS information\n" |
| 587 | "IS-IS Adjacency related packets\n" |
| 588 | ) |
| 589 | { |
| 590 | isis->debugs |= DEBUG_ADJ_PACKETS; |
| 591 | print_debug (vty,DEBUG_ADJ_PACKETS,1); |
| 592 | |
| 593 | return CMD_SUCCESS; |
| 594 | } |
| 595 | |
| 596 | DEFUN (no_debug_isis_adj, |
| 597 | no_debug_isis_adj_cmd, |
| 598 | "no debug isis adj-packets", |
| 599 | UNDEBUG_STR |
| 600 | "IS-IS information\n" |
| 601 | "IS-IS Adjacency related packets\n" |
| 602 | ) |
| 603 | { |
| 604 | |
| 605 | isis->debugs &= ~DEBUG_ADJ_PACKETS; |
| 606 | print_debug (vty, DEBUG_ADJ_PACKETS, 0); |
| 607 | |
| 608 | return CMD_SUCCESS; |
| 609 | } |
| 610 | |
| 611 | |
| 612 | DEFUN (debug_isis_csum, |
| 613 | debug_isis_csum_cmd, |
| 614 | "debug isis checksum-errors", |
| 615 | DEBUG_STR |
| 616 | "IS-IS information\n" |
| 617 | "IS-IS LSP checksum errors\n" |
| 618 | ) |
| 619 | { |
| 620 | isis->debugs |= DEBUG_CHECKSUM_ERRORS; |
| 621 | print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1); |
| 622 | |
| 623 | return CMD_SUCCESS; |
| 624 | } |
| 625 | |
| 626 | DEFUN (no_debug_isis_csum, |
| 627 | no_debug_isis_csum_cmd, |
| 628 | "no debug isis checksum-errors", |
| 629 | UNDEBUG_STR |
| 630 | "IS-IS information\n" |
| 631 | "IS-IS LSP checksum errors\n" |
| 632 | ) |
| 633 | { |
| 634 | isis->debugs &= ~DEBUG_CHECKSUM_ERRORS; |
| 635 | print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0); |
| 636 | |
| 637 | return CMD_SUCCESS; |
| 638 | } |
| 639 | |
| 640 | DEFUN (debug_isis_lupd, |
| 641 | debug_isis_lupd_cmd, |
| 642 | "debug isis local-updates", |
| 643 | DEBUG_STR |
| 644 | "IS-IS information\n" |
| 645 | "IS-IS local update packets\n" |
| 646 | ) |
| 647 | { |
| 648 | isis->debugs |= DEBUG_LOCAL_UPDATES; |
| 649 | print_debug (vty, DEBUG_LOCAL_UPDATES, 1); |
| 650 | |
| 651 | return CMD_SUCCESS; |
| 652 | } |
| 653 | |
| 654 | DEFUN (no_debug_isis_lupd, |
| 655 | no_debug_isis_lupd_cmd, |
| 656 | "no debug isis local-updates", |
| 657 | UNDEBUG_STR |
| 658 | "IS-IS information\n" |
| 659 | "IS-IS local update packets\n" |
| 660 | ) |
| 661 | { |
| 662 | isis->debugs &= ~DEBUG_LOCAL_UPDATES; |
| 663 | print_debug (vty, DEBUG_LOCAL_UPDATES , 0); |
| 664 | |
| 665 | return CMD_SUCCESS; |
| 666 | } |
| 667 | |
| 668 | DEFUN (debug_isis_err, |
| 669 | debug_isis_err_cmd, |
| 670 | "debug isis protocol-errors", |
| 671 | DEBUG_STR |
| 672 | "IS-IS information\n" |
| 673 | "IS-IS LSP protocol errors\n" |
| 674 | ) |
| 675 | { |
| 676 | isis->debugs |= DEBUG_PROTOCOL_ERRORS; |
| 677 | print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1); |
| 678 | |
| 679 | return CMD_SUCCESS; |
| 680 | } |
| 681 | |
| 682 | DEFUN (no_debug_isis_err, |
| 683 | no_debug_isis_err_cmd, |
| 684 | "no debug isis protocol-errors", |
| 685 | UNDEBUG_STR |
| 686 | "IS-IS information\n" |
| 687 | "IS-IS LSP protocol errors\n" |
| 688 | ) |
| 689 | { |
| 690 | isis->debugs &= ~DEBUG_PROTOCOL_ERRORS; |
| 691 | print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0); |
| 692 | |
| 693 | return CMD_SUCCESS; |
| 694 | } |
| 695 | |
| 696 | DEFUN (debug_isis_snp, |
| 697 | debug_isis_snp_cmd, |
| 698 | "debug isis snp-packets", |
| 699 | DEBUG_STR |
| 700 | "IS-IS information\n" |
| 701 | "IS-IS CSNP/PSNP packets\n" |
| 702 | ) |
| 703 | { |
| 704 | isis->debugs |= DEBUG_SNP_PACKETS; |
| 705 | print_debug (vty, DEBUG_SNP_PACKETS, 1); |
| 706 | |
| 707 | return CMD_SUCCESS; |
| 708 | } |
| 709 | |
| 710 | DEFUN (no_debug_isis_snp, |
| 711 | no_debug_isis_snp_cmd, |
| 712 | "no debug isis snp-packets", |
| 713 | UNDEBUG_STR |
| 714 | "IS-IS information\n" |
| 715 | "IS-IS CSNP/PSNP packets\n" |
| 716 | ) |
| 717 | { |
| 718 | isis->debugs &= ~DEBUG_SNP_PACKETS ; |
| 719 | print_debug (vty, DEBUG_SNP_PACKETS, 0); |
| 720 | |
| 721 | return CMD_SUCCESS; |
| 722 | } |
| 723 | |
| 724 | |
| 725 | |
| 726 | DEFUN (debug_isis_upd, |
| 727 | debug_isis_upd_cmd, |
| 728 | "debug isis update-packets", |
| 729 | DEBUG_STR |
| 730 | "IS-IS information\n" |
| 731 | "IS-IS Update related packets\n" |
| 732 | ) |
| 733 | { |
| 734 | isis->debugs |= DEBUG_UPDATE_PACKETS; |
| 735 | print_debug (vty, DEBUG_UPDATE_PACKETS, 1); |
| 736 | |
| 737 | return CMD_SUCCESS; |
| 738 | } |
| 739 | |
| 740 | DEFUN (no_debug_isis_upd, |
| 741 | no_debug_isis_upd_cmd, |
| 742 | "no debug isis update-packets", |
| 743 | UNDEBUG_STR |
| 744 | "IS-IS information\n" |
| 745 | "IS-IS Update related packets\n" |
| 746 | ) |
| 747 | { |
| 748 | isis->debugs &= ~DEBUG_UPDATE_PACKETS; |
| 749 | print_debug (vty, DEBUG_UPDATE_PACKETS, 0); |
| 750 | |
| 751 | return CMD_SUCCESS; |
| 752 | } |
| 753 | |
| 754 | |
| 755 | DEFUN (debug_isis_spfevents, |
| 756 | debug_isis_spfevents_cmd, |
| 757 | "debug isis spf-events", |
| 758 | DEBUG_STR |
| 759 | "IS-IS information\n" |
| 760 | "IS-IS Shortest Path First Events\n" |
| 761 | ) |
| 762 | { |
| 763 | isis->debugs |= DEBUG_SPF_EVENTS; |
| 764 | print_debug (vty, DEBUG_SPF_EVENTS , 1); |
| 765 | |
| 766 | return CMD_SUCCESS; |
| 767 | } |
| 768 | |
| 769 | DEFUN (no_debug_isis_spfevents, |
| 770 | no_debug_isis_spfevents_cmd, |
| 771 | "no debug isis spf-events", |
| 772 | UNDEBUG_STR |
| 773 | "IS-IS information\n" |
| 774 | "IS-IS Shortest Path First Events\n" |
| 775 | ) |
| 776 | { |
| 777 | isis->debugs &= ~DEBUG_SPF_EVENTS; |
| 778 | print_debug (vty, DEBUG_SPF_EVENTS , 0); |
| 779 | |
| 780 | return CMD_SUCCESS; |
| 781 | } |
| 782 | |
| 783 | |
| 784 | DEFUN (debug_isis_spfstats, |
| 785 | debug_isis_spfstats_cmd, |
| 786 | "debug isis spf-statistics ", |
| 787 | DEBUG_STR |
| 788 | "IS-IS information\n" |
| 789 | "IS-IS SPF Timing and Statistic Data\n" |
| 790 | ) |
| 791 | { |
| 792 | isis->debugs |= DEBUG_SPF_STATS; |
| 793 | print_debug (vty, DEBUG_SPF_STATS, 1); |
| 794 | |
| 795 | return CMD_SUCCESS; |
| 796 | } |
| 797 | |
| 798 | DEFUN (no_debug_isis_spfstats, |
| 799 | no_debug_isis_spfstats_cmd, |
| 800 | "no debug isis spf-statistics", |
| 801 | UNDEBUG_STR |
| 802 | "IS-IS information\n" |
| 803 | "IS-IS SPF Timing and Statistic Data\n" |
| 804 | ) |
| 805 | { |
| 806 | isis->debugs &= ~DEBUG_SPF_STATS; |
| 807 | print_debug (vty, DEBUG_SPF_STATS, 0); |
| 808 | |
| 809 | return CMD_SUCCESS; |
| 810 | } |
| 811 | |
| 812 | DEFUN (debug_isis_spftrigg, |
| 813 | debug_isis_spftrigg_cmd, |
| 814 | "debug isis spf-triggers", |
| 815 | DEBUG_STR |
| 816 | "IS-IS information\n" |
| 817 | "IS-IS SPF triggering events\n" |
| 818 | ) |
| 819 | { |
| 820 | isis->debugs |= DEBUG_SPF_TRIGGERS; |
| 821 | print_debug (vty, DEBUG_SPF_TRIGGERS, 1); |
| 822 | |
| 823 | return CMD_SUCCESS; |
| 824 | } |
| 825 | |
| 826 | DEFUN (no_debug_isis_spftrigg, |
| 827 | no_debug_isis_spftrigg_cmd, |
| 828 | "no debug isis spf-triggers", |
| 829 | UNDEBUG_STR |
| 830 | "IS-IS information\n" |
| 831 | "IS-IS SPF triggering events\n" |
| 832 | ) |
| 833 | { |
| 834 | isis->debugs &= ~DEBUG_SPF_TRIGGERS; |
| 835 | print_debug (vty, DEBUG_SPF_TRIGGERS, 0); |
| 836 | |
| 837 | return CMD_SUCCESS; |
| 838 | } |
| 839 | |
| 840 | DEFUN (debug_isis_rtevents, |
| 841 | debug_isis_rtevents_cmd, |
| 842 | "debug isis route-events", |
| 843 | DEBUG_STR |
| 844 | "IS-IS information\n" |
| 845 | "IS-IS Route related events\n" |
| 846 | ) |
| 847 | { |
| 848 | isis->debugs |= DEBUG_RTE_EVENTS; |
| 849 | print_debug (vty, DEBUG_RTE_EVENTS, 1); |
| 850 | |
| 851 | return CMD_SUCCESS; |
| 852 | } |
| 853 | |
| 854 | DEFUN (no_debug_isis_rtevents, |
| 855 | no_debug_isis_rtevents_cmd, |
| 856 | "no debug isis route-events", |
| 857 | UNDEBUG_STR |
| 858 | "IS-IS information\n" |
| 859 | "IS-IS Route related events\n" |
| 860 | ) |
| 861 | { |
| 862 | isis->debugs &= ~DEBUG_RTE_EVENTS; |
| 863 | print_debug (vty, DEBUG_RTE_EVENTS, 0); |
| 864 | |
| 865 | return CMD_SUCCESS; |
| 866 | } |
| 867 | |
| 868 | DEFUN (debug_isis_events, |
| 869 | debug_isis_events_cmd, |
| 870 | "debug isis events", |
| 871 | DEBUG_STR |
| 872 | "IS-IS information\n" |
| 873 | "IS-IS Events\n" |
| 874 | ) |
| 875 | { |
| 876 | isis->debugs |= DEBUG_EVENTS; |
| 877 | print_debug (vty, DEBUG_EVENTS, 1); |
| 878 | |
| 879 | return CMD_SUCCESS; |
| 880 | } |
| 881 | |
| 882 | DEFUN (no_debug_isis_events, |
| 883 | no_debug_isis_events_cmd, |
| 884 | "no debug isis events", |
| 885 | UNDEBUG_STR |
| 886 | "IS-IS information\n" |
| 887 | "IS-IS Events\n" |
| 888 | ) |
| 889 | { |
| 890 | isis->debugs &= ~DEBUG_EVENTS; |
| 891 | print_debug (vty, DEBUG_EVENTS, 0); |
| 892 | |
| 893 | return CMD_SUCCESS; |
| 894 | } |
| 895 | |
| 896 | |
| 897 | DEFUN (show_hostname, |
| 898 | show_hostname_cmd, |
| 899 | "show isis hostname", |
| 900 | SHOW_STR |
| 901 | "IS-IS information\n" |
| 902 | "IS-IS Dynamic hostname mapping\n") |
| 903 | { |
| 904 | dynhn_print_all (vty); |
| 905 | |
| 906 | return CMD_SUCCESS; |
| 907 | } |
| 908 | |
| 909 | |
| 910 | DEFUN (show_database, |
| 911 | show_database_cmd, |
| 912 | "show isis database", |
| 913 | SHOW_STR |
| 914 | "IS-IS information\n" |
| 915 | "IS-IS link state database\n") |
| 916 | { |
| 917 | struct listnode *node; |
| 918 | struct isis_area *area; |
| 919 | int level,lsp_count; |
| 920 | |
| 921 | if (isis->area_list->count == 0) |
| 922 | return CMD_SUCCESS; |
| 923 | |
| 924 | for (node = listhead (isis->area_list); node; nextnode (node)) { |
| 925 | area = getdata (node); |
| 926 | vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null", |
| 927 | VTY_NEWLINE); |
| 928 | for (level=0;level<ISIS_LEVELS;level++) { |
| 929 | if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) { |
| 930 | vty_out (vty,"IS-IS Level-%d link-state database:%s", level+1, |
| 931 | VTY_NEWLINE); |
| 932 | |
| 933 | lsp_count = lsp_print_all (vty, area->lspdb[level], |
| 934 | ISIS_UI_LEVEL_BRIEF, |
| 935 | area->dynhostname); |
| 936 | |
| 937 | vty_out (vty,"%s %u LSPs%s%s", |
| 938 | VTY_NEWLINE, |
| 939 | lsp_count, |
| 940 | VTY_NEWLINE, |
| 941 | VTY_NEWLINE); |
| 942 | } |
| 943 | } |
| 944 | } |
| 945 | |
| 946 | return CMD_SUCCESS; |
| 947 | } |
| 948 | |
| 949 | |
| 950 | DEFUN (show_database_detail, |
| 951 | show_database_detail_cmd, |
| 952 | "show isis database detail", |
| 953 | SHOW_STR |
| 954 | "IS-IS information\n" |
| 955 | "IS-IS link state database\n") |
| 956 | { |
| 957 | struct listnode *node; |
| 958 | struct isis_area *area; |
| 959 | int level, lsp_count; |
| 960 | |
| 961 | if (isis->area_list->count == 0) |
| 962 | return CMD_SUCCESS; |
| 963 | |
| 964 | for (node = listhead (isis->area_list); node; nextnode (node)) { |
| 965 | area = getdata (node); |
| 966 | vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null", |
| 967 | VTY_NEWLINE); |
| 968 | for (level=0;level<ISIS_LEVELS;level++) { |
| 969 | if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0) { |
| 970 | vty_out (vty,"IS-IS Level-%d Link State Database:%s", level+1, |
| 971 | VTY_NEWLINE); |
| 972 | |
| 973 | lsp_count = lsp_print_all (vty, area->lspdb[level], |
| 974 | ISIS_UI_LEVEL_DETAIL, |
| 975 | area->dynhostname); |
| 976 | |
| 977 | vty_out (vty,"%s %u LSPs%s%s", |
| 978 | VTY_NEWLINE, |
| 979 | lsp_count, |
| 980 | VTY_NEWLINE, |
| 981 | VTY_NEWLINE); |
| 982 | } |
| 983 | } |
| 984 | } |
| 985 | |
| 986 | return CMD_SUCCESS; |
| 987 | } |
| 988 | |
| 989 | /* |
| 990 | * 'router isis' command |
| 991 | */ |
| 992 | DEFUN (router_isis, |
| 993 | router_isis_cmd, |
| 994 | "router isis WORD", |
| 995 | ROUTER_STR |
| 996 | "ISO IS-IS\n" |
| 997 | "ISO Routing area tag") |
| 998 | { |
| 999 | |
| 1000 | return isis_area_get (vty, argv[0]); |
| 1001 | |
| 1002 | } |
| 1003 | |
| 1004 | /* |
| 1005 | *'no router isis' command |
| 1006 | */ |
| 1007 | DEFUN (no_router_isis, |
| 1008 | no_router_isis_cmd, |
| 1009 | "no router isis WORD", |
| 1010 | "no\n" |
| 1011 | ROUTER_STR |
| 1012 | "ISO IS-IS\n" |
| 1013 | "ISO Routing area tag") |
| 1014 | |
| 1015 | { |
| 1016 | return isis_area_destroy (vty, argv[0]); |
| 1017 | } |
| 1018 | |
| 1019 | /* |
| 1020 | * 'net' command |
| 1021 | */ |
| 1022 | DEFUN (net, |
| 1023 | net_cmd, |
| 1024 | "net WORD", |
| 1025 | "A Network Entity Title for this process (OSI only)\n" |
| 1026 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n" ) |
| 1027 | { |
| 1028 | return area_net_title (vty, argv[0]); |
| 1029 | } |
| 1030 | |
| 1031 | |
| 1032 | /* |
| 1033 | * 'no net' command |
| 1034 | */ |
| 1035 | DEFUN (no_net, |
| 1036 | no_net_cmd, |
| 1037 | "no net WORD", |
| 1038 | NO_STR |
| 1039 | "A Network Entity Title for this process (OSI only)\n" |
| 1040 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n" ) |
| 1041 | { |
| 1042 | return area_clear_net_title (vty, argv[0]); |
| 1043 | } |
| 1044 | |
| 1045 | DEFUN (area_passwd, |
| 1046 | area_passwd_cmd, |
| 1047 | "area-password WORD", |
| 1048 | "Configure the authentication password for an area\n" |
| 1049 | "Area password\n" ) |
| 1050 | { |
| 1051 | struct isis_area *area; |
| 1052 | int len; |
| 1053 | |
| 1054 | area = vty->index; |
| 1055 | |
| 1056 | if (!area) { |
| 1057 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1058 | return CMD_WARNING; |
| 1059 | } |
| 1060 | |
| 1061 | len = strlen (argv[0]); |
| 1062 | if (len > 254) { |
| 1063 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1064 | return CMD_WARNING; |
| 1065 | } |
| 1066 | area->area_passwd.len = (u_char)len; |
| 1067 | area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
| 1068 | strncpy (area->area_passwd.passwd, argv[0], 255); |
| 1069 | |
| 1070 | return CMD_SUCCESS; |
| 1071 | } |
| 1072 | |
| 1073 | DEFUN (no_area_passwd, |
| 1074 | no_area_passwd_cmd, |
| 1075 | "no area-password", |
| 1076 | NO_STR |
| 1077 | "Configure the authentication password for an area\n") |
| 1078 | { |
| 1079 | struct isis_area *area; |
| 1080 | |
| 1081 | area = vty->index; |
| 1082 | |
| 1083 | if (!area) { |
| 1084 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1085 | return CMD_WARNING; |
| 1086 | } |
| 1087 | |
| 1088 | memset (&area->area_passwd, 0, sizeof (struct isis_passwd)); |
| 1089 | |
| 1090 | return CMD_SUCCESS; |
| 1091 | } |
| 1092 | |
| 1093 | |
| 1094 | DEFUN (domain_passwd, |
| 1095 | domain_passwd_cmd, |
| 1096 | "domain-password WORD", |
| 1097 | "Set the authentication password for a routing domain\n" |
| 1098 | "Routing domain password\n" ) |
| 1099 | { |
| 1100 | struct isis_area *area; |
| 1101 | int len; |
| 1102 | |
| 1103 | area = vty->index; |
| 1104 | |
| 1105 | if (!area) { |
| 1106 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1107 | return CMD_WARNING; |
| 1108 | } |
| 1109 | |
| 1110 | len = strlen (argv[0]); |
| 1111 | if (len > 254) { |
| 1112 | vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE); |
| 1113 | return CMD_WARNING; |
| 1114 | } |
| 1115 | area->domain_passwd.len = (u_char)len; |
| 1116 | area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT; |
| 1117 | strncpy (area->domain_passwd.passwd, argv[0], 255); |
| 1118 | |
| 1119 | return CMD_SUCCESS; |
| 1120 | } |
| 1121 | |
| 1122 | |
| 1123 | DEFUN (no_domain_passwd, |
| 1124 | no_domain_passwd_cmd, |
| 1125 | "no domain-password WORD", |
| 1126 | NO_STR |
| 1127 | "Set the authentication password for a routing domain\n") |
| 1128 | { |
| 1129 | struct isis_area *area; |
| 1130 | |
| 1131 | area = vty->index; |
| 1132 | |
| 1133 | if (!area) { |
| 1134 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1135 | return CMD_WARNING; |
| 1136 | } |
| 1137 | |
| 1138 | memset (&area->domain_passwd, 0, sizeof (struct isis_passwd)); |
| 1139 | |
| 1140 | return CMD_SUCCESS; |
| 1141 | } |
| 1142 | |
| 1143 | DEFUN (is_type, |
| 1144 | is_type_cmd, |
| 1145 | "is-type (level-1|level-1-2|level-2-only)", |
| 1146 | "IS Level for this routing process (OSI only)\n" |
| 1147 | "Act as a station router only\n" |
| 1148 | "Act as both a station router and an area router\n" |
| 1149 | "Act as an area router only\n") |
| 1150 | { |
| 1151 | struct isis_area *area; |
| 1152 | int type; |
| 1153 | |
| 1154 | area = vty->index; |
| 1155 | |
| 1156 | if (!area) { |
| 1157 | vty_out (vty, "Cant find IS-IS instance%s", VTY_NEWLINE); |
| 1158 | return CMD_WARNING; |
| 1159 | } |
| 1160 | |
| 1161 | type = string2circuit_t (argv[0]); |
| 1162 | if (!type) { |
| 1163 | vty_out (vty, "Unknown IS level %s", VTY_NEWLINE); |
| 1164 | return CMD_SUCCESS; |
| 1165 | } |
| 1166 | |
| 1167 | isis_event_system_type_change (area, type); |
| 1168 | |
| 1169 | return CMD_SUCCESS; |
| 1170 | } |
| 1171 | |
| 1172 | DEFUN (no_is_type, |
| 1173 | no_is_type_cmd, |
| 1174 | "no is-type (level-1|level-1-2|level-2-only)", |
| 1175 | NO_STR |
| 1176 | "IS Level for this routing process (OSI only)\n" |
| 1177 | "Act as a station router only\n" |
| 1178 | "Act as both a station router and an area router\n" |
| 1179 | "Act as an area router only\n") |
| 1180 | { |
| 1181 | |
| 1182 | struct isis_area *area; |
| 1183 | int type; |
| 1184 | |
| 1185 | area = vty->index; |
| 1186 | assert (area); |
| 1187 | |
| 1188 | /* |
| 1189 | * Put the is-type back to default. Which is level-1-2 on first |
| 1190 | * circuit for the area level-1 for the rest |
| 1191 | */ |
| 1192 | if (getdata (listhead (isis->area_list)) == area ) |
| 1193 | type = IS_LEVEL_1_AND_2; |
| 1194 | else |
| 1195 | type = IS_LEVEL_1; |
| 1196 | |
| 1197 | isis_event_system_type_change (area, type); |
| 1198 | |
| 1199 | return CMD_SUCCESS; |
| 1200 | } |
| 1201 | |
| 1202 | DEFUN (lsp_gen_interval, |
| 1203 | lsp_gen_interval_cmd, |
| 1204 | "lsp-gen-interval <1-120>", |
| 1205 | "Minimum interval between regenerating same LSP\n" |
| 1206 | "Minimum interval in seconds\n") |
| 1207 | { |
| 1208 | struct isis_area *area; |
| 1209 | uint16_t interval; |
| 1210 | |
| 1211 | area = vty->index; |
| 1212 | assert (area); |
| 1213 | |
| 1214 | interval = atoi (argv[0]); |
| 1215 | area->lsp_gen_interval[0] = interval; |
| 1216 | area->lsp_gen_interval[1] = interval; |
| 1217 | |
| 1218 | return CMD_SUCCESS; |
| 1219 | } |
| 1220 | |
| 1221 | DEFUN (no_lsp_gen_interval, |
| 1222 | no_lsp_gen_interval_cmd, |
| 1223 | "no lsp-gen-interval", |
| 1224 | NO_STR |
| 1225 | "Minimum interval between regenerating same LSP\n" |
| 1226 | ) |
| 1227 | { |
| 1228 | struct isis_area *area; |
| 1229 | |
| 1230 | area = vty->index; |
| 1231 | assert (area); |
| 1232 | |
| 1233 | area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT; |
| 1234 | area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; |
| 1235 | |
| 1236 | return CMD_SUCCESS; |
| 1237 | } |
| 1238 | |
| 1239 | ALIAS (no_lsp_gen_interval, |
| 1240 | no_lsp_gen_interval_arg_cmd, |
| 1241 | "no lsp-gen-interval <1-120>", |
| 1242 | NO_STR |
| 1243 | "Minimum interval between regenerating same LSP\n" |
| 1244 | "Minimum interval in seconds\n" |
| 1245 | ) |
| 1246 | |
| 1247 | DEFUN (lsp_gen_interval_l1, |
| 1248 | lsp_gen_interval_l1_cmd, |
| 1249 | "lsp-gen-interval level-1 <1-120>", |
| 1250 | "Minimum interval between regenerating same LSP\n" |
| 1251 | "Set interval for level 1 only\n" |
| 1252 | "Minimum interval in seconds\n" |
| 1253 | ) |
| 1254 | { |
| 1255 | struct isis_area *area; |
| 1256 | uint16_t interval; |
| 1257 | |
| 1258 | area = vty->index; |
| 1259 | assert (area); |
| 1260 | |
| 1261 | interval = atoi (argv[0]); |
| 1262 | area->lsp_gen_interval[0] = interval; |
| 1263 | |
| 1264 | return CMD_SUCCESS; |
| 1265 | } |
| 1266 | |
| 1267 | DEFUN (no_lsp_gen_interval_l1, |
| 1268 | no_lsp_gen_interval_l1_cmd, |
| 1269 | "no lsp-gen-interval level-1", |
| 1270 | NO_STR |
| 1271 | "Minimum interval between regenerating same LSP\n" |
| 1272 | "Set interval for level 1 only\n" |
| 1273 | |
| 1274 | ) |
| 1275 | { |
| 1276 | struct isis_area *area; |
| 1277 | |
| 1278 | area = vty->index; |
| 1279 | assert (area); |
| 1280 | |
| 1281 | area->lsp_gen_interval[0] = LSP_GEN_INTERVAL_DEFAULT; |
| 1282 | |
| 1283 | return CMD_SUCCESS; |
| 1284 | } |
| 1285 | |
| 1286 | ALIAS (no_lsp_gen_interval_l1, |
| 1287 | no_lsp_gen_interval_l1_arg_cmd, |
| 1288 | "no lsp-gen-interval level-1 <1-120>", |
| 1289 | NO_STR |
| 1290 | "Minimum interval between regenerating same LSP\n" |
| 1291 | "Set interval for level 1 only\n" |
| 1292 | "Minimum interval in seconds\n" |
| 1293 | ) |
| 1294 | |
| 1295 | |
| 1296 | DEFUN (lsp_gen_interval_l2, |
| 1297 | lsp_gen_interval_l2_cmd, |
| 1298 | "lsp-gen-interval level-2 <1-120>", |
| 1299 | "Minimum interval between regenerating same LSP\n" |
| 1300 | "Set interval for level 2 only\n" |
| 1301 | "Minimum interval in seconds\n" |
| 1302 | ) |
| 1303 | { |
| 1304 | struct isis_area *area; |
| 1305 | int interval; |
| 1306 | |
| 1307 | area = vty->index; |
| 1308 | assert (area); |
| 1309 | |
| 1310 | interval = atoi (argv[0]); |
| 1311 | area->lsp_gen_interval[1] = interval; |
| 1312 | |
| 1313 | return CMD_SUCCESS; |
| 1314 | } |
| 1315 | |
| 1316 | DEFUN (no_lsp_gen_interval_l2, |
| 1317 | no_lsp_gen_interval_l2_cmd, |
| 1318 | "no lsp-gen-interval level-2", |
| 1319 | NO_STR |
| 1320 | "Minimum interval between regenerating same LSP\n" |
| 1321 | "Set interval for level 2 only\n" |
| 1322 | ) |
| 1323 | { |
| 1324 | struct isis_area *area; |
| 1325 | int interval; |
| 1326 | |
| 1327 | area = vty->index; |
| 1328 | assert (area); |
| 1329 | |
| 1330 | interval = atoi (argv[0]); |
| 1331 | area->lsp_gen_interval[1] = LSP_GEN_INTERVAL_DEFAULT; |
| 1332 | |
| 1333 | return CMD_SUCCESS; |
| 1334 | } |
| 1335 | |
| 1336 | ALIAS (no_lsp_gen_interval_l2, |
| 1337 | no_lsp_gen_interval_l2_arg_cmd, |
| 1338 | "no lsp-gen-interval level-2 <1-120>", |
| 1339 | NO_STR |
| 1340 | "Minimum interval between regenerating same LSP\n" |
| 1341 | "Set interval for level 2 only\n" |
| 1342 | "Minimum interval in seconds\n" |
| 1343 | ) |
| 1344 | |
| 1345 | |
| 1346 | DEFUN (metric_style, |
| 1347 | metric_style_cmd, |
| 1348 | "metric-style (narrow|wide)", |
| 1349 | "Use old-style (ISO 10589) or new-style packet formats\n" |
| 1350 | "Use old style of TLVs with narrow metric\n" |
| 1351 | "Use new style of TLVs to carry wider metric\n") |
| 1352 | { |
| 1353 | struct isis_area *area; |
| 1354 | |
| 1355 | area = vty->index; |
| 1356 | assert (area); |
| 1357 | if (!strcmp(argv[0],"wide")) |
| 1358 | area->newmetric = 1; |
| 1359 | else |
| 1360 | area->newmetric = 0; |
| 1361 | |
| 1362 | return CMD_SUCCESS; |
| 1363 | } |
| 1364 | |
| 1365 | DEFUN (no_metric_style, |
| 1366 | no_metric_style_cmd, |
| 1367 | "no metric-style (narrow|wide)", |
| 1368 | NO_STR |
| 1369 | "Use old-style (ISO 10589) or new-style packet formats\n" |
| 1370 | "Use old style of TLVs with narrow metric\n" |
| 1371 | "Use new style of TLVs to carry wider metric\n") |
| 1372 | { |
| 1373 | struct isis_area *area; |
| 1374 | |
| 1375 | area = vty->index; |
| 1376 | assert (area); |
| 1377 | |
| 1378 | if (!strcmp(argv[0],"wide")) |
| 1379 | area->newmetric = 0; |
| 1380 | else |
| 1381 | area->newmetric = 1; |
| 1382 | |
| 1383 | return CMD_SUCCESS; |
| 1384 | } |
| 1385 | |
| 1386 | DEFUN (dynamic_hostname, |
| 1387 | dynamic_hostname_cmd, |
| 1388 | "hostname dynamic", |
| 1389 | "Dynamic hostname for IS-IS\n" |
| 1390 | "Dynamic hostname\n") |
| 1391 | { |
| 1392 | struct isis_area *area; |
| 1393 | |
| 1394 | area = vty->index; |
| 1395 | assert (area); |
| 1396 | |
| 1397 | area->dynhostname = 1; |
| 1398 | |
| 1399 | return CMD_SUCCESS; |
| 1400 | } |
| 1401 | |
| 1402 | DEFUN (no_dynamic_hostname, |
| 1403 | no_dynamic_hostname_cmd, |
| 1404 | "no hostname dynamic", |
| 1405 | NO_STR |
| 1406 | "Dynamic hostname for IS-IS\n" |
| 1407 | "Dynamic hostname\n") |
| 1408 | { |
| 1409 | struct isis_area *area; |
| 1410 | |
| 1411 | area = vty->index; |
| 1412 | assert (area); |
| 1413 | |
| 1414 | area->dynhostname = 0; |
| 1415 | |
| 1416 | return CMD_SUCCESS; |
| 1417 | } |
| 1418 | |
| 1419 | DEFUN (spf_interval, |
| 1420 | spf_interval_cmd, |
| 1421 | "spf-interval <1-120>", |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 1422 | "Minimum interval between SPF calculations\n" |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1423 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1424 | { |
| 1425 | struct isis_area *area; |
| 1426 | u_int16_t interval; |
| 1427 | |
| 1428 | area = vty->index; |
| 1429 | interval = atoi (argv[0]); |
| 1430 | area->min_spf_interval[0] = interval; |
| 1431 | area->min_spf_interval[1] = interval; |
| 1432 | |
| 1433 | return CMD_SUCCESS; |
| 1434 | } |
| 1435 | |
| 1436 | DEFUN (no_spf_interval, |
| 1437 | no_spf_interval_cmd, |
| 1438 | "no spf-interval", |
| 1439 | NO_STR |
| 1440 | "Minimum interval between SPF calculations\n" |
| 1441 | ) |
| 1442 | { |
| 1443 | struct isis_area *area; |
| 1444 | |
| 1445 | area = vty->index; |
| 1446 | |
| 1447 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 1448 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
| 1449 | |
| 1450 | return CMD_SUCCESS; |
| 1451 | } |
| 1452 | |
| 1453 | ALIAS (no_spf_interval, |
| 1454 | no_spf_interval_arg_cmd, |
| 1455 | "no spf-interval <1-120>", |
| 1456 | NO_STR |
| 1457 | "Minimum interval between SPF calculations\n" |
| 1458 | "Minimum interval between consecutive SPFs in seconds\n" |
| 1459 | ) |
| 1460 | |
| 1461 | DEFUN (spf_interval_l1, |
| 1462 | spf_interval_l1_cmd, |
| 1463 | "spf-interval level-1 <1-120>", |
| 1464 | "Minimum interval between SPF calculations\n" |
| 1465 | "Set interval for level 1 only\n" |
| 1466 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1467 | { |
| 1468 | struct isis_area *area; |
| 1469 | u_int16_t interval; |
| 1470 | |
| 1471 | area = vty->index; |
| 1472 | interval = atoi (argv[0]); |
| 1473 | area->min_spf_interval[0] = interval; |
| 1474 | |
| 1475 | return CMD_SUCCESS; |
| 1476 | } |
| 1477 | |
| 1478 | DEFUN (no_spf_interval_l1, |
| 1479 | no_spf_interval_l1_cmd, |
| 1480 | "no spf-interval level-1", |
| 1481 | NO_STR |
| 1482 | "Minimum interval between SPF calculations\n" |
| 1483 | "Set interval for level 1 only\n") |
| 1484 | { |
| 1485 | struct isis_area *area; |
| 1486 | |
| 1487 | area = vty->index; |
| 1488 | |
| 1489 | area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL; |
| 1490 | |
| 1491 | return CMD_SUCCESS; |
| 1492 | } |
| 1493 | |
| 1494 | ALIAS (no_spf_interval, |
| 1495 | no_spf_interval_l1_arg_cmd, |
| 1496 | "no spf-interval level-1 <1-120>", |
| 1497 | NO_STR |
| 1498 | "Minimum interval between SPF calculations\n" |
| 1499 | "Set interval for level 1 only\n" |
| 1500 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1501 | |
| 1502 | DEFUN (spf_interval_l2, |
| 1503 | spf_interval_l2_cmd, |
| 1504 | "spf-interval level-2 <1-120>", |
| 1505 | "Minimum interval between SPF calculations\n" |
| 1506 | "Set interval for level 2 only\n" |
| 1507 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1508 | { |
| 1509 | struct isis_area *area; |
| 1510 | u_int16_t interval; |
| 1511 | |
| 1512 | area = vty->index; |
| 1513 | interval = atoi (argv[0]); |
| 1514 | area->min_spf_interval[1] = interval; |
| 1515 | |
| 1516 | return CMD_SUCCESS; |
| 1517 | } |
| 1518 | |
| 1519 | DEFUN (no_spf_interval_l2, |
| 1520 | no_spf_interval_l2_cmd, |
| 1521 | "no spf-interval level-2", |
| 1522 | NO_STR |
| 1523 | "Minimum interval between SPF calculations\n" |
| 1524 | "Set interval for level 2 only\n") |
| 1525 | { |
| 1526 | struct isis_area *area; |
| 1527 | |
| 1528 | area = vty->index; |
| 1529 | |
| 1530 | area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL; |
| 1531 | |
| 1532 | return CMD_SUCCESS; |
| 1533 | } |
| 1534 | |
| 1535 | ALIAS (no_spf_interval, |
| 1536 | no_spf_interval_l2_arg_cmd, |
| 1537 | "no spf-interval level-2 <1-120>", |
| 1538 | NO_STR |
| 1539 | "Minimum interval between SPF calculations\n" |
| 1540 | "Set interval for level 2 only\n" |
| 1541 | "Minimum interval between consecutive SPFs in seconds\n") |
| 1542 | |
| 1543 | |
| 1544 | #ifdef TOPOLOGY_GENERATE |
| 1545 | DEFUN (topology_generate_grid, |
| 1546 | topology_generate_grid_cmd, |
| 1547 | "topology generate grid <1-100> <1-100> <1-65000> [param] [param] " |
| 1548 | "[param]", |
| 1549 | "Topology for IS-IS\n" |
| 1550 | "Topology for IS-IS\n" |
| 1551 | "Topology grid for IS-IS\n" |
| 1552 | "X parameter of the grid\n" |
| 1553 | "Y parameter of the grid\n" |
| 1554 | "Random seed\n" |
| 1555 | "Optional param 1\n" |
| 1556 | "Optional param 2\n" |
| 1557 | "Optional param 3\n" |
| 1558 | "Topology\n") |
| 1559 | { |
| 1560 | struct isis_area *area; |
| 1561 | |
| 1562 | area = vty->index; |
| 1563 | assert (area); |
| 1564 | |
| 1565 | if (!spgrid_check_params (vty, argc, argv)) { |
| 1566 | if (area->topology) |
| 1567 | list_delete (area->topology); |
| 1568 | area->topology = list_new(); |
| 1569 | memcpy(area->top_params,vty->buf,200); |
| 1570 | gen_spgrid_topology (vty, area->topology); |
| 1571 | remove_topology_lsps (area); |
| 1572 | generate_topology_lsps (area); |
| 1573 | } |
| 1574 | |
| 1575 | return CMD_SUCCESS; |
| 1576 | } |
| 1577 | |
| 1578 | DEFUN (show_isis_topology, |
| 1579 | show_isis_topology_cmd, |
| 1580 | "show isis topology", |
| 1581 | SHOW_STR |
| 1582 | "clns network information\n" |
| 1583 | "CLNS neighbor adjacencies\n") |
| 1584 | { |
| 1585 | struct isis_area *area; |
| 1586 | struct listnode *node; |
| 1587 | struct listnode *node2; |
| 1588 | struct arc *arc; |
| 1589 | LIST_LOOP (isis->area_list, area, node) { |
| 1590 | if (area->topology) { |
| 1591 | vty_out (vty, "Topology for isis area:%s%s",area->area_tag, VTY_NEWLINE); |
| 1592 | LIST_LOOP (area->topology, arc, node2) { |
| 1593 | vty_out (vty, "a %ld %ld %ld%s",arc->from_node, arc->to_node, |
| 1594 | arc->distance, VTY_NEWLINE); |
| 1595 | } |
| 1596 | } |
| 1597 | } |
| 1598 | return CMD_SUCCESS; |
| 1599 | } |
| 1600 | |
| 1601 | /* |
| 1602 | * 'topology base-is' command |
| 1603 | */ |
| 1604 | DEFUN (topology_baseis , |
| 1605 | topology_baseis_cmd, |
| 1606 | "topology base-is WORD", |
| 1607 | "Topology for IS-IS\n" |
| 1608 | "Topology for IS-IS\n" |
| 1609 | "A Network IS Base for this topology" |
| 1610 | "XX.XXXX.XXXX.XX Network entity title (NET)\n" ) |
| 1611 | { |
| 1612 | struct isis_area *area; |
| 1613 | u_char buff[ISIS_SYS_ID_LEN]; |
| 1614 | |
| 1615 | area = vty->index; |
| 1616 | assert (area); |
| 1617 | |
| 1618 | if (sysid2buff (buff, argv[0])) { |
| 1619 | sysid2buff (area->topology_baseis, argv[0]); |
| 1620 | } |
| 1621 | |
| 1622 | return CMD_SUCCESS; |
| 1623 | } |
| 1624 | |
| 1625 | /* |
| 1626 | * 'no net' command |
| 1627 | */ |
| 1628 | DEFUN (no_topology_baseis, |
| 1629 | no_topology_baseis_cmd, |
| 1630 | "no topology base-is WORD", |
| 1631 | NO_STR |
| 1632 | "A Network Entity Title for this process (OSI only)" |
| 1633 | "XX.XXXX. ... .XXX.XX Network entity title (NET)\n" ) |
| 1634 | { |
| 1635 | struct isis_area *area; |
| 1636 | |
| 1637 | area = vty->index; |
| 1638 | assert (area); |
| 1639 | |
| 1640 | memcpy(area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN); |
| 1641 | return CMD_SUCCESS; |
| 1642 | } |
| 1643 | |
| 1644 | #endif /* TOPOLOGY_GENERATE */ |
| 1645 | |
| 1646 | DEFUN (lsp_lifetime, |
| 1647 | lsp_lifetime_cmd, |
| 1648 | "lsp-lifetime <380-65535>", |
| 1649 | "Maximum LSP lifetime\n" |
| 1650 | "LSP lifetime in seconds\n" |
| 1651 | ) |
| 1652 | { |
| 1653 | struct isis_area *area; |
| 1654 | uint16_t interval; |
| 1655 | |
| 1656 | area = vty->index; |
| 1657 | assert (area); |
| 1658 | |
| 1659 | interval = atoi (argv[0]); |
| 1660 | |
| 1661 | if (interval < ISIS_MIN_LSP_LIFETIME) { |
| 1662 | vty_out (vty, "LSP lifetime (%us) below %us%s", |
| 1663 | interval, |
| 1664 | ISIS_MIN_LSP_LIFETIME, |
| 1665 | VTY_NEWLINE); |
| 1666 | |
| 1667 | return CMD_WARNING; |
| 1668 | } |
| 1669 | |
| 1670 | |
| 1671 | area->max_lsp_lifetime[0] = interval; |
| 1672 | area->max_lsp_lifetime[1] = interval; |
| 1673 | area->lsp_refresh[0] = interval-300; |
| 1674 | area->lsp_refresh[1] = interval-300; |
| 1675 | |
| 1676 | if (area->t_lsp_refresh[0]) { |
| 1677 | thread_cancel (area->t_lsp_refresh[0]); |
| 1678 | thread_execute (master, lsp_refresh_l1, area, 0); |
| 1679 | } |
| 1680 | |
| 1681 | if (area->t_lsp_refresh[1]) { |
| 1682 | thread_cancel (area->t_lsp_refresh[1]); |
| 1683 | thread_execute (master, lsp_refresh_l2, area, 0); |
| 1684 | } |
| 1685 | |
| 1686 | |
| 1687 | return CMD_SUCCESS; |
| 1688 | } |
| 1689 | |
| 1690 | DEFUN (no_lsp_lifetime, |
| 1691 | no_lsp_lifetime_cmd, |
| 1692 | "no lsp-lifetime", |
| 1693 | NO_STR |
| 1694 | "LSP lifetime in seconds\n" |
| 1695 | ) |
| 1696 | { |
| 1697 | struct isis_area *area; |
| 1698 | |
| 1699 | area = vty->index; |
| 1700 | assert (area); |
| 1701 | |
| 1702 | area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */ |
| 1703 | area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */ |
| 1704 | area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
| 1705 | area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
| 1706 | |
| 1707 | return CMD_SUCCESS; |
| 1708 | } |
| 1709 | |
| 1710 | ALIAS (no_lsp_lifetime, |
| 1711 | no_lsp_lifetime_arg_cmd, |
| 1712 | "no lsp-lifetime <380-65535>", |
| 1713 | NO_STR |
| 1714 | "Maximum LSP lifetime\n" |
| 1715 | "LSP lifetime in seconds\n" |
| 1716 | ) |
| 1717 | |
| 1718 | DEFUN (lsp_lifetime_l1, |
| 1719 | lsp_lifetime_l1_cmd, |
| 1720 | "lsp-lifetime level-1 <380-65535>", |
| 1721 | "Maximum LSP lifetime for Level 1 only\n" |
| 1722 | "LSP lifetime for Level 1 only in seconds\n" |
| 1723 | ) |
| 1724 | { |
| 1725 | struct isis_area *area; |
| 1726 | uint16_t interval; |
| 1727 | |
| 1728 | area = vty->index; |
| 1729 | assert (area); |
| 1730 | |
| 1731 | interval = atoi (argv[0]); |
| 1732 | |
| 1733 | if (interval < ISIS_MIN_LSP_LIFETIME) { |
| 1734 | vty_out (vty, "Level-1 LSP lifetime (%us) below %us%s", |
| 1735 | interval, |
| 1736 | ISIS_MIN_LSP_LIFETIME, |
| 1737 | VTY_NEWLINE); |
| 1738 | |
| 1739 | return CMD_WARNING; |
| 1740 | } |
| 1741 | |
| 1742 | |
| 1743 | area->max_lsp_lifetime[0] = interval; |
| 1744 | area->lsp_refresh[0] = interval-300; |
| 1745 | |
| 1746 | return CMD_SUCCESS; |
| 1747 | } |
| 1748 | |
| 1749 | DEFUN (no_lsp_lifetime_l1, |
| 1750 | no_lsp_lifetime_l1_cmd, |
| 1751 | "no lsp-lifetime level-1", |
| 1752 | NO_STR |
| 1753 | "LSP lifetime for Level 1 only in seconds\n" |
| 1754 | ) |
| 1755 | { |
| 1756 | struct isis_area *area; |
| 1757 | |
| 1758 | area = vty->index; |
| 1759 | assert (area); |
| 1760 | |
| 1761 | area->max_lsp_lifetime[0] = MAX_AGE; /* 1200s */ |
| 1762 | area->lsp_refresh[0] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
| 1763 | |
| 1764 | return CMD_SUCCESS; |
| 1765 | } |
| 1766 | |
| 1767 | ALIAS (no_lsp_lifetime_l1, |
| 1768 | no_lsp_lifetime_l1_arg_cmd, |
| 1769 | "no lsp-lifetime level-1 <380-65535>", |
| 1770 | NO_STR |
| 1771 | "Maximum LSP lifetime for Level 1 only\n" |
| 1772 | "LSP lifetime for Level 1 only in seconds\n" |
| 1773 | ) |
| 1774 | |
| 1775 | DEFUN (lsp_lifetime_l2, |
| 1776 | lsp_lifetime_l2_cmd, |
| 1777 | "lsp-lifetime level-2 <380-65535>", |
| 1778 | "Maximum LSP lifetime for Level 2 only\n" |
| 1779 | "LSP lifetime for Level 2 only in seconds\n" |
| 1780 | ) |
| 1781 | { |
| 1782 | struct isis_area *area; |
| 1783 | uint16_t interval; |
| 1784 | |
| 1785 | area = vty->index; |
| 1786 | assert (area); |
| 1787 | |
| 1788 | interval = atoi (argv[0]); |
| 1789 | |
| 1790 | if (interval < ISIS_MIN_LSP_LIFETIME) { |
| 1791 | vty_out (vty, "Level-2 LSP lifetime (%us) below %us%s", |
| 1792 | interval, |
| 1793 | ISIS_MIN_LSP_LIFETIME, |
| 1794 | VTY_NEWLINE); |
| 1795 | |
| 1796 | return CMD_WARNING; |
| 1797 | } |
| 1798 | |
| 1799 | |
| 1800 | area->max_lsp_lifetime[1] = interval; |
| 1801 | area->lsp_refresh[1] = interval - 300; |
| 1802 | |
| 1803 | return CMD_SUCCESS; |
| 1804 | } |
| 1805 | |
| 1806 | DEFUN (no_lsp_lifetime_l2, |
| 1807 | no_lsp_lifetime_l2_cmd, |
| 1808 | "no lsp-lifetime level-2", |
| 1809 | NO_STR |
| 1810 | "LSP lifetime for Level 2 only in seconds\n" |
| 1811 | ) |
| 1812 | { |
| 1813 | struct isis_area *area; |
| 1814 | |
| 1815 | area = vty->index; |
| 1816 | assert (area); |
| 1817 | |
| 1818 | area->max_lsp_lifetime[1] = MAX_AGE; /* 1200s */ |
| 1819 | area->lsp_refresh[1] = MAX_LSP_GEN_INTERVAL; /* 900s */ |
| 1820 | |
| 1821 | return CMD_SUCCESS; |
| 1822 | } |
| 1823 | |
| 1824 | ALIAS (no_lsp_lifetime_l2, |
| 1825 | no_lsp_lifetime_l2_arg_cmd, |
| 1826 | "no lsp-lifetime level-2 <380-65535>", |
| 1827 | NO_STR |
| 1828 | "Maximum LSP lifetime for Level 2 only\n" |
| 1829 | "LSP lifetime for Level 2 only in seconds\n" |
| 1830 | ) |
| 1831 | |
| 1832 | |
| 1833 | |
| 1834 | |
| 1835 | /* IS-IS configuration write function */ |
| 1836 | int |
| 1837 | isis_config_write (struct vty *vty) |
| 1838 | { |
| 1839 | int write = 0; |
| 1840 | |
| 1841 | if (isis != NULL) { |
| 1842 | struct isis_area *area; |
| 1843 | struct listnode *node; |
| 1844 | struct listnode *node2; |
| 1845 | |
| 1846 | LIST_LOOP (isis->area_list, area, node) { |
| 1847 | /* ISIS - Area name */ |
| 1848 | vty_out (vty, "router isis %s%s",area->area_tag, VTY_NEWLINE); |
| 1849 | write++; |
| 1850 | /* ISIS - Net */ |
| 1851 | if (listcount (area->area_addrs) > 0) { |
| 1852 | struct area_addr *area_addr; |
| 1853 | LIST_LOOP (area->area_addrs, area_addr, node2) { |
| 1854 | vty_out (vty, " net %s%s", |
| 1855 | isonet_print (area_addr->area_addr, |
| 1856 | area_addr->addr_len + ISIS_SYS_ID_LEN + 1), |
| 1857 | VTY_NEWLINE); |
| 1858 | write ++; |
| 1859 | } |
| 1860 | } |
| 1861 | /* ISIS - Dynamic hostname - Defaults to true so only display if false*/ |
| 1862 | if (!area->dynhostname) { |
| 1863 | vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE); |
| 1864 | write ++; |
| 1865 | } |
| 1866 | /* ISIS - Metric-Style - when true displays wide */ |
| 1867 | if (area->newmetric) { |
| 1868 | vty_out (vty, " metric-style wide%s", VTY_NEWLINE); |
| 1869 | write ++; |
| 1870 | } |
| 1871 | /* ISIS - Area is-type (level-1-2 is default) */ |
| 1872 | if (area->is_type == IS_LEVEL_1) { |
| 1873 | vty_out (vty, " is-type level-1%s", VTY_NEWLINE); |
| 1874 | write ++; |
| 1875 | } else {if (area->is_type == IS_LEVEL_2) { |
| 1876 | vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE); |
| 1877 | write ++; |
| 1878 | }} |
| 1879 | /* ISIS - Lsp generation interval */ |
| 1880 | if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1]) { |
| 1881 | if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT) { |
| 1882 | vty_out (vty, " lsp-gen-interval %d%s", area->lsp_gen_interval[0], |
| 1883 | VTY_NEWLINE); |
| 1884 | write ++; |
| 1885 | }} else { |
| 1886 | if (area->lsp_gen_interval[0] != LSP_GEN_INTERVAL_DEFAULT) { |
| 1887 | vty_out (vty, " lsp-gen-interval level-1 %d%s", |
| 1888 | area->lsp_gen_interval[0], VTY_NEWLINE); |
| 1889 | write ++; |
| 1890 | } |
| 1891 | if (area->lsp_gen_interval[1] != LSP_GEN_INTERVAL_DEFAULT) { |
| 1892 | vty_out (vty, " lsp-gen-interval level-2 %d%s", |
| 1893 | area->lsp_gen_interval[1], VTY_NEWLINE); |
| 1894 | write ++; |
| 1895 | } |
| 1896 | } |
| 1897 | /* ISIS - LSP lifetime */ |
| 1898 | if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1]) { |
| 1899 | if (area->max_lsp_lifetime[0] != MAX_AGE) { |
| 1900 | vty_out (vty, " lsp-lifetime %u%s", area->max_lsp_lifetime[0], |
| 1901 | VTY_NEWLINE); |
| 1902 | write ++; |
| 1903 | }} else { |
| 1904 | if (area->max_lsp_lifetime[0] != MAX_AGE) { |
| 1905 | vty_out (vty, " lsp-lifetime level-1 %u%s", area->max_lsp_lifetime[0], |
| 1906 | VTY_NEWLINE); |
| 1907 | write ++; |
| 1908 | } |
| 1909 | if (area->max_lsp_lifetime[1] != MAX_AGE) { |
| 1910 | vty_out (vty, " lsp-lifetime level-2 %u%s", area->max_lsp_lifetime[1], |
| 1911 | VTY_NEWLINE); |
| 1912 | write ++; |
| 1913 | } |
| 1914 | } |
| 1915 | #ifdef TOPOLOGY_GENERATE |
| 1916 | /* seems we save the whole command line here */ |
| 1917 | if (area->top_params) { |
| 1918 | vty_out (vty, " %s%s",area->top_params, VTY_NEWLINE); |
| 1919 | write ++; |
| 1920 | } |
| 1921 | |
| 1922 | if (memcmp(area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, |
| 1923 | ISIS_SYS_ID_LEN)) { |
| 1924 | vty_out (vty, " topology base_is %s%s", |
| 1925 | sysid_print (area->topology_baseis), VTY_NEWLINE); |
| 1926 | write ++; |
| 1927 | } |
| 1928 | |
| 1929 | #endif /* TOPOLOGY_GENERATE */ |
| 1930 | } |
| 1931 | } |
| 1932 | |
| 1933 | return write; |
| 1934 | } |
| 1935 | |
| 1936 | struct cmd_node isis_node = |
| 1937 | { |
| 1938 | ISIS_NODE, |
hasso | 2097cd8 | 2003-12-23 11:51:08 +0000 | [diff] [blame] | 1939 | "%s(config-router)# ", |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1940 | 1 |
| 1941 | }; |
| 1942 | |
| 1943 | void |
| 1944 | isis_init () |
| 1945 | { |
| 1946 | |
| 1947 | /* Install IS-IS top node */ |
| 1948 | install_node (&isis_node, isis_config_write); |
| 1949 | |
| 1950 | install_element (VIEW_NODE, &show_clns_neighbors_cmd); |
| 1951 | install_element (VIEW_NODE, &show_isis_neighbors_cmd); |
| 1952 | install_element (VIEW_NODE, &show_clns_neighbors_detail_cmd); |
| 1953 | install_element (VIEW_NODE, &show_isis_neighbors_detail_cmd); |
| 1954 | |
| 1955 | install_element (VIEW_NODE, &show_hostname_cmd); |
| 1956 | install_element (VIEW_NODE, &show_database_cmd); |
| 1957 | install_element (VIEW_NODE, &show_database_detail_cmd); |
| 1958 | |
| 1959 | install_element (ENABLE_NODE, &show_clns_neighbors_cmd); |
| 1960 | install_element (ENABLE_NODE, &show_isis_neighbors_cmd); |
| 1961 | install_element (ENABLE_NODE, &show_clns_neighbors_detail_cmd); |
| 1962 | install_element (ENABLE_NODE, &show_isis_neighbors_detail_cmd); |
| 1963 | |
| 1964 | install_element (ENABLE_NODE, &show_hostname_cmd); |
| 1965 | install_element (ENABLE_NODE, &show_database_cmd); |
| 1966 | install_element (ENABLE_NODE, &show_database_detail_cmd); |
| 1967 | install_element (ENABLE_NODE, &show_debugging_cmd); |
| 1968 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 1969 | install_node(&debug_node, config_write_debug); |
| 1970 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 1971 | install_element (ENABLE_NODE, &debug_isis_adj_cmd); |
| 1972 | install_element (ENABLE_NODE, &no_debug_isis_adj_cmd); |
| 1973 | install_element (ENABLE_NODE, &debug_isis_csum_cmd); |
| 1974 | install_element (ENABLE_NODE, &no_debug_isis_csum_cmd); |
| 1975 | install_element (ENABLE_NODE, &debug_isis_lupd_cmd); |
| 1976 | install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd); |
| 1977 | install_element (ENABLE_NODE, &debug_isis_err_cmd); |
| 1978 | install_element (ENABLE_NODE, &no_debug_isis_err_cmd); |
| 1979 | install_element (ENABLE_NODE, &debug_isis_snp_cmd); |
| 1980 | install_element (ENABLE_NODE, &no_debug_isis_snp_cmd); |
| 1981 | install_element (ENABLE_NODE, &debug_isis_upd_cmd); |
| 1982 | install_element (ENABLE_NODE, &no_debug_isis_upd_cmd); |
| 1983 | install_element (ENABLE_NODE, &debug_isis_spfevents_cmd); |
| 1984 | install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd); |
| 1985 | install_element (ENABLE_NODE, &debug_isis_spfstats_cmd); |
| 1986 | install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd); |
| 1987 | install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd); |
| 1988 | install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd); |
| 1989 | install_element (ENABLE_NODE, &debug_isis_rtevents_cmd); |
| 1990 | install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd); |
| 1991 | install_element (ENABLE_NODE, &debug_isis_events_cmd); |
| 1992 | install_element (ENABLE_NODE, &no_debug_isis_events_cmd); |
| 1993 | |
jardin | 9e867fe | 2003-12-23 08:56:18 +0000 | [diff] [blame] | 1994 | install_element (CONFIG_NODE, &debug_isis_adj_cmd); |
| 1995 | install_element (CONFIG_NODE, &no_debug_isis_adj_cmd); |
| 1996 | install_element (CONFIG_NODE, &debug_isis_csum_cmd); |
| 1997 | install_element (CONFIG_NODE, &no_debug_isis_csum_cmd); |
| 1998 | install_element (CONFIG_NODE, &debug_isis_lupd_cmd); |
| 1999 | install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd); |
| 2000 | install_element (CONFIG_NODE, &debug_isis_err_cmd); |
| 2001 | install_element (CONFIG_NODE, &no_debug_isis_err_cmd); |
| 2002 | install_element (CONFIG_NODE, &debug_isis_snp_cmd); |
| 2003 | install_element (CONFIG_NODE, &no_debug_isis_snp_cmd); |
| 2004 | install_element (CONFIG_NODE, &debug_isis_upd_cmd); |
| 2005 | install_element (CONFIG_NODE, &no_debug_isis_upd_cmd); |
| 2006 | install_element (CONFIG_NODE, &debug_isis_spfevents_cmd); |
| 2007 | install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd); |
| 2008 | install_element (CONFIG_NODE, &debug_isis_spfstats_cmd); |
| 2009 | install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd); |
| 2010 | install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd); |
| 2011 | install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd); |
| 2012 | install_element (CONFIG_NODE, &debug_isis_rtevents_cmd); |
| 2013 | install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd); |
| 2014 | install_element (CONFIG_NODE, &debug_isis_events_cmd); |
| 2015 | install_element (CONFIG_NODE, &no_debug_isis_events_cmd); |
| 2016 | |
jardin | eb5d44e | 2003-12-23 08:09:43 +0000 | [diff] [blame] | 2017 | install_element (CONFIG_NODE, &router_isis_cmd); |
| 2018 | install_element (CONFIG_NODE, &no_router_isis_cmd); |
| 2019 | |
| 2020 | install_default (ISIS_NODE); |
| 2021 | |
| 2022 | install_element (ISIS_NODE, &net_cmd); |
| 2023 | install_element (ISIS_NODE, &no_net_cmd); |
| 2024 | |
| 2025 | install_element (ISIS_NODE, &is_type_cmd); |
| 2026 | install_element (ISIS_NODE, &no_is_type_cmd); |
| 2027 | |
| 2028 | install_element (ISIS_NODE, &area_passwd_cmd); |
| 2029 | install_element (ISIS_NODE, &no_area_passwd_cmd); |
| 2030 | |
| 2031 | install_element (ISIS_NODE, &domain_passwd_cmd); |
| 2032 | install_element (ISIS_NODE, &no_domain_passwd_cmd); |
| 2033 | |
| 2034 | install_element (ISIS_NODE, &lsp_gen_interval_cmd); |
| 2035 | install_element (ISIS_NODE, &no_lsp_gen_interval_cmd); |
| 2036 | install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd); |
| 2037 | install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd); |
| 2038 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd); |
| 2039 | install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd); |
| 2040 | install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd); |
| 2041 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd); |
| 2042 | install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd); |
| 2043 | |
| 2044 | install_element (ISIS_NODE, &spf_interval_cmd); |
| 2045 | install_element (ISIS_NODE, &no_spf_interval_cmd); |
| 2046 | install_element (ISIS_NODE, &no_spf_interval_arg_cmd); |
| 2047 | install_element (ISIS_NODE, &spf_interval_l1_cmd); |
| 2048 | install_element (ISIS_NODE, &no_spf_interval_l1_cmd); |
| 2049 | install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd); |
| 2050 | install_element (ISIS_NODE, &spf_interval_l2_cmd); |
| 2051 | install_element (ISIS_NODE, &no_spf_interval_l2_cmd); |
| 2052 | install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd); |
| 2053 | |
| 2054 | install_element (ISIS_NODE, &lsp_lifetime_cmd); |
| 2055 | install_element (ISIS_NODE, &no_lsp_lifetime_cmd); |
| 2056 | install_element (ISIS_NODE, &no_lsp_lifetime_arg_cmd); |
| 2057 | install_element (ISIS_NODE, &lsp_lifetime_l1_cmd); |
| 2058 | install_element (ISIS_NODE, &no_lsp_lifetime_l1_cmd); |
| 2059 | install_element (ISIS_NODE, &no_lsp_lifetime_l1_arg_cmd); |
| 2060 | install_element (ISIS_NODE, &lsp_lifetime_l2_cmd); |
| 2061 | install_element (ISIS_NODE, &no_lsp_lifetime_l2_cmd); |
| 2062 | install_element (ISIS_NODE, &no_lsp_lifetime_l2_arg_cmd); |
| 2063 | |
| 2064 | install_element (ISIS_NODE, &dynamic_hostname_cmd); |
| 2065 | install_element (ISIS_NODE, &no_dynamic_hostname_cmd); |
| 2066 | |
| 2067 | install_element (ISIS_NODE, &metric_style_cmd); |
| 2068 | install_element (ISIS_NODE, &no_metric_style_cmd); |
| 2069 | #ifdef TOPOLOGY_GENERATE |
| 2070 | install_element (ISIS_NODE, &topology_generate_grid_cmd); |
| 2071 | install_element (ISIS_NODE, &topology_baseis_cmd); |
| 2072 | install_element (ISIS_NODE, &no_topology_baseis_cmd); |
| 2073 | install_element (VIEW_NODE, &show_isis_topology_cmd); |
| 2074 | install_element (ENABLE_NODE, &show_isis_topology_cmd); |
| 2075 | #endif /* TOPOLOGY_GENERATE */ |
| 2076 | |
| 2077 | isis_new(0); |
| 2078 | isis_circuit_init (); |
| 2079 | isis_zebra_init (); |
| 2080 | isis_spf_cmds_init (); |
| 2081 | } |
| 2082 | |
| 2083 | |
| 2084 | |
| 2085 | |
| 2086 | |
| 2087 | |