2 * IS-IS Rout(e)ing protocol - isis_circuit.h
4 * Copyright (C) 2001,2002 Sampo Saaristo
5 * Tampere University of Technology
6 * Institute of Communications Engineering
7 * Copyright (C) 2016 David Lamparter, for NetDEF, Inc.
9 * This program is free software; you can redistribute it and/or modify it
10 * under the terms of the GNU General Public Licenseas published by the Free
11 * Software Foundation; either version 2 of the License, or (at your option)
14 * This program is distributed in the hope that it will be useful,but WITHOUT
15 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
16 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
19 * You should have received a copy of the GNU General Public License along
20 * with this program; see the file COPYING; if not, write to the Free Software
21 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
27 #include "spf_backoff.h"
29 #include "isis_circuit.h"
31 #include "isis_misc.h"
35 static struct isis_circuit
*
36 isis_circuit_lookup (struct vty
*vty
)
38 struct interface
*ifp
= VTY_GET_CONTEXT(interface
);
39 struct isis_circuit
*circuit
;
43 vty_outln (vty
, "Invalid interface ");
47 circuit
= circuit_scan_by_ifp (ifp
);
50 vty_outln (vty
, "ISIS is not enabled on circuit %s",
58 DEFUN (ip_router_isis
,
60 "ip router isis WORD",
61 "Interface Internet Protocol config commands\n"
62 "IP router interface commands\n"
63 "IS-IS Routing for IP\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
)
78 if (strcmp (circuit
->area
->area_tag
, area_tag
))
80 vty_outln (vty
, "ISIS circuit is already defined on %s",
81 circuit
->area
->area_tag
);
82 return CMD_ERR_NOTHING_TODO
;
86 area
= isis_area_lookup (area_tag
);
88 area
= isis_area_create (area_tag
);
90 if (!circuit
|| !circuit
->area
) {
91 circuit
= isis_circuit_create (area
, ifp
);
93 if (circuit
->state
!= C_STATE_CONF
&& circuit
->state
!= C_STATE_UP
)
95 vty_outln (vty
, "Couldn't bring up interface, please check log.");
100 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
106 isis_circuit_af_set (circuit
, ip
, ipv6
);
110 DEFUN (ip6_router_isis
,
112 "ipv6 router isis WORD",
113 "Interface Internet Protocol config commands\n"
114 "IP router interface commands\n"
115 "IS-IS Routing for IP\n"
116 "Routing process tag\n")
118 return ip_router_isis (self
, vty
, argc
, argv
);
121 DEFUN (no_ip_router_isis
,
122 no_ip_router_isis_cmd
,
123 "no <ip|ipv6> router isis WORD",
125 "Interface Internet Protocol config commands\n"
126 "IP router interface commands\n"
127 "IP router interface commands\n"
128 "IS-IS Routing for IP\n"
129 "Routing process tag\n")
133 VTY_DECLVAR_CONTEXT (interface
, ifp
);
134 struct isis_area
*area
;
135 struct isis_circuit
*circuit
;
136 const char *af
= argv
[idx_afi
]->arg
;
137 const char *area_tag
= argv
[idx_word
]->arg
;
139 area
= isis_area_lookup (area_tag
);
142 vty_outln (vty
, "Can't find ISIS instance %s",
144 return CMD_ERR_NO_MATCH
;
147 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
150 vty_outln (vty
, "ISIS is not enabled on circuit %s",
152 return CMD_ERR_NO_MATCH
;
155 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
161 isis_circuit_af_set (circuit
, ip
, ipv6
);
169 "Configure the passive mode for interface\n")
171 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
173 return CMD_ERR_NO_MATCH
;
175 isis_circuit_passive_set (circuit
, 1);
179 DEFUN (no_isis_passive
,
184 "Configure the passive mode for interface\n")
186 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
188 return CMD_ERR_NO_MATCH
;
190 if (if_is_loopback (circuit
->interface
))
192 vty_outln (vty
,"Can't set no passive for loopback interface");
193 return CMD_ERR_AMBIGUOUS
;
196 isis_circuit_passive_set (circuit
, 0);
200 DEFUN (isis_circuit_type
,
201 isis_circuit_type_cmd
,
202 "isis circuit-type <level-1|level-1-2|level-2-only>",
204 "Configure circuit type for interface\n"
205 "Level-1 only adjacencies are formed\n"
206 "Level-1-2 adjacencies are formed\n"
207 "Level-2 only adjacencies are formed\n")
211 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
213 return CMD_ERR_NO_MATCH
;
215 is_type
= string2circuit_t (argv
[idx_level
]->arg
);
218 vty_outln (vty
, "Unknown circuit-type ");
219 return CMD_ERR_AMBIGUOUS
;
222 if (circuit
->state
== C_STATE_UP
&&
223 circuit
->area
->is_type
!= IS_LEVEL_1_AND_2
&&
224 circuit
->area
->is_type
!= is_type
)
226 vty_outln (vty
, "Invalid circuit level for area %s.",
227 circuit
->area
->area_tag
);
228 return CMD_ERR_AMBIGUOUS
;
230 isis_circuit_is_type_set (circuit
, is_type
);
235 DEFUN (no_isis_circuit_type
,
236 no_isis_circuit_type_cmd
,
237 "no isis circuit-type <level-1|level-1-2|level-2-only>",
240 "Configure circuit type for interface\n"
241 "Level-1 only adjacencies are formed\n"
242 "Level-1-2 adjacencies are formed\n"
243 "Level-2 only adjacencies are formed\n")
246 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
248 return CMD_ERR_NO_MATCH
;
251 * Set the circuits level to its default value
253 if (circuit
->state
== C_STATE_UP
)
254 is_type
= circuit
->area
->is_type
;
256 is_type
= IS_LEVEL_1_AND_2
;
257 isis_circuit_is_type_set (circuit
, is_type
);
264 "isis network point-to-point",
267 "point-to-point network type\n")
269 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
271 return CMD_ERR_NO_MATCH
;
273 if (isis_circuit_circ_type_set(circuit
, CIRCUIT_T_P2P
))
276 "isis network point-to-point " "is valid only on broadcast interfaces");
277 return CMD_ERR_AMBIGUOUS
;
283 DEFUN (no_isis_network
,
285 "no isis network point-to-point",
288 "Set network type for circuit\n"
289 "point-to-point network type\n")
291 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
293 return CMD_ERR_NO_MATCH
;
295 if (isis_circuit_circ_type_set(circuit
, CIRCUIT_T_BROADCAST
))
298 "isis network point-to-point " "is valid only on broadcast interfaces");
299 return CMD_ERR_AMBIGUOUS
;
307 "isis password <md5|clear> WORD",
309 "Configure the authentication password for a circuit\n"
310 "HMAC-MD5 authentication\n"
311 "Cleartext password\n"
312 "Circuit password\n")
314 int idx_encryption
= 2;
316 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
319 return CMD_ERR_NO_MATCH
;
321 if (argv
[idx_encryption
]->arg
[0] == 'm')
322 rv
= isis_circuit_passwd_hmac_md5_set(circuit
, argv
[idx_word
]->arg
);
324 rv
= isis_circuit_passwd_cleartext_set(circuit
, argv
[idx_word
]->arg
);
327 vty_outln (vty
, "Too long circuit password (>254)");
328 return CMD_ERR_AMBIGUOUS
;
334 DEFUN (no_isis_passwd
,
336 "no isis password [<md5|clear> WORD]",
339 "Configure the authentication password for a circuit\n"
340 "HMAC-MD5 authentication\n"
341 "Cleartext password\n"
342 "Circuit password\n")
344 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
346 return CMD_ERR_NO_MATCH
;
348 isis_circuit_passwd_unset(circuit
);
354 DEFUN (isis_priority
,
356 "isis priority (0-127)",
358 "Set priority for Designated Router election\n"
363 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
365 return CMD_ERR_NO_MATCH
;
367 prio
= atoi (argv
[idx_number
]->arg
);
368 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
370 vty_outln (vty
, "Invalid priority %d - should be <0-127>",
372 return CMD_ERR_AMBIGUOUS
;
375 circuit
->priority
[0] = prio
;
376 circuit
->priority
[1] = prio
;
381 DEFUN (no_isis_priority
,
382 no_isis_priority_cmd
,
383 "no isis priority [(0-127)]",
386 "Set priority for Designated Router election\n"
389 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
391 return CMD_ERR_NO_MATCH
;
393 circuit
->priority
[0] = DEFAULT_PRIORITY
;
394 circuit
->priority
[1] = DEFAULT_PRIORITY
;
400 DEFUN (isis_priority_l1
,
401 isis_priority_l1_cmd
,
402 "isis priority (0-127) level-1",
404 "Set priority for Designated Router election\n"
406 "Specify priority for level-1 routing\n")
410 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
412 return CMD_ERR_NO_MATCH
;
414 prio
= atoi (argv
[idx_number
]->arg
);
415 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
417 vty_outln (vty
, "Invalid priority %d - should be <0-127>",
419 return CMD_ERR_AMBIGUOUS
;
422 circuit
->priority
[0] = prio
;
427 DEFUN (no_isis_priority_l1
,
428 no_isis_priority_l1_cmd
,
429 "no isis priority [(0-127)] level-1",
432 "Set priority for Designated Router election\n"
434 "Specify priority for level-1 routing\n")
436 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
438 return CMD_ERR_NO_MATCH
;
440 circuit
->priority
[0] = DEFAULT_PRIORITY
;
446 DEFUN (isis_priority_l2
,
447 isis_priority_l2_cmd
,
448 "isis priority (0-127) level-2",
450 "Set priority for Designated Router election\n"
452 "Specify priority for level-2 routing\n")
456 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
458 return CMD_ERR_NO_MATCH
;
460 prio
= atoi (argv
[idx_number
]->arg
);
461 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
463 vty_outln (vty
, "Invalid priority %d - should be <0-127>",
465 return CMD_ERR_AMBIGUOUS
;
468 circuit
->priority
[1] = prio
;
473 DEFUN (no_isis_priority_l2
,
474 no_isis_priority_l2_cmd
,
475 "no isis priority [(0-127)] level-2",
478 "Set priority for Designated Router election\n"
480 "Specify priority for level-2 routing\n")
482 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
484 return CMD_ERR_NO_MATCH
;
486 circuit
->priority
[1] = DEFAULT_PRIORITY
;
495 "isis metric (0-16777215)",
497 "Set default metric for circuit\n"
498 "Default metric value\n")
502 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
504 return CMD_ERR_NO_MATCH
;
506 met
= atoi (argv
[idx_number
]->arg
);
508 /* RFC3787 section 5.1 */
509 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
510 met
> MAX_NARROW_LINK_METRIC
)
512 vty_outln (vty
, "Invalid metric %d - should be <0-63> "
513 "when narrow metric type enabled",
515 return CMD_ERR_AMBIGUOUS
;
519 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
520 met
> MAX_WIDE_LINK_METRIC
)
522 vty_outln (vty
, "Invalid metric %d - should be <0-16777215> "
523 "when wide metric type enabled",
525 return CMD_ERR_AMBIGUOUS
;
528 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, met
);
529 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, met
);
534 DEFUN (no_isis_metric
,
536 "no isis metric [(0-16777215)]",
539 "Set default metric for circuit\n"
540 "Default metric value\n")
542 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
544 return CMD_ERR_NO_MATCH
;
546 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, DEFAULT_CIRCUIT_METRIC
);
547 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, DEFAULT_CIRCUIT_METRIC
);
552 DEFUN (isis_metric_l1
,
554 "isis metric (0-16777215) level-1",
556 "Set default metric for circuit\n"
557 "Default metric value\n"
558 "Specify metric for level-1 routing\n")
562 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
564 return CMD_ERR_NO_MATCH
;
566 met
= atoi (argv
[idx_number
]->arg
);
568 /* RFC3787 section 5.1 */
569 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
570 met
> MAX_NARROW_LINK_METRIC
)
572 vty_outln (vty
, "Invalid metric %d - should be <0-63> "
573 "when narrow metric type enabled",
575 return CMD_ERR_AMBIGUOUS
;
579 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
580 met
> MAX_WIDE_LINK_METRIC
)
582 vty_outln (vty
, "Invalid metric %d - should be <0-16777215> "
583 "when wide metric type enabled",
585 return CMD_ERR_AMBIGUOUS
;
588 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, met
);
593 DEFUN (no_isis_metric_l1
,
594 no_isis_metric_l1_cmd
,
595 "no isis metric [(0-16777215)] level-1",
598 "Set default metric for circuit\n"
599 "Default metric value\n"
600 "Specify metric for level-1 routing\n")
602 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
604 return CMD_ERR_NO_MATCH
;
606 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, DEFAULT_CIRCUIT_METRIC
);
611 DEFUN (isis_metric_l2
,
613 "isis metric (0-16777215) level-2",
615 "Set default metric for circuit\n"
616 "Default metric value\n"
617 "Specify metric for level-2 routing\n")
621 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
623 return CMD_ERR_NO_MATCH
;
625 met
= atoi (argv
[idx_number
]->arg
);
627 /* RFC3787 section 5.1 */
628 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
629 met
> MAX_NARROW_LINK_METRIC
)
631 vty_outln (vty
, "Invalid metric %d - should be <0-63> "
632 "when narrow metric type enabled",
634 return CMD_ERR_AMBIGUOUS
;
638 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
639 met
> MAX_WIDE_LINK_METRIC
)
641 vty_outln (vty
, "Invalid metric %d - should be <0-16777215> "
642 "when wide metric type enabled",
644 return CMD_ERR_AMBIGUOUS
;
647 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, met
);
652 DEFUN (no_isis_metric_l2
,
653 no_isis_metric_l2_cmd
,
654 "no isis metric [(0-16777215)] level-2",
657 "Set default metric for circuit\n"
658 "Default metric value\n"
659 "Specify metric for level-2 routing\n")
661 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
663 return CMD_ERR_NO_MATCH
;
665 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, DEFAULT_CIRCUIT_METRIC
);
671 DEFUN (isis_hello_interval
,
672 isis_hello_interval_cmd
,
673 "isis hello-interval (1-600)",
675 "Set Hello interval\n"
676 "Holdtime 1 seconds, interval depends on multiplier\n")
680 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
682 return CMD_ERR_NO_MATCH
;
684 interval
= atoi (argv
[idx_number
]->arg
);
685 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
687 vty_outln (vty
, "Invalid hello-interval %d - should be <1-600>",
689 return CMD_ERR_AMBIGUOUS
;
692 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
693 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
699 DEFUN (no_isis_hello_interval
,
700 no_isis_hello_interval_cmd
,
701 "no isis hello-interval [(1-600)]",
704 "Set Hello interval\n"
705 "Holdtime 1 second, interval depends on multiplier\n")
707 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
709 return CMD_ERR_NO_MATCH
;
711 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
712 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
718 DEFUN (isis_hello_interval_l1
,
719 isis_hello_interval_l1_cmd
,
720 "isis hello-interval (1-600) level-1",
722 "Set Hello interval\n"
723 "Holdtime 1 second, interval depends on multiplier\n"
724 "Specify hello-interval for level-1 IIHs\n")
728 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
730 return CMD_ERR_NO_MATCH
;
732 interval
= atoi (argv
[idx_number
]->arg
);
733 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
735 vty_outln (vty
, "Invalid hello-interval %ld - should be <1-600>",
737 return CMD_ERR_AMBIGUOUS
;
740 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
746 DEFUN (no_isis_hello_interval_l1
,
747 no_isis_hello_interval_l1_cmd
,
748 "no isis hello-interval [(1-600)] level-1",
751 "Set Hello interval\n"
752 "Holdtime 1 second, interval depends on multiplier\n"
753 "Specify hello-interval for level-1 IIHs\n")
755 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
757 return CMD_ERR_NO_MATCH
;
759 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
765 DEFUN (isis_hello_interval_l2
,
766 isis_hello_interval_l2_cmd
,
767 "isis hello-interval (1-600) level-2",
769 "Set Hello interval\n"
770 "Holdtime 1 second, interval depends on multiplier\n"
771 "Specify hello-interval for level-2 IIHs\n")
775 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
777 return CMD_ERR_NO_MATCH
;
779 interval
= atoi (argv
[idx_number
]->arg
);
780 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
782 vty_outln (vty
, "Invalid hello-interval %ld - should be <1-600>",
784 return CMD_ERR_AMBIGUOUS
;
787 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
793 DEFUN (no_isis_hello_interval_l2
,
794 no_isis_hello_interval_l2_cmd
,
795 "no isis hello-interval [(1-600)] level-2",
798 "Set Hello interval\n"
799 "Holdtime 1 second, interval depends on multiplier\n"
800 "Specify hello-interval for level-2 IIHs\n")
802 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
804 return CMD_ERR_NO_MATCH
;
806 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
812 DEFUN (isis_hello_multiplier
,
813 isis_hello_multiplier_cmd
,
814 "isis hello-multiplier (2-100)",
816 "Set multiplier for Hello holding time\n"
817 "Hello multiplier value\n")
821 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
823 return CMD_ERR_NO_MATCH
;
825 mult
= atoi (argv
[idx_number
]->arg
);
826 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
828 vty_outln (vty
, "Invalid hello-multiplier %d - should be <2-100>",
830 return CMD_ERR_AMBIGUOUS
;
833 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
834 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
840 DEFUN (no_isis_hello_multiplier
,
841 no_isis_hello_multiplier_cmd
,
842 "no isis hello-multiplier [(2-100)]",
845 "Set multiplier for Hello holding time\n"
846 "Hello multiplier value\n")
848 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
850 return CMD_ERR_NO_MATCH
;
852 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
853 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
859 DEFUN (isis_hello_multiplier_l1
,
860 isis_hello_multiplier_l1_cmd
,
861 "isis hello-multiplier (2-100) level-1",
863 "Set multiplier for Hello holding time\n"
864 "Hello multiplier value\n"
865 "Specify hello multiplier for level-1 IIHs\n")
869 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
871 return CMD_ERR_NO_MATCH
;
873 mult
= atoi (argv
[idx_number
]->arg
);
874 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
876 vty_outln (vty
, "Invalid hello-multiplier %d - should be <2-100>",
878 return CMD_ERR_AMBIGUOUS
;
881 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
887 DEFUN (no_isis_hello_multiplier_l1
,
888 no_isis_hello_multiplier_l1_cmd
,
889 "no isis hello-multiplier [(2-100)] level-1",
892 "Set multiplier for Hello holding time\n"
893 "Hello multiplier value\n"
894 "Specify hello multiplier for level-1 IIHs\n")
896 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
898 return CMD_ERR_NO_MATCH
;
900 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
906 DEFUN (isis_hello_multiplier_l2
,
907 isis_hello_multiplier_l2_cmd
,
908 "isis hello-multiplier (2-100) level-2",
910 "Set multiplier for Hello holding time\n"
911 "Hello multiplier value\n"
912 "Specify hello multiplier for level-2 IIHs\n")
916 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
918 return CMD_ERR_NO_MATCH
;
920 mult
= atoi (argv
[idx_number
]->arg
);
921 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
923 vty_outln (vty
, "Invalid hello-multiplier %d - should be <2-100>",
925 return CMD_ERR_AMBIGUOUS
;
928 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
934 DEFUN (no_isis_hello_multiplier_l2
,
935 no_isis_hello_multiplier_l2_cmd
,
936 "no isis hello-multiplier [(2-100)] level-2",
939 "Set multiplier for Hello holding time\n"
940 "Hello multiplier value\n"
941 "Specify hello multiplier for level-2 IIHs\n")
943 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
945 return CMD_ERR_NO_MATCH
;
947 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
953 DEFUN (isis_hello_padding
,
954 isis_hello_padding_cmd
,
955 "isis hello padding",
957 "Add padding to IS-IS hello packets\n"
958 "Pad hello packets\n")
960 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
962 return CMD_ERR_NO_MATCH
;
964 circuit
->pad_hellos
= 1;
969 DEFUN (no_isis_hello_padding
,
970 no_isis_hello_padding_cmd
,
971 "no isis hello padding",
974 "Add padding to IS-IS hello packets\n"
975 "Pad hello packets\n")
977 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
979 return CMD_ERR_NO_MATCH
;
981 circuit
->pad_hellos
= 0;
986 DEFUN (csnp_interval
,
988 "isis csnp-interval (1-600)",
990 "Set CSNP interval in seconds\n"
991 "CSNP interval value\n")
994 unsigned long interval
;
995 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
997 return CMD_ERR_NO_MATCH
;
999 interval
= atol (argv
[idx_number
]->arg
);
1000 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1002 vty_outln (vty
, "Invalid csnp-interval %lu - should be <1-600>",
1004 return CMD_ERR_AMBIGUOUS
;
1007 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1008 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1014 DEFUN (no_csnp_interval
,
1015 no_csnp_interval_cmd
,
1016 "no isis csnp-interval [(1-600)]",
1019 "Set CSNP interval in seconds\n"
1020 "CSNP interval value\n")
1022 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1024 return CMD_ERR_NO_MATCH
;
1026 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1027 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1033 DEFUN (csnp_interval_l1
,
1034 csnp_interval_l1_cmd
,
1035 "isis csnp-interval (1-600) level-1",
1037 "Set CSNP interval in seconds\n"
1038 "CSNP interval value\n"
1039 "Specify interval for level-1 CSNPs\n")
1042 unsigned long interval
;
1043 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1045 return CMD_ERR_NO_MATCH
;
1047 interval
= atol (argv
[idx_number
]->arg
);
1048 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1050 vty_outln (vty
, "Invalid csnp-interval %lu - should be <1-600>",
1052 return CMD_ERR_AMBIGUOUS
;
1055 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1061 DEFUN (no_csnp_interval_l1
,
1062 no_csnp_interval_l1_cmd
,
1063 "no isis csnp-interval [(1-600)] level-1",
1066 "Set CSNP interval in seconds\n"
1067 "CSNP interval value\n"
1068 "Specify interval for level-1 CSNPs\n")
1070 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1072 return CMD_ERR_NO_MATCH
;
1074 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1080 DEFUN (csnp_interval_l2
,
1081 csnp_interval_l2_cmd
,
1082 "isis csnp-interval (1-600) level-2",
1084 "Set CSNP interval in seconds\n"
1085 "CSNP interval value\n"
1086 "Specify interval for level-2 CSNPs\n")
1089 unsigned long interval
;
1090 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1092 return CMD_ERR_NO_MATCH
;
1094 interval
= atol (argv
[idx_number
]->arg
);
1095 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1097 vty_outln (vty
, "Invalid csnp-interval %lu - should be <1-600>",
1099 return CMD_ERR_AMBIGUOUS
;
1102 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1108 DEFUN (no_csnp_interval_l2
,
1109 no_csnp_interval_l2_cmd
,
1110 "no isis csnp-interval [(1-600)] level-2",
1113 "Set CSNP interval in seconds\n"
1114 "CSNP interval value\n"
1115 "Specify interval for level-2 CSNPs\n")
1117 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1119 return CMD_ERR_NO_MATCH
;
1121 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1127 DEFUN (psnp_interval
,
1129 "isis psnp-interval (1-120)",
1131 "Set PSNP interval in seconds\n"
1132 "PSNP interval value\n")
1135 unsigned long interval
;
1136 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1138 return CMD_ERR_NO_MATCH
;
1140 interval
= atol (argv
[idx_number
]->arg
);
1141 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1143 vty_outln (vty
, "Invalid psnp-interval %lu - should be <1-120>",
1145 return CMD_ERR_AMBIGUOUS
;
1148 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
1149 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
1155 DEFUN (no_psnp_interval
,
1156 no_psnp_interval_cmd
,
1157 "no isis psnp-interval [(1-120)]",
1160 "Set PSNP interval in seconds\n"
1161 "PSNP interval value\n")
1163 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1165 return CMD_ERR_NO_MATCH
;
1167 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1168 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1174 DEFUN (psnp_interval_l1
,
1175 psnp_interval_l1_cmd
,
1176 "isis psnp-interval (1-120) level-1",
1178 "Set PSNP interval in seconds\n"
1179 "PSNP interval value\n"
1180 "Specify interval for level-1 PSNPs\n")
1183 unsigned long interval
;
1184 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1186 return CMD_ERR_NO_MATCH
;
1188 interval
= atol (argv
[idx_number
]->arg
);
1189 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1191 vty_outln (vty
, "Invalid psnp-interval %lu - should be <1-120>",
1193 return CMD_ERR_AMBIGUOUS
;
1196 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
1202 DEFUN (no_psnp_interval_l1
,
1203 no_psnp_interval_l1_cmd
,
1204 "no isis psnp-interval [(1-120)] level-1",
1207 "Set PSNP interval in seconds\n"
1208 "PSNP interval value\n"
1209 "Specify interval for level-1 PSNPs\n")
1211 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1213 return CMD_ERR_NO_MATCH
;
1215 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1221 DEFUN (psnp_interval_l2
,
1222 psnp_interval_l2_cmd
,
1223 "isis psnp-interval (1-120) level-2",
1225 "Set PSNP interval in seconds\n"
1226 "PSNP interval value\n"
1227 "Specify interval for level-2 PSNPs\n")
1230 unsigned long interval
;
1231 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1233 return CMD_ERR_NO_MATCH
;
1235 interval
= atol (argv
[idx_number
]->arg
);
1236 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1238 vty_outln (vty
, "Invalid psnp-interval %lu - should be <1-120>",
1240 return CMD_ERR_AMBIGUOUS
;
1243 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
1249 DEFUN (no_psnp_interval_l2
,
1250 no_psnp_interval_l2_cmd
,
1251 "no isis psnp-interval [(1-120)] level-2",
1254 "Set PSNP interval in seconds\n"
1255 "PSNP interval value\n"
1256 "Specify interval for level-2 PSNPs\n")
1258 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1260 return CMD_ERR_NO_MATCH
;
1262 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1267 DEFUN (circuit_topology
,
1268 circuit_topology_cmd
,
1269 "isis topology " ISIS_MT_NAMES
,
1271 "Configure interface IS-IS topologies\n"
1272 ISIS_MT_DESCRIPTIONS
)
1274 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1276 return CMD_ERR_NO_MATCH
;
1277 const char *arg
= argv
[2]->arg
;
1278 uint16_t mtid
= isis_str2mtid(arg
);
1280 if (circuit
->area
&& circuit
->area
->oldmetric
)
1283 "Multi topology IS-IS can only be used with wide metrics");
1284 return CMD_ERR_AMBIGUOUS
;
1287 if (mtid
== (uint16_t)-1)
1289 vty_outln (vty
, "Don't know topology '%s'", arg
);
1290 return CMD_ERR_AMBIGUOUS
;
1293 return isis_circuit_mt_enabled_set(circuit
, mtid
, true);
1296 DEFUN (no_circuit_topology
,
1297 no_circuit_topology_cmd
,
1298 "no isis topology " ISIS_MT_NAMES
,
1301 "Configure interface IS-IS topologies\n"
1302 ISIS_MT_DESCRIPTIONS
)
1304 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1306 return CMD_ERR_NO_MATCH
;
1307 const char *arg
= argv
[3]->arg
;
1308 uint16_t mtid
= isis_str2mtid(arg
);
1310 if (circuit
->area
&& circuit
->area
->oldmetric
)
1313 "Multi topology IS-IS can only be used with wide metrics");
1314 return CMD_ERR_AMBIGUOUS
;
1317 if (mtid
== (uint16_t)-1)
1319 vty_outln (vty
, "Don't know topology '%s'", arg
);
1320 return CMD_ERR_AMBIGUOUS
;
1323 return isis_circuit_mt_enabled_set(circuit
, mtid
, false);
1327 validate_metric_style_narrow (struct vty
*vty
, struct isis_area
*area
)
1329 struct isis_circuit
*circuit
;
1330 struct listnode
*node
;
1333 return CMD_ERR_AMBIGUOUS
;
1337 vty_outln (vty
, "ISIS area is invalid");
1338 return CMD_ERR_AMBIGUOUS
;
1341 for (ALL_LIST_ELEMENTS_RO (area
->circuit_list
, node
, circuit
))
1343 if ((area
->is_type
& IS_LEVEL_1
) &&
1344 (circuit
->is_type
& IS_LEVEL_1
) &&
1345 (circuit
->te_metric
[0] > MAX_NARROW_LINK_METRIC
))
1347 vty_outln (vty
, "ISIS circuit %s metric is invalid",
1348 circuit
->interface
->name
);
1349 return CMD_ERR_AMBIGUOUS
;
1351 if ((area
->is_type
& IS_LEVEL_2
) &&
1352 (circuit
->is_type
& IS_LEVEL_2
) &&
1353 (circuit
->te_metric
[1] > MAX_NARROW_LINK_METRIC
))
1355 vty_outln (vty
, "ISIS circuit %s metric is invalid",
1356 circuit
->interface
->name
);
1357 return CMD_ERR_AMBIGUOUS
;
1364 DEFUN (metric_style
,
1366 "metric-style <narrow|transition|wide>",
1367 "Use old-style (ISO 10589) or new-style packet formats\n"
1368 "Use old style of TLVs with narrow metric\n"
1369 "Send and accept both styles of TLVs during transition\n"
1370 "Use new style of TLVs to carry wider metric\n")
1372 int idx_metric_style
= 1;
1373 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1376 if (strncmp (argv
[idx_metric_style
]->arg
, "w", 1) == 0)
1378 isis_area_metricstyle_set(area
, false, true);
1382 if (area_is_mt(area
))
1385 "Narrow metrics cannot be used while multi topology IS-IS is active");
1386 return CMD_ERR_AMBIGUOUS
;
1389 ret
= validate_metric_style_narrow (vty
, area
);
1390 if (ret
!= CMD_SUCCESS
)
1393 if (strncmp (argv
[idx_metric_style
]->arg
, "t", 1) == 0)
1394 isis_area_metricstyle_set(area
, true, true);
1395 else if (strncmp (argv
[idx_metric_style
]->arg
, "n", 1) == 0)
1396 isis_area_metricstyle_set(area
, true, false);
1402 DEFUN (no_metric_style
,
1403 no_metric_style_cmd
,
1406 "Use old-style (ISO 10589) or new-style packet formats\n")
1408 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1411 if (area_is_mt(area
))
1414 "Narrow metrics cannot be used while multi topology IS-IS is active");
1415 return CMD_ERR_AMBIGUOUS
;
1418 ret
= validate_metric_style_narrow (vty
, area
);
1419 if (ret
!= CMD_SUCCESS
)
1422 isis_area_metricstyle_set(area
, true, false);
1426 DEFUN (set_overload_bit
,
1427 set_overload_bit_cmd
,
1429 "Set overload bit to avoid any transit traffic\n")
1431 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1433 isis_area_overload_bit_set(area
, true);
1437 DEFUN (no_set_overload_bit
,
1438 no_set_overload_bit_cmd
,
1439 "no set-overload-bit",
1440 "Reset overload bit to accept transit traffic\n"
1441 "Reset overload bit\n")
1443 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1445 isis_area_overload_bit_set(area
, false);
1449 DEFUN (set_attached_bit
,
1450 set_attached_bit_cmd
,
1452 "Set attached bit to identify as L1/L2 router for inter-area traffic\n")
1454 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1456 isis_area_attached_bit_set(area
, true);
1460 DEFUN (no_set_attached_bit
,
1461 no_set_attached_bit_cmd
,
1462 "no set-attached-bit",
1464 "Reset attached bit\n")
1466 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1468 isis_area_attached_bit_set(area
, false);
1472 DEFUN (dynamic_hostname
,
1473 dynamic_hostname_cmd
,
1475 "Dynamic hostname for IS-IS\n"
1476 "Dynamic hostname\n")
1478 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1480 isis_area_dynhostname_set(area
, true);
1484 DEFUN (no_dynamic_hostname
,
1485 no_dynamic_hostname_cmd
,
1486 "no hostname dynamic",
1488 "Dynamic hostname for IS-IS\n"
1489 "Dynamic hostname\n")
1491 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1493 isis_area_dynhostname_set(area
, false);
1497 static int area_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
1499 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1500 struct listnode
*node
;
1501 struct isis_circuit
*circuit
;
1503 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1505 if(circuit
->state
!= C_STATE_INIT
&& circuit
->state
!= C_STATE_UP
)
1507 if(lsp_mtu
> isis_circuit_pdu_size(circuit
))
1509 vty_outln (vty
, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.",
1510 circuit
->interface
->name
,isis_circuit_pdu_size(circuit
));
1511 return CMD_ERR_AMBIGUOUS
;
1515 isis_area_lsp_mtu_set(area
, lsp_mtu
);
1519 DEFUN (area_lsp_mtu
,
1521 "lsp-mtu (128-4352)",
1522 "Configure the maximum size of generated LSPs\n"
1523 "Maximum size of generated LSPs\n")
1526 unsigned int lsp_mtu
;
1528 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1530 return area_lsp_mtu_set(vty
, lsp_mtu
);
1534 DEFUN (no_area_lsp_mtu
,
1535 no_area_lsp_mtu_cmd
,
1536 "no lsp-mtu [(128-4352)]",
1538 "Configure the maximum size of generated LSPs\n"
1539 "Maximum size of generated LSPs\n")
1541 return area_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
1547 "is-type <level-1|level-1-2|level-2-only>",
1548 "IS Level for this routing process (OSI only)\n"
1549 "Act as a station router only\n"
1550 "Act as both a station router and an area router\n"
1551 "Act as an area router only\n")
1554 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1557 type
= string2circuit_t (argv
[idx_level
]->arg
);
1560 vty_outln (vty
, "Unknown IS level ");
1564 isis_area_is_type_set(area
, type
);
1571 "no is-type <level-1|level-1-2|level-2-only>",
1573 "IS Level for this routing process (OSI only)\n"
1574 "Act as a station router only\n"
1575 "Act as both a station router and an area router\n"
1576 "Act as an area router only\n")
1578 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1582 * Put the is-type back to defaults:
1583 * - level-1-2 on first area
1584 * - level-1 for the rest
1586 if (listgetdata (listhead (isis
->area_list
)) == area
)
1587 type
= IS_LEVEL_1_AND_2
;
1591 isis_area_is_type_set(area
, type
);
1597 set_lsp_gen_interval (struct vty
*vty
, struct isis_area
*area
,
1598 uint16_t interval
, int level
)
1602 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1607 if (interval
>= area
->lsp_refresh
[lvl
-1])
1609 vty_outln (vty
, "LSP gen interval %us must be less than "
1610 "the LSP refresh interval %us",
1611 interval
, area
->lsp_refresh
[lvl
- 1]);
1612 return CMD_ERR_AMBIGUOUS
;
1616 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1620 area
->lsp_gen_interval
[lvl
-1] = interval
;
1626 DEFUN (lsp_gen_interval
,
1627 lsp_gen_interval_cmd
,
1628 "lsp-gen-interval [<level-1|level-2>] (1-120)",
1629 "Minimum interval between regenerating same LSP\n"
1630 "Set interval for level 1 only\n"
1631 "Set interval for level 2 only\n"
1632 "Minimum interval in seconds\n")
1635 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1640 level
|= argv_find (argv
, argc
, "level-1", &idx
) ? IS_LEVEL_1
: 0;
1641 level
|= argv_find (argv
, argc
, "level-2", &idx
) ? IS_LEVEL_2
: 0;
1643 level
= IS_LEVEL_1
| IS_LEVEL_2
;
1645 argv_find (argv
, argc
, "(1-120)", &idx
);
1647 interval
= atoi (argv
[idx
]->arg
);
1648 return set_lsp_gen_interval (vty
, area
, interval
, level
);
1651 DEFUN (no_lsp_gen_interval
,
1652 no_lsp_gen_interval_cmd
,
1653 "no lsp-gen-interval [<level-1|level-2>] [(1-120)]",
1655 "Minimum interval between regenerating same LSP\n"
1656 "Set interval for level 1 only\n"
1657 "Set interval for level 2 only\n"
1658 "Minimum interval in seconds\n")
1661 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1666 level
|= argv_find (argv
, argc
, "level-1", &idx
) ? IS_LEVEL_1
: 0;
1667 level
|= argv_find (argv
, argc
, "level-2", &idx
) ? IS_LEVEL_2
: 0;
1669 level
= IS_LEVEL_1
| IS_LEVEL_2
;
1671 interval
= DEFAULT_MIN_LSP_GEN_INTERVAL
;
1672 return set_lsp_gen_interval (vty
, area
, interval
, level
);
1675 DEFUN (spf_interval
,
1677 "spf-interval (1-120)",
1678 "Minimum interval between SPF calculations\n"
1679 "Minimum interval between consecutive SPFs in seconds\n")
1682 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1685 interval
= atoi (argv
[idx_number
]->arg
);
1686 area
->min_spf_interval
[0] = interval
;
1687 area
->min_spf_interval
[1] = interval
;
1693 DEFUN (no_spf_interval
,
1694 no_spf_interval_cmd
,
1695 "no spf-interval [[<level-1|level-2>] (1-120)]",
1697 "Minimum interval between SPF calculations\n"
1698 "Set interval for level 1 only\n"
1699 "Set interval for level 2 only\n"
1700 "Minimum interval between consecutive SPFs in seconds\n")
1702 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1704 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
1705 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
1711 DEFUN (spf_interval_l1
,
1712 spf_interval_l1_cmd
,
1713 "spf-interval level-1 (1-120)",
1714 "Minimum interval between SPF calculations\n"
1715 "Set interval for level 1 only\n"
1716 "Minimum interval between consecutive SPFs in seconds\n")
1719 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1722 interval
= atoi (argv
[idx_number
]->arg
);
1723 area
->min_spf_interval
[0] = interval
;
1728 DEFUN (no_spf_interval_l1
,
1729 no_spf_interval_l1_cmd
,
1730 "no spf-interval level-1",
1732 "Minimum interval between SPF calculations\n"
1733 "Set interval for level 1 only\n")
1735 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1737 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
1743 DEFUN (spf_interval_l2
,
1744 spf_interval_l2_cmd
,
1745 "spf-interval level-2 (1-120)",
1746 "Minimum interval between SPF calculations\n"
1747 "Set interval for level 2 only\n"
1748 "Minimum interval between consecutive SPFs in seconds\n")
1751 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1754 interval
= atoi (argv
[idx_number
]->arg
);
1755 area
->min_spf_interval
[1] = interval
;
1760 DEFUN (no_spf_interval_l2
,
1761 no_spf_interval_l2_cmd
,
1762 "no spf-interval level-2",
1764 "Minimum interval between SPF calculations\n"
1765 "Set interval for level 2 only\n")
1767 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1769 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
1774 DEFUN (no_spf_delay_ietf
,
1775 no_spf_delay_ietf_cmd
,
1776 "no spf-delay-ietf",
1778 "IETF SPF delay algorithm\n")
1780 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1782 spf_backoff_free(area
->spf_delay_ietf
[0]);
1783 spf_backoff_free(area
->spf_delay_ietf
[1]);
1784 area
->spf_delay_ietf
[0] = NULL
;
1785 area
->spf_delay_ietf
[1] = NULL
;
1790 DEFUN (spf_delay_ietf
,
1792 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
1793 "IETF SPF delay algorithm\n"
1794 "Delay used while in QUIET state\n"
1795 "Delay used while in QUIET state in milliseconds\n"
1796 "Delay used while in SHORT_WAIT state\n"
1797 "Delay used while in SHORT_WAIT state in milliseconds\n"
1798 "Delay used while in LONG_WAIT\n"
1799 "Delay used while in LONG_WAIT state in milliseconds\n"
1800 "Time with no received IGP events before considering IGP stable\n"
1801 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
1802 "Maximum duration needed to learn all the events related to a single failure\n"
1803 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
1805 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1807 long init_delay
= atol(argv
[2]->arg
);
1808 long short_delay
= atol(argv
[4]->arg
);
1809 long long_delay
= atol(argv
[6]->arg
);
1810 long holddown
= atol(argv
[8]->arg
);
1811 long timetolearn
= atol(argv
[10]->arg
);
1813 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
1814 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
1816 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
1817 spf_backoff_free(area
->spf_delay_ietf
[0]);
1818 area
->spf_delay_ietf
[0] = spf_backoff_new(master
, buf
, init_delay
,
1819 short_delay
, long_delay
,
1820 holddown
, timetolearn
);
1822 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
1823 spf_backoff_free(area
->spf_delay_ietf
[1]);
1824 area
->spf_delay_ietf
[1] = spf_backoff_new(master
, buf
, init_delay
,
1825 short_delay
, long_delay
,
1826 holddown
, timetolearn
);
1828 XFREE(MTYPE_TMP
, buf
);
1833 area_max_lsp_lifetime_set(struct vty
*vty
, int level
,
1836 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1838 uint16_t refresh_interval
= interval
- 300;
1839 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
1841 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++)
1846 if (refresh_interval
< area
->lsp_refresh
[lvl
-1])
1848 vty_outln (vty
, "Level %d Max LSP lifetime %us must be 300s greater than "
1849 "the configured LSP refresh interval %us",
1850 lvl
, interval
, area
->lsp_refresh
[lvl
- 1]);
1851 vty_outln (vty
, "Automatically reducing level %d LSP refresh interval "
1852 "to %us", lvl
, refresh_interval
);
1853 set_refresh_interval
[lvl
-1] = 1;
1855 if (refresh_interval
<= area
->lsp_gen_interval
[lvl
-1])
1857 vty_outln (vty
, "LSP refresh interval %us must be greater than "
1858 "the configured LSP gen interval %us",
1859 refresh_interval
,area
->lsp_gen_interval
[lvl
- 1]);
1860 return CMD_ERR_AMBIGUOUS
;
1865 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++)
1869 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
1870 if (set_refresh_interval
[lvl
-1])
1871 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
1877 DEFUN (max_lsp_lifetime
,
1878 max_lsp_lifetime_cmd
,
1879 "max-lsp-lifetime [<level-1|level-2>] (350-65535)",
1880 "Maximum LSP lifetime\n"
1881 "Maximum LSP lifetime for Level 1 only\n"
1882 "Maximum LSP lifetime for Level 2 only\n"
1883 "LSP lifetime in seconds\n")
1886 unsigned int level
= IS_LEVEL_1_AND_2
;
1888 if (argv_find (argv
, argc
, "level-1", &idx
))
1890 else if (argv_find (argv
, argc
, "level-2", &idx
))
1893 argv_find (argv
, argc
, "(350-65535)", &idx
);
1894 int lifetime
= atoi(argv
[idx
]->arg
);
1896 return area_max_lsp_lifetime_set(vty
, level
, lifetime
);
1900 DEFUN (no_max_lsp_lifetime
,
1901 no_max_lsp_lifetime_cmd
,
1902 "no max-lsp-lifetime [<level-1|level-2>] [(350-65535)]",
1904 "Maximum LSP lifetime\n"
1905 "Maximum LSP lifetime for Level 1 only\n"
1906 "Maximum LSP lifetime for Level 2 only\n"
1907 "LSP lifetime in seconds\n")
1910 unsigned int level
= IS_LEVEL_1_AND_2
;
1912 if (argv_find (argv
, argc
, "level-1", &idx
))
1914 else if (argv_find (argv
, argc
, "level-2", &idx
))
1917 return area_max_lsp_lifetime_set(vty
, level
, DEFAULT_LSP_LIFETIME
);
1921 area_lsp_refresh_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
1923 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1926 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1930 if (interval
<= area
->lsp_gen_interval
[lvl
-1])
1932 vty_outln (vty
, "LSP refresh interval %us must be greater than "
1933 "the configured LSP gen interval %us",
1934 interval
,area
->lsp_gen_interval
[lvl
- 1]);
1935 return CMD_ERR_AMBIGUOUS
;
1937 if (interval
> (area
->max_lsp_lifetime
[lvl
-1] - 300))
1939 vty_outln (vty
, "LSP refresh interval %us must be less than "
1940 "the configured LSP lifetime %us less 300",
1941 interval
,area
->max_lsp_lifetime
[lvl
- 1]);
1942 return CMD_ERR_AMBIGUOUS
;
1946 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1950 isis_area_lsp_refresh_set(area
, lvl
, interval
);
1956 DEFUN (lsp_refresh_interval
,
1957 lsp_refresh_interval_cmd
,
1958 "lsp-refresh-interval [<level-1|level-2>] (1-65235)",
1959 "LSP refresh interval\n"
1960 "LSP refresh interval for Level 1 only\n"
1961 "LSP refresh interval for Level 2 only\n"
1962 "LSP refresh interval in seconds\n")
1965 unsigned int level
= IS_LEVEL_1_AND_2
;
1966 unsigned int interval
= 0;
1968 if (argv_find (argv
, argc
, "level-1", &idx
))
1970 else if (argv_find (argv
, argc
, "level-2", &idx
))
1973 interval
= atoi(argv
[argc
-1]->arg
);
1974 return area_lsp_refresh_interval_set(vty
, level
, interval
);
1977 DEFUN (no_lsp_refresh_interval
,
1978 no_lsp_refresh_interval_cmd
,
1979 "no lsp-refresh-interval [<level-1|level-2>] [(1-65235)]",
1981 "LSP refresh interval\n"
1982 "LSP refresh interval for Level 1 only\n"
1983 "LSP refresh interval for Level 2 only\n"
1984 "LSP refresh interval in seconds\n")
1987 unsigned int level
= IS_LEVEL_1_AND_2
;
1989 if (argv_find (argv
, argc
, "level-1", &idx
))
1991 else if (argv_find (argv
, argc
, "level-2", &idx
))
1994 return area_lsp_refresh_interval_set(vty
, level
, DEFAULT_MAX_LSP_GEN_INTERVAL
);
1998 area_passwd_set(struct vty
*vty
, int level
,
1999 int (*type_set
)(struct isis_area
*area
, int level
,
2000 const char *passwd
, u_char snp_auth
),
2001 const char *passwd
, u_char snp_auth
)
2003 VTY_DECLVAR_CONTEXT (isis_area
, area
);
2005 if (passwd
&& strlen(passwd
) > 254)
2007 vty_outln (vty
, "Too long area password (>254)");
2008 return CMD_ERR_AMBIGUOUS
;
2011 type_set(area
, level
, passwd
, snp_auth
);
2016 DEFUN (area_passwd_md5
,
2017 area_passwd_md5_cmd
,
2018 "area-password md5 WORD [authenticate snp <send-only|validate>]",
2019 "Configure the authentication password for an area\n"
2020 "Authentication type\n"
2021 "Level-wide password\n"
2024 "Send but do not check PDUs on receiving\n"
2025 "Send and check PDUs on receiving\n")
2027 int idx_password
= 0;
2030 u_char snp_auth
= 0;
2031 int level
= strmatch(argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2035 snp_auth
= SNP_AUTH_SEND
;
2036 if (strmatch(argv
[idx_type
]->text
, "validate"))
2037 snp_auth
|= SNP_AUTH_RECV
;
2040 return area_passwd_set(vty
, level
, isis_area_passwd_hmac_md5_set
,
2041 argv
[idx_word
]->arg
, snp_auth
);
2044 DEFUN (domain_passwd_md5
,
2045 domain_passwd_md5_cmd
,
2046 "domain-password md5 WORD [authenticate snp <send-only|validate>]",
2047 "Set the authentication password for a routing domain\n"
2048 "Authentication type\n"
2049 "Level-wide password\n"
2052 "Send but do not check PDUs on receiving\n"
2053 "Send and check PDUs on receiving\n")
2055 return area_passwd_md5 (self
, vty
, argc
, argv
);
2058 DEFUN (area_passwd_clear
,
2059 area_passwd_clear_cmd
,
2060 "area-password clear WORD [authenticate snp <send-only|validate>]",
2061 "Configure the authentication password for an area\n"
2062 "Authentication type\n"
2066 "Send but do not check PDUs on receiving\n"
2067 "Send and check PDUs on receiving\n")
2069 int idx_password
= 0;
2072 u_char snp_auth
= 0;
2073 int level
= strmatch(argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2077 snp_auth
= SNP_AUTH_SEND
;
2078 if (strmatch (argv
[idx_type
]->text
, "validate"))
2079 snp_auth
|= SNP_AUTH_RECV
;
2082 return area_passwd_set(vty
, level
, isis_area_passwd_cleartext_set
,
2083 argv
[idx_word
]->arg
, snp_auth
);
2086 DEFUN (domain_passwd_clear
,
2087 domain_passwd_clear_cmd
,
2088 "domain-password clear WORD [authenticate snp <send-only|validate>]",
2089 "Set the authentication password for a routing domain\n"
2090 "Authentication type\n"
2094 "Send but do not check PDUs on receiving\n"
2095 "Send and check PDUs on receiving\n")
2097 return area_passwd_clear (self
, vty
, argc
, argv
);
2100 DEFUN (no_area_passwd
,
2102 "no <area-password|domain-password>",
2104 "Configure the authentication password for an area\n"
2105 "Set the authentication password for a routing domain\n")
2107 int idx_password
= 1;
2108 int level
= strmatch (argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2109 VTY_DECLVAR_CONTEXT (isis_area
, area
);
2111 return isis_area_passwd_unset (area
, level
);
2115 isis_vty_init (void)
2117 install_element (INTERFACE_NODE
, &ip_router_isis_cmd
);
2118 install_element (INTERFACE_NODE
, &ip6_router_isis_cmd
);
2119 install_element (INTERFACE_NODE
, &no_ip_router_isis_cmd
);
2121 install_element (INTERFACE_NODE
, &isis_passive_cmd
);
2122 install_element (INTERFACE_NODE
, &no_isis_passive_cmd
);
2124 install_element (INTERFACE_NODE
, &isis_circuit_type_cmd
);
2125 install_element (INTERFACE_NODE
, &no_isis_circuit_type_cmd
);
2127 install_element (INTERFACE_NODE
, &isis_network_cmd
);
2128 install_element (INTERFACE_NODE
, &no_isis_network_cmd
);
2130 install_element (INTERFACE_NODE
, &isis_passwd_cmd
);
2131 install_element (INTERFACE_NODE
, &no_isis_passwd_cmd
);
2133 install_element (INTERFACE_NODE
, &isis_priority_cmd
);
2134 install_element (INTERFACE_NODE
, &no_isis_priority_cmd
);
2135 install_element (INTERFACE_NODE
, &isis_priority_l1_cmd
);
2136 install_element (INTERFACE_NODE
, &no_isis_priority_l1_cmd
);
2137 install_element (INTERFACE_NODE
, &isis_priority_l2_cmd
);
2138 install_element (INTERFACE_NODE
, &no_isis_priority_l2_cmd
);
2140 install_element (INTERFACE_NODE
, &isis_metric_cmd
);
2141 install_element (INTERFACE_NODE
, &no_isis_metric_cmd
);
2142 install_element (INTERFACE_NODE
, &isis_metric_l1_cmd
);
2143 install_element (INTERFACE_NODE
, &no_isis_metric_l1_cmd
);
2144 install_element (INTERFACE_NODE
, &isis_metric_l2_cmd
);
2145 install_element (INTERFACE_NODE
, &no_isis_metric_l2_cmd
);
2147 install_element (INTERFACE_NODE
, &isis_hello_interval_cmd
);
2148 install_element (INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
2149 install_element (INTERFACE_NODE
, &isis_hello_interval_l1_cmd
);
2150 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_cmd
);
2151 install_element (INTERFACE_NODE
, &isis_hello_interval_l2_cmd
);
2152 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_cmd
);
2154 install_element (INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
2155 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
2156 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l1_cmd
);
2157 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_cmd
);
2158 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l2_cmd
);
2159 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_cmd
);
2161 install_element (INTERFACE_NODE
, &isis_hello_padding_cmd
);
2162 install_element (INTERFACE_NODE
, &no_isis_hello_padding_cmd
);
2164 install_element (INTERFACE_NODE
, &csnp_interval_cmd
);
2165 install_element (INTERFACE_NODE
, &no_csnp_interval_cmd
);
2166 install_element (INTERFACE_NODE
, &csnp_interval_l1_cmd
);
2167 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_cmd
);
2168 install_element (INTERFACE_NODE
, &csnp_interval_l2_cmd
);
2169 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_cmd
);
2171 install_element (INTERFACE_NODE
, &psnp_interval_cmd
);
2172 install_element (INTERFACE_NODE
, &no_psnp_interval_cmd
);
2173 install_element (INTERFACE_NODE
, &psnp_interval_l1_cmd
);
2174 install_element (INTERFACE_NODE
, &no_psnp_interval_l1_cmd
);
2175 install_element (INTERFACE_NODE
, &psnp_interval_l2_cmd
);
2176 install_element (INTERFACE_NODE
, &no_psnp_interval_l2_cmd
);
2178 install_element (INTERFACE_NODE
, &circuit_topology_cmd
);
2179 install_element (INTERFACE_NODE
, &no_circuit_topology_cmd
);
2181 install_element (ISIS_NODE
, &metric_style_cmd
);
2182 install_element (ISIS_NODE
, &no_metric_style_cmd
);
2184 install_element (ISIS_NODE
, &set_overload_bit_cmd
);
2185 install_element (ISIS_NODE
, &no_set_overload_bit_cmd
);
2187 install_element (ISIS_NODE
, &set_attached_bit_cmd
);
2188 install_element (ISIS_NODE
, &no_set_attached_bit_cmd
);
2190 install_element (ISIS_NODE
, &dynamic_hostname_cmd
);
2191 install_element (ISIS_NODE
, &no_dynamic_hostname_cmd
);
2193 install_element (ISIS_NODE
, &area_lsp_mtu_cmd
);
2194 install_element (ISIS_NODE
, &no_area_lsp_mtu_cmd
);
2196 install_element (ISIS_NODE
, &is_type_cmd
);
2197 install_element (ISIS_NODE
, &no_is_type_cmd
);
2199 install_element (ISIS_NODE
, &lsp_gen_interval_cmd
);
2200 install_element (ISIS_NODE
, &no_lsp_gen_interval_cmd
);
2202 install_element (ISIS_NODE
, &spf_interval_cmd
);
2203 install_element (ISIS_NODE
, &no_spf_interval_cmd
);
2204 install_element (ISIS_NODE
, &spf_interval_l1_cmd
);
2205 install_element (ISIS_NODE
, &no_spf_interval_l1_cmd
);
2206 install_element (ISIS_NODE
, &spf_interval_l2_cmd
);
2207 install_element (ISIS_NODE
, &no_spf_interval_l2_cmd
);
2209 install_element (ISIS_NODE
, &max_lsp_lifetime_cmd
);
2210 install_element (ISIS_NODE
, &no_max_lsp_lifetime_cmd
);
2212 install_element (ISIS_NODE
, &lsp_refresh_interval_cmd
);
2213 install_element (ISIS_NODE
, &no_lsp_refresh_interval_cmd
);
2215 install_element (ISIS_NODE
, &area_passwd_md5_cmd
);
2216 install_element (ISIS_NODE
, &area_passwd_clear_cmd
);
2217 install_element (ISIS_NODE
, &domain_passwd_md5_cmd
);
2218 install_element (ISIS_NODE
, &domain_passwd_clear_cmd
);
2219 install_element (ISIS_NODE
, &no_area_passwd_cmd
);
2221 install_element (ISIS_NODE
, &spf_delay_ietf_cmd
);
2222 install_element (ISIS_NODE
, &no_spf_delay_ietf_cmd
);