]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isisd.c
isisd: Attached-bit in LSP header
[mirror_frr.git] / isisd / isisd.c
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 <zebra.h>
24
25 #include "thread.h"
26 #include "vty.h"
27 #include "command.h"
28 #include "log.h"
29 #include "memory.h"
30 #include "time.h"
31 #include "linklist.h"
32 #include "if.h"
33 #include "hash.h"
34 #include "stream.h"
35 #include "prefix.h"
36 #include "table.h"
37
38 #include "isisd/dict.h"
39 #include "isisd/include-netbsd/iso.h"
40 #include "isisd/isis_constants.h"
41 #include "isisd/isis_common.h"
42 #include "isisd/isis_flags.h"
43 #include "isisd/isis_circuit.h"
44 #include "isisd/isis_csm.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 struct isis *isis = NULL;
64
65 /*
66 * Prototypes.
67 */
68 int isis_area_get(struct vty *, const char *);
69 int isis_area_destroy(struct vty *, const char *);
70 int area_net_title(struct vty *, const char *);
71 int area_clear_net_title(struct vty *, const char *);
72 int show_isis_interface_common(struct vty *, const char *ifname, char);
73 int show_isis_neighbor_common(struct vty *, const char *id, char);
74 int clear_isis_neighbor_common(struct vty *, const char *id);
75 int isis_config_write(struct vty *);
76
77
78
79 void
80 isis_new (unsigned long process_id)
81 {
82 isis = XCALLOC (MTYPE_ISIS, sizeof (struct isis));
83 /*
84 * Default values
85 */
86 isis->max_area_addrs = 3;
87 isis->process_id = process_id;
88 isis->router_id = 0;
89 isis->area_list = list_new ();
90 isis->init_circ_list = list_new ();
91 isis->uptime = time (NULL);
92 isis->nexthops = list_new ();
93 #ifdef HAVE_IPV6
94 isis->nexthops6 = list_new ();
95 #endif /* HAVE_IPV6 */
96 dyn_cache_init ();
97 /*
98 * uncomment the next line for full debugs
99 */
100 /* isis->debugs = 0xFFFF; */
101 }
102
103 struct isis_area *
104 isis_area_create (const char *area_tag)
105 {
106 struct isis_area *area;
107
108 area = XCALLOC (MTYPE_ISIS_AREA, sizeof (struct isis_area));
109
110 /*
111 * The first instance is level-1-2 rest are level-1, unless otherwise
112 * configured
113 */
114 if (listcount (isis->area_list) > 0)
115 area->is_type = IS_LEVEL_1;
116 else
117 area->is_type = IS_LEVEL_1_AND_2;
118
119 /*
120 * intialize the databases
121 */
122 if (area->is_type & IS_LEVEL_1)
123 {
124 area->lspdb[0] = lsp_db_init ();
125 area->route_table[0] = route_table_init ();
126 #ifdef HAVE_IPV6
127 area->route_table6[0] = route_table_init ();
128 #endif /* HAVE_IPV6 */
129 }
130 if (area->is_type & IS_LEVEL_2)
131 {
132 area->lspdb[1] = lsp_db_init ();
133 area->route_table[1] = route_table_init ();
134 #ifdef HAVE_IPV6
135 area->route_table6[1] = route_table_init ();
136 #endif /* HAVE_IPV6 */
137 }
138
139 spftree_area_init (area);
140
141 area->circuit_list = list_new ();
142 area->area_addrs = list_new ();
143 THREAD_TIMER_ON (master, area->t_tick, lsp_tick, area, 1);
144 flags_initialize (&area->flags);
145
146 /*
147 * Default values
148 */
149 area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
150 area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
151 area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
152 area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
153 area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
154 area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
155 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
156 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
157 area->dynhostname = 1;
158 area->oldmetric = 0;
159 area->newmetric = 1;
160 area->lsp_frag_threshold = 90;
161 #ifdef TOPOLOGY_GENERATE
162 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
163 #endif /* TOPOLOGY_GENERATE */
164
165 /* FIXME: Think of a better way... */
166 area->min_bcast_mtu = 1497;
167
168 area->area_tag = strdup (area_tag);
169 listnode_add (isis->area_list, area);
170 area->isis = isis;
171
172 return area;
173 }
174
175 struct isis_area *
176 isis_area_lookup (const char *area_tag)
177 {
178 struct isis_area *area;
179 struct listnode *node;
180
181 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
182 if ((area->area_tag == NULL && area_tag == NULL) ||
183 (area->area_tag && area_tag
184 && strcmp (area->area_tag, area_tag) == 0))
185 return area;
186
187 return NULL;
188 }
189
190 int
191 isis_area_get (struct vty *vty, const char *area_tag)
192 {
193 struct isis_area *area;
194
195 area = isis_area_lookup (area_tag);
196
197 if (area)
198 {
199 vty->node = ISIS_NODE;
200 vty->index = area;
201 return CMD_SUCCESS;
202 }
203
204 area = isis_area_create (area_tag);
205
206 if (isis->debugs & DEBUG_EVENTS)
207 zlog_debug ("New IS-IS area instance %s", area->area_tag);
208
209 vty->node = ISIS_NODE;
210 vty->index = area;
211
212 return CMD_SUCCESS;
213 }
214
215 int
216 isis_area_destroy (struct vty *vty, const char *area_tag)
217 {
218 struct isis_area *area;
219 struct listnode *node, *nnode;
220 struct isis_circuit *circuit;
221 struct area_addr *addr;
222
223 area = isis_area_lookup (area_tag);
224
225 if (area == NULL)
226 {
227 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
228 return CMD_ERR_NO_MATCH;
229 }
230
231 if (area->circuit_list)
232 {
233 for (ALL_LIST_ELEMENTS (area->circuit_list, node, nnode, circuit))
234 {
235 circuit->ip_router = 0;
236 #ifdef HAVE_IPV6
237 circuit->ipv6_router = 0;
238 #endif
239 isis_csm_state_change (ISIS_DISABLE, circuit, area);
240 }
241 list_delete (area->circuit_list);
242 area->circuit_list = NULL;
243 }
244
245 if (area->lspdb[0] != NULL)
246 {
247 lsp_db_destroy (area->lspdb[0]);
248 area->lspdb[0] = NULL;
249 }
250 if (area->lspdb[1] != NULL)
251 {
252 lsp_db_destroy (area->lspdb[1]);
253 area->lspdb[1] = NULL;
254 }
255
256 spftree_area_del (area);
257
258 /* invalidate and validate would delete all routes from zebra */
259 isis_route_invalidate (area);
260 isis_route_validate (area);
261
262 if (area->route_table[0])
263 {
264 route_table_finish (area->route_table[0]);
265 area->route_table[0] = NULL;
266 }
267 if (area->route_table[1])
268 {
269 route_table_finish (area->route_table[1]);
270 area->route_table[1] = NULL;
271 }
272 #ifdef HAVE_IPV6
273 if (area->route_table6[0])
274 {
275 route_table_finish (area->route_table6[0]);
276 area->route_table6[0] = NULL;
277 }
278 if (area->route_table6[1])
279 {
280 route_table_finish (area->route_table6[1]);
281 area->route_table6[1] = NULL;
282 }
283 #endif /* HAVE_IPV6 */
284
285 for (ALL_LIST_ELEMENTS (area->area_addrs, node, nnode, addr))
286 {
287 list_delete_node (area->area_addrs, node);
288 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
289 }
290 area->area_addrs = NULL;
291
292 THREAD_TIMER_OFF (area->t_tick);
293 THREAD_TIMER_OFF (area->t_lsp_refresh[0]);
294 THREAD_TIMER_OFF (area->t_lsp_refresh[1]);
295
296 thread_cancel_event (master, area);
297
298 listnode_delete (isis->area_list, area);
299
300 free (area->area_tag);
301
302 XFREE (MTYPE_ISIS_AREA, area);
303
304 if (listcount (isis->area_list) == 0)
305 {
306 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
307 isis->sysid_set = 0;
308 }
309
310 return CMD_SUCCESS;
311 }
312
313 int
314 area_net_title (struct vty *vty, const char *net_title)
315 {
316 struct isis_area *area;
317 struct area_addr *addr;
318 struct area_addr *addrp;
319 struct listnode *node;
320
321 u_char buff[255];
322 area = vty->index;
323
324 if (!area)
325 {
326 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
327 return CMD_ERR_NO_MATCH;
328 }
329
330 /* We check that we are not over the maximal number of addresses */
331 if (listcount (area->area_addrs) >= isis->max_area_addrs)
332 {
333 vty_out (vty, "Maximum of area addresses (%d) already reached %s",
334 isis->max_area_addrs, VTY_NEWLINE);
335 return CMD_ERR_NOTHING_TODO;
336 }
337
338 addr = XMALLOC (MTYPE_ISIS_AREA_ADDR, sizeof (struct area_addr));
339 addr->addr_len = dotformat2buff (buff, net_title);
340 memcpy (addr->area_addr, buff, addr->addr_len);
341 #ifdef EXTREME_DEBUG
342 zlog_debug ("added area address %s for area %s (address length %d)",
343 net_title, area->area_tag, addr->addr_len);
344 #endif /* EXTREME_DEBUG */
345 if (addr->addr_len < 8 || addr->addr_len > 20)
346 {
347 vty_out (vty, "area address must be at least 8..20 octets long (%d)%s",
348 addr->addr_len, VTY_NEWLINE);
349 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
350 return CMD_ERR_AMBIGUOUS;
351 }
352
353 if (addr->area_addr[addr->addr_len-1] != 0)
354 {
355 vty_out (vty, "nsel byte (last byte) in area address must be 0%s",
356 VTY_NEWLINE);
357 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
358 return CMD_ERR_AMBIGUOUS;
359 }
360
361 if (isis->sysid_set == 0)
362 {
363 /*
364 * First area address - get the SystemID for this router
365 */
366 memcpy (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN);
367 isis->sysid_set = 1;
368 if (isis->debugs & DEBUG_EVENTS)
369 zlog_debug ("Router has SystemID %s", sysid_print (isis->sysid));
370 }
371 else
372 {
373 /*
374 * Check that the SystemID portions match
375 */
376 if (memcmp (isis->sysid, GETSYSID (addr), ISIS_SYS_ID_LEN))
377 {
378 vty_out (vty,
379 "System ID must not change when defining additional area"
380 " addresses%s", VTY_NEWLINE);
381 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
382 return CMD_ERR_AMBIGUOUS;
383 }
384
385 /* now we see that we don't already have this address */
386 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
387 {
388 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN) != (addr->addr_len))
389 continue;
390 if (!memcmp (addrp->area_addr, addr->area_addr, addr->addr_len))
391 {
392 XFREE (MTYPE_ISIS_AREA_ADDR, addr);
393 return CMD_SUCCESS; /* silent fail */
394 }
395 }
396 }
397
398 /*
399 * Forget the systemID part of the address
400 */
401 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
402 listnode_add (area->area_addrs, addr);
403
404 /* only now we can safely generate our LSPs for this area */
405 if (listcount (area->area_addrs) > 0)
406 {
407 if (area->is_type & IS_LEVEL_1)
408 lsp_generate (area, IS_LEVEL_1);
409 if (area->is_type & IS_LEVEL_2)
410 lsp_generate (area, IS_LEVEL_2);
411 }
412
413 return CMD_SUCCESS;
414 }
415
416 int
417 area_clear_net_title (struct vty *vty, const char *net_title)
418 {
419 struct isis_area *area;
420 struct area_addr addr, *addrp = NULL;
421 struct listnode *node;
422 u_char buff[255];
423
424 area = vty->index;
425 if (!area)
426 {
427 vty_out (vty, "Can't find ISIS instance %s", VTY_NEWLINE);
428 return CMD_ERR_NO_MATCH;
429 }
430
431 addr.addr_len = dotformat2buff (buff, net_title);
432 if (addr.addr_len < 8 || addr.addr_len > 20)
433 {
434 vty_out (vty, "Unsupported area address length %d, should be 8...20 %s",
435 addr.addr_len, VTY_NEWLINE);
436 return CMD_ERR_AMBIGUOUS;
437 }
438
439 memcpy (addr.area_addr, buff, (int) addr.addr_len);
440
441 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node, addrp))
442 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len &&
443 !memcmp (addrp->area_addr, addr.area_addr, addr.addr_len))
444 break;
445
446 if (!addrp)
447 {
448 vty_out (vty, "No area address %s for area %s %s", net_title,
449 area->area_tag, VTY_NEWLINE);
450 return CMD_ERR_NO_MATCH;
451 }
452
453 listnode_delete (area->area_addrs, addrp);
454 XFREE (MTYPE_ISIS_AREA_ADDR, addrp);
455
456 /*
457 * Last area address - reset the SystemID for this router
458 */
459 if (listcount (area->area_addrs) == 0)
460 {
461 memset (isis->sysid, 0, ISIS_SYS_ID_LEN);
462 isis->sysid_set = 0;
463 if (isis->debugs & DEBUG_EVENTS)
464 zlog_debug ("Router has no SystemID");
465 }
466
467 return CMD_SUCCESS;
468 }
469
470 /*
471 * 'show isis interface' command
472 */
473
474 int
475 show_isis_interface_common (struct vty *vty, const char *ifname, char detail)
476 {
477 struct listnode *anode, *cnode;
478 struct isis_area *area;
479 struct isis_circuit *circuit;
480
481 if (!isis)
482 {
483 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
484 return CMD_SUCCESS;
485 }
486
487 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
488 {
489 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
490
491 if (detail == ISIS_UI_LEVEL_BRIEF)
492 vty_out (vty, " Interface CircId State Type Level%s",
493 VTY_NEWLINE);
494
495 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
496 if (!ifname)
497 isis_circuit_print_vty (circuit, vty, detail);
498 else if (strcmp(circuit->interface->name, ifname) == 0)
499 isis_circuit_print_vty (circuit, vty, detail);
500 }
501
502 return CMD_SUCCESS;
503 }
504
505 DEFUN (show_isis_interface,
506 show_isis_interface_cmd,
507 "show isis interface",
508 SHOW_STR
509 "ISIS network information\n"
510 "ISIS interface\n")
511 {
512 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
513 }
514
515 DEFUN (show_isis_interface_detail,
516 show_isis_interface_detail_cmd,
517 "show isis interface detail",
518 SHOW_STR
519 "ISIS network information\n"
520 "ISIS interface\n"
521 "show detailed information\n")
522 {
523 return show_isis_interface_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
524 }
525
526 DEFUN (show_isis_interface_arg,
527 show_isis_interface_arg_cmd,
528 "show isis interface WORD",
529 SHOW_STR
530 "ISIS network information\n"
531 "ISIS interface\n"
532 "ISIS interface name\n")
533 {
534 return show_isis_interface_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
535 }
536
537 /*
538 * 'show isis neighbor' command
539 */
540
541 int
542 show_isis_neighbor_common (struct vty *vty, const char *id, char detail)
543 {
544 struct listnode *anode, *cnode, *node;
545 struct isis_area *area;
546 struct isis_circuit *circuit;
547 struct list *adjdb;
548 struct isis_adjacency *adj;
549 struct isis_dynhn *dynhn;
550 u_char sysid[ISIS_SYS_ID_LEN];
551 int i;
552
553 if (!isis)
554 {
555 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
556 return CMD_SUCCESS;
557 }
558
559 memset (sysid, 0, ISIS_SYS_ID_LEN);
560 if (id)
561 {
562 if (sysid2buff (sysid, id) == 0)
563 {
564 dynhn = dynhn_find_by_name (id);
565 if (dynhn == NULL)
566 {
567 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
568 return CMD_SUCCESS;
569 }
570 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
571 }
572 }
573
574 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
575 {
576 vty_out (vty, "Area %s:%s", area->area_tag, VTY_NEWLINE);
577
578 if (detail == ISIS_UI_LEVEL_BRIEF)
579 vty_out (vty, " System Id Interface L State"
580 " Holdtime SNPA%s", VTY_NEWLINE);
581
582 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, cnode, circuit))
583 {
584 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
585 {
586 for (i = 0; i < 2; i++)
587 {
588 adjdb = circuit->u.bc.adjdb[i];
589 if (adjdb && adjdb->count)
590 {
591 for (ALL_LIST_ELEMENTS_RO (adjdb, node, adj))
592 if (!id || !memcmp (adj->sysid, sysid,
593 ISIS_SYS_ID_LEN))
594 isis_adj_print_vty (adj, vty, detail);
595 }
596 }
597 }
598 else if (circuit->circ_type == CIRCUIT_T_P2P &&
599 circuit->u.p2p.neighbor)
600 {
601 adj = circuit->u.p2p.neighbor;
602 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
603 isis_adj_print_vty (adj, vty, detail);
604 }
605 }
606 }
607
608 return CMD_SUCCESS;
609 }
610
611 /*
612 * 'clear isis neighbor' command
613 */
614 int
615 clear_isis_neighbor_common (struct vty *vty, const char *id)
616 {
617 struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
618 struct isis_area *area;
619 struct isis_circuit *circuit;
620 struct list *adjdb;
621 struct isis_adjacency *adj;
622 struct isis_dynhn *dynhn;
623 u_char sysid[ISIS_SYS_ID_LEN];
624 int i;
625
626 if (!isis)
627 {
628 vty_out (vty, "IS-IS Routing Process not enabled%s", VTY_NEWLINE);
629 return CMD_SUCCESS;
630 }
631
632 memset (sysid, 0, ISIS_SYS_ID_LEN);
633 if (id)
634 {
635 if (sysid2buff (sysid, id) == 0)
636 {
637 dynhn = dynhn_find_by_name (id);
638 if (dynhn == NULL)
639 {
640 vty_out (vty, "Invalid system id %s%s", id, VTY_NEWLINE);
641 return CMD_SUCCESS;
642 }
643 memcpy (sysid, dynhn->id, ISIS_SYS_ID_LEN);
644 }
645 }
646
647 for (ALL_LIST_ELEMENTS_RO (isis->area_list, anode, area))
648 {
649 for (ALL_LIST_ELEMENTS (area->circuit_list, cnode, cnextnode, circuit))
650 {
651 if (circuit->circ_type == CIRCUIT_T_BROADCAST)
652 {
653 for (i = 0; i < 2; i++)
654 {
655 adjdb = circuit->u.bc.adjdb[i];
656 if (adjdb && adjdb->count)
657 {
658 for (ALL_LIST_ELEMENTS (adjdb, node, nnode, adj))
659 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
660 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
661 "clear user request");
662 }
663 }
664 }
665 else if (circuit->circ_type == CIRCUIT_T_P2P &&
666 circuit->u.p2p.neighbor)
667 {
668 adj = circuit->u.p2p.neighbor;
669 if (!id || !memcmp (adj->sysid, sysid, ISIS_SYS_ID_LEN))
670 isis_adj_state_change (adj, ISIS_ADJ_DOWN,
671 "clear user request");
672 }
673 }
674 }
675
676 return CMD_SUCCESS;
677 }
678
679 DEFUN (show_isis_neighbor,
680 show_isis_neighbor_cmd,
681 "show isis neighbor",
682 SHOW_STR
683 "ISIS network information\n"
684 "ISIS neighbor adjacencies\n")
685 {
686 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_BRIEF);
687 }
688
689 DEFUN (show_isis_neighbor_detail,
690 show_isis_neighbor_detail_cmd,
691 "show isis neighbor detail",
692 SHOW_STR
693 "ISIS network information\n"
694 "ISIS neighbor adjacencies\n"
695 "show detailed information\n")
696 {
697 return show_isis_neighbor_common (vty, NULL, ISIS_UI_LEVEL_DETAIL);
698 }
699
700 DEFUN (show_isis_neighbor_arg,
701 show_isis_neighbor_arg_cmd,
702 "show isis neighbor WORD",
703 SHOW_STR
704 "ISIS network information\n"
705 "ISIS neighbor adjacencies\n"
706 "System id\n")
707 {
708 return show_isis_neighbor_common (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
709 }
710
711 DEFUN (clear_isis_neighbor,
712 clear_isis_neighbor_cmd,
713 "clear isis neighbor",
714 CLEAR_STR
715 "Reset ISIS network information\n"
716 "Reset ISIS neighbor adjacencies\n")
717 {
718 return clear_isis_neighbor_common (vty, NULL);
719 }
720
721 DEFUN (clear_isis_neighbor_arg,
722 clear_isis_neighbor_arg_cmd,
723 "clear isis neighbor WORD",
724 CLEAR_STR
725 "ISIS network information\n"
726 "ISIS neighbor adjacencies\n"
727 "System id\n")
728 {
729 return clear_isis_neighbor_common (vty, argv[0]);
730 }
731
732 /*
733 * 'isis debug', 'show debugging'
734 */
735 void
736 print_debug (struct vty *vty, int flags, int onoff)
737 {
738 char onoffs[4];
739 if (onoff)
740 strcpy (onoffs, "on");
741 else
742 strcpy (onoffs, "off");
743
744 if (flags & DEBUG_ADJ_PACKETS)
745 vty_out (vty, "IS-IS Adjacency related packets debugging is %s%s", onoffs,
746 VTY_NEWLINE);
747 if (flags & DEBUG_CHECKSUM_ERRORS)
748 vty_out (vty, "IS-IS checksum errors debugging is %s%s", onoffs,
749 VTY_NEWLINE);
750 if (flags & DEBUG_LOCAL_UPDATES)
751 vty_out (vty, "IS-IS local updates debugging is %s%s", onoffs,
752 VTY_NEWLINE);
753 if (flags & DEBUG_PROTOCOL_ERRORS)
754 vty_out (vty, "IS-IS protocol errors debugging is %s%s", onoffs,
755 VTY_NEWLINE);
756 if (flags & DEBUG_SNP_PACKETS)
757 vty_out (vty, "IS-IS CSNP/PSNP packets debugging is %s%s", onoffs,
758 VTY_NEWLINE);
759 if (flags & DEBUG_SPF_EVENTS)
760 vty_out (vty, "IS-IS SPF events debugging is %s%s", onoffs, VTY_NEWLINE);
761 if (flags & DEBUG_SPF_STATS)
762 vty_out (vty, "IS-IS SPF Timing and Statistics Data debugging is %s%s",
763 onoffs, VTY_NEWLINE);
764 if (flags & DEBUG_SPF_TRIGGERS)
765 vty_out (vty, "IS-IS SPF triggering events debugging is %s%s", onoffs,
766 VTY_NEWLINE);
767 if (flags & DEBUG_UPDATE_PACKETS)
768 vty_out (vty, "IS-IS Update related packet debugging is %s%s", onoffs,
769 VTY_NEWLINE);
770 if (flags & DEBUG_RTE_EVENTS)
771 vty_out (vty, "IS-IS Route related debuggin is %s%s", onoffs,
772 VTY_NEWLINE);
773 if (flags & DEBUG_EVENTS)
774 vty_out (vty, "IS-IS Event debugging is %s%s", onoffs, VTY_NEWLINE);
775 if (flags & DEBUG_PACKET_DUMP)
776 vty_out (vty, "IS-IS Packet dump debugging is %s%s", onoffs, VTY_NEWLINE);
777 }
778
779 DEFUN (show_debugging,
780 show_debugging_cmd,
781 "show debugging isis",
782 SHOW_STR
783 "State of each debugging option\n"
784 ISIS_STR)
785 {
786 vty_out (vty, "IS-IS:%s", VTY_NEWLINE);
787 print_debug (vty, isis->debugs, 1);
788 return CMD_SUCCESS;
789 }
790
791 /* Debug node. */
792 static struct cmd_node debug_node = {
793 DEBUG_NODE,
794 "",
795 1
796 };
797
798 static int
799 config_write_debug (struct vty *vty)
800 {
801 int write = 0;
802 int flags = isis->debugs;
803
804 if (flags & DEBUG_ADJ_PACKETS)
805 {
806 vty_out (vty, "debug isis adj-packets%s", VTY_NEWLINE);
807 write++;
808 }
809 if (flags & DEBUG_CHECKSUM_ERRORS)
810 {
811 vty_out (vty, "debug isis checksum-errors%s", VTY_NEWLINE);
812 write++;
813 }
814 if (flags & DEBUG_LOCAL_UPDATES)
815 {
816 vty_out (vty, "debug isis local-updates%s", VTY_NEWLINE);
817 write++;
818 }
819 if (flags & DEBUG_PROTOCOL_ERRORS)
820 {
821 vty_out (vty, "debug isis protocol-errors%s", VTY_NEWLINE);
822 write++;
823 }
824 if (flags & DEBUG_SNP_PACKETS)
825 {
826 vty_out (vty, "debug isis snp-packets%s", VTY_NEWLINE);
827 write++;
828 }
829 if (flags & DEBUG_SPF_EVENTS)
830 {
831 vty_out (vty, "debug isis spf-events%s", VTY_NEWLINE);
832 write++;
833 }
834 if (flags & DEBUG_SPF_STATS)
835 {
836 vty_out (vty, "debug isis spf-statistics%s", VTY_NEWLINE);
837 write++;
838 }
839 if (flags & DEBUG_SPF_TRIGGERS)
840 {
841 vty_out (vty, "debug isis spf-triggers%s", VTY_NEWLINE);
842 write++;
843 }
844 if (flags & DEBUG_UPDATE_PACKETS)
845 {
846 vty_out (vty, "debug isis update-packets%s", VTY_NEWLINE);
847 write++;
848 }
849 if (flags & DEBUG_RTE_EVENTS)
850 {
851 vty_out (vty, "debug isis route-events%s", VTY_NEWLINE);
852 write++;
853 }
854 if (flags & DEBUG_EVENTS)
855 {
856 vty_out (vty, "debug isis events%s", VTY_NEWLINE);
857 write++;
858 }
859 if (flags & DEBUG_PACKET_DUMP)
860 {
861 vty_out (vty, "debug isis packet-dump%s", VTY_NEWLINE);
862 write++;
863 }
864
865 return write;
866 }
867
868 DEFUN (debug_isis_adj,
869 debug_isis_adj_cmd,
870 "debug isis adj-packets",
871 DEBUG_STR
872 "IS-IS information\n"
873 "IS-IS Adjacency related packets\n")
874 {
875 isis->debugs |= DEBUG_ADJ_PACKETS;
876 print_debug (vty, DEBUG_ADJ_PACKETS, 1);
877
878 return CMD_SUCCESS;
879 }
880
881 DEFUN (no_debug_isis_adj,
882 no_debug_isis_adj_cmd,
883 "no debug isis adj-packets",
884 UNDEBUG_STR
885 "IS-IS information\n"
886 "IS-IS Adjacency related packets\n")
887 {
888 isis->debugs &= ~DEBUG_ADJ_PACKETS;
889 print_debug (vty, DEBUG_ADJ_PACKETS, 0);
890
891 return CMD_SUCCESS;
892 }
893
894 DEFUN (debug_isis_csum,
895 debug_isis_csum_cmd,
896 "debug isis checksum-errors",
897 DEBUG_STR
898 "IS-IS information\n"
899 "IS-IS LSP checksum errors\n")
900 {
901 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
902 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 1);
903
904 return CMD_SUCCESS;
905 }
906
907 DEFUN (no_debug_isis_csum,
908 no_debug_isis_csum_cmd,
909 "no debug isis checksum-errors",
910 UNDEBUG_STR
911 "IS-IS information\n"
912 "IS-IS LSP checksum errors\n")
913 {
914 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
915 print_debug (vty, DEBUG_CHECKSUM_ERRORS, 0);
916
917 return CMD_SUCCESS;
918 }
919
920 DEFUN (debug_isis_lupd,
921 debug_isis_lupd_cmd,
922 "debug isis local-updates",
923 DEBUG_STR
924 "IS-IS information\n"
925 "IS-IS local update packets\n")
926 {
927 isis->debugs |= DEBUG_LOCAL_UPDATES;
928 print_debug (vty, DEBUG_LOCAL_UPDATES, 1);
929
930 return CMD_SUCCESS;
931 }
932
933 DEFUN (no_debug_isis_lupd,
934 no_debug_isis_lupd_cmd,
935 "no debug isis local-updates",
936 UNDEBUG_STR
937 "IS-IS information\n"
938 "IS-IS local update packets\n")
939 {
940 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
941 print_debug (vty, DEBUG_LOCAL_UPDATES, 0);
942
943 return CMD_SUCCESS;
944 }
945
946 DEFUN (debug_isis_err,
947 debug_isis_err_cmd,
948 "debug isis protocol-errors",
949 DEBUG_STR
950 "IS-IS information\n"
951 "IS-IS LSP protocol errors\n")
952 {
953 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
954 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 1);
955
956 return CMD_SUCCESS;
957 }
958
959 DEFUN (no_debug_isis_err,
960 no_debug_isis_err_cmd,
961 "no debug isis protocol-errors",
962 UNDEBUG_STR
963 "IS-IS information\n"
964 "IS-IS LSP protocol errors\n")
965 {
966 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
967 print_debug (vty, DEBUG_PROTOCOL_ERRORS, 0);
968
969 return CMD_SUCCESS;
970 }
971
972 DEFUN (debug_isis_snp,
973 debug_isis_snp_cmd,
974 "debug isis snp-packets",
975 DEBUG_STR
976 "IS-IS information\n"
977 "IS-IS CSNP/PSNP packets\n")
978 {
979 isis->debugs |= DEBUG_SNP_PACKETS;
980 print_debug (vty, DEBUG_SNP_PACKETS, 1);
981
982 return CMD_SUCCESS;
983 }
984
985 DEFUN (no_debug_isis_snp,
986 no_debug_isis_snp_cmd,
987 "no debug isis snp-packets",
988 UNDEBUG_STR
989 "IS-IS information\n"
990 "IS-IS CSNP/PSNP packets\n")
991 {
992 isis->debugs &= ~DEBUG_SNP_PACKETS;
993 print_debug (vty, DEBUG_SNP_PACKETS, 0);
994
995 return CMD_SUCCESS;
996 }
997
998 DEFUN (debug_isis_upd,
999 debug_isis_upd_cmd,
1000 "debug isis update-packets",
1001 DEBUG_STR
1002 "IS-IS information\n"
1003 "IS-IS Update related packets\n")
1004 {
1005 isis->debugs |= DEBUG_UPDATE_PACKETS;
1006 print_debug (vty, DEBUG_UPDATE_PACKETS, 1);
1007
1008 return CMD_SUCCESS;
1009 }
1010
1011 DEFUN (no_debug_isis_upd,
1012 no_debug_isis_upd_cmd,
1013 "no debug isis update-packets",
1014 UNDEBUG_STR
1015 "IS-IS information\n"
1016 "IS-IS Update related packets\n")
1017 {
1018 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
1019 print_debug (vty, DEBUG_UPDATE_PACKETS, 0);
1020
1021 return CMD_SUCCESS;
1022 }
1023
1024 DEFUN (debug_isis_spfevents,
1025 debug_isis_spfevents_cmd,
1026 "debug isis spf-events",
1027 DEBUG_STR
1028 "IS-IS information\n"
1029 "IS-IS Shortest Path First Events\n")
1030 {
1031 isis->debugs |= DEBUG_SPF_EVENTS;
1032 print_debug (vty, DEBUG_SPF_EVENTS, 1);
1033
1034 return CMD_SUCCESS;
1035 }
1036
1037 DEFUN (no_debug_isis_spfevents,
1038 no_debug_isis_spfevents_cmd,
1039 "no debug isis spf-events",
1040 UNDEBUG_STR
1041 "IS-IS information\n"
1042 "IS-IS Shortest Path First Events\n")
1043 {
1044 isis->debugs &= ~DEBUG_SPF_EVENTS;
1045 print_debug (vty, DEBUG_SPF_EVENTS, 0);
1046
1047 return CMD_SUCCESS;
1048 }
1049
1050 DEFUN (debug_isis_spfstats,
1051 debug_isis_spfstats_cmd,
1052 "debug isis spf-statistics ",
1053 DEBUG_STR
1054 "IS-IS information\n"
1055 "IS-IS SPF Timing and Statistic Data\n")
1056 {
1057 isis->debugs |= DEBUG_SPF_STATS;
1058 print_debug (vty, DEBUG_SPF_STATS, 1);
1059
1060 return CMD_SUCCESS;
1061 }
1062
1063 DEFUN (no_debug_isis_spfstats,
1064 no_debug_isis_spfstats_cmd,
1065 "no debug isis spf-statistics",
1066 UNDEBUG_STR
1067 "IS-IS information\n"
1068 "IS-IS SPF Timing and Statistic Data\n")
1069 {
1070 isis->debugs &= ~DEBUG_SPF_STATS;
1071 print_debug (vty, DEBUG_SPF_STATS, 0);
1072
1073 return CMD_SUCCESS;
1074 }
1075
1076 DEFUN (debug_isis_spftrigg,
1077 debug_isis_spftrigg_cmd,
1078 "debug isis spf-triggers",
1079 DEBUG_STR
1080 "IS-IS information\n"
1081 "IS-IS SPF triggering events\n")
1082 {
1083 isis->debugs |= DEBUG_SPF_TRIGGERS;
1084 print_debug (vty, DEBUG_SPF_TRIGGERS, 1);
1085
1086 return CMD_SUCCESS;
1087 }
1088
1089 DEFUN (no_debug_isis_spftrigg,
1090 no_debug_isis_spftrigg_cmd,
1091 "no debug isis spf-triggers",
1092 UNDEBUG_STR
1093 "IS-IS information\n"
1094 "IS-IS SPF triggering events\n")
1095 {
1096 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
1097 print_debug (vty, DEBUG_SPF_TRIGGERS, 0);
1098
1099 return CMD_SUCCESS;
1100 }
1101
1102 DEFUN (debug_isis_rtevents,
1103 debug_isis_rtevents_cmd,
1104 "debug isis route-events",
1105 DEBUG_STR
1106 "IS-IS information\n"
1107 "IS-IS Route related events\n")
1108 {
1109 isis->debugs |= DEBUG_RTE_EVENTS;
1110 print_debug (vty, DEBUG_RTE_EVENTS, 1);
1111
1112 return CMD_SUCCESS;
1113 }
1114
1115 DEFUN (no_debug_isis_rtevents,
1116 no_debug_isis_rtevents_cmd,
1117 "no debug isis route-events",
1118 UNDEBUG_STR
1119 "IS-IS information\n"
1120 "IS-IS Route related events\n")
1121 {
1122 isis->debugs &= ~DEBUG_RTE_EVENTS;
1123 print_debug (vty, DEBUG_RTE_EVENTS, 0);
1124
1125 return CMD_SUCCESS;
1126 }
1127
1128 DEFUN (debug_isis_events,
1129 debug_isis_events_cmd,
1130 "debug isis events",
1131 DEBUG_STR
1132 "IS-IS information\n"
1133 "IS-IS Events\n")
1134 {
1135 isis->debugs |= DEBUG_EVENTS;
1136 print_debug (vty, DEBUG_EVENTS, 1);
1137
1138 return CMD_SUCCESS;
1139 }
1140
1141 DEFUN (no_debug_isis_events,
1142 no_debug_isis_events_cmd,
1143 "no debug isis events",
1144 UNDEBUG_STR
1145 "IS-IS information\n"
1146 "IS-IS Events\n")
1147 {
1148 isis->debugs &= ~DEBUG_EVENTS;
1149 print_debug (vty, DEBUG_EVENTS, 0);
1150
1151 return CMD_SUCCESS;
1152 }
1153
1154 DEFUN (debug_isis_packet_dump,
1155 debug_isis_packet_dump_cmd,
1156 "debug isis packet-dump",
1157 DEBUG_STR
1158 "IS-IS information\n"
1159 "IS-IS packet dump\n")
1160 {
1161 isis->debugs |= DEBUG_PACKET_DUMP;
1162 print_debug (vty, DEBUG_PACKET_DUMP, 1);
1163
1164 return CMD_SUCCESS;
1165 }
1166
1167 DEFUN (no_debug_isis_packet_dump,
1168 no_debug_isis_packet_dump_cmd,
1169 "no debug isis packet-dump",
1170 UNDEBUG_STR
1171 "IS-IS information\n"
1172 "IS-IS packet dump\n")
1173 {
1174 isis->debugs &= ~DEBUG_PACKET_DUMP;
1175 print_debug (vty, DEBUG_PACKET_DUMP, 0);
1176
1177 return CMD_SUCCESS;
1178 }
1179
1180 DEFUN (show_hostname,
1181 show_hostname_cmd,
1182 "show isis hostname",
1183 SHOW_STR
1184 "IS-IS information\n"
1185 "IS-IS Dynamic hostname mapping\n")
1186 {
1187 dynhn_print_all (vty);
1188
1189 return CMD_SUCCESS;
1190 }
1191
1192 static void
1193 vty_out_timestr(struct vty *vty, time_t uptime)
1194 {
1195 struct tm *tm;
1196 time_t difftime = time (NULL);
1197 difftime -= uptime;
1198 tm = gmtime (&difftime);
1199
1200 #define ONE_DAY_SECOND 60*60*24
1201 #define ONE_WEEK_SECOND 60*60*24*7
1202 if (difftime < ONE_DAY_SECOND)
1203 vty_out (vty, "%02d:%02d:%02d",
1204 tm->tm_hour, tm->tm_min, tm->tm_sec);
1205 else if (difftime < ONE_WEEK_SECOND)
1206 vty_out (vty, "%dd%02dh%02dm",
1207 tm->tm_yday, tm->tm_hour, tm->tm_min);
1208 else
1209 vty_out (vty, "%02dw%dd%02dh",
1210 tm->tm_yday/7,
1211 tm->tm_yday - ((tm->tm_yday/7) * 7), tm->tm_hour);
1212 vty_out (vty, " ago");
1213 }
1214
1215 DEFUN (show_isis_summary,
1216 show_isis_summary_cmd,
1217 "show isis summary",
1218 SHOW_STR "IS-IS information\n" "IS-IS summary\n")
1219 {
1220 struct listnode *node, *node2;
1221 struct isis_area *area;
1222 struct isis_spftree *spftree;
1223 int level;
1224
1225 if (isis == NULL)
1226 {
1227 vty_out (vty, "ISIS is not running%s", VTY_NEWLINE);
1228 return CMD_SUCCESS;
1229 }
1230
1231 vty_out (vty, "Process Id : %ld%s", isis->process_id,
1232 VTY_NEWLINE);
1233 if (isis->sysid_set)
1234 vty_out (vty, "System Id : %s%s", sysid_print (isis->sysid),
1235 VTY_NEWLINE);
1236
1237 vty_out (vty, "Up time : ");
1238 vty_out_timestr(vty, isis->uptime);
1239 vty_out (vty, "%s", VTY_NEWLINE);
1240
1241 if (isis->area_list)
1242 vty_out (vty, "Number of areas : %d%s", isis->area_list->count,
1243 VTY_NEWLINE);
1244
1245 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
1246 {
1247 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
1248 VTY_NEWLINE);
1249
1250 if (listcount (area->area_addrs) > 0)
1251 {
1252 struct area_addr *area_addr;
1253 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
1254 {
1255 vty_out (vty, " Net: %s%s",
1256 isonet_print (area_addr->area_addr,
1257 area_addr->addr_len + ISIS_SYS_ID_LEN +
1258 1), VTY_NEWLINE);
1259 }
1260 }
1261
1262 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++)
1263 {
1264 if ((area->is_type & level) == 0)
1265 continue;
1266
1267 vty_out (vty, " Level-%d:%s", level, VTY_NEWLINE);
1268 spftree = area->spftree[level - 1];
1269 if (spftree->pending)
1270 vty_out (vty, " IPv4 SPF: (pending)%s", VTY_NEWLINE);
1271 else
1272 vty_out (vty, " IPv4 SPF:%s", VTY_NEWLINE);
1273
1274 vty_out (vty, " minimum interval : %d%s",
1275 area->min_spf_interval[level - 1], VTY_NEWLINE);
1276
1277 vty_out (vty, " last run elapsed : ");
1278 vty_out_timestr(vty, spftree->last_run_timestamp);
1279 vty_out (vty, "%s", VTY_NEWLINE);
1280
1281 vty_out (vty, " last run duration : %u usec%s",
1282 (u_int32_t)spftree->last_run_duration, VTY_NEWLINE);
1283
1284 vty_out (vty, " run count : %d%s",
1285 spftree->runcount, VTY_NEWLINE);
1286
1287 #ifdef HAVE_IPV6
1288 spftree = area->spftree6[level - 1];
1289 if (spftree->pending)
1290 vty_out (vty, " IPv6 SPF: (pending)%s", VTY_NEWLINE);
1291 else
1292 vty_out (vty, " IPv6 SPF:%s", VTY_NEWLINE);
1293
1294 vty_out (vty, " minimum interval : %d%s",
1295 area->min_spf_interval[level - 1], VTY_NEWLINE);
1296
1297 vty_out (vty, " last run elapsed : ");
1298 vty_out_timestr(vty, spftree->last_run_timestamp);
1299 vty_out (vty, "%s", VTY_NEWLINE);
1300
1301 vty_out (vty, " last run duration : %ld msec%s",
1302 spftree->last_run_duration, VTY_NEWLINE);
1303
1304 vty_out (vty, " run count : %d%s",
1305 spftree->runcount, VTY_NEWLINE);
1306 #endif
1307 }
1308 }
1309 vty_out (vty, "%s", VTY_NEWLINE);
1310
1311 return CMD_SUCCESS;
1312 }
1313
1314 /*
1315 * This function supports following display options:
1316 * [ show isis database [detail] ]
1317 * [ show isis database <sysid> [detail] ]
1318 * [ show isis database <hostname> [detail] ]
1319 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1320 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1321 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1322 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1323 * [ show isis database detail <sysid> ]
1324 * [ show isis database detail <hostname> ]
1325 * [ show isis database detail <sysid>.<pseudo-id> ]
1326 * [ show isis database detail <hostname>.<pseudo-id> ]
1327 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1328 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1329 */
1330 static int
1331 show_isis_database (struct vty *vty, const char *argv, int ui_level)
1332 {
1333 struct listnode *node;
1334 struct isis_area *area;
1335 struct isis_lsp *lsp;
1336 struct isis_dynhn *dynhn;
1337 const char *pos = argv;
1338 u_char lspid[ISIS_SYS_ID_LEN+2];
1339 char sysid[255];
1340 u_char number[3];
1341 int level, lsp_count;
1342
1343 if (isis->area_list->count == 0)
1344 return CMD_SUCCESS;
1345
1346 memset (&lspid, 0, ISIS_SYS_ID_LEN);
1347 memset (&sysid, 0, 255);
1348
1349 /*
1350 * extract fragment and pseudo id from the string argv
1351 * in the forms:
1352 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1353 * (b) <systemid/hostname>.<pseudo-id> or
1354 * (c) <systemid/hostname> or
1355 * Where systemid is in the form:
1356 * xxxx.xxxx.xxxx
1357 */
1358 if (argv)
1359 strncpy (sysid, argv, 254);
1360 if (argv && strlen (argv) > 3)
1361 {
1362 pos = argv + strlen (argv) - 3;
1363 if (strncmp (pos, "-", 1) == 0)
1364 {
1365 memcpy (number, ++pos, 2);
1366 lspid[ISIS_SYS_ID_LEN+1] = (u_char) strtol ((char *)number, NULL, 16);
1367 pos -= 4;
1368 if (strncmp (pos, ".", 1) != 0)
1369 return CMD_ERR_AMBIGUOUS;
1370 }
1371 if (strncmp (pos, ".", 1) == 0)
1372 {
1373 memcpy (number, ++pos, 2);
1374 lspid[ISIS_SYS_ID_LEN] = (u_char) strtol ((char *)number, NULL, 16);
1375 sysid[pos - argv - 1] = '\0';
1376 }
1377 }
1378
1379 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
1380 {
1381 vty_out (vty, "Area %s:%s", area->area_tag ? area->area_tag : "null",
1382 VTY_NEWLINE);
1383
1384 for (level = 0; level < ISIS_LEVELS; level++)
1385 {
1386 if (area->lspdb[level] && dict_count (area->lspdb[level]) > 0)
1387 {
1388 lsp = NULL;
1389 if (argv != NULL)
1390 {
1391 /*
1392 * Try to find the lsp-id if the argv string is in
1393 * the form hostname.<pseudo-id>-<fragment>
1394 */
1395 if (sysid2buff (lspid, sysid))
1396 {
1397 lsp = lsp_search (lspid, area->lspdb[level]);
1398 }
1399 else if ((dynhn = dynhn_find_by_name (sysid)))
1400 {
1401 memcpy (lspid, dynhn->id, ISIS_SYS_ID_LEN);
1402 lsp = lsp_search (lspid, area->lspdb[level]);
1403 }
1404 else if (strncmp(unix_hostname (), sysid, 15) == 0)
1405 {
1406 memcpy (lspid, isis->sysid, ISIS_SYS_ID_LEN);
1407 lsp = lsp_search (lspid, area->lspdb[level]);
1408 }
1409 }
1410
1411 if (lsp != NULL || argv == NULL)
1412 {
1413 vty_out (vty, "IS-IS Level-%d link-state database:%s",
1414 level + 1, VTY_NEWLINE);
1415
1416 /* print the title in all cases */
1417 vty_out (vty, "LSP ID PduLen "
1418 "SeqNumber Chksum Holdtime ATT/P/OL%s",
1419 VTY_NEWLINE);
1420 }
1421
1422 if (lsp)
1423 {
1424 if (ui_level == ISIS_UI_LEVEL_DETAIL)
1425 lsp_print_detail (lsp, vty, area->dynhostname);
1426 else
1427 lsp_print (lsp, vty, area->dynhostname);
1428 }
1429 else if (argv == NULL)
1430 {
1431 lsp_count = lsp_print_all (vty, area->lspdb[level],
1432 ui_level,
1433 area->dynhostname);
1434
1435 vty_out (vty, " %u LSPs%s%s",
1436 lsp_count, VTY_NEWLINE, VTY_NEWLINE);
1437 }
1438 }
1439 }
1440 }
1441
1442 return CMD_SUCCESS;
1443 }
1444
1445 DEFUN (show_database_brief,
1446 show_database_cmd,
1447 "show isis database",
1448 SHOW_STR
1449 "IS-IS information\n"
1450 "IS-IS link state database\n")
1451 {
1452 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_BRIEF);
1453 }
1454
1455 DEFUN (show_database_lsp_brief,
1456 show_database_arg_cmd,
1457 "show isis database WORD",
1458 SHOW_STR
1459 "IS-IS information\n"
1460 "IS-IS link state database\n"
1461 "LSP ID\n")
1462 {
1463 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_BRIEF);
1464 }
1465
1466 DEFUN (show_database_lsp_detail,
1467 show_database_arg_detail_cmd,
1468 "show isis database WORD detail",
1469 SHOW_STR
1470 "IS-IS information\n"
1471 "IS-IS link state database\n"
1472 "LSP ID\n"
1473 "Detailed information\n")
1474 {
1475 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
1476 }
1477
1478 DEFUN (show_database_detail,
1479 show_database_detail_cmd,
1480 "show isis database detail",
1481 SHOW_STR
1482 "IS-IS information\n"
1483 "IS-IS link state database\n")
1484 {
1485 return show_isis_database (vty, NULL, ISIS_UI_LEVEL_DETAIL);
1486 }
1487
1488 DEFUN (show_database_detail_lsp,
1489 show_database_detail_arg_cmd,
1490 "show isis database detail WORD",
1491 SHOW_STR
1492 "IS-IS information\n"
1493 "IS-IS link state database\n"
1494 "Detailed information\n"
1495 "LSP ID\n")
1496 {
1497 return show_isis_database (vty, argv[0], ISIS_UI_LEVEL_DETAIL);
1498 }
1499
1500 /*
1501 * 'router isis' command
1502 */
1503 DEFUN (router_isis,
1504 router_isis_cmd,
1505 "router isis WORD",
1506 ROUTER_STR
1507 "ISO IS-IS\n"
1508 "ISO Routing area tag")
1509 {
1510 return isis_area_get (vty, argv[0]);
1511 }
1512
1513 /*
1514 *'no router isis' command
1515 */
1516 DEFUN (no_router_isis,
1517 no_router_isis_cmd,
1518 "no router isis WORD",
1519 "no\n" ROUTER_STR "ISO IS-IS\n" "ISO Routing area tag")
1520 {
1521 return isis_area_destroy (vty, argv[0]);
1522 }
1523
1524 /*
1525 * 'net' command
1526 */
1527 DEFUN (net,
1528 net_cmd,
1529 "net WORD",
1530 "A Network Entity Title for this process (OSI only)\n"
1531 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1532 {
1533 return area_net_title (vty, argv[0]);
1534 }
1535
1536 /*
1537 * 'no net' command
1538 */
1539 DEFUN (no_net,
1540 no_net_cmd,
1541 "no net WORD",
1542 NO_STR
1543 "A Network Entity Title for this process (OSI only)\n"
1544 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1545 {
1546 return area_clear_net_title (vty, argv[0]);
1547 }
1548
1549 DEFUN (area_passwd_md5,
1550 area_passwd_md5_cmd,
1551 "area-password md5 WORD",
1552 "Configure the authentication password for an area\n"
1553 "Authentication type\n"
1554 "Area password\n")
1555 {
1556 struct isis_area *area;
1557 int len;
1558
1559 area = vty->index;
1560
1561 if (!area)
1562 {
1563 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1564 return CMD_ERR_NO_MATCH;
1565 }
1566
1567 len = strlen (argv[0]);
1568 if (len > 254)
1569 {
1570 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1571 return CMD_ERR_AMBIGUOUS;
1572 }
1573
1574 area->area_passwd.len = (u_char) len;
1575 area->area_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1576 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
1577
1578 if (argc > 1)
1579 {
1580 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1581 if (strncmp(argv[1], "v", 1) == 0)
1582 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1583 else
1584 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1585 }
1586 else
1587 {
1588 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1589 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1590 }
1591 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1592
1593 return CMD_SUCCESS;
1594 }
1595
1596 ALIAS (area_passwd_md5,
1597 area_passwd_md5_snpauth_cmd,
1598 "area-password md5 WORD authenticate snp (send-only|validate)",
1599 "Configure the authentication password for an area\n"
1600 "Authentication type\n"
1601 "Area password\n"
1602 "Authentication\n"
1603 "SNP PDUs\n"
1604 "Send but do not check PDUs on receiving\n"
1605 "Send and check PDUs on receiving\n");
1606
1607 DEFUN (area_passwd_clear,
1608 area_passwd_clear_cmd,
1609 "area-password clear WORD",
1610 "Configure the authentication password for an area\n"
1611 "Authentication type\n"
1612 "Area password\n")
1613 {
1614 struct isis_area *area;
1615 int len;
1616
1617 area = vty->index;
1618
1619 if (!area)
1620 {
1621 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1622 return CMD_ERR_NO_MATCH;
1623 }
1624
1625 len = strlen (argv[0]);
1626 if (len > 254)
1627 {
1628 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1629 return CMD_ERR_AMBIGUOUS;
1630 }
1631
1632 area->area_passwd.len = (u_char) len;
1633 area->area_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1634 strncpy ((char *)area->area_passwd.passwd, argv[0], 255);
1635
1636 if (argc > 1)
1637 {
1638 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1639 if (strncmp(argv[1], "v", 1) == 0)
1640 SET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1641 else
1642 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1643 }
1644 else
1645 {
1646 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND);
1647 UNSET_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV);
1648 }
1649 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1650
1651 return CMD_SUCCESS;
1652 }
1653
1654 ALIAS (area_passwd_clear,
1655 area_passwd_clear_snpauth_cmd,
1656 "area-password clear WORD authenticate snp (send-only|validate)",
1657 "Configure the authentication password for an area\n"
1658 "Authentication type\n"
1659 "Area password\n"
1660 "Authentication\n"
1661 "SNP PDUs\n"
1662 "Send but do not check PDUs on receiving\n"
1663 "Send and check PDUs on receiving\n");
1664
1665 DEFUN (no_area_passwd,
1666 no_area_passwd_cmd,
1667 "no area-password",
1668 NO_STR
1669 "Configure the authentication password for an area\n")
1670 {
1671 struct isis_area *area;
1672
1673 area = vty->index;
1674
1675 if (!area)
1676 {
1677 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1678 return CMD_ERR_NO_MATCH;
1679 }
1680
1681 memset (&area->area_passwd, 0, sizeof (struct isis_passwd));
1682 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1683
1684 return CMD_SUCCESS;
1685 }
1686
1687 DEFUN (domain_passwd_md5,
1688 domain_passwd_md5_cmd,
1689 "domain-password md5 WORD",
1690 "Set the authentication password for a routing domain\n"
1691 "Authentication type\n"
1692 "Routing domain password\n")
1693 {
1694 struct isis_area *area;
1695 int len;
1696
1697 area = vty->index;
1698
1699 if (!area)
1700 {
1701 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1702 return CMD_ERR_NO_MATCH;
1703 }
1704
1705 len = strlen (argv[0]);
1706 if (len > 254)
1707 {
1708 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1709 return CMD_ERR_AMBIGUOUS;
1710 }
1711
1712 area->domain_passwd.len = (u_char) len;
1713 area->domain_passwd.type = ISIS_PASSWD_TYPE_HMAC_MD5;
1714 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
1715
1716 if (argc > 1)
1717 {
1718 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1719 if (strncmp(argv[1], "v", 1) == 0)
1720 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1721 else
1722 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1723 }
1724 else
1725 {
1726 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1727 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1728 }
1729 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1730
1731 return CMD_SUCCESS;
1732 }
1733
1734 ALIAS (domain_passwd_md5,
1735 domain_passwd_md5_snpauth_cmd,
1736 "domain-password md5 WORD authenticate snp (send-only|validate)",
1737 "Set the authentication password for a routing domain\n"
1738 "Authentication type\n"
1739 "Routing domain password\n"
1740 "Authentication\n"
1741 "SNP PDUs\n"
1742 "Send but do not check PDUs on receiving\n"
1743 "Send and check PDUs on receiving\n");
1744
1745 DEFUN (domain_passwd_clear,
1746 domain_passwd_clear_cmd,
1747 "domain-password clear WORD",
1748 "Set the authentication password for a routing domain\n"
1749 "Authentication type\n"
1750 "Routing domain password\n")
1751 {
1752 struct isis_area *area;
1753 int len;
1754
1755 area = vty->index;
1756
1757 if (!area)
1758 {
1759 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1760 return CMD_ERR_NO_MATCH;
1761 }
1762
1763 len = strlen (argv[0]);
1764 if (len > 254)
1765 {
1766 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
1767 return CMD_ERR_AMBIGUOUS;
1768 }
1769
1770 area->domain_passwd.len = (u_char) len;
1771 area->domain_passwd.type = ISIS_PASSWD_TYPE_CLEARTXT;
1772 strncpy ((char *)area->domain_passwd.passwd, argv[0], 255);
1773
1774 if (argc > 1)
1775 {
1776 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1777 if (strncmp(argv[1], "v", 1) == 0)
1778 SET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1779 else
1780 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1781 }
1782 else
1783 {
1784 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND);
1785 UNSET_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV);
1786 }
1787 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1788
1789 return CMD_SUCCESS;
1790 }
1791
1792 ALIAS (domain_passwd_clear,
1793 domain_passwd_clear_snpauth_cmd,
1794 "domain-password clear WORD authenticate snp (send-only|validate)",
1795 "Set the authentication password for a routing domain\n"
1796 "Authentication type\n"
1797 "Routing domain password\n"
1798 "Authentication\n"
1799 "SNP PDUs\n"
1800 "Send but do not check PDUs on receiving\n"
1801 "Send and check PDUs on receiving\n");
1802
1803 DEFUN (no_domain_passwd,
1804 no_domain_passwd_cmd,
1805 "no domain-password",
1806 NO_STR
1807 "Set the authentication password for a routing domain\n")
1808 {
1809 struct isis_area *area;
1810
1811 area = vty->index;
1812
1813 if (!area)
1814 {
1815 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1816 return CMD_ERR_NO_MATCH;
1817 }
1818
1819 memset (&area->domain_passwd, 0, sizeof (struct isis_passwd));
1820 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1821
1822 return CMD_SUCCESS;
1823 }
1824
1825 DEFUN (is_type,
1826 is_type_cmd,
1827 "is-type (level-1|level-1-2|level-2-only)",
1828 "IS Level for this routing process (OSI only)\n"
1829 "Act as a station router only\n"
1830 "Act as both a station router and an area router\n"
1831 "Act as an area router only\n")
1832 {
1833 struct isis_area *area;
1834 int type;
1835
1836 area = vty->index;
1837
1838 if (!area)
1839 {
1840 vty_out (vty, "Can't find IS-IS instance%s", VTY_NEWLINE);
1841 return CMD_ERR_NO_MATCH;
1842 }
1843
1844 type = string2circuit_t (argv[0]);
1845 if (!type)
1846 {
1847 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1848 return CMD_SUCCESS;
1849 }
1850
1851 isis_event_system_type_change (area, type);
1852
1853 return CMD_SUCCESS;
1854 }
1855
1856 DEFUN (no_is_type,
1857 no_is_type_cmd,
1858 "no is-type (level-1|level-1-2|level-2-only)",
1859 NO_STR
1860 "IS Level for this routing process (OSI only)\n"
1861 "Act as a station router only\n"
1862 "Act as both a station router and an area router\n"
1863 "Act as an area router only\n")
1864 {
1865 struct isis_area *area;
1866 int type;
1867
1868 area = vty->index;
1869 assert (area);
1870
1871 /*
1872 * Put the is-type back to defaults:
1873 * - level-1-2 on first area
1874 * - level-1 for the rest
1875 */
1876 if (listgetdata (listhead (isis->area_list)) == area)
1877 type = IS_LEVEL_1_AND_2;
1878 else
1879 type = IS_LEVEL_1;
1880
1881 isis_event_system_type_change (area, type);
1882
1883 return CMD_SUCCESS;
1884 }
1885
1886 static int
1887 set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
1888 uint16_t interval, int level)
1889 {
1890 int lvl;
1891
1892 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1893 {
1894 if (!(lvl & level))
1895 continue;
1896
1897 if (interval >= area->lsp_refresh[lvl-1])
1898 {
1899 vty_out (vty, "LSP gen interval %us must be less than "
1900 "the LSP refresh interval %us%s",
1901 interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
1902 return CMD_ERR_AMBIGUOUS;
1903 }
1904 }
1905
1906 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1907 {
1908 if (!(lvl & level))
1909 continue;
1910 area->lsp_gen_interval[lvl-1] = interval;
1911 }
1912
1913 return CMD_SUCCESS;
1914 }
1915
1916 DEFUN (lsp_gen_interval,
1917 lsp_gen_interval_cmd,
1918 "lsp-gen-interval <1-120>",
1919 "Minimum interval between regenerating same LSP\n"
1920 "Minimum interval in seconds\n")
1921 {
1922 struct isis_area *area;
1923 uint16_t interval;
1924 int level;
1925
1926 area = vty->index;
1927 interval = atoi (argv[0]);
1928 level = IS_LEVEL_1 | IS_LEVEL_2;
1929 return set_lsp_gen_interval (vty, area, interval, level);
1930 }
1931
1932 DEFUN (no_lsp_gen_interval,
1933 no_lsp_gen_interval_cmd,
1934 "no lsp-gen-interval",
1935 NO_STR
1936 "Minimum interval between regenerating same LSP\n")
1937 {
1938 struct isis_area *area;
1939 uint16_t interval;
1940 int level;
1941
1942 area = vty->index;
1943 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1944 level = IS_LEVEL_1 | IS_LEVEL_2;
1945 return set_lsp_gen_interval (vty, area, interval, level);
1946 }
1947
1948 ALIAS (no_lsp_gen_interval,
1949 no_lsp_gen_interval_arg_cmd,
1950 "no lsp-gen-interval <1-120>",
1951 NO_STR
1952 "Minimum interval between regenerating same LSP\n"
1953 "Minimum interval in seconds\n")
1954
1955 DEFUN (lsp_gen_interval_l1,
1956 lsp_gen_interval_l1_cmd,
1957 "lsp-gen-interval level-1 <1-120>",
1958 "Minimum interval between regenerating same LSP\n"
1959 "Set interval for level 1 only\n"
1960 "Minimum interval in seconds\n")
1961 {
1962 struct isis_area *area;
1963 uint16_t interval;
1964 int level;
1965
1966 area = vty->index;
1967 interval = atoi (argv[0]);
1968 level = IS_LEVEL_1;
1969 return set_lsp_gen_interval (vty, area, interval, level);
1970 }
1971
1972 DEFUN (no_lsp_gen_interval_l1,
1973 no_lsp_gen_interval_l1_cmd,
1974 "no lsp-gen-interval level-1",
1975 NO_STR
1976 "Minimum interval between regenerating same LSP\n"
1977 "Set interval for level 1 only\n")
1978 {
1979 struct isis_area *area;
1980 uint16_t interval;
1981 int level;
1982
1983 area = vty->index;
1984 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1985 level = IS_LEVEL_1;
1986 return set_lsp_gen_interval (vty, area, interval, level);
1987 }
1988
1989 ALIAS (no_lsp_gen_interval_l1,
1990 no_lsp_gen_interval_l1_arg_cmd,
1991 "no lsp-gen-interval level-1 <1-120>",
1992 NO_STR
1993 "Minimum interval between regenerating same LSP\n"
1994 "Set interval for level 1 only\n"
1995 "Minimum interval in seconds\n")
1996
1997 DEFUN (lsp_gen_interval_l2,
1998 lsp_gen_interval_l2_cmd,
1999 "lsp-gen-interval level-2 <1-120>",
2000 "Minimum interval between regenerating same LSP\n"
2001 "Set interval for level 2 only\n"
2002 "Minimum interval in seconds\n")
2003 {
2004 struct isis_area *area;
2005 uint16_t interval;
2006 int level;
2007
2008 area = vty->index;
2009 interval = atoi (argv[0]);
2010 level = IS_LEVEL_2;
2011 return set_lsp_gen_interval (vty, area, interval, level);
2012 }
2013
2014 DEFUN (no_lsp_gen_interval_l2,
2015 no_lsp_gen_interval_l2_cmd,
2016 "no lsp-gen-interval level-2",
2017 NO_STR
2018 "Minimum interval between regenerating same LSP\n"
2019 "Set interval for level 2 only\n")
2020 {
2021 struct isis_area *area;
2022 uint16_t interval;
2023 int level;
2024
2025 area = vty->index;
2026 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
2027 level = IS_LEVEL_2;
2028 return set_lsp_gen_interval (vty, area, interval, level);
2029 }
2030
2031 ALIAS (no_lsp_gen_interval_l2,
2032 no_lsp_gen_interval_l2_arg_cmd,
2033 "no lsp-gen-interval level-2 <1-120>",
2034 NO_STR
2035 "Minimum interval between regenerating same LSP\n"
2036 "Set interval for level 2 only\n"
2037 "Minimum interval in seconds\n")
2038
2039 static int
2040 validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
2041 {
2042 struct isis_circuit *circuit;
2043 struct listnode *node;
2044
2045 if (! vty)
2046 return CMD_ERR_AMBIGUOUS;
2047
2048 if (! area)
2049 {
2050 vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
2051 return CMD_ERR_AMBIGUOUS;
2052 }
2053
2054 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
2055 {
2056 if ((area->is_type & IS_LEVEL_1) &&
2057 (circuit->is_type & IS_LEVEL_1) &&
2058 (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
2059 {
2060 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2061 circuit->interface->name, VTY_NEWLINE);
2062 return CMD_ERR_AMBIGUOUS;
2063 }
2064 if ((area->is_type & IS_LEVEL_2) &&
2065 (circuit->is_type & IS_LEVEL_2) &&
2066 (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
2067 {
2068 vty_out (vty, "ISIS circuit %s metric is invalid%s",
2069 circuit->interface->name, VTY_NEWLINE);
2070 return CMD_ERR_AMBIGUOUS;
2071 }
2072 }
2073
2074 return CMD_SUCCESS;
2075 }
2076
2077 DEFUN (metric_style,
2078 metric_style_cmd,
2079 "metric-style (narrow|transition|wide)",
2080 "Use old-style (ISO 10589) or new-style packet formats\n"
2081 "Use old style of TLVs with narrow metric\n"
2082 "Send and accept both styles of TLVs during transition\n"
2083 "Use new style of TLVs to carry wider metric\n")
2084 {
2085 struct isis_area *area;
2086 int ret;
2087
2088 area = vty->index;
2089 assert (area);
2090
2091 if (strncmp (argv[0], "w", 1) == 0)
2092 {
2093 area->newmetric = 1;
2094 area->oldmetric = 0;
2095 }
2096 else
2097 {
2098 ret = validate_metric_style_narrow (vty, area);
2099 if (ret != CMD_SUCCESS)
2100 return ret;
2101
2102 if (strncmp (argv[0], "t", 1) == 0)
2103 {
2104 area->newmetric = 1;
2105 area->oldmetric = 1;
2106 }
2107 else if (strncmp (argv[0], "n", 1) == 0)
2108 {
2109 area->newmetric = 0;
2110 area->oldmetric = 1;
2111 }
2112 }
2113
2114 return CMD_SUCCESS;
2115 }
2116
2117 DEFUN (no_metric_style,
2118 no_metric_style_cmd,
2119 "no metric-style",
2120 NO_STR
2121 "Use old-style (ISO 10589) or new-style packet formats\n")
2122 {
2123 struct isis_area *area;
2124 int ret;
2125
2126 area = vty->index;
2127 assert (area);
2128
2129 ret = validate_metric_style_narrow (vty, area);
2130 if (ret != CMD_SUCCESS)
2131 return ret;
2132
2133 /* Default is narrow metric. */
2134 area->newmetric = 0;
2135 area->oldmetric = 1;
2136
2137 return CMD_SUCCESS;
2138 }
2139
2140 DEFUN (set_overload_bit,
2141 set_overload_bit_cmd,
2142 "set-overload-bit",
2143 "Set overload bit to avoid any transit traffic\n"
2144 "Set overload bit\n")
2145 {
2146 struct isis_area *area;
2147
2148 area = vty->index;
2149 assert (area);
2150
2151 area->overload_bit = LSPBIT_OL;
2152 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2153
2154 return CMD_SUCCESS;
2155 }
2156
2157 DEFUN (no_set_overload_bit,
2158 no_set_overload_bit_cmd,
2159 "no set-overload-bit",
2160 "Reset overload bit to accept transit traffic\n"
2161 "Reset overload bit\n")
2162 {
2163 struct isis_area *area;
2164
2165 area = vty->index;
2166 assert (area);
2167
2168 area->overload_bit = 0;
2169 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2170
2171 return CMD_SUCCESS;
2172 }
2173
2174 DEFUN (set_attached_bit,
2175 set_attached_bit_cmd,
2176 "set-attached-bit",
2177 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
2178 "Set attached bit\n")
2179 {
2180 struct isis_area *area;
2181
2182 area = vty->index;
2183 assert (area);
2184
2185 area->attached_bit = LSPBIT_ATT;
2186 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2187
2188 return CMD_SUCCESS;
2189 }
2190
2191 DEFUN (no_set_attached_bit,
2192 no_set_attached_bit_cmd,
2193 "no set-attached-bit",
2194 "Reset attached bit\n")
2195 {
2196 struct isis_area *area;
2197
2198 area = vty->index;
2199 assert (area);
2200
2201 area->attached_bit = 0;
2202 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2203
2204 return CMD_SUCCESS;
2205 }
2206
2207 DEFUN (dynamic_hostname,
2208 dynamic_hostname_cmd,
2209 "hostname dynamic",
2210 "Dynamic hostname for IS-IS\n"
2211 "Dynamic hostname\n")
2212 {
2213 struct isis_area *area;
2214
2215 area = vty->index;
2216 assert (area);
2217
2218 if (!area->dynhostname)
2219 {
2220 area->dynhostname = 1;
2221 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2222 }
2223
2224 return CMD_SUCCESS;
2225 }
2226
2227 DEFUN (no_dynamic_hostname,
2228 no_dynamic_hostname_cmd,
2229 "no hostname dynamic",
2230 NO_STR
2231 "Dynamic hostname for IS-IS\n"
2232 "Dynamic hostname\n")
2233 {
2234 struct isis_area *area;
2235
2236 area = vty->index;
2237 assert (area);
2238
2239 if (area->dynhostname)
2240 {
2241 area->dynhostname = 0;
2242 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 0);
2243 }
2244
2245 return CMD_SUCCESS;
2246 }
2247
2248 DEFUN (spf_interval,
2249 spf_interval_cmd,
2250 "spf-interval <1-120>",
2251 "Minimum interval between SPF calculations\n"
2252 "Minimum interval between consecutive SPFs in seconds\n")
2253 {
2254 struct isis_area *area;
2255 u_int16_t interval;
2256
2257 area = vty->index;
2258 interval = atoi (argv[0]);
2259 area->min_spf_interval[0] = interval;
2260 area->min_spf_interval[1] = interval;
2261
2262 return CMD_SUCCESS;
2263 }
2264
2265 DEFUN (no_spf_interval,
2266 no_spf_interval_cmd,
2267 "no spf-interval",
2268 NO_STR
2269 "Minimum interval between SPF calculations\n")
2270 {
2271 struct isis_area *area;
2272
2273 area = vty->index;
2274
2275 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
2276 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
2277
2278 return CMD_SUCCESS;
2279 }
2280
2281 ALIAS (no_spf_interval,
2282 no_spf_interval_arg_cmd,
2283 "no spf-interval <1-120>",
2284 NO_STR
2285 "Minimum interval between SPF calculations\n"
2286 "Minimum interval between consecutive SPFs in seconds\n")
2287
2288 DEFUN (spf_interval_l1,
2289 spf_interval_l1_cmd,
2290 "spf-interval level-1 <1-120>",
2291 "Minimum interval between SPF calculations\n"
2292 "Set interval for level 1 only\n"
2293 "Minimum interval between consecutive SPFs in seconds\n")
2294 {
2295 struct isis_area *area;
2296 u_int16_t interval;
2297
2298 area = vty->index;
2299 interval = atoi (argv[0]);
2300 area->min_spf_interval[0] = interval;
2301
2302 return CMD_SUCCESS;
2303 }
2304
2305 DEFUN (no_spf_interval_l1,
2306 no_spf_interval_l1_cmd,
2307 "no spf-interval level-1",
2308 NO_STR
2309 "Minimum interval between SPF calculations\n"
2310 "Set interval for level 1 only\n")
2311 {
2312 struct isis_area *area;
2313
2314 area = vty->index;
2315
2316 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
2317
2318 return CMD_SUCCESS;
2319 }
2320
2321 ALIAS (no_spf_interval,
2322 no_spf_interval_l1_arg_cmd,
2323 "no spf-interval level-1 <1-120>",
2324 NO_STR
2325 "Minimum interval between SPF calculations\n"
2326 "Set interval for level 1 only\n"
2327 "Minimum interval between consecutive SPFs in seconds\n")
2328
2329 DEFUN (spf_interval_l2,
2330 spf_interval_l2_cmd,
2331 "spf-interval level-2 <1-120>",
2332 "Minimum interval between SPF calculations\n"
2333 "Set interval for level 2 only\n"
2334 "Minimum interval between consecutive SPFs in seconds\n")
2335 {
2336 struct isis_area *area;
2337 u_int16_t interval;
2338
2339 area = vty->index;
2340 interval = atoi (argv[0]);
2341 area->min_spf_interval[1] = interval;
2342
2343 return CMD_SUCCESS;
2344 }
2345
2346 DEFUN (no_spf_interval_l2,
2347 no_spf_interval_l2_cmd,
2348 "no spf-interval level-2",
2349 NO_STR
2350 "Minimum interval between SPF calculations\n"
2351 "Set interval for level 2 only\n")
2352 {
2353 struct isis_area *area;
2354
2355 area = vty->index;
2356
2357 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
2358
2359 return CMD_SUCCESS;
2360 }
2361
2362 ALIAS (no_spf_interval,
2363 no_spf_interval_l2_arg_cmd,
2364 "no spf-interval level-2 <1-120>",
2365 NO_STR
2366 "Minimum interval between SPF calculations\n"
2367 "Set interval for level 2 only\n"
2368 "Minimum interval between consecutive SPFs in seconds\n")
2369
2370 static int
2371 set_lsp_max_lifetime (struct vty *vty, struct isis_area *area,
2372 uint16_t interval, int level)
2373 {
2374 int lvl;
2375 int set_refresh_interval[ISIS_LEVELS] = {0, 0};
2376 uint16_t refresh_interval;
2377
2378 refresh_interval = interval - 300;
2379
2380 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2381 {
2382 if (!(lvl & level))
2383 continue;
2384 if (refresh_interval < area->lsp_refresh[lvl-1])
2385 {
2386 vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
2387 "the configured LSP refresh interval %us%s",
2388 lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
2389 vty_out (vty, "Automatically reducing level %d LSP refresh interval "
2390 "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
2391 set_refresh_interval[lvl-1] = 1;
2392
2393 if (refresh_interval <= area->lsp_gen_interval[lvl-1])
2394 {
2395 vty_out (vty, "LSP refresh interval %us must be greater than "
2396 "the configured LSP gen interval %us%s",
2397 refresh_interval, area->lsp_gen_interval[lvl-1],
2398 VTY_NEWLINE);
2399 return CMD_ERR_AMBIGUOUS;
2400 }
2401 }
2402 }
2403
2404 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
2405 {
2406 if (!(lvl & level))
2407 continue;
2408 area->max_lsp_lifetime[lvl-1] = interval;
2409 /* Automatically reducing lsp_refresh_interval to interval - 300 */
2410 if (set_refresh_interval[lvl-1])
2411 area->lsp_refresh[lvl-1] = refresh_interval;
2412 }
2413
2414 lsp_regenerate_schedule (area, level, 1);
2415
2416 return CMD_SUCCESS;
2417 }
2418
2419 DEFUN (max_lsp_lifetime,
2420 max_lsp_lifetime_cmd,
2421 "max-lsp-lifetime <350-65535>",
2422 "Maximum LSP lifetime\n"
2423 "LSP lifetime in seconds\n")
2424 {
2425 struct isis_area *area;
2426 uint16_t interval;
2427 int level;
2428
2429 area = vty->index;
2430 interval = atoi (argv[0]);
2431 level = IS_LEVEL_1 | IS_LEVEL_2;
2432 return set_lsp_max_lifetime (vty, area, interval, level);
2433 }
2434
2435 DEFUN (no_max_lsp_lifetime,
2436 no_max_lsp_lifetime_cmd,
2437 "no max-lsp-lifetime",
2438 NO_STR
2439 "LSP lifetime in seconds\n")
2440 {
2441 struct isis_area *area;
2442 uint16_t interval;
2443 int level;
2444
2445 area = vty->index;
2446 interval = DEFAULT_LSP_LIFETIME;
2447 level = IS_LEVEL_1 | IS_LEVEL_2;
2448 return set_lsp_max_lifetime (vty, area, interval, level);
2449 }
2450
2451 ALIAS (no_max_lsp_lifetime,
2452 no_max_lsp_lifetime_arg_cmd,
2453 "no max-lsp-lifetime <350-65535>",
2454 NO_STR
2455 "Maximum LSP lifetime\n"
2456 "LSP lifetime in seconds\n")
2457
2458 DEFUN (max_lsp_lifetime_l1,
2459 max_lsp_lifetime_l1_cmd,
2460 "max-lsp-lifetime level-1 <350-65535>",
2461 "Maximum LSP lifetime for Level 1 only\n"
2462 "LSP lifetime for Level 1 only in seconds\n")
2463 {
2464 struct isis_area *area;
2465 uint16_t interval;
2466 int level;
2467
2468 area = vty->index;
2469 interval = atoi (argv[0]);
2470 level = IS_LEVEL_1;
2471 return set_lsp_max_lifetime (vty, area, interval, level);
2472 }
2473
2474 DEFUN (no_max_lsp_lifetime_l1,
2475 no_max_lsp_lifetime_l1_cmd,
2476 "no max-lsp-lifetime level-1",
2477 NO_STR
2478 "LSP lifetime for Level 1 only in seconds\n")
2479 {
2480 struct isis_area *area;
2481 uint16_t interval;
2482 int level;
2483
2484 area = vty->index;
2485 interval = DEFAULT_LSP_LIFETIME;
2486 level = IS_LEVEL_1;
2487 return set_lsp_max_lifetime (vty, area, interval, level);
2488 }
2489
2490 ALIAS (no_max_lsp_lifetime_l1,
2491 no_max_lsp_lifetime_l1_arg_cmd,
2492 "no max-lsp-lifetime level-1 <350-65535>",
2493 NO_STR
2494 "Maximum LSP lifetime for Level 1 only\n"
2495 "LSP lifetime for Level 1 only in seconds\n")
2496
2497 DEFUN (max_lsp_lifetime_l2,
2498 max_lsp_lifetime_l2_cmd,
2499 "max-lsp-lifetime level-2 <350-65535>",
2500 "Maximum LSP lifetime for Level 2 only\n"
2501 "LSP lifetime for Level 2 only in seconds\n")
2502 {
2503 struct isis_area *area;
2504 uint16_t interval;
2505 int level;
2506
2507 area = vty->index;
2508 interval = atoi (argv[0]);
2509 level = IS_LEVEL_2;
2510 return set_lsp_max_lifetime (vty, area, interval, level);
2511 }
2512
2513 DEFUN (no_max_lsp_lifetime_l2,
2514 no_max_lsp_lifetime_l2_cmd,
2515 "no max-lsp-lifetime level-2",
2516 NO_STR
2517 "LSP lifetime for Level 2 only in seconds\n")
2518 {
2519 struct isis_area *area;
2520 uint16_t interval;
2521 int level;
2522
2523 area = vty->index;
2524 interval = DEFAULT_LSP_LIFETIME;
2525 level = IS_LEVEL_2;
2526 return set_lsp_max_lifetime (vty, area, interval, level);
2527 }
2528
2529 ALIAS (no_max_lsp_lifetime_l2,
2530 no_max_lsp_lifetime_l2_arg_cmd,
2531 "no max-lsp-lifetime level-2 <350-65535>",
2532 NO_STR
2533 "Maximum LSP lifetime for Level 2 only\n"
2534 "LSP lifetime for Level 2 only in seconds\n")
2535
2536 static int
2537 set_lsp_refresh_interval (struct vty *vty, struct isis_area *area,
2538 uint16_t interval, int level)
2539 {
2540 int lvl;
2541
2542 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2543 {
2544 if (!(lvl & level))
2545 continue;
2546 if (interval <= area->lsp_gen_interval[lvl-1])
2547 {
2548 vty_out (vty, "LSP refresh interval %us must be greater than "
2549 "the configured LSP gen interval %us%s",
2550 interval, area->lsp_gen_interval[lvl-1],
2551 VTY_NEWLINE);
2552 return CMD_ERR_AMBIGUOUS;
2553 }
2554 if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
2555 {
2556 vty_out (vty, "LSP refresh interval %us must be less than "
2557 "the configured LSP lifetime %us less 300%s",
2558 interval, area->max_lsp_lifetime[lvl-1],
2559 VTY_NEWLINE);
2560 return CMD_ERR_AMBIGUOUS;
2561 }
2562 }
2563
2564 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2565 {
2566 if (!(lvl & level))
2567 continue;
2568 area->lsp_refresh[lvl-1] = interval;
2569 }
2570 lsp_regenerate_schedule (area, level, 1);
2571
2572 return CMD_SUCCESS;
2573 }
2574
2575 DEFUN (lsp_refresh_interval,
2576 lsp_refresh_interval_cmd,
2577 "lsp-refresh-interval <1-65235>",
2578 "LSP refresh interval\n"
2579 "LSP refresh interval in seconds\n")
2580 {
2581 struct isis_area *area;
2582 uint16_t interval;
2583 int level;
2584
2585 area = vty->index;
2586 interval = atoi (argv[0]);
2587 level = IS_LEVEL_1 | IS_LEVEL_2;
2588 return set_lsp_refresh_interval (vty, area, interval, level);
2589 }
2590
2591 DEFUN (no_lsp_refresh_interval,
2592 no_lsp_refresh_interval_cmd,
2593 "no lsp-refresh-interval",
2594 NO_STR
2595 "LSP refresh interval in seconds\n")
2596 {
2597 struct isis_area *area;
2598 uint16_t interval;
2599 int level;
2600
2601 area = vty->index;
2602 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2603 level = IS_LEVEL_1 | IS_LEVEL_2;
2604 return set_lsp_refresh_interval (vty, area, interval, level);
2605 }
2606
2607 ALIAS (no_lsp_refresh_interval,
2608 no_lsp_refresh_interval_arg_cmd,
2609 "no lsp-refresh-interval <1-65235>",
2610 NO_STR
2611 "LSP refresh interval\n"
2612 "LSP refresh interval in seconds\n")
2613
2614 DEFUN (lsp_refresh_interval_l1,
2615 lsp_refresh_interval_l1_cmd,
2616 "lsp-refresh-interval level-1 <1-65235>",
2617 "LSP refresh interval for Level 1 only\n"
2618 "LSP refresh interval for Level 1 only in seconds\n")
2619 {
2620 struct isis_area *area;
2621 uint16_t interval;
2622 int level;
2623
2624 area = vty->index;
2625 interval = atoi (argv[0]);
2626 level = IS_LEVEL_1;
2627 return set_lsp_refresh_interval (vty, area, interval, level);
2628 }
2629
2630 DEFUN (no_lsp_refresh_interval_l1,
2631 no_lsp_refresh_interval_l1_cmd,
2632 "no lsp-refresh-interval level-1",
2633 NO_STR
2634 "LSP refresh interval for Level 1 only in seconds\n")
2635 {
2636 struct isis_area *area;
2637 uint16_t interval;
2638 int level;
2639
2640 area = vty->index;
2641 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2642 level = IS_LEVEL_1;
2643 return set_lsp_refresh_interval (vty, area, interval, level);
2644 }
2645
2646 ALIAS (no_lsp_refresh_interval_l1,
2647 no_lsp_refresh_interval_l1_arg_cmd,
2648 "no lsp-refresh-interval level-1 <1-65235>",
2649 NO_STR
2650 "LSP refresh interval for Level 1 only\n"
2651 "LSP refresh interval for Level 1 only in seconds\n")
2652
2653 DEFUN (lsp_refresh_interval_l2,
2654 lsp_refresh_interval_l2_cmd,
2655 "lsp-refresh-interval level-2 <1-65235>",
2656 "LSP refresh interval for Level 2 only\n"
2657 "LSP refresh interval for Level 2 only in seconds\n")
2658 {
2659 struct isis_area *area;
2660 uint16_t interval;
2661 int level;
2662
2663 area = vty->index;
2664 interval = atoi (argv[0]);
2665 level = IS_LEVEL_2;
2666 return set_lsp_refresh_interval (vty, area, interval, level);
2667 }
2668
2669 DEFUN (no_lsp_refresh_interval_l2,
2670 no_lsp_refresh_interval_l2_cmd,
2671 "no lsp-refresh-interval level-2",
2672 NO_STR
2673 "LSP refresh interval for Level 2 only in seconds\n")
2674 {
2675 struct isis_area *area;
2676 uint16_t interval;
2677 int level;
2678
2679 area = vty->index;
2680 interval = DEFAULT_MAX_LSP_GEN_INTERVAL;
2681 level = IS_LEVEL_2;
2682 return set_lsp_refresh_interval (vty, area, interval, level);
2683 }
2684
2685 ALIAS (no_lsp_refresh_interval_l2,
2686 no_lsp_refresh_interval_l2_arg_cmd,
2687 "no lsp-refresh-interval level-2 <1-65235>",
2688 NO_STR
2689 "LSP refresh interval for Level 2 only\n"
2690 "LSP refresh interval for Level 2 only in seconds\n")
2691
2692 DEFUN (log_adj_changes,
2693 log_adj_changes_cmd,
2694 "log-adjacency-changes",
2695 "Log changes in adjacency state\n")
2696 {
2697 struct isis_area *area;
2698
2699 area = vty->index;
2700 assert (area);
2701
2702 area->log_adj_changes = 1;
2703
2704 return CMD_SUCCESS;
2705 }
2706
2707 DEFUN (no_log_adj_changes,
2708 no_log_adj_changes_cmd,
2709 "no log-adjacency-changes",
2710 "Stop logging changes in adjacency state\n")
2711 {
2712 struct isis_area *area;
2713
2714 area = vty->index;
2715 assert (area);
2716
2717 area->log_adj_changes = 0;
2718
2719 return CMD_SUCCESS;
2720 }
2721
2722 #ifdef TOPOLOGY_GENERATE
2723
2724 DEFUN (topology_generate_grid,
2725 topology_generate_grid_cmd,
2726 "topology generate grid <1-100> <1-100> <1-65000> [param] [param] "
2727 "[param]",
2728 "Topology generation for IS-IS\n"
2729 "Topology generation\n"
2730 "Grid topology\n"
2731 "X parameter of the grid\n"
2732 "Y parameter of the grid\n"
2733 "Random seed\n"
2734 "Optional param 1\n"
2735 "Optional param 2\n"
2736 "Optional param 3\n"
2737 "Topology\n")
2738 {
2739 struct isis_area *area;
2740
2741 area = vty->index;
2742 assert (area);
2743
2744 if (!spgrid_check_params (vty, argc, argv))
2745 {
2746 if (area->topology)
2747 list_delete (area->topology);
2748 area->topology = list_new ();
2749 memcpy (area->top_params, vty->buf, 200);
2750 gen_spgrid_topology (vty, area->topology);
2751 remove_topology_lsps (area);
2752 generate_topology_lsps (area);
2753 /* Regenerate L1 LSP to get two way connection to the generated
2754 * topology. */
2755 lsp_regenerate_schedule (area, IS_LEVEL_1 | IS_LEVEL_2, 1);
2756 }
2757
2758 return CMD_SUCCESS;
2759 }
2760
2761 DEFUN (show_isis_generated_topology,
2762 show_isis_generated_topology_cmd,
2763 "show isis generated-topologies",
2764 SHOW_STR
2765 "ISIS network information\n"
2766 "Show generated topologies\n")
2767 {
2768 struct isis_area *area;
2769 struct listnode *node;
2770 struct listnode *node2;
2771 struct arc *arc;
2772
2773 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
2774 {
2775 if (!area->topology)
2776 continue;
2777
2778 vty_out (vty, "Topology for isis area: %s%s", area->area_tag,
2779 VTY_NEWLINE);
2780 vty_out (vty, "From node To node Distance%s", VTY_NEWLINE);
2781
2782 for (ALL_LIST_ELEMENTS_RO (area->topology, node2, arc))
2783 vty_out (vty, "%9ld %11ld %12ld%s", arc->from_node, arc->to_node,
2784 arc->distance, VTY_NEWLINE);
2785 }
2786 return CMD_SUCCESS;
2787 }
2788
2789 /* Base IS for topology generation. */
2790 DEFUN (topology_baseis,
2791 topology_baseis_cmd,
2792 "topology base-is WORD",
2793 "Topology generation for IS-IS\n"
2794 "A Network IS Base for this topology\n"
2795 "XXXX.XXXX.XXXX Network entity title (NET)\n")
2796 {
2797 struct isis_area *area;
2798 u_char buff[ISIS_SYS_ID_LEN];
2799
2800 area = vty->index;
2801 assert (area);
2802
2803 if (sysid2buff (buff, argv[0]))
2804 sysid2buff (area->topology_baseis, argv[0]);
2805
2806 return CMD_SUCCESS;
2807 }
2808
2809 DEFUN (no_topology_baseis,
2810 no_topology_baseis_cmd,
2811 "no topology base-is WORD",
2812 NO_STR
2813 "Topology generation for IS-IS\n"
2814 "A Network IS Base for this topology\n"
2815 "XXXX.XXXX.XXXX Network entity title (NET)\n")
2816 {
2817 struct isis_area *area;
2818
2819 area = vty->index;
2820 assert (area);
2821
2822 memcpy (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS, ISIS_SYS_ID_LEN);
2823 return CMD_SUCCESS;
2824 }
2825
2826 ALIAS (no_topology_baseis,
2827 no_topology_baseis_noid_cmd,
2828 "no topology base-is",
2829 NO_STR
2830 "Topology generation for IS-IS\n"
2831 "A Network IS Base for this topology\n")
2832
2833 DEFUN (topology_basedynh,
2834 topology_basedynh_cmd,
2835 "topology base-dynh WORD",
2836 "Topology generation for IS-IS\n"
2837 "Dynamic hostname base for this topology\n"
2838 "Dynamic hostname base\n")
2839 {
2840 struct isis_area *area;
2841
2842 area = vty->index;
2843 assert (area);
2844
2845 /* I hope that it's enough. */
2846 area->topology_basedynh = strndup (argv[0], 16);
2847 return CMD_SUCCESS;
2848 }
2849
2850 #endif /* TOPOLOGY_GENERATE */
2851
2852 /* IS-IS configuration write function */
2853 int
2854 isis_config_write (struct vty *vty)
2855 {
2856 int write = 0;
2857
2858 if (isis != NULL)
2859 {
2860 struct isis_area *area;
2861 struct listnode *node, *node2;
2862
2863 for (ALL_LIST_ELEMENTS_RO (isis->area_list, node, area))
2864 {
2865 /* ISIS - Area name */
2866 vty_out (vty, "router isis %s%s", area->area_tag, VTY_NEWLINE);
2867 write++;
2868 /* ISIS - Net */
2869 if (listcount (area->area_addrs) > 0)
2870 {
2871 struct area_addr *area_addr;
2872 for (ALL_LIST_ELEMENTS_RO (area->area_addrs, node2, area_addr))
2873 {
2874 vty_out (vty, " net %s%s",
2875 isonet_print (area_addr->area_addr,
2876 area_addr->addr_len + ISIS_SYS_ID_LEN +
2877 1), VTY_NEWLINE);
2878 write++;
2879 }
2880 }
2881 /* ISIS - Dynamic hostname - Defaults to true so only display if
2882 * false. */
2883 if (!area->dynhostname)
2884 {
2885 vty_out (vty, " no hostname dynamic%s", VTY_NEWLINE);
2886 write++;
2887 }
2888 /* ISIS - Metric-Style - when true displays wide */
2889 if (area->newmetric)
2890 {
2891 if (!area->oldmetric)
2892 vty_out (vty, " metric-style wide%s", VTY_NEWLINE);
2893 else
2894 vty_out (vty, " metric-style transition%s", VTY_NEWLINE);
2895 write++;
2896 }
2897 else
2898 {
2899 vty_out (vty, " metric-style narrow%s", VTY_NEWLINE);
2900 write++;
2901 }
2902 /* ISIS - overload-bit */
2903 if (area->overload_bit)
2904 {
2905 vty_out (vty, " set-overload-bit%s", VTY_NEWLINE);
2906 write++;
2907 }
2908 /* ISIS - Area is-type (level-1-2 is default) */
2909 if (area->is_type == IS_LEVEL_1)
2910 {
2911 vty_out (vty, " is-type level-1%s", VTY_NEWLINE);
2912 write++;
2913 }
2914 else if (area->is_type == IS_LEVEL_2)
2915 {
2916 vty_out (vty, " is-type level-2-only%s", VTY_NEWLINE);
2917 write++;
2918 }
2919 /* ISIS - Lsp generation interval */
2920 if (area->lsp_gen_interval[0] == area->lsp_gen_interval[1])
2921 {
2922 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
2923 {
2924 vty_out (vty, " lsp-gen-interval %d%s",
2925 area->lsp_gen_interval[0], VTY_NEWLINE);
2926 write++;
2927 }
2928 }
2929 else
2930 {
2931 if (area->lsp_gen_interval[0] != DEFAULT_MIN_LSP_GEN_INTERVAL)
2932 {
2933 vty_out (vty, " lsp-gen-interval level-1 %d%s",
2934 area->lsp_gen_interval[0], VTY_NEWLINE);
2935 write++;
2936 }
2937 if (area->lsp_gen_interval[1] != DEFAULT_MIN_LSP_GEN_INTERVAL)
2938 {
2939 vty_out (vty, " lsp-gen-interval level-2 %d%s",
2940 area->lsp_gen_interval[1], VTY_NEWLINE);
2941 write++;
2942 }
2943 }
2944 /* ISIS - LSP lifetime */
2945 if (area->max_lsp_lifetime[0] == area->max_lsp_lifetime[1])
2946 {
2947 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
2948 {
2949 vty_out (vty, " max-lsp-lifetime %u%s", area->max_lsp_lifetime[0],
2950 VTY_NEWLINE);
2951 write++;
2952 }
2953 }
2954 else
2955 {
2956 if (area->max_lsp_lifetime[0] != DEFAULT_LSP_LIFETIME)
2957 {
2958 vty_out (vty, " max-lsp-lifetime level-1 %u%s",
2959 area->max_lsp_lifetime[0], VTY_NEWLINE);
2960 write++;
2961 }
2962 if (area->max_lsp_lifetime[1] != DEFAULT_LSP_LIFETIME)
2963 {
2964 vty_out (vty, " max-lsp-lifetime level-2 %u%s",
2965 area->max_lsp_lifetime[1], VTY_NEWLINE);
2966 write++;
2967 }
2968 }
2969 /* ISIS - LSP refresh interval */
2970 if (area->lsp_refresh[0] == area->lsp_refresh[1])
2971 {
2972 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
2973 {
2974 vty_out (vty, " lsp-refresh-interval %u%s", area->lsp_refresh[0],
2975 VTY_NEWLINE);
2976 write++;
2977 }
2978 }
2979 else
2980 {
2981 if (area->lsp_refresh[0] != DEFAULT_MAX_LSP_GEN_INTERVAL)
2982 {
2983 vty_out (vty, " lsp-refresh-interval level-1 %u%s",
2984 area->lsp_refresh[0], VTY_NEWLINE);
2985 write++;
2986 }
2987 if (area->lsp_refresh[1] != DEFAULT_MAX_LSP_GEN_INTERVAL)
2988 {
2989 vty_out (vty, " lsp-refresh-interval level-2 %u%s",
2990 area->lsp_refresh[1], VTY_NEWLINE);
2991 write++;
2992 }
2993 }
2994 /* Minimum SPF interval. */
2995 if (area->min_spf_interval[0] == area->min_spf_interval[1])
2996 {
2997 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
2998 {
2999 vty_out (vty, " spf-interval %d%s",
3000 area->min_spf_interval[0], VTY_NEWLINE);
3001 write++;
3002 }
3003 }
3004 else
3005 {
3006 if (area->min_spf_interval[0] != MINIMUM_SPF_INTERVAL)
3007 {
3008 vty_out (vty, " spf-interval level-1 %d%s",
3009 area->min_spf_interval[0], VTY_NEWLINE);
3010 write++;
3011 }
3012 if (area->min_spf_interval[1] != MINIMUM_SPF_INTERVAL)
3013 {
3014 vty_out (vty, " spf-interval level-2 %d%s",
3015 area->min_spf_interval[1], VTY_NEWLINE);
3016 write++;
3017 }
3018 }
3019 /* Authentication passwords. */
3020 if (area->area_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
3021 {
3022 vty_out(vty, " area-password md5 %s", area->area_passwd.passwd);
3023 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3024 {
3025 vty_out(vty, " authenticate snp ");
3026 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3027 vty_out(vty, "validate");
3028 else
3029 vty_out(vty, "send-only");
3030 }
3031 vty_out(vty, "%s", VTY_NEWLINE);
3032 write++;
3033 }
3034 else if (area->area_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3035 {
3036 vty_out(vty, " area-password clear %s", area->area_passwd.passwd);
3037 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_SEND))
3038 {
3039 vty_out(vty, " authenticate snp ");
3040 if (CHECK_FLAG(area->area_passwd.snp_auth, SNP_AUTH_RECV))
3041 vty_out(vty, "validate");
3042 else
3043 vty_out(vty, "send-only");
3044 }
3045 vty_out(vty, "%s", VTY_NEWLINE);
3046 write++;
3047 }
3048 if (area->domain_passwd.type == ISIS_PASSWD_TYPE_HMAC_MD5)
3049 {
3050 vty_out(vty, " domain-password md5 %s",
3051 area->domain_passwd.passwd);
3052 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3053 {
3054 vty_out(vty, " authenticate snp ");
3055 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3056 vty_out(vty, "validate");
3057 else
3058 vty_out(vty, "send-only");
3059 }
3060 vty_out(vty, "%s", VTY_NEWLINE);
3061 write++;
3062 }
3063 else if (area->domain_passwd.type == ISIS_PASSWD_TYPE_CLEARTXT)
3064 {
3065 vty_out(vty, " domain-password clear %s",
3066 area->domain_passwd.passwd);
3067 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_SEND))
3068 {
3069 vty_out(vty, " authenticate snp ");
3070 if (CHECK_FLAG(area->domain_passwd.snp_auth, SNP_AUTH_RECV))
3071 vty_out(vty, "validate");
3072 else
3073 vty_out(vty, "send-only");
3074 }
3075 vty_out(vty, "%s", VTY_NEWLINE);
3076 write++;
3077 }
3078
3079 if (area->log_adj_changes)
3080 {
3081 vty_out (vty, " log-adjacency-changes%s", VTY_NEWLINE);
3082 write++;
3083 }
3084
3085 #ifdef TOPOLOGY_GENERATE
3086 if (memcmp (area->topology_baseis, DEFAULT_TOPOLOGY_BASEIS,
3087 ISIS_SYS_ID_LEN))
3088 {
3089 vty_out (vty, " topology base-is %s%s",
3090 sysid_print ((u_char *)area->topology_baseis), VTY_NEWLINE);
3091 write++;
3092 }
3093 if (area->topology_basedynh)
3094 {
3095 vty_out (vty, " topology base-dynh %s%s",
3096 area->topology_basedynh, VTY_NEWLINE);
3097 write++;
3098 }
3099 /* We save the whole command line here. */
3100 if (strlen(area->top_params))
3101 {
3102 vty_out (vty, " %s%s", area->top_params, VTY_NEWLINE);
3103 write++;
3104 }
3105 #endif /* TOPOLOGY_GENERATE */
3106
3107 }
3108 }
3109
3110 return write;
3111 }
3112
3113 struct cmd_node isis_node = {
3114 ISIS_NODE,
3115 "%s(config-router)# ",
3116 1
3117 };
3118
3119 void
3120 isis_init ()
3121 {
3122 /* Install IS-IS top node */
3123 install_node (&isis_node, isis_config_write);
3124
3125 install_element (VIEW_NODE, &show_isis_summary_cmd);
3126
3127 install_element (VIEW_NODE, &show_isis_interface_cmd);
3128 install_element (VIEW_NODE, &show_isis_interface_detail_cmd);
3129 install_element (VIEW_NODE, &show_isis_interface_arg_cmd);
3130
3131 install_element (VIEW_NODE, &show_isis_neighbor_cmd);
3132 install_element (VIEW_NODE, &show_isis_neighbor_detail_cmd);
3133 install_element (VIEW_NODE, &show_isis_neighbor_arg_cmd);
3134 install_element (VIEW_NODE, &clear_isis_neighbor_cmd);
3135 install_element (VIEW_NODE, &clear_isis_neighbor_arg_cmd);
3136
3137 install_element (VIEW_NODE, &show_hostname_cmd);
3138 install_element (VIEW_NODE, &show_database_cmd);
3139 install_element (VIEW_NODE, &show_database_arg_cmd);
3140 install_element (VIEW_NODE, &show_database_arg_detail_cmd);
3141 install_element (VIEW_NODE, &show_database_detail_cmd);
3142 install_element (VIEW_NODE, &show_database_detail_arg_cmd);
3143
3144 install_element (ENABLE_NODE, &show_isis_summary_cmd);
3145
3146 install_element (ENABLE_NODE, &show_isis_interface_cmd);
3147 install_element (ENABLE_NODE, &show_isis_interface_detail_cmd);
3148 install_element (ENABLE_NODE, &show_isis_interface_arg_cmd);
3149
3150 install_element (ENABLE_NODE, &show_isis_neighbor_cmd);
3151 install_element (ENABLE_NODE, &show_isis_neighbor_detail_cmd);
3152 install_element (ENABLE_NODE, &show_isis_neighbor_arg_cmd);
3153 install_element (ENABLE_NODE, &clear_isis_neighbor_cmd);
3154 install_element (ENABLE_NODE, &clear_isis_neighbor_arg_cmd);
3155
3156 install_element (ENABLE_NODE, &show_hostname_cmd);
3157 install_element (ENABLE_NODE, &show_database_cmd);
3158 install_element (ENABLE_NODE, &show_database_arg_cmd);
3159 install_element (ENABLE_NODE, &show_database_arg_detail_cmd);
3160 install_element (ENABLE_NODE, &show_database_detail_cmd);
3161 install_element (ENABLE_NODE, &show_database_detail_arg_cmd);
3162 install_element (ENABLE_NODE, &show_debugging_cmd);
3163
3164 install_node (&debug_node, config_write_debug);
3165
3166 install_element (ENABLE_NODE, &debug_isis_adj_cmd);
3167 install_element (ENABLE_NODE, &no_debug_isis_adj_cmd);
3168 install_element (ENABLE_NODE, &debug_isis_csum_cmd);
3169 install_element (ENABLE_NODE, &no_debug_isis_csum_cmd);
3170 install_element (ENABLE_NODE, &debug_isis_lupd_cmd);
3171 install_element (ENABLE_NODE, &no_debug_isis_lupd_cmd);
3172 install_element (ENABLE_NODE, &debug_isis_err_cmd);
3173 install_element (ENABLE_NODE, &no_debug_isis_err_cmd);
3174 install_element (ENABLE_NODE, &debug_isis_snp_cmd);
3175 install_element (ENABLE_NODE, &no_debug_isis_snp_cmd);
3176 install_element (ENABLE_NODE, &debug_isis_upd_cmd);
3177 install_element (ENABLE_NODE, &no_debug_isis_upd_cmd);
3178 install_element (ENABLE_NODE, &debug_isis_spfevents_cmd);
3179 install_element (ENABLE_NODE, &no_debug_isis_spfevents_cmd);
3180 install_element (ENABLE_NODE, &debug_isis_spfstats_cmd);
3181 install_element (ENABLE_NODE, &no_debug_isis_spfstats_cmd);
3182 install_element (ENABLE_NODE, &debug_isis_spftrigg_cmd);
3183 install_element (ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
3184 install_element (ENABLE_NODE, &debug_isis_rtevents_cmd);
3185 install_element (ENABLE_NODE, &no_debug_isis_rtevents_cmd);
3186 install_element (ENABLE_NODE, &debug_isis_events_cmd);
3187 install_element (ENABLE_NODE, &no_debug_isis_events_cmd);
3188 install_element (ENABLE_NODE, &debug_isis_packet_dump_cmd);
3189 install_element (ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
3190
3191 install_element (CONFIG_NODE, &debug_isis_adj_cmd);
3192 install_element (CONFIG_NODE, &no_debug_isis_adj_cmd);
3193 install_element (CONFIG_NODE, &debug_isis_csum_cmd);
3194 install_element (CONFIG_NODE, &no_debug_isis_csum_cmd);
3195 install_element (CONFIG_NODE, &debug_isis_lupd_cmd);
3196 install_element (CONFIG_NODE, &no_debug_isis_lupd_cmd);
3197 install_element (CONFIG_NODE, &debug_isis_err_cmd);
3198 install_element (CONFIG_NODE, &no_debug_isis_err_cmd);
3199 install_element (CONFIG_NODE, &debug_isis_snp_cmd);
3200 install_element (CONFIG_NODE, &no_debug_isis_snp_cmd);
3201 install_element (CONFIG_NODE, &debug_isis_upd_cmd);
3202 install_element (CONFIG_NODE, &no_debug_isis_upd_cmd);
3203 install_element (CONFIG_NODE, &debug_isis_spfevents_cmd);
3204 install_element (CONFIG_NODE, &no_debug_isis_spfevents_cmd);
3205 install_element (CONFIG_NODE, &debug_isis_spfstats_cmd);
3206 install_element (CONFIG_NODE, &no_debug_isis_spfstats_cmd);
3207 install_element (CONFIG_NODE, &debug_isis_spftrigg_cmd);
3208 install_element (CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
3209 install_element (CONFIG_NODE, &debug_isis_rtevents_cmd);
3210 install_element (CONFIG_NODE, &no_debug_isis_rtevents_cmd);
3211 install_element (CONFIG_NODE, &debug_isis_events_cmd);
3212 install_element (CONFIG_NODE, &no_debug_isis_events_cmd);
3213 install_element (CONFIG_NODE, &debug_isis_packet_dump_cmd);
3214 install_element (CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
3215
3216 install_element (CONFIG_NODE, &router_isis_cmd);
3217 install_element (CONFIG_NODE, &no_router_isis_cmd);
3218
3219 install_default (ISIS_NODE);
3220
3221 install_element (ISIS_NODE, &net_cmd);
3222 install_element (ISIS_NODE, &no_net_cmd);
3223
3224 install_element (ISIS_NODE, &is_type_cmd);
3225 install_element (ISIS_NODE, &no_is_type_cmd);
3226
3227 install_element (ISIS_NODE, &area_passwd_md5_cmd);
3228 install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd);
3229 install_element (ISIS_NODE, &area_passwd_clear_cmd);
3230 install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd);
3231 install_element (ISIS_NODE, &no_area_passwd_cmd);
3232
3233 install_element (ISIS_NODE, &domain_passwd_md5_cmd);
3234 install_element (ISIS_NODE, &domain_passwd_md5_snpauth_cmd);
3235 install_element (ISIS_NODE, &domain_passwd_clear_cmd);
3236 install_element (ISIS_NODE, &domain_passwd_clear_snpauth_cmd);
3237 install_element (ISIS_NODE, &no_domain_passwd_cmd);
3238
3239 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
3240 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
3241 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
3242 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
3243 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
3244 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
3245 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
3246 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
3247 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
3248
3249 install_element (ISIS_NODE, &spf_interval_cmd);
3250 install_element (ISIS_NODE, &no_spf_interval_cmd);
3251 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
3252 install_element (ISIS_NODE, &spf_interval_l1_cmd);
3253 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
3254 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
3255 install_element (ISIS_NODE, &spf_interval_l2_cmd);
3256 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
3257 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
3258
3259 install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
3260 install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
3261 install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
3262 install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
3263 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
3264 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
3265 install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
3266 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
3267 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
3268
3269 install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
3270 install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
3271 install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
3272 install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
3273 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
3274 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
3275 install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
3276 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
3277 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
3278
3279 install_element (ISIS_NODE, &set_overload_bit_cmd);
3280 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
3281
3282 install_element (ISIS_NODE, &set_attached_bit_cmd);
3283 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
3284
3285 install_element (ISIS_NODE, &dynamic_hostname_cmd);
3286 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
3287
3288 install_element (ISIS_NODE, &metric_style_cmd);
3289 install_element (ISIS_NODE, &no_metric_style_cmd);
3290
3291 install_element (ISIS_NODE, &log_adj_changes_cmd);
3292 install_element (ISIS_NODE, &no_log_adj_changes_cmd);
3293
3294 #ifdef TOPOLOGY_GENERATE
3295 install_element (ISIS_NODE, &topology_generate_grid_cmd);
3296 install_element (ISIS_NODE, &topology_baseis_cmd);
3297 install_element (ISIS_NODE, &topology_basedynh_cmd);
3298 install_element (ISIS_NODE, &no_topology_baseis_cmd);
3299 install_element (ISIS_NODE, &no_topology_baseis_noid_cmd);
3300 install_element (VIEW_NODE, &show_isis_generated_topology_cmd);
3301 install_element (ENABLE_NODE, &show_isis_generated_topology_cmd);
3302 #endif /* TOPOLOGY_GENERATE */
3303 }