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; if not, write to the Free Software Foundation, Inc.,
21 * 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
27 #include "spf_backoff.h"
29 #include "isis_circuit.h"
31 #include "isis_misc.h"
34 static struct isis_circuit
*
35 isis_circuit_lookup (struct vty
*vty
)
37 struct interface
*ifp
= VTY_GET_CONTEXT(interface
);
38 struct isis_circuit
*circuit
;
42 vty_out (vty
, "Invalid interface %s", VTY_NEWLINE
);
46 circuit
= circuit_scan_by_ifp (ifp
);
49 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
50 ifp
->name
, VTY_NEWLINE
);
57 DEFUN (ip_router_isis
,
59 "ip router isis WORD",
60 "Interface Internet Protocol config commands\n"
61 "IP router interface commands\n"
62 "IS-IS Routing for IP\n"
63 "Routing process tag\n")
67 VTY_DECLVAR_CONTEXT (interface
, ifp
);
68 struct isis_circuit
*circuit
;
69 struct isis_area
*area
;
70 const char *af
= argv
[idx_afi
]->arg
;
71 const char *area_tag
= argv
[idx_word
]->arg
;
73 /* Prevent more than one area per circuit */
74 circuit
= circuit_scan_by_ifp (ifp
);
75 if (circuit
&& circuit
->area
)
77 if (strcmp (circuit
->area
->area_tag
, area_tag
))
79 vty_out (vty
, "ISIS circuit is already defined on %s%s",
80 circuit
->area
->area_tag
, VTY_NEWLINE
);
81 return CMD_ERR_NOTHING_TODO
;
85 area
= isis_area_lookup (area_tag
);
87 area
= isis_area_create (area_tag
);
89 if (!circuit
|| !circuit
->area
) {
90 circuit
= isis_circuit_create (area
, ifp
);
92 if (circuit
->state
!= C_STATE_CONF
&& circuit
->state
!= C_STATE_UP
)
94 vty_out(vty
, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE
);
99 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
105 isis_circuit_af_set (circuit
, ip
, ipv6
);
109 DEFUN (ip6_router_isis
,
111 "ipv6 router isis WORD",
112 "Interface Internet Protocol config commands\n"
113 "IP router interface commands\n"
114 "IS-IS Routing for IP\n"
115 "Routing process tag\n")
117 return ip_router_isis (self
, vty
, argc
, argv
);
120 DEFUN (no_ip_router_isis
,
121 no_ip_router_isis_cmd
,
122 "no <ip|ipv6> router isis WORD",
124 "Interface Internet Protocol config commands\n"
125 "IP router interface commands\n"
126 "IP router interface commands\n"
127 "IS-IS Routing for IP\n"
128 "Routing process tag\n")
132 VTY_DECLVAR_CONTEXT (interface
, ifp
);
133 struct isis_area
*area
;
134 struct isis_circuit
*circuit
;
135 const char *af
= argv
[idx_afi
]->arg
;
136 const char *area_tag
= argv
[idx_word
]->arg
;
138 area
= isis_area_lookup (area_tag
);
141 vty_out (vty
, "Can't find ISIS instance %s%s",
142 argv
[idx_afi
]->arg
, VTY_NEWLINE
);
143 return CMD_ERR_NO_MATCH
;
146 circuit
= circuit_lookup_by_ifp (ifp
, area
->circuit_list
);
149 vty_out (vty
, "ISIS is not enabled on circuit %s%s",
150 ifp
->name
, VTY_NEWLINE
);
151 return CMD_ERR_NO_MATCH
;
154 bool ip
= circuit
->ip_router
, ipv6
= circuit
->ipv6_router
;
160 isis_circuit_af_set (circuit
, ip
, ipv6
);
168 "Configure the passive mode for interface\n")
170 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
172 return CMD_ERR_NO_MATCH
;
174 isis_circuit_passive_set (circuit
, 1);
178 DEFUN (no_isis_passive
,
183 "Configure the passive mode for interface\n")
185 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
187 return CMD_ERR_NO_MATCH
;
189 if (if_is_loopback (circuit
->interface
))
191 vty_out (vty
, "Can't set no passive for loopback interface%s",
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_out (vty
, "Unknown circuit-type %s", VTY_NEWLINE
);
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_out (vty
, "Invalid circuit level for area %s.%s",
227 circuit
->area
->area_tag
, VTY_NEWLINE
);
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
))
275 vty_out (vty
, "isis network point-to-point "
276 "is valid only on broadcast interfaces%s",
278 return CMD_ERR_AMBIGUOUS
;
284 DEFUN (no_isis_network
,
286 "no isis network point-to-point",
289 "Set network type for circuit\n"
290 "point-to-point network type\n")
292 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
294 return CMD_ERR_NO_MATCH
;
296 if (isis_circuit_circ_type_set(circuit
, CIRCUIT_T_BROADCAST
))
298 vty_out (vty
, "isis network point-to-point "
299 "is valid only on broadcast interfaces%s",
301 return CMD_ERR_AMBIGUOUS
;
309 "isis password <md5|clear> WORD",
311 "Configure the authentication password for a circuit\n"
312 "HMAC-MD5 authentication\n"
313 "Cleartext password\n"
314 "Circuit password\n")
316 int idx_encryption
= 2;
318 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
321 return CMD_ERR_NO_MATCH
;
323 if (argv
[idx_encryption
]->arg
[0] == 'm')
324 rv
= isis_circuit_passwd_hmac_md5_set(circuit
, argv
[idx_word
]->arg
);
326 rv
= isis_circuit_passwd_cleartext_set(circuit
, argv
[idx_word
]->arg
);
329 vty_out (vty
, "Too long circuit password (>254)%s", VTY_NEWLINE
);
330 return CMD_ERR_AMBIGUOUS
;
336 DEFUN (no_isis_passwd
,
338 "no isis password [<md5|clear> WORD]",
341 "Configure the authentication password for a circuit\n"
342 "HMAC-MD5 authentication\n"
343 "Cleartext password\n"
344 "Circuit password\n")
346 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
348 return CMD_ERR_NO_MATCH
;
350 isis_circuit_passwd_unset(circuit
);
356 DEFUN (isis_priority
,
358 "isis priority (0-127)",
360 "Set priority for Designated Router election\n"
365 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
367 return CMD_ERR_NO_MATCH
;
369 prio
= atoi (argv
[idx_number
]->arg
);
370 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
372 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
374 return CMD_ERR_AMBIGUOUS
;
377 circuit
->priority
[0] = prio
;
378 circuit
->priority
[1] = prio
;
383 DEFUN (no_isis_priority
,
384 no_isis_priority_cmd
,
385 "no isis priority [(0-127)]",
388 "Set priority for Designated Router election\n"
391 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
393 return CMD_ERR_NO_MATCH
;
395 circuit
->priority
[0] = DEFAULT_PRIORITY
;
396 circuit
->priority
[1] = DEFAULT_PRIORITY
;
402 DEFUN (isis_priority_l1
,
403 isis_priority_l1_cmd
,
404 "isis priority (0-127) level-1",
406 "Set priority for Designated Router election\n"
408 "Specify priority for level-1 routing\n")
412 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
414 return CMD_ERR_NO_MATCH
;
416 prio
= atoi (argv
[idx_number
]->arg
);
417 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
419 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
421 return CMD_ERR_AMBIGUOUS
;
424 circuit
->priority
[0] = prio
;
429 DEFUN (no_isis_priority_l1
,
430 no_isis_priority_l1_cmd
,
431 "no isis priority [(0-127)] level-1",
434 "Set priority for Designated Router election\n"
436 "Specify priority for level-1 routing\n")
438 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
440 return CMD_ERR_NO_MATCH
;
442 circuit
->priority
[0] = DEFAULT_PRIORITY
;
448 DEFUN (isis_priority_l2
,
449 isis_priority_l2_cmd
,
450 "isis priority (0-127) level-2",
452 "Set priority for Designated Router election\n"
454 "Specify priority for level-2 routing\n")
458 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
460 return CMD_ERR_NO_MATCH
;
462 prio
= atoi (argv
[idx_number
]->arg
);
463 if (prio
< MIN_PRIORITY
|| prio
> MAX_PRIORITY
)
465 vty_out (vty
, "Invalid priority %d - should be <0-127>%s",
467 return CMD_ERR_AMBIGUOUS
;
470 circuit
->priority
[1] = prio
;
475 DEFUN (no_isis_priority_l2
,
476 no_isis_priority_l2_cmd
,
477 "no isis priority [(0-127)] level-2",
480 "Set priority for Designated Router election\n"
482 "Specify priority for level-2 routing\n")
484 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
486 return CMD_ERR_NO_MATCH
;
488 circuit
->priority
[1] = DEFAULT_PRIORITY
;
497 "isis metric (0-16777215)",
499 "Set default metric for circuit\n"
500 "Default metric value\n")
504 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
506 return CMD_ERR_NO_MATCH
;
508 met
= atoi (argv
[idx_number
]->arg
);
510 /* RFC3787 section 5.1 */
511 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
512 met
> MAX_NARROW_LINK_METRIC
)
514 vty_out (vty
, "Invalid metric %d - should be <0-63> "
515 "when narrow metric type enabled%s",
517 return CMD_ERR_AMBIGUOUS
;
521 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
522 met
> MAX_WIDE_LINK_METRIC
)
524 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
525 "when wide metric type enabled%s",
527 return CMD_ERR_AMBIGUOUS
;
530 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, met
);
531 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, met
);
536 DEFUN (no_isis_metric
,
538 "no isis metric [(0-16777215)]",
541 "Set default metric for circuit\n"
542 "Default metric value\n")
544 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
546 return CMD_ERR_NO_MATCH
;
548 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, DEFAULT_CIRCUIT_METRIC
);
549 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, DEFAULT_CIRCUIT_METRIC
);
554 DEFUN (isis_metric_l1
,
556 "isis metric (0-16777215) level-1",
558 "Set default metric for circuit\n"
559 "Default metric value\n"
560 "Specify metric for level-1 routing\n")
564 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
566 return CMD_ERR_NO_MATCH
;
568 met
= atoi (argv
[idx_number
]->arg
);
570 /* RFC3787 section 5.1 */
571 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
572 met
> MAX_NARROW_LINK_METRIC
)
574 vty_out (vty
, "Invalid metric %d - should be <0-63> "
575 "when narrow metric type enabled%s",
577 return CMD_ERR_AMBIGUOUS
;
581 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
582 met
> MAX_WIDE_LINK_METRIC
)
584 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
585 "when wide metric type enabled%s",
587 return CMD_ERR_AMBIGUOUS
;
590 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, met
);
595 DEFUN (no_isis_metric_l1
,
596 no_isis_metric_l1_cmd
,
597 "no isis metric [(0-16777215)] level-1",
600 "Set default metric for circuit\n"
601 "Default metric value\n"
602 "Specify metric for level-1 routing\n")
604 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
606 return CMD_ERR_NO_MATCH
;
608 isis_circuit_metric_set (circuit
, IS_LEVEL_1
, DEFAULT_CIRCUIT_METRIC
);
613 DEFUN (isis_metric_l2
,
615 "isis metric (0-16777215) level-2",
617 "Set default metric for circuit\n"
618 "Default metric value\n"
619 "Specify metric for level-2 routing\n")
623 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
625 return CMD_ERR_NO_MATCH
;
627 met
= atoi (argv
[idx_number
]->arg
);
629 /* RFC3787 section 5.1 */
630 if (circuit
->area
&& circuit
->area
->oldmetric
== 1 &&
631 met
> MAX_NARROW_LINK_METRIC
)
633 vty_out (vty
, "Invalid metric %d - should be <0-63> "
634 "when narrow metric type enabled%s",
636 return CMD_ERR_AMBIGUOUS
;
640 if (circuit
->area
&& circuit
->area
->newmetric
== 1 &&
641 met
> MAX_WIDE_LINK_METRIC
)
643 vty_out (vty
, "Invalid metric %d - should be <0-16777215> "
644 "when wide metric type enabled%s",
646 return CMD_ERR_AMBIGUOUS
;
649 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, met
);
654 DEFUN (no_isis_metric_l2
,
655 no_isis_metric_l2_cmd
,
656 "no isis metric [(0-16777215)] level-2",
659 "Set default metric for circuit\n"
660 "Default metric value\n"
661 "Specify metric for level-2 routing\n")
663 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
665 return CMD_ERR_NO_MATCH
;
667 isis_circuit_metric_set (circuit
, IS_LEVEL_2
, DEFAULT_CIRCUIT_METRIC
);
673 DEFUN (isis_hello_interval
,
674 isis_hello_interval_cmd
,
675 "isis hello-interval (1-600)",
677 "Set Hello interval\n"
678 "Hello interval value\n"
679 "Holdtime 1 seconds, interval depends on multiplier\n")
683 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
685 return CMD_ERR_NO_MATCH
;
687 interval
= atoi (argv
[idx_number
]->arg
);
688 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
690 vty_out (vty
, "Invalid hello-interval %d - should be <1-600>%s",
691 interval
, VTY_NEWLINE
);
692 return CMD_ERR_AMBIGUOUS
;
695 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
696 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
702 DEFUN (no_isis_hello_interval
,
703 no_isis_hello_interval_cmd
,
704 "no isis hello-interval [(1-600)]",
707 "Set Hello interval\n"
708 "Holdtime 1 second, interval depends on multiplier\n")
710 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
712 return CMD_ERR_NO_MATCH
;
714 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
715 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
721 DEFUN (isis_hello_interval_l1
,
722 isis_hello_interval_l1_cmd
,
723 "isis hello-interval (1-600) level-1",
725 "Set Hello interval\n"
726 "Hello interval value\n"
727 "Holdtime 1 second, interval depends on multiplier\n"
728 "Specify hello-interval for level-1 IIHs\n")
732 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
734 return CMD_ERR_NO_MATCH
;
736 interval
= atoi (argv
[idx_number
]->arg
);
737 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
739 vty_out (vty
, "Invalid hello-interval %ld - should be <1-600>%s",
740 interval
, VTY_NEWLINE
);
741 return CMD_ERR_AMBIGUOUS
;
744 circuit
->hello_interval
[0] = (u_int16_t
) interval
;
750 DEFUN (no_isis_hello_interval_l1
,
751 no_isis_hello_interval_l1_cmd
,
752 "no isis hello-interval [(1-600)] level-1",
755 "Set Hello interval\n"
756 "Holdtime 1 second, interval depends on multiplier\n"
757 "Specify hello-interval for level-1 IIHs\n")
759 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
761 return CMD_ERR_NO_MATCH
;
763 circuit
->hello_interval
[0] = DEFAULT_HELLO_INTERVAL
;
769 DEFUN (isis_hello_interval_l2
,
770 isis_hello_interval_l2_cmd
,
771 "isis hello-interval (1-600) level-2",
773 "Set Hello interval\n"
774 "Hello interval value\n"
775 "Holdtime 1 second, interval depends on multiplier\n"
776 "Specify hello-interval for level-2 IIHs\n")
780 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
782 return CMD_ERR_NO_MATCH
;
784 interval
= atoi (argv
[idx_number
]->arg
);
785 if (interval
< MIN_HELLO_INTERVAL
|| interval
> MAX_HELLO_INTERVAL
)
787 vty_out (vty
, "Invalid hello-interval %ld - should be <1-600>%s",
788 interval
, VTY_NEWLINE
);
789 return CMD_ERR_AMBIGUOUS
;
792 circuit
->hello_interval
[1] = (u_int16_t
) interval
;
798 DEFUN (no_isis_hello_interval_l2
,
799 no_isis_hello_interval_l2_cmd
,
800 "no isis hello-interval [(1-600)] level-2",
803 "Set Hello interval\n"
804 "Holdtime 1 second, interval depends on multiplier\n"
805 "Specify hello-interval for level-2 IIHs\n")
807 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
809 return CMD_ERR_NO_MATCH
;
811 circuit
->hello_interval
[1] = DEFAULT_HELLO_INTERVAL
;
817 DEFUN (isis_hello_multiplier
,
818 isis_hello_multiplier_cmd
,
819 "isis hello-multiplier (2-100)",
821 "Set multiplier for Hello holding time\n"
822 "Hello multiplier value\n")
826 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
828 return CMD_ERR_NO_MATCH
;
830 mult
= atoi (argv
[idx_number
]->arg
);
831 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
833 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
835 return CMD_ERR_AMBIGUOUS
;
838 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
839 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
845 DEFUN (no_isis_hello_multiplier
,
846 no_isis_hello_multiplier_cmd
,
847 "no isis hello-multiplier [(2-100)]",
850 "Set multiplier for Hello holding time\n"
851 "Hello multiplier value\n")
853 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
855 return CMD_ERR_NO_MATCH
;
857 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
858 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
864 DEFUN (isis_hello_multiplier_l1
,
865 isis_hello_multiplier_l1_cmd
,
866 "isis hello-multiplier (2-100) level-1",
868 "Set multiplier for Hello holding time\n"
869 "Hello multiplier value\n"
870 "Specify hello multiplier for level-1 IIHs\n")
874 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
876 return CMD_ERR_NO_MATCH
;
878 mult
= atoi (argv
[idx_number
]->arg
);
879 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
881 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
883 return CMD_ERR_AMBIGUOUS
;
886 circuit
->hello_multiplier
[0] = (u_int16_t
) mult
;
892 DEFUN (no_isis_hello_multiplier_l1
,
893 no_isis_hello_multiplier_l1_cmd
,
894 "no isis hello-multiplier [(2-100)] level-1",
897 "Set multiplier for Hello holding time\n"
898 "Hello multiplier value\n"
899 "Specify hello multiplier for level-1 IIHs\n")
901 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
903 return CMD_ERR_NO_MATCH
;
905 circuit
->hello_multiplier
[0] = DEFAULT_HELLO_MULTIPLIER
;
911 DEFUN (isis_hello_multiplier_l2
,
912 isis_hello_multiplier_l2_cmd
,
913 "isis hello-multiplier (2-100) level-2",
915 "Set multiplier for Hello holding time\n"
916 "Hello multiplier value\n"
917 "Specify hello multiplier for level-2 IIHs\n")
921 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
923 return CMD_ERR_NO_MATCH
;
925 mult
= atoi (argv
[idx_number
]->arg
);
926 if (mult
< MIN_HELLO_MULTIPLIER
|| mult
> MAX_HELLO_MULTIPLIER
)
928 vty_out (vty
, "Invalid hello-multiplier %d - should be <2-100>%s",
930 return CMD_ERR_AMBIGUOUS
;
933 circuit
->hello_multiplier
[1] = (u_int16_t
) mult
;
939 DEFUN (no_isis_hello_multiplier_l2
,
940 no_isis_hello_multiplier_l2_cmd
,
941 "no isis hello-multiplier [(2-100)] level-2",
944 "Set multiplier for Hello holding time\n"
945 "Hello multiplier value\n"
946 "Specify hello multiplier for level-2 IIHs\n")
948 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
950 return CMD_ERR_NO_MATCH
;
952 circuit
->hello_multiplier
[1] = DEFAULT_HELLO_MULTIPLIER
;
958 DEFUN (isis_hello_padding
,
959 isis_hello_padding_cmd
,
960 "isis hello padding",
962 "Add padding to IS-IS hello packets\n"
963 "Pad hello packets\n"
966 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
968 return CMD_ERR_NO_MATCH
;
970 circuit
->pad_hellos
= 1;
975 DEFUN (no_isis_hello_padding
,
976 no_isis_hello_padding_cmd
,
977 "no isis hello padding",
980 "Add padding to IS-IS hello packets\n"
981 "Pad hello packets\n"
984 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
986 return CMD_ERR_NO_MATCH
;
988 circuit
->pad_hellos
= 0;
993 DEFUN (csnp_interval
,
995 "isis csnp-interval (1-600)",
997 "Set CSNP interval in seconds\n"
998 "CSNP interval value\n")
1001 unsigned long interval
;
1002 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1004 return CMD_ERR_NO_MATCH
;
1006 interval
= atol (argv
[idx_number
]->arg
);
1007 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1009 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
1010 interval
, VTY_NEWLINE
);
1011 return CMD_ERR_AMBIGUOUS
;
1014 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1015 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1021 DEFUN (no_csnp_interval
,
1022 no_csnp_interval_cmd
,
1023 "no isis csnp-interval [(1-600)]",
1026 "Set CSNP interval in seconds\n"
1027 "CSNP interval value\n")
1029 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1031 return CMD_ERR_NO_MATCH
;
1033 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1034 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1040 DEFUN (csnp_interval_l1
,
1041 csnp_interval_l1_cmd
,
1042 "isis csnp-interval (1-600) level-1",
1044 "Set CSNP interval in seconds\n"
1045 "CSNP interval value\n"
1046 "Specify interval for level-1 CSNPs\n")
1049 unsigned long interval
;
1050 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1052 return CMD_ERR_NO_MATCH
;
1054 interval
= atol (argv
[idx_number
]->arg
);
1055 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1057 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
1058 interval
, VTY_NEWLINE
);
1059 return CMD_ERR_AMBIGUOUS
;
1062 circuit
->csnp_interval
[0] = (u_int16_t
) interval
;
1068 DEFUN (no_csnp_interval_l1
,
1069 no_csnp_interval_l1_cmd
,
1070 "no isis csnp-interval [(1-600)] level-1",
1073 "Set CSNP interval in seconds\n"
1074 "CSNP interval value\n"
1075 "Specify interval for level-1 CSNPs\n")
1077 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1079 return CMD_ERR_NO_MATCH
;
1081 circuit
->csnp_interval
[0] = DEFAULT_CSNP_INTERVAL
;
1087 DEFUN (csnp_interval_l2
,
1088 csnp_interval_l2_cmd
,
1089 "isis csnp-interval (1-600) level-2",
1091 "Set CSNP interval in seconds\n"
1092 "CSNP interval value\n"
1093 "Specify interval for level-2 CSNPs\n")
1096 unsigned long interval
;
1097 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1099 return CMD_ERR_NO_MATCH
;
1101 interval
= atol (argv
[idx_number
]->arg
);
1102 if (interval
< MIN_CSNP_INTERVAL
|| interval
> MAX_CSNP_INTERVAL
)
1104 vty_out (vty
, "Invalid csnp-interval %lu - should be <1-600>%s",
1105 interval
, VTY_NEWLINE
);
1106 return CMD_ERR_AMBIGUOUS
;
1109 circuit
->csnp_interval
[1] = (u_int16_t
) interval
;
1115 DEFUN (no_csnp_interval_l2
,
1116 no_csnp_interval_l2_cmd
,
1117 "no isis csnp-interval [(1-600)] level-2",
1120 "Set CSNP interval in seconds\n"
1121 "CSNP interval value\n"
1122 "Specify interval for level-2 CSNPs\n")
1124 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1126 return CMD_ERR_NO_MATCH
;
1128 circuit
->csnp_interval
[1] = DEFAULT_CSNP_INTERVAL
;
1134 DEFUN (psnp_interval
,
1136 "isis psnp-interval (1-120)",
1138 "Set PSNP interval in seconds\n"
1139 "PSNP interval value\n")
1142 unsigned long interval
;
1143 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1145 return CMD_ERR_NO_MATCH
;
1147 interval
= atol (argv
[idx_number
]->arg
);
1148 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1150 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
1151 interval
, VTY_NEWLINE
);
1152 return CMD_ERR_AMBIGUOUS
;
1155 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
1156 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
1162 DEFUN (no_psnp_interval
,
1163 no_psnp_interval_cmd
,
1164 "no isis psnp-interval [(1-120)]",
1167 "Set PSNP interval in seconds\n"
1168 "PSNP interval value\n")
1170 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1172 return CMD_ERR_NO_MATCH
;
1174 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1175 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1181 DEFUN (psnp_interval_l1
,
1182 psnp_interval_l1_cmd
,
1183 "isis psnp-interval (1-120) level-1",
1185 "Set PSNP interval in seconds\n"
1186 "PSNP interval value\n"
1187 "Specify interval for level-1 PSNPs\n")
1190 unsigned long interval
;
1191 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1193 return CMD_ERR_NO_MATCH
;
1195 interval
= atol (argv
[idx_number
]->arg
);
1196 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1198 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
1199 interval
, VTY_NEWLINE
);
1200 return CMD_ERR_AMBIGUOUS
;
1203 circuit
->psnp_interval
[0] = (u_int16_t
) interval
;
1209 DEFUN (no_psnp_interval_l1
,
1210 no_psnp_interval_l1_cmd
,
1211 "no isis psnp-interval [(1-120)] level-1",
1214 "Set PSNP interval in seconds\n"
1215 "PSNP interval value\n"
1216 "Specify interval for level-1 PSNPs\n")
1218 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1220 return CMD_ERR_NO_MATCH
;
1222 circuit
->psnp_interval
[0] = DEFAULT_PSNP_INTERVAL
;
1228 DEFUN (psnp_interval_l2
,
1229 psnp_interval_l2_cmd
,
1230 "isis psnp-interval (1-120) level-2",
1232 "Set PSNP interval in seconds\n"
1233 "PSNP interval value\n"
1234 "Specify interval for level-2 PSNPs\n")
1237 unsigned long interval
;
1238 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1240 return CMD_ERR_NO_MATCH
;
1242 interval
= atol (argv
[idx_number
]->arg
);
1243 if (interval
< MIN_PSNP_INTERVAL
|| interval
> MAX_PSNP_INTERVAL
)
1245 vty_out (vty
, "Invalid psnp-interval %lu - should be <1-120>%s",
1246 interval
, VTY_NEWLINE
);
1247 return CMD_ERR_AMBIGUOUS
;
1250 circuit
->psnp_interval
[1] = (u_int16_t
) interval
;
1256 DEFUN (no_psnp_interval_l2
,
1257 no_psnp_interval_l2_cmd
,
1258 "no isis psnp-interval [(1-120)] level-2",
1261 "Set PSNP interval in seconds\n"
1262 "PSNP interval value\n"
1263 "Specify interval for level-2 PSNPs\n")
1265 struct isis_circuit
*circuit
= isis_circuit_lookup (vty
);
1267 return CMD_ERR_NO_MATCH
;
1269 circuit
->psnp_interval
[1] = DEFAULT_PSNP_INTERVAL
;
1276 validate_metric_style_narrow (struct vty
*vty
, struct isis_area
*area
)
1278 struct isis_circuit
*circuit
;
1279 struct listnode
*node
;
1282 return CMD_ERR_AMBIGUOUS
;
1286 vty_out (vty
, "ISIS area is invalid%s", VTY_NEWLINE
);
1287 return CMD_ERR_AMBIGUOUS
;
1290 for (ALL_LIST_ELEMENTS_RO (area
->circuit_list
, node
, circuit
))
1292 if ((area
->is_type
& IS_LEVEL_1
) &&
1293 (circuit
->is_type
& IS_LEVEL_1
) &&
1294 (circuit
->te_metric
[0] > MAX_NARROW_LINK_METRIC
))
1296 vty_out (vty
, "ISIS circuit %s metric is invalid%s",
1297 circuit
->interface
->name
, VTY_NEWLINE
);
1298 return CMD_ERR_AMBIGUOUS
;
1300 if ((area
->is_type
& IS_LEVEL_2
) &&
1301 (circuit
->is_type
& IS_LEVEL_2
) &&
1302 (circuit
->te_metric
[1] > MAX_NARROW_LINK_METRIC
))
1304 vty_out (vty
, "ISIS circuit %s metric is invalid%s",
1305 circuit
->interface
->name
, VTY_NEWLINE
);
1306 return CMD_ERR_AMBIGUOUS
;
1313 DEFUN (metric_style
,
1315 "metric-style <narrow|transition|wide>",
1316 "Use old-style (ISO 10589) or new-style packet formats\n"
1317 "Use old style of TLVs with narrow metric\n"
1318 "Send and accept both styles of TLVs during transition\n"
1319 "Use new style of TLVs to carry wider metric\n")
1321 int idx_metric_style
= 1;
1322 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1325 if (strncmp (argv
[idx_metric_style
]->arg
, "w", 1) == 0)
1327 isis_area_metricstyle_set(area
, false, true);
1331 ret
= validate_metric_style_narrow (vty
, area
);
1332 if (ret
!= CMD_SUCCESS
)
1335 if (strncmp (argv
[idx_metric_style
]->arg
, "t", 1) == 0)
1336 isis_area_metricstyle_set(area
, true, true);
1337 else if (strncmp (argv
[idx_metric_style
]->arg
, "n", 1) == 0)
1338 isis_area_metricstyle_set(area
, true, false);
1344 DEFUN (no_metric_style
,
1345 no_metric_style_cmd
,
1348 "Use old-style (ISO 10589) or new-style packet formats\n")
1350 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1353 ret
= validate_metric_style_narrow (vty
, area
);
1354 if (ret
!= CMD_SUCCESS
)
1357 isis_area_metricstyle_set(area
, true, false);
1361 DEFUN (set_overload_bit
,
1362 set_overload_bit_cmd
,
1364 "Set overload bit to avoid any transit traffic\n"
1365 "Set overload bit\n")
1367 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1369 isis_area_overload_bit_set(area
, true);
1373 DEFUN (no_set_overload_bit
,
1374 no_set_overload_bit_cmd
,
1375 "no set-overload-bit",
1376 "Reset overload bit to accept transit traffic\n"
1377 "Reset overload bit\n")
1379 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1381 isis_area_overload_bit_set(area
, false);
1385 DEFUN (set_attached_bit
,
1386 set_attached_bit_cmd
,
1388 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
1389 "Set attached bit\n")
1391 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1393 isis_area_attached_bit_set(area
, true);
1397 DEFUN (no_set_attached_bit
,
1398 no_set_attached_bit_cmd
,
1399 "no set-attached-bit",
1401 "Reset attached bit\n")
1403 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1405 isis_area_attached_bit_set(area
, false);
1409 DEFUN (dynamic_hostname
,
1410 dynamic_hostname_cmd
,
1412 "Dynamic hostname for IS-IS\n"
1413 "Dynamic hostname\n")
1415 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1417 isis_area_dynhostname_set(area
, true);
1421 DEFUN (no_dynamic_hostname
,
1422 no_dynamic_hostname_cmd
,
1423 "no hostname dynamic",
1425 "Dynamic hostname for IS-IS\n"
1426 "Dynamic hostname\n")
1428 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1430 isis_area_dynhostname_set(area
, false);
1434 static int area_lsp_mtu_set(struct vty
*vty
, unsigned int lsp_mtu
)
1436 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1437 struct listnode
*node
;
1438 struct isis_circuit
*circuit
;
1440 for (ALL_LIST_ELEMENTS_RO(area
->circuit_list
, node
, circuit
))
1442 if(circuit
->state
!= C_STATE_INIT
&& circuit
->state
!= C_STATE_UP
)
1444 if(lsp_mtu
> isis_circuit_pdu_size(circuit
))
1446 vty_out(vty
, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1447 circuit
->interface
->name
, isis_circuit_pdu_size(circuit
),
1449 return CMD_ERR_AMBIGUOUS
;
1453 isis_area_lsp_mtu_set(area
, lsp_mtu
);
1457 DEFUN (area_lsp_mtu
,
1459 "lsp-mtu (128-4352)",
1460 "Configure the maximum size of generated LSPs\n"
1461 "Maximum size of generated LSPs\n")
1464 unsigned int lsp_mtu
;
1466 VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu
, argv
[idx_number
]->arg
, 128, 4352);
1468 return area_lsp_mtu_set(vty
, lsp_mtu
);
1472 DEFUN (no_area_lsp_mtu
,
1473 no_area_lsp_mtu_cmd
,
1474 "no lsp-mtu [(128-4352)]",
1476 "Configure the maximum size of generated LSPs\n"
1477 "Maximum size of generated LSPs\n")
1479 return area_lsp_mtu_set(vty
, DEFAULT_LSP_MTU
);
1485 "is-type <level-1|level-1-2|level-2-only>",
1486 "IS Level for this routing process (OSI only)\n"
1487 "Act as a station router only\n"
1488 "Act as both a station router and an area router\n"
1489 "Act as an area router only\n")
1492 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1495 type
= string2circuit_t (argv
[idx_level
]->arg
);
1498 vty_out (vty
, "Unknown IS level %s", VTY_NEWLINE
);
1502 isis_area_is_type_set(area
, type
);
1509 "no is-type <level-1|level-1-2|level-2-only>",
1511 "IS Level for this routing process (OSI only)\n"
1512 "Act as a station router only\n"
1513 "Act as both a station router and an area router\n"
1514 "Act as an area router only\n")
1516 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1520 * Put the is-type back to defaults:
1521 * - level-1-2 on first area
1522 * - level-1 for the rest
1524 if (listgetdata (listhead (isis
->area_list
)) == area
)
1525 type
= IS_LEVEL_1_AND_2
;
1529 isis_area_is_type_set(area
, type
);
1535 set_lsp_gen_interval (struct vty
*vty
, struct isis_area
*area
,
1536 uint16_t interval
, int level
)
1540 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1545 if (interval
>= area
->lsp_refresh
[lvl
-1])
1547 vty_out (vty
, "LSP gen interval %us must be less than "
1548 "the LSP refresh interval %us%s",
1549 interval
, area
->lsp_refresh
[lvl
-1], VTY_NEWLINE
);
1550 return CMD_ERR_AMBIGUOUS
;
1554 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1558 area
->lsp_gen_interval
[lvl
-1] = interval
;
1564 DEFUN (lsp_gen_interval
,
1565 lsp_gen_interval_cmd
,
1566 "lsp-gen-interval [<level-1|level-2>] (1-120)",
1567 "Minimum interval between regenerating same LSP\n"
1568 "Set interval for level 1 only\n"
1569 "Set interval for level 2 only\n"
1570 "Minimum interval in seconds\n")
1573 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1578 level
|= argv_find (argv
, argc
, "level-1", &idx
) ? IS_LEVEL_1
: 0;
1579 level
|= argv_find (argv
, argc
, "level-2", &idx
) ? IS_LEVEL_2
: 0;
1581 level
= IS_LEVEL_1
| IS_LEVEL_2
;
1583 argv_find (argv
, argc
, "(1-120)", &idx
);
1585 interval
= atoi (argv
[idx
]->arg
);
1586 return set_lsp_gen_interval (vty
, area
, interval
, level
);
1589 DEFUN (no_lsp_gen_interval
,
1590 no_lsp_gen_interval_cmd
,
1591 "no lsp-gen-interval [<level-1|level-2>] [(1-120)]",
1593 "Minimum interval between regenerating same LSP\n"
1594 "Set interval for level 1 only\n"
1595 "Set interval for level 2 only\n"
1596 "Minimum interval in seconds\n")
1599 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1604 level
|= argv_find (argv
, argc
, "level-1", &idx
) ? IS_LEVEL_1
: 0;
1605 level
|= argv_find (argv
, argc
, "level-2", &idx
) ? IS_LEVEL_2
: 0;
1607 level
= IS_LEVEL_1
| IS_LEVEL_2
;
1609 interval
= DEFAULT_MIN_LSP_GEN_INTERVAL
;
1610 return set_lsp_gen_interval (vty
, area
, interval
, level
);
1613 DEFUN (spf_interval
,
1615 "spf-interval (1-120)",
1616 "Minimum interval between SPF calculations\n"
1617 "Minimum interval between consecutive SPFs in seconds\n")
1620 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1623 interval
= atoi (argv
[idx_number
]->arg
);
1624 area
->min_spf_interval
[0] = interval
;
1625 area
->min_spf_interval
[1] = interval
;
1631 DEFUN (no_spf_interval
,
1632 no_spf_interval_cmd
,
1633 "no spf-interval [[<level-1|level-2>] (1-120)]",
1635 "Minimum interval between SPF calculations\n"
1636 "Set interval for level 1 only\n"
1637 "Set interval for level 2 only\n"
1638 "Minimum interval between consecutive SPFs in seconds\n")
1640 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1642 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
1643 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
1649 DEFUN (spf_interval_l1
,
1650 spf_interval_l1_cmd
,
1651 "spf-interval level-1 (1-120)",
1652 "Minimum interval between SPF calculations\n"
1653 "Set interval for level 1 only\n"
1654 "Minimum interval between consecutive SPFs in seconds\n")
1657 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1660 interval
= atoi (argv
[idx_number
]->arg
);
1661 area
->min_spf_interval
[0] = interval
;
1666 DEFUN (no_spf_interval_l1
,
1667 no_spf_interval_l1_cmd
,
1668 "no spf-interval level-1",
1670 "Minimum interval between SPF calculations\n"
1671 "Set interval for level 1 only\n")
1673 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1675 area
->min_spf_interval
[0] = MINIMUM_SPF_INTERVAL
;
1681 DEFUN (spf_interval_l2
,
1682 spf_interval_l2_cmd
,
1683 "spf-interval level-2 (1-120)",
1684 "Minimum interval between SPF calculations\n"
1685 "Set interval for level 2 only\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
[1] = interval
;
1698 DEFUN (no_spf_interval_l2
,
1699 no_spf_interval_l2_cmd
,
1700 "no spf-interval level-2",
1702 "Minimum interval between SPF calculations\n"
1703 "Set interval for level 2 only\n")
1705 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1707 area
->min_spf_interval
[1] = MINIMUM_SPF_INTERVAL
;
1712 DEFUN (no_spf_delay_ietf
,
1713 no_spf_delay_ietf_cmd
,
1714 "no spf-delay-ietf",
1716 "IETF SPF delay algorithm\n")
1718 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1720 spf_backoff_free(area
->spf_delay_ietf
[0]);
1721 spf_backoff_free(area
->spf_delay_ietf
[1]);
1722 area
->spf_delay_ietf
[0] = NULL
;
1723 area
->spf_delay_ietf
[1] = NULL
;
1728 DEFUN (spf_delay_ietf
,
1730 "spf-delay-ietf init-delay (0-60000) short-delay (0-60000) long-delay (0-60000) holddown (0-60000) time-to-learn (0-60000)",
1731 "IETF SPF delay algorithm\n"
1732 "Delay used while in QUIET state\n"
1733 "Delay used while in QUIET state in milliseconds\n"
1734 "Delay used while in SHORT_WAIT state\n"
1735 "Delay used while in SHORT_WAIT state in milliseconds\n"
1736 "Delay used while in LONG_WAIT\n"
1737 "Delay used while in LONG_WAIT state in milliseconds\n"
1738 "Time with no received IGP events before considering IGP stable\n"
1739 "Time with no received IGP events before considering IGP stable (in milliseconds)\n"
1740 "Maximum duration needed to learn all the events related to a single failure\n"
1741 "Maximum duration needed to learn all the events related to a single failure (in milliseconds)\n")
1743 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1745 long init_delay
= atol(argv
[2]->arg
);
1746 long short_delay
= atol(argv
[4]->arg
);
1747 long long_delay
= atol(argv
[6]->arg
);
1748 long holddown
= atol(argv
[8]->arg
);
1749 long timetolearn
= atol(argv
[10]->arg
);
1751 size_t bufsiz
= strlen(area
->area_tag
) + sizeof("IS-IS Lx");
1752 char *buf
= XCALLOC(MTYPE_TMP
, bufsiz
);
1754 snprintf(buf
, bufsiz
, "IS-IS %s L1", area
->area_tag
);
1755 spf_backoff_free(area
->spf_delay_ietf
[0]);
1756 area
->spf_delay_ietf
[0] = spf_backoff_new(master
, buf
, init_delay
,
1757 short_delay
, long_delay
,
1758 holddown
, timetolearn
);
1760 snprintf(buf
, bufsiz
, "IS-IS %s L2", area
->area_tag
);
1761 spf_backoff_free(area
->spf_delay_ietf
[1]);
1762 area
->spf_delay_ietf
[1] = spf_backoff_new(master
, buf
, init_delay
,
1763 short_delay
, long_delay
,
1764 holddown
, timetolearn
);
1766 XFREE(MTYPE_TMP
, buf
);
1771 area_max_lsp_lifetime_set(struct vty
*vty
, int level
,
1774 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1776 uint16_t refresh_interval
= interval
- 300;
1777 int set_refresh_interval
[ISIS_LEVELS
] = {0, 0};
1779 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++)
1784 if (refresh_interval
< area
->lsp_refresh
[lvl
-1])
1786 vty_out (vty
, "Level %d Max LSP lifetime %us must be 300s greater than "
1787 "the configured LSP refresh interval %us%s",
1788 lvl
, interval
, area
->lsp_refresh
[lvl
-1], VTY_NEWLINE
);
1789 vty_out (vty
, "Automatically reducing level %d LSP refresh interval "
1790 "to %us%s", lvl
, refresh_interval
, VTY_NEWLINE
);
1791 set_refresh_interval
[lvl
-1] = 1;
1793 if (refresh_interval
<= area
->lsp_gen_interval
[lvl
-1])
1795 vty_out (vty
, "LSP refresh interval %us must be greater than "
1796 "the configured LSP gen interval %us%s",
1797 refresh_interval
, area
->lsp_gen_interval
[lvl
-1],
1799 return CMD_ERR_AMBIGUOUS
;
1804 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; lvl
++)
1808 isis_area_max_lsp_lifetime_set(area
, lvl
, interval
);
1809 if (set_refresh_interval
[lvl
-1])
1810 isis_area_lsp_refresh_set(area
, lvl
, refresh_interval
);
1816 DEFUN (max_lsp_lifetime
,
1817 max_lsp_lifetime_cmd
,
1818 "max-lsp-lifetime [<level-1|level-2>] (350-65535)",
1819 "Maximum LSP lifetime\n"
1820 "Maximum LSP lifetime for Level 1 only\n"
1821 "Maximum LSP lifetime for Level 2 only\n"
1822 "LSP lifetime in seconds\n")
1825 unsigned int level
= IS_LEVEL_1_AND_2
;
1827 if (argv_find (argv
, argc
, "level-1", &idx
))
1829 else if (argv_find (argv
, argc
, "level-2", &idx
))
1832 argv_find (argv
, argc
, "(350-65535)", &idx
);
1833 int lifetime
= atoi(argv
[idx
]->arg
);
1835 return area_max_lsp_lifetime_set(vty
, level
, lifetime
);
1839 DEFUN (no_max_lsp_lifetime
,
1840 no_max_lsp_lifetime_cmd
,
1841 "no max-lsp-lifetime [<level-1|level-2>] [(350-65535)]",
1843 "Maximum LSP lifetime\n"
1844 "Maximum LSP lifetime for Level 1 only\n"
1845 "Maximum LSP lifetime for Level 2 only\n"
1846 "LSP lifetime in seconds\n")
1849 unsigned int level
= IS_LEVEL_1_AND_2
;
1851 if (argv_find (argv
, argc
, "level-1", &idx
))
1853 else if (argv_find (argv
, argc
, "level-2", &idx
))
1856 return area_max_lsp_lifetime_set(vty
, level
, DEFAULT_LSP_LIFETIME
);
1860 area_lsp_refresh_interval_set(struct vty
*vty
, int level
, uint16_t interval
)
1862 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1865 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1869 if (interval
<= area
->lsp_gen_interval
[lvl
-1])
1871 vty_out (vty
, "LSP refresh interval %us must be greater than "
1872 "the configured LSP gen interval %us%s",
1873 interval
, area
->lsp_gen_interval
[lvl
-1],
1875 return CMD_ERR_AMBIGUOUS
;
1877 if (interval
> (area
->max_lsp_lifetime
[lvl
-1] - 300))
1879 vty_out (vty
, "LSP refresh interval %us must be less than "
1880 "the configured LSP lifetime %us less 300%s",
1881 interval
, area
->max_lsp_lifetime
[lvl
-1],
1883 return CMD_ERR_AMBIGUOUS
;
1887 for (lvl
= IS_LEVEL_1
; lvl
<= IS_LEVEL_2
; ++lvl
)
1891 isis_area_lsp_refresh_set(area
, lvl
, interval
);
1897 DEFUN (lsp_refresh_interval
,
1898 lsp_refresh_interval_cmd
,
1899 "lsp-refresh-interval [<level-1|level-2>] (1-65235)",
1900 "LSP refresh interval\n"
1901 "LSP refresh interval for Level 1 only\n"
1902 "LSP refresh interval for Level 2 only\n"
1903 "LSP refresh interval in seconds\n")
1906 unsigned int level
= IS_LEVEL_1_AND_2
;
1907 unsigned int interval
= 0;
1909 if (argv_find (argv
, argc
, "level-1", &idx
))
1911 else if (argv_find (argv
, argc
, "level-2", &idx
))
1914 interval
= atoi(argv
[argc
-1]->arg
);
1915 return area_lsp_refresh_interval_set(vty
, level
, interval
);
1918 DEFUN (no_lsp_refresh_interval
,
1919 no_lsp_refresh_interval_cmd
,
1920 "no lsp-refresh-interval [<level-1|level-2>] [(1-65235)]",
1922 "LSP refresh interval\n"
1923 "LSP refresh interval for Level 1 only\n"
1924 "LSP refresh interval for Level 2 only\n"
1925 "LSP refresh interval in seconds\n")
1928 unsigned int level
= IS_LEVEL_1_AND_2
;
1930 if (argv_find (argv
, argc
, "level-1", &idx
))
1932 else if (argv_find (argv
, argc
, "level-2", &idx
))
1935 return area_lsp_refresh_interval_set(vty
, level
, DEFAULT_MAX_LSP_GEN_INTERVAL
);
1939 area_passwd_set(struct vty
*vty
, int level
,
1940 int (*type_set
)(struct isis_area
*area
, int level
,
1941 const char *passwd
, u_char snp_auth
),
1942 const char *passwd
, u_char snp_auth
)
1944 VTY_DECLVAR_CONTEXT (isis_area
, area
);
1946 if (passwd
&& strlen(passwd
) > 254)
1948 vty_out (vty
, "Too long area password (>254)%s", VTY_NEWLINE
);
1949 return CMD_ERR_AMBIGUOUS
;
1952 type_set(area
, level
, passwd
, snp_auth
);
1957 DEFUN (area_passwd_md5
,
1958 area_passwd_md5_cmd
,
1959 "area-password md5 WORD [authenticate snp <send-only|validate>]",
1960 "Configure the authentication password for an area\n"
1961 "Authentication type\n"
1962 "Level-wide password\n"
1965 "Send but do not check PDUs on receiving\n"
1966 "Send and check PDUs on receiving\n")
1968 int idx_password
= 0;
1971 u_char snp_auth
= 0;
1972 int level
= strmatch(argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
1976 snp_auth
= SNP_AUTH_SEND
;
1977 if (strmatch(argv
[idx_type
]->text
, "validate"))
1978 snp_auth
|= SNP_AUTH_RECV
;
1981 return area_passwd_set(vty
, level
, isis_area_passwd_hmac_md5_set
,
1982 argv
[idx_word
]->arg
, snp_auth
);
1985 DEFUN (domain_passwd_md5
,
1986 domain_passwd_md5_cmd
,
1987 "domain-password md5 WORD [authenticate snp <send-only|validate>]",
1988 "Set the authentication password for a routing domain\n"
1989 "Authentication type\n"
1990 "Level-wide password\n"
1993 "Send but do not check PDUs on receiving\n"
1994 "Send and check PDUs on receiving\n")
1996 return area_passwd_md5 (self
, vty
, argc
, argv
);
1999 DEFUN (area_passwd_clear
,
2000 area_passwd_clear_cmd
,
2001 "area-password clear WORD [authenticate snp <send-only|validate>]",
2002 "Configure the authentication password for an area\n"
2003 "Authentication type\n"
2007 "Send but do not check PDUs on receiving\n"
2008 "Send and check PDUs on receiving\n")
2010 int idx_password
= 0;
2013 u_char snp_auth
= 0;
2014 int level
= strmatch(argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2018 snp_auth
= SNP_AUTH_SEND
;
2019 if (strmatch (argv
[idx_type
]->text
, "validate"))
2020 snp_auth
|= SNP_AUTH_RECV
;
2023 return area_passwd_set(vty
, level
, isis_area_passwd_cleartext_set
,
2024 argv
[idx_word
]->arg
, snp_auth
);
2027 DEFUN (domain_passwd_clear
,
2028 domain_passwd_clear_cmd
,
2029 "domain-password clear WORD [authenticate snp <send-only|validate>]",
2030 "Set the authentication password for a routing domain\n"
2031 "Authentication type\n"
2035 "Send but do not check PDUs on receiving\n"
2036 "Send and check PDUs on receiving\n")
2038 return area_passwd_clear (self
, vty
, argc
, argv
);
2041 DEFUN (no_area_passwd
,
2043 "no <area-password|domain-password>",
2045 "Configure the authentication password for an area\n"
2046 "Set the authentication password for a routing domain\n")
2048 int idx_password
= 1;
2049 int level
= strmatch (argv
[idx_password
]->text
, "domain-password") ? IS_LEVEL_2
: IS_LEVEL_1
;
2050 VTY_DECLVAR_CONTEXT (isis_area
, area
);
2052 return isis_area_passwd_unset (area
, level
);
2056 isis_vty_init (void)
2058 install_element (INTERFACE_NODE
, &ip_router_isis_cmd
);
2059 install_element (INTERFACE_NODE
, &ip6_router_isis_cmd
);
2060 install_element (INTERFACE_NODE
, &no_ip_router_isis_cmd
);
2062 install_element (INTERFACE_NODE
, &isis_passive_cmd
);
2063 install_element (INTERFACE_NODE
, &no_isis_passive_cmd
);
2065 install_element (INTERFACE_NODE
, &isis_circuit_type_cmd
);
2066 install_element (INTERFACE_NODE
, &no_isis_circuit_type_cmd
);
2068 install_element (INTERFACE_NODE
, &isis_network_cmd
);
2069 install_element (INTERFACE_NODE
, &no_isis_network_cmd
);
2071 install_element (INTERFACE_NODE
, &isis_passwd_cmd
);
2072 install_element (INTERFACE_NODE
, &no_isis_passwd_cmd
);
2074 install_element (INTERFACE_NODE
, &isis_priority_cmd
);
2075 install_element (INTERFACE_NODE
, &no_isis_priority_cmd
);
2076 install_element (INTERFACE_NODE
, &isis_priority_l1_cmd
);
2077 install_element (INTERFACE_NODE
, &no_isis_priority_l1_cmd
);
2078 install_element (INTERFACE_NODE
, &isis_priority_l2_cmd
);
2079 install_element (INTERFACE_NODE
, &no_isis_priority_l2_cmd
);
2081 install_element (INTERFACE_NODE
, &isis_metric_cmd
);
2082 install_element (INTERFACE_NODE
, &no_isis_metric_cmd
);
2083 install_element (INTERFACE_NODE
, &isis_metric_l1_cmd
);
2084 install_element (INTERFACE_NODE
, &no_isis_metric_l1_cmd
);
2085 install_element (INTERFACE_NODE
, &isis_metric_l2_cmd
);
2086 install_element (INTERFACE_NODE
, &no_isis_metric_l2_cmd
);
2088 install_element (INTERFACE_NODE
, &isis_hello_interval_cmd
);
2089 install_element (INTERFACE_NODE
, &no_isis_hello_interval_cmd
);
2090 install_element (INTERFACE_NODE
, &isis_hello_interval_l1_cmd
);
2091 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l1_cmd
);
2092 install_element (INTERFACE_NODE
, &isis_hello_interval_l2_cmd
);
2093 install_element (INTERFACE_NODE
, &no_isis_hello_interval_l2_cmd
);
2095 install_element (INTERFACE_NODE
, &isis_hello_multiplier_cmd
);
2096 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_cmd
);
2097 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l1_cmd
);
2098 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l1_cmd
);
2099 install_element (INTERFACE_NODE
, &isis_hello_multiplier_l2_cmd
);
2100 install_element (INTERFACE_NODE
, &no_isis_hello_multiplier_l2_cmd
);
2102 install_element (INTERFACE_NODE
, &isis_hello_padding_cmd
);
2103 install_element (INTERFACE_NODE
, &no_isis_hello_padding_cmd
);
2105 install_element (INTERFACE_NODE
, &csnp_interval_cmd
);
2106 install_element (INTERFACE_NODE
, &no_csnp_interval_cmd
);
2107 install_element (INTERFACE_NODE
, &csnp_interval_l1_cmd
);
2108 install_element (INTERFACE_NODE
, &no_csnp_interval_l1_cmd
);
2109 install_element (INTERFACE_NODE
, &csnp_interval_l2_cmd
);
2110 install_element (INTERFACE_NODE
, &no_csnp_interval_l2_cmd
);
2112 install_element (INTERFACE_NODE
, &psnp_interval_cmd
);
2113 install_element (INTERFACE_NODE
, &no_psnp_interval_cmd
);
2114 install_element (INTERFACE_NODE
, &psnp_interval_l1_cmd
);
2115 install_element (INTERFACE_NODE
, &no_psnp_interval_l1_cmd
);
2116 install_element (INTERFACE_NODE
, &psnp_interval_l2_cmd
);
2117 install_element (INTERFACE_NODE
, &no_psnp_interval_l2_cmd
);
2119 install_element (ISIS_NODE
, &metric_style_cmd
);
2120 install_element (ISIS_NODE
, &no_metric_style_cmd
);
2122 install_element (ISIS_NODE
, &set_overload_bit_cmd
);
2123 install_element (ISIS_NODE
, &no_set_overload_bit_cmd
);
2125 install_element (ISIS_NODE
, &set_attached_bit_cmd
);
2126 install_element (ISIS_NODE
, &no_set_attached_bit_cmd
);
2128 install_element (ISIS_NODE
, &dynamic_hostname_cmd
);
2129 install_element (ISIS_NODE
, &no_dynamic_hostname_cmd
);
2131 install_element (ISIS_NODE
, &area_lsp_mtu_cmd
);
2132 install_element (ISIS_NODE
, &no_area_lsp_mtu_cmd
);
2134 install_element (ISIS_NODE
, &is_type_cmd
);
2135 install_element (ISIS_NODE
, &no_is_type_cmd
);
2137 install_element (ISIS_NODE
, &lsp_gen_interval_cmd
);
2138 install_element (ISIS_NODE
, &no_lsp_gen_interval_cmd
);
2140 install_element (ISIS_NODE
, &spf_interval_cmd
);
2141 install_element (ISIS_NODE
, &no_spf_interval_cmd
);
2142 install_element (ISIS_NODE
, &spf_interval_l1_cmd
);
2143 install_element (ISIS_NODE
, &no_spf_interval_l1_cmd
);
2144 install_element (ISIS_NODE
, &spf_interval_l2_cmd
);
2145 install_element (ISIS_NODE
, &no_spf_interval_l2_cmd
);
2147 install_element (ISIS_NODE
, &max_lsp_lifetime_cmd
);
2148 install_element (ISIS_NODE
, &no_max_lsp_lifetime_cmd
);
2150 install_element (ISIS_NODE
, &lsp_refresh_interval_cmd
);
2151 install_element (ISIS_NODE
, &no_lsp_refresh_interval_cmd
);
2153 install_element (ISIS_NODE
, &area_passwd_md5_cmd
);
2154 install_element (ISIS_NODE
, &area_passwd_clear_cmd
);
2155 install_element (ISIS_NODE
, &domain_passwd_md5_cmd
);
2156 install_element (ISIS_NODE
, &domain_passwd_clear_cmd
);
2157 install_element (ISIS_NODE
, &no_area_passwd_cmd
);
2159 install_element (ISIS_NODE
, &spf_delay_ietf_cmd
);
2160 install_element (ISIS_NODE
, &no_spf_delay_ietf_cmd
);