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"
60 struct isis
*isis
= NULL
;
62 DEFINE_QOBJ_TYPE(isis
)
63 DEFINE_QOBJ_TYPE(isis_area
)
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
*);
78 void isis_new(unsigned long process_id
)
80 isis
= XCALLOC(MTYPE_ISIS
, sizeof(struct isis
));
84 isis
->max_area_addrs
= 3;
85 isis
->process_id
= process_id
;
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();
94 * uncomment the next line for full debugs
96 /* isis->debugs = 0xFFFF; */
97 isisMplsTE
.status
= disable
; /* Only support TE metric */
101 struct isis_area
*isis_area_create(const char *area_tag
)
103 struct isis_area
*area
;
105 area
= XCALLOC(MTYPE_ISIS_AREA
, sizeof(struct isis_area
));
108 * The first instance is level-1-2 rest are level-1, unless otherwise
111 if (listcount(isis
->area_list
) > 0)
112 area
->is_type
= IS_LEVEL_1
;
114 area
->is_type
= IS_LEVEL_1_AND_2
;
117 * intialize the databases
119 if (area
->is_type
& IS_LEVEL_1
) {
120 area
->lspdb
[0] = lsp_db_init();
122 if (area
->is_type
& IS_LEVEL_2
) {
123 area
->lspdb
[1] = lsp_db_init();
126 spftree_area_init(area
);
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
);
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;
147 area
->lsp_frag_threshold
= 90;
148 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
152 area
->area_tag
= strdup(area_tag
);
153 listnode_add(isis
->area_list
, area
);
156 QOBJ_REG(area
, isis_area
);
161 struct isis_area
*isis_area_lookup(const char *area_tag
)
163 struct isis_area
*area
;
164 struct listnode
*node
;
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))
175 int isis_area_get(struct vty
*vty
, const char *area_tag
)
177 struct isis_area
*area
;
179 area
= isis_area_lookup(area_tag
);
182 VTY_PUSH_CONTEXT(ISIS_NODE
, area
);
186 area
= isis_area_create(area_tag
);
188 if (isis
->debugs
& DEBUG_EVENTS
)
189 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
191 VTY_PUSH_CONTEXT(ISIS_NODE
, area
);
196 int isis_area_destroy(struct vty
*vty
, const char *area_tag
)
198 struct isis_area
*area
;
199 struct listnode
*node
, *nnode
;
200 struct isis_circuit
*circuit
;
201 struct area_addr
*addr
;
203 area
= isis_area_lookup(area_tag
);
206 vty_out(vty
, "Can't find ISIS instance \n");
207 return CMD_ERR_NO_MATCH
;
212 if (area
->circuit_list
) {
213 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
215 circuit
->ip_router
= 0;
216 circuit
->ipv6_router
= 0;
217 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
219 list_delete_and_null(&area
->circuit_list
);
222 if (area
->lspdb
[0] != NULL
) {
223 lsp_db_destroy(area
->lspdb
[0]);
224 area
->lspdb
[0] = NULL
;
226 if (area
->lspdb
[1] != NULL
) {
227 lsp_db_destroy(area
->lspdb
[1]);
228 area
->lspdb
[1] = NULL
;
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
);
235 spftree_area_del(area
);
237 THREAD_TIMER_OFF(area
->spf_timer
[0]);
238 THREAD_TIMER_OFF(area
->spf_timer
[1]);
240 spf_backoff_free(area
->spf_delay_ietf
[0]);
241 spf_backoff_free(area
->spf_delay_ietf
[1]);
243 isis_redist_area_finish(area
);
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
);
249 area
->area_addrs
= NULL
;
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]);
255 thread_cancel_event(master
, area
);
257 listnode_delete(isis
->area_list
, area
);
259 free(area
->area_tag
);
261 area_mt_finish(area
);
263 XFREE(MTYPE_ISIS_AREA
, area
);
265 if (listcount(isis
->area_list
) == 0) {
266 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
273 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
276 struct isis_area_mt_setting
*setting
;
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);
285 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
288 struct isis_area_mt_setting
*setting
;
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
,
299 int area_net_title(struct vty
*vty
, const char *net_title
)
301 VTY_DECLVAR_CONTEXT(isis_area
, area
);
302 struct area_addr
*addr
;
303 struct area_addr
*addrp
;
304 struct listnode
*node
;
308 /* We check that we are not over the maximal number of addresses */
309 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
311 "Maximum of area addresses (%d) already reached \n",
312 isis
->max_area_addrs
);
313 return CMD_ERR_NOTHING_TODO
;
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
);
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) {
325 "area address must be at least 8..20 octets long (%d)\n",
327 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
328 return CMD_WARNING_CONFIG_FAILED
;
331 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
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
;
338 if (isis
->sysid_set
== 0) {
340 * First area address - get the SystemID for this router
342 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
344 if (isis
->debugs
& DEBUG_EVENTS
)
345 zlog_debug("Router has SystemID %s",
346 sysid_print(isis
->sysid
));
349 * Check that the SystemID portions match
351 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
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
;
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
)
363 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
365 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
366 return CMD_SUCCESS
; /* silent fail */
372 * Forget the systemID part of the address
374 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
375 listnode_add(area
->area_addrs
, addr
);
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
);
388 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
390 VTY_DECLVAR_CONTEXT(isis_area
, area
);
391 struct area_addr addr
, *addrp
= NULL
;
392 struct listnode
*node
;
395 addr
.addr_len
= dotformat2buff(buff
, net_title
);
396 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
398 "Unsupported area address length %d, should be 8...20 \n",
400 return CMD_WARNING_CONFIG_FAILED
;
403 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
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
))
411 vty_out(vty
, "No area address %s for area %s \n", net_title
,
413 return CMD_ERR_NO_MATCH
;
416 listnode_delete(area
->area_addrs
, addrp
);
417 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
420 * Last area address - reset the SystemID for this router
422 if (listcount(area
->area_addrs
) == 0) {
423 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
425 if (isis
->debugs
& DEBUG_EVENTS
)
426 zlog_debug("Router has no SystemID");
433 * 'show isis interface' command
436 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
438 struct listnode
*anode
, *cnode
;
439 struct isis_area
*area
;
440 struct isis_circuit
*circuit
;
443 vty_out(vty
, "IS-IS Routing Process not enabled\n");
447 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
448 vty_out(vty
, "Area %s:\n", area
->area_tag
);
450 if (detail
== ISIS_UI_LEVEL_BRIEF
)
452 " Interface CircId State Type Level\n");
454 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
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
);
464 DEFUN (show_isis_interface
,
465 show_isis_interface_cmd
,
466 "show isis interface",
468 "ISIS network information\n"
471 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
474 DEFUN (show_isis_interface_detail
,
475 show_isis_interface_detail_cmd
,
476 "show isis interface detail",
478 "ISIS network information\n"
480 "show detailed information\n")
482 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
485 DEFUN (show_isis_interface_arg
,
486 show_isis_interface_arg_cmd
,
487 "show isis interface WORD",
489 "ISIS network information\n"
491 "ISIS interface name\n")
494 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
495 ISIS_UI_LEVEL_DETAIL
);
499 * 'show isis neighbor' command
502 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
504 struct listnode
*anode
, *cnode
, *node
;
505 struct isis_area
*area
;
506 struct isis_circuit
*circuit
;
508 struct isis_adjacency
*adj
;
509 struct isis_dynhn
*dynhn
;
510 uint8_t sysid
[ISIS_SYS_ID_LEN
];
514 vty_out(vty
, "IS-IS Routing Process not enabled\n");
518 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
520 if (sysid2buff(sysid
, id
) == 0) {
521 dynhn
= dynhn_find_by_name(id
);
523 vty_out(vty
, "Invalid system id %s\n", id
);
526 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
530 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
531 vty_out(vty
, "Area %s:\n", area
->area_tag
);
533 if (detail
== ISIS_UI_LEVEL_BRIEF
)
535 " System Id Interface L State Holdtime SNPA\n");
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(
545 || !memcmp(adj
->sysid
,
554 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
555 && circuit
->u
.p2p
.neighbor
) {
556 adj
= circuit
->u
.p2p
.neighbor
;
558 || !memcmp(adj
->sysid
, sysid
,
560 isis_adj_print_vty(adj
, vty
, detail
);
569 * 'clear isis neighbor' command
571 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
573 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
574 struct isis_area
*area
;
575 struct isis_circuit
*circuit
;
577 struct isis_adjacency
*adj
;
578 struct isis_dynhn
*dynhn
;
579 uint8_t sysid
[ISIS_SYS_ID_LEN
];
583 vty_out(vty
, "IS-IS Routing Process not enabled\n");
587 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
589 if (sysid2buff(sysid
, id
) == 0) {
590 dynhn
= dynhn_find_by_name(id
);
592 vty_out(vty
, "Invalid system id %s\n", id
);
595 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
599 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
600 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
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(
610 || !memcmp(adj
->sysid
,
613 isis_adj_state_change(
616 "clear user request");
619 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
620 && circuit
->u
.p2p
.neighbor
) {
621 adj
= circuit
->u
.p2p
.neighbor
;
623 || !memcmp(adj
->sysid
, sysid
,
625 isis_adj_state_change(
627 "clear user request");
635 DEFUN (show_isis_neighbor
,
636 show_isis_neighbor_cmd
,
637 "show isis neighbor",
639 "ISIS network information\n"
640 "ISIS neighbor adjacencies\n")
642 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
645 DEFUN (show_isis_neighbor_detail
,
646 show_isis_neighbor_detail_cmd
,
647 "show isis neighbor detail",
649 "ISIS network information\n"
650 "ISIS neighbor adjacencies\n"
651 "show detailed information\n")
653 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
656 DEFUN (show_isis_neighbor_arg
,
657 show_isis_neighbor_arg_cmd
,
658 "show isis neighbor WORD",
660 "ISIS network information\n"
661 "ISIS neighbor adjacencies\n"
665 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
666 ISIS_UI_LEVEL_DETAIL
);
669 DEFUN (clear_isis_neighbor
,
670 clear_isis_neighbor_cmd
,
671 "clear isis neighbor",
673 "Reset ISIS network information\n"
674 "Reset ISIS neighbor adjacencies\n")
676 return clear_isis_neighbor_common(vty
, NULL
);
679 DEFUN (clear_isis_neighbor_arg
,
680 clear_isis_neighbor_arg_cmd
,
681 "clear isis neighbor WORD",
683 "ISIS network information\n"
684 "ISIS neighbor adjacencies\n"
688 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
692 * 'isis debug', 'show debugging'
694 void print_debug(struct vty
*vty
, int flags
, int onoff
)
698 strcpy(onoffs
, "on");
700 strcpy(onoffs
, "off");
702 if (flags
& DEBUG_ADJ_PACKETS
)
704 "IS-IS Adjacency related packets debugging is %s\n",
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",
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
)
719 "IS-IS SPF Timing and Statistics Data debugging is %s\n",
721 if (flags
& DEBUG_SPF_TRIGGERS
)
722 vty_out(vty
, "IS-IS SPF triggering events debugging is %s\n",
724 if (flags
& DEBUG_UPDATE_PACKETS
)
725 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
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
);
739 DEFUN_NOSH (show_debugging
,
740 show_debugging_isis_cmd
,
741 "show debugging [isis]",
743 "State of each debugging option\n"
746 vty_out(vty
, "IS-IS debugging status:\n");
749 print_debug(vty
, isis
->debugs
, 1);
755 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
757 static int config_write_debug(struct vty
*vty
)
760 int flags
= isis
->debugs
;
762 if (flags
& DEBUG_ADJ_PACKETS
) {
763 vty_out(vty
, "debug isis adj-packets\n");
766 if (flags
& DEBUG_CHECKSUM_ERRORS
) {
767 vty_out(vty
, "debug isis checksum-errors\n");
770 if (flags
& DEBUG_LOCAL_UPDATES
) {
771 vty_out(vty
, "debug isis local-updates\n");
774 if (flags
& DEBUG_PROTOCOL_ERRORS
) {
775 vty_out(vty
, "debug isis protocol-errors\n");
778 if (flags
& DEBUG_SNP_PACKETS
) {
779 vty_out(vty
, "debug isis snp-packets\n");
782 if (flags
& DEBUG_SPF_EVENTS
) {
783 vty_out(vty
, "debug isis spf-events\n");
786 if (flags
& DEBUG_SPF_STATS
) {
787 vty_out(vty
, "debug isis spf-statistics\n");
790 if (flags
& DEBUG_SPF_TRIGGERS
) {
791 vty_out(vty
, "debug isis spf-triggers\n");
794 if (flags
& DEBUG_UPDATE_PACKETS
) {
795 vty_out(vty
, "debug isis update-packets\n");
798 if (flags
& DEBUG_RTE_EVENTS
) {
799 vty_out(vty
, "debug isis route-events\n");
802 if (flags
& DEBUG_EVENTS
) {
803 vty_out(vty
, "debug isis events\n");
806 if (flags
& DEBUG_PACKET_DUMP
) {
807 vty_out(vty
, "debug isis packet-dump\n");
810 if (flags
& DEBUG_LSP_GEN
) {
811 vty_out(vty
, "debug isis lsp-gen\n");
814 if (flags
& DEBUG_LSP_SCHED
) {
815 vty_out(vty
, "debug isis lsp-sched\n");
818 write
+= spf_backoff_write_config(vty
);
823 DEFUN (debug_isis_adj
,
825 "debug isis adj-packets",
827 "IS-IS information\n"
828 "IS-IS Adjacency related packets\n")
830 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
831 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
836 DEFUN (no_debug_isis_adj
,
837 no_debug_isis_adj_cmd
,
838 "no debug isis adj-packets",
841 "IS-IS information\n"
842 "IS-IS Adjacency related packets\n")
844 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
845 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
850 DEFUN (debug_isis_csum
,
852 "debug isis checksum-errors",
854 "IS-IS information\n"
855 "IS-IS LSP checksum errors\n")
857 isis
->debugs
|= DEBUG_CHECKSUM_ERRORS
;
858 print_debug(vty
, DEBUG_CHECKSUM_ERRORS
, 1);
863 DEFUN (no_debug_isis_csum
,
864 no_debug_isis_csum_cmd
,
865 "no debug isis checksum-errors",
868 "IS-IS information\n"
869 "IS-IS LSP checksum errors\n")
871 isis
->debugs
&= ~DEBUG_CHECKSUM_ERRORS
;
872 print_debug(vty
, DEBUG_CHECKSUM_ERRORS
, 0);
877 DEFUN (debug_isis_lupd
,
879 "debug isis local-updates",
881 "IS-IS information\n"
882 "IS-IS local update packets\n")
884 isis
->debugs
|= DEBUG_LOCAL_UPDATES
;
885 print_debug(vty
, DEBUG_LOCAL_UPDATES
, 1);
890 DEFUN (no_debug_isis_lupd
,
891 no_debug_isis_lupd_cmd
,
892 "no debug isis local-updates",
895 "IS-IS information\n"
896 "IS-IS local update packets\n")
898 isis
->debugs
&= ~DEBUG_LOCAL_UPDATES
;
899 print_debug(vty
, DEBUG_LOCAL_UPDATES
, 0);
904 DEFUN (debug_isis_err
,
906 "debug isis protocol-errors",
908 "IS-IS information\n"
909 "IS-IS LSP protocol errors\n")
911 isis
->debugs
|= DEBUG_PROTOCOL_ERRORS
;
912 print_debug(vty
, DEBUG_PROTOCOL_ERRORS
, 1);
917 DEFUN (no_debug_isis_err
,
918 no_debug_isis_err_cmd
,
919 "no debug isis protocol-errors",
922 "IS-IS information\n"
923 "IS-IS LSP protocol errors\n")
925 isis
->debugs
&= ~DEBUG_PROTOCOL_ERRORS
;
926 print_debug(vty
, DEBUG_PROTOCOL_ERRORS
, 0);
931 DEFUN (debug_isis_snp
,
933 "debug isis snp-packets",
935 "IS-IS information\n"
936 "IS-IS CSNP/PSNP packets\n")
938 isis
->debugs
|= DEBUG_SNP_PACKETS
;
939 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
944 DEFUN (no_debug_isis_snp
,
945 no_debug_isis_snp_cmd
,
946 "no debug isis snp-packets",
949 "IS-IS information\n"
950 "IS-IS CSNP/PSNP packets\n")
952 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
953 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
958 DEFUN (debug_isis_upd
,
960 "debug isis update-packets",
962 "IS-IS information\n"
963 "IS-IS Update related packets\n")
965 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
966 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
971 DEFUN (no_debug_isis_upd
,
972 no_debug_isis_upd_cmd
,
973 "no debug isis update-packets",
976 "IS-IS information\n"
977 "IS-IS Update related packets\n")
979 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
980 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
985 DEFUN (debug_isis_spfevents
,
986 debug_isis_spfevents_cmd
,
987 "debug isis spf-events",
989 "IS-IS information\n"
990 "IS-IS Shortest Path First Events\n")
992 isis
->debugs
|= DEBUG_SPF_EVENTS
;
993 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
998 DEFUN (no_debug_isis_spfevents
,
999 no_debug_isis_spfevents_cmd
,
1000 "no debug isis spf-events",
1003 "IS-IS information\n"
1004 "IS-IS Shortest Path First Events\n")
1006 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1007 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1012 DEFUN (debug_isis_spfstats
,
1013 debug_isis_spfstats_cmd
,
1014 "debug isis spf-statistics ",
1016 "IS-IS information\n"
1017 "IS-IS SPF Timing and Statistic Data\n")
1019 isis
->debugs
|= DEBUG_SPF_STATS
;
1020 print_debug(vty
, DEBUG_SPF_STATS
, 1);
1025 DEFUN (no_debug_isis_spfstats
,
1026 no_debug_isis_spfstats_cmd
,
1027 "no debug isis spf-statistics",
1030 "IS-IS information\n"
1031 "IS-IS SPF Timing and Statistic Data\n")
1033 isis
->debugs
&= ~DEBUG_SPF_STATS
;
1034 print_debug(vty
, DEBUG_SPF_STATS
, 0);
1039 DEFUN (debug_isis_spftrigg
,
1040 debug_isis_spftrigg_cmd
,
1041 "debug isis spf-triggers",
1043 "IS-IS information\n"
1044 "IS-IS SPF triggering events\n")
1046 isis
->debugs
|= DEBUG_SPF_TRIGGERS
;
1047 print_debug(vty
, DEBUG_SPF_TRIGGERS
, 1);
1052 DEFUN (no_debug_isis_spftrigg
,
1053 no_debug_isis_spftrigg_cmd
,
1054 "no debug isis spf-triggers",
1057 "IS-IS information\n"
1058 "IS-IS SPF triggering events\n")
1060 isis
->debugs
&= ~DEBUG_SPF_TRIGGERS
;
1061 print_debug(vty
, DEBUG_SPF_TRIGGERS
, 0);
1066 DEFUN (debug_isis_rtevents
,
1067 debug_isis_rtevents_cmd
,
1068 "debug isis route-events",
1070 "IS-IS information\n"
1071 "IS-IS Route related events\n")
1073 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1074 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1079 DEFUN (no_debug_isis_rtevents
,
1080 no_debug_isis_rtevents_cmd
,
1081 "no debug isis route-events",
1084 "IS-IS information\n"
1085 "IS-IS Route related events\n")
1087 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1088 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1093 DEFUN (debug_isis_events
,
1094 debug_isis_events_cmd
,
1095 "debug isis events",
1097 "IS-IS information\n"
1100 isis
->debugs
|= DEBUG_EVENTS
;
1101 print_debug(vty
, DEBUG_EVENTS
, 1);
1106 DEFUN (no_debug_isis_events
,
1107 no_debug_isis_events_cmd
,
1108 "no debug isis events",
1111 "IS-IS information\n"
1114 isis
->debugs
&= ~DEBUG_EVENTS
;
1115 print_debug(vty
, DEBUG_EVENTS
, 0);
1120 DEFUN (debug_isis_packet_dump
,
1121 debug_isis_packet_dump_cmd
,
1122 "debug isis packet-dump",
1124 "IS-IS information\n"
1125 "IS-IS packet dump\n")
1127 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1128 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1133 DEFUN (no_debug_isis_packet_dump
,
1134 no_debug_isis_packet_dump_cmd
,
1135 "no debug isis packet-dump",
1138 "IS-IS information\n"
1139 "IS-IS packet dump\n")
1141 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1142 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1147 DEFUN (debug_isis_lsp_gen
,
1148 debug_isis_lsp_gen_cmd
,
1149 "debug isis lsp-gen",
1151 "IS-IS information\n"
1152 "IS-IS generation of own LSPs\n")
1154 isis
->debugs
|= DEBUG_LSP_GEN
;
1155 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1160 DEFUN (no_debug_isis_lsp_gen
,
1161 no_debug_isis_lsp_gen_cmd
,
1162 "no debug isis lsp-gen",
1165 "IS-IS information\n"
1166 "IS-IS generation of own LSPs\n")
1168 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1169 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1174 DEFUN (debug_isis_lsp_sched
,
1175 debug_isis_lsp_sched_cmd
,
1176 "debug isis lsp-sched",
1178 "IS-IS information\n"
1179 "IS-IS scheduling of LSP generation\n")
1181 isis
->debugs
|= DEBUG_LSP_SCHED
;
1182 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1187 DEFUN (no_debug_isis_lsp_sched
,
1188 no_debug_isis_lsp_sched_cmd
,
1189 "no debug isis lsp-sched",
1192 "IS-IS information\n"
1193 "IS-IS scheduling of LSP generation\n")
1195 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1196 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1201 DEFUN (show_hostname
,
1203 "show isis hostname",
1205 "IS-IS information\n"
1206 "IS-IS Dynamic hostname mapping\n")
1208 dynhn_print_all(vty
);
1213 DEFUN (show_isis_spf_ietf
,
1214 show_isis_spf_ietf_cmd
,
1215 "show isis spf-delay-ietf",
1217 "IS-IS information\n"
1218 "IS-IS SPF delay IETF information\n")
1221 vty_out(vty
, "ISIS is not running\n");
1225 struct listnode
*node
;
1226 struct isis_area
*area
;
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");
1232 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1233 if ((area
->is_type
& level
) == 0)
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);
1245 vty_out(vty
, "Not scheduled\n");
1248 if (area
->spf_delay_ietf
[level
- 1]) {
1250 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1252 area
->spf_delay_ietf
[level
- 1], vty
,
1255 vty_out(vty
, " Using legacy backoff algo\n");
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")
1267 struct listnode
*node
, *node2
;
1268 struct isis_area
*area
;
1272 vty_out(vty
, "ISIS is not running\n");
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
));
1281 vty_out(vty
, "Up time : ");
1282 vty_out_timestr(vty
, isis
->uptime
);
1285 if (isis
->area_list
)
1286 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
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");
1292 if (listcount(area
->area_addrs
) > 0) {
1293 struct area_addr
*area_addr
;
1294 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1296 vty_out(vty
, " Net: %s\n",
1297 isonet_print(area_addr
->area_addr
,
1304 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1305 if ((area
->is_type
& level
) == 0)
1308 vty_out(vty
, " Level-%d:\n", level
);
1309 if (area
->spf_timer
[level
- 1])
1310 vty_out(vty
, " SPF: (pending)\n");
1312 vty_out(vty
, " SPF:\n");
1314 vty_out(vty
, " minimum interval : %d",
1315 area
->min_spf_interval
[level
- 1]);
1316 if (area
->spf_delay_ietf
[level
- 1])
1318 " (not used, IETF SPF delay activated)");
1321 vty_out(vty
, " IPv4 route computation:\n");
1322 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1325 vty_out(vty
, " IPv6 route computation:\n");
1326 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1329 vty_out(vty
, " IPv6 dst-src route computation:\n");
1330 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
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> ]
1355 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1357 struct listnode
*node
;
1358 struct isis_area
*area
;
1359 struct isis_lsp
*lsp
;
1360 struct isis_dynhn
*dynhn
;
1362 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2];
1365 int level
, lsp_count
;
1367 if (isis
->area_list
->count
== 0)
1370 memset(&lspid
, 0, ISIS_SYS_ID_LEN
);
1371 memset(&sysid
, 0, 255);
1374 * extract fragment and pseudo id from the string argv
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:
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);
1391 if (strncmp(pos
, ".", 1) != 0)
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';
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");
1406 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1407 if (area
->lspdb
[level
]
1408 && dict_count(area
->lspdb
[level
]) > 0) {
1412 * Try to find the lsp-id if the argv
1415 * hostname.<pseudo-id>-<fragment>
1417 if (sysid2buff(lspid
, sysid
)) {
1420 area
->lspdb
[level
]);
1421 } else if ((dynhn
= dynhn_find_by_name(
1423 memcpy(lspid
, dynhn
->id
,
1427 area
->lspdb
[level
]);
1428 } else if (strncmp(cmd_hostname_get(),
1431 memcpy(lspid
, isis
->sysid
,
1435 area
->lspdb
[level
]);
1439 if (lsp
!= NULL
|| argv
== NULL
) {
1441 "IS-IS Level-%d link-state database:\n",
1444 /* print the title in all cases */
1446 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1450 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1457 } else if (argv
== NULL
) {
1458 lsp_count
= lsp_print_all(
1459 vty
, area
->lspdb
[level
],
1460 ui_level
, area
->dynhostname
);
1462 vty_out(vty
, " %u LSPs\n\n",
1472 DEFUN (show_database
,
1474 "show isis database [detail] [WORD]",
1476 "IS-IS information\n"
1477 "IS-IS link state database\n"
1478 "Detailed information\n"
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
);
1490 * 'router isis' command
1492 DEFUN_NOSH (router_isis
,
1497 "ISO Routing area tag\n")
1500 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1504 *'no router isis' command
1506 DEFUN (no_router_isis
,
1508 "no router isis WORD",
1509 "no\n" ROUTER_STR
"ISO IS-IS\n" "ISO Routing area tag\n")
1512 return isis_area_destroy(vty
, argv
[idx_word
]->arg
);
1521 "A Network Entity Title for this process (OSI only)\n"
1522 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1525 return area_net_title(vty
, argv
[idx_word
]->arg
);
1535 "A Network Entity Title for this process (OSI only)\n"
1536 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1539 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1542 DEFUN (isis_topology
,
1544 "topology " ISIS_MT_NAMES
" [overload]",
1545 "Configure IS-IS topologies\n"
1546 ISIS_MT_DESCRIPTIONS
1547 "Set overload bit for topology\n")
1549 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1551 const char *arg
= argv
[1]->arg
;
1552 uint16_t mtid
= isis_str2mtid(arg
);
1554 if (area
->oldmetric
) {
1556 "Multi topology IS-IS can only be used with wide metrics\n");
1557 return CMD_WARNING_CONFIG_FAILED
;
1560 if (mtid
== (uint16_t)-1) {
1561 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1562 return CMD_WARNING_CONFIG_FAILED
;
1564 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1565 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1566 return CMD_WARNING_CONFIG_FAILED
;
1569 area_set_mt_enabled(area
, mtid
, true);
1570 area_set_mt_overload(area
, mtid
, (argc
== 3));
1574 DEFUN (no_isis_topology
,
1575 no_isis_topology_cmd
,
1576 "no topology " ISIS_MT_NAMES
" [overload]",
1578 "Configure IS-IS topologies\n"
1579 ISIS_MT_DESCRIPTIONS
1580 "Set overload bit for topology\n")
1582 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1584 const char *arg
= argv
[2]->arg
;
1585 uint16_t mtid
= isis_str2mtid(arg
);
1587 if (area
->oldmetric
) {
1589 "Multi topology IS-IS can only be used with wide metrics\n");
1590 return CMD_WARNING_CONFIG_FAILED
;
1593 if (mtid
== (uint16_t)-1) {
1594 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1595 return CMD_WARNING_CONFIG_FAILED
;
1597 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1598 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1599 return CMD_WARNING_CONFIG_FAILED
;
1602 area_set_mt_enabled(area
, mtid
, false);
1603 area_set_mt_overload(area
, mtid
, false);
1607 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1609 area
->lsp_mtu
= lsp_mtu
;
1610 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1613 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1614 uint8_t passwd_type
, const char *passwd
,
1617 struct isis_passwd
*dest
;
1618 struct isis_passwd modified
;
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
));
1626 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1630 len
= strlen(passwd
);
1635 strncpy((char *)modified
.passwd
, passwd
, 255);
1636 modified
.type
= passwd_type
;
1637 modified
.snp_auth
= snp_auth
;
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);
1648 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1650 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1654 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1655 const char *passwd
, uint8_t snp_auth
)
1657 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1661 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1662 const char *passwd
, uint8_t snp_auth
)
1664 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1668 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1670 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1671 if (!(level
& levels
))
1673 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1674 isis_spf_invalidate_routes(
1675 area
->spftree
[tree
][level
- 1]);
1680 void isis_area_verify_routes(struct isis_area
*area
)
1682 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1683 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1686 static void area_resign_level(struct isis_area
*area
, int level
)
1688 isis_area_invalidate_routes(area
, level
);
1689 isis_area_verify_routes(area
);
1691 if (area
->lspdb
[level
- 1]) {
1692 lsp_db_destroy(area
->lspdb
[level
- 1]);
1693 area
->lspdb
[level
- 1] = NULL
;
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
;
1703 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
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;
1712 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1714 struct listnode
*node
;
1715 struct isis_circuit
*circuit
;
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
));
1722 if (area
->is_type
== is_type
)
1723 return; /* No change */
1725 switch (area
->is_type
) {
1727 if (is_type
== IS_LEVEL_2
)
1728 area_resign_level(area
, IS_LEVEL_1
);
1730 if (area
->lspdb
[1] == NULL
)
1731 area
->lspdb
[1] = lsp_db_init();
1734 case IS_LEVEL_1_AND_2
:
1735 if (is_type
== IS_LEVEL_1
)
1736 area_resign_level(area
, IS_LEVEL_2
);
1738 area_resign_level(area
, IS_LEVEL_1
);
1742 if (is_type
== IS_LEVEL_1
)
1743 area_resign_level(area
, IS_LEVEL_2
);
1745 if (area
->lspdb
[0] == NULL
)
1746 area
->lspdb
[0] = lsp_db_init();
1753 area
->is_type
= is_type
;
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
);
1761 spftree_area_init(area
);
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
);
1769 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1774 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
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);
1784 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1786 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
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);
1794 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1796 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
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);
1804 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1806 if (area
->dynhostname
!= dynhostname
) {
1807 area
->dynhostname
= dynhostname
;
1808 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1812 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1813 uint16_t max_lsp_lifetime
)
1815 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1817 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1820 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1821 lsp_regenerate_schedule(area
, level
, 1);
1824 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1825 uint16_t lsp_refresh
)
1827 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1829 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1832 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1833 lsp_regenerate_schedule(area
, level
, 1);
1836 DEFUN (log_adj_changes
,
1837 log_adj_changes_cmd
,
1838 "log-adjacency-changes",
1839 "Log changes in adjacency state\n")
1841 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1843 area
->log_adj_changes
= 1;
1848 DEFUN (no_log_adj_changes
,
1849 no_log_adj_changes_cmd
,
1850 "no log-adjacency-changes",
1852 "Stop logging changes in adjacency state\n")
1854 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1856 area
->log_adj_changes
= 0;
1861 /* IS-IS configuration write function */
1862 int isis_config_write(struct vty
*vty
)
1867 struct isis_area
*area
;
1868 struct listnode
*node
, *node2
;
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
);
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",
1881 area_addr
->area_addr
,
1888 /* ISIS - Dynamic hostname - Defaults to true so only
1891 if (!area
->dynhostname
) {
1892 vty_out(vty
, " no hostname dynamic\n");
1895 /* ISIS - Metric-Style - when true displays wide */
1896 if (area
->newmetric
) {
1897 if (!area
->oldmetric
)
1898 vty_out(vty
, " metric-style wide\n");
1901 " metric-style transition\n");
1904 vty_out(vty
, " metric-style narrow\n");
1907 /* ISIS - overload-bit */
1908 if (area
->overload_bit
) {
1909 vty_out(vty
, " set-overload-bit\n");
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");
1916 } else if (area
->is_type
== IS_LEVEL_2
) {
1917 vty_out(vty
, " is-type level-2-only\n");
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]);
1932 if (area
->lsp_gen_interval
[0]
1933 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1935 " lsp-gen-interval level-1 %d\n",
1936 area
->lsp_gen_interval
[0]);
1939 if (area
->lsp_gen_interval
[1]
1940 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1942 " lsp-gen-interval level-2 %d\n",
1943 area
->lsp_gen_interval
[1]);
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]);
1957 if (area
->max_lsp_lifetime
[0]
1958 != DEFAULT_LSP_LIFETIME
) {
1960 " max-lsp-lifetime level-1 %u\n",
1961 area
->max_lsp_lifetime
[0]);
1964 if (area
->max_lsp_lifetime
[1]
1965 != DEFAULT_LSP_LIFETIME
) {
1967 " max-lsp-lifetime level-2 %u\n",
1968 area
->max_lsp_lifetime
[1]);
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
) {
1977 " lsp-refresh-interval %u\n",
1978 area
->lsp_refresh
[0]);
1982 if (area
->lsp_refresh
[0]
1983 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1985 " lsp-refresh-interval level-1 %u\n",
1986 area
->lsp_refresh
[0]);
1989 if (area
->lsp_refresh
[1]
1990 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1992 " lsp-refresh-interval level-2 %u\n",
1993 area
->lsp_refresh
[1]);
1997 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
1998 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
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]);
2012 if (area
->min_spf_interval
[0]
2013 != MINIMUM_SPF_INTERVAL
) {
2015 " spf-interval level-1 %d\n",
2016 area
->min_spf_interval
[0]);
2019 if (area
->min_spf_interval
[1]
2020 != MINIMUM_SPF_INTERVAL
) {
2022 " spf-interval level-2 %d\n",
2023 area
->min_spf_interval
[1]);
2028 /* IETF SPF interval */
2029 if (area
->spf_delay_ietf
[0]) {
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]));
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
,
2052 vty_out(vty
, " authenticate snp ");
2054 area
->area_passwd
.snp_auth
,
2056 vty_out(vty
, "validate");
2058 vty_out(vty
, "send-only");
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
,
2068 vty_out(vty
, " authenticate snp ");
2070 area
->area_passwd
.snp_auth
,
2072 vty_out(vty
, "validate");
2074 vty_out(vty
, "send-only");
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
,
2085 vty_out(vty
, " authenticate snp ");
2086 if (CHECK_FLAG(area
->domain_passwd
2089 vty_out(vty
, "validate");
2091 vty_out(vty
, "send-only");
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
,
2101 vty_out(vty
, " authenticate snp ");
2102 if (CHECK_FLAG(area
->domain_passwd
2105 vty_out(vty
, "validate");
2107 vty_out(vty
, "send-only");
2113 if (area
->log_adj_changes
) {
2114 vty_out(vty
, " log-adjacency-changes\n");
2118 write
+= area_write_mt_settings(area
, vty
);
2120 isis_mpls_te_config_write_router(vty
);
2126 struct cmd_node isis_node
= {ISIS_NODE
, "%s(config-router)# ", 1};
2130 /* Install IS-IS top node */
2131 install_node(&isis_node
, isis_config_write
);
2133 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2135 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
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
);
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
);
2147 install_element(VIEW_NODE
, &show_hostname_cmd
);
2148 install_element(VIEW_NODE
, &show_database_cmd
);
2150 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2152 install_node(&debug_node
, config_write_debug
);
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
);
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
);
2212 install_element(CONFIG_NODE
, &router_isis_cmd
);
2213 install_element(CONFIG_NODE
, &no_router_isis_cmd
);
2215 install_default(ISIS_NODE
);
2217 install_element(ISIS_NODE
, &net_cmd
);
2218 install_element(ISIS_NODE
, &no_net_cmd
);
2220 install_element(ISIS_NODE
, &isis_topology_cmd
);
2221 install_element(ISIS_NODE
, &no_isis_topology_cmd
);
2223 install_element(ISIS_NODE
, &log_adj_changes_cmd
);
2224 install_element(ISIS_NODE
, &no_log_adj_changes_cmd
);
2226 spf_backoff_cmd_init();