2 * IS-IS Rout(e)ing protocol - isisd.c
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
8 * This program is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU General Public Licenseas published by the Free
10 * Software Foundation; either version 2 of the License, or (at your option)
13 * This program is distributed in the hope that it will be useful,but WITHOUT
14 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
15 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
18 * You should have received a copy of the GNU General Public License along
19 * with this program; see the file COPYING; if not, write to the Free Software
20 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
38 #include "spf_backoff.h"
39 #include "lib/northbound_cli.h"
41 #include "isisd/dict.h"
42 #include "isisd/isis_constants.h"
43 #include "isisd/isis_common.h"
44 #include "isisd/isis_flags.h"
45 #include "isisd/isis_circuit.h"
46 #include "isisd/isis_csm.h"
47 #include "isisd/isisd.h"
48 #include "isisd/isis_dynhn.h"
49 #include "isisd/isis_adjacency.h"
50 #include "isisd/isis_pdu.h"
51 #include "isisd/isis_misc.h"
52 #include "isisd/isis_constants.h"
53 #include "isisd/isis_lsp.h"
54 #include "isisd/isis_spf.h"
55 #include "isisd/isis_route.h"
56 #include "isisd/isis_zebra.h"
57 #include "isisd/isis_events.h"
58 #include "isisd/isis_te.h"
59 #include "isisd/isis_mt.h"
60 #include "isisd/fabricd.h"
62 struct isis
*isis
= NULL
;
64 DEFINE_QOBJ_TYPE(isis
)
65 DEFINE_QOBJ_TYPE(isis_area
)
70 int isis_area_get(struct vty
*, const char *);
71 int area_net_title(struct vty
*, const char *);
72 int area_clear_net_title(struct vty
*, const char *);
73 int show_isis_interface_common(struct vty
*, const char *ifname
, char);
74 int show_isis_neighbor_common(struct vty
*, const char *id
, char);
75 int clear_isis_neighbor_common(struct vty
*, const char *id
);
76 int isis_config_write(struct vty
*);
79 void isis_new(unsigned long process_id
)
81 isis
= XCALLOC(MTYPE_ISIS
, sizeof(struct isis
));
85 isis
->max_area_addrs
= 3;
86 isis
->process_id
= process_id
;
88 isis
->area_list
= list_new();
89 isis
->init_circ_list
= list_new();
90 isis
->uptime
= time(NULL
);
91 isis
->nexthops
= list_new();
92 isis
->nexthops6
= list_new();
95 * uncomment the next line for full debugs
97 /* isis->debugs = 0xFFFF; */
98 isisMplsTE
.status
= disable
; /* Only support TE metric */
100 QOBJ_REG(isis
, isis
);
103 struct isis_area
*isis_area_create(const char *area_tag
)
105 struct isis_area
*area
;
107 area
= XCALLOC(MTYPE_ISIS_AREA
, sizeof(struct isis_area
));
110 * Fabricd runs only as level-2.
111 * For IS-IS, the first instance is level-1-2 rest are level-1,
112 * unless otherwise configured
115 area
->is_type
= IS_LEVEL_2
;
116 } else if (listcount(isis
->area_list
) > 0)
117 area
->is_type
= IS_LEVEL_1
;
119 area
->is_type
= IS_LEVEL_1_AND_2
;
122 * intialize the databases
124 if (area
->is_type
& IS_LEVEL_1
) {
125 area
->lspdb
[0] = lsp_db_init();
127 if (area
->is_type
& IS_LEVEL_2
) {
128 area
->lspdb
[1] = lsp_db_init();
131 spftree_area_init(area
);
133 area
->circuit_list
= list_new();
134 area
->area_addrs
= list_new();
135 thread_add_timer(master
, lsp_tick
, area
, 1, &area
->t_tick
);
136 flags_initialize(&area
->flags
);
141 area
->max_lsp_lifetime
[0] = DEFAULT_LSP_LIFETIME
; /* 1200 */
142 area
->max_lsp_lifetime
[1] = DEFAULT_LSP_LIFETIME
; /* 1200 */
143 area
->lsp_refresh
[0] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
144 area
->lsp_refresh
[1] = DEFAULT_MAX_LSP_GEN_INTERVAL
; /* 900 */
145 area
->lsp_gen_interval
[0] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
146 area
->lsp_gen_interval
[1] = DEFAULT_MIN_LSP_GEN_INTERVAL
;
147 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
148 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
149 area
->dynhostname
= 1;
152 area
->lsp_frag_threshold
= 90;
153 area
->lsp_mtu
= DEFAULT_LSP_MTU
;
157 area
->area_tag
= strdup(area_tag
);
158 listnode_add(isis
->area_list
, area
);
162 area
->fabricd
= fabricd_new(area
);
164 area
->lsp_refresh_arg
[0].area
= area
;
165 area
->lsp_refresh_arg
[0].level
= IS_LEVEL_1
;
166 area
->lsp_refresh_arg
[1].area
= area
;
167 area
->lsp_refresh_arg
[1].level
= IS_LEVEL_2
;
170 QOBJ_REG(area
, isis_area
);
175 struct isis_area
*isis_area_lookup(const char *area_tag
)
177 struct isis_area
*area
;
178 struct listnode
*node
;
180 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
))
181 if ((area
->area_tag
== NULL
&& area_tag
== NULL
)
182 || (area
->area_tag
&& area_tag
183 && strcmp(area
->area_tag
, area_tag
) == 0))
189 int isis_area_get(struct vty
*vty
, const char *area_tag
)
191 struct isis_area
*area
;
193 area
= isis_area_lookup(area_tag
);
196 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
200 area
= isis_area_create(area_tag
);
202 if (isis
->debugs
& DEBUG_EVENTS
)
203 zlog_debug("New IS-IS area instance %s", area
->area_tag
);
205 VTY_PUSH_CONTEXT(ROUTER_NODE
, area
);
210 int isis_area_destroy(const char *area_tag
)
212 struct isis_area
*area
;
213 struct listnode
*node
, *nnode
;
214 struct isis_circuit
*circuit
;
215 struct area_addr
*addr
;
217 area
= isis_area_lookup(area_tag
);
220 zlog_warn("%s: could not find area with area-tag %s",
222 return CMD_ERR_NO_MATCH
;
228 fabricd_finish(area
->fabricd
);
230 if (area
->circuit_list
) {
231 for (ALL_LIST_ELEMENTS(area
->circuit_list
, node
, nnode
,
233 circuit
->ip_router
= 0;
234 circuit
->ipv6_router
= 0;
235 isis_csm_state_change(ISIS_DISABLE
, circuit
, area
);
237 list_delete(&area
->circuit_list
);
240 if (area
->lspdb
[0] != NULL
) {
241 lsp_db_destroy(area
->lspdb
[0]);
242 area
->lspdb
[0] = NULL
;
244 if (area
->lspdb
[1] != NULL
) {
245 lsp_db_destroy(area
->lspdb
[1]);
246 area
->lspdb
[1] = NULL
;
249 /* invalidate and verify to delete all routes from zebra */
250 isis_area_invalidate_routes(area
, ISIS_LEVEL1
& ISIS_LEVEL2
);
251 isis_area_verify_routes(area
);
253 spftree_area_del(area
);
255 THREAD_TIMER_OFF(area
->spf_timer
[0]);
256 THREAD_TIMER_OFF(area
->spf_timer
[1]);
258 spf_backoff_free(area
->spf_delay_ietf
[0]);
259 spf_backoff_free(area
->spf_delay_ietf
[1]);
261 isis_redist_area_finish(area
);
263 for (ALL_LIST_ELEMENTS(area
->area_addrs
, node
, nnode
, addr
)) {
264 list_delete_node(area
->area_addrs
, node
);
265 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
267 area
->area_addrs
= NULL
;
269 THREAD_TIMER_OFF(area
->t_tick
);
270 THREAD_TIMER_OFF(area
->t_lsp_refresh
[0]);
271 THREAD_TIMER_OFF(area
->t_lsp_refresh
[1]);
273 thread_cancel_event(master
, area
);
275 listnode_delete(isis
->area_list
, area
);
277 free(area
->area_tag
);
279 area_mt_finish(area
);
281 XFREE(MTYPE_ISIS_AREA
, area
);
283 if (listcount(isis
->area_list
) == 0) {
284 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
292 static void area_set_mt_enabled(struct isis_area
*area
, uint16_t mtid
,
295 struct isis_area_mt_setting
*setting
;
297 setting
= area_get_mt_setting(area
, mtid
);
298 if (setting
->enabled
!= enabled
) {
299 setting
->enabled
= enabled
;
300 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
304 static void area_set_mt_overload(struct isis_area
*area
, uint16_t mtid
,
307 struct isis_area_mt_setting
*setting
;
309 setting
= area_get_mt_setting(area
, mtid
);
310 if (setting
->overload
!= overload
) {
311 setting
->overload
= overload
;
312 if (setting
->enabled
)
313 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
,
317 #endif /* ifdef FABRICD */
319 int area_net_title(struct vty
*vty
, const char *net_title
)
321 VTY_DECLVAR_CONTEXT(isis_area
, area
);
322 struct area_addr
*addr
;
323 struct area_addr
*addrp
;
324 struct listnode
*node
;
328 /* We check that we are not over the maximal number of addresses */
329 if (listcount(area
->area_addrs
) >= isis
->max_area_addrs
) {
331 "Maximum of area addresses (%d) already reached \n",
332 isis
->max_area_addrs
);
333 return CMD_ERR_NOTHING_TODO
;
336 addr
= XMALLOC(MTYPE_ISIS_AREA_ADDR
, sizeof(struct area_addr
));
337 addr
->addr_len
= dotformat2buff(buff
, net_title
);
338 memcpy(addr
->area_addr
, buff
, addr
->addr_len
);
340 zlog_debug("added area address %s for area %s (address length %d)",
341 net_title
, area
->area_tag
, addr
->addr_len
);
342 #endif /* EXTREME_DEBUG */
343 if (addr
->addr_len
< 8 || addr
->addr_len
> 20) {
345 "area address must be at least 8..20 octets long (%d)\n",
347 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
348 return CMD_WARNING_CONFIG_FAILED
;
351 if (addr
->area_addr
[addr
->addr_len
- 1] != 0) {
353 "nsel byte (last byte) in area address must be 0\n");
354 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
355 return CMD_WARNING_CONFIG_FAILED
;
358 if (isis
->sysid_set
== 0) {
360 * First area address - get the SystemID for this router
362 memcpy(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
);
364 if (isis
->debugs
& DEBUG_EVENTS
)
365 zlog_debug("Router has SystemID %s",
366 sysid_print(isis
->sysid
));
369 * Check that the SystemID portions match
371 if (memcmp(isis
->sysid
, GETSYSID(addr
), ISIS_SYS_ID_LEN
)) {
373 "System ID must not change when defining additional area addresses\n");
374 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
375 return CMD_WARNING_CONFIG_FAILED
;
378 /* now we see that we don't already have this address */
379 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
)) {
380 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
)
383 if (!memcmp(addrp
->area_addr
, addr
->area_addr
,
385 XFREE(MTYPE_ISIS_AREA_ADDR
, addr
);
386 return CMD_SUCCESS
; /* silent fail */
392 * Forget the systemID part of the address
394 addr
->addr_len
-= (ISIS_SYS_ID_LEN
+ ISIS_NSEL_LEN
);
395 listnode_add(area
->area_addrs
, addr
);
397 /* only now we can safely generate our LSPs for this area */
398 if (listcount(area
->area_addrs
) > 0) {
399 if (area
->is_type
& IS_LEVEL_1
)
400 lsp_generate(area
, IS_LEVEL_1
);
401 if (area
->is_type
& IS_LEVEL_2
)
402 lsp_generate(area
, IS_LEVEL_2
);
408 int area_clear_net_title(struct vty
*vty
, const char *net_title
)
410 VTY_DECLVAR_CONTEXT(isis_area
, area
);
411 struct area_addr addr
, *addrp
= NULL
;
412 struct listnode
*node
;
415 addr
.addr_len
= dotformat2buff(buff
, net_title
);
416 if (addr
.addr_len
< 8 || addr
.addr_len
> 20) {
418 "Unsupported area address length %d, should be 8...20 \n",
420 return CMD_WARNING_CONFIG_FAILED
;
423 memcpy(addr
.area_addr
, buff
, (int)addr
.addr_len
);
425 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node
, addrp
))
426 if ((addrp
->addr_len
+ ISIS_SYS_ID_LEN
+ 1) == addr
.addr_len
427 && !memcmp(addrp
->area_addr
, addr
.area_addr
, addr
.addr_len
))
431 vty_out(vty
, "No area address %s for area %s \n", net_title
,
433 return CMD_ERR_NO_MATCH
;
436 listnode_delete(area
->area_addrs
, addrp
);
437 XFREE(MTYPE_ISIS_AREA_ADDR
, addrp
);
440 * Last area address - reset the SystemID for this router
442 if (listcount(area
->area_addrs
) == 0) {
443 memset(isis
->sysid
, 0, ISIS_SYS_ID_LEN
);
445 if (isis
->debugs
& DEBUG_EVENTS
)
446 zlog_debug("Router has no SystemID");
453 * 'show isis interface' command
456 int show_isis_interface_common(struct vty
*vty
, const char *ifname
, char detail
)
458 struct listnode
*anode
, *cnode
;
459 struct isis_area
*area
;
460 struct isis_circuit
*circuit
;
463 vty_out(vty
, "IS-IS Routing Process not enabled\n");
467 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
468 vty_out(vty
, "Area %s:\n", area
->area_tag
);
470 if (detail
== ISIS_UI_LEVEL_BRIEF
)
472 " Interface CircId State Type Level\n");
474 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
))
476 isis_circuit_print_vty(circuit
, vty
, detail
);
477 else if (strcmp(circuit
->interface
->name
, ifname
) == 0)
478 isis_circuit_print_vty(circuit
, vty
, detail
);
484 DEFUN (show_isis_interface
,
485 show_isis_interface_cmd
,
486 "show " PROTO_NAME
" interface",
491 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
494 DEFUN (show_isis_interface_detail
,
495 show_isis_interface_detail_cmd
,
496 "show " PROTO_NAME
" interface detail",
500 "show detailed information\n")
502 return show_isis_interface_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
505 DEFUN (show_isis_interface_arg
,
506 show_isis_interface_arg_cmd
,
507 "show " PROTO_NAME
" interface WORD",
511 "ISIS interface name\n")
514 return show_isis_interface_common(vty
, argv
[idx_word
]->arg
,
515 ISIS_UI_LEVEL_DETAIL
);
519 * 'show isis neighbor' command
522 int show_isis_neighbor_common(struct vty
*vty
, const char *id
, char detail
)
524 struct listnode
*anode
, *cnode
, *node
;
525 struct isis_area
*area
;
526 struct isis_circuit
*circuit
;
528 struct isis_adjacency
*adj
;
529 struct isis_dynhn
*dynhn
;
530 uint8_t sysid
[ISIS_SYS_ID_LEN
];
534 vty_out(vty
, "IS-IS Routing Process not enabled\n");
538 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
540 if (sysid2buff(sysid
, id
) == 0) {
541 dynhn
= dynhn_find_by_name(id
);
543 vty_out(vty
, "Invalid system id %s\n", id
);
546 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
550 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
551 vty_out(vty
, "Area %s:\n", area
->area_tag
);
553 if (detail
== ISIS_UI_LEVEL_BRIEF
)
555 " System Id Interface L State Holdtime SNPA\n");
557 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, cnode
, circuit
)) {
558 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
559 for (i
= 0; i
< 2; i
++) {
560 adjdb
= circuit
->u
.bc
.adjdb
[i
];
561 if (adjdb
&& adjdb
->count
) {
562 for (ALL_LIST_ELEMENTS_RO(
565 || !memcmp(adj
->sysid
,
574 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
575 && circuit
->u
.p2p
.neighbor
) {
576 adj
= circuit
->u
.p2p
.neighbor
;
578 || !memcmp(adj
->sysid
, sysid
,
580 isis_adj_print_vty(adj
, vty
, detail
);
589 * 'clear isis neighbor' command
591 int clear_isis_neighbor_common(struct vty
*vty
, const char *id
)
593 struct listnode
*anode
, *cnode
, *cnextnode
, *node
, *nnode
;
594 struct isis_area
*area
;
595 struct isis_circuit
*circuit
;
597 struct isis_adjacency
*adj
;
598 struct isis_dynhn
*dynhn
;
599 uint8_t sysid
[ISIS_SYS_ID_LEN
];
603 vty_out(vty
, "IS-IS Routing Process not enabled\n");
607 memset(sysid
, 0, ISIS_SYS_ID_LEN
);
609 if (sysid2buff(sysid
, id
) == 0) {
610 dynhn
= dynhn_find_by_name(id
);
612 vty_out(vty
, "Invalid system id %s\n", id
);
615 memcpy(sysid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
619 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, anode
, area
)) {
620 for (ALL_LIST_ELEMENTS(area
->circuit_list
, cnode
, cnextnode
,
622 if (circuit
->circ_type
== CIRCUIT_T_BROADCAST
) {
623 for (i
= 0; i
< 2; i
++) {
624 adjdb
= circuit
->u
.bc
.adjdb
[i
];
625 if (adjdb
&& adjdb
->count
) {
626 for (ALL_LIST_ELEMENTS(
630 || !memcmp(adj
->sysid
,
633 isis_adj_state_change(
636 "clear user request");
639 } else if (circuit
->circ_type
== CIRCUIT_T_P2P
640 && circuit
->u
.p2p
.neighbor
) {
641 adj
= circuit
->u
.p2p
.neighbor
;
643 || !memcmp(adj
->sysid
, sysid
,
645 isis_adj_state_change(
647 "clear user request");
655 DEFUN (show_isis_neighbor
,
656 show_isis_neighbor_cmd
,
657 "show " PROTO_NAME
" neighbor",
660 "ISIS neighbor adjacencies\n")
662 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_BRIEF
);
665 DEFUN (show_isis_neighbor_detail
,
666 show_isis_neighbor_detail_cmd
,
667 "show " PROTO_NAME
" neighbor detail",
670 "ISIS neighbor adjacencies\n"
671 "show detailed information\n")
673 return show_isis_neighbor_common(vty
, NULL
, ISIS_UI_LEVEL_DETAIL
);
676 DEFUN (show_isis_neighbor_arg
,
677 show_isis_neighbor_arg_cmd
,
678 "show " PROTO_NAME
" neighbor WORD",
681 "ISIS neighbor adjacencies\n"
685 return show_isis_neighbor_common(vty
, argv
[idx_word
]->arg
,
686 ISIS_UI_LEVEL_DETAIL
);
689 DEFUN (clear_isis_neighbor
,
690 clear_isis_neighbor_cmd
,
691 "clear " PROTO_NAME
" neighbor",
694 "ISIS neighbor adjacencies\n")
696 return clear_isis_neighbor_common(vty
, NULL
);
699 DEFUN (clear_isis_neighbor_arg
,
700 clear_isis_neighbor_arg_cmd
,
701 "clear " PROTO_NAME
" neighbor WORD",
704 "ISIS neighbor adjacencies\n"
708 return clear_isis_neighbor_common(vty
, argv
[idx_word
]->arg
);
712 * 'isis debug', 'show debugging'
714 void print_debug(struct vty
*vty
, int flags
, int onoff
)
718 strcpy(onoffs
, "on");
720 strcpy(onoffs
, "off");
722 if (flags
& DEBUG_ADJ_PACKETS
)
724 "IS-IS Adjacency related packets debugging is %s\n",
726 if (flags
& DEBUG_TX_QUEUE
)
727 vty_out(vty
, "IS-IS TX queue debugging is %s\n",
729 if (flags
& DEBUG_SNP_PACKETS
)
730 vty_out(vty
, "IS-IS CSNP/PSNP packets debugging is %s\n",
732 if (flags
& DEBUG_SPF_EVENTS
)
733 vty_out(vty
, "IS-IS SPF events debugging is %s\n", onoffs
);
734 if (flags
& DEBUG_UPDATE_PACKETS
)
735 vty_out(vty
, "IS-IS Update related packet debugging is %s\n",
737 if (flags
& DEBUG_RTE_EVENTS
)
738 vty_out(vty
, "IS-IS Route related debuggin is %s\n", onoffs
);
739 if (flags
& DEBUG_EVENTS
)
740 vty_out(vty
, "IS-IS Event debugging is %s\n", onoffs
);
741 if (flags
& DEBUG_PACKET_DUMP
)
742 vty_out(vty
, "IS-IS Packet dump debugging is %s\n", onoffs
);
743 if (flags
& DEBUG_LSP_GEN
)
744 vty_out(vty
, "IS-IS LSP generation debugging is %s\n", onoffs
);
745 if (flags
& DEBUG_LSP_SCHED
)
746 vty_out(vty
, "IS-IS LSP scheduling debugging is %s\n", onoffs
);
747 if (flags
& DEBUG_FLOODING
)
748 vty_out(vty
, "IS-IS Flooding debugging is %s\n", onoffs
);
749 if (flags
& DEBUG_BFD
)
750 vty_out(vty
, "IS-IS BFD debugging is %s\n", onoffs
);
753 DEFUN_NOSH (show_debugging
,
754 show_debugging_isis_cmd
,
755 "show debugging [" PROTO_NAME
"]",
757 "State of each debugging option\n"
760 vty_out(vty
, PROTO_NAME
" debugging status:\n");
763 print_debug(vty
, isis
->debugs
, 1);
769 static struct cmd_node debug_node
= {DEBUG_NODE
, "", 1};
771 static int config_write_debug(struct vty
*vty
)
774 int flags
= isis
->debugs
;
776 if (flags
& DEBUG_ADJ_PACKETS
) {
777 vty_out(vty
, "debug " PROTO_NAME
" adj-packets\n");
780 if (flags
& DEBUG_TX_QUEUE
) {
781 vty_out(vty
, "debug " PROTO_NAME
" tx-queue\n");
784 if (flags
& DEBUG_SNP_PACKETS
) {
785 vty_out(vty
, "debug " PROTO_NAME
" snp-packets\n");
788 if (flags
& DEBUG_SPF_EVENTS
) {
789 vty_out(vty
, "debug " PROTO_NAME
" spf-events\n");
792 if (flags
& DEBUG_UPDATE_PACKETS
) {
793 vty_out(vty
, "debug " PROTO_NAME
" update-packets\n");
796 if (flags
& DEBUG_RTE_EVENTS
) {
797 vty_out(vty
, "debug " PROTO_NAME
" route-events\n");
800 if (flags
& DEBUG_EVENTS
) {
801 vty_out(vty
, "debug " PROTO_NAME
" events\n");
804 if (flags
& DEBUG_PACKET_DUMP
) {
805 vty_out(vty
, "debug " PROTO_NAME
" packet-dump\n");
808 if (flags
& DEBUG_LSP_GEN
) {
809 vty_out(vty
, "debug " PROTO_NAME
" lsp-gen\n");
812 if (flags
& DEBUG_LSP_SCHED
) {
813 vty_out(vty
, "debug " PROTO_NAME
" lsp-sched\n");
816 if (flags
& DEBUG_FLOODING
) {
817 vty_out(vty
, "debug " PROTO_NAME
" flooding\n");
820 if (flags
& DEBUG_BFD
) {
821 vty_out(vty
, "debug " PROTO_NAME
" bfd\n");
824 write
+= spf_backoff_write_config(vty
);
829 DEFUN (debug_isis_adj
,
831 "debug " PROTO_NAME
" adj-packets",
834 "IS-IS Adjacency related packets\n")
836 isis
->debugs
|= DEBUG_ADJ_PACKETS
;
837 print_debug(vty
, DEBUG_ADJ_PACKETS
, 1);
842 DEFUN (no_debug_isis_adj
,
843 no_debug_isis_adj_cmd
,
844 "no debug " PROTO_NAME
" adj-packets",
848 "IS-IS Adjacency related packets\n")
850 isis
->debugs
&= ~DEBUG_ADJ_PACKETS
;
851 print_debug(vty
, DEBUG_ADJ_PACKETS
, 0);
856 DEFUN (debug_isis_tx_queue
,
857 debug_isis_tx_queue_cmd
,
858 "debug " PROTO_NAME
" tx-queue",
863 isis
->debugs
|= DEBUG_TX_QUEUE
;
864 print_debug(vty
, DEBUG_TX_QUEUE
, 1);
869 DEFUN (no_debug_isis_tx_queue
,
870 no_debug_isis_tx_queue_cmd
,
871 "no debug " PROTO_NAME
" tx-queue",
877 isis
->debugs
&= ~DEBUG_TX_QUEUE
;
878 print_debug(vty
, DEBUG_TX_QUEUE
, 0);
883 DEFUN (debug_isis_flooding
,
884 debug_isis_flooding_cmd
,
885 "debug " PROTO_NAME
" flooding",
888 "Flooding algorithm\n")
890 isis
->debugs
|= DEBUG_FLOODING
;
891 print_debug(vty
, DEBUG_FLOODING
, 1);
896 DEFUN (no_debug_isis_flooding
,
897 no_debug_isis_flooding_cmd
,
898 "no debug " PROTO_NAME
" flooding",
902 "Flooding algorithm\n")
904 isis
->debugs
&= ~DEBUG_FLOODING
;
905 print_debug(vty
, DEBUG_FLOODING
, 0);
910 DEFUN (debug_isis_snp
,
912 "debug " PROTO_NAME
" snp-packets",
915 "IS-IS CSNP/PSNP packets\n")
917 isis
->debugs
|= DEBUG_SNP_PACKETS
;
918 print_debug(vty
, DEBUG_SNP_PACKETS
, 1);
923 DEFUN (no_debug_isis_snp
,
924 no_debug_isis_snp_cmd
,
925 "no debug " PROTO_NAME
" snp-packets",
929 "IS-IS CSNP/PSNP packets\n")
931 isis
->debugs
&= ~DEBUG_SNP_PACKETS
;
932 print_debug(vty
, DEBUG_SNP_PACKETS
, 0);
937 DEFUN (debug_isis_upd
,
939 "debug " PROTO_NAME
" update-packets",
942 "IS-IS Update related packets\n")
944 isis
->debugs
|= DEBUG_UPDATE_PACKETS
;
945 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 1);
950 DEFUN (no_debug_isis_upd
,
951 no_debug_isis_upd_cmd
,
952 "no debug " PROTO_NAME
" update-packets",
956 "IS-IS Update related packets\n")
958 isis
->debugs
&= ~DEBUG_UPDATE_PACKETS
;
959 print_debug(vty
, DEBUG_UPDATE_PACKETS
, 0);
964 DEFUN (debug_isis_spfevents
,
965 debug_isis_spfevents_cmd
,
966 "debug " PROTO_NAME
" spf-events",
969 "IS-IS Shortest Path First Events\n")
971 isis
->debugs
|= DEBUG_SPF_EVENTS
;
972 print_debug(vty
, DEBUG_SPF_EVENTS
, 1);
977 DEFUN (no_debug_isis_spfevents
,
978 no_debug_isis_spfevents_cmd
,
979 "no debug " PROTO_NAME
" spf-events",
983 "IS-IS Shortest Path First Events\n")
985 isis
->debugs
&= ~DEBUG_SPF_EVENTS
;
986 print_debug(vty
, DEBUG_SPF_EVENTS
, 0);
991 DEFUN (debug_isis_rtevents
,
992 debug_isis_rtevents_cmd
,
993 "debug " PROTO_NAME
" route-events",
996 "IS-IS Route related events\n")
998 isis
->debugs
|= DEBUG_RTE_EVENTS
;
999 print_debug(vty
, DEBUG_RTE_EVENTS
, 1);
1004 DEFUN (no_debug_isis_rtevents
,
1005 no_debug_isis_rtevents_cmd
,
1006 "no debug " PROTO_NAME
" route-events",
1010 "IS-IS Route related events\n")
1012 isis
->debugs
&= ~DEBUG_RTE_EVENTS
;
1013 print_debug(vty
, DEBUG_RTE_EVENTS
, 0);
1018 DEFUN (debug_isis_events
,
1019 debug_isis_events_cmd
,
1020 "debug " PROTO_NAME
" events",
1025 isis
->debugs
|= DEBUG_EVENTS
;
1026 print_debug(vty
, DEBUG_EVENTS
, 1);
1031 DEFUN (no_debug_isis_events
,
1032 no_debug_isis_events_cmd
,
1033 "no debug " PROTO_NAME
" events",
1039 isis
->debugs
&= ~DEBUG_EVENTS
;
1040 print_debug(vty
, DEBUG_EVENTS
, 0);
1045 DEFUN (debug_isis_packet_dump
,
1046 debug_isis_packet_dump_cmd
,
1047 "debug " PROTO_NAME
" packet-dump",
1050 "IS-IS packet dump\n")
1052 isis
->debugs
|= DEBUG_PACKET_DUMP
;
1053 print_debug(vty
, DEBUG_PACKET_DUMP
, 1);
1058 DEFUN (no_debug_isis_packet_dump
,
1059 no_debug_isis_packet_dump_cmd
,
1060 "no debug " PROTO_NAME
" packet-dump",
1064 "IS-IS packet dump\n")
1066 isis
->debugs
&= ~DEBUG_PACKET_DUMP
;
1067 print_debug(vty
, DEBUG_PACKET_DUMP
, 0);
1072 DEFUN (debug_isis_lsp_gen
,
1073 debug_isis_lsp_gen_cmd
,
1074 "debug " PROTO_NAME
" lsp-gen",
1077 "IS-IS generation of own LSPs\n")
1079 isis
->debugs
|= DEBUG_LSP_GEN
;
1080 print_debug(vty
, DEBUG_LSP_GEN
, 1);
1085 DEFUN (no_debug_isis_lsp_gen
,
1086 no_debug_isis_lsp_gen_cmd
,
1087 "no debug " PROTO_NAME
" lsp-gen",
1091 "IS-IS generation of own LSPs\n")
1093 isis
->debugs
&= ~DEBUG_LSP_GEN
;
1094 print_debug(vty
, DEBUG_LSP_GEN
, 0);
1099 DEFUN (debug_isis_lsp_sched
,
1100 debug_isis_lsp_sched_cmd
,
1101 "debug " PROTO_NAME
" lsp-sched",
1104 "IS-IS scheduling of LSP generation\n")
1106 isis
->debugs
|= DEBUG_LSP_SCHED
;
1107 print_debug(vty
, DEBUG_LSP_SCHED
, 1);
1112 DEFUN (no_debug_isis_lsp_sched
,
1113 no_debug_isis_lsp_sched_cmd
,
1114 "no debug " PROTO_NAME
" lsp-sched",
1118 "IS-IS scheduling of LSP generation\n")
1120 isis
->debugs
&= ~DEBUG_LSP_SCHED
;
1121 print_debug(vty
, DEBUG_LSP_SCHED
, 0);
1126 DEFUN (debug_isis_bfd
,
1128 "debug " PROTO_NAME
" bfd",
1131 PROTO_NAME
" interaction with BFD\n")
1133 isis
->debugs
|= DEBUG_BFD
;
1134 print_debug(vty
, DEBUG_BFD
, 1);
1139 DEFUN (no_debug_isis_bfd
,
1140 no_debug_isis_bfd_cmd
,
1141 "no debug " PROTO_NAME
" bfd",
1145 PROTO_NAME
" interaction with BFD\n")
1147 isis
->debugs
&= ~DEBUG_BFD
;
1148 print_debug(vty
, DEBUG_BFD
, 0);
1153 DEFUN (show_hostname
,
1155 "show " PROTO_NAME
" hostname",
1158 "IS-IS Dynamic hostname mapping\n")
1160 dynhn_print_all(vty
);
1165 DEFUN (show_isis_spf_ietf
,
1166 show_isis_spf_ietf_cmd
,
1167 "show " PROTO_NAME
" spf-delay-ietf",
1170 "SPF delay IETF information\n")
1173 vty_out(vty
, "ISIS is not running\n");
1177 struct listnode
*node
;
1178 struct isis_area
*area
;
1180 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1181 vty_out(vty
, "Area %s:\n",
1182 area
->area_tag
? area
->area_tag
: "null");
1184 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1185 if ((area
->is_type
& level
) == 0)
1188 vty_out(vty
, " Level-%d:\n", level
);
1189 vty_out(vty
, " SPF delay status: ");
1190 if (area
->spf_timer
[level
- 1]) {
1191 struct timeval remain
= thread_timer_remain(
1192 area
->spf_timer
[level
- 1]);
1193 vty_out(vty
, "Pending, due in %lld msec\n",
1194 (long long)remain
.tv_sec
* 1000
1195 + remain
.tv_usec
/ 1000);
1197 vty_out(vty
, "Not scheduled\n");
1200 if (area
->spf_delay_ietf
[level
- 1]) {
1202 " Using draft-ietf-rtgwg-backoff-algo-04\n");
1204 area
->spf_delay_ietf
[level
- 1], vty
,
1207 vty_out(vty
, " Using legacy backoff algo\n");
1214 DEFUN (show_isis_summary
,
1215 show_isis_summary_cmd
,
1216 "show " PROTO_NAME
" summary",
1217 SHOW_STR PROTO_HELP
"summary\n")
1219 struct listnode
*node
, *node2
;
1220 struct isis_area
*area
;
1224 vty_out(vty
, PROTO_NAME
" is not running\n");
1228 vty_out(vty
, "Process Id : %ld\n", isis
->process_id
);
1229 if (isis
->sysid_set
)
1230 vty_out(vty
, "System Id : %s\n",
1231 sysid_print(isis
->sysid
));
1233 vty_out(vty
, "Up time : ");
1234 vty_out_timestr(vty
, isis
->uptime
);
1237 if (isis
->area_list
)
1238 vty_out(vty
, "Number of areas : %d\n", isis
->area_list
->count
);
1240 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1241 vty_out(vty
, "Area %s:\n",
1242 area
->area_tag
? area
->area_tag
: "null");
1245 uint8_t tier
= fabricd_tier(area
);
1246 if (tier
== ISIS_TIER_UNDEFINED
)
1247 vty_out(vty
, " Tier: undefined\n");
1249 vty_out(vty
, " Tier: %" PRIu8
"\n", tier
);
1252 if (listcount(area
->area_addrs
) > 0) {
1253 struct area_addr
*area_addr
;
1254 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
, node2
,
1256 vty_out(vty
, " Net: %s\n",
1257 isonet_print(area_addr
->area_addr
,
1264 vty_out(vty
, " TX counters per PDU type:\n");
1265 pdu_counter_print(vty
, " ", area
->pdu_tx_counters
);
1266 vty_out(vty
, " LSP RXMT: %" PRIu64
"\n",
1267 area
->lsp_rxmt_count
);
1268 vty_out(vty
, " RX counters per PDU type:\n");
1269 pdu_counter_print(vty
, " ", area
->pdu_rx_counters
);
1271 for (level
= ISIS_LEVEL1
; level
<= ISIS_LEVELS
; level
++) {
1272 if ((area
->is_type
& level
) == 0)
1275 vty_out(vty
, " Level-%d:\n", level
);
1277 vty_out(vty
, " LSP0 regenerated: %" PRIu64
"\n",
1278 area
->lsp_gen_count
[level
- 1]);
1280 vty_out(vty
, " LSPs purged: %" PRIu64
"\n",
1281 area
->lsp_purge_count
[level
- 1]);
1283 if (area
->spf_timer
[level
- 1])
1284 vty_out(vty
, " SPF: (pending)\n");
1286 vty_out(vty
, " SPF:\n");
1288 vty_out(vty
, " minimum interval : %d",
1289 area
->min_spf_interval
[level
- 1]);
1290 if (area
->spf_delay_ietf
[level
- 1])
1292 " (not used, IETF SPF delay activated)");
1295 vty_out(vty
, " IPv4 route computation:\n");
1296 isis_spf_print(area
->spftree
[SPFTREE_IPV4
][level
- 1],
1299 vty_out(vty
, " IPv6 route computation:\n");
1300 isis_spf_print(area
->spftree
[SPFTREE_IPV6
][level
- 1],
1303 vty_out(vty
, " IPv6 dst-src route computation:\n");
1304 isis_spf_print(area
->spftree
[SPFTREE_DSTSRC
][level
-1],
1313 struct isis_lsp
*lsp_for_arg(const char *argv
, dict_t
*lspdb
)
1315 char sysid
[255] = {0};
1318 uint8_t lspid
[ISIS_SYS_ID_LEN
+ 2] = {0};
1319 struct isis_dynhn
*dynhn
;
1320 struct isis_lsp
*lsp
= NULL
;
1326 * extract fragment and pseudo id from the string argv
1328 * (a) <systemid/hostname>.<pseudo-id>-<framenent> or
1329 * (b) <systemid/hostname>.<pseudo-id> or
1330 * (c) <systemid/hostname> or
1331 * Where systemid is in the form:
1335 strncpy(sysid
, argv
, 254);
1336 if (argv
&& strlen(argv
) > 3) {
1337 pos
= argv
+ strlen(argv
) - 3;
1338 if (strncmp(pos
, "-", 1) == 0) {
1339 memcpy(number
, ++pos
, 2);
1340 lspid
[ISIS_SYS_ID_LEN
+ 1] =
1341 (uint8_t)strtol((char *)number
, NULL
, 16);
1343 if (strncmp(pos
, ".", 1) != 0)
1346 if (strncmp(pos
, ".", 1) == 0) {
1347 memcpy(number
, ++pos
, 2);
1348 lspid
[ISIS_SYS_ID_LEN
] =
1349 (uint8_t)strtol((char *)number
, NULL
, 16);
1350 sysid
[pos
- argv
- 1] = '\0';
1355 * Try to find the lsp-id if the argv
1358 * hostname.<pseudo-id>-<fragment>
1360 if (sysid2buff(lspid
, sysid
)) {
1361 lsp
= lsp_search(lspid
, lspdb
);
1362 } else if ((dynhn
= dynhn_find_by_name(sysid
))) {
1363 memcpy(lspid
, dynhn
->id
, ISIS_SYS_ID_LEN
);
1364 lsp
= lsp_search(lspid
, lspdb
);
1365 } else if (strncmp(cmd_hostname_get(), sysid
, 15) == 0) {
1366 memcpy(lspid
, isis
->sysid
, ISIS_SYS_ID_LEN
);
1367 lsp
= lsp_search(lspid
, lspdb
);
1374 * This function supports following display options:
1375 * [ show isis database [detail] ]
1376 * [ show isis database <sysid> [detail] ]
1377 * [ show isis database <hostname> [detail] ]
1378 * [ show isis database <sysid>.<pseudo-id> [detail] ]
1379 * [ show isis database <hostname>.<pseudo-id> [detail] ]
1380 * [ show isis database <sysid>.<pseudo-id>-<fragment-number> [detail] ]
1381 * [ show isis database <hostname>.<pseudo-id>-<fragment-number> [detail] ]
1382 * [ show isis database detail <sysid> ]
1383 * [ show isis database detail <hostname> ]
1384 * [ show isis database detail <sysid>.<pseudo-id> ]
1385 * [ show isis database detail <hostname>.<pseudo-id> ]
1386 * [ show isis database detail <sysid>.<pseudo-id>-<fragment-number> ]
1387 * [ show isis database detail <hostname>.<pseudo-id>-<fragment-number> ]
1389 static int show_isis_database(struct vty
*vty
, const char *argv
, int ui_level
)
1391 struct listnode
*node
;
1392 struct isis_area
*area
;
1393 struct isis_lsp
*lsp
;
1394 int level
, lsp_count
;
1396 if (isis
->area_list
->count
== 0)
1399 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1400 vty_out(vty
, "Area %s:\n",
1401 area
->area_tag
? area
->area_tag
: "null");
1403 for (level
= 0; level
< ISIS_LEVELS
; level
++) {
1404 if (area
->lspdb
[level
]
1405 && dict_count(area
->lspdb
[level
]) > 0) {
1406 lsp
= lsp_for_arg(argv
, area
->lspdb
[level
]);
1408 if (lsp
!= NULL
|| argv
== NULL
) {
1410 "IS-IS Level-%d link-state database:\n",
1413 /* print the title in all cases */
1415 "LSP ID PduLen SeqNumber Chksum Holdtime ATT/P/OL\n");
1419 if (ui_level
== ISIS_UI_LEVEL_DETAIL
)
1426 } else if (argv
== NULL
) {
1427 lsp_count
= lsp_print_all(
1428 vty
, area
->lspdb
[level
],
1429 ui_level
, area
->dynhostname
);
1431 vty_out(vty
, " %u LSPs\n\n",
1441 DEFUN (show_database
,
1443 "show " PROTO_NAME
" database [detail] [WORD]",
1446 "Link state database\n"
1447 "Detailed information\n"
1451 int uilevel
= argv_find(argv
, argc
, "detail", &idx
)
1452 ? ISIS_UI_LEVEL_DETAIL
1453 : ISIS_UI_LEVEL_BRIEF
;
1454 char *id
= argv_find(argv
, argc
, "WORD", &idx
) ? argv
[idx
]->arg
: NULL
;
1455 return show_isis_database(vty
, id
, uilevel
);
1460 * 'router openfabric' command
1462 DEFUN_NOSH (router_openfabric
,
1463 router_openfabric_cmd
,
1464 "router openfabric WORD",
1467 "ISO Routing area tag\n")
1470 return isis_area_get(vty
, argv
[idx_word
]->arg
);
1474 *'no router openfabric' command
1476 DEFUN (no_router_openfabric
,
1477 no_router_openfabric_cmd
,
1478 "no router openfabric WORD",
1482 "ISO Routing area tag\n")
1485 return isis_area_destroy(argv
[idx_word
]->arg
);
1487 #endif /* ifdef FABRICD */
1495 "A Network Entity Title for this process (OSI only)\n"
1496 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1499 return area_net_title(vty
, argv
[idx_word
]->arg
);
1509 "A Network Entity Title for this process (OSI only)\n"
1510 "XX.XXXX. ... .XXX.XX Network entity title (NET)\n")
1513 return area_clear_net_title(vty
, argv
[idx_word
]->arg
);
1515 #endif /* ifdef FABRICD */
1517 DEFUN (isis_topology
,
1519 "topology " ISIS_MT_NAMES
" [overload]",
1520 "Configure IS-IS topologies\n"
1521 ISIS_MT_DESCRIPTIONS
1522 "Set overload bit for topology\n")
1524 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1526 const char *arg
= argv
[1]->arg
;
1527 uint16_t mtid
= isis_str2mtid(arg
);
1529 if (area
->oldmetric
) {
1531 "Multi topology IS-IS can only be used with wide metrics\n");
1532 return CMD_WARNING_CONFIG_FAILED
;
1535 if (mtid
== (uint16_t)-1) {
1536 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1537 return CMD_WARNING_CONFIG_FAILED
;
1539 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1540 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1541 return CMD_WARNING_CONFIG_FAILED
;
1544 area_set_mt_enabled(area
, mtid
, true);
1545 area_set_mt_overload(area
, mtid
, (argc
== 3));
1549 DEFUN (no_isis_topology
,
1550 no_isis_topology_cmd
,
1551 "no topology " ISIS_MT_NAMES
" [overload]",
1553 "Configure IS-IS topologies\n"
1554 ISIS_MT_DESCRIPTIONS
1555 "Set overload bit for topology\n")
1557 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1559 const char *arg
= argv
[2]->arg
;
1560 uint16_t mtid
= isis_str2mtid(arg
);
1562 if (area
->oldmetric
) {
1564 "Multi topology IS-IS can only be used with wide metrics\n");
1565 return CMD_WARNING_CONFIG_FAILED
;
1568 if (mtid
== (uint16_t)-1) {
1569 vty_out(vty
, "Don't know topology '%s'\n", arg
);
1570 return CMD_WARNING_CONFIG_FAILED
;
1572 if (mtid
== ISIS_MT_IPV4_UNICAST
) {
1573 vty_out(vty
, "Cannot configure IPv4 unicast topology\n");
1574 return CMD_WARNING_CONFIG_FAILED
;
1577 area_set_mt_enabled(area
, mtid
, false);
1578 area_set_mt_overload(area
, mtid
, false);
1581 #endif /* ifdef FABRICD */
1583 void isis_area_lsp_mtu_set(struct isis_area
*area
, unsigned int lsp_mtu
)
1585 area
->lsp_mtu
= lsp_mtu
;
1586 lsp_regenerate_schedule(area
, IS_LEVEL_1_AND_2
, 1);
1589 static int isis_area_passwd_set(struct isis_area
*area
, int level
,
1590 uint8_t passwd_type
, const char *passwd
,
1593 struct isis_passwd
*dest
;
1594 struct isis_passwd modified
;
1597 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1598 dest
= (level
== IS_LEVEL_1
) ? &area
->area_passwd
1599 : &area
->domain_passwd
;
1600 memset(&modified
, 0, sizeof(modified
));
1602 if (passwd_type
!= ISIS_PASSWD_TYPE_UNUSED
) {
1606 len
= strlen(passwd
);
1611 strncpy((char *)modified
.passwd
, passwd
, 255);
1612 modified
.type
= passwd_type
;
1613 modified
.snp_auth
= snp_auth
;
1616 if (memcmp(&modified
, dest
, sizeof(modified
))) {
1617 memcpy(dest
, &modified
, sizeof(modified
));
1618 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1624 int isis_area_passwd_unset(struct isis_area
*area
, int level
)
1626 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_UNUSED
, NULL
,
1630 int isis_area_passwd_cleartext_set(struct isis_area
*area
, int level
,
1631 const char *passwd
, uint8_t snp_auth
)
1633 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_CLEARTXT
,
1637 int isis_area_passwd_hmac_md5_set(struct isis_area
*area
, int level
,
1638 const char *passwd
, uint8_t snp_auth
)
1640 return isis_area_passwd_set(area
, level
, ISIS_PASSWD_TYPE_HMAC_MD5
,
1644 void isis_area_invalidate_routes(struct isis_area
*area
, int levels
)
1646 for (int level
= ISIS_LEVEL1
; level
<= ISIS_LEVEL2
; level
++) {
1647 if (!(level
& levels
))
1649 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1650 isis_spf_invalidate_routes(
1651 area
->spftree
[tree
][level
- 1]);
1656 void isis_area_verify_routes(struct isis_area
*area
)
1658 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++)
1659 isis_spf_verify_routes(area
, area
->spftree
[tree
]);
1662 static void area_resign_level(struct isis_area
*area
, int level
)
1664 isis_area_invalidate_routes(area
, level
);
1665 isis_area_verify_routes(area
);
1667 if (area
->lspdb
[level
- 1]) {
1668 lsp_db_destroy(area
->lspdb
[level
- 1]);
1669 area
->lspdb
[level
- 1] = NULL
;
1672 for (int tree
= SPFTREE_IPV4
; tree
< SPFTREE_COUNT
; tree
++) {
1673 if (area
->spftree
[tree
][level
- 1]) {
1674 isis_spftree_del(area
->spftree
[tree
][level
- 1]);
1675 area
->spftree
[tree
][level
- 1] = NULL
;
1679 THREAD_TIMER_OFF(area
->spf_timer
[level
- 1]);
1682 "ISIS (%s): Resigned from L%d - canceling LSP regeneration timer.",
1683 area
->area_tag
, level
);
1684 THREAD_TIMER_OFF(area
->t_lsp_refresh
[level
- 1]);
1685 area
->lsp_regenerate_pending
[level
- 1] = 0;
1688 void isis_area_is_type_set(struct isis_area
*area
, int is_type
)
1690 struct listnode
*node
;
1691 struct isis_circuit
*circuit
;
1693 if (isis
->debugs
& DEBUG_EVENTS
)
1694 zlog_debug("ISIS-Evt (%s) system type change %s -> %s",
1695 area
->area_tag
, circuit_t2string(area
->is_type
),
1696 circuit_t2string(is_type
));
1698 if (area
->is_type
== is_type
)
1699 return; /* No change */
1701 switch (area
->is_type
) {
1703 if (is_type
== IS_LEVEL_2
)
1704 area_resign_level(area
, IS_LEVEL_1
);
1706 if (area
->lspdb
[1] == NULL
)
1707 area
->lspdb
[1] = lsp_db_init();
1710 case IS_LEVEL_1_AND_2
:
1711 if (is_type
== IS_LEVEL_1
)
1712 area_resign_level(area
, IS_LEVEL_2
);
1714 area_resign_level(area
, IS_LEVEL_1
);
1718 if (is_type
== IS_LEVEL_1
)
1719 area_resign_level(area
, IS_LEVEL_2
);
1721 if (area
->lspdb
[0] == NULL
)
1722 area
->lspdb
[0] = lsp_db_init();
1729 area
->is_type
= is_type
;
1731 /* override circuit's is_type */
1732 if (area
->is_type
!= IS_LEVEL_1_AND_2
) {
1733 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1734 isis_circuit_is_type_set(circuit
, is_type
);
1737 spftree_area_init(area
);
1739 if (listcount(area
->area_addrs
) > 0) {
1740 if (is_type
& IS_LEVEL_1
)
1741 lsp_generate(area
, IS_LEVEL_1
);
1742 if (is_type
& IS_LEVEL_2
)
1743 lsp_generate(area
, IS_LEVEL_2
);
1745 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1750 void isis_area_metricstyle_set(struct isis_area
*area
, bool old_metric
,
1753 area
->oldmetric
= old_metric
;
1754 area
->newmetric
= new_metric
;
1755 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1758 void isis_area_overload_bit_set(struct isis_area
*area
, bool overload_bit
)
1760 char new_overload_bit
= overload_bit
? LSPBIT_OL
: 0;
1762 if (new_overload_bit
!= area
->overload_bit
) {
1763 area
->overload_bit
= new_overload_bit
;
1764 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1767 isis_notif_db_overload(area
, overload_bit
);
1768 #endif /* ifndef FABRICD */
1771 void isis_area_attached_bit_set(struct isis_area
*area
, bool attached_bit
)
1773 char new_attached_bit
= attached_bit
? LSPBIT_ATT
: 0;
1775 if (new_attached_bit
!= area
->attached_bit
) {
1776 area
->attached_bit
= new_attached_bit
;
1777 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 1);
1781 void isis_area_dynhostname_set(struct isis_area
*area
, bool dynhostname
)
1783 if (area
->dynhostname
!= dynhostname
) {
1784 area
->dynhostname
= dynhostname
;
1785 lsp_regenerate_schedule(area
, IS_LEVEL_1
| IS_LEVEL_2
, 0);
1789 void isis_area_max_lsp_lifetime_set(struct isis_area
*area
, int level
,
1790 uint16_t max_lsp_lifetime
)
1792 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1794 if (area
->max_lsp_lifetime
[level
- 1] == max_lsp_lifetime
)
1797 area
->max_lsp_lifetime
[level
- 1] = max_lsp_lifetime
;
1798 lsp_regenerate_schedule(area
, level
, 1);
1801 void isis_area_lsp_refresh_set(struct isis_area
*area
, int level
,
1802 uint16_t lsp_refresh
)
1804 assert((level
== IS_LEVEL_1
) || (level
== IS_LEVEL_2
));
1806 if (area
->lsp_refresh
[level
- 1] == lsp_refresh
)
1809 area
->lsp_refresh
[level
- 1] = lsp_refresh
;
1810 lsp_regenerate_schedule(area
, level
, 1);
1814 DEFUN (log_adj_changes
,
1815 log_adj_changes_cmd
,
1816 "log-adjacency-changes",
1817 "Log changes in adjacency state\n")
1819 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1821 area
->log_adj_changes
= 1;
1826 DEFUN (no_log_adj_changes
,
1827 no_log_adj_changes_cmd
,
1828 "no log-adjacency-changes",
1830 "Stop logging changes in adjacency state\n")
1832 VTY_DECLVAR_CONTEXT(isis_area
, area
);
1834 area
->log_adj_changes
= 0;
1838 #endif /* ifdef FABRICD */
1840 /* IS-IS configuration write function */
1841 int isis_config_write(struct vty
*vty
)
1846 struct isis_area
*area
;
1847 struct listnode
*node
, *node2
;
1849 for (ALL_LIST_ELEMENTS_RO(isis
->area_list
, node
, area
)) {
1850 /* ISIS - Area name */
1851 vty_out(vty
, "router " PROTO_NAME
" %s\n", area
->area_tag
);
1854 if (listcount(area
->area_addrs
) > 0) {
1855 struct area_addr
*area_addr
;
1856 for (ALL_LIST_ELEMENTS_RO(area
->area_addrs
,
1857 node2
, area_addr
)) {
1858 vty_out(vty
, " net %s\n",
1860 area_addr
->area_addr
,
1867 /* ISIS - Dynamic hostname - Defaults to true so only
1870 if (!area
->dynhostname
) {
1871 vty_out(vty
, " no hostname dynamic\n");
1874 /* ISIS - Metric-Style - when true displays wide */
1876 if (area
->newmetric
) {
1877 if (!area
->oldmetric
)
1878 vty_out(vty
, " metric-style wide\n");
1881 " metric-style transition\n");
1884 vty_out(vty
, " metric-style narrow\n");
1888 /* ISIS - overload-bit */
1889 if (area
->overload_bit
) {
1890 vty_out(vty
, " set-overload-bit\n");
1893 /* ISIS - Area is-type (level-1-2 is default) */
1895 if (area
->is_type
== IS_LEVEL_1
) {
1896 vty_out(vty
, " is-type level-1\n");
1898 } else if (area
->is_type
== IS_LEVEL_2
) {
1899 vty_out(vty
, " is-type level-2-only\n");
1903 write
+= isis_redist_config_write(vty
, area
, AF_INET
);
1904 write
+= isis_redist_config_write(vty
, area
, AF_INET6
);
1905 /* ISIS - Lsp generation interval */
1906 if (area
->lsp_gen_interval
[0]
1907 == area
->lsp_gen_interval
[1]) {
1908 if (area
->lsp_gen_interval
[0]
1909 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1910 vty_out(vty
, " lsp-gen-interval %d\n",
1911 area
->lsp_gen_interval
[0]);
1915 if (area
->lsp_gen_interval
[0]
1916 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1918 " lsp-gen-interval level-1 %d\n",
1919 area
->lsp_gen_interval
[0]);
1922 if (area
->lsp_gen_interval
[1]
1923 != DEFAULT_MIN_LSP_GEN_INTERVAL
) {
1925 " lsp-gen-interval level-2 %d\n",
1926 area
->lsp_gen_interval
[1]);
1930 /* ISIS - LSP lifetime */
1931 if (area
->max_lsp_lifetime
[0]
1932 == area
->max_lsp_lifetime
[1]) {
1933 if (area
->max_lsp_lifetime
[0]
1934 != DEFAULT_LSP_LIFETIME
) {
1935 vty_out(vty
, " max-lsp-lifetime %u\n",
1936 area
->max_lsp_lifetime
[0]);
1940 if (area
->max_lsp_lifetime
[0]
1941 != DEFAULT_LSP_LIFETIME
) {
1943 " max-lsp-lifetime level-1 %u\n",
1944 area
->max_lsp_lifetime
[0]);
1947 if (area
->max_lsp_lifetime
[1]
1948 != DEFAULT_LSP_LIFETIME
) {
1950 " max-lsp-lifetime level-2 %u\n",
1951 area
->max_lsp_lifetime
[1]);
1955 /* ISIS - LSP refresh interval */
1956 if (area
->lsp_refresh
[0] == area
->lsp_refresh
[1]) {
1957 if (area
->lsp_refresh
[0]
1958 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1960 " lsp-refresh-interval %u\n",
1961 area
->lsp_refresh
[0]);
1965 if (area
->lsp_refresh
[0]
1966 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1968 " lsp-refresh-interval level-1 %u\n",
1969 area
->lsp_refresh
[0]);
1972 if (area
->lsp_refresh
[1]
1973 != DEFAULT_MAX_LSP_GEN_INTERVAL
) {
1975 " lsp-refresh-interval level-2 %u\n",
1976 area
->lsp_refresh
[1]);
1980 if (area
->lsp_mtu
!= DEFAULT_LSP_MTU
) {
1981 vty_out(vty
, " lsp-mtu %u\n", area
->lsp_mtu
);
1984 if (area
->purge_originator
) {
1985 vty_out(vty
, " purge-originator\n");
1989 /* Minimum SPF interval. */
1990 if (area
->min_spf_interval
[0]
1991 == area
->min_spf_interval
[1]) {
1992 if (area
->min_spf_interval
[0]
1993 != MINIMUM_SPF_INTERVAL
) {
1994 vty_out(vty
, " spf-interval %d\n",
1995 area
->min_spf_interval
[0]);
1999 if (area
->min_spf_interval
[0]
2000 != MINIMUM_SPF_INTERVAL
) {
2002 " spf-interval level-1 %d\n",
2003 area
->min_spf_interval
[0]);
2006 if (area
->min_spf_interval
[1]
2007 != MINIMUM_SPF_INTERVAL
) {
2009 " spf-interval level-2 %d\n",
2010 area
->min_spf_interval
[1]);
2015 /* IETF SPF interval */
2016 if (area
->spf_delay_ietf
[0]) {
2018 " spf-delay-ietf init-delay %ld short-delay %ld long-delay %ld holddown %ld time-to-learn %ld\n",
2019 spf_backoff_init_delay(
2020 area
->spf_delay_ietf
[0]),
2021 spf_backoff_short_delay(
2022 area
->spf_delay_ietf
[0]),
2023 spf_backoff_long_delay(
2024 area
->spf_delay_ietf
[0]),
2025 spf_backoff_holddown(
2026 area
->spf_delay_ietf
[0]),
2027 spf_backoff_timetolearn(
2028 area
->spf_delay_ietf
[0]));
2032 /* Authentication passwords. */
2033 if (area
->area_passwd
.type
2034 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2035 vty_out(vty
, " area-password md5 %s",
2036 area
->area_passwd
.passwd
);
2037 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2039 vty_out(vty
, " authenticate snp ");
2041 area
->area_passwd
.snp_auth
,
2043 vty_out(vty
, "validate");
2045 vty_out(vty
, "send-only");
2049 } else if (area
->area_passwd
.type
2050 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2051 vty_out(vty
, " area-password clear %s",
2052 area
->area_passwd
.passwd
);
2053 if (CHECK_FLAG(area
->area_passwd
.snp_auth
,
2055 vty_out(vty
, " authenticate snp ");
2057 area
->area_passwd
.snp_auth
,
2059 vty_out(vty
, "validate");
2061 vty_out(vty
, "send-only");
2066 if (area
->domain_passwd
.type
2067 == ISIS_PASSWD_TYPE_HMAC_MD5
) {
2068 vty_out(vty
, " domain-password md5 %s",
2069 area
->domain_passwd
.passwd
);
2070 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2072 vty_out(vty
, " authenticate snp ");
2073 if (CHECK_FLAG(area
->domain_passwd
2076 vty_out(vty
, "validate");
2078 vty_out(vty
, "send-only");
2082 } else if (area
->domain_passwd
.type
2083 == ISIS_PASSWD_TYPE_CLEARTXT
) {
2084 vty_out(vty
, " domain-password clear %s",
2085 area
->domain_passwd
.passwd
);
2086 if (CHECK_FLAG(area
->domain_passwd
.snp_auth
,
2088 vty_out(vty
, " authenticate snp ");
2089 if (CHECK_FLAG(area
->domain_passwd
2092 vty_out(vty
, "validate");
2094 vty_out(vty
, "send-only");
2100 if (area
->log_adj_changes
) {
2101 vty_out(vty
, " log-adjacency-changes\n");
2105 write
+= area_write_mt_settings(area
, vty
);
2106 write
+= fabricd_write_settings(area
, vty
);
2108 isis_mpls_te_config_write_router(vty
);
2115 /* IS-IS configuration write function */
2116 int isis_config_write(struct vty
*vty
)
2119 struct lyd_node
*dnode
;
2121 dnode
= yang_dnode_get(running_config
->dnode
, "/frr-isisd:isis");
2123 nb_cli_show_dnode_cmds(vty
, dnode
, false);
2127 #endif /* ifdef FABRICD */
2129 struct cmd_node router_node
= {ROUTER_NODE
, "%s(config-router)# ", 1};
2133 /* Install IS-IS top node */
2134 install_node(&router_node
, isis_config_write
);
2136 install_element(VIEW_NODE
, &show_isis_summary_cmd
);
2138 install_element(VIEW_NODE
, &show_isis_spf_ietf_cmd
);
2140 install_element(VIEW_NODE
, &show_isis_interface_cmd
);
2141 install_element(VIEW_NODE
, &show_isis_interface_detail_cmd
);
2142 install_element(VIEW_NODE
, &show_isis_interface_arg_cmd
);
2144 install_element(VIEW_NODE
, &show_isis_neighbor_cmd
);
2145 install_element(VIEW_NODE
, &show_isis_neighbor_detail_cmd
);
2146 install_element(VIEW_NODE
, &show_isis_neighbor_arg_cmd
);
2147 install_element(VIEW_NODE
, &clear_isis_neighbor_cmd
);
2148 install_element(VIEW_NODE
, &clear_isis_neighbor_arg_cmd
);
2150 install_element(VIEW_NODE
, &show_hostname_cmd
);
2151 install_element(VIEW_NODE
, &show_database_cmd
);
2153 install_element(ENABLE_NODE
, &show_debugging_isis_cmd
);
2155 install_node(&debug_node
, config_write_debug
);
2157 install_element(ENABLE_NODE
, &debug_isis_adj_cmd
);
2158 install_element(ENABLE_NODE
, &no_debug_isis_adj_cmd
);
2159 install_element(ENABLE_NODE
, &debug_isis_tx_queue_cmd
);
2160 install_element(ENABLE_NODE
, &no_debug_isis_tx_queue_cmd
);
2161 install_element(ENABLE_NODE
, &debug_isis_flooding_cmd
);
2162 install_element(ENABLE_NODE
, &no_debug_isis_flooding_cmd
);
2163 install_element(ENABLE_NODE
, &debug_isis_snp_cmd
);
2164 install_element(ENABLE_NODE
, &no_debug_isis_snp_cmd
);
2165 install_element(ENABLE_NODE
, &debug_isis_upd_cmd
);
2166 install_element(ENABLE_NODE
, &no_debug_isis_upd_cmd
);
2167 install_element(ENABLE_NODE
, &debug_isis_spfevents_cmd
);
2168 install_element(ENABLE_NODE
, &no_debug_isis_spfevents_cmd
);
2169 install_element(ENABLE_NODE
, &debug_isis_rtevents_cmd
);
2170 install_element(ENABLE_NODE
, &no_debug_isis_rtevents_cmd
);
2171 install_element(ENABLE_NODE
, &debug_isis_events_cmd
);
2172 install_element(ENABLE_NODE
, &no_debug_isis_events_cmd
);
2173 install_element(ENABLE_NODE
, &debug_isis_packet_dump_cmd
);
2174 install_element(ENABLE_NODE
, &no_debug_isis_packet_dump_cmd
);
2175 install_element(ENABLE_NODE
, &debug_isis_lsp_gen_cmd
);
2176 install_element(ENABLE_NODE
, &no_debug_isis_lsp_gen_cmd
);
2177 install_element(ENABLE_NODE
, &debug_isis_lsp_sched_cmd
);
2178 install_element(ENABLE_NODE
, &no_debug_isis_lsp_sched_cmd
);
2179 install_element(ENABLE_NODE
, &debug_isis_bfd_cmd
);
2180 install_element(ENABLE_NODE
, &no_debug_isis_bfd_cmd
);
2182 install_element(CONFIG_NODE
, &debug_isis_adj_cmd
);
2183 install_element(CONFIG_NODE
, &no_debug_isis_adj_cmd
);
2184 install_element(CONFIG_NODE
, &debug_isis_tx_queue_cmd
);
2185 install_element(CONFIG_NODE
, &no_debug_isis_tx_queue_cmd
);
2186 install_element(CONFIG_NODE
, &debug_isis_flooding_cmd
);
2187 install_element(CONFIG_NODE
, &no_debug_isis_flooding_cmd
);
2188 install_element(CONFIG_NODE
, &debug_isis_snp_cmd
);
2189 install_element(CONFIG_NODE
, &no_debug_isis_snp_cmd
);
2190 install_element(CONFIG_NODE
, &debug_isis_upd_cmd
);
2191 install_element(CONFIG_NODE
, &no_debug_isis_upd_cmd
);
2192 install_element(CONFIG_NODE
, &debug_isis_spfevents_cmd
);
2193 install_element(CONFIG_NODE
, &no_debug_isis_spfevents_cmd
);
2194 install_element(CONFIG_NODE
, &debug_isis_rtevents_cmd
);
2195 install_element(CONFIG_NODE
, &no_debug_isis_rtevents_cmd
);
2196 install_element(CONFIG_NODE
, &debug_isis_events_cmd
);
2197 install_element(CONFIG_NODE
, &no_debug_isis_events_cmd
);
2198 install_element(CONFIG_NODE
, &debug_isis_packet_dump_cmd
);
2199 install_element(CONFIG_NODE
, &no_debug_isis_packet_dump_cmd
);
2200 install_element(CONFIG_NODE
, &debug_isis_lsp_gen_cmd
);
2201 install_element(CONFIG_NODE
, &no_debug_isis_lsp_gen_cmd
);
2202 install_element(CONFIG_NODE
, &debug_isis_lsp_sched_cmd
);
2203 install_element(CONFIG_NODE
, &no_debug_isis_lsp_sched_cmd
);
2204 install_element(CONFIG_NODE
, &debug_isis_bfd_cmd
);
2205 install_element(CONFIG_NODE
, &no_debug_isis_bfd_cmd
);
2207 install_default(ROUTER_NODE
);
2210 install_element(CONFIG_NODE
, &router_openfabric_cmd
);
2211 install_element(CONFIG_NODE
, &no_router_openfabric_cmd
);
2213 install_element(ROUTER_NODE
, &net_cmd
);
2214 install_element(ROUTER_NODE
, &no_net_cmd
);
2216 install_element(ROUTER_NODE
, &isis_topology_cmd
);
2217 install_element(ROUTER_NODE
, &no_isis_topology_cmd
);
2219 install_element(ROUTER_NODE
, &log_adj_changes_cmd
);
2220 install_element(ROUTER_NODE
, &no_log_adj_changes_cmd
);
2221 #endif /* ifdef FABRICD */
2223 spf_backoff_cmd_init();