2 * IS-IS Rout(e)ing protocol - isis_vty_common.c
4 * This file contains the CLI that is shared between OpenFabric and IS-IS
6 * Copyright (C) 2001,2002 Sampo Saaristo
7 * Tampere University of Technology
8 * Institute of Communications Engineering
9 * Copyright (C) 2016 David Lamparter, for NetDEF, Inc.
10 * Copyright (C) 2018 Christian Franke, for NetDEF, Inc.
12 * This program is free software; you can redistribute it and/or modify it
13 * under the terms of the GNU General Public Licenseas published by the Free
14 * Software Foundation; either version 2 of the License, or (at your option)
17 * This program is distributed in the hope that it will be useful,but WITHOUT
18 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
19 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
22 * You should have received a copy of the GNU General Public License along
23 * with this program; see the file COPYING; if not, write to the Free Software
24 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
30 #include "spf_backoff.h"
32 #include "isis_circuit.h"
34 #include "isis_misc.h"
37 #include "isis_vty_common.h"
39 struct isis_circuit
*isis_circuit_lookup(struct vty
*vty
)
41 struct interface
*ifp
= VTY_GET_CONTEXT(interface
);
42 struct isis_circuit
*circuit
;
45 vty_out(vty
, "Invalid interface \n");
49 circuit
= circuit_scan_by_ifp(ifp
);
51 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
58 DEFUN (ip_router_isis
,
60 "ip router " PROTO_NAME
" WORD",
61 "Interface Internet Protocol config commands\n"
62 "IP router interface commands\n"
64 "Routing process tag\n")
68 VTY_DECLVAR_CONTEXT(interface
, ifp
);
69 struct isis_circuit
*circuit
;
70 struct isis_area
*area
;
71 const char *af
= argv
[idx_afi
]->arg
;
72 const char *area_tag
= argv
[idx_word
]->arg
;
74 /* Prevent more than one area per circuit */
75 circuit
= circuit_scan_by_ifp(ifp
);
76 if (circuit
&& circuit
->area
) {
77 if (strcmp(circuit
->area
->area_tag
, area_tag
)) {
78 vty_out(vty
, "ISIS circuit is already defined on %s\n",
79 circuit
->area
->area_tag
);
80 return CMD_ERR_NOTHING_TODO
;
84 area
= isis_area_lookup(area_tag
);
86 area
= isis_area_create(area_tag
);
88 if (!circuit
|| !circuit
->area
) {
89 circuit
= isis_circuit_create(area
, ifp
);
91 if (circuit
->state
!= C_STATE_CONF
92 && circuit
->state
!= C_STATE_UP
) {
94 "Couldn't bring up interface, please check log.\n");
95 return CMD_WARNING_CONFIG_FAILED
;
99 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
105 isis_circuit_af_set(circuit
, ip
, ipv6
);
109 DEFUN (ip6_router_isis
,
111 "ipv6 router " PROTO_NAME
" WORD",
112 "Interface Internet Protocol config commands\n"
113 "IP router interface commands\n"
115 "Routing process tag\n")
117 return ip_router_isis(self
, vty
, argc
, argv
);
120 DEFUN (no_ip_router_isis
,
121 no_ip_router_isis_cmd
,
122 "no <ip|ipv6> router " PROTO_NAME
" WORD",
124 "Interface Internet Protocol config commands\n"
125 "IP router interface commands\n"
126 "IP router interface commands\n"
128 "Routing process tag\n")
132 VTY_DECLVAR_CONTEXT(interface
, ifp
);
133 struct isis_area
*area
;
134 struct isis_circuit
*circuit
;
135 const char *af
= argv
[idx_afi
]->arg
;
136 const char *area_tag
= argv
[idx_word
]->arg
;
138 area
= isis_area_lookup(area_tag
);
140 vty_out(vty
, "Can't find ISIS instance %s\n",
142 return CMD_ERR_NO_MATCH
;
145 circuit
= circuit_lookup_by_ifp(ifp
, area
->circuit_list
);
147 vty_out(vty
, "ISIS is not enabled on circuit %s\n", ifp
->name
);
148 return CMD_ERR_NO_MATCH
;
151 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
157 isis_circuit_af_set(circuit
, ip
, ipv6
);
163 PROTO_NAME
" passive",
165 "Configure the passive mode for interface\n")
167 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
169 return CMD_ERR_NO_MATCH
;
171 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 1),
172 "Cannot set passive: $ERR");
176 DEFUN (no_isis_passive
,
178 "no " PROTO_NAME
" passive",
181 "Configure the passive mode for interface\n")
183 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
185 return CMD_ERR_NO_MATCH
;
187 CMD_FERR_RETURN(isis_circuit_passive_set(circuit
, 0),
188 "Cannot set no passive: $ERR");
194 PROTO_NAME
" password <md5|clear> WORD",
196 "Configure the authentication password for a circuit\n"
197 "HMAC-MD5 authentication\n"
198 "Cleartext password\n"
199 "Circuit password\n")
201 int idx_encryption
= 2;
203 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
207 return CMD_ERR_NO_MATCH
;
209 if (argv
[idx_encryption
]->arg
[0] == 'm')
210 rv
= isis_circuit_passwd_hmac_md5_set(circuit
,
211 argv
[idx_word
]->arg
);
213 rv
= isis_circuit_passwd_cleartext_set(circuit
,
214 argv
[idx_word
]->arg
);
216 CMD_FERR_RETURN(rv
, "Failed to set circuit password: $ERR");
220 DEFUN (no_isis_passwd
,
222 "no " PROTO_NAME
" password [<md5|clear> WORD]",
225 "Configure the authentication password for a circuit\n"
226 "HMAC-MD5 authentication\n"
227 "Cleartext password\n"
228 "Circuit password\n")
230 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
232 return CMD_ERR_NO_MATCH
;
234 CMD_FERR_RETURN(isis_circuit_passwd_unset(circuit
),
235 "Failed to unset circuit password: $ERR");
241 PROTO_NAME
" metric (0-16777215)",
243 "Set default metric for circuit\n"
244 "Default metric value\n")
248 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
250 return CMD_ERR_NO_MATCH
;
252 met
= atoi(argv
[idx_number
]->arg
);
254 /* RFC3787 section 5.1 */
255 if (circuit
->area
&& circuit
->area
->oldmetric
== 1
256 && met
> MAX_NARROW_LINK_METRIC
) {
258 "Invalid metric %d - should be <0-63> "
259 "when narrow metric type enabled\n",
261 return CMD_WARNING_CONFIG_FAILED
;
265 if (circuit
->area
&& circuit
->area
->newmetric
== 1
266 && met
> MAX_WIDE_LINK_METRIC
) {
268 "Invalid metric %d - should be <0-16777215> "
269 "when wide metric type enabled\n",
271 return CMD_WARNING_CONFIG_FAILED
;
274 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
, met
),
275 "Failed to set L1 metric: $ERR");
276 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
, met
),
277 "Failed to set L2 metric: $ERR");
281 DEFUN (no_isis_metric
,
283 "no " PROTO_NAME
" metric [(0-16777215)]",
286 "Set default metric for circuit\n"
287 "Default metric value\n")
289 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
291 return CMD_ERR_NO_MATCH
;
293 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_1
,
294 DEFAULT_CIRCUIT_METRIC
),
295 "Failed to set L1 metric: $ERR");
296 CMD_FERR_RETURN(isis_circuit_metric_set(circuit
, IS_LEVEL_2
,
297 DEFAULT_CIRCUIT_METRIC
),
298 "Failed to set L2 metric: $ERR");
302 DEFUN (isis_hello_interval
,
303 isis_hello_interval_cmd
,
304 PROTO_NAME
" hello-interval (1-600)",
306 "Set Hello interval\n"
307 "Holdtime 1 seconds, interval depends on multiplier\n")
309 uint32_t interval
= atoi(argv
[2]->arg
);
310 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
312 return CMD_ERR_NO_MATCH
;
314 circuit
->hello_interval
[0] = interval
;
315 circuit
->hello_interval
[1] = interval
;
320 DEFUN (no_isis_hello_interval
,
321 no_isis_hello_interval_cmd
,
322 "no " PROTO_NAME
" hello-interval [(1-600)]",
325 "Set Hello interval\n"
326 "Holdtime 1 second, interval depends on multiplier\n")
328 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
330 return CMD_ERR_NO_MATCH
;
332 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
333 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
338 DEFUN (isis_hello_multiplier
,
339 isis_hello_multiplier_cmd
,
340 PROTO_NAME
" hello-multiplier (2-100)",
342 "Set multiplier for Hello holding time\n"
343 "Hello multiplier value\n")
345 uint16_t mult
= atoi(argv
[2]->arg
);
346 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
348 return CMD_ERR_NO_MATCH
;
350 circuit
->hello_multiplier
[0] = mult
;
351 circuit
->hello_multiplier
[1] = mult
;
356 DEFUN (no_isis_hello_multiplier
,
357 no_isis_hello_multiplier_cmd
,
358 "no " PROTO_NAME
" hello-multiplier [(2-100)]",
361 "Set multiplier for Hello holding time\n"
362 "Hello multiplier value\n")
364 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
366 return CMD_ERR_NO_MATCH
;
368 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
369 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
374 DEFUN (csnp_interval
,
376 PROTO_NAME
" csnp-interval (1-600)",
378 "Set CSNP interval in seconds\n"
379 "CSNP interval value\n")
381 uint16_t interval
= atoi(argv
[2]->arg
);
382 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
384 return CMD_ERR_NO_MATCH
;
386 circuit
->csnp_interval
[0] = interval
;
387 circuit
->csnp_interval
[1] = interval
;
392 DEFUN (no_csnp_interval
,
393 no_csnp_interval_cmd
,
394 "no " PROTO_NAME
" csnp-interval [(1-600)]",
397 "Set CSNP interval in seconds\n"
398 "CSNP interval value\n")
400 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
402 return CMD_ERR_NO_MATCH
;
404 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
405 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
410 DEFUN (psnp_interval
,
412 PROTO_NAME
" psnp-interval (1-120)",
414 "Set PSNP interval in seconds\n"
415 "PSNP interval value\n")
417 uint16_t interval
= atoi(argv
[2]->arg
);
418 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
420 return CMD_ERR_NO_MATCH
;
422 circuit
->psnp_interval
[0] = interval
;
423 circuit
->psnp_interval
[1] = interval
;
428 DEFUN (no_psnp_interval
,
429 no_psnp_interval_cmd
,
430 "no " PROTO_NAME
" psnp-interval [(1-120)]",
433 "Set PSNP interval in seconds\n"
434 "PSNP interval value\n")
436 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
438 return CMD_ERR_NO_MATCH
;
440 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
441 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
446 DEFUN (circuit_topology
,
447 circuit_topology_cmd
,
448 PROTO_NAME
" topology " ISIS_MT_NAMES
,
450 "Configure interface IS-IS topologies\n"
451 ISIS_MT_DESCRIPTIONS
)
453 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
455 return CMD_ERR_NO_MATCH
;
456 const char *arg
= argv
[2]->arg
;
457 uint16_t mtid
= isis_str2mtid(arg
);
459 if (circuit
->area
&& circuit
->area
->oldmetric
) {
461 "Multi topology IS-IS can only be used with wide metrics\n");
462 return CMD_WARNING_CONFIG_FAILED
;
465 if (mtid
== (uint16_t)-1) {
466 vty_out(vty
, "Don't know topology '%s'\n", arg
);
467 return CMD_WARNING_CONFIG_FAILED
;
470 return isis_circuit_mt_enabled_set(circuit
, mtid
, true);
473 DEFUN (no_circuit_topology
,
474 no_circuit_topology_cmd
,
475 "no " PROTO_NAME
" topology " ISIS_MT_NAMES
,
478 "Configure interface IS-IS topologies\n"
479 ISIS_MT_DESCRIPTIONS
)
481 struct isis_circuit
*circuit
= isis_circuit_lookup(vty
);
483 return CMD_ERR_NO_MATCH
;
484 const char *arg
= argv
[3]->arg
;
485 uint16_t mtid
= isis_str2mtid(arg
);
487 if (circuit
->area
&& circuit
->area
->oldmetric
) {
489 "Multi topology IS-IS can only be used with wide metrics\n");
490 return CMD_WARNING_CONFIG_FAILED
;
493 if (mtid
== (uint16_t)-1) {
494 vty_out(vty
, "Don't know topology '%s'\n", arg
);
495 return CMD_WARNING_CONFIG_FAILED
;
498 return isis_circuit_mt_enabled_set(circuit
, mtid
, false);
501 DEFUN (set_overload_bit
,
502 set_overload_bit_cmd
,
504 "Set overload bit to avoid any transit traffic\n")
506 VTY_DECLVAR_CONTEXT(isis_area
, area
);
508 isis_area_overload_bit_set(area
, true);
512 DEFUN (no_set_overload_bit
,
513 no_set_overload_bit_cmd
,
514 "no set-overload-bit",
515 "Reset overload bit to accept transit traffic\n"
516 "Reset overload bit\n")
518 VTY_DECLVAR_CONTEXT(isis_area
, area
);
520 isis_area_overload_bit_set(area
, false);
524 static int isis_vty_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
526 VTY_DECLVAR_CONTEXT(isis_area
, area
);
527 struct listnode
*node
;
528 struct isis_circuit
*circuit
;
530 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
)) {
531 if (circuit
->state
!= C_STATE_INIT
532 && circuit
->state
!= C_STATE_UP
)
534 if (lsp_mtu
> isis_circuit_pdu_size(circuit
)) {
536 "ISIS area contains circuit %s, which has a maximum PDU size of %zu.\n",
537 circuit
->interface
->name
,
538 isis_circuit_pdu_size(circuit
));
539 return CMD_WARNING_CONFIG_FAILED
;
543 isis_area_lsp_mtu_set(area
, lsp_mtu
);
549 "lsp-mtu (128-4352)",
550 "Configure the maximum size of generated LSPs\n"
551 "Maximum size of generated LSPs\n")
554 unsigned int lsp_mtu
;
556 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
558 return isis_vty_lsp_mtu_set(vty
, lsp_mtu
);
561 DEFUN (no_area_lsp_mtu
,
563 "no lsp-mtu [(128-4352)]",
565 "Configure the maximum size of generated LSPs\n"
566 "Maximum size of generated LSPs\n")
568 return isis_vty_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
571 DEFUN (area_purge_originator
,
572 area_purge_originator_cmd
,
573 "[no] purge-originator",
575 "Use the RFC 6232 purge-originator\n")
577 VTY_DECLVAR_CONTEXT(isis_area
, area
);
579 area
->purge_originator
= !!strcmp(argv
[0]->text
, "no");
583 int isis_vty_lsp_gen_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
585 VTY_DECLVAR_CONTEXT(isis_area
, area
);
588 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
592 if (interval
>= area
->lsp_refresh
[lvl
- 1]) {
594 "LSP gen interval %us must be less than "
595 "the LSP refresh interval %us\n",
596 interval
, area
->lsp_refresh
[lvl
- 1]);
597 return CMD_WARNING_CONFIG_FAILED
;
601 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
604 area
->lsp_gen_interval
[lvl
- 1] = interval
;
610 DEFUN (lsp_gen_interval
,
611 lsp_gen_interval_cmd
,
612 "lsp-gen-interval (1-120)",
613 "Minimum interval between regenerating same LSP\n"
614 "Minimum interval in seconds\n")
616 uint16_t interval
= atoi(argv
[1]->arg
);
618 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
, interval
);
621 DEFUN (no_lsp_gen_interval
,
622 no_lsp_gen_interval_cmd
,
623 "no lsp-gen-interval [(1-120)]",
625 "Minimum interval between regenerating same LSP\n"
626 "Minimum interval in seconds\n")
628 VTY_DECLVAR_CONTEXT(isis_area
, area
);
630 return isis_vty_lsp_gen_interval_set(vty
, IS_LEVEL_1_AND_2
,
631 DEFAULT_MIN_LSP_GEN_INTERVAL
);
636 "spf-interval (1-120)",
637 "Minimum interval between SPF calculations\n"
638 "Minimum interval between consecutive SPFs in seconds\n")
640 VTY_DECLVAR_CONTEXT(isis_area
, area
);
641 uint16_t interval
= atoi(argv
[1]->arg
);
643 area
->min_spf_interval
[0] = interval
;
644 area
->min_spf_interval
[1] = interval
;
649 DEFUN (no_spf_interval
,
651 "no spf-interval [(1-120)]",
653 "Minimum interval between SPF calculations\n"
654 "Minimum interval between consecutive SPFs in seconds\n")
656 VTY_DECLVAR_CONTEXT(isis_area
, area
);
658 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
659 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
664 DEFUN (no_spf_delay_ietf
,
665 no_spf_delay_ietf_cmd
,
668 "IETF SPF delay algorithm\n")
670 VTY_DECLVAR_CONTEXT(isis_area
, area
);
672 spf_backoff_free(area
->spf_delay_ietf
[0]);
673 spf_backoff_free(area
->spf_delay_ietf
[1]);
674 area
->spf_delay_ietf
[0] = NULL
;
675 area
->spf_delay_ietf
[1] = NULL
;
680 DEFUN (spf_delay_ietf
,
682 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
683 "IETF SPF delay algorithm\n"
684 "Delay used while in QUIET state\n"
685 "Delay used while in QUIET state in milliseconds\n"
686 "Delay used while in SHORT_WAIT state\n"
687 "Delay used while in SHORT_WAIT state in milliseconds\n"
688 "Delay used while in LONG_WAIT\n"
689 "Delay used while in LONG_WAIT state in milliseconds\n"
690 "Time with no received IGP events before considering IGP stable\n"
691 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
692 "Maximum duration needed to learn all the events related to a single failure\n"
693 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
695 VTY_DECLVAR_CONTEXT(isis_area
, area
);
697 long init_delay
= atol(argv
[2]->arg
);
698 long short_delay
= atol(argv
[4]->arg
);
699 long long_delay
= atol(argv
[6]->arg
);
700 long holddown
= atol(argv
[8]->arg
);
701 long timetolearn
= atol(argv
[10]->arg
);
703 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
704 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
706 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
707 spf_backoff_free(area
->spf_delay_ietf
[0]);
708 area
->spf_delay_ietf
[0] =
709 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
710 long_delay
, holddown
, timetolearn
);
712 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
713 spf_backoff_free(area
->spf_delay_ietf
[1]);
714 area
->spf_delay_ietf
[1] =
715 spf_backoff_new(master
, buf
, init_delay
, short_delay
,
716 long_delay
, holddown
, timetolearn
);
718 XFREE(MTYPE_TMP
, buf
);
722 int isis_vty_max_lsp_lifetime_set(struct vty
*vty
, int level
, uint16_t interval
)
724 VTY_DECLVAR_CONTEXT(isis_area
, area
);
726 uint16_t refresh_interval
= interval
- 300;
727 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
729 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
733 if (refresh_interval
< area
->lsp_refresh
[lvl
- 1]) {
735 "Level %d Max LSP lifetime %us must be 300s greater than "
736 "the configured LSP refresh interval %us\n",
737 lvl
, interval
, area
->lsp_refresh
[lvl
- 1]);
739 "Automatically reducing level %d LSP refresh interval "
741 lvl
, refresh_interval
);
742 set_refresh_interval
[lvl
- 1] = 1;
745 <= area
->lsp_gen_interval
[lvl
- 1]) {
747 "LSP refresh interval %us must be greater than "
748 "the configured LSP gen interval %us\n",
750 area
->lsp_gen_interval
[lvl
- 1]);
751 return CMD_WARNING_CONFIG_FAILED
;
756 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++) {
759 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
760 if (set_refresh_interval
[lvl
- 1])
761 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
767 DEFUN (max_lsp_lifetime
,
768 max_lsp_lifetime_cmd
,
769 "max-lsp-lifetime (350-65535)",
770 "Maximum LSP lifetime\n"
771 "LSP lifetime in seconds\n")
773 int lifetime
= atoi(argv
[1]->arg
);
775 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
, lifetime
);
779 DEFUN (no_max_lsp_lifetime
,
780 no_max_lsp_lifetime_cmd
,
781 "no max-lsp-lifetime [(350-65535)]",
783 "Maximum LSP lifetime\n"
784 "LSP lifetime in seconds\n")
786 return isis_vty_max_lsp_lifetime_set(vty
, IS_LEVEL_1_AND_2
,
787 DEFAULT_LSP_LIFETIME
);
790 int isis_vty_lsp_refresh_set(struct vty
*vty
, int level
, uint16_t interval
)
792 VTY_DECLVAR_CONTEXT(isis_area
, area
);
795 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
798 if (interval
<= area
->lsp_gen_interval
[lvl
- 1]) {
800 "LSP refresh interval %us must be greater than "
801 "the configured LSP gen interval %us\n",
802 interval
, area
->lsp_gen_interval
[lvl
- 1]);
803 return CMD_WARNING_CONFIG_FAILED
;
805 if (interval
> (area
->max_lsp_lifetime
[lvl
- 1] - 300)) {
807 "LSP refresh interval %us must be less than "
808 "the configured LSP lifetime %us less 300\n",
809 interval
, area
->max_lsp_lifetime
[lvl
- 1]);
810 return CMD_WARNING_CONFIG_FAILED
;
814 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
) {
817 isis_area_lsp_refresh_set(area
, lvl
, interval
);
823 DEFUN (lsp_refresh_interval
,
824 lsp_refresh_interval_cmd
,
825 "lsp-refresh-interval (1-65235)",
826 "LSP refresh interval\n"
827 "LSP refresh interval in seconds\n")
829 unsigned int interval
= atoi(argv
[1]->arg
);
830 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
, interval
);
833 DEFUN (no_lsp_refresh_interval
,
834 no_lsp_refresh_interval_cmd
,
835 "no lsp-refresh-interval [(1-65235)]",
837 "LSP refresh interval\n"
838 "LSP refresh interval in seconds\n")
840 return isis_vty_lsp_refresh_set(vty
, IS_LEVEL_1_AND_2
,
841 DEFAULT_MAX_LSP_GEN_INTERVAL
);
844 int isis_vty_password_set(struct vty
*vty
, int argc
,
845 struct cmd_token
*argv
[], int level
)
847 VTY_DECLVAR_CONTEXT(isis_area
, area
);
850 int idx_password
= 2;
851 int idx_snp_auth
= 5;
852 uint8_t snp_auth
= 0;
854 const char *passwd
= argv
[idx_password
]->arg
;
855 if (strlen(passwd
) > 254) {
856 vty_out(vty
, "Too long area password (>254)\n");
857 return CMD_WARNING_CONFIG_FAILED
;
860 if (argc
> idx_snp_auth
) {
861 snp_auth
= SNP_AUTH_SEND
;
862 if (strmatch(argv
[idx_snp_auth
]->text
, "validate"))
863 snp_auth
|= SNP_AUTH_RECV
;
866 if (strmatch(argv
[idx_algo
]->text
, "clear")) {
867 return isis_area_passwd_cleartext_set(area
, level
,
869 } else if (strmatch(argv
[idx_algo
]->text
, "md5")) {
870 return isis_area_passwd_hmac_md5_set(area
, level
,
874 return CMD_WARNING_CONFIG_FAILED
;
877 DEFUN (domain_passwd
,
879 "domain-password <clear|md5> WORD [authenticate snp <send-only|validate>]",
880 "Set the authentication password for a routing domain\n"
881 "Authentication type\n"
882 "Authentication type\n"
883 "Level-wide password\n"
886 "Send but do not check PDUs on receiving\n"
887 "Send and check PDUs on receiving\n")
889 return isis_vty_password_set(vty
, argc
, argv
, IS_LEVEL_2
);
892 DEFUN (no_domain_passwd
,
893 no_domain_passwd_cmd
,
894 "no domain-password",
896 "Set the authentication password for a routing domain\n")
898 VTY_DECLVAR_CONTEXT(isis_area
, area
);
900 return isis_area_passwd_unset(area
, IS_LEVEL_2
);
903 void isis_vty_init(void)
905 install_element(INTERFACE_NODE
, &ip_router_isis_cmd
);
906 install_element(INTERFACE_NODE
, &ip6_router_isis_cmd
);
907 install_element(INTERFACE_NODE
, &no_ip_router_isis_cmd
);
909 install_element(INTERFACE_NODE
, &isis_passive_cmd
);
910 install_element(INTERFACE_NODE
, &no_isis_passive_cmd
);
912 install_element(INTERFACE_NODE
, &isis_passwd_cmd
);
913 install_element(INTERFACE_NODE
, &no_isis_passwd_cmd
);
915 install_element(INTERFACE_NODE
, &isis_metric_cmd
);
916 install_element(INTERFACE_NODE
, &no_isis_metric_cmd
);
918 install_element(INTERFACE_NODE
, &isis_hello_interval_cmd
);
919 install_element(INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
921 install_element(INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
922 install_element(INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
924 install_element(INTERFACE_NODE
, &csnp_interval_cmd
);
925 install_element(INTERFACE_NODE
, &no_csnp_interval_cmd
);
927 install_element(INTERFACE_NODE
, &psnp_interval_cmd
);
928 install_element(INTERFACE_NODE
, &no_psnp_interval_cmd
);
930 install_element(INTERFACE_NODE
, &circuit_topology_cmd
);
931 install_element(INTERFACE_NODE
, &no_circuit_topology_cmd
);
933 install_element(ROUTER_NODE
, &set_overload_bit_cmd
);
934 install_element(ROUTER_NODE
, &no_set_overload_bit_cmd
);
936 install_element(ROUTER_NODE
, &area_lsp_mtu_cmd
);
937 install_element(ROUTER_NODE
, &no_area_lsp_mtu_cmd
);
939 install_element(ROUTER_NODE
, &area_purge_originator_cmd
);
941 install_element(ROUTER_NODE
, &lsp_gen_interval_cmd
);
942 install_element(ROUTER_NODE
, &no_lsp_gen_interval_cmd
);
944 install_element(ROUTER_NODE
, &spf_interval_cmd
);
945 install_element(ROUTER_NODE
, &no_spf_interval_cmd
);
947 install_element(ROUTER_NODE
, &max_lsp_lifetime_cmd
);
948 install_element(ROUTER_NODE
, &no_max_lsp_lifetime_cmd
);
950 install_element(ROUTER_NODE
, &lsp_refresh_interval_cmd
);
951 install_element(ROUTER_NODE
, &no_lsp_refresh_interval_cmd
);
953 install_element(ROUTER_NODE
, &domain_passwd_cmd
);
954 install_element(ROUTER_NODE
, &no_domain_passwd_cmd
);
956 install_element(ROUTER_NODE
, &spf_delay_ietf_cmd
);
957 install_element(ROUTER_NODE
, &no_spf_delay_ietf_cmd
);
959 isis_vty_daemon_init();