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"
60 #include "isisd/isis_nb.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
, vrf_id_t vrf_id
)
81 isis
= XCALLOC(MTYPE_ISIS
, sizeof(struct isis
));
85 isis
->vrf_id
= vrf_id
;
86 isis
->max_area_addrs
= 3;
87 isis
->process_id
= process_id
;
89 isis
->area_list
= list_new();
90 isis
->init_circ_list
= list_new();
91 isis
->uptime
= time(NULL
);
92 isis
->nexthops
= 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 lsp_db_init(&area
->lspdb
[0]);
126 if (area
->is_type
& IS_LEVEL_2
)
127 lsp_db_init(&area
->lspdb
[1]);
129 spftree_area_init(area
);
131 area
->circuit_list
= list_new();
132 area
->area_addrs
= list_new();
133 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
134 flags_initialize(&area
->flags
);
140 enum isis_metric_style default_style
;
142 area
->max_lsp_lifetime
[0] = yang_get_default_uint16(
143 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-1");
144 area
->max_lsp_lifetime
[1] = yang_get_default_uint16(
145 "/frr-isisd:isis/instance/lsp/maximum-lifetime/level-2");
146 area
->lsp_refresh
[0] = yang_get_default_uint16(
147 "/frr-isisd:isis/instance/lsp/refresh-interval/level-1");
148 area
->lsp_refresh
[1] = yang_get_default_uint16(
149 "/frr-isisd:isis/instance/lsp/refresh-interval/level-2");
150 area
->lsp_gen_interval
[0] = yang_get_default_uint16(
151 "/frr-isisd:isis/instance/lsp/generation-interval/level-1");
152 area
->lsp_gen_interval
[1] = yang_get_default_uint16(
153 "/frr-isisd:isis/instance/lsp/generation-interval/level-2");
154 area
->min_spf_interval
[0] = yang_get_default_uint16(
155 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
156 area
->min_spf_interval
[1] = yang_get_default_uint16(
157 "/frr-isisd:isis/instance/spf/minimum-interval/level-1");
158 area
->dynhostname
= yang_get_default_bool(
159 "/frr-isisd:isis/instance/dynamic-hostname");
161 yang_get_default_enum("/frr-isisd:isis/instance/metric-style");
162 area
->oldmetric
= default_style
== ISIS_WIDE_METRIC
? 0 : 1;
163 area
->newmetric
= default_style
== ISIS_NARROW_METRIC
? 0 : 1;
164 area
->lsp_frag_threshold
= 90; /* not currently configurable */
166 yang_get_default_uint16("/frr-isisd:isis/instance/lsp/mtu");
168 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
169 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
170 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
171 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
172 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
173 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
174 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
175 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
176 area
->dynhostname
= 1;
179 area
->lsp_frag_threshold
= 90;
180 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
181 #endif /* ifndef FABRICD */
185 area
->area_tag
= strdup(area_tag
);
186 listnode_add(isis
->area_list
, area
);
190 area
->fabricd
= fabricd_new(area
);
192 area
->lsp_refresh_arg
[0].area
= area
;
193 area
->lsp_refresh_arg
[0].level
= IS_LEVEL_1
;
194 area
->lsp_refresh_arg
[1].area
= area
;
195 area
->lsp_refresh_arg
[1].level
= IS_LEVEL_2
;
198 QOBJ_REG(area
, isis_area
);
203 struct isis_area
*isis_area_lookup(const char *area_tag
)
205 struct isis_area
*area
;
206 struct listnode
*node
;
208 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
209 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
210 || (area
->area_tag
&& area_tag
211 && strcmp(area
->area_tag
, area_tag
) == 0))
217 int isis_area_get(struct vty
*vty
, const char *area_tag
)
219 struct isis_area
*area
;
221 area
= isis_area_lookup(area_tag
);
224 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
228 area
= isis_area_create(area_tag
);
230 if (isis
->debugs
& DEBUG_EVENTS
)
231 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
233 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
238 int isis_area_destroy(const char *area_tag
)
240 struct isis_area
*area
;
241 struct listnode
*node
, *nnode
;
242 struct isis_circuit
*circuit
;
243 struct area_addr
*addr
;
245 area
= isis_area_lookup(area_tag
);
248 zlog_warn("%s: could not find area with area-tag %s",
250 return CMD_ERR_NO_MATCH
;
256 fabricd_finish(area
->fabricd
);
258 /* Disable MPLS if necessary before flooding LSP */
259 if (IS_MPLS_TE(area
->mta
))
260 area
->mta
->status
= disable
;
262 if (area
->circuit_list
) {
263 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
265 circuit
->ip_router
= 0;
266 circuit
->ipv6_router
= 0;
267 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
269 list_delete(&area
->circuit_list
);
272 lsp_db_fini(&area
->lspdb
[0]);
273 lsp_db_fini(&area
->lspdb
[1]);
275 /* invalidate and verify to delete all routes from zebra */
276 isis_area_invalidate_routes(area
, area
->is_type
);
277 isis_area_verify_routes(area
);
279 spftree_area_del(area
);
281 THREAD_TIMER_OFF(area
->spf_timer
[0]);
282 THREAD_TIMER_OFF(area
->spf_timer
[1]);
284 spf_backoff_free(area
->spf_delay_ietf
[0]);
285 spf_backoff_free(area
->spf_delay_ietf
[1]);
287 isis_redist_area_finish(area
);
289 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
290 list_delete_node(area
->area_addrs
, node
);
291 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
293 area
->area_addrs
= NULL
;
295 THREAD_TIMER_OFF(area
->t_tick
);
296 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
297 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
299 thread_cancel_event(master
, area
);
301 listnode_delete(isis
->area_list
, area
);
303 free(area
->area_tag
);
305 area_mt_finish(area
);
307 XFREE(MTYPE_ISIS_AREA
, area
);
309 if (listcount(isis
->area_list
) == 0) {
310 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
318 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
321 struct isis_area_mt_setting
*setting
;
323 setting
= area_get_mt_setting(area
, mtid
);
324 if (setting
->enabled
!= enabled
) {
325 setting
->enabled
= enabled
;
326 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
330 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
333 struct isis_area_mt_setting
*setting
;
335 setting
= area_get_mt_setting(area
, mtid
);
336 if (setting
->overload
!= overload
) {
337 setting
->overload
= overload
;
338 if (setting
->enabled
)
339 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
343 #endif /* ifdef FABRICD */
345 int area_net_title(struct vty
*vty
, const char *net_title
)
347 VTY_DECLVAR_CONTEXT(isis_area
, area
);
348 struct area_addr
*addr
;
349 struct area_addr
*addrp
;
350 struct listnode
*node
;
354 /* We check that we are not over the maximal number of addresses */
355 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
357 "Maximum of area addresses (%d) already reached \n",
358 isis
->max_area_addrs
);
359 return CMD_ERR_NOTHING_TODO
;
362 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
363 addr
->addr_len
= dotformat2buff(buff
, net_title
);
364 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
366 zlog_debug("added area address %s for area %s (address length %d)",
367 net_title
, area
->area_tag
, addr
->addr_len
);
368 #endif /* EXTREME_DEBUG */
369 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
371 "area address must be at least 8..20 octets long (%d)\n",
373 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
374 return CMD_WARNING_CONFIG_FAILED
;
377 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
379 "nsel byte (last byte) in area address must be 0\n");
380 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
381 return CMD_WARNING_CONFIG_FAILED
;
384 if (isis
->sysid_set
== 0) {
386 * First area address - get the SystemID for this router
388 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
390 if (isis
->debugs
& DEBUG_EVENTS
)
391 zlog_debug("Router has SystemID %s",
392 sysid_print(isis
->sysid
));
395 * Check that the SystemID portions match
397 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
399 "System ID must not change when defining additional area addresses\n");
400 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
401 return CMD_WARNING_CONFIG_FAILED
;
404 /* now we see that we don't already have this address */
405 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
406 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
409 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
411 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
412 return CMD_SUCCESS
; /* silent fail */
418 * Forget the systemID part of the address
420 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
421 listnode_add(area
->area_addrs
, addr
);
423 /* only now we can safely generate our LSPs for this area */
424 if (listcount(area
->area_addrs
) > 0) {
425 if (area
->is_type
& IS_LEVEL_1
)
426 lsp_generate(area
, IS_LEVEL_1
);
427 if (area
->is_type
& IS_LEVEL_2
)
428 lsp_generate(area
, IS_LEVEL_2
);
434 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
436 VTY_DECLVAR_CONTEXT(isis_area
, area
);
437 struct area_addr addr
, *addrp
= NULL
;
438 struct listnode
*node
;
441 addr
.addr_len
= dotformat2buff(buff
, net_title
);
442 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
444 "Unsupported area address length %d, should be 8...20 \n",
446 return CMD_WARNING_CONFIG_FAILED
;
449 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
451 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
452 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
453 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
457 vty_out(vty
, "No area address %s for area %s \n", net_title
,
459 return CMD_ERR_NO_MATCH
;
462 listnode_delete(area
->area_addrs
, addrp
);
463 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
466 * Last area address - reset the SystemID for this router
468 if (listcount(area
->area_addrs
) == 0) {
469 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
471 if (isis
->debugs
& DEBUG_EVENTS
)
472 zlog_debug("Router has no SystemID");
479 * 'show isis interface' command
482 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
484 struct listnode
*anode
, *cnode
;
485 struct isis_area
*area
;
486 struct isis_circuit
*circuit
;
489 vty_out(vty
, "IS-IS Routing Process not enabled\n");
493 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
494 vty_out(vty
, "Area %s:\n", area
->area_tag
);
496 if (detail
== ISIS_UI_LEVEL_BRIEF
)
498 " Interface CircId State Type Level\n");
500 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
502 isis_circuit_print_vty(circuit
, vty
, detail
);
503 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
504 isis_circuit_print_vty(circuit
, vty
, detail
);
510 DEFUN (show_isis_interface
,
511 show_isis_interface_cmd
,
512 "show " PROTO_NAME
" interface",
517 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
520 DEFUN (show_isis_interface_detail
,
521 show_isis_interface_detail_cmd
,
522 "show " PROTO_NAME
" interface detail",
526 "show detailed information\n")
528 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
531 DEFUN (show_isis_interface_arg
,
532 show_isis_interface_arg_cmd
,
533 "show " PROTO_NAME
" interface WORD",
537 "ISIS interface name\n")
540 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
541 ISIS_UI_LEVEL_DETAIL
);
545 * 'show isis neighbor' command
548 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
550 struct listnode
*anode
, *cnode
, *node
;
551 struct isis_area
*area
;
552 struct isis_circuit
*circuit
;
554 struct isis_adjacency
*adj
;
555 struct isis_dynhn
*dynhn
;
556 uint8_t sysid
[ISIS_SYS_ID_LEN
];
560 vty_out(vty
, "IS-IS Routing Process not enabled\n");
564 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
566 if (sysid2buff(sysid
, id
) == 0) {
567 dynhn
= dynhn_find_by_name(id
);
569 vty_out(vty
, "Invalid system id %s\n", id
);
572 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
576 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
577 vty_out(vty
, "Area %s:\n", area
->area_tag
);
579 if (detail
== ISIS_UI_LEVEL_BRIEF
)
581 " System Id Interface L State Holdtime SNPA\n");
583 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
584 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
585 for (i
= 0; i
< 2; i
++) {
586 adjdb
= circuit
->u
.bc
.adjdb
[i
];
587 if (adjdb
&& adjdb
->count
) {
588 for (ALL_LIST_ELEMENTS_RO(
591 || !memcmp(adj
->sysid
,
600 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
601 && circuit
->u
.p2p
.neighbor
) {
602 adj
= circuit
->u
.p2p
.neighbor
;
604 || !memcmp(adj
->sysid
, sysid
,
606 isis_adj_print_vty(adj
, vty
, detail
);
615 * 'clear isis neighbor' command
617 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
619 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
620 struct isis_area
*area
;
621 struct isis_circuit
*circuit
;
623 struct isis_adjacency
*adj
;
624 struct isis_dynhn
*dynhn
;
625 uint8_t sysid
[ISIS_SYS_ID_LEN
];
629 vty_out(vty
, "IS-IS Routing Process not enabled\n");
633 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
635 if (sysid2buff(sysid
, id
) == 0) {
636 dynhn
= dynhn_find_by_name(id
);
638 vty_out(vty
, "Invalid system id %s\n", id
);
641 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
645 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
646 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
648 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
649 for (i
= 0; i
< 2; i
++) {
650 adjdb
= circuit
->u
.bc
.adjdb
[i
];
651 if (adjdb
&& adjdb
->count
) {
652 for (ALL_LIST_ELEMENTS(
656 || !memcmp(adj
->sysid
,
659 isis_adj_state_change(
662 "clear user request");
665 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
666 && circuit
->u
.p2p
.neighbor
) {
667 adj
= circuit
->u
.p2p
.neighbor
;
669 || !memcmp(adj
->sysid
, sysid
,
671 isis_adj_state_change(
673 "clear user request");
681 DEFUN (show_isis_neighbor
,
682 show_isis_neighbor_cmd
,
683 "show " PROTO_NAME
" neighbor",
686 "ISIS neighbor adjacencies\n")
688 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
691 DEFUN (show_isis_neighbor_detail
,
692 show_isis_neighbor_detail_cmd
,
693 "show " PROTO_NAME
" neighbor detail",
696 "ISIS neighbor adjacencies\n"
697 "show detailed information\n")
699 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
702 DEFUN (show_isis_neighbor_arg
,
703 show_isis_neighbor_arg_cmd
,
704 "show " PROTO_NAME
" neighbor WORD",
707 "ISIS neighbor adjacencies\n"
711 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
712 ISIS_UI_LEVEL_DETAIL
);
715 DEFUN (clear_isis_neighbor
,
716 clear_isis_neighbor_cmd
,
717 "clear " PROTO_NAME
" neighbor",
720 "ISIS neighbor adjacencies\n")
722 return clear_isis_neighbor_common(vty
, NULL
);
725 DEFUN (clear_isis_neighbor_arg
,
726 clear_isis_neighbor_arg_cmd
,
727 "clear " PROTO_NAME
" neighbor WORD",
730 "ISIS neighbor adjacencies\n"
734 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
738 * 'isis debug', 'show debugging'
740 void print_debug(struct vty
*vty
, int flags
, int onoff
)
742 const char *onoffs
= onoff
? "on" : "off";
744 if (flags
& DEBUG_ADJ_PACKETS
)
746 "IS-IS Adjacency related packets debugging is %s\n",
748 if (flags
& DEBUG_TX_QUEUE
)
749 vty_out(vty
, "IS-IS TX queue debugging is %s\n",
751 if (flags
& DEBUG_SNP_PACKETS
)
752 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
754 if (flags
& DEBUG_SPF_EVENTS
)
755 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
756 if (flags
& DEBUG_UPDATE_PACKETS
)
757 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
759 if (flags
& DEBUG_RTE_EVENTS
)
760 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
761 if (flags
& DEBUG_EVENTS
)
762 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
763 if (flags
& DEBUG_PACKET_DUMP
)
764 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
765 if (flags
& DEBUG_LSP_GEN
)
766 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
767 if (flags
& DEBUG_LSP_SCHED
)
768 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
769 if (flags
& DEBUG_FLOODING
)
770 vty_out(vty
, "IS-IS Flooding debugging is %s\n", onoffs
);
771 if (flags
& DEBUG_BFD
)
772 vty_out(vty
, "IS-IS BFD debugging is %s\n", onoffs
);
775 DEFUN_NOSH (show_debugging
,
776 show_debugging_isis_cmd
,
777 "show debugging [" PROTO_NAME
"]",
779 "State of each debugging option\n"
782 vty_out(vty
, PROTO_NAME
" debugging status:\n");
785 print_debug(vty
, isis
->debugs
, 1);
791 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
793 static int config_write_debug(struct vty
*vty
)
796 int flags
= isis
->debugs
;
798 if (flags
& DEBUG_ADJ_PACKETS
) {
799 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
802 if (flags
& DEBUG_TX_QUEUE
) {
803 vty_out(vty
, "debug " PROTO_NAME
" tx-queue\n");
806 if (flags
& DEBUG_SNP_PACKETS
) {
807 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
810 if (flags
& DEBUG_SPF_EVENTS
) {
811 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
814 if (flags
& DEBUG_UPDATE_PACKETS
) {
815 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
818 if (flags
& DEBUG_RTE_EVENTS
) {
819 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
822 if (flags
& DEBUG_EVENTS
) {
823 vty_out(vty
, "debug " PROTO_NAME
" events\n");
826 if (flags
& DEBUG_PACKET_DUMP
) {
827 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
830 if (flags
& DEBUG_LSP_GEN
) {
831 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
834 if (flags
& DEBUG_LSP_SCHED
) {
835 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
838 if (flags
& DEBUG_FLOODING
) {
839 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
842 if (flags
& DEBUG_BFD
) {
843 vty_out(vty
, "debug " PROTO_NAME
" bfd\n");
846 write
+= spf_backoff_write_config(vty
);
851 DEFUN (debug_isis_adj
,
853 "debug " PROTO_NAME
" adj-packets",
856 "IS-IS Adjacency related packets\n")
858 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
859 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
864 DEFUN (no_debug_isis_adj
,
865 no_debug_isis_adj_cmd
,
866 "no debug " PROTO_NAME
" adj-packets",
870 "IS-IS Adjacency related packets\n")
872 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
873 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
878 DEFUN (debug_isis_tx_queue
,
879 debug_isis_tx_queue_cmd
,
880 "debug " PROTO_NAME
" tx-queue",
885 isis
->debugs
|= DEBUG_TX_QUEUE
;
886 print_debug(vty
, DEBUG_TX_QUEUE
, 1);
891 DEFUN (no_debug_isis_tx_queue
,
892 no_debug_isis_tx_queue_cmd
,
893 "no debug " PROTO_NAME
" tx-queue",
899 isis
->debugs
&= ~DEBUG_TX_QUEUE
;
900 print_debug(vty
, DEBUG_TX_QUEUE
, 0);
905 DEFUN (debug_isis_flooding
,
906 debug_isis_flooding_cmd
,
907 "debug " PROTO_NAME
" flooding",
910 "Flooding algorithm\n")
912 isis
->debugs
|= DEBUG_FLOODING
;
913 print_debug(vty
, DEBUG_FLOODING
, 1);
918 DEFUN (no_debug_isis_flooding
,
919 no_debug_isis_flooding_cmd
,
920 "no debug " PROTO_NAME
" flooding",
924 "Flooding algorithm\n")
926 isis
->debugs
&= ~DEBUG_FLOODING
;
927 print_debug(vty
, DEBUG_FLOODING
, 0);
932 DEFUN (debug_isis_snp
,
934 "debug " PROTO_NAME
" snp-packets",
937 "IS-IS CSNP/PSNP packets\n")
939 isis
->debugs
|= DEBUG_SNP_PACKETS
;
940 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
945 DEFUN (no_debug_isis_snp
,
946 no_debug_isis_snp_cmd
,
947 "no debug " PROTO_NAME
" snp-packets",
951 "IS-IS CSNP/PSNP packets\n")
953 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
954 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
959 DEFUN (debug_isis_upd
,
961 "debug " PROTO_NAME
" update-packets",
964 "IS-IS Update related packets\n")
966 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
967 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
972 DEFUN (no_debug_isis_upd
,
973 no_debug_isis_upd_cmd
,
974 "no debug " PROTO_NAME
" update-packets",
978 "IS-IS Update related packets\n")
980 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
981 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
986 DEFUN (debug_isis_spfevents
,
987 debug_isis_spfevents_cmd
,
988 "debug " PROTO_NAME
" spf-events",
991 "IS-IS Shortest Path First Events\n")
993 isis
->debugs
|= DEBUG_SPF_EVENTS
;
994 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
999 DEFUN (no_debug_isis_spfevents
,
1000 no_debug_isis_spfevents_cmd
,
1001 "no debug " PROTO_NAME
" spf-events",
1005 "IS-IS Shortest Path First Events\n")
1007 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
1008 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
1013 DEFUN (debug_isis_rtevents
,
1014 debug_isis_rtevents_cmd
,
1015 "debug " PROTO_NAME
" route-events",
1018 "IS-IS Route related events\n")
1020 isis
->debugs
|= DEBUG_RTE_EVENTS
;
1021 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1026 DEFUN (no_debug_isis_rtevents
,
1027 no_debug_isis_rtevents_cmd
,
1028 "no debug " PROTO_NAME
" route-events",
1032 "IS-IS Route related events\n")
1034 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1035 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1040 DEFUN (debug_isis_events
,
1041 debug_isis_events_cmd
,
1042 "debug " PROTO_NAME
" events",
1047 isis
->debugs
|= DEBUG_EVENTS
;
1048 print_debug(vty
, DEBUG_EVENTS
, 1);
1053 DEFUN (no_debug_isis_events
,
1054 no_debug_isis_events_cmd
,
1055 "no debug " PROTO_NAME
" events",
1061 isis
->debugs
&= ~DEBUG_EVENTS
;
1062 print_debug(vty
, DEBUG_EVENTS
, 0);
1067 DEFUN (debug_isis_packet_dump
,
1068 debug_isis_packet_dump_cmd
,
1069 "debug " PROTO_NAME
" packet-dump",
1072 "IS-IS packet dump\n")
1074 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1075 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1080 DEFUN (no_debug_isis_packet_dump
,
1081 no_debug_isis_packet_dump_cmd
,
1082 "no debug " PROTO_NAME
" packet-dump",
1086 "IS-IS packet dump\n")
1088 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1089 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1094 DEFUN (debug_isis_lsp_gen
,
1095 debug_isis_lsp_gen_cmd
,
1096 "debug " PROTO_NAME
" lsp-gen",
1099 "IS-IS generation of own LSPs\n")
1101 isis
->debugs
|= DEBUG_LSP_GEN
;
1102 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1107 DEFUN (no_debug_isis_lsp_gen
,
1108 no_debug_isis_lsp_gen_cmd
,
1109 "no debug " PROTO_NAME
" lsp-gen",
1113 "IS-IS generation of own LSPs\n")
1115 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1116 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1121 DEFUN (debug_isis_lsp_sched
,
1122 debug_isis_lsp_sched_cmd
,
1123 "debug " PROTO_NAME
" lsp-sched",
1126 "IS-IS scheduling of LSP generation\n")
1128 isis
->debugs
|= DEBUG_LSP_SCHED
;
1129 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1134 DEFUN (no_debug_isis_lsp_sched
,
1135 no_debug_isis_lsp_sched_cmd
,
1136 "no debug " PROTO_NAME
" lsp-sched",
1140 "IS-IS scheduling of LSP generation\n")
1142 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1143 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1148 DEFUN (debug_isis_bfd
,
1150 "debug " PROTO_NAME
" bfd",
1153 PROTO_NAME
" interaction with BFD\n")
1155 isis
->debugs
|= DEBUG_BFD
;
1156 print_debug(vty
, DEBUG_BFD
, 1);
1161 DEFUN (no_debug_isis_bfd
,
1162 no_debug_isis_bfd_cmd
,
1163 "no debug " PROTO_NAME
" bfd",
1167 PROTO_NAME
" interaction with BFD\n")
1169 isis
->debugs
&= ~DEBUG_BFD
;
1170 print_debug(vty
, DEBUG_BFD
, 0);
1175 DEFUN (show_hostname
,
1177 "show " PROTO_NAME
" hostname",
1180 "IS-IS Dynamic hostname mapping\n")
1182 dynhn_print_all(vty
);
1187 DEFUN (show_isis_spf_ietf
,
1188 show_isis_spf_ietf_cmd
,
1189 "show " PROTO_NAME
" spf-delay-ietf",
1192 "SPF delay IETF information\n")
1195 vty_out(vty
, "ISIS is not running\n");
1199 struct listnode
*node
;
1200 struct isis_area
*area
;
1202 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1203 vty_out(vty
, "Area %s:\n",
1204 area
->area_tag
? area
->area_tag
: "null");
1206 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1207 if ((area
->is_type
& level
) == 0)
1210 vty_out(vty
, " Level-%d:\n", level
);
1211 vty_out(vty
, " SPF delay status: ");
1212 if (area
->spf_timer
[level
- 1]) {
1213 struct timeval remain
= thread_timer_remain(
1214 area
->spf_timer
[level
- 1]);
1215 vty_out(vty
, "Pending, due in %lld msec\n",
1216 (long long)remain
.tv_sec
* 1000
1217 + remain
.tv_usec
/ 1000);
1219 vty_out(vty
, "Not scheduled\n");
1222 if (area
->spf_delay_ietf
[level
- 1]) {
1224 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1226 area
->spf_delay_ietf
[level
- 1], vty
,
1229 vty_out(vty
, " Using legacy backoff algo\n");
1236 DEFUN (show_isis_summary
,
1237 show_isis_summary_cmd
,
1238 "show " PROTO_NAME
" summary",
1239 SHOW_STR PROTO_HELP
"summary\n")
1241 struct listnode
*node
, *node2
;
1242 struct isis_area
*area
;
1246 vty_out(vty
, PROTO_NAME
" is not running\n");
1250 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1251 if (isis
->sysid_set
)
1252 vty_out(vty
, "System Id : %s\n",
1253 sysid_print(isis
->sysid
));
1255 vty_out(vty
, "Up time : ");
1256 vty_out_timestr(vty
, isis
->uptime
);
1259 if (isis
->area_list
)
1260 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1262 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1263 vty_out(vty
, "Area %s:\n",
1264 area
->area_tag
? area
->area_tag
: "null");
1267 uint8_t tier
= fabricd_tier(area
);
1268 if (tier
== ISIS_TIER_UNDEFINED
)
1269 vty_out(vty
, " Tier: undefined\n");
1271 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1274 if (listcount(area
->area_addrs
) > 0) {
1275 struct area_addr
*area_addr
;
1276 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1278 vty_out(vty
, " Net: %s\n",
1279 isonet_print(area_addr
->area_addr
,
1286 vty_out(vty
, " TX counters per PDU type:\n");
1287 pdu_counter_print(vty
, " ", area
->pdu_tx_counters
);
1288 vty_out(vty
, " LSP RXMT: %" PRIu64
"\n",
1289 area
->lsp_rxmt_count
);
1290 vty_out(vty
, " RX counters per PDU type:\n");
1291 pdu_counter_print(vty
, " ", area
->pdu_rx_counters
);
1293 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1294 if ((area
->is_type
& level
) == 0)
1297 vty_out(vty
, " Level-%d:\n", level
);
1299 vty_out(vty
, " LSP0 regenerated: %" PRIu64
"\n",
1300 area
->lsp_gen_count
[level
- 1]);
1302 vty_out(vty
, " LSPs purged: %" PRIu64
"\n",
1303 area
->lsp_purge_count
[level
- 1]);
1305 if (area
->spf_timer
[level
- 1])
1306 vty_out(vty
, " SPF: (pending)\n");
1308 vty_out(vty
, " SPF:\n");
1310 vty_out(vty
, " minimum interval : %d",
1311 area
->min_spf_interval
[level
- 1]);
1312 if (area
->spf_delay_ietf
[level
- 1])
1314 " (not used, IETF SPF delay activated)");
1317 vty_out(vty
, " IPv4 route computation:\n");
1318 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1321 vty_out(vty
, " IPv6 route computation:\n");
1322 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1325 vty_out(vty
, " IPv6 dst-src route computation:\n");
1326 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1335 struct isis_lsp
*lsp_for_arg(struct lspdb_head
*head
, const char *argv
)
1337 char sysid
[255] = {0};
1340 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2] = {0};
1341 struct isis_dynhn
*dynhn
;
1342 struct isis_lsp
*lsp
= NULL
;
1348 * extract fragment and pseudo id from the string argv
1350 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1351 * (b) <systemid/hostname>.<pseudo-id> or
1352 * (c) <systemid/hostname> or
1353 * Where systemid is in the form:
1357 strlcpy(sysid
, argv
, sizeof(sysid
));
1358 if (argv
&& strlen(argv
) > 3) {
1359 pos
= argv
+ strlen(argv
) - 3;
1360 if (strncmp(pos
, "-", 1) == 0) {
1361 memcpy(number
, ++pos
, 2);
1362 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1363 (uint8_t)strtol((char *)number
, NULL
, 16);
1365 if (strncmp(pos
, ".", 1) != 0)
1368 if (strncmp(pos
, ".", 1) == 0) {
1369 memcpy(number
, ++pos
, 2);
1370 lspid
[ISIS_SYS_ID_LEN
] =
1371 (uint8_t)strtol((char *)number
, NULL
, 16);
1372 sysid
[pos
- argv
- 1] = '\0';
1377 * Try to find the lsp-id if the argv
1380 * hostname.<pseudo-id>-<fragment>
1382 if (sysid2buff(lspid
, sysid
)) {
1383 lsp
= lsp_search(head
, lspid
);
1384 } else if ((dynhn
= dynhn_find_by_name(sysid
))) {
1385 memcpy(lspid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
1386 lsp
= lsp_search(head
, lspid
);
1387 } else if (strncmp(cmd_hostname_get(), sysid
, 15) == 0) {
1388 memcpy(lspid
, isis
->sysid
, ISIS_SYS_ID_LEN
);
1389 lsp
= lsp_search(head
, lspid
);
1396 * This function supports following display options:
1397 * [ show isis database [detail] ]
1398 * [ show isis database <sysid> [detail] ]
1399 * [ show isis database <hostname> [detail] ]
1400 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1401 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1402 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1403 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1404 * [ show isis database detail <sysid> ]
1405 * [ show isis database detail <hostname> ]
1406 * [ show isis database detail <sysid>.<pseudo-id> ]
1407 * [ show isis database detail <hostname>.<pseudo-id> ]
1408 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1409 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1411 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1413 struct listnode
*node
;
1414 struct isis_area
*area
;
1415 struct isis_lsp
*lsp
;
1416 int level
, lsp_count
;
1418 if (isis
->area_list
->count
== 0)
1421 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1422 vty_out(vty
, "Area %s:\n",
1423 area
->area_tag
? area
->area_tag
: "null");
1425 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1426 if (lspdb_count(&area
->lspdb
[level
]) > 0) {
1427 lsp
= lsp_for_arg(&area
->lspdb
[level
], argv
);
1429 if (lsp
!= NULL
|| argv
== NULL
) {
1431 "IS-IS Level-%d link-state database:\n",
1434 /* print the title in all cases */
1436 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1440 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1447 } else if (argv
== NULL
) {
1448 lsp_count
= lsp_print_all(
1449 vty
, &area
->lspdb
[level
],
1450 ui_level
, area
->dynhostname
);
1452 vty_out(vty
, " %u LSPs\n\n",
1462 DEFUN (show_database
,
1464 "show " PROTO_NAME
" database [detail] [WORD]",
1467 "Link state database\n"
1468 "Detailed information\n"
1472 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1473 ? ISIS_UI_LEVEL_DETAIL
1474 : ISIS_UI_LEVEL_BRIEF
;
1475 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1476 return show_isis_database(vty
, id
, uilevel
);
1481 * 'router openfabric' command
1483 DEFUN_NOSH (router_openfabric
,
1484 router_openfabric_cmd
,
1485 "router openfabric WORD",
1488 "ISO Routing area tag\n")
1491 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1495 *'no router openfabric' command
1497 DEFUN (no_router_openfabric
,
1498 no_router_openfabric_cmd
,
1499 "no router openfabric WORD",
1503 "ISO Routing area tag\n")
1506 return isis_area_destroy(argv
[idx_word
]->arg
);
1508 #endif /* ifdef FABRICD */
1516 "A Network Entity Title for this process (OSI only)\n"
1517 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1520 return area_net_title(vty
, argv
[idx_word
]->arg
);
1530 "A Network Entity Title for this process (OSI only)\n"
1531 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1534 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1536 #endif /* ifdef FABRICD */
1538 DEFUN (isis_topology
,
1540 "topology " ISIS_MT_NAMES
" [overload]",
1541 "Configure IS-IS topologies\n"
1542 ISIS_MT_DESCRIPTIONS
1543 "Set overload bit for topology\n")
1545 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1547 const char *arg
= argv
[1]->arg
;
1548 uint16_t mtid
= isis_str2mtid(arg
);
1550 if (area
->oldmetric
) {
1552 "Multi topology IS-IS can only be used with wide metrics\n");
1553 return CMD_WARNING_CONFIG_FAILED
;
1556 if (mtid
== (uint16_t)-1) {
1557 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1558 return CMD_WARNING_CONFIG_FAILED
;
1560 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1561 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1562 return CMD_WARNING_CONFIG_FAILED
;
1565 area_set_mt_enabled(area
, mtid
, true);
1566 area_set_mt_overload(area
, mtid
, (argc
== 3));
1570 DEFUN (no_isis_topology
,
1571 no_isis_topology_cmd
,
1572 "no topology " ISIS_MT_NAMES
" [overload]",
1574 "Configure IS-IS topologies\n"
1575 ISIS_MT_DESCRIPTIONS
1576 "Set overload bit for topology\n")
1578 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1580 const char *arg
= argv
[2]->arg
;
1581 uint16_t mtid
= isis_str2mtid(arg
);
1583 if (area
->oldmetric
) {
1585 "Multi topology IS-IS can only be used with wide metrics\n");
1586 return CMD_WARNING_CONFIG_FAILED
;
1589 if (mtid
== (uint16_t)-1) {
1590 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1591 return CMD_WARNING_CONFIG_FAILED
;
1593 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1594 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1595 return CMD_WARNING_CONFIG_FAILED
;
1598 area_set_mt_enabled(area
, mtid
, false);
1599 area_set_mt_overload(area
, mtid
, false);
1602 #endif /* ifdef FABRICD */
1604 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1606 area
->lsp_mtu
= lsp_mtu
;
1607 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1610 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1611 uint8_t passwd_type
, const char *passwd
,
1614 struct isis_passwd
*dest
;
1615 struct isis_passwd modified
;
1618 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1619 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1620 : &area
->domain_passwd
;
1621 memset(&modified
, 0, sizeof(modified
));
1623 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1627 len
= strlen(passwd
);
1632 strlcpy((char *)modified
.passwd
, passwd
,
1633 sizeof(modified
.passwd
));
1634 modified
.type
= passwd_type
;
1635 modified
.snp_auth
= snp_auth
;
1638 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1639 memcpy(dest
, &modified
, sizeof(modified
));
1640 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1646 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1648 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1652 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1653 const char *passwd
, uint8_t snp_auth
)
1655 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1659 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1660 const char *passwd
, uint8_t snp_auth
)
1662 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1666 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1668 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1669 if (!(level
& levels
))
1671 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1672 isis_spf_invalidate_routes(
1673 area
->spftree
[tree
][level
- 1]);
1678 void isis_area_verify_routes(struct isis_area
*area
)
1680 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1681 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1684 static void area_resign_level(struct isis_area
*area
, int level
)
1686 isis_area_invalidate_routes(area
, level
);
1687 isis_area_verify_routes(area
);
1689 lsp_db_fini(&area
->lspdb
[level
- 1]);
1691 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1692 if (area
->spftree
[tree
][level
- 1]) {
1693 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1694 area
->spftree
[tree
][level
- 1] = NULL
;
1698 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1701 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1702 area
->area_tag
, level
);
1703 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1704 area
->lsp_regenerate_pending
[level
- 1] = 0;
1707 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1709 struct listnode
*node
;
1710 struct isis_circuit
*circuit
;
1712 if (isis
->debugs
& DEBUG_EVENTS
)
1713 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1714 area
->area_tag
, circuit_t2string(area
->is_type
),
1715 circuit_t2string(is_type
));
1717 if (area
->is_type
== is_type
)
1718 return; /* No change */
1720 switch (area
->is_type
) {
1722 if (is_type
== IS_LEVEL_2
)
1723 area_resign_level(area
, IS_LEVEL_1
);
1725 lsp_db_init(&area
->lspdb
[1]);
1728 case IS_LEVEL_1_AND_2
:
1729 if (is_type
== IS_LEVEL_1
)
1730 area_resign_level(area
, IS_LEVEL_2
);
1732 area_resign_level(area
, IS_LEVEL_1
);
1736 if (is_type
== IS_LEVEL_1
)
1737 area_resign_level(area
, IS_LEVEL_2
);
1739 lsp_db_init(&area
->lspdb
[0]);
1746 area
->is_type
= is_type
;
1748 /* override circuit's is_type */
1749 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1750 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1751 isis_circuit_is_type_set(circuit
, is_type
);
1754 spftree_area_init(area
);
1756 if (listcount(area
->area_addrs
) > 0) {
1757 if (is_type
& IS_LEVEL_1
)
1758 lsp_generate(area
, IS_LEVEL_1
);
1759 if (is_type
& IS_LEVEL_2
)
1760 lsp_generate(area
, IS_LEVEL_2
);
1762 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1767 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1770 area
->oldmetric
= old_metric
;
1771 area
->newmetric
= new_metric
;
1772 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1775 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1777 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1779 if (new_overload_bit
!= area
->overload_bit
) {
1780 area
->overload_bit
= new_overload_bit
;
1781 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1784 isis_notif_db_overload(area
, overload_bit
);
1785 #endif /* ifndef FABRICD */
1788 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1790 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1792 if (new_attached_bit
!= area
->attached_bit
) {
1793 area
->attached_bit
= new_attached_bit
;
1794 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1798 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1800 if (area
->dynhostname
!= dynhostname
) {
1801 area
->dynhostname
= dynhostname
;
1802 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1806 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1807 uint16_t max_lsp_lifetime
)
1809 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1811 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1814 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1815 lsp_regenerate_schedule(area
, level
, 1);
1818 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1819 uint16_t lsp_refresh
)
1821 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1823 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1826 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1827 lsp_regenerate_schedule(area
, level
, 1);
1831 DEFUN (log_adj_changes
,
1832 log_adj_changes_cmd
,
1833 "log-adjacency-changes",
1834 "Log changes in adjacency state\n")
1836 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1838 area
->log_adj_changes
= 1;
1843 DEFUN (no_log_adj_changes
,
1844 no_log_adj_changes_cmd
,
1845 "no log-adjacency-changes",
1847 "Stop logging changes in adjacency state\n")
1849 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1851 area
->log_adj_changes
= 0;
1855 #endif /* ifdef FABRICD */
1857 /* IS-IS configuration write function */
1858 int isis_config_write(struct vty
*vty
)
1863 struct isis_area
*area
;
1864 struct listnode
*node
, *node2
;
1866 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1867 /* ISIS - Area name */
1868 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1871 if (listcount(area
->area_addrs
) > 0) {
1872 struct area_addr
*area_addr
;
1873 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1874 node2
, area_addr
)) {
1875 vty_out(vty
, " net %s\n",
1877 area_addr
->area_addr
,
1884 /* ISIS - Dynamic hostname - Defaults to true so only
1887 if (!area
->dynhostname
) {
1888 vty_out(vty
, " no hostname dynamic\n");
1891 /* ISIS - Metric-Style - when true displays wide */
1893 if (area
->newmetric
) {
1894 if (!area
->oldmetric
)
1895 vty_out(vty
, " metric-style wide\n");
1898 " metric-style transition\n");
1901 vty_out(vty
, " metric-style narrow\n");
1905 /* ISIS - overload-bit */
1906 if (area
->overload_bit
) {
1907 vty_out(vty
, " set-overload-bit\n");
1910 /* ISIS - Area is-type (level-1-2 is default) */
1912 if (area
->is_type
== IS_LEVEL_1
) {
1913 vty_out(vty
, " is-type level-1\n");
1915 } else if (area
->is_type
== IS_LEVEL_2
) {
1916 vty_out(vty
, " is-type level-2-only\n");
1920 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1921 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1922 /* ISIS - Lsp generation interval */
1923 if (area
->lsp_gen_interval
[0]
1924 == area
->lsp_gen_interval
[1]) {
1925 if (area
->lsp_gen_interval
[0]
1926 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1927 vty_out(vty
, " lsp-gen-interval %d\n",
1928 area
->lsp_gen_interval
[0]);
1932 if (area
->lsp_gen_interval
[0]
1933 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1935 " lsp-gen-interval level-1 %d\n",
1936 area
->lsp_gen_interval
[0]);
1939 if (area
->lsp_gen_interval
[1]
1940 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1942 " lsp-gen-interval level-2 %d\n",
1943 area
->lsp_gen_interval
[1]);
1947 /* ISIS - LSP lifetime */
1948 if (area
->max_lsp_lifetime
[0]
1949 == area
->max_lsp_lifetime
[1]) {
1950 if (area
->max_lsp_lifetime
[0]
1951 != DEFAULT_LSP_LIFETIME
) {
1952 vty_out(vty
, " max-lsp-lifetime %u\n",
1953 area
->max_lsp_lifetime
[0]);
1957 if (area
->max_lsp_lifetime
[0]
1958 != DEFAULT_LSP_LIFETIME
) {
1960 " max-lsp-lifetime level-1 %u\n",
1961 area
->max_lsp_lifetime
[0]);
1964 if (area
->max_lsp_lifetime
[1]
1965 != DEFAULT_LSP_LIFETIME
) {
1967 " max-lsp-lifetime level-2 %u\n",
1968 area
->max_lsp_lifetime
[1]);
1972 /* ISIS - LSP refresh interval */
1973 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1974 if (area
->lsp_refresh
[0]
1975 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1977 " lsp-refresh-interval %u\n",
1978 area
->lsp_refresh
[0]);
1982 if (area
->lsp_refresh
[0]
1983 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1985 " lsp-refresh-interval level-1 %u\n",
1986 area
->lsp_refresh
[0]);
1989 if (area
->lsp_refresh
[1]
1990 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1992 " lsp-refresh-interval level-2 %u\n",
1993 area
->lsp_refresh
[1]);
1997 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
1998 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
2001 if (area
->purge_originator
) {
2002 vty_out(vty
, " purge-originator\n");
2006 /* Minimum SPF interval. */
2007 if (area
->min_spf_interval
[0]
2008 == area
->min_spf_interval
[1]) {
2009 if (area
->min_spf_interval
[0]
2010 != MINIMUM_SPF_INTERVAL
) {
2011 vty_out(vty
, " spf-interval %d\n",
2012 area
->min_spf_interval
[0]);
2016 if (area
->min_spf_interval
[0]
2017 != MINIMUM_SPF_INTERVAL
) {
2019 " spf-interval level-1 %d\n",
2020 area
->min_spf_interval
[0]);
2023 if (area
->min_spf_interval
[1]
2024 != MINIMUM_SPF_INTERVAL
) {
2026 " spf-interval level-2 %d\n",
2027 area
->min_spf_interval
[1]);
2032 /* IETF SPF interval */
2033 if (area
->spf_delay_ietf
[0]) {
2035 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2036 spf_backoff_init_delay(
2037 area
->spf_delay_ietf
[0]),
2038 spf_backoff_short_delay(
2039 area
->spf_delay_ietf
[0]),
2040 spf_backoff_long_delay(
2041 area
->spf_delay_ietf
[0]),
2042 spf_backoff_holddown(
2043 area
->spf_delay_ietf
[0]),
2044 spf_backoff_timetolearn(
2045 area
->spf_delay_ietf
[0]));
2049 /* Authentication passwords. */
2050 if (area
->area_passwd
.type
2051 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2052 vty_out(vty
, " area-password md5 %s",
2053 area
->area_passwd
.passwd
);
2054 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2056 vty_out(vty
, " authenticate snp ");
2058 area
->area_passwd
.snp_auth
,
2060 vty_out(vty
, "validate");
2062 vty_out(vty
, "send-only");
2066 } else if (area
->area_passwd
.type
2067 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2068 vty_out(vty
, " area-password clear %s",
2069 area
->area_passwd
.passwd
);
2070 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2072 vty_out(vty
, " authenticate snp ");
2074 area
->area_passwd
.snp_auth
,
2076 vty_out(vty
, "validate");
2078 vty_out(vty
, "send-only");
2083 if (area
->domain_passwd
.type
2084 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2085 vty_out(vty
, " domain-password md5 %s",
2086 area
->domain_passwd
.passwd
);
2087 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2089 vty_out(vty
, " authenticate snp ");
2090 if (CHECK_FLAG(area
->domain_passwd
2093 vty_out(vty
, "validate");
2095 vty_out(vty
, "send-only");
2099 } else if (area
->domain_passwd
.type
2100 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2101 vty_out(vty
, " domain-password clear %s",
2102 area
->domain_passwd
.passwd
);
2103 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2105 vty_out(vty
, " authenticate snp ");
2106 if (CHECK_FLAG(area
->domain_passwd
2109 vty_out(vty
, "validate");
2111 vty_out(vty
, "send-only");
2117 if (area
->log_adj_changes
) {
2118 vty_out(vty
, " log-adjacency-changes\n");
2122 write
+= area_write_mt_settings(area
, vty
);
2123 write
+= fabricd_write_settings(area
, vty
);
2131 /* IS-IS configuration write function */
2132 int isis_config_write(struct vty
*vty
)
2135 struct lyd_node
*dnode
;
2137 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-isisd:isis");
2139 nb_cli_show_dnode_cmds(vty
, dnode
, false);
2145 #endif /* ifdef FABRICD */
2147 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2149 void isis_init(void)
2151 /* Install IS-IS top node */
2152 install_node(&router_node
, isis_config_write
);
2154 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2156 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2158 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2159 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2160 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2162 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2163 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2164 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2165 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2166 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2168 install_element(VIEW_NODE
, &show_hostname_cmd
);
2169 install_element(VIEW_NODE
, &show_database_cmd
);
2171 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2173 install_node(&debug_node
, config_write_debug
);
2175 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2176 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2177 install_element(ENABLE_NODE
, &debug_isis_tx_queue_cmd
);
2178 install_element(ENABLE_NODE
, &no_debug_isis_tx_queue_cmd
);
2179 install_element(ENABLE_NODE
, &debug_isis_flooding_cmd
);
2180 install_element(ENABLE_NODE
, &no_debug_isis_flooding_cmd
);
2181 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2182 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2183 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2184 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2185 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2186 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2187 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2188 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2189 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2190 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2191 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2192 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2193 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2194 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2195 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2196 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2197 install_element(ENABLE_NODE
, &debug_isis_bfd_cmd
);
2198 install_element(ENABLE_NODE
, &no_debug_isis_bfd_cmd
);
2200 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2201 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2202 install_element(CONFIG_NODE
, &debug_isis_tx_queue_cmd
);
2203 install_element(CONFIG_NODE
, &no_debug_isis_tx_queue_cmd
);
2204 install_element(CONFIG_NODE
, &debug_isis_flooding_cmd
);
2205 install_element(CONFIG_NODE
, &no_debug_isis_flooding_cmd
);
2206 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2207 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2208 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2209 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2210 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2211 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2212 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2213 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2214 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2215 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2216 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2217 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2218 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2219 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2220 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2221 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2222 install_element(CONFIG_NODE
, &debug_isis_bfd_cmd
);
2223 install_element(CONFIG_NODE
, &no_debug_isis_bfd_cmd
);
2225 install_default(ROUTER_NODE
);
2228 install_element(CONFIG_NODE
, &router_openfabric_cmd
);
2229 install_element(CONFIG_NODE
, &no_router_openfabric_cmd
);
2231 install_element(ROUTER_NODE
, &net_cmd
);
2232 install_element(ROUTER_NODE
, &no_net_cmd
);
2234 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2235 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2237 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2238 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2239 #endif /* ifdef FABRICD */
2241 spf_backoff_cmd_init();