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