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; */
102 struct isis_area
*isis_area_create(const char *area_tag
)
104 struct isis_area
*area
;
106 area
= XCALLOC(MTYPE_ISIS_AREA
, sizeof(struct isis_area
));
109 * Fabricd runs only as level-2.
110 * For IS-IS, the first instance is level-1-2 rest are level-1,
111 * unless otherwise configured
114 area
->is_type
= IS_LEVEL_2
;
115 } else if (listcount(isis
->area_list
) == 0)
116 area
->is_type
= IS_LEVEL_1_AND_2
;
118 area
->is_type
= yang_get_default_enum(
119 "/frr-isisd:isis/instance/is-type");
122 * intialize the databases
124 if (area
->is_type
& IS_LEVEL_1
) {
125 area
->lspdb
[0] = lsp_db_init();
127 if (area
->is_type
& IS_LEVEL_2
) {
128 area
->lspdb
[1] = lsp_db_init();
131 spftree_area_init(area
);
133 area
->circuit_list
= list_new();
134 area
->area_addrs
= list_new();
135 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
136 flags_initialize(&area
->flags
);
142 enum isis_metric_style default_style
;
144 area
->max_lsp_lifetime
[0] = yang_get_default_uint16(
145 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-1");
146 area
->max_lsp_lifetime
[1] = yang_get_default_uint16(
147 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-2");
148 area
->lsp_refresh
[0] = yang_get_default_uint16(
149 "/frr-isisd:isis/instance/lsp/refresh-interval/level-1");
150 area
->lsp_refresh
[1] = yang_get_default_uint16(
151 "/frr-isisd:isis/instance/lsp/refresh-interval/level-2");
152 area
->lsp_gen_interval
[0] = yang_get_default_uint16(
153 "/frr-isisd:isis/instance/lsp/generation-interval/level-1");
154 area
->lsp_gen_interval
[1] = yang_get_default_uint16(
155 "/frr-isisd:isis/instance/lsp/generation-interval/level-2");
156 area
->min_spf_interval
[0] = yang_get_default_uint16(
157 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
158 area
->min_spf_interval
[1] = yang_get_default_uint16(
159 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
160 area
->dynhostname
= yang_get_default_bool(
161 "/frr-isisd:isis/instance/dynamic-hostname");
163 yang_get_default_enum("/frr-isisd:isis/instance/metric-style");
164 area
->oldmetric
= default_style
== ISIS_WIDE_METRIC
? 0 : 1;
165 area
->newmetric
= default_style
== ISIS_NARROW_METRIC
? 0 : 1;
166 area
->lsp_frag_threshold
= 90; /* not currently configurable */
168 yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu");
170 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
171 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
172 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
173 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
174 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
175 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
176 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
177 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
178 area
->dynhostname
= 1;
181 area
->lsp_frag_threshold
= 90;
182 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
183 #endif /* ifndef FABRICD */
187 area
->area_tag
= strdup(area_tag
);
188 listnode_add(isis
->area_list
, area
);
192 area
->fabricd
= fabricd_new(area
);
194 area
->lsp_refresh_arg
[0].area
= area
;
195 area
->lsp_refresh_arg
[0].level
= IS_LEVEL_1
;
196 area
->lsp_refresh_arg
[1].area
= area
;
197 area
->lsp_refresh_arg
[1].level
= IS_LEVEL_2
;
200 QOBJ_REG(area
, isis_area
);
205 struct isis_area
*isis_area_lookup(const char *area_tag
)
207 struct isis_area
*area
;
208 struct listnode
*node
;
210 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
211 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
212 || (area
->area_tag
&& area_tag
213 && strcmp(area
->area_tag
, area_tag
) == 0))
219 int isis_area_get(struct vty
*vty
, const char *area_tag
)
221 struct isis_area
*area
;
223 area
= isis_area_lookup(area_tag
);
226 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
230 area
= isis_area_create(area_tag
);
232 if (isis
->debugs
& DEBUG_EVENTS
)
233 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
235 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
240 int isis_area_destroy(const char *area_tag
)
242 struct isis_area
*area
;
243 struct listnode
*node
, *nnode
;
244 struct isis_circuit
*circuit
;
245 struct area_addr
*addr
;
247 area
= isis_area_lookup(area_tag
);
250 zlog_warn("%s: could not find area with area-tag %s",
252 return CMD_ERR_NO_MATCH
;
258 fabricd_finish(area
->fabricd
);
260 /* Disable MPLS if necessary before flooding LSP */
261 if (IS_MPLS_TE(area
->mta
))
262 area
->mta
->status
= disable
;
264 if (area
->circuit_list
) {
265 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
267 circuit
->ip_router
= 0;
268 circuit
->ipv6_router
= 0;
269 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
271 list_delete(&area
->circuit_list
);
274 if (area
->lspdb
[0] != NULL
) {
275 lsp_db_destroy(area
->lspdb
[0]);
276 area
->lspdb
[0] = NULL
;
278 if (area
->lspdb
[1] != NULL
) {
279 lsp_db_destroy(area
->lspdb
[1]);
280 area
->lspdb
[1] = NULL
;
283 /* invalidate and verify to delete all routes from zebra */
284 isis_area_invalidate_routes(area
, ISIS_LEVEL1
& ISIS_LEVEL2
);
285 isis_area_verify_routes(area
);
287 spftree_area_del(area
);
289 THREAD_TIMER_OFF(area
->spf_timer
[0]);
290 THREAD_TIMER_OFF(area
->spf_timer
[1]);
292 spf_backoff_free(area
->spf_delay_ietf
[0]);
293 spf_backoff_free(area
->spf_delay_ietf
[1]);
295 isis_redist_area_finish(area
);
297 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
298 list_delete_node(area
->area_addrs
, node
);
299 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
301 area
->area_addrs
= NULL
;
303 THREAD_TIMER_OFF(area
->t_tick
);
304 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
305 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
307 thread_cancel_event(master
, area
);
309 listnode_delete(isis
->area_list
, area
);
311 free(area
->area_tag
);
313 area_mt_finish(area
);
315 XFREE(MTYPE_ISIS_AREA
, area
);
317 if (listcount(isis
->area_list
) == 0) {
318 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
326 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
329 struct isis_area_mt_setting
*setting
;
331 setting
= area_get_mt_setting(area
, mtid
);
332 if (setting
->enabled
!= enabled
) {
333 setting
->enabled
= enabled
;
334 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
338 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
341 struct isis_area_mt_setting
*setting
;
343 setting
= area_get_mt_setting(area
, mtid
);
344 if (setting
->overload
!= overload
) {
345 setting
->overload
= overload
;
346 if (setting
->enabled
)
347 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
351 #endif /* ifdef FABRICD */
353 int area_net_title(struct vty
*vty
, const char *net_title
)
355 VTY_DECLVAR_CONTEXT(isis_area
, area
);
356 struct area_addr
*addr
;
357 struct area_addr
*addrp
;
358 struct listnode
*node
;
362 /* We check that we are not over the maximal number of addresses */
363 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
365 "Maximum of area addresses (%d) already reached \n",
366 isis
->max_area_addrs
);
367 return CMD_ERR_NOTHING_TODO
;
370 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
371 addr
->addr_len
= dotformat2buff(buff
, net_title
);
372 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
374 zlog_debug("added area address %s for area %s (address length %d)",
375 net_title
, area
->area_tag
, addr
->addr_len
);
376 #endif /* EXTREME_DEBUG */
377 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
379 "area address must be at least 8..20 octets long (%d)\n",
381 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
382 return CMD_WARNING_CONFIG_FAILED
;
385 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
387 "nsel byte (last byte) in area address must be 0\n");
388 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
389 return CMD_WARNING_CONFIG_FAILED
;
392 if (isis
->sysid_set
== 0) {
394 * First area address - get the SystemID for this router
396 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
398 if (isis
->debugs
& DEBUG_EVENTS
)
399 zlog_debug("Router has SystemID %s",
400 sysid_print(isis
->sysid
));
403 * Check that the SystemID portions match
405 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
407 "System ID must not change when defining additional area addresses\n");
408 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
409 return CMD_WARNING_CONFIG_FAILED
;
412 /* now we see that we don't already have this address */
413 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
414 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
417 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
419 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
420 return CMD_SUCCESS
; /* silent fail */
426 * Forget the systemID part of the address
428 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
429 listnode_add(area
->area_addrs
, addr
);
431 /* only now we can safely generate our LSPs for this area */
432 if (listcount(area
->area_addrs
) > 0) {
433 if (area
->is_type
& IS_LEVEL_1
)
434 lsp_generate(area
, IS_LEVEL_1
);
435 if (area
->is_type
& IS_LEVEL_2
)
436 lsp_generate(area
, IS_LEVEL_2
);
442 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
444 VTY_DECLVAR_CONTEXT(isis_area
, area
);
445 struct area_addr addr
, *addrp
= NULL
;
446 struct listnode
*node
;
449 addr
.addr_len
= dotformat2buff(buff
, net_title
);
450 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
452 "Unsupported area address length %d, should be 8...20 \n",
454 return CMD_WARNING_CONFIG_FAILED
;
457 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
459 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
460 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
461 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
465 vty_out(vty
, "No area address %s for area %s \n", net_title
,
467 return CMD_ERR_NO_MATCH
;
470 listnode_delete(area
->area_addrs
, addrp
);
471 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
474 * Last area address - reset the SystemID for this router
476 if (listcount(area
->area_addrs
) == 0) {
477 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
479 if (isis
->debugs
& DEBUG_EVENTS
)
480 zlog_debug("Router has no SystemID");
487 * 'show isis interface' command
490 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
492 struct listnode
*anode
, *cnode
;
493 struct isis_area
*area
;
494 struct isis_circuit
*circuit
;
497 vty_out(vty
, "IS-IS Routing Process not enabled\n");
501 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
502 vty_out(vty
, "Area %s:\n", area
->area_tag
);
504 if (detail
== ISIS_UI_LEVEL_BRIEF
)
506 " Interface CircId State Type Level\n");
508 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
510 isis_circuit_print_vty(circuit
, vty
, detail
);
511 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
512 isis_circuit_print_vty(circuit
, vty
, detail
);
518 DEFUN (show_isis_interface
,
519 show_isis_interface_cmd
,
520 "show " PROTO_NAME
" interface",
525 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
528 DEFUN (show_isis_interface_detail
,
529 show_isis_interface_detail_cmd
,
530 "show " PROTO_NAME
" interface detail",
534 "show detailed information\n")
536 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
539 DEFUN (show_isis_interface_arg
,
540 show_isis_interface_arg_cmd
,
541 "show " PROTO_NAME
" interface WORD",
545 "ISIS interface name\n")
548 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
549 ISIS_UI_LEVEL_DETAIL
);
553 * 'show isis neighbor' command
556 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
558 struct listnode
*anode
, *cnode
, *node
;
559 struct isis_area
*area
;
560 struct isis_circuit
*circuit
;
562 struct isis_adjacency
*adj
;
563 struct isis_dynhn
*dynhn
;
564 uint8_t sysid
[ISIS_SYS_ID_LEN
];
568 vty_out(vty
, "IS-IS Routing Process not enabled\n");
572 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
574 if (sysid2buff(sysid
, id
) == 0) {
575 dynhn
= dynhn_find_by_name(id
);
577 vty_out(vty
, "Invalid system id %s\n", id
);
580 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
584 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
585 vty_out(vty
, "Area %s:\n", area
->area_tag
);
587 if (detail
== ISIS_UI_LEVEL_BRIEF
)
589 " System Id Interface L State Holdtime SNPA\n");
591 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
592 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
593 for (i
= 0; i
< 2; i
++) {
594 adjdb
= circuit
->u
.bc
.adjdb
[i
];
595 if (adjdb
&& adjdb
->count
) {
596 for (ALL_LIST_ELEMENTS_RO(
599 || !memcmp(adj
->sysid
,
608 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
609 && circuit
->u
.p2p
.neighbor
) {
610 adj
= circuit
->u
.p2p
.neighbor
;
612 || !memcmp(adj
->sysid
, sysid
,
614 isis_adj_print_vty(adj
, vty
, detail
);
623 * 'clear isis neighbor' command
625 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
627 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
628 struct isis_area
*area
;
629 struct isis_circuit
*circuit
;
631 struct isis_adjacency
*adj
;
632 struct isis_dynhn
*dynhn
;
633 uint8_t sysid
[ISIS_SYS_ID_LEN
];
637 vty_out(vty
, "IS-IS Routing Process not enabled\n");
641 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
643 if (sysid2buff(sysid
, id
) == 0) {
644 dynhn
= dynhn_find_by_name(id
);
646 vty_out(vty
, "Invalid system id %s\n", id
);
649 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
653 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
654 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
656 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
657 for (i
= 0; i
< 2; i
++) {
658 adjdb
= circuit
->u
.bc
.adjdb
[i
];
659 if (adjdb
&& adjdb
->count
) {
660 for (ALL_LIST_ELEMENTS(
664 || !memcmp(adj
->sysid
,
667 isis_adj_state_change(
670 "clear user request");
673 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
674 && circuit
->u
.p2p
.neighbor
) {
675 adj
= circuit
->u
.p2p
.neighbor
;
677 || !memcmp(adj
->sysid
, sysid
,
679 isis_adj_state_change(
681 "clear user request");
689 DEFUN (show_isis_neighbor
,
690 show_isis_neighbor_cmd
,
691 "show " PROTO_NAME
" neighbor",
694 "ISIS neighbor adjacencies\n")
696 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
699 DEFUN (show_isis_neighbor_detail
,
700 show_isis_neighbor_detail_cmd
,
701 "show " PROTO_NAME
" neighbor detail",
704 "ISIS neighbor adjacencies\n"
705 "show detailed information\n")
707 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
710 DEFUN (show_isis_neighbor_arg
,
711 show_isis_neighbor_arg_cmd
,
712 "show " PROTO_NAME
" neighbor WORD",
715 "ISIS neighbor adjacencies\n"
719 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
720 ISIS_UI_LEVEL_DETAIL
);
723 DEFUN (clear_isis_neighbor
,
724 clear_isis_neighbor_cmd
,
725 "clear " PROTO_NAME
" neighbor",
728 "ISIS neighbor adjacencies\n")
730 return clear_isis_neighbor_common(vty
, NULL
);
733 DEFUN (clear_isis_neighbor_arg
,
734 clear_isis_neighbor_arg_cmd
,
735 "clear " PROTO_NAME
" neighbor WORD",
738 "ISIS neighbor adjacencies\n"
742 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
746 * 'isis debug', 'show debugging'
748 void print_debug(struct vty
*vty
, int flags
, int onoff
)
752 strcpy(onoffs
, "on");
754 strcpy(onoffs
, "off");
756 if (flags
& DEBUG_ADJ_PACKETS
)
758 "IS-IS Adjacency related packets debugging is %s\n",
760 if (flags
& DEBUG_TX_QUEUE
)
761 vty_out(vty
, "IS-IS TX queue debugging is %s\n",
763 if (flags
& DEBUG_SNP_PACKETS
)
764 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
766 if (flags
& DEBUG_SPF_EVENTS
)
767 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
768 if (flags
& DEBUG_UPDATE_PACKETS
)
769 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
771 if (flags
& DEBUG_RTE_EVENTS
)
772 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
773 if (flags
& DEBUG_EVENTS
)
774 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
775 if (flags
& DEBUG_PACKET_DUMP
)
776 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
777 if (flags
& DEBUG_LSP_GEN
)
778 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
779 if (flags
& DEBUG_LSP_SCHED
)
780 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
781 if (flags
& DEBUG_FLOODING
)
782 vty_out(vty
, "IS-IS Flooding debugging is %s\n", onoffs
);
783 if (flags
& DEBUG_BFD
)
784 vty_out(vty
, "IS-IS BFD debugging is %s\n", onoffs
);
787 DEFUN_NOSH (show_debugging
,
788 show_debugging_isis_cmd
,
789 "show debugging [" PROTO_NAME
"]",
791 "State of each debugging option\n"
794 vty_out(vty
, PROTO_NAME
" debugging status:\n");
797 print_debug(vty
, isis
->debugs
, 1);
803 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
805 static int config_write_debug(struct vty
*vty
)
808 int flags
= isis
->debugs
;
810 if (flags
& DEBUG_ADJ_PACKETS
) {
811 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
814 if (flags
& DEBUG_TX_QUEUE
) {
815 vty_out(vty
, "debug " PROTO_NAME
" tx-queue\n");
818 if (flags
& DEBUG_SNP_PACKETS
) {
819 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
822 if (flags
& DEBUG_SPF_EVENTS
) {
823 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
826 if (flags
& DEBUG_UPDATE_PACKETS
) {
827 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
830 if (flags
& DEBUG_RTE_EVENTS
) {
831 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
834 if (flags
& DEBUG_EVENTS
) {
835 vty_out(vty
, "debug " PROTO_NAME
" events\n");
838 if (flags
& DEBUG_PACKET_DUMP
) {
839 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
842 if (flags
& DEBUG_LSP_GEN
) {
843 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
846 if (flags
& DEBUG_LSP_SCHED
) {
847 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
850 if (flags
& DEBUG_FLOODING
) {
851 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
854 if (flags
& DEBUG_BFD
) {
855 vty_out(vty
, "debug " PROTO_NAME
" bfd\n");
858 write
+= spf_backoff_write_config(vty
);
863 DEFUN (debug_isis_adj
,
865 "debug " PROTO_NAME
" adj-packets",
868 "IS-IS Adjacency related packets\n")
870 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
871 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
876 DEFUN (no_debug_isis_adj
,
877 no_debug_isis_adj_cmd
,
878 "no debug " PROTO_NAME
" adj-packets",
882 "IS-IS Adjacency related packets\n")
884 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
885 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
890 DEFUN (debug_isis_tx_queue
,
891 debug_isis_tx_queue_cmd
,
892 "debug " PROTO_NAME
" tx-queue",
897 isis
->debugs
|= DEBUG_TX_QUEUE
;
898 print_debug(vty
, DEBUG_TX_QUEUE
, 1);
903 DEFUN (no_debug_isis_tx_queue
,
904 no_debug_isis_tx_queue_cmd
,
905 "no debug " PROTO_NAME
" tx-queue",
911 isis
->debugs
&= ~DEBUG_TX_QUEUE
;
912 print_debug(vty
, DEBUG_TX_QUEUE
, 0);
917 DEFUN (debug_isis_flooding
,
918 debug_isis_flooding_cmd
,
919 "debug " PROTO_NAME
" flooding",
922 "Flooding algorithm\n")
924 isis
->debugs
|= DEBUG_FLOODING
;
925 print_debug(vty
, DEBUG_FLOODING
, 1);
930 DEFUN (no_debug_isis_flooding
,
931 no_debug_isis_flooding_cmd
,
932 "no debug " PROTO_NAME
" flooding",
936 "Flooding algorithm\n")
938 isis
->debugs
&= ~DEBUG_FLOODING
;
939 print_debug(vty
, DEBUG_FLOODING
, 0);
944 DEFUN (debug_isis_snp
,
946 "debug " PROTO_NAME
" snp-packets",
949 "IS-IS CSNP/PSNP packets\n")
951 isis
->debugs
|= DEBUG_SNP_PACKETS
;
952 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
957 DEFUN (no_debug_isis_snp
,
958 no_debug_isis_snp_cmd
,
959 "no debug " PROTO_NAME
" snp-packets",
963 "IS-IS CSNP/PSNP packets\n")
965 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
966 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
971 DEFUN (debug_isis_upd
,
973 "debug " PROTO_NAME
" update-packets",
976 "IS-IS Update related packets\n")
978 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
979 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
984 DEFUN (no_debug_isis_upd
,
985 no_debug_isis_upd_cmd
,
986 "no debug " PROTO_NAME
" update-packets",
990 "IS-IS Update related packets\n")
992 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
993 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
998 DEFUN (debug_isis_spfevents
,
999 debug_isis_spfevents_cmd
,
1000 "debug " PROTO_NAME
" spf-events",
1003 "IS-IS Shortest Path First Events\n")
1005 isis
->debugs
|= DEBUG_SPF_EVENTS
;
1006 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
1011 DEFUN (no_debug_isis_spfevents
,
1012 no_debug_isis_spfevents_cmd
,
1013 "no debug " PROTO_NAME
" spf-events",
1017 "IS-IS Shortest Path First Events\n")
1019 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1020 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1025 DEFUN (debug_isis_rtevents
,
1026 debug_isis_rtevents_cmd
,
1027 "debug " PROTO_NAME
" route-events",
1030 "IS-IS Route related events\n")
1032 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1033 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1038 DEFUN (no_debug_isis_rtevents
,
1039 no_debug_isis_rtevents_cmd
,
1040 "no debug " PROTO_NAME
" route-events",
1044 "IS-IS Route related events\n")
1046 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1047 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1052 DEFUN (debug_isis_events
,
1053 debug_isis_events_cmd
,
1054 "debug " PROTO_NAME
" events",
1059 isis
->debugs
|= DEBUG_EVENTS
;
1060 print_debug(vty
, DEBUG_EVENTS
, 1);
1065 DEFUN (no_debug_isis_events
,
1066 no_debug_isis_events_cmd
,
1067 "no debug " PROTO_NAME
" events",
1073 isis
->debugs
&= ~DEBUG_EVENTS
;
1074 print_debug(vty
, DEBUG_EVENTS
, 0);
1079 DEFUN (debug_isis_packet_dump
,
1080 debug_isis_packet_dump_cmd
,
1081 "debug " PROTO_NAME
" packet-dump",
1084 "IS-IS packet dump\n")
1086 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1087 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1092 DEFUN (no_debug_isis_packet_dump
,
1093 no_debug_isis_packet_dump_cmd
,
1094 "no debug " PROTO_NAME
" packet-dump",
1098 "IS-IS packet dump\n")
1100 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1101 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1106 DEFUN (debug_isis_lsp_gen
,
1107 debug_isis_lsp_gen_cmd
,
1108 "debug " PROTO_NAME
" lsp-gen",
1111 "IS-IS generation of own LSPs\n")
1113 isis
->debugs
|= DEBUG_LSP_GEN
;
1114 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1119 DEFUN (no_debug_isis_lsp_gen
,
1120 no_debug_isis_lsp_gen_cmd
,
1121 "no debug " PROTO_NAME
" lsp-gen",
1125 "IS-IS generation of own LSPs\n")
1127 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1128 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1133 DEFUN (debug_isis_lsp_sched
,
1134 debug_isis_lsp_sched_cmd
,
1135 "debug " PROTO_NAME
" lsp-sched",
1138 "IS-IS scheduling of LSP generation\n")
1140 isis
->debugs
|= DEBUG_LSP_SCHED
;
1141 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1146 DEFUN (no_debug_isis_lsp_sched
,
1147 no_debug_isis_lsp_sched_cmd
,
1148 "no debug " PROTO_NAME
" lsp-sched",
1152 "IS-IS scheduling of LSP generation\n")
1154 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1155 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1160 DEFUN (debug_isis_bfd
,
1162 "debug " PROTO_NAME
" bfd",
1165 PROTO_NAME
" interaction with BFD\n")
1167 isis
->debugs
|= DEBUG_BFD
;
1168 print_debug(vty
, DEBUG_BFD
, 1);
1173 DEFUN (no_debug_isis_bfd
,
1174 no_debug_isis_bfd_cmd
,
1175 "no debug " PROTO_NAME
" bfd",
1179 PROTO_NAME
" interaction with BFD\n")
1181 isis
->debugs
&= ~DEBUG_BFD
;
1182 print_debug(vty
, DEBUG_BFD
, 0);
1187 DEFUN (show_hostname
,
1189 "show " PROTO_NAME
" hostname",
1192 "IS-IS Dynamic hostname mapping\n")
1194 dynhn_print_all(vty
);
1199 DEFUN (show_isis_spf_ietf
,
1200 show_isis_spf_ietf_cmd
,
1201 "show " PROTO_NAME
" spf-delay-ietf",
1204 "SPF delay IETF information\n")
1207 vty_out(vty
, "ISIS is not running\n");
1211 struct listnode
*node
;
1212 struct isis_area
*area
;
1214 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1215 vty_out(vty
, "Area %s:\n",
1216 area
->area_tag
? area
->area_tag
: "null");
1218 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1219 if ((area
->is_type
& level
) == 0)
1222 vty_out(vty
, " Level-%d:\n", level
);
1223 vty_out(vty
, " SPF delay status: ");
1224 if (area
->spf_timer
[level
- 1]) {
1225 struct timeval remain
= thread_timer_remain(
1226 area
->spf_timer
[level
- 1]);
1227 vty_out(vty
, "Pending, due in %lld msec\n",
1228 (long long)remain
.tv_sec
* 1000
1229 + remain
.tv_usec
/ 1000);
1231 vty_out(vty
, "Not scheduled\n");
1234 if (area
->spf_delay_ietf
[level
- 1]) {
1236 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1238 area
->spf_delay_ietf
[level
- 1], vty
,
1241 vty_out(vty
, " Using legacy backoff algo\n");
1248 DEFUN (show_isis_summary
,
1249 show_isis_summary_cmd
,
1250 "show " PROTO_NAME
" summary",
1251 SHOW_STR PROTO_HELP
"summary\n")
1253 struct listnode
*node
, *node2
;
1254 struct isis_area
*area
;
1258 vty_out(vty
, PROTO_NAME
" is not running\n");
1262 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1263 if (isis
->sysid_set
)
1264 vty_out(vty
, "System Id : %s\n",
1265 sysid_print(isis
->sysid
));
1267 vty_out(vty
, "Up time : ");
1268 vty_out_timestr(vty
, isis
->uptime
);
1271 if (isis
->area_list
)
1272 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1274 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1275 vty_out(vty
, "Area %s:\n",
1276 area
->area_tag
? area
->area_tag
: "null");
1279 uint8_t tier
= fabricd_tier(area
);
1280 if (tier
== ISIS_TIER_UNDEFINED
)
1281 vty_out(vty
, " Tier: undefined\n");
1283 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1286 if (listcount(area
->area_addrs
) > 0) {
1287 struct area_addr
*area_addr
;
1288 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1290 vty_out(vty
, " Net: %s\n",
1291 isonet_print(area_addr
->area_addr
,
1298 vty_out(vty
, " TX counters per PDU type:\n");
1299 pdu_counter_print(vty
, " ", area
->pdu_tx_counters
);
1300 vty_out(vty
, " LSP RXMT: %" PRIu64
"\n",
1301 area
->lsp_rxmt_count
);
1302 vty_out(vty
, " RX counters per PDU type:\n");
1303 pdu_counter_print(vty
, " ", area
->pdu_rx_counters
);
1305 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1306 if ((area
->is_type
& level
) == 0)
1309 vty_out(vty
, " Level-%d:\n", level
);
1311 vty_out(vty
, " LSP0 regenerated: %" PRIu64
"\n",
1312 area
->lsp_gen_count
[level
- 1]);
1314 vty_out(vty
, " LSPs purged: %" PRIu64
"\n",
1315 area
->lsp_purge_count
[level
- 1]);
1317 if (area
->spf_timer
[level
- 1])
1318 vty_out(vty
, " SPF: (pending)\n");
1320 vty_out(vty
, " SPF:\n");
1322 vty_out(vty
, " minimum interval : %d",
1323 area
->min_spf_interval
[level
- 1]);
1324 if (area
->spf_delay_ietf
[level
- 1])
1326 " (not used, IETF SPF delay activated)");
1329 vty_out(vty
, " IPv4 route computation:\n");
1330 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1333 vty_out(vty
, " IPv6 route computation:\n");
1334 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1337 vty_out(vty
, " IPv6 dst-src route computation:\n");
1338 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1347 struct isis_lsp
*lsp_for_arg(const char *argv
, dict_t
*lspdb
)
1349 char sysid
[255] = {0};
1352 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2] = {0};
1353 struct isis_dynhn
*dynhn
;
1354 struct isis_lsp
*lsp
= NULL
;
1360 * extract fragment and pseudo id from the string argv
1362 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1363 * (b) <systemid/hostname>.<pseudo-id> or
1364 * (c) <systemid/hostname> or
1365 * Where systemid is in the form:
1369 strlcpy(sysid
, argv
, sizeof(sysid
));
1370 if (argv
&& strlen(argv
) > 3) {
1371 pos
= argv
+ strlen(argv
) - 3;
1372 if (strncmp(pos
, "-", 1) == 0) {
1373 memcpy(number
, ++pos
, 2);
1374 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1375 (uint8_t)strtol((char *)number
, NULL
, 16);
1377 if (strncmp(pos
, ".", 1) != 0)
1380 if (strncmp(pos
, ".", 1) == 0) {
1381 memcpy(number
, ++pos
, 2);
1382 lspid
[ISIS_SYS_ID_LEN
] =
1383 (uint8_t)strtol((char *)number
, NULL
, 16);
1384 sysid
[pos
- argv
- 1] = '\0';
1389 * Try to find the lsp-id if the argv
1392 * hostname.<pseudo-id>-<fragment>
1394 if (sysid2buff(lspid
, sysid
)) {
1395 lsp
= lsp_search(lspid
, lspdb
);
1396 } else if ((dynhn
= dynhn_find_by_name(sysid
))) {
1397 memcpy(lspid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
1398 lsp
= lsp_search(lspid
, lspdb
);
1399 } else if (strncmp(cmd_hostname_get(), sysid
, 15) == 0) {
1400 memcpy(lspid
, isis
->sysid
, ISIS_SYS_ID_LEN
);
1401 lsp
= lsp_search(lspid
, lspdb
);
1408 * This function supports following display options:
1409 * [ show isis database [detail] ]
1410 * [ show isis database <sysid> [detail] ]
1411 * [ show isis database <hostname> [detail] ]
1412 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1413 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1414 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1415 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1416 * [ show isis database detail <sysid> ]
1417 * [ show isis database detail <hostname> ]
1418 * [ show isis database detail <sysid>.<pseudo-id> ]
1419 * [ show isis database detail <hostname>.<pseudo-id> ]
1420 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1421 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1423 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1425 struct listnode
*node
;
1426 struct isis_area
*area
;
1427 struct isis_lsp
*lsp
;
1428 int level
, lsp_count
;
1430 if (isis
->area_list
->count
== 0)
1433 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1434 vty_out(vty
, "Area %s:\n",
1435 area
->area_tag
? area
->area_tag
: "null");
1437 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1438 if (area
->lspdb
[level
]
1439 && dict_count(area
->lspdb
[level
]) > 0) {
1440 lsp
= lsp_for_arg(argv
, area
->lspdb
[level
]);
1442 if (lsp
!= NULL
|| argv
== NULL
) {
1444 "IS-IS Level-%d link-state database:\n",
1447 /* print the title in all cases */
1449 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1453 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1460 } else if (argv
== NULL
) {
1461 lsp_count
= lsp_print_all(
1462 vty
, area
->lspdb
[level
],
1463 ui_level
, area
->dynhostname
);
1465 vty_out(vty
, " %u LSPs\n\n",
1475 DEFUN (show_database
,
1477 "show " PROTO_NAME
" database [detail] [WORD]",
1480 "Link state database\n"
1481 "Detailed information\n"
1485 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1486 ? ISIS_UI_LEVEL_DETAIL
1487 : ISIS_UI_LEVEL_BRIEF
;
1488 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1489 return show_isis_database(vty
, id
, uilevel
);
1494 * 'router openfabric' command
1496 DEFUN_NOSH (router_openfabric
,
1497 router_openfabric_cmd
,
1498 "router openfabric WORD",
1501 "ISO Routing area tag\n")
1504 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1508 *'no router openfabric' command
1510 DEFUN (no_router_openfabric
,
1511 no_router_openfabric_cmd
,
1512 "no router openfabric WORD",
1516 "ISO Routing area tag\n")
1519 return isis_area_destroy(argv
[idx_word
]->arg
);
1521 #endif /* ifdef FABRICD */
1529 "A Network Entity Title for this process (OSI only)\n"
1530 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1533 return area_net_title(vty
, argv
[idx_word
]->arg
);
1543 "A Network Entity Title for this process (OSI only)\n"
1544 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1547 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1549 #endif /* ifdef FABRICD */
1551 DEFUN (isis_topology
,
1553 "topology " ISIS_MT_NAMES
" [overload]",
1554 "Configure IS-IS topologies\n"
1555 ISIS_MT_DESCRIPTIONS
1556 "Set overload bit for topology\n")
1558 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1560 const char *arg
= argv
[1]->arg
;
1561 uint16_t mtid
= isis_str2mtid(arg
);
1563 if (area
->oldmetric
) {
1565 "Multi topology IS-IS can only be used with wide metrics\n");
1566 return CMD_WARNING_CONFIG_FAILED
;
1569 if (mtid
== (uint16_t)-1) {
1570 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1571 return CMD_WARNING_CONFIG_FAILED
;
1573 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1574 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1575 return CMD_WARNING_CONFIG_FAILED
;
1578 area_set_mt_enabled(area
, mtid
, true);
1579 area_set_mt_overload(area
, mtid
, (argc
== 3));
1583 DEFUN (no_isis_topology
,
1584 no_isis_topology_cmd
,
1585 "no topology " ISIS_MT_NAMES
" [overload]",
1587 "Configure IS-IS topologies\n"
1588 ISIS_MT_DESCRIPTIONS
1589 "Set overload bit for topology\n")
1591 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1593 const char *arg
= argv
[2]->arg
;
1594 uint16_t mtid
= isis_str2mtid(arg
);
1596 if (area
->oldmetric
) {
1598 "Multi topology IS-IS can only be used with wide metrics\n");
1599 return CMD_WARNING_CONFIG_FAILED
;
1602 if (mtid
== (uint16_t)-1) {
1603 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1604 return CMD_WARNING_CONFIG_FAILED
;
1606 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1607 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1608 return CMD_WARNING_CONFIG_FAILED
;
1611 area_set_mt_enabled(area
, mtid
, false);
1612 area_set_mt_overload(area
, mtid
, false);
1615 #endif /* ifdef FABRICD */
1617 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1619 area
->lsp_mtu
= lsp_mtu
;
1620 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1623 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1624 uint8_t passwd_type
, const char *passwd
,
1627 struct isis_passwd
*dest
;
1628 struct isis_passwd modified
;
1631 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1632 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1633 : &area
->domain_passwd
;
1634 memset(&modified
, 0, sizeof(modified
));
1636 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1640 len
= strlen(passwd
);
1645 strlcpy((char *)modified
.passwd
, passwd
,
1646 sizeof(modified
.passwd
));
1647 modified
.type
= passwd_type
;
1648 modified
.snp_auth
= snp_auth
;
1651 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1652 memcpy(dest
, &modified
, sizeof(modified
));
1653 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1659 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1661 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1665 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1666 const char *passwd
, uint8_t snp_auth
)
1668 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1672 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1673 const char *passwd
, uint8_t snp_auth
)
1675 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1679 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1681 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1682 if (!(level
& levels
))
1684 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1685 isis_spf_invalidate_routes(
1686 area
->spftree
[tree
][level
- 1]);
1691 void isis_area_verify_routes(struct isis_area
*area
)
1693 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1694 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1697 static void area_resign_level(struct isis_area
*area
, int level
)
1699 isis_area_invalidate_routes(area
, level
);
1700 isis_area_verify_routes(area
);
1702 if (area
->lspdb
[level
- 1]) {
1703 lsp_db_destroy(area
->lspdb
[level
- 1]);
1704 area
->lspdb
[level
- 1] = NULL
;
1707 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1708 if (area
->spftree
[tree
][level
- 1]) {
1709 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1710 area
->spftree
[tree
][level
- 1] = NULL
;
1714 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1717 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1718 area
->area_tag
, level
);
1719 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1720 area
->lsp_regenerate_pending
[level
- 1] = 0;
1723 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1725 struct listnode
*node
;
1726 struct isis_circuit
*circuit
;
1728 if (isis
->debugs
& DEBUG_EVENTS
)
1729 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1730 area
->area_tag
, circuit_t2string(area
->is_type
),
1731 circuit_t2string(is_type
));
1733 if (area
->is_type
== is_type
)
1734 return; /* No change */
1736 switch (area
->is_type
) {
1738 if (is_type
== IS_LEVEL_2
)
1739 area_resign_level(area
, IS_LEVEL_1
);
1741 if (area
->lspdb
[1] == NULL
)
1742 area
->lspdb
[1] = lsp_db_init();
1745 case IS_LEVEL_1_AND_2
:
1746 if (is_type
== IS_LEVEL_1
)
1747 area_resign_level(area
, IS_LEVEL_2
);
1749 area_resign_level(area
, IS_LEVEL_1
);
1753 if (is_type
== IS_LEVEL_1
)
1754 area_resign_level(area
, IS_LEVEL_2
);
1756 if (area
->lspdb
[0] == NULL
)
1757 area
->lspdb
[0] = lsp_db_init();
1764 area
->is_type
= is_type
;
1766 /* override circuit's is_type */
1767 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1768 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1769 isis_circuit_is_type_set(circuit
, is_type
);
1772 spftree_area_init(area
);
1774 if (listcount(area
->area_addrs
) > 0) {
1775 if (is_type
& IS_LEVEL_1
)
1776 lsp_generate(area
, IS_LEVEL_1
);
1777 if (is_type
& IS_LEVEL_2
)
1778 lsp_generate(area
, IS_LEVEL_2
);
1780 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1785 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1788 area
->oldmetric
= old_metric
;
1789 area
->newmetric
= new_metric
;
1790 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1793 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1795 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1797 if (new_overload_bit
!= area
->overload_bit
) {
1798 area
->overload_bit
= new_overload_bit
;
1799 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1802 isis_notif_db_overload(area
, overload_bit
);
1803 #endif /* ifndef FABRICD */
1806 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1808 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1810 if (new_attached_bit
!= area
->attached_bit
) {
1811 area
->attached_bit
= new_attached_bit
;
1812 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1816 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1818 if (area
->dynhostname
!= dynhostname
) {
1819 area
->dynhostname
= dynhostname
;
1820 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1824 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1825 uint16_t max_lsp_lifetime
)
1827 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1829 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1832 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1833 lsp_regenerate_schedule(area
, level
, 1);
1836 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1837 uint16_t lsp_refresh
)
1839 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1841 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1844 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1845 lsp_regenerate_schedule(area
, level
, 1);
1849 DEFUN (log_adj_changes
,
1850 log_adj_changes_cmd
,
1851 "log-adjacency-changes",
1852 "Log changes in adjacency state\n")
1854 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1856 area
->log_adj_changes
= 1;
1861 DEFUN (no_log_adj_changes
,
1862 no_log_adj_changes_cmd
,
1863 "no log-adjacency-changes",
1865 "Stop logging changes in adjacency state\n")
1867 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1869 area
->log_adj_changes
= 0;
1873 #endif /* ifdef FABRICD */
1875 /* IS-IS configuration write function */
1876 int isis_config_write(struct vty
*vty
)
1881 struct isis_area
*area
;
1882 struct listnode
*node
, *node2
;
1884 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1885 /* ISIS - Area name */
1886 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1889 if (listcount(area
->area_addrs
) > 0) {
1890 struct area_addr
*area_addr
;
1891 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1892 node2
, area_addr
)) {
1893 vty_out(vty
, " net %s\n",
1895 area_addr
->area_addr
,
1902 /* ISIS - Dynamic hostname - Defaults to true so only
1905 if (!area
->dynhostname
) {
1906 vty_out(vty
, " no hostname dynamic\n");
1909 /* ISIS - Metric-Style - when true displays wide */
1911 if (area
->newmetric
) {
1912 if (!area
->oldmetric
)
1913 vty_out(vty
, " metric-style wide\n");
1916 " metric-style transition\n");
1919 vty_out(vty
, " metric-style narrow\n");
1923 /* ISIS - overload-bit */
1924 if (area
->overload_bit
) {
1925 vty_out(vty
, " set-overload-bit\n");
1928 /* ISIS - Area is-type (level-1-2 is default) */
1930 if (area
->is_type
== IS_LEVEL_1
) {
1931 vty_out(vty
, " is-type level-1\n");
1933 } else if (area
->is_type
== IS_LEVEL_2
) {
1934 vty_out(vty
, " is-type level-2-only\n");
1938 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1939 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1940 /* ISIS - Lsp generation interval */
1941 if (area
->lsp_gen_interval
[0]
1942 == area
->lsp_gen_interval
[1]) {
1943 if (area
->lsp_gen_interval
[0]
1944 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1945 vty_out(vty
, " lsp-gen-interval %d\n",
1946 area
->lsp_gen_interval
[0]);
1950 if (area
->lsp_gen_interval
[0]
1951 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1953 " lsp-gen-interval level-1 %d\n",
1954 area
->lsp_gen_interval
[0]);
1957 if (area
->lsp_gen_interval
[1]
1958 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1960 " lsp-gen-interval level-2 %d\n",
1961 area
->lsp_gen_interval
[1]);
1965 /* ISIS - LSP lifetime */
1966 if (area
->max_lsp_lifetime
[0]
1967 == area
->max_lsp_lifetime
[1]) {
1968 if (area
->max_lsp_lifetime
[0]
1969 != DEFAULT_LSP_LIFETIME
) {
1970 vty_out(vty
, " max-lsp-lifetime %u\n",
1971 area
->max_lsp_lifetime
[0]);
1975 if (area
->max_lsp_lifetime
[0]
1976 != DEFAULT_LSP_LIFETIME
) {
1978 " max-lsp-lifetime level-1 %u\n",
1979 area
->max_lsp_lifetime
[0]);
1982 if (area
->max_lsp_lifetime
[1]
1983 != DEFAULT_LSP_LIFETIME
) {
1985 " max-lsp-lifetime level-2 %u\n",
1986 area
->max_lsp_lifetime
[1]);
1990 /* ISIS - LSP refresh interval */
1991 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1992 if (area
->lsp_refresh
[0]
1993 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1995 " lsp-refresh-interval %u\n",
1996 area
->lsp_refresh
[0]);
2000 if (area
->lsp_refresh
[0]
2001 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2003 " lsp-refresh-interval level-1 %u\n",
2004 area
->lsp_refresh
[0]);
2007 if (area
->lsp_refresh
[1]
2008 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
2010 " lsp-refresh-interval level-2 %u\n",
2011 area
->lsp_refresh
[1]);
2015 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
2016 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
2019 if (area
->purge_originator
) {
2020 vty_out(vty
, " purge-originator\n");
2024 /* Minimum SPF interval. */
2025 if (area
->min_spf_interval
[0]
2026 == area
->min_spf_interval
[1]) {
2027 if (area
->min_spf_interval
[0]
2028 != MINIMUM_SPF_INTERVAL
) {
2029 vty_out(vty
, " spf-interval %d\n",
2030 area
->min_spf_interval
[0]);
2034 if (area
->min_spf_interval
[0]
2035 != MINIMUM_SPF_INTERVAL
) {
2037 " spf-interval level-1 %d\n",
2038 area
->min_spf_interval
[0]);
2041 if (area
->min_spf_interval
[1]
2042 != MINIMUM_SPF_INTERVAL
) {
2044 " spf-interval level-2 %d\n",
2045 area
->min_spf_interval
[1]);
2050 /* IETF SPF interval */
2051 if (area
->spf_delay_ietf
[0]) {
2053 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2054 spf_backoff_init_delay(
2055 area
->spf_delay_ietf
[0]),
2056 spf_backoff_short_delay(
2057 area
->spf_delay_ietf
[0]),
2058 spf_backoff_long_delay(
2059 area
->spf_delay_ietf
[0]),
2060 spf_backoff_holddown(
2061 area
->spf_delay_ietf
[0]),
2062 spf_backoff_timetolearn(
2063 area
->spf_delay_ietf
[0]));
2067 /* Authentication passwords. */
2068 if (area
->area_passwd
.type
2069 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2070 vty_out(vty
, " area-password md5 %s",
2071 area
->area_passwd
.passwd
);
2072 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2074 vty_out(vty
, " authenticate snp ");
2076 area
->area_passwd
.snp_auth
,
2078 vty_out(vty
, "validate");
2080 vty_out(vty
, "send-only");
2084 } else if (area
->area_passwd
.type
2085 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2086 vty_out(vty
, " area-password clear %s",
2087 area
->area_passwd
.passwd
);
2088 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2090 vty_out(vty
, " authenticate snp ");
2092 area
->area_passwd
.snp_auth
,
2094 vty_out(vty
, "validate");
2096 vty_out(vty
, "send-only");
2101 if (area
->domain_passwd
.type
2102 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2103 vty_out(vty
, " domain-password md5 %s",
2104 area
->domain_passwd
.passwd
);
2105 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2107 vty_out(vty
, " authenticate snp ");
2108 if (CHECK_FLAG(area
->domain_passwd
2111 vty_out(vty
, "validate");
2113 vty_out(vty
, "send-only");
2117 } else if (area
->domain_passwd
.type
2118 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2119 vty_out(vty
, " domain-password clear %s",
2120 area
->domain_passwd
.passwd
);
2121 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2123 vty_out(vty
, " authenticate snp ");
2124 if (CHECK_FLAG(area
->domain_passwd
2127 vty_out(vty
, "validate");
2129 vty_out(vty
, "send-only");
2135 if (area
->log_adj_changes
) {
2136 vty_out(vty
, " log-adjacency-changes\n");
2140 write
+= area_write_mt_settings(area
, vty
);
2141 write
+= fabricd_write_settings(area
, vty
);
2149 /* IS-IS configuration write function */
2150 int isis_config_write(struct vty
*vty
)
2153 struct lyd_node
*dnode
;
2155 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-isisd:isis");
2157 nb_cli_show_dnode_cmds(vty
, dnode
, false);
2163 #endif /* ifdef FABRICD */
2165 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2167 void isis_init(void)
2169 /* Install IS-IS top node */
2170 install_node(&router_node
, isis_config_write
);
2172 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2174 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2176 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2177 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2178 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2180 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2181 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2182 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2183 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2184 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2186 install_element(VIEW_NODE
, &show_hostname_cmd
);
2187 install_element(VIEW_NODE
, &show_database_cmd
);
2189 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2191 install_node(&debug_node
, config_write_debug
);
2193 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2194 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2195 install_element(ENABLE_NODE
, &debug_isis_tx_queue_cmd
);
2196 install_element(ENABLE_NODE
, &no_debug_isis_tx_queue_cmd
);
2197 install_element(ENABLE_NODE
, &debug_isis_flooding_cmd
);
2198 install_element(ENABLE_NODE
, &no_debug_isis_flooding_cmd
);
2199 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2200 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2201 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2202 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2203 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2204 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2205 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2206 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2207 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2208 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2209 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2210 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2211 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2212 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2213 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2214 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2215 install_element(ENABLE_NODE
, &debug_isis_bfd_cmd
);
2216 install_element(ENABLE_NODE
, &no_debug_isis_bfd_cmd
);
2218 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2219 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2220 install_element(CONFIG_NODE
, &debug_isis_tx_queue_cmd
);
2221 install_element(CONFIG_NODE
, &no_debug_isis_tx_queue_cmd
);
2222 install_element(CONFIG_NODE
, &debug_isis_flooding_cmd
);
2223 install_element(CONFIG_NODE
, &no_debug_isis_flooding_cmd
);
2224 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2225 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2226 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2227 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2228 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2229 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2230 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2231 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2232 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2233 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2234 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2235 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2236 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2237 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2238 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2239 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2240 install_element(CONFIG_NODE
, &debug_isis_bfd_cmd
);
2241 install_element(CONFIG_NODE
, &no_debug_isis_bfd_cmd
);
2243 install_default(ROUTER_NODE
);
2246 install_element(CONFIG_NODE
, &router_openfabric_cmd
);
2247 install_element(CONFIG_NODE
, &no_router_openfabric_cmd
);
2249 install_element(ROUTER_NODE
, &net_cmd
);
2250 install_element(ROUTER_NODE
, &no_net_cmd
);
2252 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2253 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2255 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2256 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2257 #endif /* ifdef FABRICD */
2259 spf_backoff_cmd_init();