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_out (vty
, "Invalid interface %s", VTY_NEWLINE
);
47 circuit
= circuit_scan_by_ifp (ifp
);
50 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
51 ifp
->name
, VTY_NEWLINE
);
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_out (vty
, "ISIS circuit is already defined on %s%s",
81 circuit
->area
->area_tag
, VTY_NEWLINE
);
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_out(vty
, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE
);
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_out (vty
, "Can't find ISIS instance %s%s",
143 argv
[idx_afi
]->arg
, VTY_NEWLINE
);
144 return CMD_ERR_NO_MATCH
;
147 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
150 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
151 ifp
->name
, VTY_NEWLINE
);
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_out (vty
, "Can't set no passive for loopback interface%s",
194 return CMD_ERR_AMBIGUOUS
;
197 isis_circuit_passive_set (circuit
, 0);
201 DEFUN (isis_circuit_type
,
202 isis_circuit_type_cmd
,
203 "isis circuit-type <level-1|level-1-2|level-2-only>",
205 "Configure circuit type for interface\n"
206 "Level-1 only adjacencies are formed\n"
207 "Level-1-2 adjacencies are formed\n"
208 "Level-2 only adjacencies are formed\n")
212 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
214 return CMD_ERR_NO_MATCH
;
216 is_type
= string2circuit_t (argv
[idx_level
]->arg
);
219 vty_out (vty
, "Unknown circuit-type %s", VTY_NEWLINE
);
220 return CMD_ERR_AMBIGUOUS
;
223 if (circuit
->state
== C_STATE_UP
&&
224 circuit
->area
->is_type
!= IS_LEVEL_1_AND_2
&&
225 circuit
->area
->is_type
!= is_type
)
227 vty_out (vty
, "Invalid circuit level for area %s.%s",
228 circuit
->area
->area_tag
, VTY_NEWLINE
);
229 return CMD_ERR_AMBIGUOUS
;
231 isis_circuit_is_type_set (circuit
, is_type
);
236 DEFUN (no_isis_circuit_type
,
237 no_isis_circuit_type_cmd
,
238 "no isis circuit-type <level-1|level-1-2|level-2-only>",
241 "Configure circuit type for interface\n"
242 "Level-1 only adjacencies are formed\n"
243 "Level-1-2 adjacencies are formed\n"
244 "Level-2 only adjacencies are formed\n")
247 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
249 return CMD_ERR_NO_MATCH
;
252 * Set the circuits level to its default value
254 if (circuit
->state
== C_STATE_UP
)
255 is_type
= circuit
->area
->is_type
;
257 is_type
= IS_LEVEL_1_AND_2
;
258 isis_circuit_is_type_set (circuit
, is_type
);
265 "isis network point-to-point",
268 "point-to-point network type\n")
270 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
272 return CMD_ERR_NO_MATCH
;
274 if (isis_circuit_circ_type_set(circuit
, CIRCUIT_T_P2P
))
276 vty_out (vty
, "isis network point-to-point "
277 "is valid only on broadcast interfaces%s",
279 return CMD_ERR_AMBIGUOUS
;
285 DEFUN (no_isis_network
,
287 "no isis network point-to-point",
290 "Set network type for circuit\n"
291 "point-to-point network type\n")
293 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
295 return CMD_ERR_NO_MATCH
;
297 if (isis_circuit_circ_type_set(circuit
, CIRCUIT_T_BROADCAST
))
299 vty_out (vty
, "isis network point-to-point "
300 "is valid only on broadcast interfaces%s",
302 return CMD_ERR_AMBIGUOUS
;
310 "isis password <md5|clear> WORD",
312 "Configure the authentication password for a circuit\n"
313 "HMAC-MD5 authentication\n"
314 "Cleartext password\n"
315 "Circuit password\n")
317 int idx_encryption
= 2;
319 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
322 return CMD_ERR_NO_MATCH
;
324 if (argv
[idx_encryption
]->arg
[0] == 'm')
325 rv
= isis_circuit_passwd_hmac_md5_set(circuit
, argv
[idx_word
]->arg
);
327 rv
= isis_circuit_passwd_cleartext_set(circuit
, argv
[idx_word
]->arg
);
330 vty_out (vty
, "Too long circuit password (>254)%s", VTY_NEWLINE
);
331 return CMD_ERR_AMBIGUOUS
;
337 DEFUN (no_isis_passwd
,
339 "no isis password [<md5|clear> WORD]",
342 "Configure the authentication password for a circuit\n"
343 "HMAC-MD5 authentication\n"
344 "Cleartext password\n"
345 "Circuit password\n")
347 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
349 return CMD_ERR_NO_MATCH
;
351 isis_circuit_passwd_unset(circuit
);
357 DEFUN (isis_priority
,
359 "isis priority (0-127)",
361 "Set priority for Designated Router election\n"
366 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
368 return CMD_ERR_NO_MATCH
;
370 prio
= atoi (argv
[idx_number
]->arg
);
371 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
373 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
375 return CMD_ERR_AMBIGUOUS
;
378 circuit
->priority
[0] = prio
;
379 circuit
->priority
[1] = prio
;
384 DEFUN (no_isis_priority
,
385 no_isis_priority_cmd
,
386 "no isis priority [(0-127)]",
389 "Set priority for Designated Router election\n"
392 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
394 return CMD_ERR_NO_MATCH
;
396 circuit
->priority
[0] = DEFAULT_PRIORITY
;
397 circuit
->priority
[1] = DEFAULT_PRIORITY
;
403 DEFUN (isis_priority_l1
,
404 isis_priority_l1_cmd
,
405 "isis priority (0-127) level-1",
407 "Set priority for Designated Router election\n"
409 "Specify priority for level-1 routing\n")
413 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
415 return CMD_ERR_NO_MATCH
;
417 prio
= atoi (argv
[idx_number
]->arg
);
418 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
420 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
422 return CMD_ERR_AMBIGUOUS
;
425 circuit
->priority
[0] = prio
;
430 DEFUN (no_isis_priority_l1
,
431 no_isis_priority_l1_cmd
,
432 "no isis priority [(0-127)] level-1",
435 "Set priority for Designated Router election\n"
437 "Specify priority for level-1 routing\n")
439 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
441 return CMD_ERR_NO_MATCH
;
443 circuit
->priority
[0] = DEFAULT_PRIORITY
;
449 DEFUN (isis_priority_l2
,
450 isis_priority_l2_cmd
,
451 "isis priority (0-127) level-2",
453 "Set priority for Designated Router election\n"
455 "Specify priority for level-2 routing\n")
459 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
461 return CMD_ERR_NO_MATCH
;
463 prio
= atoi (argv
[idx_number
]->arg
);
464 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
466 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
468 return CMD_ERR_AMBIGUOUS
;
471 circuit
->priority
[1] = prio
;
476 DEFUN (no_isis_priority_l2
,
477 no_isis_priority_l2_cmd
,
478 "no isis priority [(0-127)] level-2",
481 "Set priority for Designated Router election\n"
483 "Specify priority for level-2 routing\n")
485 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
487 return CMD_ERR_NO_MATCH
;
489 circuit
->priority
[1] = DEFAULT_PRIORITY
;
498 "isis metric (0-16777215)",
500 "Set default metric for circuit\n"
501 "Default metric value\n")
505 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
507 return CMD_ERR_NO_MATCH
;
509 met
= atoi (argv
[idx_number
]->arg
);
511 /* RFC3787 section 5.1 */
512 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
513 met
> MAX_NARROW_LINK_METRIC
)
515 vty_out (vty
, "Invalid metric %d - should be <0-63> "
516 "when narrow metric type enabled%s",
518 return CMD_ERR_AMBIGUOUS
;
522 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
523 met
> MAX_WIDE_LINK_METRIC
)
525 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
526 "when wide metric type enabled%s",
528 return CMD_ERR_AMBIGUOUS
;
531 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, met
);
532 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, met
);
537 DEFUN (no_isis_metric
,
539 "no isis metric [(0-16777215)]",
542 "Set default metric for circuit\n"
543 "Default metric value\n")
545 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
547 return CMD_ERR_NO_MATCH
;
549 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, DEFAULT_CIRCUIT_METRIC
);
550 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, DEFAULT_CIRCUIT_METRIC
);
555 DEFUN (isis_metric_l1
,
557 "isis metric (0-16777215) level-1",
559 "Set default metric for circuit\n"
560 "Default metric value\n"
561 "Specify metric for level-1 routing\n")
565 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
567 return CMD_ERR_NO_MATCH
;
569 met
= atoi (argv
[idx_number
]->arg
);
571 /* RFC3787 section 5.1 */
572 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
573 met
> MAX_NARROW_LINK_METRIC
)
575 vty_out (vty
, "Invalid metric %d - should be <0-63> "
576 "when narrow metric type enabled%s",
578 return CMD_ERR_AMBIGUOUS
;
582 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
583 met
> MAX_WIDE_LINK_METRIC
)
585 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
586 "when wide metric type enabled%s",
588 return CMD_ERR_AMBIGUOUS
;
591 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, met
);
596 DEFUN (no_isis_metric_l1
,
597 no_isis_metric_l1_cmd
,
598 "no isis metric [(0-16777215)] level-1",
601 "Set default metric for circuit\n"
602 "Default metric value\n"
603 "Specify metric for level-1 routing\n")
605 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
607 return CMD_ERR_NO_MATCH
;
609 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, DEFAULT_CIRCUIT_METRIC
);
614 DEFUN (isis_metric_l2
,
616 "isis metric (0-16777215) level-2",
618 "Set default metric for circuit\n"
619 "Default metric value\n"
620 "Specify metric for level-2 routing\n")
624 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
626 return CMD_ERR_NO_MATCH
;
628 met
= atoi (argv
[idx_number
]->arg
);
630 /* RFC3787 section 5.1 */
631 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
632 met
> MAX_NARROW_LINK_METRIC
)
634 vty_out (vty
, "Invalid metric %d - should be <0-63> "
635 "when narrow metric type enabled%s",
637 return CMD_ERR_AMBIGUOUS
;
641 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
642 met
> MAX_WIDE_LINK_METRIC
)
644 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
645 "when wide metric type enabled%s",
647 return CMD_ERR_AMBIGUOUS
;
650 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, met
);
655 DEFUN (no_isis_metric_l2
,
656 no_isis_metric_l2_cmd
,
657 "no isis metric [(0-16777215)] level-2",
660 "Set default metric for circuit\n"
661 "Default metric value\n"
662 "Specify metric for level-2 routing\n")
664 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
666 return CMD_ERR_NO_MATCH
;
668 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, DEFAULT_CIRCUIT_METRIC
);
674 DEFUN (isis_hello_interval
,
675 isis_hello_interval_cmd
,
676 "isis hello-interval (1-600)",
678 "Set Hello interval\n"
679 "Hello interval value\n"
680 "Holdtime 1 seconds, interval depends on multiplier\n")
684 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
686 return CMD_ERR_NO_MATCH
;
688 interval
= atoi (argv
[idx_number
]->arg
);
689 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
691 vty_out (vty
, "Invalid hello-interval %d - should be <1-600>%s",
692 interval
, VTY_NEWLINE
);
693 return CMD_ERR_AMBIGUOUS
;
696 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
697 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
703 DEFUN (no_isis_hello_interval
,
704 no_isis_hello_interval_cmd
,
705 "no isis hello-interval [(1-600)]",
708 "Set Hello interval\n"
709 "Holdtime 1 second, interval depends on multiplier\n")
711 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
713 return CMD_ERR_NO_MATCH
;
715 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
716 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
722 DEFUN (isis_hello_interval_l1
,
723 isis_hello_interval_l1_cmd
,
724 "isis hello-interval (1-600) level-1",
726 "Set Hello interval\n"
727 "Hello interval value\n"
728 "Holdtime 1 second, interval depends on multiplier\n"
729 "Specify hello-interval for level-1 IIHs\n")
733 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
735 return CMD_ERR_NO_MATCH
;
737 interval
= atoi (argv
[idx_number
]->arg
);
738 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
740 vty_out (vty
, "Invalid hello-interval %ld - should be <1-600>%s",
741 interval
, VTY_NEWLINE
);
742 return CMD_ERR_AMBIGUOUS
;
745 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
751 DEFUN (no_isis_hello_interval_l1
,
752 no_isis_hello_interval_l1_cmd
,
753 "no isis hello-interval [(1-600)] level-1",
756 "Set Hello interval\n"
757 "Holdtime 1 second, interval depends on multiplier\n"
758 "Specify hello-interval for level-1 IIHs\n")
760 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
762 return CMD_ERR_NO_MATCH
;
764 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
770 DEFUN (isis_hello_interval_l2
,
771 isis_hello_interval_l2_cmd
,
772 "isis hello-interval (1-600) level-2",
774 "Set Hello interval\n"
775 "Hello interval value\n"
776 "Holdtime 1 second, interval depends on multiplier\n"
777 "Specify hello-interval for level-2 IIHs\n")
781 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
783 return CMD_ERR_NO_MATCH
;
785 interval
= atoi (argv
[idx_number
]->arg
);
786 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
788 vty_out (vty
, "Invalid hello-interval %ld - should be <1-600>%s",
789 interval
, VTY_NEWLINE
);
790 return CMD_ERR_AMBIGUOUS
;
793 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
799 DEFUN (no_isis_hello_interval_l2
,
800 no_isis_hello_interval_l2_cmd
,
801 "no isis hello-interval [(1-600)] level-2",
804 "Set Hello interval\n"
805 "Holdtime 1 second, interval depends on multiplier\n"
806 "Specify hello-interval for level-2 IIHs\n")
808 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
810 return CMD_ERR_NO_MATCH
;
812 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
818 DEFUN (isis_hello_multiplier
,
819 isis_hello_multiplier_cmd
,
820 "isis hello-multiplier (2-100)",
822 "Set multiplier for Hello holding time\n"
823 "Hello multiplier value\n")
827 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
829 return CMD_ERR_NO_MATCH
;
831 mult
= atoi (argv
[idx_number
]->arg
);
832 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
834 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
836 return CMD_ERR_AMBIGUOUS
;
839 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
840 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
846 DEFUN (no_isis_hello_multiplier
,
847 no_isis_hello_multiplier_cmd
,
848 "no isis hello-multiplier [(2-100)]",
851 "Set multiplier for Hello holding time\n"
852 "Hello multiplier value\n")
854 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
856 return CMD_ERR_NO_MATCH
;
858 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
859 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
865 DEFUN (isis_hello_multiplier_l1
,
866 isis_hello_multiplier_l1_cmd
,
867 "isis hello-multiplier (2-100) level-1",
869 "Set multiplier for Hello holding time\n"
870 "Hello multiplier value\n"
871 "Specify hello multiplier for level-1 IIHs\n")
875 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
877 return CMD_ERR_NO_MATCH
;
879 mult
= atoi (argv
[idx_number
]->arg
);
880 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
882 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
884 return CMD_ERR_AMBIGUOUS
;
887 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
893 DEFUN (no_isis_hello_multiplier_l1
,
894 no_isis_hello_multiplier_l1_cmd
,
895 "no isis hello-multiplier [(2-100)] level-1",
898 "Set multiplier for Hello holding time\n"
899 "Hello multiplier value\n"
900 "Specify hello multiplier for level-1 IIHs\n")
902 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
904 return CMD_ERR_NO_MATCH
;
906 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
912 DEFUN (isis_hello_multiplier_l2
,
913 isis_hello_multiplier_l2_cmd
,
914 "isis hello-multiplier (2-100) level-2",
916 "Set multiplier for Hello holding time\n"
917 "Hello multiplier value\n"
918 "Specify hello multiplier for level-2 IIHs\n")
922 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
924 return CMD_ERR_NO_MATCH
;
926 mult
= atoi (argv
[idx_number
]->arg
);
927 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
929 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
931 return CMD_ERR_AMBIGUOUS
;
934 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
940 DEFUN (no_isis_hello_multiplier_l2
,
941 no_isis_hello_multiplier_l2_cmd
,
942 "no isis hello-multiplier [(2-100)] level-2",
945 "Set multiplier for Hello holding time\n"
946 "Hello multiplier value\n"
947 "Specify hello multiplier for level-2 IIHs\n")
949 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
951 return CMD_ERR_NO_MATCH
;
953 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
959 DEFUN (isis_hello_padding
,
960 isis_hello_padding_cmd
,
961 "isis hello padding",
963 "Add padding to IS-IS hello packets\n"
964 "Pad hello packets\n"
967 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
969 return CMD_ERR_NO_MATCH
;
971 circuit
->pad_hellos
= 1;
976 DEFUN (no_isis_hello_padding
,
977 no_isis_hello_padding_cmd
,
978 "no isis hello padding",
981 "Add padding to IS-IS hello packets\n"
982 "Pad hello packets\n"
985 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
987 return CMD_ERR_NO_MATCH
;
989 circuit
->pad_hellos
= 0;
994 DEFUN (csnp_interval
,
996 "isis csnp-interval (1-600)",
998 "Set CSNP interval in seconds\n"
999 "CSNP interval value\n")
1002 unsigned long interval
;
1003 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1005 return CMD_ERR_NO_MATCH
;
1007 interval
= atol (argv
[idx_number
]->arg
);
1008 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1010 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
1011 interval
, VTY_NEWLINE
);
1012 return CMD_ERR_AMBIGUOUS
;
1015 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1016 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1022 DEFUN (no_csnp_interval
,
1023 no_csnp_interval_cmd
,
1024 "no isis csnp-interval [(1-600)]",
1027 "Set CSNP interval in seconds\n"
1028 "CSNP interval value\n")
1030 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1032 return CMD_ERR_NO_MATCH
;
1034 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1035 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1041 DEFUN (csnp_interval_l1
,
1042 csnp_interval_l1_cmd
,
1043 "isis csnp-interval (1-600) level-1",
1045 "Set CSNP interval in seconds\n"
1046 "CSNP interval value\n"
1047 "Specify interval for level-1 CSNPs\n")
1050 unsigned long interval
;
1051 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1053 return CMD_ERR_NO_MATCH
;
1055 interval
= atol (argv
[idx_number
]->arg
);
1056 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1058 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
1059 interval
, VTY_NEWLINE
);
1060 return CMD_ERR_AMBIGUOUS
;
1063 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1069 DEFUN (no_csnp_interval_l1
,
1070 no_csnp_interval_l1_cmd
,
1071 "no isis csnp-interval [(1-600)] level-1",
1074 "Set CSNP interval in seconds\n"
1075 "CSNP interval value\n"
1076 "Specify interval for level-1 CSNPs\n")
1078 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1080 return CMD_ERR_NO_MATCH
;
1082 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1088 DEFUN (csnp_interval_l2
,
1089 csnp_interval_l2_cmd
,
1090 "isis csnp-interval (1-600) level-2",
1092 "Set CSNP interval in seconds\n"
1093 "CSNP interval value\n"
1094 "Specify interval for level-2 CSNPs\n")
1097 unsigned long interval
;
1098 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1100 return CMD_ERR_NO_MATCH
;
1102 interval
= atol (argv
[idx_number
]->arg
);
1103 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1105 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
1106 interval
, VTY_NEWLINE
);
1107 return CMD_ERR_AMBIGUOUS
;
1110 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1116 DEFUN (no_csnp_interval_l2
,
1117 no_csnp_interval_l2_cmd
,
1118 "no isis csnp-interval [(1-600)] level-2",
1121 "Set CSNP interval in seconds\n"
1122 "CSNP interval value\n"
1123 "Specify interval for level-2 CSNPs\n")
1125 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1127 return CMD_ERR_NO_MATCH
;
1129 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1135 DEFUN (psnp_interval
,
1137 "isis psnp-interval (1-120)",
1139 "Set PSNP interval in seconds\n"
1140 "PSNP interval value\n")
1143 unsigned long interval
;
1144 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1146 return CMD_ERR_NO_MATCH
;
1148 interval
= atol (argv
[idx_number
]->arg
);
1149 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1151 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
1152 interval
, VTY_NEWLINE
);
1153 return CMD_ERR_AMBIGUOUS
;
1156 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
1157 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
1163 DEFUN (no_psnp_interval
,
1164 no_psnp_interval_cmd
,
1165 "no isis psnp-interval [(1-120)]",
1168 "Set PSNP interval in seconds\n"
1169 "PSNP interval value\n")
1171 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1173 return CMD_ERR_NO_MATCH
;
1175 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1176 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1182 DEFUN (psnp_interval_l1
,
1183 psnp_interval_l1_cmd
,
1184 "isis psnp-interval (1-120) level-1",
1186 "Set PSNP interval in seconds\n"
1187 "PSNP interval value\n"
1188 "Specify interval for level-1 PSNPs\n")
1191 unsigned long interval
;
1192 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1194 return CMD_ERR_NO_MATCH
;
1196 interval
= atol (argv
[idx_number
]->arg
);
1197 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1199 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
1200 interval
, VTY_NEWLINE
);
1201 return CMD_ERR_AMBIGUOUS
;
1204 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
1210 DEFUN (no_psnp_interval_l1
,
1211 no_psnp_interval_l1_cmd
,
1212 "no isis psnp-interval [(1-120)] level-1",
1215 "Set PSNP interval in seconds\n"
1216 "PSNP interval value\n"
1217 "Specify interval for level-1 PSNPs\n")
1219 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1221 return CMD_ERR_NO_MATCH
;
1223 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1229 DEFUN (psnp_interval_l2
,
1230 psnp_interval_l2_cmd
,
1231 "isis psnp-interval (1-120) level-2",
1233 "Set PSNP interval in seconds\n"
1234 "PSNP interval value\n"
1235 "Specify interval for level-2 PSNPs\n")
1238 unsigned long interval
;
1239 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1241 return CMD_ERR_NO_MATCH
;
1243 interval
= atol (argv
[idx_number
]->arg
);
1244 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1246 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
1247 interval
, VTY_NEWLINE
);
1248 return CMD_ERR_AMBIGUOUS
;
1251 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
1257 DEFUN (no_psnp_interval_l2
,
1258 no_psnp_interval_l2_cmd
,
1259 "no isis psnp-interval [(1-120)] level-2",
1262 "Set PSNP interval in seconds\n"
1263 "PSNP interval value\n"
1264 "Specify interval for level-2 PSNPs\n")
1266 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1268 return CMD_ERR_NO_MATCH
;
1270 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1275 DEFUN (circuit_topology
,
1276 circuit_topology_cmd
,
1277 "isis topology " ISIS_MT_NAMES
,
1279 "Configure interface IS-IS topologies\n"
1280 ISIS_MT_DESCRIPTIONS
)
1282 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1284 return CMD_ERR_NO_MATCH
;
1285 const char *arg
= argv
[2]->arg
;
1286 uint16_t mtid
= isis_str2mtid(arg
);
1288 if (circuit
->area
&& circuit
->area
->oldmetric
)
1290 vty_out (vty
, "Multi topology IS-IS can only be used with wide metrics%s", VTY_NEWLINE
);
1291 return CMD_ERR_AMBIGUOUS
;
1294 if (mtid
== (uint16_t)-1)
1296 vty_out (vty
, "Don't know topology '%s'%s", arg
, VTY_NEWLINE
);
1297 return CMD_ERR_AMBIGUOUS
;
1300 return isis_circuit_mt_enabled_set(circuit
, mtid
, true);
1303 DEFUN (no_circuit_topology
,
1304 no_circuit_topology_cmd
,
1305 "no isis topology " ISIS_MT_NAMES
,
1308 "Configure interface IS-IS topologies\n"
1309 ISIS_MT_DESCRIPTIONS
)
1311 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1313 return CMD_ERR_NO_MATCH
;
1314 const char *arg
= argv
[3]->arg
;
1315 uint16_t mtid
= isis_str2mtid(arg
);
1317 if (circuit
->area
&& circuit
->area
->oldmetric
)
1319 vty_out (vty
, "Multi topology IS-IS can only be used with wide metrics%s", VTY_NEWLINE
);
1320 return CMD_ERR_AMBIGUOUS
;
1323 if (mtid
== (uint16_t)-1)
1325 vty_out (vty
, "Don't know topology '%s'%s", arg
, VTY_NEWLINE
);
1326 return CMD_ERR_AMBIGUOUS
;
1329 return isis_circuit_mt_enabled_set(circuit
, mtid
, false);
1333 validate_metric_style_narrow (struct vty
*vty
, struct isis_area
*area
)
1335 struct isis_circuit
*circuit
;
1336 struct listnode
*node
;
1339 return CMD_ERR_AMBIGUOUS
;
1343 vty_out (vty
, "ISIS area is invalid%s", VTY_NEWLINE
);
1344 return CMD_ERR_AMBIGUOUS
;
1347 for (ALL_LIST_ELEMENTS_RO (area
->circuit_list
, node
, circuit
))
1349 if ((area
->is_type
& IS_LEVEL_1
) &&
1350 (circuit
->is_type
& IS_LEVEL_1
) &&
1351 (circuit
->te_metric
[0] > MAX_NARROW_LINK_METRIC
))
1353 vty_out (vty
, "ISIS circuit %s metric is invalid%s",
1354 circuit
->interface
->name
, VTY_NEWLINE
);
1355 return CMD_ERR_AMBIGUOUS
;
1357 if ((area
->is_type
& IS_LEVEL_2
) &&
1358 (circuit
->is_type
& IS_LEVEL_2
) &&
1359 (circuit
->te_metric
[1] > MAX_NARROW_LINK_METRIC
))
1361 vty_out (vty
, "ISIS circuit %s metric is invalid%s",
1362 circuit
->interface
->name
, VTY_NEWLINE
);
1363 return CMD_ERR_AMBIGUOUS
;
1370 DEFUN (metric_style
,
1372 "metric-style <narrow|transition|wide>",
1373 "Use old-style (ISO 10589) or new-style packet formats\n"
1374 "Use old style of TLVs with narrow metric\n"
1375 "Send and accept both styles of TLVs during transition\n"
1376 "Use new style of TLVs to carry wider metric\n")
1378 int idx_metric_style
= 1;
1379 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1382 if (strncmp (argv
[idx_metric_style
]->arg
, "w", 1) == 0)
1384 isis_area_metricstyle_set(area
, false, true);
1388 if (area_is_mt(area
))
1390 vty_out (vty
, "Narrow metrics cannot be used while multi topology IS-IS is active%s", VTY_NEWLINE
);
1391 return CMD_ERR_AMBIGUOUS
;
1394 ret
= validate_metric_style_narrow (vty
, area
);
1395 if (ret
!= CMD_SUCCESS
)
1398 if (strncmp (argv
[idx_metric_style
]->arg
, "t", 1) == 0)
1399 isis_area_metricstyle_set(area
, true, true);
1400 else if (strncmp (argv
[idx_metric_style
]->arg
, "n", 1) == 0)
1401 isis_area_metricstyle_set(area
, true, false);
1407 DEFUN (no_metric_style
,
1408 no_metric_style_cmd
,
1411 "Use old-style (ISO 10589) or new-style packet formats\n")
1413 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1416 if (area_is_mt(area
))
1418 vty_out (vty
, "Narrow metrics cannot be used while multi topology IS-IS is active%s", VTY_NEWLINE
);
1419 return CMD_ERR_AMBIGUOUS
;
1422 ret
= validate_metric_style_narrow (vty
, area
);
1423 if (ret
!= CMD_SUCCESS
)
1426 isis_area_metricstyle_set(area
, true, false);
1430 DEFUN (set_overload_bit
,
1431 set_overload_bit_cmd
,
1433 "Set overload bit to avoid any transit traffic\n"
1434 "Set overload bit\n")
1436 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1438 isis_area_overload_bit_set(area
, true);
1442 DEFUN (no_set_overload_bit
,
1443 no_set_overload_bit_cmd
,
1444 "no set-overload-bit",
1445 "Reset overload bit to accept transit traffic\n"
1446 "Reset overload bit\n")
1448 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1450 isis_area_overload_bit_set(area
, false);
1454 DEFUN (set_attached_bit
,
1455 set_attached_bit_cmd
,
1457 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
1458 "Set attached bit\n")
1460 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1462 isis_area_attached_bit_set(area
, true);
1466 DEFUN (no_set_attached_bit
,
1467 no_set_attached_bit_cmd
,
1468 "no set-attached-bit",
1470 "Reset attached bit\n")
1472 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1474 isis_area_attached_bit_set(area
, false);
1478 DEFUN (dynamic_hostname
,
1479 dynamic_hostname_cmd
,
1481 "Dynamic hostname for IS-IS\n"
1482 "Dynamic hostname\n")
1484 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1486 isis_area_dynhostname_set(area
, true);
1490 DEFUN (no_dynamic_hostname
,
1491 no_dynamic_hostname_cmd
,
1492 "no hostname dynamic",
1494 "Dynamic hostname for IS-IS\n"
1495 "Dynamic hostname\n")
1497 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1499 isis_area_dynhostname_set(area
, false);
1503 static int area_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
1505 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1506 struct listnode
*node
;
1507 struct isis_circuit
*circuit
;
1509 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1511 if(circuit
->state
!= C_STATE_INIT
&& circuit
->state
!= C_STATE_UP
)
1513 if(lsp_mtu
> isis_circuit_pdu_size(circuit
))
1515 vty_out(vty
, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1516 circuit
->interface
->name
, isis_circuit_pdu_size(circuit
),
1518 return CMD_ERR_AMBIGUOUS
;
1522 isis_area_lsp_mtu_set(area
, lsp_mtu
);
1526 DEFUN (area_lsp_mtu
,
1528 "lsp-mtu (128-4352)",
1529 "Configure the maximum size of generated LSPs\n"
1530 "Maximum size of generated LSPs\n")
1533 unsigned int lsp_mtu
;
1535 lsp_mtu
= strtoul(argv
[idx_number
]->arg
, NULL
, 10);
1537 return area_lsp_mtu_set(vty
, lsp_mtu
);
1541 DEFUN (no_area_lsp_mtu
,
1542 no_area_lsp_mtu_cmd
,
1543 "no lsp-mtu [(128-4352)]",
1545 "Configure the maximum size of generated LSPs\n"
1546 "Maximum size of generated LSPs\n")
1548 return area_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
1554 "is-type <level-1|level-1-2|level-2-only>",
1555 "IS Level for this routing process (OSI only)\n"
1556 "Act as a station router only\n"
1557 "Act as both a station router and an area router\n"
1558 "Act as an area router only\n")
1561 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1564 type
= string2circuit_t (argv
[idx_level
]->arg
);
1567 vty_out (vty
, "Unknown IS level %s", VTY_NEWLINE
);
1571 isis_area_is_type_set(area
, type
);
1578 "no is-type <level-1|level-1-2|level-2-only>",
1580 "IS Level for this routing process (OSI only)\n"
1581 "Act as a station router only\n"
1582 "Act as both a station router and an area router\n"
1583 "Act as an area router only\n")
1585 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1589 * Put the is-type back to defaults:
1590 * - level-1-2 on first area
1591 * - level-1 for the rest
1593 if (listgetdata (listhead (isis
->area_list
)) == area
)
1594 type
= IS_LEVEL_1_AND_2
;
1598 isis_area_is_type_set(area
, type
);
1604 set_lsp_gen_interval (struct vty
*vty
, struct isis_area
*area
,
1605 uint16_t interval
, int level
)
1609 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1614 if (interval
>= area
->lsp_refresh
[lvl
-1])
1616 vty_out (vty
, "LSP gen interval %us must be less than "
1617 "the LSP refresh interval %us%s",
1618 interval
, area
->lsp_refresh
[lvl
-1], VTY_NEWLINE
);
1619 return CMD_ERR_AMBIGUOUS
;
1623 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1627 area
->lsp_gen_interval
[lvl
-1] = interval
;
1633 DEFUN (lsp_gen_interval
,
1634 lsp_gen_interval_cmd
,
1635 "lsp-gen-interval [<level-1|level-2>] (1-120)",
1636 "Minimum interval between regenerating same LSP\n"
1637 "Set interval for level 1 only\n"
1638 "Set interval for level 2 only\n"
1639 "Minimum interval in seconds\n")
1642 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1647 level
|= argv_find (argv
, argc
, "level-1", &idx
) ? IS_LEVEL_1
: 0;
1648 level
|= argv_find (argv
, argc
, "level-2", &idx
) ? IS_LEVEL_2
: 0;
1650 level
= IS_LEVEL_1
| IS_LEVEL_2
;
1652 argv_find (argv
, argc
, "(1-120)", &idx
);
1654 interval
= atoi (argv
[idx
]->arg
);
1655 return set_lsp_gen_interval (vty
, area
, interval
, level
);
1658 DEFUN (no_lsp_gen_interval
,
1659 no_lsp_gen_interval_cmd
,
1660 "no lsp-gen-interval [<level-1|level-2>] [(1-120)]",
1662 "Minimum interval between regenerating same LSP\n"
1663 "Set interval for level 1 only\n"
1664 "Set interval for level 2 only\n"
1665 "Minimum interval in seconds\n")
1668 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1673 level
|= argv_find (argv
, argc
, "level-1", &idx
) ? IS_LEVEL_1
: 0;
1674 level
|= argv_find (argv
, argc
, "level-2", &idx
) ? IS_LEVEL_2
: 0;
1676 level
= IS_LEVEL_1
| IS_LEVEL_2
;
1678 interval
= DEFAULT_MIN_LSP_GEN_INTERVAL
;
1679 return set_lsp_gen_interval (vty
, area
, interval
, level
);
1682 DEFUN (spf_interval
,
1684 "spf-interval (1-120)",
1685 "Minimum interval between SPF calculations\n"
1686 "Minimum interval between consecutive SPFs in seconds\n")
1689 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1692 interval
= atoi (argv
[idx_number
]->arg
);
1693 area
->min_spf_interval
[0] = interval
;
1694 area
->min_spf_interval
[1] = interval
;
1700 DEFUN (no_spf_interval
,
1701 no_spf_interval_cmd
,
1702 "no spf-interval [[<level-1|level-2>] (1-120)]",
1704 "Minimum interval between SPF calculations\n"
1705 "Set interval for level 1 only\n"
1706 "Set interval for level 2 only\n"
1707 "Minimum interval between consecutive SPFs in seconds\n")
1709 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1711 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
1712 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
1718 DEFUN (spf_interval_l1
,
1719 spf_interval_l1_cmd
,
1720 "spf-interval level-1 (1-120)",
1721 "Minimum interval between SPF calculations\n"
1722 "Set interval for level 1 only\n"
1723 "Minimum interval between consecutive SPFs in seconds\n")
1726 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1729 interval
= atoi (argv
[idx_number
]->arg
);
1730 area
->min_spf_interval
[0] = interval
;
1735 DEFUN (no_spf_interval_l1
,
1736 no_spf_interval_l1_cmd
,
1737 "no spf-interval level-1",
1739 "Minimum interval between SPF calculations\n"
1740 "Set interval for level 1 only\n")
1742 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1744 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
1750 DEFUN (spf_interval_l2
,
1751 spf_interval_l2_cmd
,
1752 "spf-interval level-2 (1-120)",
1753 "Minimum interval between SPF calculations\n"
1754 "Set interval for level 2 only\n"
1755 "Minimum interval between consecutive SPFs in seconds\n")
1758 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1761 interval
= atoi (argv
[idx_number
]->arg
);
1762 area
->min_spf_interval
[1] = interval
;
1767 DEFUN (no_spf_interval_l2
,
1768 no_spf_interval_l2_cmd
,
1769 "no spf-interval level-2",
1771 "Minimum interval between SPF calculations\n"
1772 "Set interval for level 2 only\n")
1774 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1776 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
1781 DEFUN (no_spf_delay_ietf
,
1782 no_spf_delay_ietf_cmd
,
1783 "no spf-delay-ietf",
1785 "IETF SPF delay algorithm\n")
1787 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1789 spf_backoff_free(area
->spf_delay_ietf
[0]);
1790 spf_backoff_free(area
->spf_delay_ietf
[1]);
1791 area
->spf_delay_ietf
[0] = NULL
;
1792 area
->spf_delay_ietf
[1] = NULL
;
1797 DEFUN (spf_delay_ietf
,
1799 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
1800 "IETF SPF delay algorithm\n"
1801 "Delay used while in QUIET state\n"
1802 "Delay used while in QUIET state in milliseconds\n"
1803 "Delay used while in SHORT_WAIT state\n"
1804 "Delay used while in SHORT_WAIT state in milliseconds\n"
1805 "Delay used while in LONG_WAIT\n"
1806 "Delay used while in LONG_WAIT state in milliseconds\n"
1807 "Time with no received IGP events before considering IGP stable\n"
1808 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
1809 "Maximum duration needed to learn all the events related to a single failure\n"
1810 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
1812 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1814 long init_delay
= atol(argv
[2]->arg
);
1815 long short_delay
= atol(argv
[4]->arg
);
1816 long long_delay
= atol(argv
[6]->arg
);
1817 long holddown
= atol(argv
[8]->arg
);
1818 long timetolearn
= atol(argv
[10]->arg
);
1820 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
1821 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
1823 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
1824 spf_backoff_free(area
->spf_delay_ietf
[0]);
1825 area
->spf_delay_ietf
[0] = spf_backoff_new(master
, buf
, init_delay
,
1826 short_delay
, long_delay
,
1827 holddown
, timetolearn
);
1829 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
1830 spf_backoff_free(area
->spf_delay_ietf
[1]);
1831 area
->spf_delay_ietf
[1] = spf_backoff_new(master
, buf
, init_delay
,
1832 short_delay
, long_delay
,
1833 holddown
, timetolearn
);
1835 XFREE(MTYPE_TMP
, buf
);
1840 area_max_lsp_lifetime_set(struct vty
*vty
, int level
,
1843 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1845 uint16_t refresh_interval
= interval
- 300;
1846 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
1848 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++)
1853 if (refresh_interval
< area
->lsp_refresh
[lvl
-1])
1855 vty_out (vty
, "Level %d Max LSP lifetime %us must be 300s greater than "
1856 "the configured LSP refresh interval %us%s",
1857 lvl
, interval
, area
->lsp_refresh
[lvl
-1], VTY_NEWLINE
);
1858 vty_out (vty
, "Automatically reducing level %d LSP refresh interval "
1859 "to %us%s", lvl
, refresh_interval
, VTY_NEWLINE
);
1860 set_refresh_interval
[lvl
-1] = 1;
1862 if (refresh_interval
<= area
->lsp_gen_interval
[lvl
-1])
1864 vty_out (vty
, "LSP refresh interval %us must be greater than "
1865 "the configured LSP gen interval %us%s",
1866 refresh_interval
, area
->lsp_gen_interval
[lvl
-1],
1868 return CMD_ERR_AMBIGUOUS
;
1873 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++)
1877 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
1878 if (set_refresh_interval
[lvl
-1])
1879 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
1885 DEFUN (max_lsp_lifetime
,
1886 max_lsp_lifetime_cmd
,
1887 "max-lsp-lifetime [<level-1|level-2>] (350-65535)",
1888 "Maximum LSP lifetime\n"
1889 "Maximum LSP lifetime for Level 1 only\n"
1890 "Maximum LSP lifetime for Level 2 only\n"
1891 "LSP lifetime in seconds\n")
1894 unsigned int level
= IS_LEVEL_1_AND_2
;
1896 if (argv_find (argv
, argc
, "level-1", &idx
))
1898 else if (argv_find (argv
, argc
, "level-2", &idx
))
1901 argv_find (argv
, argc
, "(350-65535)", &idx
);
1902 int lifetime
= atoi(argv
[idx
]->arg
);
1904 return area_max_lsp_lifetime_set(vty
, level
, lifetime
);
1908 DEFUN (no_max_lsp_lifetime
,
1909 no_max_lsp_lifetime_cmd
,
1910 "no max-lsp-lifetime [<level-1|level-2>] [(350-65535)]",
1912 "Maximum LSP lifetime\n"
1913 "Maximum LSP lifetime for Level 1 only\n"
1914 "Maximum LSP lifetime for Level 2 only\n"
1915 "LSP lifetime in seconds\n")
1918 unsigned int level
= IS_LEVEL_1_AND_2
;
1920 if (argv_find (argv
, argc
, "level-1", &idx
))
1922 else if (argv_find (argv
, argc
, "level-2", &idx
))
1925 return area_max_lsp_lifetime_set(vty
, level
, DEFAULT_LSP_LIFETIME
);
1929 area_lsp_refresh_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
1931 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1934 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1938 if (interval
<= area
->lsp_gen_interval
[lvl
-1])
1940 vty_out (vty
, "LSP refresh interval %us must be greater than "
1941 "the configured LSP gen interval %us%s",
1942 interval
, area
->lsp_gen_interval
[lvl
-1],
1944 return CMD_ERR_AMBIGUOUS
;
1946 if (interval
> (area
->max_lsp_lifetime
[lvl
-1] - 300))
1948 vty_out (vty
, "LSP refresh interval %us must be less than "
1949 "the configured LSP lifetime %us less 300%s",
1950 interval
, area
->max_lsp_lifetime
[lvl
-1],
1952 return CMD_ERR_AMBIGUOUS
;
1956 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1960 isis_area_lsp_refresh_set(area
, lvl
, interval
);
1966 DEFUN (lsp_refresh_interval
,
1967 lsp_refresh_interval_cmd
,
1968 "lsp-refresh-interval [<level-1|level-2>] (1-65235)",
1969 "LSP refresh interval\n"
1970 "LSP refresh interval for Level 1 only\n"
1971 "LSP refresh interval for Level 2 only\n"
1972 "LSP refresh interval in seconds\n")
1975 unsigned int level
= IS_LEVEL_1_AND_2
;
1976 unsigned int interval
= 0;
1978 if (argv_find (argv
, argc
, "level-1", &idx
))
1980 else if (argv_find (argv
, argc
, "level-2", &idx
))
1983 interval
= atoi(argv
[argc
-1]->arg
);
1984 return area_lsp_refresh_interval_set(vty
, level
, interval
);
1987 DEFUN (no_lsp_refresh_interval
,
1988 no_lsp_refresh_interval_cmd
,
1989 "no lsp-refresh-interval [<level-1|level-2>] [(1-65235)]",
1991 "LSP refresh interval\n"
1992 "LSP refresh interval for Level 1 only\n"
1993 "LSP refresh interval for Level 2 only\n"
1994 "LSP refresh interval in seconds\n")
1997 unsigned int level
= IS_LEVEL_1_AND_2
;
1999 if (argv_find (argv
, argc
, "level-1", &idx
))
2001 else if (argv_find (argv
, argc
, "level-2", &idx
))
2004 return area_lsp_refresh_interval_set(vty
, level
, DEFAULT_MAX_LSP_GEN_INTERVAL
);
2008 area_passwd_set(struct vty
*vty
, int level
,
2009 int (*type_set
)(struct isis_area
*area
, int level
,
2010 const char *passwd
, u_char snp_auth
),
2011 const char *passwd
, u_char snp_auth
)
2013 VTY_DECLVAR_CONTEXT (isis_area
, area
);
2015 if (passwd
&& strlen(passwd
) > 254)
2017 vty_out (vty
, "Too long area password (>254)%s", VTY_NEWLINE
);
2018 return CMD_ERR_AMBIGUOUS
;
2021 type_set(area
, level
, passwd
, snp_auth
);
2026 DEFUN (area_passwd_md5
,
2027 area_passwd_md5_cmd
,
2028 "area-password md5 WORD [authenticate snp <send-only|validate>]",
2029 "Configure the authentication password for an area\n"
2030 "Authentication type\n"
2031 "Level-wide password\n"
2034 "Send but do not check PDUs on receiving\n"
2035 "Send and check PDUs on receiving\n")
2037 int idx_password
= 0;
2040 u_char snp_auth
= 0;
2041 int level
= strmatch(argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2045 snp_auth
= SNP_AUTH_SEND
;
2046 if (strmatch(argv
[idx_type
]->text
, "validate"))
2047 snp_auth
|= SNP_AUTH_RECV
;
2050 return area_passwd_set(vty
, level
, isis_area_passwd_hmac_md5_set
,
2051 argv
[idx_word
]->arg
, snp_auth
);
2054 DEFUN (domain_passwd_md5
,
2055 domain_passwd_md5_cmd
,
2056 "domain-password md5 WORD [authenticate snp <send-only|validate>]",
2057 "Set the authentication password for a routing domain\n"
2058 "Authentication type\n"
2059 "Level-wide password\n"
2062 "Send but do not check PDUs on receiving\n"
2063 "Send and check PDUs on receiving\n")
2065 return area_passwd_md5 (self
, vty
, argc
, argv
);
2068 DEFUN (area_passwd_clear
,
2069 area_passwd_clear_cmd
,
2070 "area-password clear WORD [authenticate snp <send-only|validate>]",
2071 "Configure the authentication password for an area\n"
2072 "Authentication type\n"
2076 "Send but do not check PDUs on receiving\n"
2077 "Send and check PDUs on receiving\n")
2079 int idx_password
= 0;
2082 u_char snp_auth
= 0;
2083 int level
= strmatch(argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2087 snp_auth
= SNP_AUTH_SEND
;
2088 if (strmatch (argv
[idx_type
]->text
, "validate"))
2089 snp_auth
|= SNP_AUTH_RECV
;
2092 return area_passwd_set(vty
, level
, isis_area_passwd_cleartext_set
,
2093 argv
[idx_word
]->arg
, snp_auth
);
2096 DEFUN (domain_passwd_clear
,
2097 domain_passwd_clear_cmd
,
2098 "domain-password clear WORD [authenticate snp <send-only|validate>]",
2099 "Set the authentication password for a routing domain\n"
2100 "Authentication type\n"
2104 "Send but do not check PDUs on receiving\n"
2105 "Send and check PDUs on receiving\n")
2107 return area_passwd_clear (self
, vty
, argc
, argv
);
2110 DEFUN (no_area_passwd
,
2112 "no <area-password|domain-password>",
2114 "Configure the authentication password for an area\n"
2115 "Set the authentication password for a routing domain\n")
2117 int idx_password
= 1;
2118 int level
= strmatch (argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2119 VTY_DECLVAR_CONTEXT (isis_area
, area
);
2121 return isis_area_passwd_unset (area
, level
);
2125 isis_vty_init (void)
2127 install_element (INTERFACE_NODE
, &ip_router_isis_cmd
);
2128 install_element (INTERFACE_NODE
, &ip6_router_isis_cmd
);
2129 install_element (INTERFACE_NODE
, &no_ip_router_isis_cmd
);
2131 install_element (INTERFACE_NODE
, &isis_passive_cmd
);
2132 install_element (INTERFACE_NODE
, &no_isis_passive_cmd
);
2134 install_element (INTERFACE_NODE
, &isis_circuit_type_cmd
);
2135 install_element (INTERFACE_NODE
, &no_isis_circuit_type_cmd
);
2137 install_element (INTERFACE_NODE
, &isis_network_cmd
);
2138 install_element (INTERFACE_NODE
, &no_isis_network_cmd
);
2140 install_element (INTERFACE_NODE
, &isis_passwd_cmd
);
2141 install_element (INTERFACE_NODE
, &no_isis_passwd_cmd
);
2143 install_element (INTERFACE_NODE
, &isis_priority_cmd
);
2144 install_element (INTERFACE_NODE
, &no_isis_priority_cmd
);
2145 install_element (INTERFACE_NODE
, &isis_priority_l1_cmd
);
2146 install_element (INTERFACE_NODE
, &no_isis_priority_l1_cmd
);
2147 install_element (INTERFACE_NODE
, &isis_priority_l2_cmd
);
2148 install_element (INTERFACE_NODE
, &no_isis_priority_l2_cmd
);
2150 install_element (INTERFACE_NODE
, &isis_metric_cmd
);
2151 install_element (INTERFACE_NODE
, &no_isis_metric_cmd
);
2152 install_element (INTERFACE_NODE
, &isis_metric_l1_cmd
);
2153 install_element (INTERFACE_NODE
, &no_isis_metric_l1_cmd
);
2154 install_element (INTERFACE_NODE
, &isis_metric_l2_cmd
);
2155 install_element (INTERFACE_NODE
, &no_isis_metric_l2_cmd
);
2157 install_element (INTERFACE_NODE
, &isis_hello_interval_cmd
);
2158 install_element (INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
2159 install_element (INTERFACE_NODE
, &isis_hello_interval_l1_cmd
);
2160 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_cmd
);
2161 install_element (INTERFACE_NODE
, &isis_hello_interval_l2_cmd
);
2162 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_cmd
);
2164 install_element (INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
2165 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
2166 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l1_cmd
);
2167 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_cmd
);
2168 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l2_cmd
);
2169 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_cmd
);
2171 install_element (INTERFACE_NODE
, &isis_hello_padding_cmd
);
2172 install_element (INTERFACE_NODE
, &no_isis_hello_padding_cmd
);
2174 install_element (INTERFACE_NODE
, &csnp_interval_cmd
);
2175 install_element (INTERFACE_NODE
, &no_csnp_interval_cmd
);
2176 install_element (INTERFACE_NODE
, &csnp_interval_l1_cmd
);
2177 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_cmd
);
2178 install_element (INTERFACE_NODE
, &csnp_interval_l2_cmd
);
2179 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_cmd
);
2181 install_element (INTERFACE_NODE
, &psnp_interval_cmd
);
2182 install_element (INTERFACE_NODE
, &no_psnp_interval_cmd
);
2183 install_element (INTERFACE_NODE
, &psnp_interval_l1_cmd
);
2184 install_element (INTERFACE_NODE
, &no_psnp_interval_l1_cmd
);
2185 install_element (INTERFACE_NODE
, &psnp_interval_l2_cmd
);
2186 install_element (INTERFACE_NODE
, &no_psnp_interval_l2_cmd
);
2188 install_element (INTERFACE_NODE
, &circuit_topology_cmd
);
2189 install_element (INTERFACE_NODE
, &no_circuit_topology_cmd
);
2191 install_element (ISIS_NODE
, &metric_style_cmd
);
2192 install_element (ISIS_NODE
, &no_metric_style_cmd
);
2194 install_element (ISIS_NODE
, &set_overload_bit_cmd
);
2195 install_element (ISIS_NODE
, &no_set_overload_bit_cmd
);
2197 install_element (ISIS_NODE
, &set_attached_bit_cmd
);
2198 install_element (ISIS_NODE
, &no_set_attached_bit_cmd
);
2200 install_element (ISIS_NODE
, &dynamic_hostname_cmd
);
2201 install_element (ISIS_NODE
, &no_dynamic_hostname_cmd
);
2203 install_element (ISIS_NODE
, &area_lsp_mtu_cmd
);
2204 install_element (ISIS_NODE
, &no_area_lsp_mtu_cmd
);
2206 install_element (ISIS_NODE
, &is_type_cmd
);
2207 install_element (ISIS_NODE
, &no_is_type_cmd
);
2209 install_element (ISIS_NODE
, &lsp_gen_interval_cmd
);
2210 install_element (ISIS_NODE
, &no_lsp_gen_interval_cmd
);
2212 install_element (ISIS_NODE
, &spf_interval_cmd
);
2213 install_element (ISIS_NODE
, &no_spf_interval_cmd
);
2214 install_element (ISIS_NODE
, &spf_interval_l1_cmd
);
2215 install_element (ISIS_NODE
, &no_spf_interval_l1_cmd
);
2216 install_element (ISIS_NODE
, &spf_interval_l2_cmd
);
2217 install_element (ISIS_NODE
, &no_spf_interval_l2_cmd
);
2219 install_element (ISIS_NODE
, &max_lsp_lifetime_cmd
);
2220 install_element (ISIS_NODE
, &no_max_lsp_lifetime_cmd
);
2222 install_element (ISIS_NODE
, &lsp_refresh_interval_cmd
);
2223 install_element (ISIS_NODE
, &no_lsp_refresh_interval_cmd
);
2225 install_element (ISIS_NODE
, &area_passwd_md5_cmd
);
2226 install_element (ISIS_NODE
, &area_passwd_clear_cmd
);
2227 install_element (ISIS_NODE
, &domain_passwd_md5_cmd
);
2228 install_element (ISIS_NODE
, &domain_passwd_clear_cmd
);
2229 install_element (ISIS_NODE
, &no_area_passwd_cmd
);
2231 install_element (ISIS_NODE
, &spf_delay_ietf_cmd
);
2232 install_element (ISIS_NODE
, &no_spf_delay_ietf_cmd
);