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"
39 #include "lib/northbound_cli.h"
41 #include "isisd/dict.h"
42 #include "isisd/isis_constants.h"
43 #include "isisd/isis_common.h"
44 #include "isisd/isis_flags.h"
45 #include "isisd/isis_circuit.h"
46 #include "isisd/isis_csm.h"
47 #include "isisd/isisd.h"
48 #include "isisd/isis_dynhn.h"
49 #include "isisd/isis_adjacency.h"
50 #include "isisd/isis_pdu.h"
51 #include "isisd/isis_misc.h"
52 #include "isisd/isis_constants.h"
53 #include "isisd/isis_lsp.h"
54 #include "isisd/isis_spf.h"
55 #include "isisd/isis_route.h"
56 #include "isisd/isis_zebra.h"
57 #include "isisd/isis_events.h"
58 #include "isisd/isis_te.h"
59 #include "isisd/isis_mt.h"
60 #include "isisd/fabricd.h"
62 struct isis
*isis
= NULL
;
64 DEFINE_QOBJ_TYPE(isis
)
65 DEFINE_QOBJ_TYPE(isis_area
)
70 int isis_area_get(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_AND_2
;
119 area
->is_type
= yang_get_default_enum(
120 "/frr-isisd:isis/instance/is-type");
123 * intialize the databases
125 if (area
->is_type
& IS_LEVEL_1
) {
126 area
->lspdb
[0] = lsp_db_init();
128 if (area
->is_type
& IS_LEVEL_2
) {
129 area
->lspdb
[1] = lsp_db_init();
132 spftree_area_init(area
);
134 area
->circuit_list
= list_new();
135 area
->area_addrs
= list_new();
136 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
137 flags_initialize(&area
->flags
);
143 enum isis_metric_style default_style
;
145 area
->max_lsp_lifetime
[0] = yang_get_default_uint16(
146 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-1");
147 area
->max_lsp_lifetime
[1] = yang_get_default_uint16(
148 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-2");
149 area
->lsp_refresh
[0] = yang_get_default_uint16(
150 "/frr-isisd:isis/instance/lsp/refresh-interval/level-1");
151 area
->lsp_refresh
[1] = yang_get_default_uint16(
152 "/frr-isisd:isis/instance/lsp/refresh-interval/level-2");
153 area
->lsp_gen_interval
[0] = yang_get_default_uint16(
154 "/frr-isisd:isis/instance/lsp/generation-interval/level-1");
155 area
->lsp_gen_interval
[1] = yang_get_default_uint16(
156 "/frr-isisd:isis/instance/lsp/generation-interval/level-2");
157 area
->min_spf_interval
[0] = yang_get_default_uint16(
158 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
159 area
->min_spf_interval
[1] = yang_get_default_uint16(
160 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
161 area
->dynhostname
= yang_get_default_bool(
162 "/frr-isisd:isis/instance/dynamic-hostname");
164 yang_get_default_enum("/frr-isisd:isis/instance/metric-style");
165 area
->oldmetric
= default_style
== ISIS_WIDE_METRIC
? 0 : 1;
166 area
->newmetric
= default_style
== ISIS_NARROW_METRIC
? 0 : 1;
167 area
->lsp_frag_threshold
= 90; /* not currently configurable */
169 yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu");
171 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
172 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
173 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
174 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
175 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
176 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
177 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
178 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
179 area
->dynhostname
= 1;
182 area
->lsp_frag_threshold
= 90;
183 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
184 #endif /* ifndef FABRICD */
188 area
->area_tag
= strdup(area_tag
);
189 listnode_add(isis
->area_list
, area
);
193 area
->fabricd
= fabricd_new(area
);
195 area
->lsp_refresh_arg
[0].area
= area
;
196 area
->lsp_refresh_arg
[0].level
= IS_LEVEL_1
;
197 area
->lsp_refresh_arg
[1].area
= area
;
198 area
->lsp_refresh_arg
[1].level
= IS_LEVEL_2
;
201 QOBJ_REG(area
, isis_area
);
206 struct isis_area
*isis_area_lookup(const char *area_tag
)
208 struct isis_area
*area
;
209 struct listnode
*node
;
211 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
212 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
213 || (area
->area_tag
&& area_tag
214 && strcmp(area
->area_tag
, area_tag
) == 0))
220 int isis_area_get(struct vty
*vty
, const char *area_tag
)
222 struct isis_area
*area
;
224 area
= isis_area_lookup(area_tag
);
227 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
231 area
= isis_area_create(area_tag
);
233 if (isis
->debugs
& DEBUG_EVENTS
)
234 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
236 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
241 int isis_area_destroy(const char *area_tag
)
243 struct isis_area
*area
;
244 struct listnode
*node
, *nnode
;
245 struct isis_circuit
*circuit
;
246 struct area_addr
*addr
;
248 area
= isis_area_lookup(area_tag
);
251 zlog_warn("%s: could not find area with area-tag %s",
253 return CMD_ERR_NO_MATCH
;
259 fabricd_finish(area
->fabricd
);
261 if (area
->circuit_list
) {
262 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
264 circuit
->ip_router
= 0;
265 circuit
->ipv6_router
= 0;
266 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
268 list_delete(&area
->circuit_list
);
271 if (area
->lspdb
[0] != NULL
) {
272 lsp_db_destroy(area
->lspdb
[0]);
273 area
->lspdb
[0] = NULL
;
275 if (area
->lspdb
[1] != NULL
) {
276 lsp_db_destroy(area
->lspdb
[1]);
277 area
->lspdb
[1] = NULL
;
280 /* invalidate and verify to delete all routes from zebra */
281 isis_area_invalidate_routes(area
, ISIS_LEVEL1
& ISIS_LEVEL2
);
282 isis_area_verify_routes(area
);
284 spftree_area_del(area
);
286 THREAD_TIMER_OFF(area
->spf_timer
[0]);
287 THREAD_TIMER_OFF(area
->spf_timer
[1]);
289 spf_backoff_free(area
->spf_delay_ietf
[0]);
290 spf_backoff_free(area
->spf_delay_ietf
[1]);
292 isis_redist_area_finish(area
);
294 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
295 list_delete_node(area
->area_addrs
, node
);
296 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
298 area
->area_addrs
= NULL
;
300 THREAD_TIMER_OFF(area
->t_tick
);
301 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
302 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
304 thread_cancel_event(master
, area
);
306 listnode_delete(isis
->area_list
, area
);
308 free(area
->area_tag
);
310 area_mt_finish(area
);
312 XFREE(MTYPE_ISIS_AREA
, area
);
314 if (listcount(isis
->area_list
) == 0) {
315 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
323 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
326 struct isis_area_mt_setting
*setting
;
328 setting
= area_get_mt_setting(area
, mtid
);
329 if (setting
->enabled
!= enabled
) {
330 setting
->enabled
= enabled
;
331 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
335 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
338 struct isis_area_mt_setting
*setting
;
340 setting
= area_get_mt_setting(area
, mtid
);
341 if (setting
->overload
!= overload
) {
342 setting
->overload
= overload
;
343 if (setting
->enabled
)
344 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
348 #endif /* ifdef FABRICD */
350 int area_net_title(struct vty
*vty
, const char *net_title
)
352 VTY_DECLVAR_CONTEXT(isis_area
, area
);
353 struct area_addr
*addr
;
354 struct area_addr
*addrp
;
355 struct listnode
*node
;
359 /* We check that we are not over the maximal number of addresses */
360 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
362 "Maximum of area addresses (%d) already reached \n",
363 isis
->max_area_addrs
);
364 return CMD_ERR_NOTHING_TODO
;
367 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
368 addr
->addr_len
= dotformat2buff(buff
, net_title
);
369 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
371 zlog_debug("added area address %s for area %s (address length %d)",
372 net_title
, area
->area_tag
, addr
->addr_len
);
373 #endif /* EXTREME_DEBUG */
374 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
376 "area address must be at least 8..20 octets long (%d)\n",
378 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
379 return CMD_WARNING_CONFIG_FAILED
;
382 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
384 "nsel byte (last byte) in area address must be 0\n");
385 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
386 return CMD_WARNING_CONFIG_FAILED
;
389 if (isis
->sysid_set
== 0) {
391 * First area address - get the SystemID for this router
393 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
395 if (isis
->debugs
& DEBUG_EVENTS
)
396 zlog_debug("Router has SystemID %s",
397 sysid_print(isis
->sysid
));
400 * Check that the SystemID portions match
402 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
404 "System ID must not change when defining additional area addresses\n");
405 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
406 return CMD_WARNING_CONFIG_FAILED
;
409 /* now we see that we don't already have this address */
410 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
411 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
414 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
416 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
417 return CMD_SUCCESS
; /* silent fail */
423 * Forget the systemID part of the address
425 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
426 listnode_add(area
->area_addrs
, addr
);
428 /* only now we can safely generate our LSPs for this area */
429 if (listcount(area
->area_addrs
) > 0) {
430 if (area
->is_type
& IS_LEVEL_1
)
431 lsp_generate(area
, IS_LEVEL_1
);
432 if (area
->is_type
& IS_LEVEL_2
)
433 lsp_generate(area
, IS_LEVEL_2
);
439 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
441 VTY_DECLVAR_CONTEXT(isis_area
, area
);
442 struct area_addr addr
, *addrp
= NULL
;
443 struct listnode
*node
;
446 addr
.addr_len
= dotformat2buff(buff
, net_title
);
447 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
449 "Unsupported area address length %d, should be 8...20 \n",
451 return CMD_WARNING_CONFIG_FAILED
;
454 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
456 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
457 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
458 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
462 vty_out(vty
, "No area address %s for area %s \n", net_title
,
464 return CMD_ERR_NO_MATCH
;
467 listnode_delete(area
->area_addrs
, addrp
);
468 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
471 * Last area address - reset the SystemID for this router
473 if (listcount(area
->area_addrs
) == 0) {
474 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
476 if (isis
->debugs
& DEBUG_EVENTS
)
477 zlog_debug("Router has no SystemID");
484 * 'show isis interface' command
487 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
489 struct listnode
*anode
, *cnode
;
490 struct isis_area
*area
;
491 struct isis_circuit
*circuit
;
494 vty_out(vty
, "IS-IS Routing Process not enabled\n");
498 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
499 vty_out(vty
, "Area %s:\n", area
->area_tag
);
501 if (detail
== ISIS_UI_LEVEL_BRIEF
)
503 " Interface CircId State Type Level\n");
505 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
507 isis_circuit_print_vty(circuit
, vty
, detail
);
508 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
509 isis_circuit_print_vty(circuit
, vty
, detail
);
515 DEFUN (show_isis_interface
,
516 show_isis_interface_cmd
,
517 "show " PROTO_NAME
" interface",
522 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
525 DEFUN (show_isis_interface_detail
,
526 show_isis_interface_detail_cmd
,
527 "show " PROTO_NAME
" interface detail",
531 "show detailed information\n")
533 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
536 DEFUN (show_isis_interface_arg
,
537 show_isis_interface_arg_cmd
,
538 "show " PROTO_NAME
" interface WORD",
542 "ISIS interface name\n")
545 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
546 ISIS_UI_LEVEL_DETAIL
);
550 * 'show isis neighbor' command
553 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
555 struct listnode
*anode
, *cnode
, *node
;
556 struct isis_area
*area
;
557 struct isis_circuit
*circuit
;
559 struct isis_adjacency
*adj
;
560 struct isis_dynhn
*dynhn
;
561 uint8_t sysid
[ISIS_SYS_ID_LEN
];
565 vty_out(vty
, "IS-IS Routing Process not enabled\n");
569 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
571 if (sysid2buff(sysid
, id
) == 0) {
572 dynhn
= dynhn_find_by_name(id
);
574 vty_out(vty
, "Invalid system id %s\n", id
);
577 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
581 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
582 vty_out(vty
, "Area %s:\n", area
->area_tag
);
584 if (detail
== ISIS_UI_LEVEL_BRIEF
)
586 " System Id Interface L State Holdtime SNPA\n");
588 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
589 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
590 for (i
= 0; i
< 2; i
++) {
591 adjdb
= circuit
->u
.bc
.adjdb
[i
];
592 if (adjdb
&& adjdb
->count
) {
593 for (ALL_LIST_ELEMENTS_RO(
596 || !memcmp(adj
->sysid
,
605 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
606 && circuit
->u
.p2p
.neighbor
) {
607 adj
= circuit
->u
.p2p
.neighbor
;
609 || !memcmp(adj
->sysid
, sysid
,
611 isis_adj_print_vty(adj
, vty
, detail
);
620 * 'clear isis neighbor' command
622 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
624 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
625 struct isis_area
*area
;
626 struct isis_circuit
*circuit
;
628 struct isis_adjacency
*adj
;
629 struct isis_dynhn
*dynhn
;
630 uint8_t sysid
[ISIS_SYS_ID_LEN
];
634 vty_out(vty
, "IS-IS Routing Process not enabled\n");
638 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
640 if (sysid2buff(sysid
, id
) == 0) {
641 dynhn
= dynhn_find_by_name(id
);
643 vty_out(vty
, "Invalid system id %s\n", id
);
646 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
650 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
651 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
653 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
654 for (i
= 0; i
< 2; i
++) {
655 adjdb
= circuit
->u
.bc
.adjdb
[i
];
656 if (adjdb
&& adjdb
->count
) {
657 for (ALL_LIST_ELEMENTS(
661 || !memcmp(adj
->sysid
,
664 isis_adj_state_change(
667 "clear user request");
670 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
671 && circuit
->u
.p2p
.neighbor
) {
672 adj
= circuit
->u
.p2p
.neighbor
;
674 || !memcmp(adj
->sysid
, sysid
,
676 isis_adj_state_change(
678 "clear user request");
686 DEFUN (show_isis_neighbor
,
687 show_isis_neighbor_cmd
,
688 "show " PROTO_NAME
" neighbor",
691 "ISIS neighbor adjacencies\n")
693 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
696 DEFUN (show_isis_neighbor_detail
,
697 show_isis_neighbor_detail_cmd
,
698 "show " PROTO_NAME
" neighbor detail",
701 "ISIS neighbor adjacencies\n"
702 "show detailed information\n")
704 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
707 DEFUN (show_isis_neighbor_arg
,
708 show_isis_neighbor_arg_cmd
,
709 "show " PROTO_NAME
" neighbor WORD",
712 "ISIS neighbor adjacencies\n"
716 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
717 ISIS_UI_LEVEL_DETAIL
);
720 DEFUN (clear_isis_neighbor
,
721 clear_isis_neighbor_cmd
,
722 "clear " PROTO_NAME
" neighbor",
725 "ISIS neighbor adjacencies\n")
727 return clear_isis_neighbor_common(vty
, NULL
);
730 DEFUN (clear_isis_neighbor_arg
,
731 clear_isis_neighbor_arg_cmd
,
732 "clear " PROTO_NAME
" neighbor WORD",
735 "ISIS neighbor adjacencies\n"
739 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
743 * 'isis debug', 'show debugging'
745 void print_debug(struct vty
*vty
, int flags
, int onoff
)
749 strcpy(onoffs
, "on");
751 strcpy(onoffs
, "off");
753 if (flags
& DEBUG_ADJ_PACKETS
)
755 "IS-IS Adjacency related packets debugging is %s\n",
757 if (flags
& DEBUG_TX_QUEUE
)
758 vty_out(vty
, "IS-IS TX queue debugging is %s\n",
760 if (flags
& DEBUG_SNP_PACKETS
)
761 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
763 if (flags
& DEBUG_SPF_EVENTS
)
764 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
765 if (flags
& DEBUG_UPDATE_PACKETS
)
766 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
768 if (flags
& DEBUG_RTE_EVENTS
)
769 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
770 if (flags
& DEBUG_EVENTS
)
771 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
772 if (flags
& DEBUG_PACKET_DUMP
)
773 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
774 if (flags
& DEBUG_LSP_GEN
)
775 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
776 if (flags
& DEBUG_LSP_SCHED
)
777 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
778 if (flags
& DEBUG_FLOODING
)
779 vty_out(vty
, "IS-IS Flooding debugging is %s\n", onoffs
);
780 if (flags
& DEBUG_BFD
)
781 vty_out(vty
, "IS-IS BFD debugging is %s\n", onoffs
);
784 DEFUN_NOSH (show_debugging
,
785 show_debugging_isis_cmd
,
786 "show debugging [" PROTO_NAME
"]",
788 "State of each debugging option\n"
791 vty_out(vty
, PROTO_NAME
" debugging status:\n");
794 print_debug(vty
, isis
->debugs
, 1);
800 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
802 static int config_write_debug(struct vty
*vty
)
805 int flags
= isis
->debugs
;
807 if (flags
& DEBUG_ADJ_PACKETS
) {
808 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
811 if (flags
& DEBUG_TX_QUEUE
) {
812 vty_out(vty
, "debug " PROTO_NAME
" tx-queue\n");
815 if (flags
& DEBUG_SNP_PACKETS
) {
816 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
819 if (flags
& DEBUG_SPF_EVENTS
) {
820 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
823 if (flags
& DEBUG_UPDATE_PACKETS
) {
824 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
827 if (flags
& DEBUG_RTE_EVENTS
) {
828 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
831 if (flags
& DEBUG_EVENTS
) {
832 vty_out(vty
, "debug " PROTO_NAME
" events\n");
835 if (flags
& DEBUG_PACKET_DUMP
) {
836 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
839 if (flags
& DEBUG_LSP_GEN
) {
840 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
843 if (flags
& DEBUG_LSP_SCHED
) {
844 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
847 if (flags
& DEBUG_FLOODING
) {
848 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
851 if (flags
& DEBUG_BFD
) {
852 vty_out(vty
, "debug " PROTO_NAME
" bfd\n");
855 write
+= spf_backoff_write_config(vty
);
860 DEFUN (debug_isis_adj
,
862 "debug " PROTO_NAME
" adj-packets",
865 "IS-IS Adjacency related packets\n")
867 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
868 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
873 DEFUN (no_debug_isis_adj
,
874 no_debug_isis_adj_cmd
,
875 "no debug " PROTO_NAME
" adj-packets",
879 "IS-IS Adjacency related packets\n")
881 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
882 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
887 DEFUN (debug_isis_tx_queue
,
888 debug_isis_tx_queue_cmd
,
889 "debug " PROTO_NAME
" tx-queue",
894 isis
->debugs
|= DEBUG_TX_QUEUE
;
895 print_debug(vty
, DEBUG_TX_QUEUE
, 1);
900 DEFUN (no_debug_isis_tx_queue
,
901 no_debug_isis_tx_queue_cmd
,
902 "no debug " PROTO_NAME
" tx-queue",
908 isis
->debugs
&= ~DEBUG_TX_QUEUE
;
909 print_debug(vty
, DEBUG_TX_QUEUE
, 0);
914 DEFUN (debug_isis_flooding
,
915 debug_isis_flooding_cmd
,
916 "debug " PROTO_NAME
" flooding",
919 "Flooding algorithm\n")
921 isis
->debugs
|= DEBUG_FLOODING
;
922 print_debug(vty
, DEBUG_FLOODING
, 1);
927 DEFUN (no_debug_isis_flooding
,
928 no_debug_isis_flooding_cmd
,
929 "no debug " PROTO_NAME
" flooding",
933 "Flooding algorithm\n")
935 isis
->debugs
&= ~DEBUG_FLOODING
;
936 print_debug(vty
, DEBUG_FLOODING
, 0);
941 DEFUN (debug_isis_snp
,
943 "debug " PROTO_NAME
" snp-packets",
946 "IS-IS CSNP/PSNP packets\n")
948 isis
->debugs
|= DEBUG_SNP_PACKETS
;
949 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
954 DEFUN (no_debug_isis_snp
,
955 no_debug_isis_snp_cmd
,
956 "no debug " PROTO_NAME
" snp-packets",
960 "IS-IS CSNP/PSNP packets\n")
962 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
963 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
968 DEFUN (debug_isis_upd
,
970 "debug " PROTO_NAME
" update-packets",
973 "IS-IS Update related packets\n")
975 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
976 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
981 DEFUN (no_debug_isis_upd
,
982 no_debug_isis_upd_cmd
,
983 "no debug " PROTO_NAME
" update-packets",
987 "IS-IS Update related packets\n")
989 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
990 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
995 DEFUN (debug_isis_spfevents
,
996 debug_isis_spfevents_cmd
,
997 "debug " PROTO_NAME
" spf-events",
1000 "IS-IS Shortest Path First Events\n")
1002 isis
->debugs
|= DEBUG_SPF_EVENTS
;
1003 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
1008 DEFUN (no_debug_isis_spfevents
,
1009 no_debug_isis_spfevents_cmd
,
1010 "no debug " PROTO_NAME
" spf-events",
1014 "IS-IS Shortest Path First Events\n")
1016 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1017 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1022 DEFUN (debug_isis_rtevents
,
1023 debug_isis_rtevents_cmd
,
1024 "debug " PROTO_NAME
" route-events",
1027 "IS-IS Route related events\n")
1029 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1030 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1035 DEFUN (no_debug_isis_rtevents
,
1036 no_debug_isis_rtevents_cmd
,
1037 "no debug " PROTO_NAME
" route-events",
1041 "IS-IS Route related events\n")
1043 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1044 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1049 DEFUN (debug_isis_events
,
1050 debug_isis_events_cmd
,
1051 "debug " PROTO_NAME
" events",
1056 isis
->debugs
|= DEBUG_EVENTS
;
1057 print_debug(vty
, DEBUG_EVENTS
, 1);
1062 DEFUN (no_debug_isis_events
,
1063 no_debug_isis_events_cmd
,
1064 "no debug " PROTO_NAME
" events",
1070 isis
->debugs
&= ~DEBUG_EVENTS
;
1071 print_debug(vty
, DEBUG_EVENTS
, 0);
1076 DEFUN (debug_isis_packet_dump
,
1077 debug_isis_packet_dump_cmd
,
1078 "debug " PROTO_NAME
" packet-dump",
1081 "IS-IS packet dump\n")
1083 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1084 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1089 DEFUN (no_debug_isis_packet_dump
,
1090 no_debug_isis_packet_dump_cmd
,
1091 "no debug " PROTO_NAME
" packet-dump",
1095 "IS-IS packet dump\n")
1097 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1098 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1103 DEFUN (debug_isis_lsp_gen
,
1104 debug_isis_lsp_gen_cmd
,
1105 "debug " PROTO_NAME
" lsp-gen",
1108 "IS-IS generation of own LSPs\n")
1110 isis
->debugs
|= DEBUG_LSP_GEN
;
1111 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1116 DEFUN (no_debug_isis_lsp_gen
,
1117 no_debug_isis_lsp_gen_cmd
,
1118 "no debug " PROTO_NAME
" lsp-gen",
1122 "IS-IS generation of own LSPs\n")
1124 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1125 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1130 DEFUN (debug_isis_lsp_sched
,
1131 debug_isis_lsp_sched_cmd
,
1132 "debug " PROTO_NAME
" lsp-sched",
1135 "IS-IS scheduling of LSP generation\n")
1137 isis
->debugs
|= DEBUG_LSP_SCHED
;
1138 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1143 DEFUN (no_debug_isis_lsp_sched
,
1144 no_debug_isis_lsp_sched_cmd
,
1145 "no debug " PROTO_NAME
" lsp-sched",
1149 "IS-IS scheduling of LSP generation\n")
1151 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1152 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1157 DEFUN (debug_isis_bfd
,
1159 "debug " PROTO_NAME
" bfd",
1162 PROTO_NAME
" interaction with BFD\n")
1164 isis
->debugs
|= DEBUG_BFD
;
1165 print_debug(vty
, DEBUG_BFD
, 1);
1170 DEFUN (no_debug_isis_bfd
,
1171 no_debug_isis_bfd_cmd
,
1172 "no debug " PROTO_NAME
" bfd",
1176 PROTO_NAME
" interaction with BFD\n")
1178 isis
->debugs
&= ~DEBUG_BFD
;
1179 print_debug(vty
, DEBUG_BFD
, 0);
1184 DEFUN (show_hostname
,
1186 "show " PROTO_NAME
" hostname",
1189 "IS-IS Dynamic hostname mapping\n")
1191 dynhn_print_all(vty
);
1196 DEFUN (show_isis_spf_ietf
,
1197 show_isis_spf_ietf_cmd
,
1198 "show " PROTO_NAME
" spf-delay-ietf",
1201 "SPF delay IETF information\n")
1204 vty_out(vty
, "ISIS is not running\n");
1208 struct listnode
*node
;
1209 struct isis_area
*area
;
1211 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1212 vty_out(vty
, "Area %s:\n",
1213 area
->area_tag
? area
->area_tag
: "null");
1215 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1216 if ((area
->is_type
& level
) == 0)
1219 vty_out(vty
, " Level-%d:\n", level
);
1220 vty_out(vty
, " SPF delay status: ");
1221 if (area
->spf_timer
[level
- 1]) {
1222 struct timeval remain
= thread_timer_remain(
1223 area
->spf_timer
[level
- 1]);
1224 vty_out(vty
, "Pending, due in %lld msec\n",
1225 (long long)remain
.tv_sec
* 1000
1226 + remain
.tv_usec
/ 1000);
1228 vty_out(vty
, "Not scheduled\n");
1231 if (area
->spf_delay_ietf
[level
- 1]) {
1233 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1235 area
->spf_delay_ietf
[level
- 1], vty
,
1238 vty_out(vty
, " Using legacy backoff algo\n");
1245 DEFUN (show_isis_summary
,
1246 show_isis_summary_cmd
,
1247 "show " PROTO_NAME
" summary",
1248 SHOW_STR PROTO_HELP
"summary\n")
1250 struct listnode
*node
, *node2
;
1251 struct isis_area
*area
;
1255 vty_out(vty
, PROTO_NAME
" is not running\n");
1259 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1260 if (isis
->sysid_set
)
1261 vty_out(vty
, "System Id : %s\n",
1262 sysid_print(isis
->sysid
));
1264 vty_out(vty
, "Up time : ");
1265 vty_out_timestr(vty
, isis
->uptime
);
1268 if (isis
->area_list
)
1269 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1271 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1272 vty_out(vty
, "Area %s:\n",
1273 area
->area_tag
? area
->area_tag
: "null");
1276 uint8_t tier
= fabricd_tier(area
);
1277 if (tier
== ISIS_TIER_UNDEFINED
)
1278 vty_out(vty
, " Tier: undefined\n");
1280 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1283 if (listcount(area
->area_addrs
) > 0) {
1284 struct area_addr
*area_addr
;
1285 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1287 vty_out(vty
, " Net: %s\n",
1288 isonet_print(area_addr
->area_addr
,
1295 vty_out(vty
, " TX counters per PDU type:\n");
1296 pdu_counter_print(vty
, " ", area
->pdu_tx_counters
);
1297 vty_out(vty
, " LSP RXMT: %" PRIu64
"\n",
1298 area
->lsp_rxmt_count
);
1299 vty_out(vty
, " RX counters per PDU type:\n");
1300 pdu_counter_print(vty
, " ", area
->pdu_rx_counters
);
1302 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1303 if ((area
->is_type
& level
) == 0)
1306 vty_out(vty
, " Level-%d:\n", level
);
1308 vty_out(vty
, " LSP0 regenerated: %" PRIu64
"\n",
1309 area
->lsp_gen_count
[level
- 1]);
1311 vty_out(vty
, " LSPs purged: %" PRIu64
"\n",
1312 area
->lsp_purge_count
[level
- 1]);
1314 if (area
->spf_timer
[level
- 1])
1315 vty_out(vty
, " SPF: (pending)\n");
1317 vty_out(vty
, " SPF:\n");
1319 vty_out(vty
, " minimum interval : %d",
1320 area
->min_spf_interval
[level
- 1]);
1321 if (area
->spf_delay_ietf
[level
- 1])
1323 " (not used, IETF SPF delay activated)");
1326 vty_out(vty
, " IPv4 route computation:\n");
1327 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1330 vty_out(vty
, " IPv6 route computation:\n");
1331 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1334 vty_out(vty
, " IPv6 dst-src route computation:\n");
1335 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1344 struct isis_lsp
*lsp_for_arg(const char *argv
, dict_t
*lspdb
)
1346 char sysid
[255] = {0};
1349 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2] = {0};
1350 struct isis_dynhn
*dynhn
;
1351 struct isis_lsp
*lsp
= NULL
;
1357 * extract fragment and pseudo id from the string argv
1359 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1360 * (b) <systemid/hostname>.<pseudo-id> or
1361 * (c) <systemid/hostname> or
1362 * Where systemid is in the form:
1366 strlcpy(sysid
, argv
, sizeof(sysid
));
1367 if (argv
&& strlen(argv
) > 3) {
1368 pos
= argv
+ strlen(argv
) - 3;
1369 if (strncmp(pos
, "-", 1) == 0) {
1370 memcpy(number
, ++pos
, 2);
1371 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1372 (uint8_t)strtol((char *)number
, NULL
, 16);
1374 if (strncmp(pos
, ".", 1) != 0)
1377 if (strncmp(pos
, ".", 1) == 0) {
1378 memcpy(number
, ++pos
, 2);
1379 lspid
[ISIS_SYS_ID_LEN
] =
1380 (uint8_t)strtol((char *)number
, NULL
, 16);
1381 sysid
[pos
- argv
- 1] = '\0';
1386 * Try to find the lsp-id if the argv
1389 * hostname.<pseudo-id>-<fragment>
1391 if (sysid2buff(lspid
, sysid
)) {
1392 lsp
= lsp_search(lspid
, lspdb
);
1393 } else if ((dynhn
= dynhn_find_by_name(sysid
))) {
1394 memcpy(lspid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
1395 lsp
= lsp_search(lspid
, lspdb
);
1396 } else if (strncmp(cmd_hostname_get(), sysid
, 15) == 0) {
1397 memcpy(lspid
, isis
->sysid
, ISIS_SYS_ID_LEN
);
1398 lsp
= lsp_search(lspid
, lspdb
);
1405 * This function supports following display options:
1406 * [ show isis database [detail] ]
1407 * [ show isis database <sysid> [detail] ]
1408 * [ show isis database <hostname> [detail] ]
1409 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1410 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1411 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1412 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1413 * [ show isis database detail <sysid> ]
1414 * [ show isis database detail <hostname> ]
1415 * [ show isis database detail <sysid>.<pseudo-id> ]
1416 * [ show isis database detail <hostname>.<pseudo-id> ]
1417 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1418 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1420 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1422 struct listnode
*node
;
1423 struct isis_area
*area
;
1424 struct isis_lsp
*lsp
;
1425 int level
, lsp_count
;
1427 if (isis
->area_list
->count
== 0)
1430 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1431 vty_out(vty
, "Area %s:\n",
1432 area
->area_tag
? area
->area_tag
: "null");
1434 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1435 if (area
->lspdb
[level
]
1436 && dict_count(area
->lspdb
[level
]) > 0) {
1437 lsp
= lsp_for_arg(argv
, area
->lspdb
[level
]);
1439 if (lsp
!= NULL
|| argv
== NULL
) {
1441 "IS-IS Level-%d link-state database:\n",
1444 /* print the title in all cases */
1446 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1450 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1457 } else if (argv
== NULL
) {
1458 lsp_count
= lsp_print_all(
1459 vty
, area
->lspdb
[level
],
1460 ui_level
, area
->dynhostname
);
1462 vty_out(vty
, " %u LSPs\n\n",
1472 DEFUN (show_database
,
1474 "show " PROTO_NAME
" database [detail] [WORD]",
1477 "Link state database\n"
1478 "Detailed information\n"
1482 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1483 ? ISIS_UI_LEVEL_DETAIL
1484 : ISIS_UI_LEVEL_BRIEF
;
1485 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1486 return show_isis_database(vty
, id
, uilevel
);
1491 * 'router openfabric' command
1493 DEFUN_NOSH (router_openfabric
,
1494 router_openfabric_cmd
,
1495 "router openfabric WORD",
1498 "ISO Routing area tag\n")
1501 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1505 *'no router openfabric' command
1507 DEFUN (no_router_openfabric
,
1508 no_router_openfabric_cmd
,
1509 "no router openfabric WORD",
1513 "ISO Routing area tag\n")
1516 return isis_area_destroy(argv
[idx_word
]->arg
);
1518 #endif /* ifdef FABRICD */
1526 "A Network Entity Title for this process (OSI only)\n"
1527 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1530 return area_net_title(vty
, argv
[idx_word
]->arg
);
1540 "A Network Entity Title for this process (OSI only)\n"
1541 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1544 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1546 #endif /* ifdef FABRICD */
1548 DEFUN (isis_topology
,
1550 "topology " ISIS_MT_NAMES
" [overload]",
1551 "Configure IS-IS topologies\n"
1552 ISIS_MT_DESCRIPTIONS
1553 "Set overload bit for topology\n")
1555 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1557 const char *arg
= argv
[1]->arg
;
1558 uint16_t mtid
= isis_str2mtid(arg
);
1560 if (area
->oldmetric
) {
1562 "Multi topology IS-IS can only be used with wide metrics\n");
1563 return CMD_WARNING_CONFIG_FAILED
;
1566 if (mtid
== (uint16_t)-1) {
1567 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1568 return CMD_WARNING_CONFIG_FAILED
;
1570 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1571 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1572 return CMD_WARNING_CONFIG_FAILED
;
1575 area_set_mt_enabled(area
, mtid
, true);
1576 area_set_mt_overload(area
, mtid
, (argc
== 3));
1580 DEFUN (no_isis_topology
,
1581 no_isis_topology_cmd
,
1582 "no topology " ISIS_MT_NAMES
" [overload]",
1584 "Configure IS-IS topologies\n"
1585 ISIS_MT_DESCRIPTIONS
1586 "Set overload bit for topology\n")
1588 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1590 const char *arg
= argv
[2]->arg
;
1591 uint16_t mtid
= isis_str2mtid(arg
);
1593 if (area
->oldmetric
) {
1595 "Multi topology IS-IS can only be used with wide metrics\n");
1596 return CMD_WARNING_CONFIG_FAILED
;
1599 if (mtid
== (uint16_t)-1) {
1600 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1601 return CMD_WARNING_CONFIG_FAILED
;
1603 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1604 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1605 return CMD_WARNING_CONFIG_FAILED
;
1608 area_set_mt_enabled(area
, mtid
, false);
1609 area_set_mt_overload(area
, mtid
, false);
1612 #endif /* ifdef FABRICD */
1614 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1616 area
->lsp_mtu
= lsp_mtu
;
1617 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1620 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1621 uint8_t passwd_type
, const char *passwd
,
1624 struct isis_passwd
*dest
;
1625 struct isis_passwd modified
;
1628 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1629 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1630 : &area
->domain_passwd
;
1631 memset(&modified
, 0, sizeof(modified
));
1633 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1637 len
= strlen(passwd
);
1642 strlcpy((char *)modified
.passwd
, passwd
,
1643 sizeof(modified
.passwd
));
1644 modified
.type
= passwd_type
;
1645 modified
.snp_auth
= snp_auth
;
1648 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1649 memcpy(dest
, &modified
, sizeof(modified
));
1650 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1656 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1658 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1662 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1663 const char *passwd
, uint8_t snp_auth
)
1665 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1669 int isis_area_passwd_hmac_md5_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_HMAC_MD5
,
1676 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1678 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1679 if (!(level
& levels
))
1681 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1682 isis_spf_invalidate_routes(
1683 area
->spftree
[tree
][level
- 1]);
1688 void isis_area_verify_routes(struct isis_area
*area
)
1690 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1691 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1694 static void area_resign_level(struct isis_area
*area
, int level
)
1696 isis_area_invalidate_routes(area
, level
);
1697 isis_area_verify_routes(area
);
1699 if (area
->lspdb
[level
- 1]) {
1700 lsp_db_destroy(area
->lspdb
[level
- 1]);
1701 area
->lspdb
[level
- 1] = NULL
;
1704 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1705 if (area
->spftree
[tree
][level
- 1]) {
1706 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1707 area
->spftree
[tree
][level
- 1] = NULL
;
1711 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1714 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1715 area
->area_tag
, level
);
1716 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1717 area
->lsp_regenerate_pending
[level
- 1] = 0;
1720 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1722 struct listnode
*node
;
1723 struct isis_circuit
*circuit
;
1725 if (isis
->debugs
& DEBUG_EVENTS
)
1726 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1727 area
->area_tag
, circuit_t2string(area
->is_type
),
1728 circuit_t2string(is_type
));
1730 if (area
->is_type
== is_type
)
1731 return; /* No change */
1733 switch (area
->is_type
) {
1735 if (is_type
== IS_LEVEL_2
)
1736 area_resign_level(area
, IS_LEVEL_1
);
1738 if (area
->lspdb
[1] == NULL
)
1739 area
->lspdb
[1] = lsp_db_init();
1742 case IS_LEVEL_1_AND_2
:
1743 if (is_type
== IS_LEVEL_1
)
1744 area_resign_level(area
, IS_LEVEL_2
);
1746 area_resign_level(area
, IS_LEVEL_1
);
1750 if (is_type
== IS_LEVEL_1
)
1751 area_resign_level(area
, IS_LEVEL_2
);
1753 if (area
->lspdb
[0] == NULL
)
1754 area
->lspdb
[0] = lsp_db_init();
1761 area
->is_type
= is_type
;
1763 /* override circuit's is_type */
1764 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1765 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1766 isis_circuit_is_type_set(circuit
, is_type
);
1769 spftree_area_init(area
);
1771 if (listcount(area
->area_addrs
) > 0) {
1772 if (is_type
& IS_LEVEL_1
)
1773 lsp_generate(area
, IS_LEVEL_1
);
1774 if (is_type
& IS_LEVEL_2
)
1775 lsp_generate(area
, IS_LEVEL_2
);
1777 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1782 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1785 area
->oldmetric
= old_metric
;
1786 area
->newmetric
= new_metric
;
1787 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1790 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1792 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1794 if (new_overload_bit
!= area
->overload_bit
) {
1795 area
->overload_bit
= new_overload_bit
;
1796 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1799 isis_notif_db_overload(area
, overload_bit
);
1800 #endif /* ifndef FABRICD */
1803 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1805 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1807 if (new_attached_bit
!= area
->attached_bit
) {
1808 area
->attached_bit
= new_attached_bit
;
1809 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1813 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1815 if (area
->dynhostname
!= dynhostname
) {
1816 area
->dynhostname
= dynhostname
;
1817 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1821 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1822 uint16_t max_lsp_lifetime
)
1824 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1826 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1829 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1830 lsp_regenerate_schedule(area
, level
, 1);
1833 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1834 uint16_t lsp_refresh
)
1836 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1838 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1841 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1842 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;
1870 #endif /* ifdef FABRICD */
1872 /* IS-IS configuration write function */
1873 int isis_config_write(struct vty
*vty
)
1878 struct isis_area
*area
;
1879 struct listnode
*node
, *node2
;
1881 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1882 /* ISIS - Area name */
1883 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1886 if (listcount(area
->area_addrs
) > 0) {
1887 struct area_addr
*area_addr
;
1888 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1889 node2
, area_addr
)) {
1890 vty_out(vty
, " net %s\n",
1892 area_addr
->area_addr
,
1899 /* ISIS - Dynamic hostname - Defaults to true so only
1902 if (!area
->dynhostname
) {
1903 vty_out(vty
, " no hostname dynamic\n");
1906 /* ISIS - Metric-Style - when true displays wide */
1908 if (area
->newmetric
) {
1909 if (!area
->oldmetric
)
1910 vty_out(vty
, " metric-style wide\n");
1913 " metric-style transition\n");
1916 vty_out(vty
, " metric-style narrow\n");
1920 /* ISIS - overload-bit */
1921 if (area
->overload_bit
) {
1922 vty_out(vty
, " set-overload-bit\n");
1925 /* ISIS - Area is-type (level-1-2 is default) */
1927 if (area
->is_type
== IS_LEVEL_1
) {
1928 vty_out(vty
, " is-type level-1\n");
1930 } else if (area
->is_type
== IS_LEVEL_2
) {
1931 vty_out(vty
, " is-type level-2-only\n");
1935 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1936 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1937 /* ISIS - Lsp generation interval */
1938 if (area
->lsp_gen_interval
[0]
1939 == area
->lsp_gen_interval
[1]) {
1940 if (area
->lsp_gen_interval
[0]
1941 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1942 vty_out(vty
, " lsp-gen-interval %d\n",
1943 area
->lsp_gen_interval
[0]);
1947 if (area
->lsp_gen_interval
[0]
1948 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1950 " lsp-gen-interval level-1 %d\n",
1951 area
->lsp_gen_interval
[0]);
1954 if (area
->lsp_gen_interval
[1]
1955 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1957 " lsp-gen-interval level-2 %d\n",
1958 area
->lsp_gen_interval
[1]);
1962 /* ISIS - LSP lifetime */
1963 if (area
->max_lsp_lifetime
[0]
1964 == area
->max_lsp_lifetime
[1]) {
1965 if (area
->max_lsp_lifetime
[0]
1966 != DEFAULT_LSP_LIFETIME
) {
1967 vty_out(vty
, " max-lsp-lifetime %u\n",
1968 area
->max_lsp_lifetime
[0]);
1972 if (area
->max_lsp_lifetime
[0]
1973 != DEFAULT_LSP_LIFETIME
) {
1975 " max-lsp-lifetime level-1 %u\n",
1976 area
->max_lsp_lifetime
[0]);
1979 if (area
->max_lsp_lifetime
[1]
1980 != DEFAULT_LSP_LIFETIME
) {
1982 " max-lsp-lifetime level-2 %u\n",
1983 area
->max_lsp_lifetime
[1]);
1987 /* ISIS - LSP refresh interval */
1988 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1989 if (area
->lsp_refresh
[0]
1990 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1992 " lsp-refresh-interval %u\n",
1993 area
->lsp_refresh
[0]);
1997 if (area
->lsp_refresh
[0]
1998 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2000 " lsp-refresh-interval level-1 %u\n",
2001 area
->lsp_refresh
[0]);
2004 if (area
->lsp_refresh
[1]
2005 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2007 " lsp-refresh-interval level-2 %u\n",
2008 area
->lsp_refresh
[1]);
2012 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
2013 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
2016 if (area
->purge_originator
) {
2017 vty_out(vty
, " purge-originator\n");
2021 /* Minimum SPF interval. */
2022 if (area
->min_spf_interval
[0]
2023 == area
->min_spf_interval
[1]) {
2024 if (area
->min_spf_interval
[0]
2025 != MINIMUM_SPF_INTERVAL
) {
2026 vty_out(vty
, " spf-interval %d\n",
2027 area
->min_spf_interval
[0]);
2031 if (area
->min_spf_interval
[0]
2032 != MINIMUM_SPF_INTERVAL
) {
2034 " spf-interval level-1 %d\n",
2035 area
->min_spf_interval
[0]);
2038 if (area
->min_spf_interval
[1]
2039 != MINIMUM_SPF_INTERVAL
) {
2041 " spf-interval level-2 %d\n",
2042 area
->min_spf_interval
[1]);
2047 /* IETF SPF interval */
2048 if (area
->spf_delay_ietf
[0]) {
2050 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2051 spf_backoff_init_delay(
2052 area
->spf_delay_ietf
[0]),
2053 spf_backoff_short_delay(
2054 area
->spf_delay_ietf
[0]),
2055 spf_backoff_long_delay(
2056 area
->spf_delay_ietf
[0]),
2057 spf_backoff_holddown(
2058 area
->spf_delay_ietf
[0]),
2059 spf_backoff_timetolearn(
2060 area
->spf_delay_ietf
[0]));
2064 /* Authentication passwords. */
2065 if (area
->area_passwd
.type
2066 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2067 vty_out(vty
, " area-password md5 %s",
2068 area
->area_passwd
.passwd
);
2069 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2071 vty_out(vty
, " authenticate snp ");
2073 area
->area_passwd
.snp_auth
,
2075 vty_out(vty
, "validate");
2077 vty_out(vty
, "send-only");
2081 } else if (area
->area_passwd
.type
2082 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2083 vty_out(vty
, " area-password clear %s",
2084 area
->area_passwd
.passwd
);
2085 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2087 vty_out(vty
, " authenticate snp ");
2089 area
->area_passwd
.snp_auth
,
2091 vty_out(vty
, "validate");
2093 vty_out(vty
, "send-only");
2098 if (area
->domain_passwd
.type
2099 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2100 vty_out(vty
, " domain-password md5 %s",
2101 area
->domain_passwd
.passwd
);
2102 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2104 vty_out(vty
, " authenticate snp ");
2105 if (CHECK_FLAG(area
->domain_passwd
2108 vty_out(vty
, "validate");
2110 vty_out(vty
, "send-only");
2114 } else if (area
->domain_passwd
.type
2115 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2116 vty_out(vty
, " domain-password clear %s",
2117 area
->domain_passwd
.passwd
);
2118 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2120 vty_out(vty
, " authenticate snp ");
2121 if (CHECK_FLAG(area
->domain_passwd
2124 vty_out(vty
, "validate");
2126 vty_out(vty
, "send-only");
2132 if (area
->log_adj_changes
) {
2133 vty_out(vty
, " log-adjacency-changes\n");
2137 write
+= area_write_mt_settings(area
, vty
);
2138 write
+= fabricd_write_settings(area
, vty
);
2140 isis_mpls_te_config_write_router(vty
);
2147 /* IS-IS configuration write function */
2148 int isis_config_write(struct vty
*vty
)
2151 struct lyd_node
*dnode
;
2153 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-isisd:isis");
2155 nb_cli_show_dnode_cmds(vty
, dnode
, false);
2161 #endif /* ifdef FABRICD */
2163 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2165 void isis_init(void)
2167 /* Install IS-IS top node */
2168 install_node(&router_node
, isis_config_write
);
2170 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2172 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2174 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2175 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2176 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2178 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2179 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2180 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2181 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2182 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2184 install_element(VIEW_NODE
, &show_hostname_cmd
);
2185 install_element(VIEW_NODE
, &show_database_cmd
);
2187 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2189 install_node(&debug_node
, config_write_debug
);
2191 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2192 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2193 install_element(ENABLE_NODE
, &debug_isis_tx_queue_cmd
);
2194 install_element(ENABLE_NODE
, &no_debug_isis_tx_queue_cmd
);
2195 install_element(ENABLE_NODE
, &debug_isis_flooding_cmd
);
2196 install_element(ENABLE_NODE
, &no_debug_isis_flooding_cmd
);
2197 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2198 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2199 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2200 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2201 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2202 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2203 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2204 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2205 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2206 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2207 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2208 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2209 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2210 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2211 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2212 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2213 install_element(ENABLE_NODE
, &debug_isis_bfd_cmd
);
2214 install_element(ENABLE_NODE
, &no_debug_isis_bfd_cmd
);
2216 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2217 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2218 install_element(CONFIG_NODE
, &debug_isis_tx_queue_cmd
);
2219 install_element(CONFIG_NODE
, &no_debug_isis_tx_queue_cmd
);
2220 install_element(CONFIG_NODE
, &debug_isis_flooding_cmd
);
2221 install_element(CONFIG_NODE
, &no_debug_isis_flooding_cmd
);
2222 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2223 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2224 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2225 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2226 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2227 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2228 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2229 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2230 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2231 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2232 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2233 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2234 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2235 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2236 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2237 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2238 install_element(CONFIG_NODE
, &debug_isis_bfd_cmd
);
2239 install_element(CONFIG_NODE
, &no_debug_isis_bfd_cmd
);
2241 install_default(ROUTER_NODE
);
2244 install_element(CONFIG_NODE
, &router_openfabric_cmd
);
2245 install_element(CONFIG_NODE
, &no_router_openfabric_cmd
);
2247 install_element(ROUTER_NODE
, &net_cmd
);
2248 install_element(ROUTER_NODE
, &no_net_cmd
);
2250 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2251 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2253 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2254 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2255 #endif /* ifdef FABRICD */
2257 spf_backoff_cmd_init();