]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isisd.c
fabricd: adjust IS-IS defaults as per draft
[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; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 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 #include "qobj.h"
38 #include "spf_backoff.h"
39
40 #include "isisd/dict.h"
41 #include "isisd/isis_constants.h"
42 #include "isisd/isis_common.h"
43 #include "isisd/isis_flags.h"
44 #include "isisd/isis_circuit.h"
45 #include "isisd/isis_csm.h"
46 #include "isisd/isisd.h"
47 #include "isisd/isis_dynhn.h"
48 #include "isisd/isis_adjacency.h"
49 #include "isisd/isis_pdu.h"
50 #include "isisd/isis_misc.h"
51 #include "isisd/isis_constants.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 #include "isisd/isis_te.h"
58 #include "isisd/isis_mt.h"
59
60 struct isis *isis = NULL;
61
62 DEFINE_QOBJ_TYPE(isis)
63 DEFINE_QOBJ_TYPE(isis_area)
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 void isis_new(unsigned long process_id)
79 {
80 isis = XCALLOC(MTYPE_ISIS, sizeof(struct isis));
81 /*
82 * Default values
83 */
84 isis->max_area_addrs = 3;
85 isis->process_id = process_id;
86 isis->router_id = 0;
87 isis->area_list = list_new();
88 isis->init_circ_list = list_new();
89 isis->uptime = time(NULL);
90 isis->nexthops = list_new();
91 isis->nexthops6 = list_new();
92 dyn_cache_init();
93 /*
94 * uncomment the next line for full debugs
95 */
96 /* isis->debugs = 0xFFFF; */
97 isisMplsTE.status = disable; /* Only support TE metric */
98 QOBJ_REG(isis, isis);
99 }
100
101 struct isis_area *isis_area_create(const char *area_tag)
102 {
103 struct isis_area *area;
104
105 area = XCALLOC(MTYPE_ISIS_AREA, sizeof(struct isis_area));
106
107 /*
108 * Fabricd runs only as level-2.
109 * For IS-IS, the first instance is level-1-2 rest are level-1,
110 * unless otherwise configured
111 */
112 if (fabricd) {
113 area->is_type = IS_LEVEL_2;
114 } else 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 area->lspdb[0] = lsp_db_init();
124 }
125 if (area->is_type & IS_LEVEL_2) {
126 area->lspdb[1] = lsp_db_init();
127 }
128
129 spftree_area_init(area);
130
131 area->circuit_list = list_new();
132 area->area_addrs = list_new();
133 thread_add_timer(master, lsp_tick, area, 1, &area->t_tick);
134 flags_initialize(&area->flags);
135
136 /*
137 * Default values
138 */
139 area->max_lsp_lifetime[0] = DEFAULT_LSP_LIFETIME; /* 1200 */
140 area->max_lsp_lifetime[1] = DEFAULT_LSP_LIFETIME; /* 1200 */
141 area->lsp_refresh[0] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
142 area->lsp_refresh[1] = DEFAULT_MAX_LSP_GEN_INTERVAL; /* 900 */
143 area->lsp_gen_interval[0] = DEFAULT_MIN_LSP_GEN_INTERVAL;
144 area->lsp_gen_interval[1] = DEFAULT_MIN_LSP_GEN_INTERVAL;
145 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
146 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
147 area->dynhostname = 1;
148 area->oldmetric = 0;
149 area->newmetric = 1;
150 area->lsp_frag_threshold = 90;
151 area->lsp_mtu = DEFAULT_LSP_MTU;
152
153 area_mt_init(area);
154
155 area->area_tag = strdup(area_tag);
156 listnode_add(isis->area_list, area);
157 area->isis = isis;
158
159 QOBJ_REG(area, isis_area);
160
161 return area;
162 }
163
164 struct isis_area *isis_area_lookup(const char *area_tag)
165 {
166 struct isis_area *area;
167 struct listnode *node;
168
169 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area))
170 if ((area->area_tag == NULL && area_tag == NULL)
171 || (area->area_tag && area_tag
172 && strcmp(area->area_tag, area_tag) == 0))
173 return area;
174
175 return NULL;
176 }
177
178 int isis_area_get(struct vty *vty, const char *area_tag)
179 {
180 struct isis_area *area;
181
182 area = isis_area_lookup(area_tag);
183
184 if (area) {
185 VTY_PUSH_CONTEXT(ROUTER_NODE, area);
186 return CMD_SUCCESS;
187 }
188
189 area = isis_area_create(area_tag);
190
191 if (isis->debugs & DEBUG_EVENTS)
192 zlog_debug("New IS-IS area instance %s", area->area_tag);
193
194 VTY_PUSH_CONTEXT(ROUTER_NODE, area);
195
196 return CMD_SUCCESS;
197 }
198
199 int isis_area_destroy(struct vty *vty, const char *area_tag)
200 {
201 struct isis_area *area;
202 struct listnode *node, *nnode;
203 struct isis_circuit *circuit;
204 struct area_addr *addr;
205
206 area = isis_area_lookup(area_tag);
207
208 if (area == NULL) {
209 vty_out(vty, "Can't find ISIS instance \n");
210 return CMD_ERR_NO_MATCH;
211 }
212
213 QOBJ_UNREG(area);
214
215 if (area->circuit_list) {
216 for (ALL_LIST_ELEMENTS(area->circuit_list, node, nnode,
217 circuit)) {
218 circuit->ip_router = 0;
219 circuit->ipv6_router = 0;
220 isis_csm_state_change(ISIS_DISABLE, circuit, area);
221 }
222 list_delete_and_null(&area->circuit_list);
223 }
224
225 if (area->lspdb[0] != NULL) {
226 lsp_db_destroy(area->lspdb[0]);
227 area->lspdb[0] = NULL;
228 }
229 if (area->lspdb[1] != NULL) {
230 lsp_db_destroy(area->lspdb[1]);
231 area->lspdb[1] = NULL;
232 }
233
234 /* invalidate and verify to delete all routes from zebra */
235 isis_area_invalidate_routes(area, ISIS_LEVEL1 & ISIS_LEVEL2);
236 isis_area_verify_routes(area);
237
238 spftree_area_del(area);
239
240 THREAD_TIMER_OFF(area->spf_timer[0]);
241 THREAD_TIMER_OFF(area->spf_timer[1]);
242
243 spf_backoff_free(area->spf_delay_ietf[0]);
244 spf_backoff_free(area->spf_delay_ietf[1]);
245
246 isis_redist_area_finish(area);
247
248 for (ALL_LIST_ELEMENTS(area->area_addrs, node, nnode, addr)) {
249 list_delete_node(area->area_addrs, node);
250 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
251 }
252 area->area_addrs = NULL;
253
254 THREAD_TIMER_OFF(area->t_tick);
255 THREAD_TIMER_OFF(area->t_lsp_refresh[0]);
256 THREAD_TIMER_OFF(area->t_lsp_refresh[1]);
257
258 thread_cancel_event(master, area);
259
260 listnode_delete(isis->area_list, area);
261
262 free(area->area_tag);
263
264 area_mt_finish(area);
265
266 XFREE(MTYPE_ISIS_AREA, area);
267
268 if (listcount(isis->area_list) == 0) {
269 memset(isis->sysid, 0, ISIS_SYS_ID_LEN);
270 isis->sysid_set = 0;
271 }
272
273 return CMD_SUCCESS;
274 }
275
276 static void area_set_mt_enabled(struct isis_area *area, uint16_t mtid,
277 bool enabled)
278 {
279 struct isis_area_mt_setting *setting;
280
281 setting = area_get_mt_setting(area, mtid);
282 if (setting->enabled != enabled) {
283 setting->enabled = enabled;
284 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
285 }
286 }
287
288 static void area_set_mt_overload(struct isis_area *area, uint16_t mtid,
289 bool overload)
290 {
291 struct isis_area_mt_setting *setting;
292
293 setting = area_get_mt_setting(area, mtid);
294 if (setting->overload != overload) {
295 setting->overload = overload;
296 if (setting->enabled)
297 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2,
298 0);
299 }
300 }
301
302 int area_net_title(struct vty *vty, const char *net_title)
303 {
304 VTY_DECLVAR_CONTEXT(isis_area, area);
305 struct area_addr *addr;
306 struct area_addr *addrp;
307 struct listnode *node;
308
309 uint8_t buff[255];
310
311 /* We check that we are not over the maximal number of addresses */
312 if (listcount(area->area_addrs) >= isis->max_area_addrs) {
313 vty_out(vty,
314 "Maximum of area addresses (%d) already reached \n",
315 isis->max_area_addrs);
316 return CMD_ERR_NOTHING_TODO;
317 }
318
319 addr = XMALLOC(MTYPE_ISIS_AREA_ADDR, sizeof(struct area_addr));
320 addr->addr_len = dotformat2buff(buff, net_title);
321 memcpy(addr->area_addr, buff, addr->addr_len);
322 #ifdef EXTREME_DEBUG
323 zlog_debug("added area address %s for area %s (address length %d)",
324 net_title, area->area_tag, addr->addr_len);
325 #endif /* EXTREME_DEBUG */
326 if (addr->addr_len < 8 || addr->addr_len > 20) {
327 vty_out(vty,
328 "area address must be at least 8..20 octets long (%d)\n",
329 addr->addr_len);
330 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
331 return CMD_WARNING_CONFIG_FAILED;
332 }
333
334 if (addr->area_addr[addr->addr_len - 1] != 0) {
335 vty_out(vty,
336 "nsel byte (last byte) in area address must be 0\n");
337 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
338 return CMD_WARNING_CONFIG_FAILED;
339 }
340
341 if (isis->sysid_set == 0) {
342 /*
343 * First area address - get the SystemID for this router
344 */
345 memcpy(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN);
346 isis->sysid_set = 1;
347 if (isis->debugs & DEBUG_EVENTS)
348 zlog_debug("Router has SystemID %s",
349 sysid_print(isis->sysid));
350 } else {
351 /*
352 * Check that the SystemID portions match
353 */
354 if (memcmp(isis->sysid, GETSYSID(addr), ISIS_SYS_ID_LEN)) {
355 vty_out(vty,
356 "System ID must not change when defining additional area addresses\n");
357 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
358 return CMD_WARNING_CONFIG_FAILED;
359 }
360
361 /* now we see that we don't already have this address */
362 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp)) {
363 if ((addrp->addr_len + ISIS_SYS_ID_LEN + ISIS_NSEL_LEN)
364 != (addr->addr_len))
365 continue;
366 if (!memcmp(addrp->area_addr, addr->area_addr,
367 addr->addr_len)) {
368 XFREE(MTYPE_ISIS_AREA_ADDR, addr);
369 return CMD_SUCCESS; /* silent fail */
370 }
371 }
372 }
373
374 /*
375 * Forget the systemID part of the address
376 */
377 addr->addr_len -= (ISIS_SYS_ID_LEN + ISIS_NSEL_LEN);
378 listnode_add(area->area_addrs, addr);
379
380 /* only now we can safely generate our LSPs for this area */
381 if (listcount(area->area_addrs) > 0) {
382 if (area->is_type & IS_LEVEL_1)
383 lsp_generate(area, IS_LEVEL_1);
384 if (area->is_type & IS_LEVEL_2)
385 lsp_generate(area, IS_LEVEL_2);
386 }
387
388 return CMD_SUCCESS;
389 }
390
391 int area_clear_net_title(struct vty *vty, const char *net_title)
392 {
393 VTY_DECLVAR_CONTEXT(isis_area, area);
394 struct area_addr addr, *addrp = NULL;
395 struct listnode *node;
396 uint8_t buff[255];
397
398 addr.addr_len = dotformat2buff(buff, net_title);
399 if (addr.addr_len < 8 || addr.addr_len > 20) {
400 vty_out(vty,
401 "Unsupported area address length %d, should be 8...20 \n",
402 addr.addr_len);
403 return CMD_WARNING_CONFIG_FAILED;
404 }
405
406 memcpy(addr.area_addr, buff, (int)addr.addr_len);
407
408 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node, addrp))
409 if ((addrp->addr_len + ISIS_SYS_ID_LEN + 1) == addr.addr_len
410 && !memcmp(addrp->area_addr, addr.area_addr, addr.addr_len))
411 break;
412
413 if (!addrp) {
414 vty_out(vty, "No area address %s for area %s \n", net_title,
415 area->area_tag);
416 return CMD_ERR_NO_MATCH;
417 }
418
419 listnode_delete(area->area_addrs, addrp);
420 XFREE(MTYPE_ISIS_AREA_ADDR, addrp);
421
422 /*
423 * Last area address - reset the SystemID for this router
424 */
425 if (listcount(area->area_addrs) == 0) {
426 memset(isis->sysid, 0, ISIS_SYS_ID_LEN);
427 isis->sysid_set = 0;
428 if (isis->debugs & DEBUG_EVENTS)
429 zlog_debug("Router has no SystemID");
430 }
431
432 return CMD_SUCCESS;
433 }
434
435 /*
436 * 'show isis interface' command
437 */
438
439 int show_isis_interface_common(struct vty *vty, const char *ifname, char detail)
440 {
441 struct listnode *anode, *cnode;
442 struct isis_area *area;
443 struct isis_circuit *circuit;
444
445 if (!isis) {
446 vty_out(vty, "IS-IS Routing Process not enabled\n");
447 return CMD_SUCCESS;
448 }
449
450 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
451 vty_out(vty, "Area %s:\n", area->area_tag);
452
453 if (detail == ISIS_UI_LEVEL_BRIEF)
454 vty_out(vty,
455 " Interface CircId State Type Level\n");
456
457 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit))
458 if (!ifname)
459 isis_circuit_print_vty(circuit, vty, detail);
460 else if (strcmp(circuit->interface->name, ifname) == 0)
461 isis_circuit_print_vty(circuit, vty, detail);
462 }
463
464 return CMD_SUCCESS;
465 }
466
467 DEFUN (show_isis_interface,
468 show_isis_interface_cmd,
469 "show " PROTO_NAME " interface",
470 SHOW_STR
471 PROTO_HELP
472 "ISIS interface\n")
473 {
474 return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_BRIEF);
475 }
476
477 DEFUN (show_isis_interface_detail,
478 show_isis_interface_detail_cmd,
479 "show " PROTO_NAME " interface detail",
480 SHOW_STR
481 PROTO_HELP
482 "ISIS interface\n"
483 "show detailed information\n")
484 {
485 return show_isis_interface_common(vty, NULL, ISIS_UI_LEVEL_DETAIL);
486 }
487
488 DEFUN (show_isis_interface_arg,
489 show_isis_interface_arg_cmd,
490 "show " PROTO_NAME " interface WORD",
491 SHOW_STR
492 PROTO_HELP
493 "ISIS interface\n"
494 "ISIS interface name\n")
495 {
496 int idx_word = 3;
497 return show_isis_interface_common(vty, argv[idx_word]->arg,
498 ISIS_UI_LEVEL_DETAIL);
499 }
500
501 /*
502 * 'show isis neighbor' command
503 */
504
505 int show_isis_neighbor_common(struct vty *vty, const char *id, char detail)
506 {
507 struct listnode *anode, *cnode, *node;
508 struct isis_area *area;
509 struct isis_circuit *circuit;
510 struct list *adjdb;
511 struct isis_adjacency *adj;
512 struct isis_dynhn *dynhn;
513 uint8_t sysid[ISIS_SYS_ID_LEN];
514 int i;
515
516 if (!isis) {
517 vty_out(vty, "IS-IS Routing Process not enabled\n");
518 return CMD_SUCCESS;
519 }
520
521 memset(sysid, 0, ISIS_SYS_ID_LEN);
522 if (id) {
523 if (sysid2buff(sysid, id) == 0) {
524 dynhn = dynhn_find_by_name(id);
525 if (dynhn == NULL) {
526 vty_out(vty, "Invalid system id %s\n", id);
527 return CMD_SUCCESS;
528 }
529 memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN);
530 }
531 }
532
533 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
534 vty_out(vty, "Area %s:\n", area->area_tag);
535
536 if (detail == ISIS_UI_LEVEL_BRIEF)
537 vty_out(vty,
538 " System Id Interface L State Holdtime SNPA\n");
539
540 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, cnode, circuit)) {
541 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
542 for (i = 0; i < 2; i++) {
543 adjdb = circuit->u.bc.adjdb[i];
544 if (adjdb && adjdb->count) {
545 for (ALL_LIST_ELEMENTS_RO(
546 adjdb, node, adj))
547 if (!id
548 || !memcmp(adj->sysid,
549 sysid,
550 ISIS_SYS_ID_LEN))
551 isis_adj_print_vty(
552 adj,
553 vty,
554 detail);
555 }
556 }
557 } else if (circuit->circ_type == CIRCUIT_T_P2P
558 && circuit->u.p2p.neighbor) {
559 adj = circuit->u.p2p.neighbor;
560 if (!id
561 || !memcmp(adj->sysid, sysid,
562 ISIS_SYS_ID_LEN))
563 isis_adj_print_vty(adj, vty, detail);
564 }
565 }
566 }
567
568 return CMD_SUCCESS;
569 }
570
571 /*
572 * 'clear isis neighbor' command
573 */
574 int clear_isis_neighbor_common(struct vty *vty, const char *id)
575 {
576 struct listnode *anode, *cnode, *cnextnode, *node, *nnode;
577 struct isis_area *area;
578 struct isis_circuit *circuit;
579 struct list *adjdb;
580 struct isis_adjacency *adj;
581 struct isis_dynhn *dynhn;
582 uint8_t sysid[ISIS_SYS_ID_LEN];
583 int i;
584
585 if (!isis) {
586 vty_out(vty, "IS-IS Routing Process not enabled\n");
587 return CMD_SUCCESS;
588 }
589
590 memset(sysid, 0, ISIS_SYS_ID_LEN);
591 if (id) {
592 if (sysid2buff(sysid, id) == 0) {
593 dynhn = dynhn_find_by_name(id);
594 if (dynhn == NULL) {
595 vty_out(vty, "Invalid system id %s\n", id);
596 return CMD_SUCCESS;
597 }
598 memcpy(sysid, dynhn->id, ISIS_SYS_ID_LEN);
599 }
600 }
601
602 for (ALL_LIST_ELEMENTS_RO(isis->area_list, anode, area)) {
603 for (ALL_LIST_ELEMENTS(area->circuit_list, cnode, cnextnode,
604 circuit)) {
605 if (circuit->circ_type == CIRCUIT_T_BROADCAST) {
606 for (i = 0; i < 2; i++) {
607 adjdb = circuit->u.bc.adjdb[i];
608 if (adjdb && adjdb->count) {
609 for (ALL_LIST_ELEMENTS(
610 adjdb, node, nnode,
611 adj))
612 if (!id
613 || !memcmp(adj->sysid,
614 sysid,
615 ISIS_SYS_ID_LEN))
616 isis_adj_state_change(
617 adj,
618 ISIS_ADJ_DOWN,
619 "clear user request");
620 }
621 }
622 } else if (circuit->circ_type == CIRCUIT_T_P2P
623 && circuit->u.p2p.neighbor) {
624 adj = circuit->u.p2p.neighbor;
625 if (!id
626 || !memcmp(adj->sysid, sysid,
627 ISIS_SYS_ID_LEN))
628 isis_adj_state_change(
629 adj, ISIS_ADJ_DOWN,
630 "clear user request");
631 }
632 }
633 }
634
635 return CMD_SUCCESS;
636 }
637
638 DEFUN (show_isis_neighbor,
639 show_isis_neighbor_cmd,
640 "show " PROTO_NAME " neighbor",
641 SHOW_STR
642 PROTO_HELP
643 "ISIS neighbor adjacencies\n")
644 {
645 return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_BRIEF);
646 }
647
648 DEFUN (show_isis_neighbor_detail,
649 show_isis_neighbor_detail_cmd,
650 "show " PROTO_NAME " neighbor detail",
651 SHOW_STR
652 PROTO_HELP
653 "ISIS neighbor adjacencies\n"
654 "show detailed information\n")
655 {
656 return show_isis_neighbor_common(vty, NULL, ISIS_UI_LEVEL_DETAIL);
657 }
658
659 DEFUN (show_isis_neighbor_arg,
660 show_isis_neighbor_arg_cmd,
661 "show " PROTO_NAME " neighbor WORD",
662 SHOW_STR
663 PROTO_HELP
664 "ISIS neighbor adjacencies\n"
665 "System id\n")
666 {
667 int idx_word = 3;
668 return show_isis_neighbor_common(vty, argv[idx_word]->arg,
669 ISIS_UI_LEVEL_DETAIL);
670 }
671
672 DEFUN (clear_isis_neighbor,
673 clear_isis_neighbor_cmd,
674 "clear " PROTO_NAME " neighbor",
675 CLEAR_STR
676 PROTO_HELP
677 "ISIS neighbor adjacencies\n")
678 {
679 return clear_isis_neighbor_common(vty, NULL);
680 }
681
682 DEFUN (clear_isis_neighbor_arg,
683 clear_isis_neighbor_arg_cmd,
684 "clear " PROTO_NAME " neighbor WORD",
685 CLEAR_STR
686 PROTO_HELP
687 "ISIS neighbor adjacencies\n"
688 "System id\n")
689 {
690 int idx_word = 3;
691 return clear_isis_neighbor_common(vty, argv[idx_word]->arg);
692 }
693
694 /*
695 * 'isis debug', 'show debugging'
696 */
697 void print_debug(struct vty *vty, int flags, int onoff)
698 {
699 char onoffs[4];
700 if (onoff)
701 strcpy(onoffs, "on");
702 else
703 strcpy(onoffs, "off");
704
705 if (flags & DEBUG_ADJ_PACKETS)
706 vty_out(vty,
707 "IS-IS Adjacency related packets debugging is %s\n",
708 onoffs);
709 if (flags & DEBUG_CHECKSUM_ERRORS)
710 vty_out(vty, "IS-IS checksum errors debugging is %s\n", onoffs);
711 if (flags & DEBUG_LOCAL_UPDATES)
712 vty_out(vty, "IS-IS local updates debugging is %s\n", onoffs);
713 if (flags & DEBUG_PROTOCOL_ERRORS)
714 vty_out(vty, "IS-IS protocol errors debugging is %s\n", onoffs);
715 if (flags & DEBUG_SNP_PACKETS)
716 vty_out(vty, "IS-IS CSNP/PSNP packets debugging is %s\n",
717 onoffs);
718 if (flags & DEBUG_SPF_EVENTS)
719 vty_out(vty, "IS-IS SPF events debugging is %s\n", onoffs);
720 if (flags & DEBUG_SPF_STATS)
721 vty_out(vty,
722 "IS-IS SPF Timing and Statistics Data debugging is %s\n",
723 onoffs);
724 if (flags & DEBUG_SPF_TRIGGERS)
725 vty_out(vty, "IS-IS SPF triggering events debugging is %s\n",
726 onoffs);
727 if (flags & DEBUG_UPDATE_PACKETS)
728 vty_out(vty, "IS-IS Update related packet debugging is %s\n",
729 onoffs);
730 if (flags & DEBUG_RTE_EVENTS)
731 vty_out(vty, "IS-IS Route related debuggin is %s\n", onoffs);
732 if (flags & DEBUG_EVENTS)
733 vty_out(vty, "IS-IS Event debugging is %s\n", onoffs);
734 if (flags & DEBUG_PACKET_DUMP)
735 vty_out(vty, "IS-IS Packet dump debugging is %s\n", onoffs);
736 if (flags & DEBUG_LSP_GEN)
737 vty_out(vty, "IS-IS LSP generation debugging is %s\n", onoffs);
738 if (flags & DEBUG_LSP_SCHED)
739 vty_out(vty, "IS-IS LSP scheduling debugging is %s\n", onoffs);
740 }
741
742 DEFUN_NOSH (show_debugging,
743 show_debugging_isis_cmd,
744 "show debugging [" PROTO_NAME "]",
745 SHOW_STR
746 "State of each debugging option\n"
747 PROTO_HELP)
748 {
749 vty_out(vty, PROTO_NAME " debugging status:\n");
750
751 if (isis->debugs)
752 print_debug(vty, isis->debugs, 1);
753
754 return CMD_SUCCESS;
755 }
756
757 /* Debug node. */
758 static struct cmd_node debug_node = {DEBUG_NODE, "", 1};
759
760 static int config_write_debug(struct vty *vty)
761 {
762 int write = 0;
763 int flags = isis->debugs;
764
765 if (flags & DEBUG_ADJ_PACKETS) {
766 vty_out(vty, "debug " PROTO_NAME " adj-packets\n");
767 write++;
768 }
769 if (flags & DEBUG_CHECKSUM_ERRORS) {
770 vty_out(vty, "debug " PROTO_NAME " checksum-errors\n");
771 write++;
772 }
773 if (flags & DEBUG_LOCAL_UPDATES) {
774 vty_out(vty, "debug " PROTO_NAME " local-updates\n");
775 write++;
776 }
777 if (flags & DEBUG_PROTOCOL_ERRORS) {
778 vty_out(vty, "debug " PROTO_NAME " protocol-errors\n");
779 write++;
780 }
781 if (flags & DEBUG_SNP_PACKETS) {
782 vty_out(vty, "debug " PROTO_NAME " snp-packets\n");
783 write++;
784 }
785 if (flags & DEBUG_SPF_EVENTS) {
786 vty_out(vty, "debug " PROTO_NAME " spf-events\n");
787 write++;
788 }
789 if (flags & DEBUG_SPF_STATS) {
790 vty_out(vty, "debug " PROTO_NAME " spf-statistics\n");
791 write++;
792 }
793 if (flags & DEBUG_SPF_TRIGGERS) {
794 vty_out(vty, "debug " PROTO_NAME " spf-triggers\n");
795 write++;
796 }
797 if (flags & DEBUG_UPDATE_PACKETS) {
798 vty_out(vty, "debug " PROTO_NAME " update-packets\n");
799 write++;
800 }
801 if (flags & DEBUG_RTE_EVENTS) {
802 vty_out(vty, "debug " PROTO_NAME " route-events\n");
803 write++;
804 }
805 if (flags & DEBUG_EVENTS) {
806 vty_out(vty, "debug " PROTO_NAME " events\n");
807 write++;
808 }
809 if (flags & DEBUG_PACKET_DUMP) {
810 vty_out(vty, "debug " PROTO_NAME " packet-dump\n");
811 write++;
812 }
813 if (flags & DEBUG_LSP_GEN) {
814 vty_out(vty, "debug " PROTO_NAME " lsp-gen\n");
815 write++;
816 }
817 if (flags & DEBUG_LSP_SCHED) {
818 vty_out(vty, "debug " PROTO_NAME " lsp-sched\n");
819 write++;
820 }
821 write += spf_backoff_write_config(vty);
822
823 return write;
824 }
825
826 DEFUN (debug_isis_adj,
827 debug_isis_adj_cmd,
828 "debug " PROTO_NAME " adj-packets",
829 DEBUG_STR
830 PROTO_HELP
831 "IS-IS Adjacency related packets\n")
832 {
833 isis->debugs |= DEBUG_ADJ_PACKETS;
834 print_debug(vty, DEBUG_ADJ_PACKETS, 1);
835
836 return CMD_SUCCESS;
837 }
838
839 DEFUN (no_debug_isis_adj,
840 no_debug_isis_adj_cmd,
841 "no debug " PROTO_NAME " adj-packets",
842 NO_STR
843 UNDEBUG_STR
844 PROTO_HELP
845 "IS-IS Adjacency related packets\n")
846 {
847 isis->debugs &= ~DEBUG_ADJ_PACKETS;
848 print_debug(vty, DEBUG_ADJ_PACKETS, 0);
849
850 return CMD_SUCCESS;
851 }
852
853 DEFUN (debug_isis_csum,
854 debug_isis_csum_cmd,
855 "debug " PROTO_NAME " checksum-errors",
856 DEBUG_STR
857 PROTO_HELP
858 "IS-IS LSP checksum errors\n")
859 {
860 isis->debugs |= DEBUG_CHECKSUM_ERRORS;
861 print_debug(vty, DEBUG_CHECKSUM_ERRORS, 1);
862
863 return CMD_SUCCESS;
864 }
865
866 DEFUN (no_debug_isis_csum,
867 no_debug_isis_csum_cmd,
868 "no debug " PROTO_NAME " checksum-errors",
869 NO_STR
870 UNDEBUG_STR
871 PROTO_HELP
872 "IS-IS LSP checksum errors\n")
873 {
874 isis->debugs &= ~DEBUG_CHECKSUM_ERRORS;
875 print_debug(vty, DEBUG_CHECKSUM_ERRORS, 0);
876
877 return CMD_SUCCESS;
878 }
879
880 DEFUN (debug_isis_lupd,
881 debug_isis_lupd_cmd,
882 "debug " PROTO_NAME " local-updates",
883 DEBUG_STR
884 PROTO_HELP
885 "IS-IS local update packets\n")
886 {
887 isis->debugs |= DEBUG_LOCAL_UPDATES;
888 print_debug(vty, DEBUG_LOCAL_UPDATES, 1);
889
890 return CMD_SUCCESS;
891 }
892
893 DEFUN (no_debug_isis_lupd,
894 no_debug_isis_lupd_cmd,
895 "no debug " PROTO_NAME " local-updates",
896 NO_STR
897 UNDEBUG_STR
898 PROTO_HELP
899 "IS-IS local update packets\n")
900 {
901 isis->debugs &= ~DEBUG_LOCAL_UPDATES;
902 print_debug(vty, DEBUG_LOCAL_UPDATES, 0);
903
904 return CMD_SUCCESS;
905 }
906
907 DEFUN (debug_isis_err,
908 debug_isis_err_cmd,
909 "debug " PROTO_NAME " protocol-errors",
910 DEBUG_STR
911 PROTO_HELP
912 "IS-IS LSP protocol errors\n")
913 {
914 isis->debugs |= DEBUG_PROTOCOL_ERRORS;
915 print_debug(vty, DEBUG_PROTOCOL_ERRORS, 1);
916
917 return CMD_SUCCESS;
918 }
919
920 DEFUN (no_debug_isis_err,
921 no_debug_isis_err_cmd,
922 "no debug " PROTO_NAME " protocol-errors",
923 NO_STR
924 UNDEBUG_STR
925 PROTO_HELP
926 "IS-IS LSP protocol errors\n")
927 {
928 isis->debugs &= ~DEBUG_PROTOCOL_ERRORS;
929 print_debug(vty, DEBUG_PROTOCOL_ERRORS, 0);
930
931 return CMD_SUCCESS;
932 }
933
934 DEFUN (debug_isis_snp,
935 debug_isis_snp_cmd,
936 "debug " PROTO_NAME " snp-packets",
937 DEBUG_STR
938 PROTO_HELP
939 "IS-IS CSNP/PSNP packets\n")
940 {
941 isis->debugs |= DEBUG_SNP_PACKETS;
942 print_debug(vty, DEBUG_SNP_PACKETS, 1);
943
944 return CMD_SUCCESS;
945 }
946
947 DEFUN (no_debug_isis_snp,
948 no_debug_isis_snp_cmd,
949 "no debug " PROTO_NAME " snp-packets",
950 NO_STR
951 UNDEBUG_STR
952 PROTO_HELP
953 "IS-IS CSNP/PSNP packets\n")
954 {
955 isis->debugs &= ~DEBUG_SNP_PACKETS;
956 print_debug(vty, DEBUG_SNP_PACKETS, 0);
957
958 return CMD_SUCCESS;
959 }
960
961 DEFUN (debug_isis_upd,
962 debug_isis_upd_cmd,
963 "debug " PROTO_NAME " update-packets",
964 DEBUG_STR
965 PROTO_HELP
966 "IS-IS Update related packets\n")
967 {
968 isis->debugs |= DEBUG_UPDATE_PACKETS;
969 print_debug(vty, DEBUG_UPDATE_PACKETS, 1);
970
971 return CMD_SUCCESS;
972 }
973
974 DEFUN (no_debug_isis_upd,
975 no_debug_isis_upd_cmd,
976 "no debug " PROTO_NAME " update-packets",
977 NO_STR
978 UNDEBUG_STR
979 PROTO_HELP
980 "IS-IS Update related packets\n")
981 {
982 isis->debugs &= ~DEBUG_UPDATE_PACKETS;
983 print_debug(vty, DEBUG_UPDATE_PACKETS, 0);
984
985 return CMD_SUCCESS;
986 }
987
988 DEFUN (debug_isis_spfevents,
989 debug_isis_spfevents_cmd,
990 "debug " PROTO_NAME " spf-events",
991 DEBUG_STR
992 PROTO_HELP
993 "IS-IS Shortest Path First Events\n")
994 {
995 isis->debugs |= DEBUG_SPF_EVENTS;
996 print_debug(vty, DEBUG_SPF_EVENTS, 1);
997
998 return CMD_SUCCESS;
999 }
1000
1001 DEFUN (no_debug_isis_spfevents,
1002 no_debug_isis_spfevents_cmd,
1003 "no debug " PROTO_NAME " spf-events",
1004 NO_STR
1005 UNDEBUG_STR
1006 PROTO_HELP
1007 "IS-IS Shortest Path First Events\n")
1008 {
1009 isis->debugs &= ~DEBUG_SPF_EVENTS;
1010 print_debug(vty, DEBUG_SPF_EVENTS, 0);
1011
1012 return CMD_SUCCESS;
1013 }
1014
1015 DEFUN (debug_isis_spfstats,
1016 debug_isis_spfstats_cmd,
1017 "debug " PROTO_NAME " spf-statistics ",
1018 DEBUG_STR
1019 PROTO_HELP
1020 "IS-IS SPF Timing and Statistic Data\n")
1021 {
1022 isis->debugs |= DEBUG_SPF_STATS;
1023 print_debug(vty, DEBUG_SPF_STATS, 1);
1024
1025 return CMD_SUCCESS;
1026 }
1027
1028 DEFUN (no_debug_isis_spfstats,
1029 no_debug_isis_spfstats_cmd,
1030 "no debug " PROTO_NAME " spf-statistics",
1031 NO_STR
1032 UNDEBUG_STR
1033 PROTO_HELP
1034 "IS-IS SPF Timing and Statistic Data\n")
1035 {
1036 isis->debugs &= ~DEBUG_SPF_STATS;
1037 print_debug(vty, DEBUG_SPF_STATS, 0);
1038
1039 return CMD_SUCCESS;
1040 }
1041
1042 DEFUN (debug_isis_spftrigg,
1043 debug_isis_spftrigg_cmd,
1044 "debug " PROTO_NAME " spf-triggers",
1045 DEBUG_STR
1046 PROTO_HELP
1047 "IS-IS SPF triggering events\n")
1048 {
1049 isis->debugs |= DEBUG_SPF_TRIGGERS;
1050 print_debug(vty, DEBUG_SPF_TRIGGERS, 1);
1051
1052 return CMD_SUCCESS;
1053 }
1054
1055 DEFUN (no_debug_isis_spftrigg,
1056 no_debug_isis_spftrigg_cmd,
1057 "no debug " PROTO_NAME " spf-triggers",
1058 NO_STR
1059 UNDEBUG_STR
1060 PROTO_HELP
1061 "IS-IS SPF triggering events\n")
1062 {
1063 isis->debugs &= ~DEBUG_SPF_TRIGGERS;
1064 print_debug(vty, DEBUG_SPF_TRIGGERS, 0);
1065
1066 return CMD_SUCCESS;
1067 }
1068
1069 DEFUN (debug_isis_rtevents,
1070 debug_isis_rtevents_cmd,
1071 "debug " PROTO_NAME " route-events",
1072 DEBUG_STR
1073 PROTO_HELP
1074 "IS-IS Route related events\n")
1075 {
1076 isis->debugs |= DEBUG_RTE_EVENTS;
1077 print_debug(vty, DEBUG_RTE_EVENTS, 1);
1078
1079 return CMD_SUCCESS;
1080 }
1081
1082 DEFUN (no_debug_isis_rtevents,
1083 no_debug_isis_rtevents_cmd,
1084 "no debug " PROTO_NAME " route-events",
1085 NO_STR
1086 UNDEBUG_STR
1087 PROTO_HELP
1088 "IS-IS Route related events\n")
1089 {
1090 isis->debugs &= ~DEBUG_RTE_EVENTS;
1091 print_debug(vty, DEBUG_RTE_EVENTS, 0);
1092
1093 return CMD_SUCCESS;
1094 }
1095
1096 DEFUN (debug_isis_events,
1097 debug_isis_events_cmd,
1098 "debug " PROTO_NAME " events",
1099 DEBUG_STR
1100 PROTO_HELP
1101 "IS-IS Events\n")
1102 {
1103 isis->debugs |= DEBUG_EVENTS;
1104 print_debug(vty, DEBUG_EVENTS, 1);
1105
1106 return CMD_SUCCESS;
1107 }
1108
1109 DEFUN (no_debug_isis_events,
1110 no_debug_isis_events_cmd,
1111 "no debug " PROTO_NAME " events",
1112 NO_STR
1113 UNDEBUG_STR
1114 PROTO_HELP
1115 "IS-IS Events\n")
1116 {
1117 isis->debugs &= ~DEBUG_EVENTS;
1118 print_debug(vty, DEBUG_EVENTS, 0);
1119
1120 return CMD_SUCCESS;
1121 }
1122
1123 DEFUN (debug_isis_packet_dump,
1124 debug_isis_packet_dump_cmd,
1125 "debug " PROTO_NAME " packet-dump",
1126 DEBUG_STR
1127 PROTO_HELP
1128 "IS-IS packet dump\n")
1129 {
1130 isis->debugs |= DEBUG_PACKET_DUMP;
1131 print_debug(vty, DEBUG_PACKET_DUMP, 1);
1132
1133 return CMD_SUCCESS;
1134 }
1135
1136 DEFUN (no_debug_isis_packet_dump,
1137 no_debug_isis_packet_dump_cmd,
1138 "no debug " PROTO_NAME " packet-dump",
1139 NO_STR
1140 UNDEBUG_STR
1141 PROTO_HELP
1142 "IS-IS packet dump\n")
1143 {
1144 isis->debugs &= ~DEBUG_PACKET_DUMP;
1145 print_debug(vty, DEBUG_PACKET_DUMP, 0);
1146
1147 return CMD_SUCCESS;
1148 }
1149
1150 DEFUN (debug_isis_lsp_gen,
1151 debug_isis_lsp_gen_cmd,
1152 "debug " PROTO_NAME " lsp-gen",
1153 DEBUG_STR
1154 PROTO_HELP
1155 "IS-IS generation of own LSPs\n")
1156 {
1157 isis->debugs |= DEBUG_LSP_GEN;
1158 print_debug(vty, DEBUG_LSP_GEN, 1);
1159
1160 return CMD_SUCCESS;
1161 }
1162
1163 DEFUN (no_debug_isis_lsp_gen,
1164 no_debug_isis_lsp_gen_cmd,
1165 "no debug " PROTO_NAME " lsp-gen",
1166 NO_STR
1167 UNDEBUG_STR
1168 PROTO_HELP
1169 "IS-IS generation of own LSPs\n")
1170 {
1171 isis->debugs &= ~DEBUG_LSP_GEN;
1172 print_debug(vty, DEBUG_LSP_GEN, 0);
1173
1174 return CMD_SUCCESS;
1175 }
1176
1177 DEFUN (debug_isis_lsp_sched,
1178 debug_isis_lsp_sched_cmd,
1179 "debug " PROTO_NAME " lsp-sched",
1180 DEBUG_STR
1181 PROTO_HELP
1182 "IS-IS scheduling of LSP generation\n")
1183 {
1184 isis->debugs |= DEBUG_LSP_SCHED;
1185 print_debug(vty, DEBUG_LSP_SCHED, 1);
1186
1187 return CMD_SUCCESS;
1188 }
1189
1190 DEFUN (no_debug_isis_lsp_sched,
1191 no_debug_isis_lsp_sched_cmd,
1192 "no debug " PROTO_NAME " lsp-sched",
1193 NO_STR
1194 UNDEBUG_STR
1195 PROTO_HELP
1196 "IS-IS scheduling of LSP generation\n")
1197 {
1198 isis->debugs &= ~DEBUG_LSP_SCHED;
1199 print_debug(vty, DEBUG_LSP_SCHED, 0);
1200
1201 return CMD_SUCCESS;
1202 }
1203
1204 DEFUN (show_hostname,
1205 show_hostname_cmd,
1206 "show " PROTO_NAME " hostname",
1207 SHOW_STR
1208 PROTO_HELP
1209 "IS-IS Dynamic hostname mapping\n")
1210 {
1211 dynhn_print_all(vty);
1212
1213 return CMD_SUCCESS;
1214 }
1215
1216 DEFUN (show_isis_spf_ietf,
1217 show_isis_spf_ietf_cmd,
1218 "show " PROTO_NAME " spf-delay-ietf",
1219 SHOW_STR
1220 PROTO_HELP
1221 "SPF delay IETF information\n")
1222 {
1223 if (!isis) {
1224 vty_out(vty, "ISIS is not running\n");
1225 return CMD_SUCCESS;
1226 }
1227
1228 struct listnode *node;
1229 struct isis_area *area;
1230
1231 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1232 vty_out(vty, "Area %s:\n",
1233 area->area_tag ? area->area_tag : "null");
1234
1235 for (int level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
1236 if ((area->is_type & level) == 0)
1237 continue;
1238
1239 vty_out(vty, " Level-%d:\n", level);
1240 vty_out(vty, " SPF delay status: ");
1241 if (area->spf_timer[level - 1]) {
1242 struct timeval remain = thread_timer_remain(
1243 area->spf_timer[level - 1]);
1244 vty_out(vty, "Pending, due in %lld msec\n",
1245 (long long)remain.tv_sec * 1000
1246 + remain.tv_usec / 1000);
1247 } else {
1248 vty_out(vty, "Not scheduled\n");
1249 }
1250
1251 if (area->spf_delay_ietf[level - 1]) {
1252 vty_out(vty,
1253 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1254 spf_backoff_show(
1255 area->spf_delay_ietf[level - 1], vty,
1256 " ");
1257 } else {
1258 vty_out(vty, " Using legacy backoff algo\n");
1259 }
1260 }
1261 }
1262 return CMD_SUCCESS;
1263 }
1264
1265 DEFUN (show_isis_summary,
1266 show_isis_summary_cmd,
1267 "show " PROTO_NAME " summary",
1268 SHOW_STR PROTO_HELP "summary\n")
1269 {
1270 struct listnode *node, *node2;
1271 struct isis_area *area;
1272 int level;
1273
1274 if (isis == NULL) {
1275 vty_out(vty, PROTO_NAME " is not running\n");
1276 return CMD_SUCCESS;
1277 }
1278
1279 vty_out(vty, "Process Id : %ld\n", isis->process_id);
1280 if (isis->sysid_set)
1281 vty_out(vty, "System Id : %s\n",
1282 sysid_print(isis->sysid));
1283
1284 vty_out(vty, "Up time : ");
1285 vty_out_timestr(vty, isis->uptime);
1286 vty_out(vty, "\n");
1287
1288 if (isis->area_list)
1289 vty_out(vty, "Number of areas : %d\n", isis->area_list->count);
1290
1291 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1292 vty_out(vty, "Area %s:\n",
1293 area->area_tag ? area->area_tag : "null");
1294
1295 if (listcount(area->area_addrs) > 0) {
1296 struct area_addr *area_addr;
1297 for (ALL_LIST_ELEMENTS_RO(area->area_addrs, node2,
1298 area_addr)) {
1299 vty_out(vty, " Net: %s\n",
1300 isonet_print(area_addr->area_addr,
1301 area_addr->addr_len
1302 + ISIS_SYS_ID_LEN
1303 + 1));
1304 }
1305 }
1306
1307 for (level = ISIS_LEVEL1; level <= ISIS_LEVELS; level++) {
1308 if ((area->is_type & level) == 0)
1309 continue;
1310
1311 vty_out(vty, " Level-%d:\n", level);
1312 if (area->spf_timer[level - 1])
1313 vty_out(vty, " SPF: (pending)\n");
1314 else
1315 vty_out(vty, " SPF:\n");
1316
1317 vty_out(vty, " minimum interval : %d",
1318 area->min_spf_interval[level - 1]);
1319 if (area->spf_delay_ietf[level - 1])
1320 vty_out(vty,
1321 " (not used, IETF SPF delay activated)");
1322 vty_out(vty, "\n");
1323
1324 vty_out(vty, " IPv4 route computation:\n");
1325 isis_spf_print(area->spftree[SPFTREE_IPV4][level - 1],
1326 vty);
1327
1328 vty_out(vty, " IPv6 route computation:\n");
1329 isis_spf_print(area->spftree[SPFTREE_IPV6][level - 1],
1330 vty);
1331
1332 vty_out(vty, " IPv6 dst-src route computation:\n");
1333 isis_spf_print(area->spftree[SPFTREE_DSTSRC][level-1],
1334 vty);
1335 }
1336 }
1337 vty_out(vty, "\n");
1338
1339 return CMD_SUCCESS;
1340 }
1341
1342 /*
1343 * This function supports following display options:
1344 * [ show isis database [detail] ]
1345 * [ show isis database <sysid> [detail] ]
1346 * [ show isis database <hostname> [detail] ]
1347 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1348 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1349 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1350 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1351 * [ show isis database detail <sysid> ]
1352 * [ show isis database detail <hostname> ]
1353 * [ show isis database detail <sysid>.<pseudo-id> ]
1354 * [ show isis database detail <hostname>.<pseudo-id> ]
1355 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1356 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1357 */
1358 static int show_isis_database(struct vty *vty, const char *argv, int ui_level)
1359 {
1360 struct listnode *node;
1361 struct isis_area *area;
1362 struct isis_lsp *lsp;
1363 struct isis_dynhn *dynhn;
1364 const char *pos;
1365 uint8_t lspid[ISIS_SYS_ID_LEN + 2];
1366 char sysid[255];
1367 uint8_t number[3];
1368 int level, lsp_count;
1369
1370 if (isis->area_list->count == 0)
1371 return CMD_SUCCESS;
1372
1373 memset(&lspid, 0, ISIS_SYS_ID_LEN);
1374 memset(&sysid, 0, 255);
1375
1376 /*
1377 * extract fragment and pseudo id from the string argv
1378 * in the forms:
1379 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1380 * (b) <systemid/hostname>.<pseudo-id> or
1381 * (c) <systemid/hostname> or
1382 * Where systemid is in the form:
1383 * xxxx.xxxx.xxxx
1384 */
1385 if (argv)
1386 strncpy(sysid, argv, 254);
1387 if (argv && strlen(argv) > 3) {
1388 pos = argv + strlen(argv) - 3;
1389 if (strncmp(pos, "-", 1) == 0) {
1390 memcpy(number, ++pos, 2);
1391 lspid[ISIS_SYS_ID_LEN + 1] =
1392 (uint8_t)strtol((char *)number, NULL, 16);
1393 pos -= 4;
1394 if (strncmp(pos, ".", 1) != 0)
1395 return CMD_WARNING;
1396 }
1397 if (strncmp(pos, ".", 1) == 0) {
1398 memcpy(number, ++pos, 2);
1399 lspid[ISIS_SYS_ID_LEN] =
1400 (uint8_t)strtol((char *)number, NULL, 16);
1401 sysid[pos - argv - 1] = '\0';
1402 }
1403 }
1404
1405 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1406 vty_out(vty, "Area %s:\n",
1407 area->area_tag ? area->area_tag : "null");
1408
1409 for (level = 0; level < ISIS_LEVELS; level++) {
1410 if (area->lspdb[level]
1411 && dict_count(area->lspdb[level]) > 0) {
1412 lsp = NULL;
1413 if (argv != NULL) {
1414 /*
1415 * Try to find the lsp-id if the argv
1416 * string is in
1417 * the form
1418 * hostname.<pseudo-id>-<fragment>
1419 */
1420 if (sysid2buff(lspid, sysid)) {
1421 lsp = lsp_search(
1422 lspid,
1423 area->lspdb[level]);
1424 } else if ((dynhn = dynhn_find_by_name(
1425 sysid))) {
1426 memcpy(lspid, dynhn->id,
1427 ISIS_SYS_ID_LEN);
1428 lsp = lsp_search(
1429 lspid,
1430 area->lspdb[level]);
1431 } else if (strncmp(cmd_hostname_get(),
1432 sysid, 15)
1433 == 0) {
1434 memcpy(lspid, isis->sysid,
1435 ISIS_SYS_ID_LEN);
1436 lsp = lsp_search(
1437 lspid,
1438 area->lspdb[level]);
1439 }
1440 }
1441
1442 if (lsp != NULL || argv == NULL) {
1443 vty_out(vty,
1444 "IS-IS Level-%d link-state database:\n",
1445 level + 1);
1446
1447 /* print the title in all cases */
1448 vty_out(vty,
1449 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1450 }
1451
1452 if (lsp) {
1453 if (ui_level == ISIS_UI_LEVEL_DETAIL)
1454 lsp_print_detail(
1455 lsp, vty,
1456 area->dynhostname);
1457 else
1458 lsp_print(lsp, vty,
1459 area->dynhostname);
1460 } else if (argv == NULL) {
1461 lsp_count = lsp_print_all(
1462 vty, area->lspdb[level],
1463 ui_level, area->dynhostname);
1464
1465 vty_out(vty, " %u LSPs\n\n",
1466 lsp_count);
1467 }
1468 }
1469 }
1470 }
1471
1472 return CMD_SUCCESS;
1473 }
1474
1475 DEFUN (show_database,
1476 show_database_cmd,
1477 "show " PROTO_NAME " database [detail] [WORD]",
1478 SHOW_STR
1479 PROTO_HELP
1480 "Link state database\n"
1481 "Detailed information\n"
1482 "LSP ID\n")
1483 {
1484 int idx = 0;
1485 int uilevel = argv_find(argv, argc, "detail", &idx)
1486 ? ISIS_UI_LEVEL_DETAIL
1487 : ISIS_UI_LEVEL_BRIEF;
1488 char *id = argv_find(argv, argc, "WORD", &idx) ? argv[idx]->arg : NULL;
1489 return show_isis_database(vty, id, uilevel);
1490 }
1491
1492 /*
1493 * 'router isis' command
1494 */
1495 DEFUN_NOSH (router_isis,
1496 router_isis_cmd,
1497 "router " PROTO_NAME " WORD",
1498 ROUTER_STR
1499 PROTO_HELP
1500 "ISO Routing area tag\n")
1501 {
1502 int idx_word = 2;
1503 return isis_area_get(vty, argv[idx_word]->arg);
1504 }
1505
1506 /*
1507 *'no router isis' command
1508 */
1509 DEFUN (no_router_isis,
1510 no_router_isis_cmd,
1511 "no router " PROTO_NAME " WORD",
1512 NO_STR
1513 ROUTER_STR
1514 PROTO_HELP
1515 "ISO Routing area tag\n")
1516 {
1517 int idx_word = 3;
1518 return isis_area_destroy(vty, argv[idx_word]->arg);
1519 }
1520
1521 /*
1522 * 'net' command
1523 */
1524 DEFUN (net,
1525 net_cmd,
1526 "net WORD",
1527 "A Network Entity Title for this process (OSI only)\n"
1528 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1529 {
1530 int idx_word = 1;
1531 return area_net_title(vty, argv[idx_word]->arg);
1532 }
1533
1534 /*
1535 * 'no net' command
1536 */
1537 DEFUN (no_net,
1538 no_net_cmd,
1539 "no net WORD",
1540 NO_STR
1541 "A Network Entity Title for this process (OSI only)\n"
1542 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1543 {
1544 int idx_word = 2;
1545 return area_clear_net_title(vty, argv[idx_word]->arg);
1546 }
1547
1548 DEFUN (isis_topology,
1549 isis_topology_cmd,
1550 "topology " ISIS_MT_NAMES " [overload]",
1551 "Configure IS-IS topologies\n"
1552 ISIS_MT_DESCRIPTIONS
1553 "Set overload bit for topology\n")
1554 {
1555 VTY_DECLVAR_CONTEXT(isis_area, area);
1556
1557 const char *arg = argv[1]->arg;
1558 uint16_t mtid = isis_str2mtid(arg);
1559
1560 if (area->oldmetric) {
1561 vty_out(vty,
1562 "Multi topology IS-IS can only be used with wide metrics\n");
1563 return CMD_WARNING_CONFIG_FAILED;
1564 }
1565
1566 if (mtid == (uint16_t)-1) {
1567 vty_out(vty, "Don't know topology '%s'\n", arg);
1568 return CMD_WARNING_CONFIG_FAILED;
1569 }
1570 if (mtid == ISIS_MT_IPV4_UNICAST) {
1571 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
1572 return CMD_WARNING_CONFIG_FAILED;
1573 }
1574
1575 area_set_mt_enabled(area, mtid, true);
1576 area_set_mt_overload(area, mtid, (argc == 3));
1577 return CMD_SUCCESS;
1578 }
1579
1580 DEFUN (no_isis_topology,
1581 no_isis_topology_cmd,
1582 "no topology " ISIS_MT_NAMES " [overload]",
1583 NO_STR
1584 "Configure IS-IS topologies\n"
1585 ISIS_MT_DESCRIPTIONS
1586 "Set overload bit for topology\n")
1587 {
1588 VTY_DECLVAR_CONTEXT(isis_area, area);
1589
1590 const char *arg = argv[2]->arg;
1591 uint16_t mtid = isis_str2mtid(arg);
1592
1593 if (area->oldmetric) {
1594 vty_out(vty,
1595 "Multi topology IS-IS can only be used with wide metrics\n");
1596 return CMD_WARNING_CONFIG_FAILED;
1597 }
1598
1599 if (mtid == (uint16_t)-1) {
1600 vty_out(vty, "Don't know topology '%s'\n", arg);
1601 return CMD_WARNING_CONFIG_FAILED;
1602 }
1603 if (mtid == ISIS_MT_IPV4_UNICAST) {
1604 vty_out(vty, "Cannot configure IPv4 unicast topology\n");
1605 return CMD_WARNING_CONFIG_FAILED;
1606 }
1607
1608 area_set_mt_enabled(area, mtid, false);
1609 area_set_mt_overload(area, mtid, false);
1610 return CMD_SUCCESS;
1611 }
1612
1613 void isis_area_lsp_mtu_set(struct isis_area *area, unsigned int lsp_mtu)
1614 {
1615 area->lsp_mtu = lsp_mtu;
1616 lsp_regenerate_schedule(area, IS_LEVEL_1_AND_2, 1);
1617 }
1618
1619 static int isis_area_passwd_set(struct isis_area *area, int level,
1620 uint8_t passwd_type, const char *passwd,
1621 uint8_t snp_auth)
1622 {
1623 struct isis_passwd *dest;
1624 struct isis_passwd modified;
1625 int len;
1626
1627 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
1628 dest = (level == IS_LEVEL_1) ? &area->area_passwd
1629 : &area->domain_passwd;
1630 memset(&modified, 0, sizeof(modified));
1631
1632 if (passwd_type != ISIS_PASSWD_TYPE_UNUSED) {
1633 if (!passwd)
1634 return -1;
1635
1636 len = strlen(passwd);
1637 if (len > 254)
1638 return -1;
1639
1640 modified.len = len;
1641 strncpy((char *)modified.passwd, passwd, 255);
1642 modified.type = passwd_type;
1643 modified.snp_auth = snp_auth;
1644 }
1645
1646 if (memcmp(&modified, dest, sizeof(modified))) {
1647 memcpy(dest, &modified, sizeof(modified));
1648 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1649 }
1650
1651 return 0;
1652 }
1653
1654 int isis_area_passwd_unset(struct isis_area *area, int level)
1655 {
1656 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_UNUSED, NULL,
1657 0);
1658 }
1659
1660 int isis_area_passwd_cleartext_set(struct isis_area *area, int level,
1661 const char *passwd, uint8_t snp_auth)
1662 {
1663 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_CLEARTXT,
1664 passwd, snp_auth);
1665 }
1666
1667 int isis_area_passwd_hmac_md5_set(struct isis_area *area, int level,
1668 const char *passwd, uint8_t snp_auth)
1669 {
1670 return isis_area_passwd_set(area, level, ISIS_PASSWD_TYPE_HMAC_MD5,
1671 passwd, snp_auth);
1672 }
1673
1674 void isis_area_invalidate_routes(struct isis_area *area, int levels)
1675 {
1676 for (int level = ISIS_LEVEL1; level <= ISIS_LEVEL2; level++) {
1677 if (!(level & levels))
1678 continue;
1679 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
1680 isis_spf_invalidate_routes(
1681 area->spftree[tree][level - 1]);
1682 }
1683 }
1684 }
1685
1686 void isis_area_verify_routes(struct isis_area *area)
1687 {
1688 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++)
1689 isis_spf_verify_routes(area, area->spftree[tree]);
1690 }
1691
1692 static void area_resign_level(struct isis_area *area, int level)
1693 {
1694 isis_area_invalidate_routes(area, level);
1695 isis_area_verify_routes(area);
1696
1697 if (area->lspdb[level - 1]) {
1698 lsp_db_destroy(area->lspdb[level - 1]);
1699 area->lspdb[level - 1] = NULL;
1700 }
1701
1702 for (int tree = SPFTREE_IPV4; tree < SPFTREE_COUNT; tree++) {
1703 if (area->spftree[tree][level - 1]) {
1704 isis_spftree_del(area->spftree[tree][level - 1]);
1705 area->spftree[tree][level - 1] = NULL;
1706 }
1707 }
1708
1709 THREAD_TIMER_OFF(area->spf_timer[level - 1]);
1710
1711 sched_debug(
1712 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1713 area->area_tag, level);
1714 THREAD_TIMER_OFF(area->t_lsp_refresh[level - 1]);
1715 area->lsp_regenerate_pending[level - 1] = 0;
1716 }
1717
1718 void isis_area_is_type_set(struct isis_area *area, int is_type)
1719 {
1720 struct listnode *node;
1721 struct isis_circuit *circuit;
1722
1723 if (isis->debugs & DEBUG_EVENTS)
1724 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1725 area->area_tag, circuit_t2string(area->is_type),
1726 circuit_t2string(is_type));
1727
1728 if (area->is_type == is_type)
1729 return; /* No change */
1730
1731 switch (area->is_type) {
1732 case IS_LEVEL_1:
1733 if (is_type == IS_LEVEL_2)
1734 area_resign_level(area, IS_LEVEL_1);
1735
1736 if (area->lspdb[1] == NULL)
1737 area->lspdb[1] = lsp_db_init();
1738 break;
1739
1740 case IS_LEVEL_1_AND_2:
1741 if (is_type == IS_LEVEL_1)
1742 area_resign_level(area, IS_LEVEL_2);
1743 else
1744 area_resign_level(area, IS_LEVEL_1);
1745 break;
1746
1747 case IS_LEVEL_2:
1748 if (is_type == IS_LEVEL_1)
1749 area_resign_level(area, IS_LEVEL_2);
1750
1751 if (area->lspdb[0] == NULL)
1752 area->lspdb[0] = lsp_db_init();
1753 break;
1754
1755 default:
1756 break;
1757 }
1758
1759 area->is_type = is_type;
1760
1761 /* override circuit's is_type */
1762 if (area->is_type != IS_LEVEL_1_AND_2) {
1763 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1764 isis_circuit_is_type_set(circuit, is_type);
1765 }
1766
1767 spftree_area_init(area);
1768
1769 if (listcount(area->area_addrs) > 0) {
1770 if (is_type & IS_LEVEL_1)
1771 lsp_generate(area, IS_LEVEL_1);
1772 if (is_type & IS_LEVEL_2)
1773 lsp_generate(area, IS_LEVEL_2);
1774 }
1775 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1776
1777 return;
1778 }
1779
1780 void isis_area_metricstyle_set(struct isis_area *area, bool old_metric,
1781 bool new_metric)
1782 {
1783 if (area->oldmetric != old_metric || area->newmetric != new_metric) {
1784 area->oldmetric = old_metric;
1785 area->newmetric = new_metric;
1786 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1787 }
1788 }
1789
1790 void isis_area_overload_bit_set(struct isis_area *area, bool overload_bit)
1791 {
1792 char new_overload_bit = overload_bit ? LSPBIT_OL : 0;
1793
1794 if (new_overload_bit != area->overload_bit) {
1795 area->overload_bit = new_overload_bit;
1796 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1797 }
1798 }
1799
1800 void isis_area_attached_bit_set(struct isis_area *area, bool attached_bit)
1801 {
1802 char new_attached_bit = attached_bit ? LSPBIT_ATT : 0;
1803
1804 if (new_attached_bit != area->attached_bit) {
1805 area->attached_bit = new_attached_bit;
1806 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 1);
1807 }
1808 }
1809
1810 void isis_area_dynhostname_set(struct isis_area *area, bool dynhostname)
1811 {
1812 if (area->dynhostname != dynhostname) {
1813 area->dynhostname = dynhostname;
1814 lsp_regenerate_schedule(area, IS_LEVEL_1 | IS_LEVEL_2, 0);
1815 }
1816 }
1817
1818 void isis_area_max_lsp_lifetime_set(struct isis_area *area, int level,
1819 uint16_t max_lsp_lifetime)
1820 {
1821 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
1822
1823 if (area->max_lsp_lifetime[level - 1] == max_lsp_lifetime)
1824 return;
1825
1826 area->max_lsp_lifetime[level - 1] = max_lsp_lifetime;
1827 lsp_regenerate_schedule(area, level, 1);
1828 }
1829
1830 void isis_area_lsp_refresh_set(struct isis_area *area, int level,
1831 uint16_t lsp_refresh)
1832 {
1833 assert((level == IS_LEVEL_1) || (level == IS_LEVEL_2));
1834
1835 if (area->lsp_refresh[level - 1] == lsp_refresh)
1836 return;
1837
1838 area->lsp_refresh[level - 1] = lsp_refresh;
1839 lsp_regenerate_schedule(area, level, 1);
1840 }
1841
1842 DEFUN (log_adj_changes,
1843 log_adj_changes_cmd,
1844 "log-adjacency-changes",
1845 "Log changes in adjacency state\n")
1846 {
1847 VTY_DECLVAR_CONTEXT(isis_area, area);
1848
1849 area->log_adj_changes = 1;
1850
1851 return CMD_SUCCESS;
1852 }
1853
1854 DEFUN (no_log_adj_changes,
1855 no_log_adj_changes_cmd,
1856 "no log-adjacency-changes",
1857 NO_STR
1858 "Stop logging changes in adjacency state\n")
1859 {
1860 VTY_DECLVAR_CONTEXT(isis_area, area);
1861
1862 area->log_adj_changes = 0;
1863
1864 return CMD_SUCCESS;
1865 }
1866
1867 /* IS-IS configuration write function */
1868 int isis_config_write(struct vty *vty)
1869 {
1870 int write = 0;
1871
1872 if (isis != NULL) {
1873 struct isis_area *area;
1874 struct listnode *node, *node2;
1875
1876 for (ALL_LIST_ELEMENTS_RO(isis->area_list, node, area)) {
1877 /* ISIS - Area name */
1878 vty_out(vty, "router " PROTO_NAME " %s\n", area->area_tag);
1879 write++;
1880 /* ISIS - Net */
1881 if (listcount(area->area_addrs) > 0) {
1882 struct area_addr *area_addr;
1883 for (ALL_LIST_ELEMENTS_RO(area->area_addrs,
1884 node2, area_addr)) {
1885 vty_out(vty, " net %s\n",
1886 isonet_print(
1887 area_addr->area_addr,
1888 area_addr->addr_len
1889 + ISIS_SYS_ID_LEN
1890 + 1));
1891 write++;
1892 }
1893 }
1894 /* ISIS - Dynamic hostname - Defaults to true so only
1895 * display if
1896 * false. */
1897 if (!area->dynhostname) {
1898 vty_out(vty, " no hostname dynamic\n");
1899 write++;
1900 }
1901 /* ISIS - Metric-Style - when true displays wide */
1902 if (!fabricd) {
1903 if (area->newmetric) {
1904 if (!area->oldmetric)
1905 vty_out(vty, " metric-style wide\n");
1906 else
1907 vty_out(vty,
1908 " metric-style transition\n");
1909 write++;
1910 } else {
1911 vty_out(vty, " metric-style narrow\n");
1912 write++;
1913 }
1914 }
1915 /* ISIS - overload-bit */
1916 if (area->overload_bit) {
1917 vty_out(vty, " set-overload-bit\n");
1918 write++;
1919 }
1920 /* ISIS - Area is-type (level-1-2 is default) */
1921 if (!fabricd) {
1922 if (area->is_type == IS_LEVEL_1) {
1923 vty_out(vty, " is-type level-1\n");
1924 write++;
1925 } else if (area->is_type == IS_LEVEL_2) {
1926 vty_out(vty, " is-type level-2-only\n");
1927 write++;
1928 }
1929 }
1930 write += isis_redist_config_write(vty, area, AF_INET);
1931 write += isis_redist_config_write(vty, area, AF_INET6);
1932 /* ISIS - Lsp generation interval */
1933 if (area->lsp_gen_interval[0]
1934 == area->lsp_gen_interval[1]) {
1935 if (area->lsp_gen_interval[0]
1936 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
1937 vty_out(vty, " lsp-gen-interval %d\n",
1938 area->lsp_gen_interval[0]);
1939 write++;
1940 }
1941 } else {
1942 if (area->lsp_gen_interval[0]
1943 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
1944 vty_out(vty,
1945 " lsp-gen-interval level-1 %d\n",
1946 area->lsp_gen_interval[0]);
1947 write++;
1948 }
1949 if (area->lsp_gen_interval[1]
1950 != DEFAULT_MIN_LSP_GEN_INTERVAL) {
1951 vty_out(vty,
1952 " lsp-gen-interval level-2 %d\n",
1953 area->lsp_gen_interval[1]);
1954 write++;
1955 }
1956 }
1957 /* ISIS - LSP lifetime */
1958 if (area->max_lsp_lifetime[0]
1959 == area->max_lsp_lifetime[1]) {
1960 if (area->max_lsp_lifetime[0]
1961 != DEFAULT_LSP_LIFETIME) {
1962 vty_out(vty, " max-lsp-lifetime %u\n",
1963 area->max_lsp_lifetime[0]);
1964 write++;
1965 }
1966 } else {
1967 if (area->max_lsp_lifetime[0]
1968 != DEFAULT_LSP_LIFETIME) {
1969 vty_out(vty,
1970 " max-lsp-lifetime level-1 %u\n",
1971 area->max_lsp_lifetime[0]);
1972 write++;
1973 }
1974 if (area->max_lsp_lifetime[1]
1975 != DEFAULT_LSP_LIFETIME) {
1976 vty_out(vty,
1977 " max-lsp-lifetime level-2 %u\n",
1978 area->max_lsp_lifetime[1]);
1979 write++;
1980 }
1981 }
1982 /* ISIS - LSP refresh interval */
1983 if (area->lsp_refresh[0] == area->lsp_refresh[1]) {
1984 if (area->lsp_refresh[0]
1985 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
1986 vty_out(vty,
1987 " lsp-refresh-interval %u\n",
1988 area->lsp_refresh[0]);
1989 write++;
1990 }
1991 } else {
1992 if (area->lsp_refresh[0]
1993 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
1994 vty_out(vty,
1995 " lsp-refresh-interval level-1 %u\n",
1996 area->lsp_refresh[0]);
1997 write++;
1998 }
1999 if (area->lsp_refresh[1]
2000 != DEFAULT_MAX_LSP_GEN_INTERVAL) {
2001 vty_out(vty,
2002 " lsp-refresh-interval level-2 %u\n",
2003 area->lsp_refresh[1]);
2004 write++;
2005 }
2006 }
2007 if (area->lsp_mtu != DEFAULT_LSP_MTU) {
2008 vty_out(vty, " lsp-mtu %u\n", area->lsp_mtu);
2009 write++;
2010 }
2011
2012 /* Minimum SPF interval. */
2013 if (area->min_spf_interval[0]
2014 == area->min_spf_interval[1]) {
2015 if (area->min_spf_interval[0]
2016 != MINIMUM_SPF_INTERVAL) {
2017 vty_out(vty, " spf-interval %d\n",
2018 area->min_spf_interval[0]);
2019 write++;
2020 }
2021 } else {
2022 if (area->min_spf_interval[0]
2023 != MINIMUM_SPF_INTERVAL) {
2024 vty_out(vty,
2025 " spf-interval level-1 %d\n",
2026 area->min_spf_interval[0]);
2027 write++;
2028 }
2029 if (area->min_spf_interval[1]
2030 != MINIMUM_SPF_INTERVAL) {
2031 vty_out(vty,
2032 " spf-interval level-2 %d\n",
2033 area->min_spf_interval[1]);
2034 write++;
2035 }
2036 }
2037
2038 /* IETF SPF interval */
2039 if (area->spf_delay_ietf[0]) {
2040 vty_out(vty,
2041 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2042 spf_backoff_init_delay(
2043 area->spf_delay_ietf[0]),
2044 spf_backoff_short_delay(
2045 area->spf_delay_ietf[0]),
2046 spf_backoff_long_delay(
2047 area->spf_delay_ietf[0]),
2048 spf_backoff_holddown(
2049 area->spf_delay_ietf[0]),
2050 spf_backoff_timetolearn(
2051 area->spf_delay_ietf[0]));
2052 write++;
2053 }
2054
2055 /* Authentication passwords. */
2056 if (area->area_passwd.type
2057 == ISIS_PASSWD_TYPE_HMAC_MD5) {
2058 vty_out(vty, " area-password md5 %s",
2059 area->area_passwd.passwd);
2060 if (CHECK_FLAG(area->area_passwd.snp_auth,
2061 SNP_AUTH_SEND)) {
2062 vty_out(vty, " authenticate snp ");
2063 if (CHECK_FLAG(
2064 area->area_passwd.snp_auth,
2065 SNP_AUTH_RECV))
2066 vty_out(vty, "validate");
2067 else
2068 vty_out(vty, "send-only");
2069 }
2070 vty_out(vty, "\n");
2071 write++;
2072 } else if (area->area_passwd.type
2073 == ISIS_PASSWD_TYPE_CLEARTXT) {
2074 vty_out(vty, " area-password clear %s",
2075 area->area_passwd.passwd);
2076 if (CHECK_FLAG(area->area_passwd.snp_auth,
2077 SNP_AUTH_SEND)) {
2078 vty_out(vty, " authenticate snp ");
2079 if (CHECK_FLAG(
2080 area->area_passwd.snp_auth,
2081 SNP_AUTH_RECV))
2082 vty_out(vty, "validate");
2083 else
2084 vty_out(vty, "send-only");
2085 }
2086 vty_out(vty, "\n");
2087 write++;
2088 }
2089 if (area->domain_passwd.type
2090 == ISIS_PASSWD_TYPE_HMAC_MD5) {
2091 vty_out(vty, " domain-password md5 %s",
2092 area->domain_passwd.passwd);
2093 if (CHECK_FLAG(area->domain_passwd.snp_auth,
2094 SNP_AUTH_SEND)) {
2095 vty_out(vty, " authenticate snp ");
2096 if (CHECK_FLAG(area->domain_passwd
2097 .snp_auth,
2098 SNP_AUTH_RECV))
2099 vty_out(vty, "validate");
2100 else
2101 vty_out(vty, "send-only");
2102 }
2103 vty_out(vty, "\n");
2104 write++;
2105 } else if (area->domain_passwd.type
2106 == ISIS_PASSWD_TYPE_CLEARTXT) {
2107 vty_out(vty, " domain-password clear %s",
2108 area->domain_passwd.passwd);
2109 if (CHECK_FLAG(area->domain_passwd.snp_auth,
2110 SNP_AUTH_SEND)) {
2111 vty_out(vty, " authenticate snp ");
2112 if (CHECK_FLAG(area->domain_passwd
2113 .snp_auth,
2114 SNP_AUTH_RECV))
2115 vty_out(vty, "validate");
2116 else
2117 vty_out(vty, "send-only");
2118 }
2119 vty_out(vty, "\n");
2120 write++;
2121 }
2122
2123 if (area->log_adj_changes) {
2124 vty_out(vty, " log-adjacency-changes\n");
2125 write++;
2126 }
2127
2128 write += area_write_mt_settings(area, vty);
2129 }
2130 isis_mpls_te_config_write_router(vty);
2131 }
2132
2133 return write;
2134 }
2135
2136 struct cmd_node router_node = {ROUTER_NODE, "%s(config-router)# ", 1};
2137
2138 void isis_init()
2139 {
2140 /* Install IS-IS top node */
2141 install_node(&router_node, isis_config_write);
2142
2143 install_element(VIEW_NODE, &show_isis_summary_cmd);
2144
2145 install_element(VIEW_NODE, &show_isis_spf_ietf_cmd);
2146
2147 install_element(VIEW_NODE, &show_isis_interface_cmd);
2148 install_element(VIEW_NODE, &show_isis_interface_detail_cmd);
2149 install_element(VIEW_NODE, &show_isis_interface_arg_cmd);
2150
2151 install_element(VIEW_NODE, &show_isis_neighbor_cmd);
2152 install_element(VIEW_NODE, &show_isis_neighbor_detail_cmd);
2153 install_element(VIEW_NODE, &show_isis_neighbor_arg_cmd);
2154 install_element(VIEW_NODE, &clear_isis_neighbor_cmd);
2155 install_element(VIEW_NODE, &clear_isis_neighbor_arg_cmd);
2156
2157 install_element(VIEW_NODE, &show_hostname_cmd);
2158 install_element(VIEW_NODE, &show_database_cmd);
2159
2160 install_element(ENABLE_NODE, &show_debugging_isis_cmd);
2161
2162 install_node(&debug_node, config_write_debug);
2163
2164 install_element(ENABLE_NODE, &debug_isis_adj_cmd);
2165 install_element(ENABLE_NODE, &no_debug_isis_adj_cmd);
2166 install_element(ENABLE_NODE, &debug_isis_csum_cmd);
2167 install_element(ENABLE_NODE, &no_debug_isis_csum_cmd);
2168 install_element(ENABLE_NODE, &debug_isis_lupd_cmd);
2169 install_element(ENABLE_NODE, &no_debug_isis_lupd_cmd);
2170 install_element(ENABLE_NODE, &debug_isis_err_cmd);
2171 install_element(ENABLE_NODE, &no_debug_isis_err_cmd);
2172 install_element(ENABLE_NODE, &debug_isis_snp_cmd);
2173 install_element(ENABLE_NODE, &no_debug_isis_snp_cmd);
2174 install_element(ENABLE_NODE, &debug_isis_upd_cmd);
2175 install_element(ENABLE_NODE, &no_debug_isis_upd_cmd);
2176 install_element(ENABLE_NODE, &debug_isis_spfevents_cmd);
2177 install_element(ENABLE_NODE, &no_debug_isis_spfevents_cmd);
2178 install_element(ENABLE_NODE, &debug_isis_spfstats_cmd);
2179 install_element(ENABLE_NODE, &no_debug_isis_spfstats_cmd);
2180 install_element(ENABLE_NODE, &debug_isis_spftrigg_cmd);
2181 install_element(ENABLE_NODE, &no_debug_isis_spftrigg_cmd);
2182 install_element(ENABLE_NODE, &debug_isis_rtevents_cmd);
2183 install_element(ENABLE_NODE, &no_debug_isis_rtevents_cmd);
2184 install_element(ENABLE_NODE, &debug_isis_events_cmd);
2185 install_element(ENABLE_NODE, &no_debug_isis_events_cmd);
2186 install_element(ENABLE_NODE, &debug_isis_packet_dump_cmd);
2187 install_element(ENABLE_NODE, &no_debug_isis_packet_dump_cmd);
2188 install_element(ENABLE_NODE, &debug_isis_lsp_gen_cmd);
2189 install_element(ENABLE_NODE, &no_debug_isis_lsp_gen_cmd);
2190 install_element(ENABLE_NODE, &debug_isis_lsp_sched_cmd);
2191 install_element(ENABLE_NODE, &no_debug_isis_lsp_sched_cmd);
2192
2193 install_element(CONFIG_NODE, &debug_isis_adj_cmd);
2194 install_element(CONFIG_NODE, &no_debug_isis_adj_cmd);
2195 install_element(CONFIG_NODE, &debug_isis_csum_cmd);
2196 install_element(CONFIG_NODE, &no_debug_isis_csum_cmd);
2197 install_element(CONFIG_NODE, &debug_isis_lupd_cmd);
2198 install_element(CONFIG_NODE, &no_debug_isis_lupd_cmd);
2199 install_element(CONFIG_NODE, &debug_isis_err_cmd);
2200 install_element(CONFIG_NODE, &no_debug_isis_err_cmd);
2201 install_element(CONFIG_NODE, &debug_isis_snp_cmd);
2202 install_element(CONFIG_NODE, &no_debug_isis_snp_cmd);
2203 install_element(CONFIG_NODE, &debug_isis_upd_cmd);
2204 install_element(CONFIG_NODE, &no_debug_isis_upd_cmd);
2205 install_element(CONFIG_NODE, &debug_isis_spfevents_cmd);
2206 install_element(CONFIG_NODE, &no_debug_isis_spfevents_cmd);
2207 install_element(CONFIG_NODE, &debug_isis_spfstats_cmd);
2208 install_element(CONFIG_NODE, &no_debug_isis_spfstats_cmd);
2209 install_element(CONFIG_NODE, &debug_isis_spftrigg_cmd);
2210 install_element(CONFIG_NODE, &no_debug_isis_spftrigg_cmd);
2211 install_element(CONFIG_NODE, &debug_isis_rtevents_cmd);
2212 install_element(CONFIG_NODE, &no_debug_isis_rtevents_cmd);
2213 install_element(CONFIG_NODE, &debug_isis_events_cmd);
2214 install_element(CONFIG_NODE, &no_debug_isis_events_cmd);
2215 install_element(CONFIG_NODE, &debug_isis_packet_dump_cmd);
2216 install_element(CONFIG_NODE, &no_debug_isis_packet_dump_cmd);
2217 install_element(CONFIG_NODE, &debug_isis_lsp_gen_cmd);
2218 install_element(CONFIG_NODE, &no_debug_isis_lsp_gen_cmd);
2219 install_element(CONFIG_NODE, &debug_isis_lsp_sched_cmd);
2220 install_element(CONFIG_NODE, &no_debug_isis_lsp_sched_cmd);
2221
2222 install_element(CONFIG_NODE, &router_isis_cmd);
2223 install_element(CONFIG_NODE, &no_router_isis_cmd);
2224
2225 install_default(ROUTER_NODE);
2226
2227 install_element(ROUTER_NODE, &net_cmd);
2228 install_element(ROUTER_NODE, &no_net_cmd);
2229
2230 install_element(ROUTER_NODE, &isis_topology_cmd);
2231 install_element(ROUTER_NODE, &no_isis_topology_cmd);
2232
2233 install_element(ROUTER_NODE, &log_adj_changes_cmd);
2234 install_element(ROUTER_NODE, &no_log_adj_changes_cmd);
2235
2236 spf_backoff_cmd_init();
2237 }