2 * IS-IS Rout(e)ing protocol - isisd.c
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
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)
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
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
38 #include "spf_backoff.h"
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 #include "isisd/fabricd.h"
61 struct isis
*isis
= NULL
;
63 DEFINE_QOBJ_TYPE(isis
)
64 DEFINE_QOBJ_TYPE(isis_area
)
69 int isis_area_get(struct vty
*, const char *);
70 int isis_area_destroy(struct vty
*, const char *);
71 int area_net_title(struct vty
*, const char *);
72 int area_clear_net_title(struct vty
*, const char *);
73 int show_isis_interface_common(struct vty
*, const char *ifname
, char);
74 int show_isis_neighbor_common(struct vty
*, const char *id
, char);
75 int clear_isis_neighbor_common(struct vty
*, const char *id
);
76 int isis_config_write(struct vty
*);
79 void isis_new(unsigned long process_id
)
81 isis
= XCALLOC(MTYPE_ISIS
, sizeof(struct isis
));
85 isis
->max_area_addrs
= 3;
86 isis
->process_id
= process_id
;
88 isis
->area_list
= list_new();
89 isis
->init_circ_list
= list_new();
90 isis
->uptime
= time(NULL
);
91 isis
->nexthops
= list_new();
92 isis
->nexthops6
= list_new();
95 * uncomment the next line for full debugs
97 /* isis->debugs = 0xFFFF; */
98 isisMplsTE
.status
= disable
; /* Only support TE metric */
100 QOBJ_REG(isis
, isis
);
103 struct isis_area
*isis_area_create(const char *area_tag
)
105 struct isis_area
*area
;
107 area
= XCALLOC(MTYPE_ISIS_AREA
, sizeof(struct isis_area
));
110 * Fabricd runs only as level-2.
111 * For IS-IS, the first instance is level-1-2 rest are level-1,
112 * unless otherwise configured
115 area
->is_type
= IS_LEVEL_2
;
116 } else if (listcount(isis
->area_list
) > 0)
117 area
->is_type
= IS_LEVEL_1
;
119 area
->is_type
= IS_LEVEL_1_AND_2
;
122 * intialize the databases
124 if (area
->is_type
& IS_LEVEL_1
) {
125 area
->lspdb
[0] = lsp_db_init();
127 if (area
->is_type
& IS_LEVEL_2
) {
128 area
->lspdb
[1] = lsp_db_init();
131 spftree_area_init(area
);
133 area
->circuit_list
= list_new();
134 area
->area_addrs
= list_new();
135 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
136 flags_initialize(&area
->flags
);
141 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
142 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
143 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
144 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
145 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
146 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
147 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
148 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
149 area
->dynhostname
= 1;
152 area
->lsp_frag_threshold
= 90;
153 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
157 area
->area_tag
= strdup(area_tag
);
158 listnode_add(isis
->area_list
, area
);
162 area
->fabricd
= fabricd_new(area
);
163 QOBJ_REG(area
, isis_area
);
168 struct isis_area
*isis_area_lookup(const char *area_tag
)
170 struct isis_area
*area
;
171 struct listnode
*node
;
173 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
174 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
175 || (area
->area_tag
&& area_tag
176 && strcmp(area
->area_tag
, area_tag
) == 0))
182 int isis_area_get(struct vty
*vty
, const char *area_tag
)
184 struct isis_area
*area
;
186 area
= isis_area_lookup(area_tag
);
189 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
193 area
= isis_area_create(area_tag
);
195 if (isis
->debugs
& DEBUG_EVENTS
)
196 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
198 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
203 int isis_area_destroy(struct vty
*vty
, const char *area_tag
)
205 struct isis_area
*area
;
206 struct listnode
*node
, *nnode
;
207 struct isis_circuit
*circuit
;
208 struct area_addr
*addr
;
210 area
= isis_area_lookup(area_tag
);
213 vty_out(vty
, "Can't find ISIS instance \n");
214 return CMD_ERR_NO_MATCH
;
220 fabricd_finish(area
->fabricd
);
222 if (area
->circuit_list
) {
223 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
225 circuit
->ip_router
= 0;
226 circuit
->ipv6_router
= 0;
227 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
229 list_delete_and_null(&area
->circuit_list
);
232 if (area
->lspdb
[0] != NULL
) {
233 lsp_db_destroy(area
->lspdb
[0]);
234 area
->lspdb
[0] = NULL
;
236 if (area
->lspdb
[1] != NULL
) {
237 lsp_db_destroy(area
->lspdb
[1]);
238 area
->lspdb
[1] = NULL
;
241 /* invalidate and verify to delete all routes from zebra */
242 isis_area_invalidate_routes(area
, ISIS_LEVEL1
& ISIS_LEVEL2
);
243 isis_area_verify_routes(area
);
245 spftree_area_del(area
);
247 THREAD_TIMER_OFF(area
->spf_timer
[0]);
248 THREAD_TIMER_OFF(area
->spf_timer
[1]);
250 spf_backoff_free(area
->spf_delay_ietf
[0]);
251 spf_backoff_free(area
->spf_delay_ietf
[1]);
253 isis_redist_area_finish(area
);
255 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
256 list_delete_node(area
->area_addrs
, node
);
257 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
259 area
->area_addrs
= NULL
;
261 THREAD_TIMER_OFF(area
->t_tick
);
262 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
263 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
265 thread_cancel_event(master
, area
);
267 listnode_delete(isis
->area_list
, area
);
269 free(area
->area_tag
);
271 area_mt_finish(area
);
273 XFREE(MTYPE_ISIS_AREA
, area
);
275 if (listcount(isis
->area_list
) == 0) {
276 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
283 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
286 struct isis_area_mt_setting
*setting
;
288 setting
= area_get_mt_setting(area
, mtid
);
289 if (setting
->enabled
!= enabled
) {
290 setting
->enabled
= enabled
;
291 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
295 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
298 struct isis_area_mt_setting
*setting
;
300 setting
= area_get_mt_setting(area
, mtid
);
301 if (setting
->overload
!= overload
) {
302 setting
->overload
= overload
;
303 if (setting
->enabled
)
304 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
309 int area_net_title(struct vty
*vty
, const char *net_title
)
311 VTY_DECLVAR_CONTEXT(isis_area
, area
);
312 struct area_addr
*addr
;
313 struct area_addr
*addrp
;
314 struct listnode
*node
;
318 /* We check that we are not over the maximal number of addresses */
319 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
321 "Maximum of area addresses (%d) already reached \n",
322 isis
->max_area_addrs
);
323 return CMD_ERR_NOTHING_TODO
;
326 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
327 addr
->addr_len
= dotformat2buff(buff
, net_title
);
328 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
330 zlog_debug("added area address %s for area %s (address length %d)",
331 net_title
, area
->area_tag
, addr
->addr_len
);
332 #endif /* EXTREME_DEBUG */
333 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
335 "area address must be at least 8..20 octets long (%d)\n",
337 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
338 return CMD_WARNING_CONFIG_FAILED
;
341 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
343 "nsel byte (last byte) in area address must be 0\n");
344 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
345 return CMD_WARNING_CONFIG_FAILED
;
348 if (isis
->sysid_set
== 0) {
350 * First area address - get the SystemID for this router
352 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
354 if (isis
->debugs
& DEBUG_EVENTS
)
355 zlog_debug("Router has SystemID %s",
356 sysid_print(isis
->sysid
));
359 * Check that the SystemID portions match
361 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
363 "System ID must not change when defining additional area addresses\n");
364 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
365 return CMD_WARNING_CONFIG_FAILED
;
368 /* now we see that we don't already have this address */
369 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
370 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
373 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
375 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
376 return CMD_SUCCESS
; /* silent fail */
382 * Forget the systemID part of the address
384 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
385 listnode_add(area
->area_addrs
, addr
);
387 /* only now we can safely generate our LSPs for this area */
388 if (listcount(area
->area_addrs
) > 0) {
389 if (area
->is_type
& IS_LEVEL_1
)
390 lsp_generate(area
, IS_LEVEL_1
);
391 if (area
->is_type
& IS_LEVEL_2
)
392 lsp_generate(area
, IS_LEVEL_2
);
398 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
400 VTY_DECLVAR_CONTEXT(isis_area
, area
);
401 struct area_addr addr
, *addrp
= NULL
;
402 struct listnode
*node
;
405 addr
.addr_len
= dotformat2buff(buff
, net_title
);
406 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
408 "Unsupported area address length %d, should be 8...20 \n",
410 return CMD_WARNING_CONFIG_FAILED
;
413 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
415 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
416 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
417 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
421 vty_out(vty
, "No area address %s for area %s \n", net_title
,
423 return CMD_ERR_NO_MATCH
;
426 listnode_delete(area
->area_addrs
, addrp
);
427 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
430 * Last area address - reset the SystemID for this router
432 if (listcount(area
->area_addrs
) == 0) {
433 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
435 if (isis
->debugs
& DEBUG_EVENTS
)
436 zlog_debug("Router has no SystemID");
443 * 'show isis interface' command
446 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
448 struct listnode
*anode
, *cnode
;
449 struct isis_area
*area
;
450 struct isis_circuit
*circuit
;
453 vty_out(vty
, "IS-IS Routing Process not enabled\n");
457 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
458 vty_out(vty
, "Area %s:\n", area
->area_tag
);
460 if (detail
== ISIS_UI_LEVEL_BRIEF
)
462 " Interface CircId State Type Level\n");
464 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
466 isis_circuit_print_vty(circuit
, vty
, detail
);
467 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
468 isis_circuit_print_vty(circuit
, vty
, detail
);
474 DEFUN (show_isis_interface
,
475 show_isis_interface_cmd
,
476 "show " PROTO_NAME
" interface",
481 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
484 DEFUN (show_isis_interface_detail
,
485 show_isis_interface_detail_cmd
,
486 "show " PROTO_NAME
" interface detail",
490 "show detailed information\n")
492 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
495 DEFUN (show_isis_interface_arg
,
496 show_isis_interface_arg_cmd
,
497 "show " PROTO_NAME
" interface WORD",
501 "ISIS interface name\n")
504 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
505 ISIS_UI_LEVEL_DETAIL
);
509 * 'show isis neighbor' command
512 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
514 struct listnode
*anode
, *cnode
, *node
;
515 struct isis_area
*area
;
516 struct isis_circuit
*circuit
;
518 struct isis_adjacency
*adj
;
519 struct isis_dynhn
*dynhn
;
520 uint8_t sysid
[ISIS_SYS_ID_LEN
];
524 vty_out(vty
, "IS-IS Routing Process not enabled\n");
528 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
530 if (sysid2buff(sysid
, id
) == 0) {
531 dynhn
= dynhn_find_by_name(id
);
533 vty_out(vty
, "Invalid system id %s\n", id
);
536 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
540 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
541 vty_out(vty
, "Area %s:\n", area
->area_tag
);
543 if (detail
== ISIS_UI_LEVEL_BRIEF
)
545 " System Id Interface L State Holdtime SNPA\n");
547 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
548 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
549 for (i
= 0; i
< 2; i
++) {
550 adjdb
= circuit
->u
.bc
.adjdb
[i
];
551 if (adjdb
&& adjdb
->count
) {
552 for (ALL_LIST_ELEMENTS_RO(
555 || !memcmp(adj
->sysid
,
564 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
565 && circuit
->u
.p2p
.neighbor
) {
566 adj
= circuit
->u
.p2p
.neighbor
;
568 || !memcmp(adj
->sysid
, sysid
,
570 isis_adj_print_vty(adj
, vty
, detail
);
579 * 'clear isis neighbor' command
581 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
583 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
584 struct isis_area
*area
;
585 struct isis_circuit
*circuit
;
587 struct isis_adjacency
*adj
;
588 struct isis_dynhn
*dynhn
;
589 uint8_t sysid
[ISIS_SYS_ID_LEN
];
593 vty_out(vty
, "IS-IS Routing Process not enabled\n");
597 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
599 if (sysid2buff(sysid
, id
) == 0) {
600 dynhn
= dynhn_find_by_name(id
);
602 vty_out(vty
, "Invalid system id %s\n", id
);
605 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
609 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
610 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
612 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
613 for (i
= 0; i
< 2; i
++) {
614 adjdb
= circuit
->u
.bc
.adjdb
[i
];
615 if (adjdb
&& adjdb
->count
) {
616 for (ALL_LIST_ELEMENTS(
620 || !memcmp(adj
->sysid
,
623 isis_adj_state_change(
626 "clear user request");
629 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
630 && circuit
->u
.p2p
.neighbor
) {
631 adj
= circuit
->u
.p2p
.neighbor
;
633 || !memcmp(adj
->sysid
, sysid
,
635 isis_adj_state_change(
637 "clear user request");
645 DEFUN (show_isis_neighbor
,
646 show_isis_neighbor_cmd
,
647 "show " PROTO_NAME
" neighbor",
650 "ISIS neighbor adjacencies\n")
652 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
655 DEFUN (show_isis_neighbor_detail
,
656 show_isis_neighbor_detail_cmd
,
657 "show " PROTO_NAME
" neighbor detail",
660 "ISIS neighbor adjacencies\n"
661 "show detailed information\n")
663 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
666 DEFUN (show_isis_neighbor_arg
,
667 show_isis_neighbor_arg_cmd
,
668 "show " PROTO_NAME
" neighbor WORD",
671 "ISIS neighbor adjacencies\n"
675 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
676 ISIS_UI_LEVEL_DETAIL
);
679 DEFUN (clear_isis_neighbor
,
680 clear_isis_neighbor_cmd
,
681 "clear " PROTO_NAME
" neighbor",
684 "ISIS neighbor adjacencies\n")
686 return clear_isis_neighbor_common(vty
, NULL
);
689 DEFUN (clear_isis_neighbor_arg
,
690 clear_isis_neighbor_arg_cmd
,
691 "clear " PROTO_NAME
" neighbor WORD",
694 "ISIS neighbor adjacencies\n"
698 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
702 * 'isis debug', 'show debugging'
704 void print_debug(struct vty
*vty
, int flags
, int onoff
)
708 strcpy(onoffs
, "on");
710 strcpy(onoffs
, "off");
712 if (flags
& DEBUG_ADJ_PACKETS
)
714 "IS-IS Adjacency related packets debugging is %s\n",
716 if (flags
& DEBUG_CHECKSUM_ERRORS
)
717 vty_out(vty
, "IS-IS checksum errors debugging is %s\n", onoffs
);
718 if (flags
& DEBUG_LOCAL_UPDATES
)
719 vty_out(vty
, "IS-IS local updates debugging is %s\n", onoffs
);
720 if (flags
& DEBUG_PROTOCOL_ERRORS
)
721 vty_out(vty
, "IS-IS protocol errors debugging is %s\n", onoffs
);
722 if (flags
& DEBUG_SNP_PACKETS
)
723 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
725 if (flags
& DEBUG_SPF_EVENTS
)
726 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
727 if (flags
& DEBUG_SPF_STATS
)
729 "IS-IS SPF Timing and Statistics Data debugging is %s\n",
731 if (flags
& DEBUG_SPF_TRIGGERS
)
732 vty_out(vty
, "IS-IS SPF triggering events debugging is %s\n",
734 if (flags
& DEBUG_UPDATE_PACKETS
)
735 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
737 if (flags
& DEBUG_RTE_EVENTS
)
738 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
739 if (flags
& DEBUG_EVENTS
)
740 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
741 if (flags
& DEBUG_PACKET_DUMP
)
742 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
743 if (flags
& DEBUG_LSP_GEN
)
744 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
745 if (flags
& DEBUG_LSP_SCHED
)
746 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
747 if (flags
& DEBUG_FABRICD_FLOODING
)
748 vty_out(vty
, "OpenFabric Flooding debugging is %s\n", onoffs
);
751 DEFUN_NOSH (show_debugging
,
752 show_debugging_isis_cmd
,
753 "show debugging [" PROTO_NAME
"]",
755 "State of each debugging option\n"
758 vty_out(vty
, PROTO_NAME
" debugging status:\n");
761 print_debug(vty
, isis
->debugs
, 1);
767 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
769 static int config_write_debug(struct vty
*vty
)
772 int flags
= isis
->debugs
;
774 if (flags
& DEBUG_ADJ_PACKETS
) {
775 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
778 if (flags
& DEBUG_CHECKSUM_ERRORS
) {
779 vty_out(vty
, "debug " PROTO_NAME
" checksum-errors\n");
782 if (flags
& DEBUG_LOCAL_UPDATES
) {
783 vty_out(vty
, "debug " PROTO_NAME
" local-updates\n");
786 if (flags
& DEBUG_PROTOCOL_ERRORS
) {
787 vty_out(vty
, "debug " PROTO_NAME
" protocol-errors\n");
790 if (flags
& DEBUG_SNP_PACKETS
) {
791 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
794 if (flags
& DEBUG_SPF_EVENTS
) {
795 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
798 if (flags
& DEBUG_SPF_STATS
) {
799 vty_out(vty
, "debug " PROTO_NAME
" spf-statistics\n");
802 if (flags
& DEBUG_SPF_TRIGGERS
) {
803 vty_out(vty
, "debug " PROTO_NAME
" spf-triggers\n");
806 if (flags
& DEBUG_UPDATE_PACKETS
) {
807 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
810 if (flags
& DEBUG_RTE_EVENTS
) {
811 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
814 if (flags
& DEBUG_EVENTS
) {
815 vty_out(vty
, "debug " PROTO_NAME
" events\n");
818 if (flags
& DEBUG_PACKET_DUMP
) {
819 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
822 if (flags
& DEBUG_LSP_GEN
) {
823 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
826 if (flags
& DEBUG_LSP_SCHED
) {
827 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
830 if (flags
& DEBUG_FABRICD_FLOODING
) {
831 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
834 write
+= spf_backoff_write_config(vty
);
839 DEFUN (debug_isis_adj
,
841 "debug " PROTO_NAME
" adj-packets",
844 "IS-IS Adjacency related packets\n")
846 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
847 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
852 DEFUN (no_debug_isis_adj
,
853 no_debug_isis_adj_cmd
,
854 "no debug " PROTO_NAME
" adj-packets",
858 "IS-IS Adjacency related packets\n")
860 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
861 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
866 DEFUN (debug_isis_csum
,
868 "debug " PROTO_NAME
" checksum-errors",
871 "IS-IS LSP checksum errors\n")
873 isis
->debugs
|= DEBUG_CHECKSUM_ERRORS
;
874 print_debug(vty
, DEBUG_CHECKSUM_ERRORS
, 1);
879 DEFUN (no_debug_isis_csum
,
880 no_debug_isis_csum_cmd
,
881 "no debug " PROTO_NAME
" checksum-errors",
885 "IS-IS LSP checksum errors\n")
887 isis
->debugs
&= ~DEBUG_CHECKSUM_ERRORS
;
888 print_debug(vty
, DEBUG_CHECKSUM_ERRORS
, 0);
893 DEFUN (debug_isis_lupd
,
895 "debug " PROTO_NAME
" local-updates",
898 "IS-IS local update packets\n")
900 isis
->debugs
|= DEBUG_LOCAL_UPDATES
;
901 print_debug(vty
, DEBUG_LOCAL_UPDATES
, 1);
906 DEFUN (no_debug_isis_lupd
,
907 no_debug_isis_lupd_cmd
,
908 "no debug " PROTO_NAME
" local-updates",
912 "IS-IS local update packets\n")
914 isis
->debugs
&= ~DEBUG_LOCAL_UPDATES
;
915 print_debug(vty
, DEBUG_LOCAL_UPDATES
, 0);
920 DEFUN (debug_isis_err
,
922 "debug " PROTO_NAME
" protocol-errors",
925 "IS-IS LSP protocol errors\n")
927 isis
->debugs
|= DEBUG_PROTOCOL_ERRORS
;
928 print_debug(vty
, DEBUG_PROTOCOL_ERRORS
, 1);
933 DEFUN (no_debug_isis_err
,
934 no_debug_isis_err_cmd
,
935 "no debug " PROTO_NAME
" protocol-errors",
939 "IS-IS LSP protocol errors\n")
941 isis
->debugs
&= ~DEBUG_PROTOCOL_ERRORS
;
942 print_debug(vty
, DEBUG_PROTOCOL_ERRORS
, 0);
947 DEFUN (debug_isis_snp
,
949 "debug " PROTO_NAME
" snp-packets",
952 "IS-IS CSNP/PSNP packets\n")
954 isis
->debugs
|= DEBUG_SNP_PACKETS
;
955 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
960 DEFUN (no_debug_isis_snp
,
961 no_debug_isis_snp_cmd
,
962 "no debug " PROTO_NAME
" snp-packets",
966 "IS-IS CSNP/PSNP packets\n")
968 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
969 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
974 DEFUN (debug_isis_upd
,
976 "debug " PROTO_NAME
" update-packets",
979 "IS-IS Update related packets\n")
981 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
982 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
987 DEFUN (no_debug_isis_upd
,
988 no_debug_isis_upd_cmd
,
989 "no debug " PROTO_NAME
" update-packets",
993 "IS-IS Update related packets\n")
995 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
996 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
1001 DEFUN (debug_isis_spfevents
,
1002 debug_isis_spfevents_cmd
,
1003 "debug " PROTO_NAME
" spf-events",
1006 "IS-IS Shortest Path First Events\n")
1008 isis
->debugs
|= DEBUG_SPF_EVENTS
;
1009 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
1014 DEFUN (no_debug_isis_spfevents
,
1015 no_debug_isis_spfevents_cmd
,
1016 "no debug " PROTO_NAME
" spf-events",
1020 "IS-IS Shortest Path First Events\n")
1022 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1023 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1028 DEFUN (debug_isis_spfstats
,
1029 debug_isis_spfstats_cmd
,
1030 "debug " PROTO_NAME
" spf-statistics ",
1033 "IS-IS SPF Timing and Statistic Data\n")
1035 isis
->debugs
|= DEBUG_SPF_STATS
;
1036 print_debug(vty
, DEBUG_SPF_STATS
, 1);
1041 DEFUN (no_debug_isis_spfstats
,
1042 no_debug_isis_spfstats_cmd
,
1043 "no debug " PROTO_NAME
" spf-statistics",
1047 "IS-IS SPF Timing and Statistic Data\n")
1049 isis
->debugs
&= ~DEBUG_SPF_STATS
;
1050 print_debug(vty
, DEBUG_SPF_STATS
, 0);
1055 DEFUN (debug_isis_spftrigg
,
1056 debug_isis_spftrigg_cmd
,
1057 "debug " PROTO_NAME
" spf-triggers",
1060 "IS-IS SPF triggering events\n")
1062 isis
->debugs
|= DEBUG_SPF_TRIGGERS
;
1063 print_debug(vty
, DEBUG_SPF_TRIGGERS
, 1);
1068 DEFUN (no_debug_isis_spftrigg
,
1069 no_debug_isis_spftrigg_cmd
,
1070 "no debug " PROTO_NAME
" spf-triggers",
1074 "IS-IS SPF triggering events\n")
1076 isis
->debugs
&= ~DEBUG_SPF_TRIGGERS
;
1077 print_debug(vty
, DEBUG_SPF_TRIGGERS
, 0);
1082 DEFUN (debug_isis_rtevents
,
1083 debug_isis_rtevents_cmd
,
1084 "debug " PROTO_NAME
" route-events",
1087 "IS-IS Route related events\n")
1089 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1090 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1095 DEFUN (no_debug_isis_rtevents
,
1096 no_debug_isis_rtevents_cmd
,
1097 "no debug " PROTO_NAME
" route-events",
1101 "IS-IS Route related events\n")
1103 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1104 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1109 DEFUN (debug_isis_events
,
1110 debug_isis_events_cmd
,
1111 "debug " PROTO_NAME
" events",
1116 isis
->debugs
|= DEBUG_EVENTS
;
1117 print_debug(vty
, DEBUG_EVENTS
, 1);
1122 DEFUN (no_debug_isis_events
,
1123 no_debug_isis_events_cmd
,
1124 "no debug " PROTO_NAME
" events",
1130 isis
->debugs
&= ~DEBUG_EVENTS
;
1131 print_debug(vty
, DEBUG_EVENTS
, 0);
1136 DEFUN (debug_isis_packet_dump
,
1137 debug_isis_packet_dump_cmd
,
1138 "debug " PROTO_NAME
" packet-dump",
1141 "IS-IS packet dump\n")
1143 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1144 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1149 DEFUN (no_debug_isis_packet_dump
,
1150 no_debug_isis_packet_dump_cmd
,
1151 "no debug " PROTO_NAME
" packet-dump",
1155 "IS-IS packet dump\n")
1157 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1158 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1163 DEFUN (debug_isis_lsp_gen
,
1164 debug_isis_lsp_gen_cmd
,
1165 "debug " PROTO_NAME
" lsp-gen",
1168 "IS-IS generation of own LSPs\n")
1170 isis
->debugs
|= DEBUG_LSP_GEN
;
1171 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1176 DEFUN (no_debug_isis_lsp_gen
,
1177 no_debug_isis_lsp_gen_cmd
,
1178 "no debug " PROTO_NAME
" lsp-gen",
1182 "IS-IS generation of own LSPs\n")
1184 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1185 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1190 DEFUN (debug_isis_lsp_sched
,
1191 debug_isis_lsp_sched_cmd
,
1192 "debug " PROTO_NAME
" lsp-sched",
1195 "IS-IS scheduling of LSP generation\n")
1197 isis
->debugs
|= DEBUG_LSP_SCHED
;
1198 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1203 DEFUN (no_debug_isis_lsp_sched
,
1204 no_debug_isis_lsp_sched_cmd
,
1205 "no debug " PROTO_NAME
" lsp-sched",
1209 "IS-IS scheduling of LSP generation\n")
1211 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1212 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1217 DEFUN (show_hostname
,
1219 "show " PROTO_NAME
" hostname",
1222 "IS-IS Dynamic hostname mapping\n")
1224 dynhn_print_all(vty
);
1229 DEFUN (show_isis_spf_ietf
,
1230 show_isis_spf_ietf_cmd
,
1231 "show " PROTO_NAME
" spf-delay-ietf",
1234 "SPF delay IETF information\n")
1237 vty_out(vty
, "ISIS is not running\n");
1241 struct listnode
*node
;
1242 struct isis_area
*area
;
1244 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1245 vty_out(vty
, "Area %s:\n",
1246 area
->area_tag
? area
->area_tag
: "null");
1248 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1249 if ((area
->is_type
& level
) == 0)
1252 vty_out(vty
, " Level-%d:\n", level
);
1253 vty_out(vty
, " SPF delay status: ");
1254 if (area
->spf_timer
[level
- 1]) {
1255 struct timeval remain
= thread_timer_remain(
1256 area
->spf_timer
[level
- 1]);
1257 vty_out(vty
, "Pending, due in %lld msec\n",
1258 (long long)remain
.tv_sec
* 1000
1259 + remain
.tv_usec
/ 1000);
1261 vty_out(vty
, "Not scheduled\n");
1264 if (area
->spf_delay_ietf
[level
- 1]) {
1266 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1268 area
->spf_delay_ietf
[level
- 1], vty
,
1271 vty_out(vty
, " Using legacy backoff algo\n");
1278 DEFUN (show_isis_summary
,
1279 show_isis_summary_cmd
,
1280 "show " PROTO_NAME
" summary",
1281 SHOW_STR PROTO_HELP
"summary\n")
1283 struct listnode
*node
, *node2
;
1284 struct isis_area
*area
;
1288 vty_out(vty
, PROTO_NAME
" is not running\n");
1292 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1293 if (isis
->sysid_set
)
1294 vty_out(vty
, "System Id : %s\n",
1295 sysid_print(isis
->sysid
));
1297 vty_out(vty
, "Up time : ");
1298 vty_out_timestr(vty
, isis
->uptime
);
1301 if (isis
->area_list
)
1302 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1304 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1305 vty_out(vty
, "Area %s:\n",
1306 area
->area_tag
? area
->area_tag
: "null");
1309 uint8_t tier
= fabricd_tier(area
);
1310 if (tier
== ISIS_TIER_UNDEFINED
)
1311 vty_out(vty
, " Tier: undefined\n");
1313 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1316 if (listcount(area
->area_addrs
) > 0) {
1317 struct area_addr
*area_addr
;
1318 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1320 vty_out(vty
, " Net: %s\n",
1321 isonet_print(area_addr
->area_addr
,
1328 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1329 if ((area
->is_type
& level
) == 0)
1332 vty_out(vty
, " Level-%d:\n", level
);
1333 if (area
->spf_timer
[level
- 1])
1334 vty_out(vty
, " SPF: (pending)\n");
1336 vty_out(vty
, " SPF:\n");
1338 vty_out(vty
, " minimum interval : %d",
1339 area
->min_spf_interval
[level
- 1]);
1340 if (area
->spf_delay_ietf
[level
- 1])
1342 " (not used, IETF SPF delay activated)");
1345 vty_out(vty
, " IPv4 route computation:\n");
1346 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1349 vty_out(vty
, " IPv6 route computation:\n");
1350 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1353 vty_out(vty
, " IPv6 dst-src route computation:\n");
1354 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1364 * This function supports following display options:
1365 * [ show isis database [detail] ]
1366 * [ show isis database <sysid> [detail] ]
1367 * [ show isis database <hostname> [detail] ]
1368 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1369 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1370 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1371 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1372 * [ show isis database detail <sysid> ]
1373 * [ show isis database detail <hostname> ]
1374 * [ show isis database detail <sysid>.<pseudo-id> ]
1375 * [ show isis database detail <hostname>.<pseudo-id> ]
1376 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1377 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1379 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1381 struct listnode
*node
;
1382 struct isis_area
*area
;
1383 struct isis_lsp
*lsp
;
1384 struct isis_dynhn
*dynhn
;
1386 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2];
1389 int level
, lsp_count
;
1391 if (isis
->area_list
->count
== 0)
1394 memset(&lspid
, 0, ISIS_SYS_ID_LEN
);
1395 memset(&sysid
, 0, 255);
1398 * extract fragment and pseudo id from the string argv
1400 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1401 * (b) <systemid/hostname>.<pseudo-id> or
1402 * (c) <systemid/hostname> or
1403 * Where systemid is in the form:
1407 strncpy(sysid
, argv
, 254);
1408 if (argv
&& strlen(argv
) > 3) {
1409 pos
= argv
+ strlen(argv
) - 3;
1410 if (strncmp(pos
, "-", 1) == 0) {
1411 memcpy(number
, ++pos
, 2);
1412 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1413 (uint8_t)strtol((char *)number
, NULL
, 16);
1415 if (strncmp(pos
, ".", 1) != 0)
1418 if (strncmp(pos
, ".", 1) == 0) {
1419 memcpy(number
, ++pos
, 2);
1420 lspid
[ISIS_SYS_ID_LEN
] =
1421 (uint8_t)strtol((char *)number
, NULL
, 16);
1422 sysid
[pos
- argv
- 1] = '\0';
1426 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1427 vty_out(vty
, "Area %s:\n",
1428 area
->area_tag
? area
->area_tag
: "null");
1430 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1431 if (area
->lspdb
[level
]
1432 && dict_count(area
->lspdb
[level
]) > 0) {
1436 * Try to find the lsp-id if the argv
1439 * hostname.<pseudo-id>-<fragment>
1441 if (sysid2buff(lspid
, sysid
)) {
1444 area
->lspdb
[level
]);
1445 } else if ((dynhn
= dynhn_find_by_name(
1447 memcpy(lspid
, dynhn
->id
,
1451 area
->lspdb
[level
]);
1452 } else if (strncmp(cmd_hostname_get(),
1455 memcpy(lspid
, isis
->sysid
,
1459 area
->lspdb
[level
]);
1463 if (lsp
!= NULL
|| argv
== NULL
) {
1465 "IS-IS Level-%d link-state database:\n",
1468 /* print the title in all cases */
1470 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1474 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1481 } else if (argv
== NULL
) {
1482 lsp_count
= lsp_print_all(
1483 vty
, area
->lspdb
[level
],
1484 ui_level
, area
->dynhostname
);
1486 vty_out(vty
, " %u LSPs\n\n",
1496 DEFUN (show_database
,
1498 "show " PROTO_NAME
" database [detail] [WORD]",
1501 "Link state database\n"
1502 "Detailed information\n"
1506 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1507 ? ISIS_UI_LEVEL_DETAIL
1508 : ISIS_UI_LEVEL_BRIEF
;
1509 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1510 return show_isis_database(vty
, id
, uilevel
);
1514 * 'router isis' command
1516 DEFUN_NOSH (router_isis
,
1518 "router " PROTO_NAME
" WORD",
1521 "ISO Routing area tag\n")
1524 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1528 *'no router isis' command
1530 DEFUN (no_router_isis
,
1532 "no router " PROTO_NAME
" WORD",
1536 "ISO Routing area tag\n")
1539 return isis_area_destroy(vty
, argv
[idx_word
]->arg
);
1548 "A Network Entity Title for this process (OSI only)\n"
1549 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1552 return area_net_title(vty
, argv
[idx_word
]->arg
);
1562 "A Network Entity Title for this process (OSI only)\n"
1563 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1566 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1569 DEFUN (isis_topology
,
1571 "topology " ISIS_MT_NAMES
" [overload]",
1572 "Configure IS-IS topologies\n"
1573 ISIS_MT_DESCRIPTIONS
1574 "Set overload bit for topology\n")
1576 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1578 const char *arg
= argv
[1]->arg
;
1579 uint16_t mtid
= isis_str2mtid(arg
);
1581 if (area
->oldmetric
) {
1583 "Multi topology IS-IS can only be used with wide metrics\n");
1584 return CMD_WARNING_CONFIG_FAILED
;
1587 if (mtid
== (uint16_t)-1) {
1588 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1589 return CMD_WARNING_CONFIG_FAILED
;
1591 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1592 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1593 return CMD_WARNING_CONFIG_FAILED
;
1596 area_set_mt_enabled(area
, mtid
, true);
1597 area_set_mt_overload(area
, mtid
, (argc
== 3));
1601 DEFUN (no_isis_topology
,
1602 no_isis_topology_cmd
,
1603 "no topology " ISIS_MT_NAMES
" [overload]",
1605 "Configure IS-IS topologies\n"
1606 ISIS_MT_DESCRIPTIONS
1607 "Set overload bit for topology\n")
1609 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1611 const char *arg
= argv
[2]->arg
;
1612 uint16_t mtid
= isis_str2mtid(arg
);
1614 if (area
->oldmetric
) {
1616 "Multi topology IS-IS can only be used with wide metrics\n");
1617 return CMD_WARNING_CONFIG_FAILED
;
1620 if (mtid
== (uint16_t)-1) {
1621 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1622 return CMD_WARNING_CONFIG_FAILED
;
1624 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1625 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1626 return CMD_WARNING_CONFIG_FAILED
;
1629 area_set_mt_enabled(area
, mtid
, false);
1630 area_set_mt_overload(area
, mtid
, false);
1634 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1636 area
->lsp_mtu
= lsp_mtu
;
1637 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1640 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1641 uint8_t passwd_type
, const char *passwd
,
1644 struct isis_passwd
*dest
;
1645 struct isis_passwd modified
;
1648 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1649 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1650 : &area
->domain_passwd
;
1651 memset(&modified
, 0, sizeof(modified
));
1653 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1657 len
= strlen(passwd
);
1662 strncpy((char *)modified
.passwd
, passwd
, 255);
1663 modified
.type
= passwd_type
;
1664 modified
.snp_auth
= snp_auth
;
1667 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1668 memcpy(dest
, &modified
, sizeof(modified
));
1669 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1675 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1677 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1681 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1682 const char *passwd
, uint8_t snp_auth
)
1684 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1688 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1689 const char *passwd
, uint8_t snp_auth
)
1691 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1695 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1697 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1698 if (!(level
& levels
))
1700 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1701 isis_spf_invalidate_routes(
1702 area
->spftree
[tree
][level
- 1]);
1707 void isis_area_verify_routes(struct isis_area
*area
)
1709 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1710 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1713 static void area_resign_level(struct isis_area
*area
, int level
)
1715 isis_area_invalidate_routes(area
, level
);
1716 isis_area_verify_routes(area
);
1718 if (area
->lspdb
[level
- 1]) {
1719 lsp_db_destroy(area
->lspdb
[level
- 1]);
1720 area
->lspdb
[level
- 1] = NULL
;
1723 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1724 if (area
->spftree
[tree
][level
- 1]) {
1725 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1726 area
->spftree
[tree
][level
- 1] = NULL
;
1730 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1733 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1734 area
->area_tag
, level
);
1735 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1736 area
->lsp_regenerate_pending
[level
- 1] = 0;
1739 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1741 struct listnode
*node
;
1742 struct isis_circuit
*circuit
;
1744 if (isis
->debugs
& DEBUG_EVENTS
)
1745 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1746 area
->area_tag
, circuit_t2string(area
->is_type
),
1747 circuit_t2string(is_type
));
1749 if (area
->is_type
== is_type
)
1750 return; /* No change */
1752 switch (area
->is_type
) {
1754 if (is_type
== IS_LEVEL_2
)
1755 area_resign_level(area
, IS_LEVEL_1
);
1757 if (area
->lspdb
[1] == NULL
)
1758 area
->lspdb
[1] = lsp_db_init();
1761 case IS_LEVEL_1_AND_2
:
1762 if (is_type
== IS_LEVEL_1
)
1763 area_resign_level(area
, IS_LEVEL_2
);
1765 area_resign_level(area
, IS_LEVEL_1
);
1769 if (is_type
== IS_LEVEL_1
)
1770 area_resign_level(area
, IS_LEVEL_2
);
1772 if (area
->lspdb
[0] == NULL
)
1773 area
->lspdb
[0] = lsp_db_init();
1780 area
->is_type
= is_type
;
1782 /* override circuit's is_type */
1783 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1784 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1785 isis_circuit_is_type_set(circuit
, is_type
);
1788 spftree_area_init(area
);
1790 if (listcount(area
->area_addrs
) > 0) {
1791 if (is_type
& IS_LEVEL_1
)
1792 lsp_generate(area
, IS_LEVEL_1
);
1793 if (is_type
& IS_LEVEL_2
)
1794 lsp_generate(area
, IS_LEVEL_2
);
1796 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1801 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1804 if (area
->oldmetric
!= old_metric
|| area
->newmetric
!= new_metric
) {
1805 area
->oldmetric
= old_metric
;
1806 area
->newmetric
= new_metric
;
1807 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1811 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1813 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1815 if (new_overload_bit
!= area
->overload_bit
) {
1816 area
->overload_bit
= new_overload_bit
;
1817 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1821 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1823 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1825 if (new_attached_bit
!= area
->attached_bit
) {
1826 area
->attached_bit
= new_attached_bit
;
1827 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1831 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1833 if (area
->dynhostname
!= dynhostname
) {
1834 area
->dynhostname
= dynhostname
;
1835 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1839 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1840 uint16_t max_lsp_lifetime
)
1842 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1844 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1847 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1848 lsp_regenerate_schedule(area
, level
, 1);
1851 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1852 uint16_t lsp_refresh
)
1854 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1856 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1859 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1860 lsp_regenerate_schedule(area
, level
, 1);
1863 DEFUN (log_adj_changes
,
1864 log_adj_changes_cmd
,
1865 "log-adjacency-changes",
1866 "Log changes in adjacency state\n")
1868 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1870 area
->log_adj_changes
= 1;
1875 DEFUN (no_log_adj_changes
,
1876 no_log_adj_changes_cmd
,
1877 "no log-adjacency-changes",
1879 "Stop logging changes in adjacency state\n")
1881 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1883 area
->log_adj_changes
= 0;
1888 /* IS-IS configuration write function */
1889 int isis_config_write(struct vty
*vty
)
1894 struct isis_area
*area
;
1895 struct listnode
*node
, *node2
;
1897 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1898 /* ISIS - Area name */
1899 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1902 if (listcount(area
->area_addrs
) > 0) {
1903 struct area_addr
*area_addr
;
1904 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1905 node2
, area_addr
)) {
1906 vty_out(vty
, " net %s\n",
1908 area_addr
->area_addr
,
1915 /* ISIS - Dynamic hostname - Defaults to true so only
1918 if (!area
->dynhostname
) {
1919 vty_out(vty
, " no hostname dynamic\n");
1922 /* ISIS - Metric-Style - when true displays wide */
1924 if (area
->newmetric
) {
1925 if (!area
->oldmetric
)
1926 vty_out(vty
, " metric-style wide\n");
1929 " metric-style transition\n");
1932 vty_out(vty
, " metric-style narrow\n");
1936 /* ISIS - overload-bit */
1937 if (area
->overload_bit
) {
1938 vty_out(vty
, " set-overload-bit\n");
1941 /* ISIS - Area is-type (level-1-2 is default) */
1943 if (area
->is_type
== IS_LEVEL_1
) {
1944 vty_out(vty
, " is-type level-1\n");
1946 } else if (area
->is_type
== IS_LEVEL_2
) {
1947 vty_out(vty
, " is-type level-2-only\n");
1951 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1952 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1953 /* ISIS - Lsp generation interval */
1954 if (area
->lsp_gen_interval
[0]
1955 == area
->lsp_gen_interval
[1]) {
1956 if (area
->lsp_gen_interval
[0]
1957 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1958 vty_out(vty
, " lsp-gen-interval %d\n",
1959 area
->lsp_gen_interval
[0]);
1963 if (area
->lsp_gen_interval
[0]
1964 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1966 " lsp-gen-interval level-1 %d\n",
1967 area
->lsp_gen_interval
[0]);
1970 if (area
->lsp_gen_interval
[1]
1971 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1973 " lsp-gen-interval level-2 %d\n",
1974 area
->lsp_gen_interval
[1]);
1978 /* ISIS - LSP lifetime */
1979 if (area
->max_lsp_lifetime
[0]
1980 == area
->max_lsp_lifetime
[1]) {
1981 if (area
->max_lsp_lifetime
[0]
1982 != DEFAULT_LSP_LIFETIME
) {
1983 vty_out(vty
, " max-lsp-lifetime %u\n",
1984 area
->max_lsp_lifetime
[0]);
1988 if (area
->max_lsp_lifetime
[0]
1989 != DEFAULT_LSP_LIFETIME
) {
1991 " max-lsp-lifetime level-1 %u\n",
1992 area
->max_lsp_lifetime
[0]);
1995 if (area
->max_lsp_lifetime
[1]
1996 != DEFAULT_LSP_LIFETIME
) {
1998 " max-lsp-lifetime level-2 %u\n",
1999 area
->max_lsp_lifetime
[1]);
2003 /* ISIS - LSP refresh interval */
2004 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
2005 if (area
->lsp_refresh
[0]
2006 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2008 " lsp-refresh-interval %u\n",
2009 area
->lsp_refresh
[0]);
2013 if (area
->lsp_refresh
[0]
2014 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2016 " lsp-refresh-interval level-1 %u\n",
2017 area
->lsp_refresh
[0]);
2020 if (area
->lsp_refresh
[1]
2021 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2023 " lsp-refresh-interval level-2 %u\n",
2024 area
->lsp_refresh
[1]);
2028 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
2029 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
2032 if (area
->purge_originator
) {
2033 vty_out(vty
, " purge-originator\n");
2037 /* Minimum SPF interval. */
2038 if (area
->min_spf_interval
[0]
2039 == area
->min_spf_interval
[1]) {
2040 if (area
->min_spf_interval
[0]
2041 != MINIMUM_SPF_INTERVAL
) {
2042 vty_out(vty
, " spf-interval %d\n",
2043 area
->min_spf_interval
[0]);
2047 if (area
->min_spf_interval
[0]
2048 != MINIMUM_SPF_INTERVAL
) {
2050 " spf-interval level-1 %d\n",
2051 area
->min_spf_interval
[0]);
2054 if (area
->min_spf_interval
[1]
2055 != MINIMUM_SPF_INTERVAL
) {
2057 " spf-interval level-2 %d\n",
2058 area
->min_spf_interval
[1]);
2063 /* IETF SPF interval */
2064 if (area
->spf_delay_ietf
[0]) {
2066 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2067 spf_backoff_init_delay(
2068 area
->spf_delay_ietf
[0]),
2069 spf_backoff_short_delay(
2070 area
->spf_delay_ietf
[0]),
2071 spf_backoff_long_delay(
2072 area
->spf_delay_ietf
[0]),
2073 spf_backoff_holddown(
2074 area
->spf_delay_ietf
[0]),
2075 spf_backoff_timetolearn(
2076 area
->spf_delay_ietf
[0]));
2080 /* Authentication passwords. */
2081 if (area
->area_passwd
.type
2082 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2083 vty_out(vty
, " area-password md5 %s",
2084 area
->area_passwd
.passwd
);
2085 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2087 vty_out(vty
, " authenticate snp ");
2089 area
->area_passwd
.snp_auth
,
2091 vty_out(vty
, "validate");
2093 vty_out(vty
, "send-only");
2097 } else if (area
->area_passwd
.type
2098 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2099 vty_out(vty
, " area-password clear %s",
2100 area
->area_passwd
.passwd
);
2101 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2103 vty_out(vty
, " authenticate snp ");
2105 area
->area_passwd
.snp_auth
,
2107 vty_out(vty
, "validate");
2109 vty_out(vty
, "send-only");
2114 if (area
->domain_passwd
.type
2115 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2116 vty_out(vty
, " domain-password md5 %s",
2117 area
->domain_passwd
.passwd
);
2118 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2120 vty_out(vty
, " authenticate snp ");
2121 if (CHECK_FLAG(area
->domain_passwd
2124 vty_out(vty
, "validate");
2126 vty_out(vty
, "send-only");
2130 } else if (area
->domain_passwd
.type
2131 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2132 vty_out(vty
, " domain-password clear %s",
2133 area
->domain_passwd
.passwd
);
2134 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2136 vty_out(vty
, " authenticate snp ");
2137 if (CHECK_FLAG(area
->domain_passwd
2140 vty_out(vty
, "validate");
2142 vty_out(vty
, "send-only");
2148 if (area
->log_adj_changes
) {
2149 vty_out(vty
, " log-adjacency-changes\n");
2153 write
+= area_write_mt_settings(area
, vty
);
2154 write
+= fabricd_write_settings(area
, vty
);
2156 isis_mpls_te_config_write_router(vty
);
2162 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2166 /* Install IS-IS top node */
2167 install_node(&router_node
, isis_config_write
);
2169 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2171 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2173 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2174 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2175 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2177 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2178 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2179 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2180 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2181 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2183 install_element(VIEW_NODE
, &show_hostname_cmd
);
2184 install_element(VIEW_NODE
, &show_database_cmd
);
2186 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2188 install_node(&debug_node
, config_write_debug
);
2190 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2191 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2192 install_element(ENABLE_NODE
, &debug_isis_csum_cmd
);
2193 install_element(ENABLE_NODE
, &no_debug_isis_csum_cmd
);
2194 install_element(ENABLE_NODE
, &debug_isis_lupd_cmd
);
2195 install_element(ENABLE_NODE
, &no_debug_isis_lupd_cmd
);
2196 install_element(ENABLE_NODE
, &debug_isis_err_cmd
);
2197 install_element(ENABLE_NODE
, &no_debug_isis_err_cmd
);
2198 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2199 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2200 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2201 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2202 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2203 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2204 install_element(ENABLE_NODE
, &debug_isis_spfstats_cmd
);
2205 install_element(ENABLE_NODE
, &no_debug_isis_spfstats_cmd
);
2206 install_element(ENABLE_NODE
, &debug_isis_spftrigg_cmd
);
2207 install_element(ENABLE_NODE
, &no_debug_isis_spftrigg_cmd
);
2208 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2209 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2210 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2211 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2212 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2213 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2214 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2215 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2216 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2217 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2219 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2220 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2221 install_element(CONFIG_NODE
, &debug_isis_csum_cmd
);
2222 install_element(CONFIG_NODE
, &no_debug_isis_csum_cmd
);
2223 install_element(CONFIG_NODE
, &debug_isis_lupd_cmd
);
2224 install_element(CONFIG_NODE
, &no_debug_isis_lupd_cmd
);
2225 install_element(CONFIG_NODE
, &debug_isis_err_cmd
);
2226 install_element(CONFIG_NODE
, &no_debug_isis_err_cmd
);
2227 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2228 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2229 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2230 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2231 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2232 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2233 install_element(CONFIG_NODE
, &debug_isis_spfstats_cmd
);
2234 install_element(CONFIG_NODE
, &no_debug_isis_spfstats_cmd
);
2235 install_element(CONFIG_NODE
, &debug_isis_spftrigg_cmd
);
2236 install_element(CONFIG_NODE
, &no_debug_isis_spftrigg_cmd
);
2237 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2238 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2239 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2240 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2241 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2242 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2243 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2244 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2245 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2246 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2248 install_element(CONFIG_NODE
, &router_isis_cmd
);
2249 install_element(CONFIG_NODE
, &no_router_isis_cmd
);
2251 install_default(ROUTER_NODE
);
2253 install_element(ROUTER_NODE
, &net_cmd
);
2254 install_element(ROUTER_NODE
, &no_net_cmd
);
2256 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2257 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2259 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2260 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2262 spf_backoff_cmd_init();