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();
121 area
->route_table
[0] = route_table_init();
122 area
->route_table6
[0] = route_table_init();
124 if (area
->is_type
& IS_LEVEL_2
) {
125 area
->lspdb
[1] = lsp_db_init();
126 area
->route_table
[1] = route_table_init();
127 area
->route_table6
[1] = route_table_init();
130 spftree_area_init(area
);
132 area
->circuit_list
= list_new();
133 area
->area_addrs
= list_new();
134 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
135 flags_initialize(&area
->flags
);
140 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
141 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
142 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
143 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
144 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
145 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
146 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
147 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
148 area
->dynhostname
= 1;
151 area
->lsp_frag_threshold
= 90;
152 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
156 area
->area_tag
= strdup(area_tag
);
157 listnode_add(isis
->area_list
, area
);
160 QOBJ_REG(area
, isis_area
);
165 struct isis_area
*isis_area_lookup(const char *area_tag
)
167 struct isis_area
*area
;
168 struct listnode
*node
;
170 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
171 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
172 || (area
->area_tag
&& area_tag
173 && strcmp(area
->area_tag
, area_tag
) == 0))
179 int isis_area_get(struct vty
*vty
, const char *area_tag
)
181 struct isis_area
*area
;
183 area
= isis_area_lookup(area_tag
);
186 VTY_PUSH_CONTEXT(ISIS_NODE
, area
);
190 area
= isis_area_create(area_tag
);
192 if (isis
->debugs
& DEBUG_EVENTS
)
193 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
195 VTY_PUSH_CONTEXT(ISIS_NODE
, area
);
200 int isis_area_destroy(struct vty
*vty
, const char *area_tag
)
202 struct isis_area
*area
;
203 struct listnode
*node
, *nnode
;
204 struct isis_circuit
*circuit
;
205 struct area_addr
*addr
;
207 area
= isis_area_lookup(area_tag
);
210 vty_out(vty
, "Can't find ISIS instance \n");
211 return CMD_ERR_NO_MATCH
;
216 if (area
->circuit_list
) {
217 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
219 circuit
->ip_router
= 0;
220 circuit
->ipv6_router
= 0;
221 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
223 list_delete_and_null(&area
->circuit_list
);
226 if (area
->lspdb
[0] != NULL
) {
227 lsp_db_destroy(area
->lspdb
[0]);
228 area
->lspdb
[0] = NULL
;
230 if (area
->lspdb
[1] != NULL
) {
231 lsp_db_destroy(area
->lspdb
[1]);
232 area
->lspdb
[1] = NULL
;
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 /* invalidate and validate would delete all routes from zebra */
244 isis_route_invalidate(area
);
245 isis_route_validate(area
);
247 if (area
->route_table
[0]) {
248 route_table_finish(area
->route_table
[0]);
249 area
->route_table
[0] = NULL
;
251 if (area
->route_table
[1]) {
252 route_table_finish(area
->route_table
[1]);
253 area
->route_table
[1] = NULL
;
255 if (area
->route_table6
[0]) {
256 route_table_finish(area
->route_table6
[0]);
257 area
->route_table6
[0] = NULL
;
259 if (area
->route_table6
[1]) {
260 route_table_finish(area
->route_table6
[1]);
261 area
->route_table6
[1] = NULL
;
264 isis_redist_area_finish(area
);
266 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
267 list_delete_node(area
->area_addrs
, node
);
268 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
270 area
->area_addrs
= NULL
;
272 THREAD_TIMER_OFF(area
->t_tick
);
273 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
274 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
276 thread_cancel_event(master
, area
);
278 listnode_delete(isis
->area_list
, area
);
280 free(area
->area_tag
);
282 area_mt_finish(area
);
284 XFREE(MTYPE_ISIS_AREA
, area
);
286 if (listcount(isis
->area_list
) == 0) {
287 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
294 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
297 struct isis_area_mt_setting
*setting
;
299 setting
= area_get_mt_setting(area
, mtid
);
300 if (setting
->enabled
!= enabled
) {
301 setting
->enabled
= enabled
;
302 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
306 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
309 struct isis_area_mt_setting
*setting
;
311 setting
= area_get_mt_setting(area
, mtid
);
312 if (setting
->overload
!= overload
) {
313 setting
->overload
= overload
;
314 if (setting
->enabled
)
315 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
320 int area_net_title(struct vty
*vty
, const char *net_title
)
322 VTY_DECLVAR_CONTEXT(isis_area
, area
);
323 struct area_addr
*addr
;
324 struct area_addr
*addrp
;
325 struct listnode
*node
;
329 /* We check that we are not over the maximal number of addresses */
330 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
332 "Maximum of area addresses (%d) already reached \n",
333 isis
->max_area_addrs
);
334 return CMD_ERR_NOTHING_TODO
;
337 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
338 addr
->addr_len
= dotformat2buff(buff
, net_title
);
339 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
341 zlog_debug("added area address %s for area %s (address length %d)",
342 net_title
, area
->area_tag
, addr
->addr_len
);
343 #endif /* EXTREME_DEBUG */
344 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
346 "area address must be at least 8..20 octets long (%d)\n",
348 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
349 return CMD_WARNING_CONFIG_FAILED
;
352 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
354 "nsel byte (last byte) in area address must be 0\n");
355 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
356 return CMD_WARNING_CONFIG_FAILED
;
359 if (isis
->sysid_set
== 0) {
361 * First area address - get the SystemID for this router
363 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
365 if (isis
->debugs
& DEBUG_EVENTS
)
366 zlog_debug("Router has SystemID %s",
367 sysid_print(isis
->sysid
));
370 * Check that the SystemID portions match
372 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
374 "System ID must not change when defining additional area addresses\n");
375 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
376 return CMD_WARNING_CONFIG_FAILED
;
379 /* now we see that we don't already have this address */
380 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
381 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
384 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
386 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
387 return CMD_SUCCESS
; /* silent fail */
393 * Forget the systemID part of the address
395 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
396 listnode_add(area
->area_addrs
, addr
);
398 /* only now we can safely generate our LSPs for this area */
399 if (listcount(area
->area_addrs
) > 0) {
400 if (area
->is_type
& IS_LEVEL_1
)
401 lsp_generate(area
, IS_LEVEL_1
);
402 if (area
->is_type
& IS_LEVEL_2
)
403 lsp_generate(area
, IS_LEVEL_2
);
409 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
411 VTY_DECLVAR_CONTEXT(isis_area
, area
);
412 struct area_addr addr
, *addrp
= NULL
;
413 struct listnode
*node
;
416 addr
.addr_len
= dotformat2buff(buff
, net_title
);
417 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
419 "Unsupported area address length %d, should be 8...20 \n",
421 return CMD_WARNING_CONFIG_FAILED
;
424 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
426 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
427 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
428 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
432 vty_out(vty
, "No area address %s for area %s \n", net_title
,
434 return CMD_ERR_NO_MATCH
;
437 listnode_delete(area
->area_addrs
, addrp
);
438 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
441 * Last area address - reset the SystemID for this router
443 if (listcount(area
->area_addrs
) == 0) {
444 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
446 if (isis
->debugs
& DEBUG_EVENTS
)
447 zlog_debug("Router has no SystemID");
454 * 'show isis interface' command
457 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
459 struct listnode
*anode
, *cnode
;
460 struct isis_area
*area
;
461 struct isis_circuit
*circuit
;
464 vty_out(vty
, "IS-IS Routing Process not enabled\n");
468 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
469 vty_out(vty
, "Area %s:\n", area
->area_tag
);
471 if (detail
== ISIS_UI_LEVEL_BRIEF
)
473 " Interface CircId State Type Level\n");
475 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
477 isis_circuit_print_vty(circuit
, vty
, detail
);
478 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
479 isis_circuit_print_vty(circuit
, vty
, detail
);
485 DEFUN (show_isis_interface
,
486 show_isis_interface_cmd
,
487 "show isis interface",
489 "ISIS network information\n"
492 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
495 DEFUN (show_isis_interface_detail
,
496 show_isis_interface_detail_cmd
,
497 "show isis interface detail",
499 "ISIS network information\n"
501 "show detailed information\n")
503 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
506 DEFUN (show_isis_interface_arg
,
507 show_isis_interface_arg_cmd
,
508 "show isis interface WORD",
510 "ISIS network information\n"
512 "ISIS interface name\n")
515 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
516 ISIS_UI_LEVEL_DETAIL
);
520 * 'show isis neighbor' command
523 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
525 struct listnode
*anode
, *cnode
, *node
;
526 struct isis_area
*area
;
527 struct isis_circuit
*circuit
;
529 struct isis_adjacency
*adj
;
530 struct isis_dynhn
*dynhn
;
531 uint8_t sysid
[ISIS_SYS_ID_LEN
];
535 vty_out(vty
, "IS-IS Routing Process not enabled\n");
539 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
541 if (sysid2buff(sysid
, id
) == 0) {
542 dynhn
= dynhn_find_by_name(id
);
544 vty_out(vty
, "Invalid system id %s\n", id
);
547 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
551 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
552 vty_out(vty
, "Area %s:\n", area
->area_tag
);
554 if (detail
== ISIS_UI_LEVEL_BRIEF
)
556 " System Id Interface L State Holdtime SNPA\n");
558 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
559 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
560 for (i
= 0; i
< 2; i
++) {
561 adjdb
= circuit
->u
.bc
.adjdb
[i
];
562 if (adjdb
&& adjdb
->count
) {
563 for (ALL_LIST_ELEMENTS_RO(
566 || !memcmp(adj
->sysid
,
575 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
576 && circuit
->u
.p2p
.neighbor
) {
577 adj
= circuit
->u
.p2p
.neighbor
;
579 || !memcmp(adj
->sysid
, sysid
,
581 isis_adj_print_vty(adj
, vty
, detail
);
590 * 'clear isis neighbor' command
592 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
594 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
595 struct isis_area
*area
;
596 struct isis_circuit
*circuit
;
598 struct isis_adjacency
*adj
;
599 struct isis_dynhn
*dynhn
;
600 uint8_t sysid
[ISIS_SYS_ID_LEN
];
604 vty_out(vty
, "IS-IS Routing Process not enabled\n");
608 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
610 if (sysid2buff(sysid
, id
) == 0) {
611 dynhn
= dynhn_find_by_name(id
);
613 vty_out(vty
, "Invalid system id %s\n", id
);
616 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
620 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
621 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
623 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
624 for (i
= 0; i
< 2; i
++) {
625 adjdb
= circuit
->u
.bc
.adjdb
[i
];
626 if (adjdb
&& adjdb
->count
) {
627 for (ALL_LIST_ELEMENTS(
631 || !memcmp(adj
->sysid
,
634 isis_adj_state_change(
637 "clear user request");
640 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
641 && circuit
->u
.p2p
.neighbor
) {
642 adj
= circuit
->u
.p2p
.neighbor
;
644 || !memcmp(adj
->sysid
, sysid
,
646 isis_adj_state_change(
648 "clear user request");
656 DEFUN (show_isis_neighbor
,
657 show_isis_neighbor_cmd
,
658 "show isis neighbor",
660 "ISIS network information\n"
661 "ISIS neighbor adjacencies\n")
663 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
666 DEFUN (show_isis_neighbor_detail
,
667 show_isis_neighbor_detail_cmd
,
668 "show isis neighbor detail",
670 "ISIS network information\n"
671 "ISIS neighbor adjacencies\n"
672 "show detailed information\n")
674 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
677 DEFUN (show_isis_neighbor_arg
,
678 show_isis_neighbor_arg_cmd
,
679 "show isis neighbor WORD",
681 "ISIS network information\n"
682 "ISIS neighbor adjacencies\n"
686 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
687 ISIS_UI_LEVEL_DETAIL
);
690 DEFUN (clear_isis_neighbor
,
691 clear_isis_neighbor_cmd
,
692 "clear isis neighbor",
694 "Reset ISIS network information\n"
695 "Reset ISIS neighbor adjacencies\n")
697 return clear_isis_neighbor_common(vty
, NULL
);
700 DEFUN (clear_isis_neighbor_arg
,
701 clear_isis_neighbor_arg_cmd
,
702 "clear isis neighbor WORD",
704 "ISIS network information\n"
705 "ISIS neighbor adjacencies\n"
709 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
713 * 'isis debug', 'show debugging'
715 void print_debug(struct vty
*vty
, int flags
, int onoff
)
719 strcpy(onoffs
, "on");
721 strcpy(onoffs
, "off");
723 if (flags
& DEBUG_ADJ_PACKETS
)
725 "IS-IS Adjacency related packets debugging is %s\n",
727 if (flags
& DEBUG_CHECKSUM_ERRORS
)
728 vty_out(vty
, "IS-IS checksum errors debugging is %s\n", onoffs
);
729 if (flags
& DEBUG_LOCAL_UPDATES
)
730 vty_out(vty
, "IS-IS local updates debugging is %s\n", onoffs
);
731 if (flags
& DEBUG_PROTOCOL_ERRORS
)
732 vty_out(vty
, "IS-IS protocol errors debugging is %s\n", onoffs
);
733 if (flags
& DEBUG_SNP_PACKETS
)
734 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
736 if (flags
& DEBUG_SPF_EVENTS
)
737 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
738 if (flags
& DEBUG_SPF_STATS
)
740 "IS-IS SPF Timing and Statistics Data debugging is %s\n",
742 if (flags
& DEBUG_SPF_TRIGGERS
)
743 vty_out(vty
, "IS-IS SPF triggering events debugging is %s\n",
745 if (flags
& DEBUG_UPDATE_PACKETS
)
746 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
748 if (flags
& DEBUG_RTE_EVENTS
)
749 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
750 if (flags
& DEBUG_EVENTS
)
751 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
752 if (flags
& DEBUG_PACKET_DUMP
)
753 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
754 if (flags
& DEBUG_LSP_GEN
)
755 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
756 if (flags
& DEBUG_LSP_SCHED
)
757 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
760 DEFUN_NOSH (show_debugging
,
761 show_debugging_isis_cmd
,
762 "show debugging [isis]",
764 "State of each debugging option\n"
767 vty_out(vty
, "IS-IS debugging status:\n");
770 print_debug(vty
, isis
->debugs
, 1);
776 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
778 static int config_write_debug(struct vty
*vty
)
781 int flags
= isis
->debugs
;
783 if (flags
& DEBUG_ADJ_PACKETS
) {
784 vty_out(vty
, "debug isis adj-packets\n");
787 if (flags
& DEBUG_CHECKSUM_ERRORS
) {
788 vty_out(vty
, "debug isis checksum-errors\n");
791 if (flags
& DEBUG_LOCAL_UPDATES
) {
792 vty_out(vty
, "debug isis local-updates\n");
795 if (flags
& DEBUG_PROTOCOL_ERRORS
) {
796 vty_out(vty
, "debug isis protocol-errors\n");
799 if (flags
& DEBUG_SNP_PACKETS
) {
800 vty_out(vty
, "debug isis snp-packets\n");
803 if (flags
& DEBUG_SPF_EVENTS
) {
804 vty_out(vty
, "debug isis spf-events\n");
807 if (flags
& DEBUG_SPF_STATS
) {
808 vty_out(vty
, "debug isis spf-statistics\n");
811 if (flags
& DEBUG_SPF_TRIGGERS
) {
812 vty_out(vty
, "debug isis spf-triggers\n");
815 if (flags
& DEBUG_UPDATE_PACKETS
) {
816 vty_out(vty
, "debug isis update-packets\n");
819 if (flags
& DEBUG_RTE_EVENTS
) {
820 vty_out(vty
, "debug isis route-events\n");
823 if (flags
& DEBUG_EVENTS
) {
824 vty_out(vty
, "debug isis events\n");
827 if (flags
& DEBUG_PACKET_DUMP
) {
828 vty_out(vty
, "debug isis packet-dump\n");
831 if (flags
& DEBUG_LSP_GEN
) {
832 vty_out(vty
, "debug isis lsp-gen\n");
835 if (flags
& DEBUG_LSP_SCHED
) {
836 vty_out(vty
, "debug isis lsp-sched\n");
839 write
+= spf_backoff_write_config(vty
);
844 DEFUN (debug_isis_adj
,
846 "debug isis adj-packets",
848 "IS-IS information\n"
849 "IS-IS Adjacency related packets\n")
851 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
852 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
857 DEFUN (no_debug_isis_adj
,
858 no_debug_isis_adj_cmd
,
859 "no debug isis adj-packets",
862 "IS-IS information\n"
863 "IS-IS Adjacency related packets\n")
865 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
866 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
871 DEFUN (debug_isis_csum
,
873 "debug isis checksum-errors",
875 "IS-IS information\n"
876 "IS-IS LSP checksum errors\n")
878 isis
->debugs
|= DEBUG_CHECKSUM_ERRORS
;
879 print_debug(vty
, DEBUG_CHECKSUM_ERRORS
, 1);
884 DEFUN (no_debug_isis_csum
,
885 no_debug_isis_csum_cmd
,
886 "no debug isis checksum-errors",
889 "IS-IS information\n"
890 "IS-IS LSP checksum errors\n")
892 isis
->debugs
&= ~DEBUG_CHECKSUM_ERRORS
;
893 print_debug(vty
, DEBUG_CHECKSUM_ERRORS
, 0);
898 DEFUN (debug_isis_lupd
,
900 "debug isis local-updates",
902 "IS-IS information\n"
903 "IS-IS local update packets\n")
905 isis
->debugs
|= DEBUG_LOCAL_UPDATES
;
906 print_debug(vty
, DEBUG_LOCAL_UPDATES
, 1);
911 DEFUN (no_debug_isis_lupd
,
912 no_debug_isis_lupd_cmd
,
913 "no debug isis local-updates",
916 "IS-IS information\n"
917 "IS-IS local update packets\n")
919 isis
->debugs
&= ~DEBUG_LOCAL_UPDATES
;
920 print_debug(vty
, DEBUG_LOCAL_UPDATES
, 0);
925 DEFUN (debug_isis_err
,
927 "debug isis protocol-errors",
929 "IS-IS information\n"
930 "IS-IS LSP protocol errors\n")
932 isis
->debugs
|= DEBUG_PROTOCOL_ERRORS
;
933 print_debug(vty
, DEBUG_PROTOCOL_ERRORS
, 1);
938 DEFUN (no_debug_isis_err
,
939 no_debug_isis_err_cmd
,
940 "no debug isis protocol-errors",
943 "IS-IS information\n"
944 "IS-IS LSP protocol errors\n")
946 isis
->debugs
&= ~DEBUG_PROTOCOL_ERRORS
;
947 print_debug(vty
, DEBUG_PROTOCOL_ERRORS
, 0);
952 DEFUN (debug_isis_snp
,
954 "debug isis snp-packets",
956 "IS-IS information\n"
957 "IS-IS CSNP/PSNP packets\n")
959 isis
->debugs
|= DEBUG_SNP_PACKETS
;
960 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
965 DEFUN (no_debug_isis_snp
,
966 no_debug_isis_snp_cmd
,
967 "no debug isis snp-packets",
970 "IS-IS information\n"
971 "IS-IS CSNP/PSNP packets\n")
973 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
974 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
979 DEFUN (debug_isis_upd
,
981 "debug isis update-packets",
983 "IS-IS information\n"
984 "IS-IS Update related packets\n")
986 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
987 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
992 DEFUN (no_debug_isis_upd
,
993 no_debug_isis_upd_cmd
,
994 "no debug isis update-packets",
997 "IS-IS information\n"
998 "IS-IS Update related packets\n")
1000 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
1001 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
1006 DEFUN (debug_isis_spfevents
,
1007 debug_isis_spfevents_cmd
,
1008 "debug isis spf-events",
1010 "IS-IS information\n"
1011 "IS-IS Shortest Path First Events\n")
1013 isis
->debugs
|= DEBUG_SPF_EVENTS
;
1014 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
1019 DEFUN (no_debug_isis_spfevents
,
1020 no_debug_isis_spfevents_cmd
,
1021 "no debug isis spf-events",
1024 "IS-IS information\n"
1025 "IS-IS Shortest Path First Events\n")
1027 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1028 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1033 DEFUN (debug_isis_spfstats
,
1034 debug_isis_spfstats_cmd
,
1035 "debug isis spf-statistics ",
1037 "IS-IS information\n"
1038 "IS-IS SPF Timing and Statistic Data\n")
1040 isis
->debugs
|= DEBUG_SPF_STATS
;
1041 print_debug(vty
, DEBUG_SPF_STATS
, 1);
1046 DEFUN (no_debug_isis_spfstats
,
1047 no_debug_isis_spfstats_cmd
,
1048 "no debug isis spf-statistics",
1051 "IS-IS information\n"
1052 "IS-IS SPF Timing and Statistic Data\n")
1054 isis
->debugs
&= ~DEBUG_SPF_STATS
;
1055 print_debug(vty
, DEBUG_SPF_STATS
, 0);
1060 DEFUN (debug_isis_spftrigg
,
1061 debug_isis_spftrigg_cmd
,
1062 "debug isis spf-triggers",
1064 "IS-IS information\n"
1065 "IS-IS SPF triggering events\n")
1067 isis
->debugs
|= DEBUG_SPF_TRIGGERS
;
1068 print_debug(vty
, DEBUG_SPF_TRIGGERS
, 1);
1073 DEFUN (no_debug_isis_spftrigg
,
1074 no_debug_isis_spftrigg_cmd
,
1075 "no debug isis spf-triggers",
1078 "IS-IS information\n"
1079 "IS-IS SPF triggering events\n")
1081 isis
->debugs
&= ~DEBUG_SPF_TRIGGERS
;
1082 print_debug(vty
, DEBUG_SPF_TRIGGERS
, 0);
1087 DEFUN (debug_isis_rtevents
,
1088 debug_isis_rtevents_cmd
,
1089 "debug isis route-events",
1091 "IS-IS information\n"
1092 "IS-IS Route related events\n")
1094 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1095 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1100 DEFUN (no_debug_isis_rtevents
,
1101 no_debug_isis_rtevents_cmd
,
1102 "no debug isis route-events",
1105 "IS-IS information\n"
1106 "IS-IS Route related events\n")
1108 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1109 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1114 DEFUN (debug_isis_events
,
1115 debug_isis_events_cmd
,
1116 "debug isis events",
1118 "IS-IS information\n"
1121 isis
->debugs
|= DEBUG_EVENTS
;
1122 print_debug(vty
, DEBUG_EVENTS
, 1);
1127 DEFUN (no_debug_isis_events
,
1128 no_debug_isis_events_cmd
,
1129 "no debug isis events",
1132 "IS-IS information\n"
1135 isis
->debugs
&= ~DEBUG_EVENTS
;
1136 print_debug(vty
, DEBUG_EVENTS
, 0);
1141 DEFUN (debug_isis_packet_dump
,
1142 debug_isis_packet_dump_cmd
,
1143 "debug isis packet-dump",
1145 "IS-IS information\n"
1146 "IS-IS packet dump\n")
1148 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1149 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1154 DEFUN (no_debug_isis_packet_dump
,
1155 no_debug_isis_packet_dump_cmd
,
1156 "no debug isis packet-dump",
1159 "IS-IS information\n"
1160 "IS-IS packet dump\n")
1162 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1163 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1168 DEFUN (debug_isis_lsp_gen
,
1169 debug_isis_lsp_gen_cmd
,
1170 "debug isis lsp-gen",
1172 "IS-IS information\n"
1173 "IS-IS generation of own LSPs\n")
1175 isis
->debugs
|= DEBUG_LSP_GEN
;
1176 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1181 DEFUN (no_debug_isis_lsp_gen
,
1182 no_debug_isis_lsp_gen_cmd
,
1183 "no debug isis lsp-gen",
1186 "IS-IS information\n"
1187 "IS-IS generation of own LSPs\n")
1189 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1190 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1195 DEFUN (debug_isis_lsp_sched
,
1196 debug_isis_lsp_sched_cmd
,
1197 "debug isis lsp-sched",
1199 "IS-IS information\n"
1200 "IS-IS scheduling of LSP generation\n")
1202 isis
->debugs
|= DEBUG_LSP_SCHED
;
1203 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1208 DEFUN (no_debug_isis_lsp_sched
,
1209 no_debug_isis_lsp_sched_cmd
,
1210 "no debug isis lsp-sched",
1213 "IS-IS information\n"
1214 "IS-IS scheduling of LSP generation\n")
1216 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1217 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1222 DEFUN (show_hostname
,
1224 "show isis hostname",
1226 "IS-IS information\n"
1227 "IS-IS Dynamic hostname mapping\n")
1229 dynhn_print_all(vty
);
1234 DEFUN (show_isis_spf_ietf
,
1235 show_isis_spf_ietf_cmd
,
1236 "show isis spf-delay-ietf",
1238 "IS-IS information\n"
1239 "IS-IS SPF delay IETF information\n")
1242 vty_out(vty
, "ISIS is not running\n");
1246 struct listnode
*node
;
1247 struct isis_area
*area
;
1249 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1250 vty_out(vty
, "Area %s:\n",
1251 area
->area_tag
? area
->area_tag
: "null");
1253 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1254 if ((area
->is_type
& level
) == 0)
1257 vty_out(vty
, " Level-%d:\n", level
);
1258 vty_out(vty
, " SPF delay status: ");
1259 if (area
->spf_timer
[level
- 1]) {
1260 struct timeval remain
= thread_timer_remain(
1261 area
->spf_timer
[level
- 1]);
1262 vty_out(vty
, "Pending, due in %lld msec\n",
1263 (long long)remain
.tv_sec
* 1000
1264 + remain
.tv_usec
/ 1000);
1266 vty_out(vty
, "Not scheduled\n");
1269 if (area
->spf_delay_ietf
[level
- 1]) {
1271 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1273 area
->spf_delay_ietf
[level
- 1], vty
,
1276 vty_out(vty
, " Using legacy backoff algo\n");
1283 DEFUN (show_isis_summary
,
1284 show_isis_summary_cmd
,
1285 "show isis summary",
1286 SHOW_STR
"IS-IS information\n" "IS-IS summary\n")
1288 struct listnode
*node
, *node2
;
1289 struct isis_area
*area
;
1293 vty_out(vty
, "ISIS is not running\n");
1297 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1298 if (isis
->sysid_set
)
1299 vty_out(vty
, "System Id : %s\n",
1300 sysid_print(isis
->sysid
));
1302 vty_out(vty
, "Up time : ");
1303 vty_out_timestr(vty
, isis
->uptime
);
1306 if (isis
->area_list
)
1307 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1309 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1310 vty_out(vty
, "Area %s:\n",
1311 area
->area_tag
? area
->area_tag
: "null");
1313 if (listcount(area
->area_addrs
) > 0) {
1314 struct area_addr
*area_addr
;
1315 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1317 vty_out(vty
, " Net: %s\n",
1318 isonet_print(area_addr
->area_addr
,
1325 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1326 if ((area
->is_type
& level
) == 0)
1329 vty_out(vty
, " Level-%d:\n", level
);
1330 if (area
->spf_timer
[level
- 1])
1331 vty_out(vty
, " SPF: (pending)\n");
1333 vty_out(vty
, " SPF:\n");
1335 vty_out(vty
, " minimum interval : %d",
1336 area
->min_spf_interval
[level
- 1]);
1337 if (area
->spf_delay_ietf
[level
- 1])
1339 " (not used, IETF SPF delay activated)");
1342 vty_out(vty
, " IPv4 route computation:\n");
1343 isis_spf_print(area
->spftree
[level
- 1], vty
);
1345 vty_out(vty
, " IPv6 route computation:\n");
1346 isis_spf_print(area
->spftree6
[level
- 1], vty
);
1355 * This function supports following display options:
1356 * [ show isis database [detail] ]
1357 * [ show isis database <sysid> [detail] ]
1358 * [ show isis database <hostname> [detail] ]
1359 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1360 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1361 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1362 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1363 * [ show isis database detail <sysid> ]
1364 * [ show isis database detail <hostname> ]
1365 * [ show isis database detail <sysid>.<pseudo-id> ]
1366 * [ show isis database detail <hostname>.<pseudo-id> ]
1367 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1368 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1370 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1372 struct listnode
*node
;
1373 struct isis_area
*area
;
1374 struct isis_lsp
*lsp
;
1375 struct isis_dynhn
*dynhn
;
1377 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2];
1380 int level
, lsp_count
;
1382 if (isis
->area_list
->count
== 0)
1385 memset(&lspid
, 0, ISIS_SYS_ID_LEN
);
1386 memset(&sysid
, 0, 255);
1389 * extract fragment and pseudo id from the string argv
1391 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1392 * (b) <systemid/hostname>.<pseudo-id> or
1393 * (c) <systemid/hostname> or
1394 * Where systemid is in the form:
1398 strncpy(sysid
, argv
, 254);
1399 if (argv
&& strlen(argv
) > 3) {
1400 pos
= argv
+ strlen(argv
) - 3;
1401 if (strncmp(pos
, "-", 1) == 0) {
1402 memcpy(number
, ++pos
, 2);
1403 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1404 (uint8_t)strtol((char *)number
, NULL
, 16);
1406 if (strncmp(pos
, ".", 1) != 0)
1409 if (strncmp(pos
, ".", 1) == 0) {
1410 memcpy(number
, ++pos
, 2);
1411 lspid
[ISIS_SYS_ID_LEN
] =
1412 (uint8_t)strtol((char *)number
, NULL
, 16);
1413 sysid
[pos
- argv
- 1] = '\0';
1417 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1418 vty_out(vty
, "Area %s:\n",
1419 area
->area_tag
? area
->area_tag
: "null");
1421 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1422 if (area
->lspdb
[level
]
1423 && dict_count(area
->lspdb
[level
]) > 0) {
1427 * Try to find the lsp-id if the argv
1430 * hostname.<pseudo-id>-<fragment>
1432 if (sysid2buff(lspid
, sysid
)) {
1435 area
->lspdb
[level
]);
1436 } else if ((dynhn
= dynhn_find_by_name(
1438 memcpy(lspid
, dynhn
->id
,
1442 area
->lspdb
[level
]);
1443 } else if (strncmp(cmd_hostname_get(),
1446 memcpy(lspid
, isis
->sysid
,
1450 area
->lspdb
[level
]);
1454 if (lsp
!= NULL
|| argv
== NULL
) {
1456 "IS-IS Level-%d link-state database:\n",
1459 /* print the title in all cases */
1461 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1465 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1472 } else if (argv
== NULL
) {
1473 lsp_count
= lsp_print_all(
1474 vty
, area
->lspdb
[level
],
1475 ui_level
, area
->dynhostname
);
1477 vty_out(vty
, " %u LSPs\n\n",
1487 DEFUN (show_database
,
1489 "show isis database [detail] [WORD]",
1491 "IS-IS information\n"
1492 "IS-IS link state database\n"
1493 "Detailed information\n"
1497 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1498 ? ISIS_UI_LEVEL_DETAIL
1499 : ISIS_UI_LEVEL_BRIEF
;
1500 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1501 return show_isis_database(vty
, id
, uilevel
);
1505 * 'router isis' command
1507 DEFUN_NOSH (router_isis
,
1512 "ISO Routing area tag\n")
1515 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1519 *'no router isis' command
1521 DEFUN (no_router_isis
,
1523 "no router isis WORD",
1524 "no\n" ROUTER_STR
"ISO IS-IS\n" "ISO Routing area tag\n")
1527 return isis_area_destroy(vty
, argv
[idx_word
]->arg
);
1536 "A Network Entity Title for this process (OSI only)\n"
1537 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1540 return area_net_title(vty
, argv
[idx_word
]->arg
);
1550 "A Network Entity Title for this process (OSI only)\n"
1551 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1554 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1557 DEFUN (isis_topology
,
1559 "topology " ISIS_MT_NAMES
" [overload]",
1560 "Configure IS-IS topologies\n"
1561 ISIS_MT_DESCRIPTIONS
1562 "Set overload bit for topology\n")
1564 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1566 const char *arg
= argv
[1]->arg
;
1567 uint16_t mtid
= isis_str2mtid(arg
);
1569 if (area
->oldmetric
) {
1571 "Multi topology IS-IS can only be used with wide metrics\n");
1572 return CMD_WARNING_CONFIG_FAILED
;
1575 if (mtid
== (uint16_t)-1) {
1576 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1577 return CMD_WARNING_CONFIG_FAILED
;
1579 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1580 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1581 return CMD_WARNING_CONFIG_FAILED
;
1584 area_set_mt_enabled(area
, mtid
, true);
1585 area_set_mt_overload(area
, mtid
, (argc
== 3));
1589 DEFUN (no_isis_topology
,
1590 no_isis_topology_cmd
,
1591 "no topology " ISIS_MT_NAMES
" [overload]",
1593 "Configure IS-IS topologies\n"
1594 ISIS_MT_DESCRIPTIONS
1595 "Set overload bit for topology\n")
1597 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1599 const char *arg
= argv
[2]->arg
;
1600 uint16_t mtid
= isis_str2mtid(arg
);
1602 if (area
->oldmetric
) {
1604 "Multi topology IS-IS can only be used with wide metrics\n");
1605 return CMD_WARNING_CONFIG_FAILED
;
1608 if (mtid
== (uint16_t)-1) {
1609 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1610 return CMD_WARNING_CONFIG_FAILED
;
1612 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1613 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1614 return CMD_WARNING_CONFIG_FAILED
;
1617 area_set_mt_enabled(area
, mtid
, false);
1618 area_set_mt_overload(area
, mtid
, false);
1622 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1624 area
->lsp_mtu
= lsp_mtu
;
1625 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1628 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1629 uint8_t passwd_type
, const char *passwd
,
1632 struct isis_passwd
*dest
;
1633 struct isis_passwd modified
;
1636 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1637 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1638 : &area
->domain_passwd
;
1639 memset(&modified
, 0, sizeof(modified
));
1641 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1645 len
= strlen(passwd
);
1650 strncpy((char *)modified
.passwd
, passwd
, 255);
1651 modified
.type
= passwd_type
;
1652 modified
.snp_auth
= snp_auth
;
1655 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1656 memcpy(dest
, &modified
, sizeof(modified
));
1657 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1663 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1665 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1669 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1670 const char *passwd
, uint8_t snp_auth
)
1672 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1676 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1677 const char *passwd
, uint8_t snp_auth
)
1679 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1683 static void area_resign_level(struct isis_area
*area
, int level
)
1685 if (area
->lspdb
[level
- 1]) {
1686 lsp_db_destroy(area
->lspdb
[level
- 1]);
1687 area
->lspdb
[level
- 1] = NULL
;
1689 if (area
->spftree
[level
- 1]) {
1690 isis_spftree_del(area
->spftree
[level
- 1]);
1691 area
->spftree
[level
- 1] = NULL
;
1693 if (area
->spftree6
[level
- 1]) {
1694 isis_spftree_del(area
->spftree6
[level
- 1]);
1695 area
->spftree6
[level
- 1] = NULL
;
1697 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1698 if (area
->route_table
[level
- 1]) {
1699 route_table_finish(area
->route_table
[level
- 1]);
1700 area
->route_table
[level
- 1] = NULL
;
1702 if (area
->route_table6
[level
- 1]) {
1703 route_table_finish(area
->route_table6
[level
- 1]);
1704 area
->route_table6
[level
- 1] = NULL
;
1708 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1709 area
->area_tag
, level
);
1710 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1711 area
->lsp_regenerate_pending
[level
- 1] = 0;
1714 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1716 struct listnode
*node
;
1717 struct isis_circuit
*circuit
;
1719 if (isis
->debugs
& DEBUG_EVENTS
)
1720 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1721 area
->area_tag
, circuit_t2string(area
->is_type
),
1722 circuit_t2string(is_type
));
1724 if (area
->is_type
== is_type
)
1725 return; /* No change */
1727 switch (area
->is_type
) {
1729 if (is_type
== IS_LEVEL_2
)
1730 area_resign_level(area
, IS_LEVEL_1
);
1732 if (area
->lspdb
[1] == NULL
)
1733 area
->lspdb
[1] = lsp_db_init();
1734 if (area
->route_table
[1] == NULL
)
1735 area
->route_table
[1] = route_table_init();
1736 if (area
->route_table6
[1] == NULL
)
1737 area
->route_table6
[1] = route_table_init();
1740 case IS_LEVEL_1_AND_2
:
1741 if (is_type
== IS_LEVEL_1
)
1742 area_resign_level(area
, IS_LEVEL_2
);
1744 area_resign_level(area
, IS_LEVEL_1
);
1748 if (is_type
== IS_LEVEL_1
)
1749 area_resign_level(area
, IS_LEVEL_2
);
1751 if (area
->lspdb
[0] == NULL
)
1752 area
->lspdb
[0] = lsp_db_init();
1753 if (area
->route_table
[0] == NULL
)
1754 area
->route_table
[0] = route_table_init();
1755 if (area
->route_table6
[0] == NULL
)
1756 area
->route_table6
[0] = route_table_init();
1763 area
->is_type
= is_type
;
1765 /* override circuit's is_type */
1766 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1767 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1768 isis_circuit_is_type_set(circuit
, is_type
);
1771 spftree_area_init(area
);
1773 if (listcount(area
->area_addrs
) > 0) {
1774 if (is_type
& IS_LEVEL_1
)
1775 lsp_generate(area
, IS_LEVEL_1
);
1776 if (is_type
& IS_LEVEL_2
)
1777 lsp_generate(area
, IS_LEVEL_2
);
1779 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1784 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1787 if (area
->oldmetric
!= old_metric
|| area
->newmetric
!= new_metric
) {
1788 area
->oldmetric
= old_metric
;
1789 area
->newmetric
= new_metric
;
1790 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1794 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1796 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1798 if (new_overload_bit
!= area
->overload_bit
) {
1799 area
->overload_bit
= new_overload_bit
;
1800 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1804 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1806 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1808 if (new_attached_bit
!= area
->attached_bit
) {
1809 area
->attached_bit
= new_attached_bit
;
1810 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1814 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1816 if (area
->dynhostname
!= dynhostname
) {
1817 area
->dynhostname
= dynhostname
;
1818 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1822 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1823 uint16_t max_lsp_lifetime
)
1825 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1827 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1830 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1831 lsp_regenerate_schedule(area
, level
, 1);
1834 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1835 uint16_t lsp_refresh
)
1837 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1839 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1842 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1843 lsp_regenerate_schedule(area
, level
, 1);
1846 DEFUN (log_adj_changes
,
1847 log_adj_changes_cmd
,
1848 "log-adjacency-changes",
1849 "Log changes in adjacency state\n")
1851 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1853 area
->log_adj_changes
= 1;
1858 DEFUN (no_log_adj_changes
,
1859 no_log_adj_changes_cmd
,
1860 "no log-adjacency-changes",
1862 "Stop logging changes in adjacency state\n")
1864 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1866 area
->log_adj_changes
= 0;
1871 /* IS-IS configuration write function */
1872 int isis_config_write(struct vty
*vty
)
1877 struct isis_area
*area
;
1878 struct listnode
*node
, *node2
;
1880 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1881 /* ISIS - Area name */
1882 vty_out(vty
, "router isis %s\n", area
->area_tag
);
1885 if (listcount(area
->area_addrs
) > 0) {
1886 struct area_addr
*area_addr
;
1887 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1888 node2
, area_addr
)) {
1889 vty_out(vty
, " net %s\n",
1891 area_addr
->area_addr
,
1898 /* ISIS - Dynamic hostname - Defaults to true so only
1901 if (!area
->dynhostname
) {
1902 vty_out(vty
, " no hostname dynamic\n");
1905 /* ISIS - Metric-Style - when true displays wide */
1906 if (area
->newmetric
) {
1907 if (!area
->oldmetric
)
1908 vty_out(vty
, " metric-style wide\n");
1911 " metric-style transition\n");
1914 vty_out(vty
, " metric-style narrow\n");
1917 /* ISIS - overload-bit */
1918 if (area
->overload_bit
) {
1919 vty_out(vty
, " set-overload-bit\n");
1922 /* ISIS - Area is-type (level-1-2 is default) */
1923 if (area
->is_type
== IS_LEVEL_1
) {
1924 vty_out(vty
, " is-type level-1\n");
1926 } else if (area
->is_type
== IS_LEVEL_2
) {
1927 vty_out(vty
, " is-type level-2-only\n");
1930 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1931 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1932 /* ISIS - Lsp generation interval */
1933 if (area
->lsp_gen_interval
[0]
1934 == area
->lsp_gen_interval
[1]) {
1935 if (area
->lsp_gen_interval
[0]
1936 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1937 vty_out(vty
, " lsp-gen-interval %d\n",
1938 area
->lsp_gen_interval
[0]);
1942 if (area
->lsp_gen_interval
[0]
1943 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1945 " lsp-gen-interval level-1 %d\n",
1946 area
->lsp_gen_interval
[0]);
1949 if (area
->lsp_gen_interval
[1]
1950 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1952 " lsp-gen-interval level-2 %d\n",
1953 area
->lsp_gen_interval
[1]);
1957 /* ISIS - LSP lifetime */
1958 if (area
->max_lsp_lifetime
[0]
1959 == area
->max_lsp_lifetime
[1]) {
1960 if (area
->max_lsp_lifetime
[0]
1961 != DEFAULT_LSP_LIFETIME
) {
1962 vty_out(vty
, " max-lsp-lifetime %u\n",
1963 area
->max_lsp_lifetime
[0]);
1967 if (area
->max_lsp_lifetime
[0]
1968 != DEFAULT_LSP_LIFETIME
) {
1970 " max-lsp-lifetime level-1 %u\n",
1971 area
->max_lsp_lifetime
[0]);
1974 if (area
->max_lsp_lifetime
[1]
1975 != DEFAULT_LSP_LIFETIME
) {
1977 " max-lsp-lifetime level-2 %u\n",
1978 area
->max_lsp_lifetime
[1]);
1982 /* ISIS - LSP refresh interval */
1983 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1984 if (area
->lsp_refresh
[0]
1985 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1987 " lsp-refresh-interval %u\n",
1988 area
->lsp_refresh
[0]);
1992 if (area
->lsp_refresh
[0]
1993 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1995 " lsp-refresh-interval level-1 %u\n",
1996 area
->lsp_refresh
[0]);
1999 if (area
->lsp_refresh
[1]
2000 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2002 " lsp-refresh-interval level-2 %u\n",
2003 area
->lsp_refresh
[1]);
2007 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
2008 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
2012 /* Minimum SPF interval. */
2013 if (area
->min_spf_interval
[0]
2014 == area
->min_spf_interval
[1]) {
2015 if (area
->min_spf_interval
[0]
2016 != MINIMUM_SPF_INTERVAL
) {
2017 vty_out(vty
, " spf-interval %d\n",
2018 area
->min_spf_interval
[0]);
2022 if (area
->min_spf_interval
[0]
2023 != MINIMUM_SPF_INTERVAL
) {
2025 " spf-interval level-1 %d\n",
2026 area
->min_spf_interval
[0]);
2029 if (area
->min_spf_interval
[1]
2030 != MINIMUM_SPF_INTERVAL
) {
2032 " spf-interval level-2 %d\n",
2033 area
->min_spf_interval
[1]);
2038 /* IETF SPF interval */
2039 if (area
->spf_delay_ietf
[0]) {
2041 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2042 spf_backoff_init_delay(
2043 area
->spf_delay_ietf
[0]),
2044 spf_backoff_short_delay(
2045 area
->spf_delay_ietf
[0]),
2046 spf_backoff_long_delay(
2047 area
->spf_delay_ietf
[0]),
2048 spf_backoff_holddown(
2049 area
->spf_delay_ietf
[0]),
2050 spf_backoff_timetolearn(
2051 area
->spf_delay_ietf
[0]));
2055 /* Authentication passwords. */
2056 if (area
->area_passwd
.type
2057 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2058 vty_out(vty
, " area-password md5 %s",
2059 area
->area_passwd
.passwd
);
2060 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2062 vty_out(vty
, " authenticate snp ");
2064 area
->area_passwd
.snp_auth
,
2066 vty_out(vty
, "validate");
2068 vty_out(vty
, "send-only");
2072 } else if (area
->area_passwd
.type
2073 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2074 vty_out(vty
, " area-password clear %s",
2075 area
->area_passwd
.passwd
);
2076 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2078 vty_out(vty
, " authenticate snp ");
2080 area
->area_passwd
.snp_auth
,
2082 vty_out(vty
, "validate");
2084 vty_out(vty
, "send-only");
2089 if (area
->domain_passwd
.type
2090 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2091 vty_out(vty
, " domain-password md5 %s",
2092 area
->domain_passwd
.passwd
);
2093 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2095 vty_out(vty
, " authenticate snp ");
2096 if (CHECK_FLAG(area
->domain_passwd
2099 vty_out(vty
, "validate");
2101 vty_out(vty
, "send-only");
2105 } else if (area
->domain_passwd
.type
2106 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2107 vty_out(vty
, " domain-password clear %s",
2108 area
->domain_passwd
.passwd
);
2109 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2111 vty_out(vty
, " authenticate snp ");
2112 if (CHECK_FLAG(area
->domain_passwd
2115 vty_out(vty
, "validate");
2117 vty_out(vty
, "send-only");
2123 if (area
->log_adj_changes
) {
2124 vty_out(vty
, " log-adjacency-changes\n");
2128 write
+= area_write_mt_settings(area
, vty
);
2130 isis_mpls_te_config_write_router(vty
);
2136 struct cmd_node isis_node
= {ISIS_NODE
, "%s(config-router)# ", 1};
2140 /* Install IS-IS top node */
2141 install_node(&isis_node
, isis_config_write
);
2143 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2145 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2147 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2148 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2149 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2151 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2152 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2153 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2154 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2155 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2157 install_element(VIEW_NODE
, &show_hostname_cmd
);
2158 install_element(VIEW_NODE
, &show_database_cmd
);
2160 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2162 install_node(&debug_node
, config_write_debug
);
2164 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2165 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2166 install_element(ENABLE_NODE
, &debug_isis_csum_cmd
);
2167 install_element(ENABLE_NODE
, &no_debug_isis_csum_cmd
);
2168 install_element(ENABLE_NODE
, &debug_isis_lupd_cmd
);
2169 install_element(ENABLE_NODE
, &no_debug_isis_lupd_cmd
);
2170 install_element(ENABLE_NODE
, &debug_isis_err_cmd
);
2171 install_element(ENABLE_NODE
, &no_debug_isis_err_cmd
);
2172 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2173 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2174 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2175 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2176 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2177 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2178 install_element(ENABLE_NODE
, &debug_isis_spfstats_cmd
);
2179 install_element(ENABLE_NODE
, &no_debug_isis_spfstats_cmd
);
2180 install_element(ENABLE_NODE
, &debug_isis_spftrigg_cmd
);
2181 install_element(ENABLE_NODE
, &no_debug_isis_spftrigg_cmd
);
2182 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2183 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2184 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2185 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2186 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2187 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2188 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2189 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2190 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2191 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2193 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2194 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2195 install_element(CONFIG_NODE
, &debug_isis_csum_cmd
);
2196 install_element(CONFIG_NODE
, &no_debug_isis_csum_cmd
);
2197 install_element(CONFIG_NODE
, &debug_isis_lupd_cmd
);
2198 install_element(CONFIG_NODE
, &no_debug_isis_lupd_cmd
);
2199 install_element(CONFIG_NODE
, &debug_isis_err_cmd
);
2200 install_element(CONFIG_NODE
, &no_debug_isis_err_cmd
);
2201 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2202 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2203 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2204 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2205 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2206 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2207 install_element(CONFIG_NODE
, &debug_isis_spfstats_cmd
);
2208 install_element(CONFIG_NODE
, &no_debug_isis_spfstats_cmd
);
2209 install_element(CONFIG_NODE
, &debug_isis_spftrigg_cmd
);
2210 install_element(CONFIG_NODE
, &no_debug_isis_spftrigg_cmd
);
2211 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2212 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2213 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2214 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2215 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2216 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2217 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2218 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2219 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2220 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2222 install_element(CONFIG_NODE
, &router_isis_cmd
);
2223 install_element(CONFIG_NODE
, &no_router_isis_cmd
);
2225 install_default(ISIS_NODE
);
2227 install_element(ISIS_NODE
, &net_cmd
);
2228 install_element(ISIS_NODE
, &no_net_cmd
);
2230 install_element(ISIS_NODE
, &isis_topology_cmd
);
2231 install_element(ISIS_NODE
, &no_isis_topology_cmd
);
2233 install_element(ISIS_NODE
, &log_adj_changes_cmd
);
2234 install_element(ISIS_NODE
, &no_log_adj_changes_cmd
);
2236 spf_backoff_cmd_init();