2 * IS-IS Rout(e)ing protocol - isisd.c
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
38 #include "spf_backoff.h"
40 #include "isisd/dict.h"
41 #include "isisd/isis_constants.h"
42 #include "isisd/isis_common.h"
43 #include "isisd/isis_flags.h"
44 #include "isisd/isis_circuit.h"
45 #include "isisd/isis_csm.h"
46 #include "isisd/isisd.h"
47 #include "isisd/isis_dynhn.h"
48 #include "isisd/isis_adjacency.h"
49 #include "isisd/isis_pdu.h"
50 #include "isisd/isis_misc.h"
51 #include "isisd/isis_constants.h"
52 #include "isisd/isis_lsp.h"
53 #include "isisd/isis_spf.h"
54 #include "isisd/isis_route.h"
55 #include "isisd/isis_zebra.h"
56 #include "isisd/isis_events.h"
57 #include "isisd/isis_te.h"
58 #include "isisd/isis_mt.h"
59 #include "isisd/fabricd.h"
61 struct isis
*isis
= NULL
;
63 DEFINE_QOBJ_TYPE(isis
)
64 DEFINE_QOBJ_TYPE(isis_area
)
69 int isis_area_get(struct vty
*, const char *);
70 int isis_area_destroy(struct vty
*, const char *);
71 int area_net_title(struct vty
*, const char *);
72 int area_clear_net_title(struct vty
*, const char *);
73 int show_isis_interface_common(struct vty
*, const char *ifname
, char);
74 int show_isis_neighbor_common(struct vty
*, const char *id
, char);
75 int clear_isis_neighbor_common(struct vty
*, const char *id
);
76 int isis_config_write(struct vty
*);
79 void isis_new(unsigned long process_id
)
81 isis
= XCALLOC(MTYPE_ISIS
, sizeof(struct isis
));
85 isis
->max_area_addrs
= 3;
86 isis
->process_id
= process_id
;
88 isis
->area_list
= list_new();
89 isis
->init_circ_list
= list_new();
90 isis
->uptime
= time(NULL
);
91 isis
->nexthops
= list_new();
92 isis
->nexthops6
= list_new();
95 * uncomment the next line for full debugs
97 /* isis->debugs = 0xFFFF; */
98 isisMplsTE
.status
= disable
; /* Only support TE metric */
100 QOBJ_REG(isis
, isis
);
103 struct isis_area
*isis_area_create(const char *area_tag
)
105 struct isis_area
*area
;
107 area
= XCALLOC(MTYPE_ISIS_AREA
, sizeof(struct isis_area
));
110 * Fabricd runs only as level-2.
111 * For IS-IS, the first instance is level-1-2 rest are level-1,
112 * unless otherwise configured
115 area
->is_type
= IS_LEVEL_2
;
116 } else if (listcount(isis
->area_list
) > 0)
117 area
->is_type
= IS_LEVEL_1
;
119 area
->is_type
= IS_LEVEL_1_AND_2
;
122 * intialize the databases
124 if (area
->is_type
& IS_LEVEL_1
) {
125 area
->lspdb
[0] = lsp_db_init();
127 if (area
->is_type
& IS_LEVEL_2
) {
128 area
->lspdb
[1] = lsp_db_init();
131 spftree_area_init(area
);
133 area
->circuit_list
= list_new();
134 area
->area_addrs
= list_new();
135 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
136 flags_initialize(&area
->flags
);
141 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
142 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
143 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
144 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
145 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
146 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
147 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
148 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
149 area
->dynhostname
= 1;
152 area
->lsp_frag_threshold
= 90;
153 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
157 area
->area_tag
= strdup(area_tag
);
158 listnode_add(isis
->area_list
, area
);
162 area
->fabricd
= fabricd_new(area
);
164 area
->lsp_refresh_arg
[0].area
= area
;
165 area
->lsp_refresh_arg
[0].level
= IS_LEVEL_1
;
166 area
->lsp_refresh_arg
[1].area
= area
;
167 area
->lsp_refresh_arg
[1].level
= IS_LEVEL_2
;
170 QOBJ_REG(area
, isis_area
);
175 struct isis_area
*isis_area_lookup(const char *area_tag
)
177 struct isis_area
*area
;
178 struct listnode
*node
;
180 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
181 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
182 || (area
->area_tag
&& area_tag
183 && strcmp(area
->area_tag
, area_tag
) == 0))
189 int isis_area_get(struct vty
*vty
, const char *area_tag
)
191 struct isis_area
*area
;
193 area
= isis_area_lookup(area_tag
);
196 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
200 area
= isis_area_create(area_tag
);
202 if (isis
->debugs
& DEBUG_EVENTS
)
203 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
205 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
210 int isis_area_destroy(struct vty
*vty
, const char *area_tag
)
212 struct isis_area
*area
;
213 struct listnode
*node
, *nnode
;
214 struct isis_circuit
*circuit
;
215 struct area_addr
*addr
;
217 area
= isis_area_lookup(area_tag
);
220 vty_out(vty
, "Can't find ISIS instance \n");
221 return CMD_ERR_NO_MATCH
;
227 fabricd_finish(area
->fabricd
);
229 if (area
->circuit_list
) {
230 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
232 circuit
->ip_router
= 0;
233 circuit
->ipv6_router
= 0;
234 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
236 list_delete(&area
->circuit_list
);
239 if (area
->lspdb
[0] != NULL
) {
240 lsp_db_destroy(area
->lspdb
[0]);
241 area
->lspdb
[0] = NULL
;
243 if (area
->lspdb
[1] != NULL
) {
244 lsp_db_destroy(area
->lspdb
[1]);
245 area
->lspdb
[1] = NULL
;
248 /* invalidate and verify to delete all routes from zebra */
249 isis_area_invalidate_routes(area
, ISIS_LEVEL1
& ISIS_LEVEL2
);
250 isis_area_verify_routes(area
);
252 spftree_area_del(area
);
254 THREAD_TIMER_OFF(area
->spf_timer
[0]);
255 THREAD_TIMER_OFF(area
->spf_timer
[1]);
257 spf_backoff_free(area
->spf_delay_ietf
[0]);
258 spf_backoff_free(area
->spf_delay_ietf
[1]);
260 isis_redist_area_finish(area
);
262 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
263 list_delete_node(area
->area_addrs
, node
);
264 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
266 area
->area_addrs
= NULL
;
268 THREAD_TIMER_OFF(area
->t_tick
);
269 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
270 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
272 thread_cancel_event(master
, area
);
274 listnode_delete(isis
->area_list
, area
);
276 free(area
->area_tag
);
278 area_mt_finish(area
);
280 XFREE(MTYPE_ISIS_AREA
, area
);
282 if (listcount(isis
->area_list
) == 0) {
283 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
290 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
293 struct isis_area_mt_setting
*setting
;
295 setting
= area_get_mt_setting(area
, mtid
);
296 if (setting
->enabled
!= enabled
) {
297 setting
->enabled
= enabled
;
298 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
302 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
305 struct isis_area_mt_setting
*setting
;
307 setting
= area_get_mt_setting(area
, mtid
);
308 if (setting
->overload
!= overload
) {
309 setting
->overload
= overload
;
310 if (setting
->enabled
)
311 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
316 int area_net_title(struct vty
*vty
, const char *net_title
)
318 VTY_DECLVAR_CONTEXT(isis_area
, area
);
319 struct area_addr
*addr
;
320 struct area_addr
*addrp
;
321 struct listnode
*node
;
325 /* We check that we are not over the maximal number of addresses */
326 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
328 "Maximum of area addresses (%d) already reached \n",
329 isis
->max_area_addrs
);
330 return CMD_ERR_NOTHING_TODO
;
333 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
334 addr
->addr_len
= dotformat2buff(buff
, net_title
);
335 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
337 zlog_debug("added area address %s for area %s (address length %d)",
338 net_title
, area
->area_tag
, addr
->addr_len
);
339 #endif /* EXTREME_DEBUG */
340 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
342 "area address must be at least 8..20 octets long (%d)\n",
344 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
345 return CMD_WARNING_CONFIG_FAILED
;
348 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
350 "nsel byte (last byte) in area address must be 0\n");
351 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
352 return CMD_WARNING_CONFIG_FAILED
;
355 if (isis
->sysid_set
== 0) {
357 * First area address - get the SystemID for this router
359 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
361 if (isis
->debugs
& DEBUG_EVENTS
)
362 zlog_debug("Router has SystemID %s",
363 sysid_print(isis
->sysid
));
366 * Check that the SystemID portions match
368 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
370 "System ID must not change when defining additional area addresses\n");
371 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
372 return CMD_WARNING_CONFIG_FAILED
;
375 /* now we see that we don't already have this address */
376 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
377 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
380 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
382 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
383 return CMD_SUCCESS
; /* silent fail */
389 * Forget the systemID part of the address
391 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
392 listnode_add(area
->area_addrs
, addr
);
394 /* only now we can safely generate our LSPs for this area */
395 if (listcount(area
->area_addrs
) > 0) {
396 if (area
->is_type
& IS_LEVEL_1
)
397 lsp_generate(area
, IS_LEVEL_1
);
398 if (area
->is_type
& IS_LEVEL_2
)
399 lsp_generate(area
, IS_LEVEL_2
);
405 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
407 VTY_DECLVAR_CONTEXT(isis_area
, area
);
408 struct area_addr addr
, *addrp
= NULL
;
409 struct listnode
*node
;
412 addr
.addr_len
= dotformat2buff(buff
, net_title
);
413 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
415 "Unsupported area address length %d, should be 8...20 \n",
417 return CMD_WARNING_CONFIG_FAILED
;
420 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
422 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
423 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
424 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
428 vty_out(vty
, "No area address %s for area %s \n", net_title
,
430 return CMD_ERR_NO_MATCH
;
433 listnode_delete(area
->area_addrs
, addrp
);
434 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
437 * Last area address - reset the SystemID for this router
439 if (listcount(area
->area_addrs
) == 0) {
440 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
442 if (isis
->debugs
& DEBUG_EVENTS
)
443 zlog_debug("Router has no SystemID");
450 * 'show isis interface' command
453 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
455 struct listnode
*anode
, *cnode
;
456 struct isis_area
*area
;
457 struct isis_circuit
*circuit
;
460 vty_out(vty
, "IS-IS Routing Process not enabled\n");
464 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
465 vty_out(vty
, "Area %s:\n", area
->area_tag
);
467 if (detail
== ISIS_UI_LEVEL_BRIEF
)
469 " Interface CircId State Type Level\n");
471 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
473 isis_circuit_print_vty(circuit
, vty
, detail
);
474 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
475 isis_circuit_print_vty(circuit
, vty
, detail
);
481 DEFUN (show_isis_interface
,
482 show_isis_interface_cmd
,
483 "show " PROTO_NAME
" interface",
488 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
491 DEFUN (show_isis_interface_detail
,
492 show_isis_interface_detail_cmd
,
493 "show " PROTO_NAME
" interface detail",
497 "show detailed information\n")
499 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
502 DEFUN (show_isis_interface_arg
,
503 show_isis_interface_arg_cmd
,
504 "show " PROTO_NAME
" interface WORD",
508 "ISIS interface name\n")
511 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
512 ISIS_UI_LEVEL_DETAIL
);
516 * 'show isis neighbor' command
519 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
521 struct listnode
*anode
, *cnode
, *node
;
522 struct isis_area
*area
;
523 struct isis_circuit
*circuit
;
525 struct isis_adjacency
*adj
;
526 struct isis_dynhn
*dynhn
;
527 uint8_t sysid
[ISIS_SYS_ID_LEN
];
531 vty_out(vty
, "IS-IS Routing Process not enabled\n");
535 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
537 if (sysid2buff(sysid
, id
) == 0) {
538 dynhn
= dynhn_find_by_name(id
);
540 vty_out(vty
, "Invalid system id %s\n", id
);
543 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
547 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
548 vty_out(vty
, "Area %s:\n", area
->area_tag
);
550 if (detail
== ISIS_UI_LEVEL_BRIEF
)
552 " System Id Interface L State Holdtime SNPA\n");
554 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
555 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
556 for (i
= 0; i
< 2; i
++) {
557 adjdb
= circuit
->u
.bc
.adjdb
[i
];
558 if (adjdb
&& adjdb
->count
) {
559 for (ALL_LIST_ELEMENTS_RO(
562 || !memcmp(adj
->sysid
,
571 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
572 && circuit
->u
.p2p
.neighbor
) {
573 adj
= circuit
->u
.p2p
.neighbor
;
575 || !memcmp(adj
->sysid
, sysid
,
577 isis_adj_print_vty(adj
, vty
, detail
);
586 * 'clear isis neighbor' command
588 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
590 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
591 struct isis_area
*area
;
592 struct isis_circuit
*circuit
;
594 struct isis_adjacency
*adj
;
595 struct isis_dynhn
*dynhn
;
596 uint8_t sysid
[ISIS_SYS_ID_LEN
];
600 vty_out(vty
, "IS-IS Routing Process not enabled\n");
604 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
606 if (sysid2buff(sysid
, id
) == 0) {
607 dynhn
= dynhn_find_by_name(id
);
609 vty_out(vty
, "Invalid system id %s\n", id
);
612 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
616 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
617 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
619 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
620 for (i
= 0; i
< 2; i
++) {
621 adjdb
= circuit
->u
.bc
.adjdb
[i
];
622 if (adjdb
&& adjdb
->count
) {
623 for (ALL_LIST_ELEMENTS(
627 || !memcmp(adj
->sysid
,
630 isis_adj_state_change(
633 "clear user request");
636 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
637 && circuit
->u
.p2p
.neighbor
) {
638 adj
= circuit
->u
.p2p
.neighbor
;
640 || !memcmp(adj
->sysid
, sysid
,
642 isis_adj_state_change(
644 "clear user request");
652 DEFUN (show_isis_neighbor
,
653 show_isis_neighbor_cmd
,
654 "show " PROTO_NAME
" neighbor",
657 "ISIS neighbor adjacencies\n")
659 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
662 DEFUN (show_isis_neighbor_detail
,
663 show_isis_neighbor_detail_cmd
,
664 "show " PROTO_NAME
" neighbor detail",
667 "ISIS neighbor adjacencies\n"
668 "show detailed information\n")
670 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
673 DEFUN (show_isis_neighbor_arg
,
674 show_isis_neighbor_arg_cmd
,
675 "show " PROTO_NAME
" neighbor WORD",
678 "ISIS neighbor adjacencies\n"
682 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
683 ISIS_UI_LEVEL_DETAIL
);
686 DEFUN (clear_isis_neighbor
,
687 clear_isis_neighbor_cmd
,
688 "clear " PROTO_NAME
" neighbor",
691 "ISIS neighbor adjacencies\n")
693 return clear_isis_neighbor_common(vty
, NULL
);
696 DEFUN (clear_isis_neighbor_arg
,
697 clear_isis_neighbor_arg_cmd
,
698 "clear " PROTO_NAME
" neighbor WORD",
701 "ISIS neighbor adjacencies\n"
705 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
709 * 'isis debug', 'show debugging'
711 void print_debug(struct vty
*vty
, int flags
, int onoff
)
715 strcpy(onoffs
, "on");
717 strcpy(onoffs
, "off");
719 if (flags
& DEBUG_ADJ_PACKETS
)
721 "IS-IS Adjacency related packets debugging is %s\n",
723 if (flags
& DEBUG_SNP_PACKETS
)
724 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
726 if (flags
& DEBUG_SPF_EVENTS
)
727 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
728 if (flags
& DEBUG_UPDATE_PACKETS
)
729 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
731 if (flags
& DEBUG_RTE_EVENTS
)
732 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
733 if (flags
& DEBUG_EVENTS
)
734 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
735 if (flags
& DEBUG_PACKET_DUMP
)
736 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
737 if (flags
& DEBUG_LSP_GEN
)
738 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
739 if (flags
& DEBUG_LSP_SCHED
)
740 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
741 if (flags
& DEBUG_FABRICD_FLOODING
)
742 vty_out(vty
, "OpenFabric Flooding debugging is %s\n", onoffs
);
743 if (flags
& DEBUG_BFD
)
744 vty_out(vty
, "IS-IS BFD debugging is %s\n", onoffs
);
747 DEFUN_NOSH (show_debugging
,
748 show_debugging_isis_cmd
,
749 "show debugging [" PROTO_NAME
"]",
751 "State of each debugging option\n"
754 vty_out(vty
, PROTO_NAME
" debugging status:\n");
757 print_debug(vty
, isis
->debugs
, 1);
763 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
765 static int config_write_debug(struct vty
*vty
)
768 int flags
= isis
->debugs
;
770 if (flags
& DEBUG_ADJ_PACKETS
) {
771 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
774 if (flags
& DEBUG_SNP_PACKETS
) {
775 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
778 if (flags
& DEBUG_SPF_EVENTS
) {
779 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
782 if (flags
& DEBUG_UPDATE_PACKETS
) {
783 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
786 if (flags
& DEBUG_RTE_EVENTS
) {
787 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
790 if (flags
& DEBUG_EVENTS
) {
791 vty_out(vty
, "debug " PROTO_NAME
" events\n");
794 if (flags
& DEBUG_PACKET_DUMP
) {
795 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
798 if (flags
& DEBUG_LSP_GEN
) {
799 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
802 if (flags
& DEBUG_LSP_SCHED
) {
803 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
806 if (flags
& DEBUG_FABRICD_FLOODING
) {
807 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
810 if (flags
& DEBUG_BFD
) {
811 vty_out(vty
, "debug " PROTO_NAME
" bfd\n");
814 write
+= spf_backoff_write_config(vty
);
819 DEFUN (debug_isis_adj
,
821 "debug " PROTO_NAME
" adj-packets",
824 "IS-IS Adjacency related packets\n")
826 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
827 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
832 DEFUN (no_debug_isis_adj
,
833 no_debug_isis_adj_cmd
,
834 "no debug " PROTO_NAME
" adj-packets",
838 "IS-IS Adjacency related packets\n")
840 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
841 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
846 DEFUN (debug_isis_snp
,
848 "debug " PROTO_NAME
" snp-packets",
851 "IS-IS CSNP/PSNP packets\n")
853 isis
->debugs
|= DEBUG_SNP_PACKETS
;
854 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
859 DEFUN (no_debug_isis_snp
,
860 no_debug_isis_snp_cmd
,
861 "no debug " PROTO_NAME
" snp-packets",
865 "IS-IS CSNP/PSNP packets\n")
867 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
868 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
873 DEFUN (debug_isis_upd
,
875 "debug " PROTO_NAME
" update-packets",
878 "IS-IS Update related packets\n")
880 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
881 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
886 DEFUN (no_debug_isis_upd
,
887 no_debug_isis_upd_cmd
,
888 "no debug " PROTO_NAME
" update-packets",
892 "IS-IS Update related packets\n")
894 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
895 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
900 DEFUN (debug_isis_spfevents
,
901 debug_isis_spfevents_cmd
,
902 "debug " PROTO_NAME
" spf-events",
905 "IS-IS Shortest Path First Events\n")
907 isis
->debugs
|= DEBUG_SPF_EVENTS
;
908 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
913 DEFUN (no_debug_isis_spfevents
,
914 no_debug_isis_spfevents_cmd
,
915 "no debug " PROTO_NAME
" spf-events",
919 "IS-IS Shortest Path First Events\n")
921 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
922 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
927 DEFUN (debug_isis_rtevents
,
928 debug_isis_rtevents_cmd
,
929 "debug " PROTO_NAME
" route-events",
932 "IS-IS Route related events\n")
934 isis
->debugs
|= DEBUG_RTE_EVENTS
;
935 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
940 DEFUN (no_debug_isis_rtevents
,
941 no_debug_isis_rtevents_cmd
,
942 "no debug " PROTO_NAME
" route-events",
946 "IS-IS Route related events\n")
948 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
949 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
954 DEFUN (debug_isis_events
,
955 debug_isis_events_cmd
,
956 "debug " PROTO_NAME
" events",
961 isis
->debugs
|= DEBUG_EVENTS
;
962 print_debug(vty
, DEBUG_EVENTS
, 1);
967 DEFUN (no_debug_isis_events
,
968 no_debug_isis_events_cmd
,
969 "no debug " PROTO_NAME
" events",
975 isis
->debugs
&= ~DEBUG_EVENTS
;
976 print_debug(vty
, DEBUG_EVENTS
, 0);
981 DEFUN (debug_isis_packet_dump
,
982 debug_isis_packet_dump_cmd
,
983 "debug " PROTO_NAME
" packet-dump",
986 "IS-IS packet dump\n")
988 isis
->debugs
|= DEBUG_PACKET_DUMP
;
989 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
994 DEFUN (no_debug_isis_packet_dump
,
995 no_debug_isis_packet_dump_cmd
,
996 "no debug " PROTO_NAME
" packet-dump",
1000 "IS-IS packet dump\n")
1002 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1003 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1008 DEFUN (debug_isis_lsp_gen
,
1009 debug_isis_lsp_gen_cmd
,
1010 "debug " PROTO_NAME
" lsp-gen",
1013 "IS-IS generation of own LSPs\n")
1015 isis
->debugs
|= DEBUG_LSP_GEN
;
1016 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1021 DEFUN (no_debug_isis_lsp_gen
,
1022 no_debug_isis_lsp_gen_cmd
,
1023 "no debug " PROTO_NAME
" lsp-gen",
1027 "IS-IS generation of own LSPs\n")
1029 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1030 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1035 DEFUN (debug_isis_lsp_sched
,
1036 debug_isis_lsp_sched_cmd
,
1037 "debug " PROTO_NAME
" lsp-sched",
1040 "IS-IS scheduling of LSP generation\n")
1042 isis
->debugs
|= DEBUG_LSP_SCHED
;
1043 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1048 DEFUN (no_debug_isis_lsp_sched
,
1049 no_debug_isis_lsp_sched_cmd
,
1050 "no debug " PROTO_NAME
" lsp-sched",
1054 "IS-IS scheduling of LSP generation\n")
1056 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1057 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1062 DEFUN (debug_isis_bfd
,
1064 "debug " PROTO_NAME
" bfd",
1067 PROTO_NAME
" interaction with BFD\n")
1069 isis
->debugs
|= DEBUG_BFD
;
1070 print_debug(vty
, DEBUG_BFD
, 1);
1075 DEFUN (no_debug_isis_bfd
,
1076 no_debug_isis_bfd_cmd
,
1077 "no debug " PROTO_NAME
" bfd",
1081 PROTO_NAME
" interaction with BFD\n")
1083 isis
->debugs
&= ~DEBUG_BFD
;
1084 print_debug(vty
, DEBUG_BFD
, 0);
1089 DEFUN (show_hostname
,
1091 "show " PROTO_NAME
" hostname",
1094 "IS-IS Dynamic hostname mapping\n")
1096 dynhn_print_all(vty
);
1101 DEFUN (show_isis_spf_ietf
,
1102 show_isis_spf_ietf_cmd
,
1103 "show " PROTO_NAME
" spf-delay-ietf",
1106 "SPF delay IETF information\n")
1109 vty_out(vty
, "ISIS is not running\n");
1113 struct listnode
*node
;
1114 struct isis_area
*area
;
1116 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1117 vty_out(vty
, "Area %s:\n",
1118 area
->area_tag
? area
->area_tag
: "null");
1120 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1121 if ((area
->is_type
& level
) == 0)
1124 vty_out(vty
, " Level-%d:\n", level
);
1125 vty_out(vty
, " SPF delay status: ");
1126 if (area
->spf_timer
[level
- 1]) {
1127 struct timeval remain
= thread_timer_remain(
1128 area
->spf_timer
[level
- 1]);
1129 vty_out(vty
, "Pending, due in %lld msec\n",
1130 (long long)remain
.tv_sec
* 1000
1131 + remain
.tv_usec
/ 1000);
1133 vty_out(vty
, "Not scheduled\n");
1136 if (area
->spf_delay_ietf
[level
- 1]) {
1138 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1140 area
->spf_delay_ietf
[level
- 1], vty
,
1143 vty_out(vty
, " Using legacy backoff algo\n");
1150 DEFUN (show_isis_summary
,
1151 show_isis_summary_cmd
,
1152 "show " PROTO_NAME
" summary",
1153 SHOW_STR PROTO_HELP
"summary\n")
1155 struct listnode
*node
, *node2
;
1156 struct isis_area
*area
;
1160 vty_out(vty
, PROTO_NAME
" is not running\n");
1164 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1165 if (isis
->sysid_set
)
1166 vty_out(vty
, "System Id : %s\n",
1167 sysid_print(isis
->sysid
));
1169 vty_out(vty
, "Up time : ");
1170 vty_out_timestr(vty
, isis
->uptime
);
1173 if (isis
->area_list
)
1174 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1176 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1177 vty_out(vty
, "Area %s:\n",
1178 area
->area_tag
? area
->area_tag
: "null");
1181 uint8_t tier
= fabricd_tier(area
);
1182 if (tier
== ISIS_TIER_UNDEFINED
)
1183 vty_out(vty
, " Tier: undefined\n");
1185 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1188 if (listcount(area
->area_addrs
) > 0) {
1189 struct area_addr
*area_addr
;
1190 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1192 vty_out(vty
, " Net: %s\n",
1193 isonet_print(area_addr
->area_addr
,
1200 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1201 if ((area
->is_type
& level
) == 0)
1204 vty_out(vty
, " Level-%d:\n", level
);
1205 if (area
->spf_timer
[level
- 1])
1206 vty_out(vty
, " SPF: (pending)\n");
1208 vty_out(vty
, " SPF:\n");
1210 vty_out(vty
, " minimum interval : %d",
1211 area
->min_spf_interval
[level
- 1]);
1212 if (area
->spf_delay_ietf
[level
- 1])
1214 " (not used, IETF SPF delay activated)");
1217 vty_out(vty
, " IPv4 route computation:\n");
1218 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1221 vty_out(vty
, " IPv6 route computation:\n");
1222 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1225 vty_out(vty
, " IPv6 dst-src route computation:\n");
1226 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1236 * This function supports following display options:
1237 * [ show isis database [detail] ]
1238 * [ show isis database <sysid> [detail] ]
1239 * [ show isis database <hostname> [detail] ]
1240 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1241 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1242 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1243 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1244 * [ show isis database detail <sysid> ]
1245 * [ show isis database detail <hostname> ]
1246 * [ show isis database detail <sysid>.<pseudo-id> ]
1247 * [ show isis database detail <hostname>.<pseudo-id> ]
1248 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1249 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1251 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1253 struct listnode
*node
;
1254 struct isis_area
*area
;
1255 struct isis_lsp
*lsp
;
1256 struct isis_dynhn
*dynhn
;
1258 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2];
1261 int level
, lsp_count
;
1263 if (isis
->area_list
->count
== 0)
1266 memset(&lspid
, 0, ISIS_SYS_ID_LEN
);
1267 memset(&sysid
, 0, 255);
1270 * extract fragment and pseudo id from the string argv
1272 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1273 * (b) <systemid/hostname>.<pseudo-id> or
1274 * (c) <systemid/hostname> or
1275 * Where systemid is in the form:
1279 strncpy(sysid
, argv
, 254);
1280 if (argv
&& strlen(argv
) > 3) {
1281 pos
= argv
+ strlen(argv
) - 3;
1282 if (strncmp(pos
, "-", 1) == 0) {
1283 memcpy(number
, ++pos
, 2);
1284 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1285 (uint8_t)strtol((char *)number
, NULL
, 16);
1287 if (strncmp(pos
, ".", 1) != 0)
1290 if (strncmp(pos
, ".", 1) == 0) {
1291 memcpy(number
, ++pos
, 2);
1292 lspid
[ISIS_SYS_ID_LEN
] =
1293 (uint8_t)strtol((char *)number
, NULL
, 16);
1294 sysid
[pos
- argv
- 1] = '\0';
1298 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1299 vty_out(vty
, "Area %s:\n",
1300 area
->area_tag
? area
->area_tag
: "null");
1302 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1303 if (area
->lspdb
[level
]
1304 && dict_count(area
->lspdb
[level
]) > 0) {
1308 * Try to find the lsp-id if the argv
1311 * hostname.<pseudo-id>-<fragment>
1313 if (sysid2buff(lspid
, sysid
)) {
1316 area
->lspdb
[level
]);
1317 } else if ((dynhn
= dynhn_find_by_name(
1319 memcpy(lspid
, dynhn
->id
,
1323 area
->lspdb
[level
]);
1324 } else if (strncmp(cmd_hostname_get(),
1327 memcpy(lspid
, isis
->sysid
,
1331 area
->lspdb
[level
]);
1335 if (lsp
!= NULL
|| argv
== NULL
) {
1337 "IS-IS Level-%d link-state database:\n",
1340 /* print the title in all cases */
1342 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1346 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1353 } else if (argv
== NULL
) {
1354 lsp_count
= lsp_print_all(
1355 vty
, area
->lspdb
[level
],
1356 ui_level
, area
->dynhostname
);
1358 vty_out(vty
, " %u LSPs\n\n",
1368 DEFUN (show_database
,
1370 "show " PROTO_NAME
" database [detail] [WORD]",
1373 "Link state database\n"
1374 "Detailed information\n"
1378 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1379 ? ISIS_UI_LEVEL_DETAIL
1380 : ISIS_UI_LEVEL_BRIEF
;
1381 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1382 return show_isis_database(vty
, id
, uilevel
);
1386 * 'router isis' command
1388 DEFUN_NOSH (router_isis
,
1390 "router " PROTO_NAME
" WORD",
1393 "ISO Routing area tag\n")
1396 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1400 *'no router isis' command
1402 DEFUN (no_router_isis
,
1404 "no router " PROTO_NAME
" WORD",
1408 "ISO Routing area tag\n")
1411 return isis_area_destroy(vty
, argv
[idx_word
]->arg
);
1420 "A Network Entity Title for this process (OSI only)\n"
1421 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1424 return area_net_title(vty
, argv
[idx_word
]->arg
);
1434 "A Network Entity Title for this process (OSI only)\n"
1435 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1438 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1441 DEFUN (isis_topology
,
1443 "topology " ISIS_MT_NAMES
" [overload]",
1444 "Configure IS-IS topologies\n"
1445 ISIS_MT_DESCRIPTIONS
1446 "Set overload bit for topology\n")
1448 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1450 const char *arg
= argv
[1]->arg
;
1451 uint16_t mtid
= isis_str2mtid(arg
);
1453 if (area
->oldmetric
) {
1455 "Multi topology IS-IS can only be used with wide metrics\n");
1456 return CMD_WARNING_CONFIG_FAILED
;
1459 if (mtid
== (uint16_t)-1) {
1460 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1461 return CMD_WARNING_CONFIG_FAILED
;
1463 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1464 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1465 return CMD_WARNING_CONFIG_FAILED
;
1468 area_set_mt_enabled(area
, mtid
, true);
1469 area_set_mt_overload(area
, mtid
, (argc
== 3));
1473 DEFUN (no_isis_topology
,
1474 no_isis_topology_cmd
,
1475 "no topology " ISIS_MT_NAMES
" [overload]",
1477 "Configure IS-IS topologies\n"
1478 ISIS_MT_DESCRIPTIONS
1479 "Set overload bit for topology\n")
1481 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1483 const char *arg
= argv
[2]->arg
;
1484 uint16_t mtid
= isis_str2mtid(arg
);
1486 if (area
->oldmetric
) {
1488 "Multi topology IS-IS can only be used with wide metrics\n");
1489 return CMD_WARNING_CONFIG_FAILED
;
1492 if (mtid
== (uint16_t)-1) {
1493 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1494 return CMD_WARNING_CONFIG_FAILED
;
1496 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1497 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1498 return CMD_WARNING_CONFIG_FAILED
;
1501 area_set_mt_enabled(area
, mtid
, false);
1502 area_set_mt_overload(area
, mtid
, false);
1506 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1508 area
->lsp_mtu
= lsp_mtu
;
1509 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1512 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1513 uint8_t passwd_type
, const char *passwd
,
1516 struct isis_passwd
*dest
;
1517 struct isis_passwd modified
;
1520 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1521 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1522 : &area
->domain_passwd
;
1523 memset(&modified
, 0, sizeof(modified
));
1525 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1529 len
= strlen(passwd
);
1534 strncpy((char *)modified
.passwd
, passwd
, 255);
1535 modified
.type
= passwd_type
;
1536 modified
.snp_auth
= snp_auth
;
1539 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1540 memcpy(dest
, &modified
, sizeof(modified
));
1541 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1547 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1549 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1553 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1554 const char *passwd
, uint8_t snp_auth
)
1556 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1560 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1561 const char *passwd
, uint8_t snp_auth
)
1563 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1567 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1569 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1570 if (!(level
& levels
))
1572 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1573 isis_spf_invalidate_routes(
1574 area
->spftree
[tree
][level
- 1]);
1579 void isis_area_verify_routes(struct isis_area
*area
)
1581 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1582 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1585 static void area_resign_level(struct isis_area
*area
, int level
)
1587 isis_area_invalidate_routes(area
, level
);
1588 isis_area_verify_routes(area
);
1590 if (area
->lspdb
[level
- 1]) {
1591 lsp_db_destroy(area
->lspdb
[level
- 1]);
1592 area
->lspdb
[level
- 1] = NULL
;
1595 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1596 if (area
->spftree
[tree
][level
- 1]) {
1597 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1598 area
->spftree
[tree
][level
- 1] = NULL
;
1602 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1605 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1606 area
->area_tag
, level
);
1607 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1608 area
->lsp_regenerate_pending
[level
- 1] = 0;
1611 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1613 struct listnode
*node
;
1614 struct isis_circuit
*circuit
;
1616 if (isis
->debugs
& DEBUG_EVENTS
)
1617 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1618 area
->area_tag
, circuit_t2string(area
->is_type
),
1619 circuit_t2string(is_type
));
1621 if (area
->is_type
== is_type
)
1622 return; /* No change */
1624 switch (area
->is_type
) {
1626 if (is_type
== IS_LEVEL_2
)
1627 area_resign_level(area
, IS_LEVEL_1
);
1629 if (area
->lspdb
[1] == NULL
)
1630 area
->lspdb
[1] = lsp_db_init();
1633 case IS_LEVEL_1_AND_2
:
1634 if (is_type
== IS_LEVEL_1
)
1635 area_resign_level(area
, IS_LEVEL_2
);
1637 area_resign_level(area
, IS_LEVEL_1
);
1641 if (is_type
== IS_LEVEL_1
)
1642 area_resign_level(area
, IS_LEVEL_2
);
1644 if (area
->lspdb
[0] == NULL
)
1645 area
->lspdb
[0] = lsp_db_init();
1652 area
->is_type
= is_type
;
1654 /* override circuit's is_type */
1655 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1656 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1657 isis_circuit_is_type_set(circuit
, is_type
);
1660 spftree_area_init(area
);
1662 if (listcount(area
->area_addrs
) > 0) {
1663 if (is_type
& IS_LEVEL_1
)
1664 lsp_generate(area
, IS_LEVEL_1
);
1665 if (is_type
& IS_LEVEL_2
)
1666 lsp_generate(area
, IS_LEVEL_2
);
1668 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1673 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1676 if (area
->oldmetric
!= old_metric
|| area
->newmetric
!= new_metric
) {
1677 area
->oldmetric
= old_metric
;
1678 area
->newmetric
= new_metric
;
1679 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1683 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1685 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1687 if (new_overload_bit
!= area
->overload_bit
) {
1688 area
->overload_bit
= new_overload_bit
;
1689 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1693 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1695 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1697 if (new_attached_bit
!= area
->attached_bit
) {
1698 area
->attached_bit
= new_attached_bit
;
1699 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1703 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1705 if (area
->dynhostname
!= dynhostname
) {
1706 area
->dynhostname
= dynhostname
;
1707 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1711 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1712 uint16_t max_lsp_lifetime
)
1714 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1716 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1719 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1720 lsp_regenerate_schedule(area
, level
, 1);
1723 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1724 uint16_t lsp_refresh
)
1726 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1728 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1731 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1732 lsp_regenerate_schedule(area
, level
, 1);
1735 DEFUN (log_adj_changes
,
1736 log_adj_changes_cmd
,
1737 "log-adjacency-changes",
1738 "Log changes in adjacency state\n")
1740 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1742 area
->log_adj_changes
= 1;
1747 DEFUN (no_log_adj_changes
,
1748 no_log_adj_changes_cmd
,
1749 "no log-adjacency-changes",
1751 "Stop logging changes in adjacency state\n")
1753 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1755 area
->log_adj_changes
= 0;
1760 /* IS-IS configuration write function */
1761 int isis_config_write(struct vty
*vty
)
1766 struct isis_area
*area
;
1767 struct listnode
*node
, *node2
;
1769 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1770 /* ISIS - Area name */
1771 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1774 if (listcount(area
->area_addrs
) > 0) {
1775 struct area_addr
*area_addr
;
1776 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1777 node2
, area_addr
)) {
1778 vty_out(vty
, " net %s\n",
1780 area_addr
->area_addr
,
1787 /* ISIS - Dynamic hostname - Defaults to true so only
1790 if (!area
->dynhostname
) {
1791 vty_out(vty
, " no hostname dynamic\n");
1794 /* ISIS - Metric-Style - when true displays wide */
1796 if (area
->newmetric
) {
1797 if (!area
->oldmetric
)
1798 vty_out(vty
, " metric-style wide\n");
1801 " metric-style transition\n");
1804 vty_out(vty
, " metric-style narrow\n");
1808 /* ISIS - overload-bit */
1809 if (area
->overload_bit
) {
1810 vty_out(vty
, " set-overload-bit\n");
1813 /* ISIS - Area is-type (level-1-2 is default) */
1815 if (area
->is_type
== IS_LEVEL_1
) {
1816 vty_out(vty
, " is-type level-1\n");
1818 } else if (area
->is_type
== IS_LEVEL_2
) {
1819 vty_out(vty
, " is-type level-2-only\n");
1823 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1824 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1825 /* ISIS - Lsp generation interval */
1826 if (area
->lsp_gen_interval
[0]
1827 == area
->lsp_gen_interval
[1]) {
1828 if (area
->lsp_gen_interval
[0]
1829 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1830 vty_out(vty
, " lsp-gen-interval %d\n",
1831 area
->lsp_gen_interval
[0]);
1835 if (area
->lsp_gen_interval
[0]
1836 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1838 " lsp-gen-interval level-1 %d\n",
1839 area
->lsp_gen_interval
[0]);
1842 if (area
->lsp_gen_interval
[1]
1843 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1845 " lsp-gen-interval level-2 %d\n",
1846 area
->lsp_gen_interval
[1]);
1850 /* ISIS - LSP lifetime */
1851 if (area
->max_lsp_lifetime
[0]
1852 == area
->max_lsp_lifetime
[1]) {
1853 if (area
->max_lsp_lifetime
[0]
1854 != DEFAULT_LSP_LIFETIME
) {
1855 vty_out(vty
, " max-lsp-lifetime %u\n",
1856 area
->max_lsp_lifetime
[0]);
1860 if (area
->max_lsp_lifetime
[0]
1861 != DEFAULT_LSP_LIFETIME
) {
1863 " max-lsp-lifetime level-1 %u\n",
1864 area
->max_lsp_lifetime
[0]);
1867 if (area
->max_lsp_lifetime
[1]
1868 != DEFAULT_LSP_LIFETIME
) {
1870 " max-lsp-lifetime level-2 %u\n",
1871 area
->max_lsp_lifetime
[1]);
1875 /* ISIS - LSP refresh interval */
1876 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1877 if (area
->lsp_refresh
[0]
1878 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1880 " lsp-refresh-interval %u\n",
1881 area
->lsp_refresh
[0]);
1885 if (area
->lsp_refresh
[0]
1886 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1888 " lsp-refresh-interval level-1 %u\n",
1889 area
->lsp_refresh
[0]);
1892 if (area
->lsp_refresh
[1]
1893 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1895 " lsp-refresh-interval level-2 %u\n",
1896 area
->lsp_refresh
[1]);
1900 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
1901 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
1904 if (area
->purge_originator
) {
1905 vty_out(vty
, " purge-originator\n");
1909 /* Minimum SPF interval. */
1910 if (area
->min_spf_interval
[0]
1911 == area
->min_spf_interval
[1]) {
1912 if (area
->min_spf_interval
[0]
1913 != MINIMUM_SPF_INTERVAL
) {
1914 vty_out(vty
, " spf-interval %d\n",
1915 area
->min_spf_interval
[0]);
1919 if (area
->min_spf_interval
[0]
1920 != MINIMUM_SPF_INTERVAL
) {
1922 " spf-interval level-1 %d\n",
1923 area
->min_spf_interval
[0]);
1926 if (area
->min_spf_interval
[1]
1927 != MINIMUM_SPF_INTERVAL
) {
1929 " spf-interval level-2 %d\n",
1930 area
->min_spf_interval
[1]);
1935 /* IETF SPF interval */
1936 if (area
->spf_delay_ietf
[0]) {
1938 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
1939 spf_backoff_init_delay(
1940 area
->spf_delay_ietf
[0]),
1941 spf_backoff_short_delay(
1942 area
->spf_delay_ietf
[0]),
1943 spf_backoff_long_delay(
1944 area
->spf_delay_ietf
[0]),
1945 spf_backoff_holddown(
1946 area
->spf_delay_ietf
[0]),
1947 spf_backoff_timetolearn(
1948 area
->spf_delay_ietf
[0]));
1952 /* Authentication passwords. */
1953 if (area
->area_passwd
.type
1954 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
1955 vty_out(vty
, " area-password md5 %s",
1956 area
->area_passwd
.passwd
);
1957 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
1959 vty_out(vty
, " authenticate snp ");
1961 area
->area_passwd
.snp_auth
,
1963 vty_out(vty
, "validate");
1965 vty_out(vty
, "send-only");
1969 } else if (area
->area_passwd
.type
1970 == ISIS_PASSWD_TYPE_CLEARTXT
) {
1971 vty_out(vty
, " area-password clear %s",
1972 area
->area_passwd
.passwd
);
1973 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
1975 vty_out(vty
, " authenticate snp ");
1977 area
->area_passwd
.snp_auth
,
1979 vty_out(vty
, "validate");
1981 vty_out(vty
, "send-only");
1986 if (area
->domain_passwd
.type
1987 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
1988 vty_out(vty
, " domain-password md5 %s",
1989 area
->domain_passwd
.passwd
);
1990 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
1992 vty_out(vty
, " authenticate snp ");
1993 if (CHECK_FLAG(area
->domain_passwd
1996 vty_out(vty
, "validate");
1998 vty_out(vty
, "send-only");
2002 } else if (area
->domain_passwd
.type
2003 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2004 vty_out(vty
, " domain-password clear %s",
2005 area
->domain_passwd
.passwd
);
2006 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2008 vty_out(vty
, " authenticate snp ");
2009 if (CHECK_FLAG(area
->domain_passwd
2012 vty_out(vty
, "validate");
2014 vty_out(vty
, "send-only");
2020 if (area
->log_adj_changes
) {
2021 vty_out(vty
, " log-adjacency-changes\n");
2025 write
+= area_write_mt_settings(area
, vty
);
2026 write
+= fabricd_write_settings(area
, vty
);
2028 isis_mpls_te_config_write_router(vty
);
2034 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2038 /* Install IS-IS top node */
2039 install_node(&router_node
, isis_config_write
);
2041 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2043 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2045 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2046 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2047 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2049 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2050 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2051 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2052 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2053 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2055 install_element(VIEW_NODE
, &show_hostname_cmd
);
2056 install_element(VIEW_NODE
, &show_database_cmd
);
2058 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2060 install_node(&debug_node
, config_write_debug
);
2062 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2063 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2064 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2065 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2066 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2067 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2068 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2069 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2070 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2071 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2072 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2073 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2074 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2075 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2076 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2077 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2078 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2079 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2080 install_element(ENABLE_NODE
, &debug_isis_bfd_cmd
);
2081 install_element(ENABLE_NODE
, &no_debug_isis_bfd_cmd
);
2083 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2084 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2085 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2086 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2087 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2088 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2089 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2090 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2091 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2092 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2093 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2094 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2095 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2096 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2097 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2098 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2099 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2100 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2101 install_element(CONFIG_NODE
, &debug_isis_bfd_cmd
);
2102 install_element(CONFIG_NODE
, &no_debug_isis_bfd_cmd
);
2104 install_element(CONFIG_NODE
, &router_isis_cmd
);
2105 install_element(CONFIG_NODE
, &no_router_isis_cmd
);
2107 install_default(ROUTER_NODE
);
2109 install_element(ROUTER_NODE
, &net_cmd
);
2110 install_element(ROUTER_NODE
, &no_net_cmd
);
2112 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2113 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2115 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2116 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2118 spf_backoff_cmd_init();