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