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/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 area_net_title(struct vty
*, const char *);
71 int area_clear_net_title(struct vty
*, const char *);
72 int show_isis_interface_common(struct vty
*, const char *ifname
, char);
73 int show_isis_neighbor_common(struct vty
*, const char *id
, char);
74 int clear_isis_neighbor_common(struct vty
*, const char *id
);
75 int isis_config_write(struct vty
*);
78 void isis_new(unsigned long process_id
)
80 isis
= XCALLOC(MTYPE_ISIS
, sizeof(struct isis
));
84 isis
->max_area_addrs
= 3;
85 isis
->process_id
= process_id
;
87 isis
->area_list
= list_new();
88 isis
->init_circ_list
= list_new();
89 isis
->uptime
= time(NULL
);
90 isis
->nexthops
= list_new();
91 isis
->nexthops6
= list_new();
94 * uncomment the next line for full debugs
96 /* isis->debugs = 0xFFFF; */
101 struct isis_area
*isis_area_create(const char *area_tag
)
103 struct isis_area
*area
;
105 area
= XCALLOC(MTYPE_ISIS_AREA
, sizeof(struct isis_area
));
108 * Fabricd runs only as level-2.
109 * For IS-IS, the first instance is level-1-2 rest are level-1,
110 * unless otherwise configured
113 area
->is_type
= IS_LEVEL_2
;
114 } else if (listcount(isis
->area_list
) == 0)
115 area
->is_type
= IS_LEVEL_1_AND_2
;
117 area
->is_type
= yang_get_default_enum(
118 "/frr-isisd:isis/instance/is-type");
121 * intialize the databases
123 if (area
->is_type
& IS_LEVEL_1
)
124 lsp_db_init(&area
->lspdb
[0]);
125 if (area
->is_type
& IS_LEVEL_2
)
126 lsp_db_init(&area
->lspdb
[1]);
128 spftree_area_init(area
);
130 area
->circuit_list
= list_new();
131 area
->area_addrs
= list_new();
132 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
133 flags_initialize(&area
->flags
);
139 enum isis_metric_style default_style
;
141 area
->max_lsp_lifetime
[0] = yang_get_default_uint16(
142 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-1");
143 area
->max_lsp_lifetime
[1] = yang_get_default_uint16(
144 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-2");
145 area
->lsp_refresh
[0] = yang_get_default_uint16(
146 "/frr-isisd:isis/instance/lsp/refresh-interval/level-1");
147 area
->lsp_refresh
[1] = yang_get_default_uint16(
148 "/frr-isisd:isis/instance/lsp/refresh-interval/level-2");
149 area
->lsp_gen_interval
[0] = yang_get_default_uint16(
150 "/frr-isisd:isis/instance/lsp/generation-interval/level-1");
151 area
->lsp_gen_interval
[1] = yang_get_default_uint16(
152 "/frr-isisd:isis/instance/lsp/generation-interval/level-2");
153 area
->min_spf_interval
[0] = yang_get_default_uint16(
154 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
155 area
->min_spf_interval
[1] = yang_get_default_uint16(
156 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
157 area
->dynhostname
= yang_get_default_bool(
158 "/frr-isisd:isis/instance/dynamic-hostname");
160 yang_get_default_enum("/frr-isisd:isis/instance/metric-style");
161 area
->oldmetric
= default_style
== ISIS_WIDE_METRIC
? 0 : 1;
162 area
->newmetric
= default_style
== ISIS_NARROW_METRIC
? 0 : 1;
163 area
->lsp_frag_threshold
= 90; /* not currently configurable */
165 yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu");
167 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
168 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
169 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
170 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
171 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
172 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
173 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
174 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
175 area
->dynhostname
= 1;
178 area
->lsp_frag_threshold
= 90;
179 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
180 #endif /* ifndef FABRICD */
184 area
->area_tag
= strdup(area_tag
);
185 listnode_add(isis
->area_list
, area
);
189 area
->fabricd
= fabricd_new(area
);
191 area
->lsp_refresh_arg
[0].area
= area
;
192 area
->lsp_refresh_arg
[0].level
= IS_LEVEL_1
;
193 area
->lsp_refresh_arg
[1].area
= area
;
194 area
->lsp_refresh_arg
[1].level
= IS_LEVEL_2
;
197 QOBJ_REG(area
, isis_area
);
202 struct isis_area
*isis_area_lookup(const char *area_tag
)
204 struct isis_area
*area
;
205 struct listnode
*node
;
207 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
208 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
209 || (area
->area_tag
&& area_tag
210 && strcmp(area
->area_tag
, area_tag
) == 0))
216 int isis_area_get(struct vty
*vty
, const char *area_tag
)
218 struct isis_area
*area
;
220 area
= isis_area_lookup(area_tag
);
223 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
227 area
= isis_area_create(area_tag
);
229 if (isis
->debugs
& DEBUG_EVENTS
)
230 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
232 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
237 int isis_area_destroy(const char *area_tag
)
239 struct isis_area
*area
;
240 struct listnode
*node
, *nnode
;
241 struct isis_circuit
*circuit
;
242 struct area_addr
*addr
;
244 area
= isis_area_lookup(area_tag
);
247 zlog_warn("%s: could not find area with area-tag %s",
249 return CMD_ERR_NO_MATCH
;
255 fabricd_finish(area
->fabricd
);
257 /* Disable MPLS if necessary before flooding LSP */
258 if (IS_MPLS_TE(area
->mta
))
259 area
->mta
->status
= disable
;
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 lsp_db_fini(&area
->lspdb
[0]);
272 lsp_db_fini(&area
->lspdb
[1]);
274 /* invalidate and verify to delete all routes from zebra */
275 isis_area_invalidate_routes(area
, area
->is_type
);
276 isis_area_verify_routes(area
);
278 spftree_area_del(area
);
280 THREAD_TIMER_OFF(area
->spf_timer
[0]);
281 THREAD_TIMER_OFF(area
->spf_timer
[1]);
283 spf_backoff_free(area
->spf_delay_ietf
[0]);
284 spf_backoff_free(area
->spf_delay_ietf
[1]);
286 isis_redist_area_finish(area
);
288 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
289 list_delete_node(area
->area_addrs
, node
);
290 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
292 area
->area_addrs
= NULL
;
294 THREAD_TIMER_OFF(area
->t_tick
);
295 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
296 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
298 thread_cancel_event(master
, area
);
300 listnode_delete(isis
->area_list
, area
);
302 free(area
->area_tag
);
304 area_mt_finish(area
);
306 XFREE(MTYPE_ISIS_AREA
, area
);
308 if (listcount(isis
->area_list
) == 0) {
309 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
317 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
320 struct isis_area_mt_setting
*setting
;
322 setting
= area_get_mt_setting(area
, mtid
);
323 if (setting
->enabled
!= enabled
) {
324 setting
->enabled
= enabled
;
325 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
329 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
332 struct isis_area_mt_setting
*setting
;
334 setting
= area_get_mt_setting(area
, mtid
);
335 if (setting
->overload
!= overload
) {
336 setting
->overload
= overload
;
337 if (setting
->enabled
)
338 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
342 #endif /* ifdef FABRICD */
344 int area_net_title(struct vty
*vty
, const char *net_title
)
346 VTY_DECLVAR_CONTEXT(isis_area
, area
);
347 struct area_addr
*addr
;
348 struct area_addr
*addrp
;
349 struct listnode
*node
;
353 /* We check that we are not over the maximal number of addresses */
354 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
356 "Maximum of area addresses (%d) already reached \n",
357 isis
->max_area_addrs
);
358 return CMD_ERR_NOTHING_TODO
;
361 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
362 addr
->addr_len
= dotformat2buff(buff
, net_title
);
363 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
365 zlog_debug("added area address %s for area %s (address length %d)",
366 net_title
, area
->area_tag
, addr
->addr_len
);
367 #endif /* EXTREME_DEBUG */
368 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
370 "area address must be at least 8..20 octets long (%d)\n",
372 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
373 return CMD_WARNING_CONFIG_FAILED
;
376 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
378 "nsel byte (last byte) in area address must be 0\n");
379 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
380 return CMD_WARNING_CONFIG_FAILED
;
383 if (isis
->sysid_set
== 0) {
385 * First area address - get the SystemID for this router
387 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
389 if (isis
->debugs
& DEBUG_EVENTS
)
390 zlog_debug("Router has SystemID %s",
391 sysid_print(isis
->sysid
));
394 * Check that the SystemID portions match
396 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
398 "System ID must not change when defining additional area addresses\n");
399 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
400 return CMD_WARNING_CONFIG_FAILED
;
403 /* now we see that we don't already have this address */
404 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
405 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
408 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
410 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
411 return CMD_SUCCESS
; /* silent fail */
417 * Forget the systemID part of the address
419 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
420 listnode_add(area
->area_addrs
, addr
);
422 /* only now we can safely generate our LSPs for this area */
423 if (listcount(area
->area_addrs
) > 0) {
424 if (area
->is_type
& IS_LEVEL_1
)
425 lsp_generate(area
, IS_LEVEL_1
);
426 if (area
->is_type
& IS_LEVEL_2
)
427 lsp_generate(area
, IS_LEVEL_2
);
433 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
435 VTY_DECLVAR_CONTEXT(isis_area
, area
);
436 struct area_addr addr
, *addrp
= NULL
;
437 struct listnode
*node
;
440 addr
.addr_len
= dotformat2buff(buff
, net_title
);
441 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
443 "Unsupported area address length %d, should be 8...20 \n",
445 return CMD_WARNING_CONFIG_FAILED
;
448 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
450 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
451 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
452 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
456 vty_out(vty
, "No area address %s for area %s \n", net_title
,
458 return CMD_ERR_NO_MATCH
;
461 listnode_delete(area
->area_addrs
, addrp
);
462 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
465 * Last area address - reset the SystemID for this router
467 if (listcount(area
->area_addrs
) == 0) {
468 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
470 if (isis
->debugs
& DEBUG_EVENTS
)
471 zlog_debug("Router has no SystemID");
478 * 'show isis interface' command
481 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
483 struct listnode
*anode
, *cnode
;
484 struct isis_area
*area
;
485 struct isis_circuit
*circuit
;
488 vty_out(vty
, "IS-IS Routing Process not enabled\n");
492 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
493 vty_out(vty
, "Area %s:\n", area
->area_tag
);
495 if (detail
== ISIS_UI_LEVEL_BRIEF
)
497 " Interface CircId State Type Level\n");
499 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
501 isis_circuit_print_vty(circuit
, vty
, detail
);
502 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
503 isis_circuit_print_vty(circuit
, vty
, detail
);
509 DEFUN (show_isis_interface
,
510 show_isis_interface_cmd
,
511 "show " PROTO_NAME
" interface",
516 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
519 DEFUN (show_isis_interface_detail
,
520 show_isis_interface_detail_cmd
,
521 "show " PROTO_NAME
" interface detail",
525 "show detailed information\n")
527 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
530 DEFUN (show_isis_interface_arg
,
531 show_isis_interface_arg_cmd
,
532 "show " PROTO_NAME
" interface WORD",
536 "ISIS interface name\n")
539 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
540 ISIS_UI_LEVEL_DETAIL
);
544 * 'show isis neighbor' command
547 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
549 struct listnode
*anode
, *cnode
, *node
;
550 struct isis_area
*area
;
551 struct isis_circuit
*circuit
;
553 struct isis_adjacency
*adj
;
554 struct isis_dynhn
*dynhn
;
555 uint8_t sysid
[ISIS_SYS_ID_LEN
];
559 vty_out(vty
, "IS-IS Routing Process not enabled\n");
563 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
565 if (sysid2buff(sysid
, id
) == 0) {
566 dynhn
= dynhn_find_by_name(id
);
568 vty_out(vty
, "Invalid system id %s\n", id
);
571 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
575 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
576 vty_out(vty
, "Area %s:\n", area
->area_tag
);
578 if (detail
== ISIS_UI_LEVEL_BRIEF
)
580 " System Id Interface L State Holdtime SNPA\n");
582 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
583 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
584 for (i
= 0; i
< 2; i
++) {
585 adjdb
= circuit
->u
.bc
.adjdb
[i
];
586 if (adjdb
&& adjdb
->count
) {
587 for (ALL_LIST_ELEMENTS_RO(
590 || !memcmp(adj
->sysid
,
599 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
600 && circuit
->u
.p2p
.neighbor
) {
601 adj
= circuit
->u
.p2p
.neighbor
;
603 || !memcmp(adj
->sysid
, sysid
,
605 isis_adj_print_vty(adj
, vty
, detail
);
614 * 'clear isis neighbor' command
616 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
618 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
619 struct isis_area
*area
;
620 struct isis_circuit
*circuit
;
622 struct isis_adjacency
*adj
;
623 struct isis_dynhn
*dynhn
;
624 uint8_t sysid
[ISIS_SYS_ID_LEN
];
628 vty_out(vty
, "IS-IS Routing Process not enabled\n");
632 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
634 if (sysid2buff(sysid
, id
) == 0) {
635 dynhn
= dynhn_find_by_name(id
);
637 vty_out(vty
, "Invalid system id %s\n", id
);
640 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
644 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
645 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
647 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
648 for (i
= 0; i
< 2; i
++) {
649 adjdb
= circuit
->u
.bc
.adjdb
[i
];
650 if (adjdb
&& adjdb
->count
) {
651 for (ALL_LIST_ELEMENTS(
655 || !memcmp(adj
->sysid
,
658 isis_adj_state_change(
661 "clear user request");
664 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
665 && circuit
->u
.p2p
.neighbor
) {
666 adj
= circuit
->u
.p2p
.neighbor
;
668 || !memcmp(adj
->sysid
, sysid
,
670 isis_adj_state_change(
672 "clear user request");
680 DEFUN (show_isis_neighbor
,
681 show_isis_neighbor_cmd
,
682 "show " PROTO_NAME
" neighbor",
685 "ISIS neighbor adjacencies\n")
687 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
690 DEFUN (show_isis_neighbor_detail
,
691 show_isis_neighbor_detail_cmd
,
692 "show " PROTO_NAME
" neighbor detail",
695 "ISIS neighbor adjacencies\n"
696 "show detailed information\n")
698 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
701 DEFUN (show_isis_neighbor_arg
,
702 show_isis_neighbor_arg_cmd
,
703 "show " PROTO_NAME
" neighbor WORD",
706 "ISIS neighbor adjacencies\n"
710 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
711 ISIS_UI_LEVEL_DETAIL
);
714 DEFUN (clear_isis_neighbor
,
715 clear_isis_neighbor_cmd
,
716 "clear " PROTO_NAME
" neighbor",
719 "ISIS neighbor adjacencies\n")
721 return clear_isis_neighbor_common(vty
, NULL
);
724 DEFUN (clear_isis_neighbor_arg
,
725 clear_isis_neighbor_arg_cmd
,
726 "clear " PROTO_NAME
" neighbor WORD",
729 "ISIS neighbor adjacencies\n"
733 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
737 * 'isis debug', 'show debugging'
739 void print_debug(struct vty
*vty
, int flags
, int onoff
)
741 const char *onoffs
= onoff
? "on" : "off";
743 if (flags
& DEBUG_ADJ_PACKETS
)
745 "IS-IS Adjacency related packets debugging is %s\n",
747 if (flags
& DEBUG_TX_QUEUE
)
748 vty_out(vty
, "IS-IS TX queue debugging is %s\n",
750 if (flags
& DEBUG_SNP_PACKETS
)
751 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
753 if (flags
& DEBUG_SPF_EVENTS
)
754 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
755 if (flags
& DEBUG_UPDATE_PACKETS
)
756 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
758 if (flags
& DEBUG_RTE_EVENTS
)
759 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
760 if (flags
& DEBUG_EVENTS
)
761 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
762 if (flags
& DEBUG_PACKET_DUMP
)
763 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
764 if (flags
& DEBUG_LSP_GEN
)
765 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
766 if (flags
& DEBUG_LSP_SCHED
)
767 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
768 if (flags
& DEBUG_FLOODING
)
769 vty_out(vty
, "IS-IS Flooding debugging is %s\n", onoffs
);
770 if (flags
& DEBUG_BFD
)
771 vty_out(vty
, "IS-IS BFD debugging is %s\n", onoffs
);
774 DEFUN_NOSH (show_debugging
,
775 show_debugging_isis_cmd
,
776 "show debugging [" PROTO_NAME
"]",
778 "State of each debugging option\n"
781 vty_out(vty
, PROTO_NAME
" debugging status:\n");
784 print_debug(vty
, isis
->debugs
, 1);
790 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
792 static int config_write_debug(struct vty
*vty
)
795 int flags
= isis
->debugs
;
797 if (flags
& DEBUG_ADJ_PACKETS
) {
798 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
801 if (flags
& DEBUG_TX_QUEUE
) {
802 vty_out(vty
, "debug " PROTO_NAME
" tx-queue\n");
805 if (flags
& DEBUG_SNP_PACKETS
) {
806 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
809 if (flags
& DEBUG_SPF_EVENTS
) {
810 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
813 if (flags
& DEBUG_UPDATE_PACKETS
) {
814 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
817 if (flags
& DEBUG_RTE_EVENTS
) {
818 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
821 if (flags
& DEBUG_EVENTS
) {
822 vty_out(vty
, "debug " PROTO_NAME
" events\n");
825 if (flags
& DEBUG_PACKET_DUMP
) {
826 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
829 if (flags
& DEBUG_LSP_GEN
) {
830 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
833 if (flags
& DEBUG_LSP_SCHED
) {
834 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
837 if (flags
& DEBUG_FLOODING
) {
838 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
841 if (flags
& DEBUG_BFD
) {
842 vty_out(vty
, "debug " PROTO_NAME
" bfd\n");
845 write
+= spf_backoff_write_config(vty
);
850 DEFUN (debug_isis_adj
,
852 "debug " PROTO_NAME
" adj-packets",
855 "IS-IS Adjacency related packets\n")
857 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
858 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
863 DEFUN (no_debug_isis_adj
,
864 no_debug_isis_adj_cmd
,
865 "no debug " PROTO_NAME
" adj-packets",
869 "IS-IS Adjacency related packets\n")
871 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
872 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
877 DEFUN (debug_isis_tx_queue
,
878 debug_isis_tx_queue_cmd
,
879 "debug " PROTO_NAME
" tx-queue",
884 isis
->debugs
|= DEBUG_TX_QUEUE
;
885 print_debug(vty
, DEBUG_TX_QUEUE
, 1);
890 DEFUN (no_debug_isis_tx_queue
,
891 no_debug_isis_tx_queue_cmd
,
892 "no debug " PROTO_NAME
" tx-queue",
898 isis
->debugs
&= ~DEBUG_TX_QUEUE
;
899 print_debug(vty
, DEBUG_TX_QUEUE
, 0);
904 DEFUN (debug_isis_flooding
,
905 debug_isis_flooding_cmd
,
906 "debug " PROTO_NAME
" flooding",
909 "Flooding algorithm\n")
911 isis
->debugs
|= DEBUG_FLOODING
;
912 print_debug(vty
, DEBUG_FLOODING
, 1);
917 DEFUN (no_debug_isis_flooding
,
918 no_debug_isis_flooding_cmd
,
919 "no debug " PROTO_NAME
" flooding",
923 "Flooding algorithm\n")
925 isis
->debugs
&= ~DEBUG_FLOODING
;
926 print_debug(vty
, DEBUG_FLOODING
, 0);
931 DEFUN (debug_isis_snp
,
933 "debug " PROTO_NAME
" snp-packets",
936 "IS-IS CSNP/PSNP packets\n")
938 isis
->debugs
|= DEBUG_SNP_PACKETS
;
939 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
944 DEFUN (no_debug_isis_snp
,
945 no_debug_isis_snp_cmd
,
946 "no debug " PROTO_NAME
" snp-packets",
950 "IS-IS CSNP/PSNP packets\n")
952 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
953 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
958 DEFUN (debug_isis_upd
,
960 "debug " PROTO_NAME
" update-packets",
963 "IS-IS Update related packets\n")
965 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
966 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
971 DEFUN (no_debug_isis_upd
,
972 no_debug_isis_upd_cmd
,
973 "no debug " PROTO_NAME
" update-packets",
977 "IS-IS Update related packets\n")
979 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
980 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
985 DEFUN (debug_isis_spfevents
,
986 debug_isis_spfevents_cmd
,
987 "debug " PROTO_NAME
" spf-events",
990 "IS-IS Shortest Path First Events\n")
992 isis
->debugs
|= DEBUG_SPF_EVENTS
;
993 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
998 DEFUN (no_debug_isis_spfevents
,
999 no_debug_isis_spfevents_cmd
,
1000 "no debug " PROTO_NAME
" spf-events",
1004 "IS-IS Shortest Path First Events\n")
1006 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1007 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1012 DEFUN (debug_isis_rtevents
,
1013 debug_isis_rtevents_cmd
,
1014 "debug " PROTO_NAME
" route-events",
1017 "IS-IS Route related events\n")
1019 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1020 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1025 DEFUN (no_debug_isis_rtevents
,
1026 no_debug_isis_rtevents_cmd
,
1027 "no debug " PROTO_NAME
" route-events",
1031 "IS-IS Route related events\n")
1033 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1034 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1039 DEFUN (debug_isis_events
,
1040 debug_isis_events_cmd
,
1041 "debug " PROTO_NAME
" events",
1046 isis
->debugs
|= DEBUG_EVENTS
;
1047 print_debug(vty
, DEBUG_EVENTS
, 1);
1052 DEFUN (no_debug_isis_events
,
1053 no_debug_isis_events_cmd
,
1054 "no debug " PROTO_NAME
" events",
1060 isis
->debugs
&= ~DEBUG_EVENTS
;
1061 print_debug(vty
, DEBUG_EVENTS
, 0);
1066 DEFUN (debug_isis_packet_dump
,
1067 debug_isis_packet_dump_cmd
,
1068 "debug " PROTO_NAME
" packet-dump",
1071 "IS-IS packet dump\n")
1073 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1074 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1079 DEFUN (no_debug_isis_packet_dump
,
1080 no_debug_isis_packet_dump_cmd
,
1081 "no debug " PROTO_NAME
" packet-dump",
1085 "IS-IS packet dump\n")
1087 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1088 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1093 DEFUN (debug_isis_lsp_gen
,
1094 debug_isis_lsp_gen_cmd
,
1095 "debug " PROTO_NAME
" lsp-gen",
1098 "IS-IS generation of own LSPs\n")
1100 isis
->debugs
|= DEBUG_LSP_GEN
;
1101 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1106 DEFUN (no_debug_isis_lsp_gen
,
1107 no_debug_isis_lsp_gen_cmd
,
1108 "no debug " PROTO_NAME
" lsp-gen",
1112 "IS-IS generation of own LSPs\n")
1114 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1115 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1120 DEFUN (debug_isis_lsp_sched
,
1121 debug_isis_lsp_sched_cmd
,
1122 "debug " PROTO_NAME
" lsp-sched",
1125 "IS-IS scheduling of LSP generation\n")
1127 isis
->debugs
|= DEBUG_LSP_SCHED
;
1128 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1133 DEFUN (no_debug_isis_lsp_sched
,
1134 no_debug_isis_lsp_sched_cmd
,
1135 "no debug " PROTO_NAME
" lsp-sched",
1139 "IS-IS scheduling of LSP generation\n")
1141 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1142 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1147 DEFUN (debug_isis_bfd
,
1149 "debug " PROTO_NAME
" bfd",
1152 PROTO_NAME
" interaction with BFD\n")
1154 isis
->debugs
|= DEBUG_BFD
;
1155 print_debug(vty
, DEBUG_BFD
, 1);
1160 DEFUN (no_debug_isis_bfd
,
1161 no_debug_isis_bfd_cmd
,
1162 "no debug " PROTO_NAME
" bfd",
1166 PROTO_NAME
" interaction with BFD\n")
1168 isis
->debugs
&= ~DEBUG_BFD
;
1169 print_debug(vty
, DEBUG_BFD
, 0);
1174 DEFUN (show_hostname
,
1176 "show " PROTO_NAME
" hostname",
1179 "IS-IS Dynamic hostname mapping\n")
1181 dynhn_print_all(vty
);
1186 DEFUN (show_isis_spf_ietf
,
1187 show_isis_spf_ietf_cmd
,
1188 "show " PROTO_NAME
" spf-delay-ietf",
1191 "SPF delay IETF information\n")
1194 vty_out(vty
, "ISIS is not running\n");
1198 struct listnode
*node
;
1199 struct isis_area
*area
;
1201 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1202 vty_out(vty
, "Area %s:\n",
1203 area
->area_tag
? area
->area_tag
: "null");
1205 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1206 if ((area
->is_type
& level
) == 0)
1209 vty_out(vty
, " Level-%d:\n", level
);
1210 vty_out(vty
, " SPF delay status: ");
1211 if (area
->spf_timer
[level
- 1]) {
1212 struct timeval remain
= thread_timer_remain(
1213 area
->spf_timer
[level
- 1]);
1214 vty_out(vty
, "Pending, due in %lld msec\n",
1215 (long long)remain
.tv_sec
* 1000
1216 + remain
.tv_usec
/ 1000);
1218 vty_out(vty
, "Not scheduled\n");
1221 if (area
->spf_delay_ietf
[level
- 1]) {
1223 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1225 area
->spf_delay_ietf
[level
- 1], vty
,
1228 vty_out(vty
, " Using legacy backoff algo\n");
1235 DEFUN (show_isis_summary
,
1236 show_isis_summary_cmd
,
1237 "show " PROTO_NAME
" summary",
1238 SHOW_STR PROTO_HELP
"summary\n")
1240 struct listnode
*node
, *node2
;
1241 struct isis_area
*area
;
1245 vty_out(vty
, PROTO_NAME
" is not running\n");
1249 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1250 if (isis
->sysid_set
)
1251 vty_out(vty
, "System Id : %s\n",
1252 sysid_print(isis
->sysid
));
1254 vty_out(vty
, "Up time : ");
1255 vty_out_timestr(vty
, isis
->uptime
);
1258 if (isis
->area_list
)
1259 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1261 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1262 vty_out(vty
, "Area %s:\n",
1263 area
->area_tag
? area
->area_tag
: "null");
1266 uint8_t tier
= fabricd_tier(area
);
1267 if (tier
== ISIS_TIER_UNDEFINED
)
1268 vty_out(vty
, " Tier: undefined\n");
1270 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1273 if (listcount(area
->area_addrs
) > 0) {
1274 struct area_addr
*area_addr
;
1275 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1277 vty_out(vty
, " Net: %s\n",
1278 isonet_print(area_addr
->area_addr
,
1285 vty_out(vty
, " TX counters per PDU type:\n");
1286 pdu_counter_print(vty
, " ", area
->pdu_tx_counters
);
1287 vty_out(vty
, " LSP RXMT: %" PRIu64
"\n",
1288 area
->lsp_rxmt_count
);
1289 vty_out(vty
, " RX counters per PDU type:\n");
1290 pdu_counter_print(vty
, " ", area
->pdu_rx_counters
);
1292 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1293 if ((area
->is_type
& level
) == 0)
1296 vty_out(vty
, " Level-%d:\n", level
);
1298 vty_out(vty
, " LSP0 regenerated: %" PRIu64
"\n",
1299 area
->lsp_gen_count
[level
- 1]);
1301 vty_out(vty
, " LSPs purged: %" PRIu64
"\n",
1302 area
->lsp_purge_count
[level
- 1]);
1304 if (area
->spf_timer
[level
- 1])
1305 vty_out(vty
, " SPF: (pending)\n");
1307 vty_out(vty
, " SPF:\n");
1309 vty_out(vty
, " minimum interval : %d",
1310 area
->min_spf_interval
[level
- 1]);
1311 if (area
->spf_delay_ietf
[level
- 1])
1313 " (not used, IETF SPF delay activated)");
1316 vty_out(vty
, " IPv4 route computation:\n");
1317 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1320 vty_out(vty
, " IPv6 route computation:\n");
1321 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1324 vty_out(vty
, " IPv6 dst-src route computation:\n");
1325 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1334 struct isis_lsp
*lsp_for_arg(struct lspdb_head
*head
, const char *argv
)
1336 char sysid
[255] = {0};
1339 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2] = {0};
1340 struct isis_dynhn
*dynhn
;
1341 struct isis_lsp
*lsp
= NULL
;
1347 * extract fragment and pseudo id from the string argv
1349 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1350 * (b) <systemid/hostname>.<pseudo-id> or
1351 * (c) <systemid/hostname> or
1352 * Where systemid is in the form:
1356 strlcpy(sysid
, argv
, sizeof(sysid
));
1357 if (argv
&& strlen(argv
) > 3) {
1358 pos
= argv
+ strlen(argv
) - 3;
1359 if (strncmp(pos
, "-", 1) == 0) {
1360 memcpy(number
, ++pos
, 2);
1361 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1362 (uint8_t)strtol((char *)number
, NULL
, 16);
1364 if (strncmp(pos
, ".", 1) != 0)
1367 if (strncmp(pos
, ".", 1) == 0) {
1368 memcpy(number
, ++pos
, 2);
1369 lspid
[ISIS_SYS_ID_LEN
] =
1370 (uint8_t)strtol((char *)number
, NULL
, 16);
1371 sysid
[pos
- argv
- 1] = '\0';
1376 * Try to find the lsp-id if the argv
1379 * hostname.<pseudo-id>-<fragment>
1381 if (sysid2buff(lspid
, sysid
)) {
1382 lsp
= lsp_search(head
, lspid
);
1383 } else if ((dynhn
= dynhn_find_by_name(sysid
))) {
1384 memcpy(lspid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
1385 lsp
= lsp_search(head
, lspid
);
1386 } else if (strncmp(cmd_hostname_get(), sysid
, 15) == 0) {
1387 memcpy(lspid
, isis
->sysid
, ISIS_SYS_ID_LEN
);
1388 lsp
= lsp_search(head
, lspid
);
1395 * This function supports following display options:
1396 * [ show isis database [detail] ]
1397 * [ show isis database <sysid> [detail] ]
1398 * [ show isis database <hostname> [detail] ]
1399 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1400 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1401 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1402 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1403 * [ show isis database detail <sysid> ]
1404 * [ show isis database detail <hostname> ]
1405 * [ show isis database detail <sysid>.<pseudo-id> ]
1406 * [ show isis database detail <hostname>.<pseudo-id> ]
1407 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1408 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1410 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1412 struct listnode
*node
;
1413 struct isis_area
*area
;
1414 struct isis_lsp
*lsp
;
1415 int level
, lsp_count
;
1417 if (isis
->area_list
->count
== 0)
1420 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1421 vty_out(vty
, "Area %s:\n",
1422 area
->area_tag
? area
->area_tag
: "null");
1424 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1425 if (lspdb_count(&area
->lspdb
[level
]) > 0) {
1426 lsp
= lsp_for_arg(&area
->lspdb
[level
], argv
);
1428 if (lsp
!= NULL
|| argv
== NULL
) {
1430 "IS-IS Level-%d link-state database:\n",
1433 /* print the title in all cases */
1435 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1439 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1446 } else if (argv
== NULL
) {
1447 lsp_count
= lsp_print_all(
1448 vty
, &area
->lspdb
[level
],
1449 ui_level
, area
->dynhostname
);
1451 vty_out(vty
, " %u LSPs\n\n",
1461 DEFUN (show_database
,
1463 "show " PROTO_NAME
" database [detail] [WORD]",
1466 "Link state database\n"
1467 "Detailed information\n"
1471 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1472 ? ISIS_UI_LEVEL_DETAIL
1473 : ISIS_UI_LEVEL_BRIEF
;
1474 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1475 return show_isis_database(vty
, id
, uilevel
);
1480 * 'router openfabric' command
1482 DEFUN_NOSH (router_openfabric
,
1483 router_openfabric_cmd
,
1484 "router openfabric WORD",
1487 "ISO Routing area tag\n")
1490 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1494 *'no router openfabric' command
1496 DEFUN (no_router_openfabric
,
1497 no_router_openfabric_cmd
,
1498 "no router openfabric WORD",
1502 "ISO Routing area tag\n")
1505 return isis_area_destroy(argv
[idx_word
]->arg
);
1507 #endif /* ifdef FABRICD */
1515 "A Network Entity Title for this process (OSI only)\n"
1516 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1519 return area_net_title(vty
, argv
[idx_word
]->arg
);
1529 "A Network Entity Title for this process (OSI only)\n"
1530 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1533 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1535 #endif /* ifdef FABRICD */
1537 DEFUN (isis_topology
,
1539 "topology " ISIS_MT_NAMES
" [overload]",
1540 "Configure IS-IS topologies\n"
1541 ISIS_MT_DESCRIPTIONS
1542 "Set overload bit for topology\n")
1544 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1546 const char *arg
= argv
[1]->arg
;
1547 uint16_t mtid
= isis_str2mtid(arg
);
1549 if (area
->oldmetric
) {
1551 "Multi topology IS-IS can only be used with wide metrics\n");
1552 return CMD_WARNING_CONFIG_FAILED
;
1555 if (mtid
== (uint16_t)-1) {
1556 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1557 return CMD_WARNING_CONFIG_FAILED
;
1559 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1560 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1561 return CMD_WARNING_CONFIG_FAILED
;
1564 area_set_mt_enabled(area
, mtid
, true);
1565 area_set_mt_overload(area
, mtid
, (argc
== 3));
1569 DEFUN (no_isis_topology
,
1570 no_isis_topology_cmd
,
1571 "no topology " ISIS_MT_NAMES
" [overload]",
1573 "Configure IS-IS topologies\n"
1574 ISIS_MT_DESCRIPTIONS
1575 "Set overload bit for topology\n")
1577 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1579 const char *arg
= argv
[2]->arg
;
1580 uint16_t mtid
= isis_str2mtid(arg
);
1582 if (area
->oldmetric
) {
1584 "Multi topology IS-IS can only be used with wide metrics\n");
1585 return CMD_WARNING_CONFIG_FAILED
;
1588 if (mtid
== (uint16_t)-1) {
1589 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1590 return CMD_WARNING_CONFIG_FAILED
;
1592 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1593 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1594 return CMD_WARNING_CONFIG_FAILED
;
1597 area_set_mt_enabled(area
, mtid
, false);
1598 area_set_mt_overload(area
, mtid
, false);
1601 #endif /* ifdef FABRICD */
1603 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1605 area
->lsp_mtu
= lsp_mtu
;
1606 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1609 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1610 uint8_t passwd_type
, const char *passwd
,
1613 struct isis_passwd
*dest
;
1614 struct isis_passwd modified
;
1617 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1618 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1619 : &area
->domain_passwd
;
1620 memset(&modified
, 0, sizeof(modified
));
1622 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1626 len
= strlen(passwd
);
1631 strlcpy((char *)modified
.passwd
, passwd
,
1632 sizeof(modified
.passwd
));
1633 modified
.type
= passwd_type
;
1634 modified
.snp_auth
= snp_auth
;
1637 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1638 memcpy(dest
, &modified
, sizeof(modified
));
1639 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1645 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1647 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1651 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1652 const char *passwd
, uint8_t snp_auth
)
1654 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1658 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1659 const char *passwd
, uint8_t snp_auth
)
1661 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1665 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1667 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1668 if (!(level
& levels
))
1670 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1671 isis_spf_invalidate_routes(
1672 area
->spftree
[tree
][level
- 1]);
1677 void isis_area_verify_routes(struct isis_area
*area
)
1679 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1680 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1683 static void area_resign_level(struct isis_area
*area
, int level
)
1685 isis_area_invalidate_routes(area
, level
);
1686 isis_area_verify_routes(area
);
1688 lsp_db_fini(&area
->lspdb
[level
- 1]);
1690 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1691 if (area
->spftree
[tree
][level
- 1]) {
1692 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1693 area
->spftree
[tree
][level
- 1] = NULL
;
1697 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1700 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1701 area
->area_tag
, level
);
1702 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1703 area
->lsp_regenerate_pending
[level
- 1] = 0;
1706 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1708 struct listnode
*node
;
1709 struct isis_circuit
*circuit
;
1711 if (isis
->debugs
& DEBUG_EVENTS
)
1712 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1713 area
->area_tag
, circuit_t2string(area
->is_type
),
1714 circuit_t2string(is_type
));
1716 if (area
->is_type
== is_type
)
1717 return; /* No change */
1719 switch (area
->is_type
) {
1721 if (is_type
== IS_LEVEL_2
)
1722 area_resign_level(area
, IS_LEVEL_1
);
1724 lsp_db_init(&area
->lspdb
[1]);
1727 case IS_LEVEL_1_AND_2
:
1728 if (is_type
== IS_LEVEL_1
)
1729 area_resign_level(area
, IS_LEVEL_2
);
1731 area_resign_level(area
, IS_LEVEL_1
);
1735 if (is_type
== IS_LEVEL_1
)
1736 area_resign_level(area
, IS_LEVEL_2
);
1738 lsp_db_init(&area
->lspdb
[0]);
1745 area
->is_type
= is_type
;
1747 /* override circuit's is_type */
1748 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1749 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1750 isis_circuit_is_type_set(circuit
, is_type
);
1753 spftree_area_init(area
);
1755 if (listcount(area
->area_addrs
) > 0) {
1756 if (is_type
& IS_LEVEL_1
)
1757 lsp_generate(area
, IS_LEVEL_1
);
1758 if (is_type
& IS_LEVEL_2
)
1759 lsp_generate(area
, IS_LEVEL_2
);
1761 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1766 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1769 area
->oldmetric
= old_metric
;
1770 area
->newmetric
= new_metric
;
1771 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1774 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1776 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1778 if (new_overload_bit
!= area
->overload_bit
) {
1779 area
->overload_bit
= new_overload_bit
;
1780 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1783 isis_notif_db_overload(area
, overload_bit
);
1784 #endif /* ifndef FABRICD */
1787 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1789 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1791 if (new_attached_bit
!= area
->attached_bit
) {
1792 area
->attached_bit
= new_attached_bit
;
1793 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1797 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1799 if (area
->dynhostname
!= dynhostname
) {
1800 area
->dynhostname
= dynhostname
;
1801 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1805 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1806 uint16_t max_lsp_lifetime
)
1808 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1810 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1813 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1814 lsp_regenerate_schedule(area
, level
, 1);
1817 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1818 uint16_t lsp_refresh
)
1820 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1822 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1825 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1826 lsp_regenerate_schedule(area
, level
, 1);
1830 DEFUN (log_adj_changes
,
1831 log_adj_changes_cmd
,
1832 "log-adjacency-changes",
1833 "Log changes in adjacency state\n")
1835 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1837 area
->log_adj_changes
= 1;
1842 DEFUN (no_log_adj_changes
,
1843 no_log_adj_changes_cmd
,
1844 "no log-adjacency-changes",
1846 "Stop logging changes in adjacency state\n")
1848 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1850 area
->log_adj_changes
= 0;
1854 #endif /* ifdef FABRICD */
1856 /* IS-IS configuration write function */
1857 int isis_config_write(struct vty
*vty
)
1862 struct isis_area
*area
;
1863 struct listnode
*node
, *node2
;
1865 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1866 /* ISIS - Area name */
1867 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1870 if (listcount(area
->area_addrs
) > 0) {
1871 struct area_addr
*area_addr
;
1872 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1873 node2
, area_addr
)) {
1874 vty_out(vty
, " net %s\n",
1876 area_addr
->area_addr
,
1883 /* ISIS - Dynamic hostname - Defaults to true so only
1886 if (!area
->dynhostname
) {
1887 vty_out(vty
, " no hostname dynamic\n");
1890 /* ISIS - Metric-Style - when true displays wide */
1892 if (area
->newmetric
) {
1893 if (!area
->oldmetric
)
1894 vty_out(vty
, " metric-style wide\n");
1897 " metric-style transition\n");
1900 vty_out(vty
, " metric-style narrow\n");
1904 /* ISIS - overload-bit */
1905 if (area
->overload_bit
) {
1906 vty_out(vty
, " set-overload-bit\n");
1909 /* ISIS - Area is-type (level-1-2 is default) */
1911 if (area
->is_type
== IS_LEVEL_1
) {
1912 vty_out(vty
, " is-type level-1\n");
1914 } else if (area
->is_type
== IS_LEVEL_2
) {
1915 vty_out(vty
, " is-type level-2-only\n");
1919 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1920 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1921 /* ISIS - Lsp generation interval */
1922 if (area
->lsp_gen_interval
[0]
1923 == area
->lsp_gen_interval
[1]) {
1924 if (area
->lsp_gen_interval
[0]
1925 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1926 vty_out(vty
, " lsp-gen-interval %d\n",
1927 area
->lsp_gen_interval
[0]);
1931 if (area
->lsp_gen_interval
[0]
1932 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1934 " lsp-gen-interval level-1 %d\n",
1935 area
->lsp_gen_interval
[0]);
1938 if (area
->lsp_gen_interval
[1]
1939 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1941 " lsp-gen-interval level-2 %d\n",
1942 area
->lsp_gen_interval
[1]);
1946 /* ISIS - LSP lifetime */
1947 if (area
->max_lsp_lifetime
[0]
1948 == area
->max_lsp_lifetime
[1]) {
1949 if (area
->max_lsp_lifetime
[0]
1950 != DEFAULT_LSP_LIFETIME
) {
1951 vty_out(vty
, " max-lsp-lifetime %u\n",
1952 area
->max_lsp_lifetime
[0]);
1956 if (area
->max_lsp_lifetime
[0]
1957 != DEFAULT_LSP_LIFETIME
) {
1959 " max-lsp-lifetime level-1 %u\n",
1960 area
->max_lsp_lifetime
[0]);
1963 if (area
->max_lsp_lifetime
[1]
1964 != DEFAULT_LSP_LIFETIME
) {
1966 " max-lsp-lifetime level-2 %u\n",
1967 area
->max_lsp_lifetime
[1]);
1971 /* ISIS - LSP refresh interval */
1972 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1973 if (area
->lsp_refresh
[0]
1974 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1976 " lsp-refresh-interval %u\n",
1977 area
->lsp_refresh
[0]);
1981 if (area
->lsp_refresh
[0]
1982 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1984 " lsp-refresh-interval level-1 %u\n",
1985 area
->lsp_refresh
[0]);
1988 if (area
->lsp_refresh
[1]
1989 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1991 " lsp-refresh-interval level-2 %u\n",
1992 area
->lsp_refresh
[1]);
1996 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
1997 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
2000 if (area
->purge_originator
) {
2001 vty_out(vty
, " purge-originator\n");
2005 /* Minimum SPF interval. */
2006 if (area
->min_spf_interval
[0]
2007 == area
->min_spf_interval
[1]) {
2008 if (area
->min_spf_interval
[0]
2009 != MINIMUM_SPF_INTERVAL
) {
2010 vty_out(vty
, " spf-interval %d\n",
2011 area
->min_spf_interval
[0]);
2015 if (area
->min_spf_interval
[0]
2016 != MINIMUM_SPF_INTERVAL
) {
2018 " spf-interval level-1 %d\n",
2019 area
->min_spf_interval
[0]);
2022 if (area
->min_spf_interval
[1]
2023 != MINIMUM_SPF_INTERVAL
) {
2025 " spf-interval level-2 %d\n",
2026 area
->min_spf_interval
[1]);
2031 /* IETF SPF interval */
2032 if (area
->spf_delay_ietf
[0]) {
2034 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2035 spf_backoff_init_delay(
2036 area
->spf_delay_ietf
[0]),
2037 spf_backoff_short_delay(
2038 area
->spf_delay_ietf
[0]),
2039 spf_backoff_long_delay(
2040 area
->spf_delay_ietf
[0]),
2041 spf_backoff_holddown(
2042 area
->spf_delay_ietf
[0]),
2043 spf_backoff_timetolearn(
2044 area
->spf_delay_ietf
[0]));
2048 /* Authentication passwords. */
2049 if (area
->area_passwd
.type
2050 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2051 vty_out(vty
, " area-password md5 %s",
2052 area
->area_passwd
.passwd
);
2053 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2055 vty_out(vty
, " authenticate snp ");
2057 area
->area_passwd
.snp_auth
,
2059 vty_out(vty
, "validate");
2061 vty_out(vty
, "send-only");
2065 } else if (area
->area_passwd
.type
2066 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2067 vty_out(vty
, " area-password clear %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");
2082 if (area
->domain_passwd
.type
2083 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2084 vty_out(vty
, " domain-password md5 %s",
2085 area
->domain_passwd
.passwd
);
2086 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2088 vty_out(vty
, " authenticate snp ");
2089 if (CHECK_FLAG(area
->domain_passwd
2092 vty_out(vty
, "validate");
2094 vty_out(vty
, "send-only");
2098 } else if (area
->domain_passwd
.type
2099 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2100 vty_out(vty
, " domain-password clear %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");
2116 if (area
->log_adj_changes
) {
2117 vty_out(vty
, " log-adjacency-changes\n");
2121 write
+= area_write_mt_settings(area
, vty
);
2122 write
+= fabricd_write_settings(area
, vty
);
2130 /* IS-IS configuration write function */
2131 int isis_config_write(struct vty
*vty
)
2134 struct lyd_node
*dnode
;
2136 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-isisd:isis");
2138 nb_cli_show_dnode_cmds(vty
, dnode
, false);
2144 #endif /* ifdef FABRICD */
2146 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2148 void isis_init(void)
2150 /* Install IS-IS top node */
2151 install_node(&router_node
, isis_config_write
);
2153 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2155 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2157 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2158 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2159 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2161 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2162 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2163 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2164 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2165 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2167 install_element(VIEW_NODE
, &show_hostname_cmd
);
2168 install_element(VIEW_NODE
, &show_database_cmd
);
2170 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2172 install_node(&debug_node
, config_write_debug
);
2174 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2175 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2176 install_element(ENABLE_NODE
, &debug_isis_tx_queue_cmd
);
2177 install_element(ENABLE_NODE
, &no_debug_isis_tx_queue_cmd
);
2178 install_element(ENABLE_NODE
, &debug_isis_flooding_cmd
);
2179 install_element(ENABLE_NODE
, &no_debug_isis_flooding_cmd
);
2180 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2181 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2182 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2183 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2184 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2185 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2186 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2187 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2188 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2189 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2190 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2191 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2192 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2193 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2194 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2195 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2196 install_element(ENABLE_NODE
, &debug_isis_bfd_cmd
);
2197 install_element(ENABLE_NODE
, &no_debug_isis_bfd_cmd
);
2199 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2200 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2201 install_element(CONFIG_NODE
, &debug_isis_tx_queue_cmd
);
2202 install_element(CONFIG_NODE
, &no_debug_isis_tx_queue_cmd
);
2203 install_element(CONFIG_NODE
, &debug_isis_flooding_cmd
);
2204 install_element(CONFIG_NODE
, &no_debug_isis_flooding_cmd
);
2205 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2206 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2207 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2208 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2209 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2210 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2211 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2212 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2213 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2214 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2215 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2216 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2217 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2218 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2219 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2220 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2221 install_element(CONFIG_NODE
, &debug_isis_bfd_cmd
);
2222 install_element(CONFIG_NODE
, &no_debug_isis_bfd_cmd
);
2224 install_default(ROUTER_NODE
);
2227 install_element(CONFIG_NODE
, &router_openfabric_cmd
);
2228 install_element(CONFIG_NODE
, &no_router_openfabric_cmd
);
2230 install_element(ROUTER_NODE
, &net_cmd
);
2231 install_element(ROUTER_NODE
, &no_net_cmd
);
2233 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2234 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2236 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2237 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2238 #endif /* ifdef FABRICD */
2240 spf_backoff_cmd_init();