]> git.proxmox.com Git - mirror_frr.git/blob - isisd/isis_vty.c
Add user `frr` into group `frrvty`
[mirror_frr.git] / isisd / isis_vty.c
1 /*
2 * IS-IS Rout(e)ing protocol - isis_circuit.h
3 *
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.
8 *
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)
12 * any later version.
13 *
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
17 * more details.
18
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.
22 */
23
24 #include <zebra.h>
25 #include <command.h>
26
27 #include "isis_circuit.h"
28 #include "isis_csm.h"
29 #include "isis_misc.h"
30 #include "isisd.h"
31
32 static struct isis_circuit *
33 isis_circuit_lookup (struct vty *vty)
34 {
35 struct interface *ifp = VTY_GET_CONTEXT(interface);
36 struct isis_circuit *circuit;
37
38 if (!ifp)
39 {
40 vty_out (vty, "Invalid interface %s", VTY_NEWLINE);
41 return NULL;
42 }
43
44 circuit = circuit_scan_by_ifp (ifp);
45 if (!circuit)
46 {
47 vty_out (vty, "ISIS is not enabled on circuit %s%s",
48 ifp->name, VTY_NEWLINE);
49 return NULL;
50 }
51
52 return circuit;
53 }
54
55 DEFUN (ip_router_isis,
56 ip_router_isis_cmd,
57 "(ip|ipv6) router isis WORD",
58 "Interface Internet Protocol config commands\n"
59 "IP router interface commands\n"
60 "IS-IS Routing for IP\n"
61 "Routing process tag\n")
62 {
63 VTY_DECLVAR_CONTEXT (interface, ifp);
64 struct isis_circuit *circuit;
65 struct isis_area *area;
66 const char *af = argv[0];
67 const char *area_tag = argv[1];
68
69 /* Prevent more than one area per circuit */
70 circuit = circuit_scan_by_ifp (ifp);
71 if (circuit && circuit->area)
72 {
73 if (strcmp (circuit->area->area_tag, area_tag))
74 {
75 vty_out (vty, "ISIS circuit is already defined on %s%s",
76 circuit->area->area_tag, VTY_NEWLINE);
77 return CMD_ERR_NOTHING_TODO;
78 }
79 }
80
81 area = isis_area_lookup (area_tag);
82 if (!area)
83 area = isis_area_create (area_tag);
84
85 if (!circuit || !circuit->area) {
86 circuit = isis_circuit_create (area, ifp);
87
88 if (circuit->state != C_STATE_CONF && circuit->state != C_STATE_UP)
89 {
90 vty_out(vty, "Couldn't bring up interface, please check log.%s", VTY_NEWLINE);
91 return CMD_WARNING;
92 }
93 }
94
95 bool ip = circuit->ip_router, ipv6 = circuit->ipv6_router;
96 if (af[2] != '\0')
97 ipv6 = true;
98 else
99 ip = true;
100
101 isis_circuit_af_set (circuit, ip, ipv6);
102 return CMD_SUCCESS;
103 }
104
105 DEFUN (no_ip_router_isis,
106 no_ip_router_isis_cmd,
107 "no (ip|ipv6) router isis WORD",
108 NO_STR
109 "Interface Internet Protocol config commands\n"
110 "IP router interface commands\n"
111 "IS-IS Routing for IP\n"
112 "Routing process tag\n")
113 {
114 VTY_DECLVAR_CONTEXT (interface, ifp);
115 struct isis_area *area;
116 struct isis_circuit *circuit;
117 const char *af = argv[0];
118 const char *area_tag = argv[1];
119
120 area = isis_area_lookup (area_tag);
121 if (!area)
122 {
123 vty_out (vty, "Can't find ISIS instance %s%s",
124 argv[0], VTY_NEWLINE);
125 return CMD_ERR_NO_MATCH;
126 }
127
128 circuit = circuit_lookup_by_ifp (ifp, area->circuit_list);
129 if (!circuit)
130 {
131 vty_out (vty, "ISIS is not enabled on circuit %s%s",
132 ifp->name, VTY_NEWLINE);
133 return CMD_ERR_NO_MATCH;
134 }
135
136 bool ip = circuit->ip_router, ipv6 = circuit->ipv6_router;
137 if (af[2] != '\0')
138 ipv6 = false;
139 else
140 ip = false;
141
142 isis_circuit_af_set (circuit, ip, ipv6);
143 return CMD_SUCCESS;
144 }
145
146 DEFUN (isis_passive,
147 isis_passive_cmd,
148 "isis passive",
149 "IS-IS commands\n"
150 "Configure the passive mode for interface\n")
151 {
152 struct isis_circuit *circuit = isis_circuit_lookup (vty);
153 if (!circuit)
154 return CMD_ERR_NO_MATCH;
155
156 isis_circuit_passive_set (circuit, 1);
157 return CMD_SUCCESS;
158 }
159
160 DEFUN (no_isis_passive,
161 no_isis_passive_cmd,
162 "no isis passive",
163 NO_STR
164 "IS-IS commands\n"
165 "Configure the passive mode for interface\n")
166 {
167 struct isis_circuit *circuit = isis_circuit_lookup (vty);
168 if (!circuit)
169 return CMD_ERR_NO_MATCH;
170
171 if (if_is_loopback (circuit->interface))
172 {
173 vty_out (vty, "Can't set no passive for loopback interface%s",
174 VTY_NEWLINE);
175 return CMD_ERR_AMBIGUOUS;
176 }
177
178 isis_circuit_passive_set (circuit, 0);
179 return CMD_SUCCESS;
180 }
181
182 DEFUN (isis_circuit_type,
183 isis_circuit_type_cmd,
184 "isis circuit-type (level-1|level-1-2|level-2-only)",
185 "IS-IS commands\n"
186 "Configure circuit type for interface\n"
187 "Level-1 only adjacencies are formed\n"
188 "Level-1-2 adjacencies are formed\n"
189 "Level-2 only adjacencies are formed\n")
190 {
191 int is_type;
192 struct isis_circuit *circuit = isis_circuit_lookup (vty);
193 if (!circuit)
194 return CMD_ERR_NO_MATCH;
195
196 is_type = string2circuit_t (argv[0]);
197 if (!is_type)
198 {
199 vty_out (vty, "Unknown circuit-type %s", VTY_NEWLINE);
200 return CMD_ERR_AMBIGUOUS;
201 }
202
203 if (circuit->state == C_STATE_UP &&
204 circuit->area->is_type != IS_LEVEL_1_AND_2 &&
205 circuit->area->is_type != is_type)
206 {
207 vty_out (vty, "Invalid circuit level for area %s.%s",
208 circuit->area->area_tag, VTY_NEWLINE);
209 return CMD_ERR_AMBIGUOUS;
210 }
211 isis_circuit_is_type_set (circuit, is_type);
212
213 return CMD_SUCCESS;
214 }
215
216 DEFUN (no_isis_circuit_type,
217 no_isis_circuit_type_cmd,
218 "no isis circuit-type (level-1|level-1-2|level-2-only)",
219 NO_STR
220 "IS-IS commands\n"
221 "Configure circuit type for interface\n"
222 "Level-1 only adjacencies are formed\n"
223 "Level-1-2 adjacencies are formed\n"
224 "Level-2 only adjacencies are formed\n")
225 {
226 int is_type;
227 struct isis_circuit *circuit = isis_circuit_lookup (vty);
228 if (!circuit)
229 return CMD_ERR_NO_MATCH;
230
231 /*
232 * Set the circuits level to its default value
233 */
234 if (circuit->state == C_STATE_UP)
235 is_type = circuit->area->is_type;
236 else
237 is_type = IS_LEVEL_1_AND_2;
238 isis_circuit_is_type_set (circuit, is_type);
239
240 return CMD_SUCCESS;
241 }
242
243 DEFUN (isis_network,
244 isis_network_cmd,
245 "isis network point-to-point",
246 "IS-IS commands\n"
247 "Set network type\n"
248 "point-to-point network type\n")
249 {
250 struct isis_circuit *circuit = isis_circuit_lookup (vty);
251 if (!circuit)
252 return CMD_ERR_NO_MATCH;
253
254 if (isis_circuit_circ_type_set(circuit, CIRCUIT_T_P2P))
255 {
256 vty_out (vty, "isis network point-to-point "
257 "is valid only on broadcast interfaces%s",
258 VTY_NEWLINE);
259 return CMD_ERR_AMBIGUOUS;
260 }
261
262 return CMD_SUCCESS;
263 }
264
265 DEFUN (no_isis_network,
266 no_isis_network_cmd,
267 "no isis network point-to-point",
268 NO_STR
269 "IS-IS commands\n"
270 "Set network type for circuit\n"
271 "point-to-point network type\n")
272 {
273 struct isis_circuit *circuit = isis_circuit_lookup (vty);
274 if (!circuit)
275 return CMD_ERR_NO_MATCH;
276
277 if (isis_circuit_circ_type_set(circuit, CIRCUIT_T_BROADCAST))
278 {
279 vty_out (vty, "isis network point-to-point "
280 "is valid only on broadcast interfaces%s",
281 VTY_NEWLINE);
282 return CMD_ERR_AMBIGUOUS;
283 }
284
285 return CMD_SUCCESS;
286 }
287
288 DEFUN (isis_passwd,
289 isis_passwd_cmd,
290 "isis password (md5|clear) WORD",
291 "IS-IS commands\n"
292 "Configure the authentication password for a circuit\n"
293 "HMAC-MD5 authentication\n"
294 "Cleartext password\n"
295 "Circuit password\n")
296 {
297 struct isis_circuit *circuit = isis_circuit_lookup (vty);
298 int rv;
299 if (!circuit)
300 return CMD_ERR_NO_MATCH;
301
302 if (argv[0][0] == 'm')
303 rv = isis_circuit_passwd_hmac_md5_set(circuit, argv[1]);
304 else
305 rv = isis_circuit_passwd_cleartext_set(circuit, argv[1]);
306 if (rv)
307 {
308 vty_out (vty, "Too long circuit password (>254)%s", VTY_NEWLINE);
309 return CMD_ERR_AMBIGUOUS;
310 }
311
312 return CMD_SUCCESS;
313 }
314
315 DEFUN (no_isis_passwd,
316 no_isis_passwd_cmd,
317 "no isis password",
318 NO_STR
319 "IS-IS commands\n"
320 "Configure the authentication password for a circuit\n")
321 {
322 struct isis_circuit *circuit = isis_circuit_lookup (vty);
323 if (!circuit)
324 return CMD_ERR_NO_MATCH;
325
326 isis_circuit_passwd_unset(circuit);
327
328 return CMD_SUCCESS;
329 }
330
331 ALIAS (no_isis_passwd,
332 no_isis_passwd_arg_cmd,
333 "no isis password (md5|clear) WORD",
334 NO_STR
335 "IS-IS commands\n"
336 "Configure the authentication password for a circuit\n"
337 "HMAC-MD5 authentication\n"
338 "Cleartext password\n"
339 "Circuit password\n")
340
341 DEFUN (isis_priority,
342 isis_priority_cmd,
343 "isis priority <0-127>",
344 "IS-IS commands\n"
345 "Set priority for Designated Router election\n"
346 "Priority value\n")
347 {
348 int prio;
349 struct isis_circuit *circuit = isis_circuit_lookup (vty);
350 if (!circuit)
351 return CMD_ERR_NO_MATCH;
352
353 prio = atoi (argv[0]);
354 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
355 {
356 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
357 prio, VTY_NEWLINE);
358 return CMD_ERR_AMBIGUOUS;
359 }
360
361 circuit->priority[0] = prio;
362 circuit->priority[1] = prio;
363
364 return CMD_SUCCESS;
365 }
366
367 DEFUN (no_isis_priority,
368 no_isis_priority_cmd,
369 "no isis priority",
370 NO_STR
371 "IS-IS commands\n"
372 "Set priority for Designated Router election\n")
373 {
374 struct isis_circuit *circuit = isis_circuit_lookup (vty);
375 if (!circuit)
376 return CMD_ERR_NO_MATCH;
377
378 circuit->priority[0] = DEFAULT_PRIORITY;
379 circuit->priority[1] = DEFAULT_PRIORITY;
380
381 return CMD_SUCCESS;
382 }
383
384 ALIAS (no_isis_priority,
385 no_isis_priority_arg_cmd,
386 "no isis priority <0-127>",
387 NO_STR
388 "IS-IS commands\n"
389 "Set priority for Designated Router election\n"
390 "Priority value\n")
391
392 DEFUN (isis_priority_l1,
393 isis_priority_l1_cmd,
394 "isis priority <0-127> level-1",
395 "IS-IS commands\n"
396 "Set priority for Designated Router election\n"
397 "Priority value\n"
398 "Specify priority for level-1 routing\n")
399 {
400 int prio;
401 struct isis_circuit *circuit = isis_circuit_lookup (vty);
402 if (!circuit)
403 return CMD_ERR_NO_MATCH;
404
405 prio = atoi (argv[0]);
406 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
407 {
408 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
409 prio, VTY_NEWLINE);
410 return CMD_ERR_AMBIGUOUS;
411 }
412
413 circuit->priority[0] = prio;
414
415 return CMD_SUCCESS;
416 }
417
418 DEFUN (no_isis_priority_l1,
419 no_isis_priority_l1_cmd,
420 "no isis priority level-1",
421 NO_STR
422 "IS-IS commands\n"
423 "Set priority for Designated Router election\n"
424 "Specify priority for level-1 routing\n")
425 {
426 struct isis_circuit *circuit = isis_circuit_lookup (vty);
427 if (!circuit)
428 return CMD_ERR_NO_MATCH;
429
430 circuit->priority[0] = DEFAULT_PRIORITY;
431
432 return CMD_SUCCESS;
433 }
434
435 ALIAS (no_isis_priority_l1,
436 no_isis_priority_l1_arg_cmd,
437 "no isis priority <0-127> level-1",
438 NO_STR
439 "IS-IS commands\n"
440 "Set priority for Designated Router election\n"
441 "Priority value\n"
442 "Specify priority for level-1 routing\n")
443
444 DEFUN (isis_priority_l2,
445 isis_priority_l2_cmd,
446 "isis priority <0-127> level-2",
447 "IS-IS commands\n"
448 "Set priority for Designated Router election\n"
449 "Priority value\n"
450 "Specify priority for level-2 routing\n")
451 {
452 int prio;
453 struct isis_circuit *circuit = isis_circuit_lookup (vty);
454 if (!circuit)
455 return CMD_ERR_NO_MATCH;
456
457 prio = atoi (argv[0]);
458 if (prio < MIN_PRIORITY || prio > MAX_PRIORITY)
459 {
460 vty_out (vty, "Invalid priority %d - should be <0-127>%s",
461 prio, VTY_NEWLINE);
462 return CMD_ERR_AMBIGUOUS;
463 }
464
465 circuit->priority[1] = prio;
466
467 return CMD_SUCCESS;
468 }
469
470 DEFUN (no_isis_priority_l2,
471 no_isis_priority_l2_cmd,
472 "no isis priority level-2",
473 NO_STR
474 "IS-IS commands\n"
475 "Set priority for Designated Router election\n"
476 "Specify priority for level-2 routing\n")
477 {
478 struct isis_circuit *circuit = isis_circuit_lookup (vty);
479 if (!circuit)
480 return CMD_ERR_NO_MATCH;
481
482 circuit->priority[1] = DEFAULT_PRIORITY;
483
484 return CMD_SUCCESS;
485 }
486
487 ALIAS (no_isis_priority_l2,
488 no_isis_priority_l2_arg_cmd,
489 "no isis priority <0-127> level-2",
490 NO_STR
491 "IS-IS commands\n"
492 "Set priority for Designated Router election\n"
493 "Priority value\n"
494 "Specify priority for level-2 routing\n")
495
496 /* Metric command */
497 DEFUN (isis_metric,
498 isis_metric_cmd,
499 "isis metric <0-16777215>",
500 "IS-IS commands\n"
501 "Set default metric for circuit\n"
502 "Default metric value\n")
503 {
504 int met;
505 struct isis_circuit *circuit = isis_circuit_lookup (vty);
506 if (!circuit)
507 return CMD_ERR_NO_MATCH;
508
509 met = atoi (argv[0]);
510
511 /* RFC3787 section 5.1 */
512 if (circuit->area && circuit->area->oldmetric == 1 &&
513 met > MAX_NARROW_LINK_METRIC)
514 {
515 vty_out (vty, "Invalid metric %d - should be <0-63> "
516 "when narrow metric type enabled%s",
517 met, VTY_NEWLINE);
518 return CMD_ERR_AMBIGUOUS;
519 }
520
521 /* RFC4444 */
522 if (circuit->area && circuit->area->newmetric == 1 &&
523 met > MAX_WIDE_LINK_METRIC)
524 {
525 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
526 "when wide metric type enabled%s",
527 met, VTY_NEWLINE);
528 return CMD_ERR_AMBIGUOUS;
529 }
530
531 isis_circuit_metric_set (circuit, IS_LEVEL_1, met);
532 isis_circuit_metric_set (circuit, IS_LEVEL_2, met);
533 return CMD_SUCCESS;
534 }
535
536 DEFUN (no_isis_metric,
537 no_isis_metric_cmd,
538 "no isis metric",
539 NO_STR
540 "IS-IS commands\n"
541 "Set default metric for circuit\n")
542 {
543 struct isis_circuit *circuit = isis_circuit_lookup (vty);
544 if (!circuit)
545 return CMD_ERR_NO_MATCH;
546
547 isis_circuit_metric_set (circuit, IS_LEVEL_1, DEFAULT_CIRCUIT_METRIC);
548 isis_circuit_metric_set (circuit, IS_LEVEL_2, DEFAULT_CIRCUIT_METRIC);
549 return CMD_SUCCESS;
550 }
551
552 ALIAS (no_isis_metric,
553 no_isis_metric_arg_cmd,
554 "no isis metric <0-16777215>",
555 NO_STR
556 "IS-IS commands\n"
557 "Set default metric for circuit\n"
558 "Default metric value\n")
559
560 DEFUN (isis_metric_l1,
561 isis_metric_l1_cmd,
562 "isis metric <0-16777215> level-1",
563 "IS-IS commands\n"
564 "Set default metric for circuit\n"
565 "Default metric value\n"
566 "Specify metric for level-1 routing\n")
567 {
568 int met;
569 struct isis_circuit *circuit = isis_circuit_lookup (vty);
570 if (!circuit)
571 return CMD_ERR_NO_MATCH;
572
573 met = atoi (argv[0]);
574
575 /* RFC3787 section 5.1 */
576 if (circuit->area && circuit->area->oldmetric == 1 &&
577 met > MAX_NARROW_LINK_METRIC)
578 {
579 vty_out (vty, "Invalid metric %d - should be <0-63> "
580 "when narrow metric type enabled%s",
581 met, VTY_NEWLINE);
582 return CMD_ERR_AMBIGUOUS;
583 }
584
585 /* RFC4444 */
586 if (circuit->area && circuit->area->newmetric == 1 &&
587 met > MAX_WIDE_LINK_METRIC)
588 {
589 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
590 "when wide metric type enabled%s",
591 met, VTY_NEWLINE);
592 return CMD_ERR_AMBIGUOUS;
593 }
594
595 isis_circuit_metric_set (circuit, IS_LEVEL_1, met);
596 return CMD_SUCCESS;
597 }
598
599 DEFUN (no_isis_metric_l1,
600 no_isis_metric_l1_cmd,
601 "no isis metric level-1",
602 NO_STR
603 "IS-IS commands\n"
604 "Set default metric for circuit\n"
605 "Specify metric for level-1 routing\n")
606 {
607 struct isis_circuit *circuit = isis_circuit_lookup (vty);
608 if (!circuit)
609 return CMD_ERR_NO_MATCH;
610
611 isis_circuit_metric_set (circuit, IS_LEVEL_1, DEFAULT_CIRCUIT_METRIC);
612 return CMD_SUCCESS;
613 }
614
615 ALIAS (no_isis_metric_l1,
616 no_isis_metric_l1_arg_cmd,
617 "no isis metric <0-16777215> level-1",
618 NO_STR
619 "IS-IS commands\n"
620 "Set default metric for circuit\n"
621 "Default metric value\n"
622 "Specify metric for level-1 routing\n")
623
624 DEFUN (isis_metric_l2,
625 isis_metric_l2_cmd,
626 "isis metric <0-16777215> level-2",
627 "IS-IS commands\n"
628 "Set default metric for circuit\n"
629 "Default metric value\n"
630 "Specify metric for level-2 routing\n")
631 {
632 int met;
633 struct isis_circuit *circuit = isis_circuit_lookup (vty);
634 if (!circuit)
635 return CMD_ERR_NO_MATCH;
636
637 met = atoi (argv[0]);
638
639 /* RFC3787 section 5.1 */
640 if (circuit->area && circuit->area->oldmetric == 1 &&
641 met > MAX_NARROW_LINK_METRIC)
642 {
643 vty_out (vty, "Invalid metric %d - should be <0-63> "
644 "when narrow metric type enabled%s",
645 met, VTY_NEWLINE);
646 return CMD_ERR_AMBIGUOUS;
647 }
648
649 /* RFC4444 */
650 if (circuit->area && circuit->area->newmetric == 1 &&
651 met > MAX_WIDE_LINK_METRIC)
652 {
653 vty_out (vty, "Invalid metric %d - should be <0-16777215> "
654 "when wide metric type enabled%s",
655 met, VTY_NEWLINE);
656 return CMD_ERR_AMBIGUOUS;
657 }
658
659 isis_circuit_metric_set (circuit, IS_LEVEL_2, met);
660 return CMD_SUCCESS;
661 }
662
663 DEFUN (no_isis_metric_l2,
664 no_isis_metric_l2_cmd,
665 "no isis metric level-2",
666 NO_STR
667 "IS-IS commands\n"
668 "Set default metric for circuit\n"
669 "Specify metric for level-2 routing\n")
670 {
671 struct isis_circuit *circuit = isis_circuit_lookup (vty);
672 if (!circuit)
673 return CMD_ERR_NO_MATCH;
674
675 isis_circuit_metric_set (circuit, IS_LEVEL_2, DEFAULT_CIRCUIT_METRIC);
676 return CMD_SUCCESS;
677 }
678
679 ALIAS (no_isis_metric_l2,
680 no_isis_metric_l2_arg_cmd,
681 "no isis metric <0-16777215> level-2",
682 NO_STR
683 "IS-IS commands\n"
684 "Set default metric for circuit\n"
685 "Default metric value\n"
686 "Specify metric for level-2 routing\n")
687 /* end of metrics */
688
689 DEFUN (isis_hello_interval,
690 isis_hello_interval_cmd,
691 "isis hello-interval <1-600>",
692 "IS-IS commands\n"
693 "Set Hello interval\n"
694 "Hello interval value\n"
695 "Holdtime 1 seconds, interval depends on multiplier\n")
696 {
697 int interval;
698 struct isis_circuit *circuit = isis_circuit_lookup (vty);
699 if (!circuit)
700 return CMD_ERR_NO_MATCH;
701
702 interval = atoi (argv[0]);
703 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
704 {
705 vty_out (vty, "Invalid hello-interval %d - should be <1-600>%s",
706 interval, VTY_NEWLINE);
707 return CMD_ERR_AMBIGUOUS;
708 }
709
710 circuit->hello_interval[0] = (u_int16_t) interval;
711 circuit->hello_interval[1] = (u_int16_t) interval;
712
713 return CMD_SUCCESS;
714 }
715
716 DEFUN (no_isis_hello_interval,
717 no_isis_hello_interval_cmd,
718 "no isis hello-interval",
719 NO_STR
720 "IS-IS commands\n"
721 "Set Hello interval\n")
722 {
723 struct isis_circuit *circuit = isis_circuit_lookup (vty);
724 if (!circuit)
725 return CMD_ERR_NO_MATCH;
726
727 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
728 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
729
730 return CMD_SUCCESS;
731 }
732
733 ALIAS (no_isis_hello_interval,
734 no_isis_hello_interval_arg_cmd,
735 "no isis hello-interval <1-600>",
736 NO_STR
737 "IS-IS commands\n"
738 "Set Hello interval\n"
739 "Hello interval value\n"
740 "Holdtime 1 second, interval depends on multiplier\n")
741
742 DEFUN (isis_hello_interval_l1,
743 isis_hello_interval_l1_cmd,
744 "isis hello-interval <1-600> level-1",
745 "IS-IS commands\n"
746 "Set Hello interval\n"
747 "Hello interval value\n"
748 "Holdtime 1 second, interval depends on multiplier\n"
749 "Specify hello-interval for level-1 IIHs\n")
750 {
751 long interval;
752 struct isis_circuit *circuit = isis_circuit_lookup (vty);
753 if (!circuit)
754 return CMD_ERR_NO_MATCH;
755
756 interval = atoi (argv[0]);
757 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
758 {
759 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
760 interval, VTY_NEWLINE);
761 return CMD_ERR_AMBIGUOUS;
762 }
763
764 circuit->hello_interval[0] = (u_int16_t) interval;
765
766 return CMD_SUCCESS;
767 }
768
769 DEFUN (no_isis_hello_interval_l1,
770 no_isis_hello_interval_l1_cmd,
771 "no isis hello-interval level-1",
772 NO_STR
773 "IS-IS commands\n"
774 "Set Hello interval\n"
775 "Specify hello-interval for level-1 IIHs\n")
776 {
777 struct isis_circuit *circuit = isis_circuit_lookup (vty);
778 if (!circuit)
779 return CMD_ERR_NO_MATCH;
780
781 circuit->hello_interval[0] = DEFAULT_HELLO_INTERVAL;
782
783 return CMD_SUCCESS;
784 }
785
786 ALIAS (no_isis_hello_interval_l1,
787 no_isis_hello_interval_l1_arg_cmd,
788 "no isis hello-interval <1-600> level-1",
789 NO_STR
790 "IS-IS commands\n"
791 "Set Hello interval\n"
792 "Hello interval value\n"
793 "Holdtime 1 second, interval depends on multiplier\n"
794 "Specify hello-interval for level-1 IIHs\n")
795
796 DEFUN (isis_hello_interval_l2,
797 isis_hello_interval_l2_cmd,
798 "isis hello-interval <1-600> level-2",
799 "IS-IS commands\n"
800 "Set Hello interval\n"
801 "Hello interval value\n"
802 "Holdtime 1 second, interval depends on multiplier\n"
803 "Specify hello-interval for level-2 IIHs\n")
804 {
805 long interval;
806 struct isis_circuit *circuit = isis_circuit_lookup (vty);
807 if (!circuit)
808 return CMD_ERR_NO_MATCH;
809
810 interval = atoi (argv[0]);
811 if (interval < MIN_HELLO_INTERVAL || interval > MAX_HELLO_INTERVAL)
812 {
813 vty_out (vty, "Invalid hello-interval %ld - should be <1-600>%s",
814 interval, VTY_NEWLINE);
815 return CMD_ERR_AMBIGUOUS;
816 }
817
818 circuit->hello_interval[1] = (u_int16_t) interval;
819
820 return CMD_SUCCESS;
821 }
822
823 DEFUN (no_isis_hello_interval_l2,
824 no_isis_hello_interval_l2_cmd,
825 "no isis hello-interval level-2",
826 NO_STR
827 "IS-IS commands\n"
828 "Set Hello interval\n"
829 "Specify hello-interval for level-2 IIHs\n")
830 {
831 struct isis_circuit *circuit = isis_circuit_lookup (vty);
832 if (!circuit)
833 return CMD_ERR_NO_MATCH;
834
835 circuit->hello_interval[1] = DEFAULT_HELLO_INTERVAL;
836
837 return CMD_SUCCESS;
838 }
839
840 ALIAS (no_isis_hello_interval_l2,
841 no_isis_hello_interval_l2_arg_cmd,
842 "no isis hello-interval <1-600> level-2",
843 NO_STR
844 "IS-IS commands\n"
845 "Set Hello interval\n"
846 "Hello interval value\n"
847 "Holdtime 1 second, interval depends on multiplier\n"
848 "Specify hello-interval for level-2 IIHs\n")
849
850 DEFUN (isis_hello_multiplier,
851 isis_hello_multiplier_cmd,
852 "isis hello-multiplier <2-100>",
853 "IS-IS commands\n"
854 "Set multiplier for Hello holding time\n"
855 "Hello multiplier value\n")
856 {
857 int mult;
858 struct isis_circuit *circuit = isis_circuit_lookup (vty);
859 if (!circuit)
860 return CMD_ERR_NO_MATCH;
861
862 mult = atoi (argv[0]);
863 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
864 {
865 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
866 mult, VTY_NEWLINE);
867 return CMD_ERR_AMBIGUOUS;
868 }
869
870 circuit->hello_multiplier[0] = (u_int16_t) mult;
871 circuit->hello_multiplier[1] = (u_int16_t) mult;
872
873 return CMD_SUCCESS;
874 }
875
876 DEFUN (no_isis_hello_multiplier,
877 no_isis_hello_multiplier_cmd,
878 "no isis hello-multiplier",
879 NO_STR
880 "IS-IS commands\n"
881 "Set multiplier for Hello holding time\n")
882 {
883 struct isis_circuit *circuit = isis_circuit_lookup (vty);
884 if (!circuit)
885 return CMD_ERR_NO_MATCH;
886
887 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
888 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
889
890 return CMD_SUCCESS;
891 }
892
893 ALIAS (no_isis_hello_multiplier,
894 no_isis_hello_multiplier_arg_cmd,
895 "no isis hello-multiplier <2-100>",
896 NO_STR
897 "IS-IS commands\n"
898 "Set multiplier for Hello holding time\n"
899 "Hello multiplier value\n")
900
901 DEFUN (isis_hello_multiplier_l1,
902 isis_hello_multiplier_l1_cmd,
903 "isis hello-multiplier <2-100> level-1",
904 "IS-IS commands\n"
905 "Set multiplier for Hello holding time\n"
906 "Hello multiplier value\n"
907 "Specify hello multiplier for level-1 IIHs\n")
908 {
909 int mult;
910 struct isis_circuit *circuit = isis_circuit_lookup (vty);
911 if (!circuit)
912 return CMD_ERR_NO_MATCH;
913
914 mult = atoi (argv[0]);
915 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
916 {
917 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
918 mult, VTY_NEWLINE);
919 return CMD_ERR_AMBIGUOUS;
920 }
921
922 circuit->hello_multiplier[0] = (u_int16_t) mult;
923
924 return CMD_SUCCESS;
925 }
926
927 DEFUN (no_isis_hello_multiplier_l1,
928 no_isis_hello_multiplier_l1_cmd,
929 "no isis hello-multiplier level-1",
930 NO_STR
931 "IS-IS commands\n"
932 "Set multiplier for Hello holding time\n"
933 "Specify hello multiplier for level-1 IIHs\n")
934 {
935 struct isis_circuit *circuit = isis_circuit_lookup (vty);
936 if (!circuit)
937 return CMD_ERR_NO_MATCH;
938
939 circuit->hello_multiplier[0] = DEFAULT_HELLO_MULTIPLIER;
940
941 return CMD_SUCCESS;
942 }
943
944 ALIAS (no_isis_hello_multiplier_l1,
945 no_isis_hello_multiplier_l1_arg_cmd,
946 "no isis hello-multiplier <2-100> level-1",
947 NO_STR
948 "IS-IS commands\n"
949 "Set multiplier for Hello holding time\n"
950 "Hello multiplier value\n"
951 "Specify hello multiplier for level-1 IIHs\n")
952
953 DEFUN (isis_hello_multiplier_l2,
954 isis_hello_multiplier_l2_cmd,
955 "isis hello-multiplier <2-100> level-2",
956 "IS-IS commands\n"
957 "Set multiplier for Hello holding time\n"
958 "Hello multiplier value\n"
959 "Specify hello multiplier for level-2 IIHs\n")
960 {
961 int mult;
962 struct isis_circuit *circuit = isis_circuit_lookup (vty);
963 if (!circuit)
964 return CMD_ERR_NO_MATCH;
965
966 mult = atoi (argv[0]);
967 if (mult < MIN_HELLO_MULTIPLIER || mult > MAX_HELLO_MULTIPLIER)
968 {
969 vty_out (vty, "Invalid hello-multiplier %d - should be <2-100>%s",
970 mult, VTY_NEWLINE);
971 return CMD_ERR_AMBIGUOUS;
972 }
973
974 circuit->hello_multiplier[1] = (u_int16_t) mult;
975
976 return CMD_SUCCESS;
977 }
978
979 DEFUN (no_isis_hello_multiplier_l2,
980 no_isis_hello_multiplier_l2_cmd,
981 "no isis hello-multiplier level-2",
982 NO_STR
983 "IS-IS commands\n"
984 "Set multiplier for Hello holding time\n"
985 "Specify hello multiplier for level-2 IIHs\n")
986 {
987 struct isis_circuit *circuit = isis_circuit_lookup (vty);
988 if (!circuit)
989 return CMD_ERR_NO_MATCH;
990
991 circuit->hello_multiplier[1] = DEFAULT_HELLO_MULTIPLIER;
992
993 return CMD_SUCCESS;
994 }
995
996 ALIAS (no_isis_hello_multiplier_l2,
997 no_isis_hello_multiplier_l2_arg_cmd,
998 "no isis hello-multiplier <2-100> level-2",
999 NO_STR
1000 "IS-IS commands\n"
1001 "Set multiplier for Hello holding time\n"
1002 "Hello multiplier value\n"
1003 "Specify hello multiplier for level-2 IIHs\n")
1004
1005 DEFUN (isis_hello_padding,
1006 isis_hello_padding_cmd,
1007 "isis hello padding",
1008 "IS-IS commands\n"
1009 "Add padding to IS-IS hello packets\n"
1010 "Pad hello packets\n"
1011 "<cr>\n")
1012 {
1013 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1014 if (!circuit)
1015 return CMD_ERR_NO_MATCH;
1016
1017 circuit->pad_hellos = 1;
1018
1019 return CMD_SUCCESS;
1020 }
1021
1022 DEFUN (no_isis_hello_padding,
1023 no_isis_hello_padding_cmd,
1024 "no isis hello padding",
1025 NO_STR
1026 "IS-IS commands\n"
1027 "Add padding to IS-IS hello packets\n"
1028 "Pad hello packets\n"
1029 "<cr>\n")
1030 {
1031 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1032 if (!circuit)
1033 return CMD_ERR_NO_MATCH;
1034
1035 circuit->pad_hellos = 0;
1036
1037 return CMD_SUCCESS;
1038 }
1039
1040 DEFUN (csnp_interval,
1041 csnp_interval_cmd,
1042 "isis csnp-interval <1-600>",
1043 "IS-IS commands\n"
1044 "Set CSNP interval in seconds\n"
1045 "CSNP interval value\n")
1046 {
1047 unsigned long interval;
1048 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1049 if (!circuit)
1050 return CMD_ERR_NO_MATCH;
1051
1052 interval = atol (argv[0]);
1053 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
1054 {
1055 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
1056 interval, VTY_NEWLINE);
1057 return CMD_ERR_AMBIGUOUS;
1058 }
1059
1060 circuit->csnp_interval[0] = (u_int16_t) interval;
1061 circuit->csnp_interval[1] = (u_int16_t) interval;
1062
1063 return CMD_SUCCESS;
1064 }
1065
1066 DEFUN (no_csnp_interval,
1067 no_csnp_interval_cmd,
1068 "no isis csnp-interval",
1069 NO_STR
1070 "IS-IS commands\n"
1071 "Set CSNP interval in seconds\n")
1072 {
1073 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1074 if (!circuit)
1075 return CMD_ERR_NO_MATCH;
1076
1077 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
1078 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
1079
1080 return CMD_SUCCESS;
1081 }
1082
1083 ALIAS (no_csnp_interval,
1084 no_csnp_interval_arg_cmd,
1085 "no isis csnp-interval <1-600>",
1086 NO_STR
1087 "IS-IS commands\n"
1088 "Set CSNP interval in seconds\n"
1089 "CSNP interval value\n")
1090
1091 DEFUN (csnp_interval_l1,
1092 csnp_interval_l1_cmd,
1093 "isis csnp-interval <1-600> level-1",
1094 "IS-IS commands\n"
1095 "Set CSNP interval in seconds\n"
1096 "CSNP interval value\n"
1097 "Specify interval for level-1 CSNPs\n")
1098 {
1099 unsigned long interval;
1100 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1101 if (!circuit)
1102 return CMD_ERR_NO_MATCH;
1103
1104 interval = atol (argv[0]);
1105 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
1106 {
1107 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
1108 interval, VTY_NEWLINE);
1109 return CMD_ERR_AMBIGUOUS;
1110 }
1111
1112 circuit->csnp_interval[0] = (u_int16_t) interval;
1113
1114 return CMD_SUCCESS;
1115 }
1116
1117 DEFUN (no_csnp_interval_l1,
1118 no_csnp_interval_l1_cmd,
1119 "no isis csnp-interval level-1",
1120 NO_STR
1121 "IS-IS commands\n"
1122 "Set CSNP interval in seconds\n"
1123 "Specify interval for level-1 CSNPs\n")
1124 {
1125 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1126 if (!circuit)
1127 return CMD_ERR_NO_MATCH;
1128
1129 circuit->csnp_interval[0] = DEFAULT_CSNP_INTERVAL;
1130
1131 return CMD_SUCCESS;
1132 }
1133
1134 ALIAS (no_csnp_interval_l1,
1135 no_csnp_interval_l1_arg_cmd,
1136 "no isis csnp-interval <1-600> level-1",
1137 NO_STR
1138 "IS-IS commands\n"
1139 "Set CSNP interval in seconds\n"
1140 "CSNP interval value\n"
1141 "Specify interval for level-1 CSNPs\n")
1142
1143 DEFUN (csnp_interval_l2,
1144 csnp_interval_l2_cmd,
1145 "isis csnp-interval <1-600> level-2",
1146 "IS-IS commands\n"
1147 "Set CSNP interval in seconds\n"
1148 "CSNP interval value\n"
1149 "Specify interval for level-2 CSNPs\n")
1150 {
1151 unsigned long interval;
1152 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1153 if (!circuit)
1154 return CMD_ERR_NO_MATCH;
1155
1156 interval = atol (argv[0]);
1157 if (interval < MIN_CSNP_INTERVAL || interval > MAX_CSNP_INTERVAL)
1158 {
1159 vty_out (vty, "Invalid csnp-interval %lu - should be <1-600>%s",
1160 interval, VTY_NEWLINE);
1161 return CMD_ERR_AMBIGUOUS;
1162 }
1163
1164 circuit->csnp_interval[1] = (u_int16_t) interval;
1165
1166 return CMD_SUCCESS;
1167 }
1168
1169 DEFUN (no_csnp_interval_l2,
1170 no_csnp_interval_l2_cmd,
1171 "no isis csnp-interval level-2",
1172 NO_STR
1173 "IS-IS commands\n"
1174 "Set CSNP interval in seconds\n"
1175 "Specify interval for level-2 CSNPs\n")
1176 {
1177 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1178 if (!circuit)
1179 return CMD_ERR_NO_MATCH;
1180
1181 circuit->csnp_interval[1] = DEFAULT_CSNP_INTERVAL;
1182
1183 return CMD_SUCCESS;
1184 }
1185
1186 ALIAS (no_csnp_interval_l2,
1187 no_csnp_interval_l2_arg_cmd,
1188 "no isis csnp-interval <1-600> level-2",
1189 NO_STR
1190 "IS-IS commands\n"
1191 "Set CSNP interval in seconds\n"
1192 "CSNP interval value\n"
1193 "Specify interval for level-2 CSNPs\n")
1194
1195 DEFUN (psnp_interval,
1196 psnp_interval_cmd,
1197 "isis psnp-interval <1-120>",
1198 "IS-IS commands\n"
1199 "Set PSNP interval in seconds\n"
1200 "PSNP interval value\n")
1201 {
1202 unsigned long interval;
1203 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1204 if (!circuit)
1205 return CMD_ERR_NO_MATCH;
1206
1207 interval = atol (argv[0]);
1208 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
1209 {
1210 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
1211 interval, VTY_NEWLINE);
1212 return CMD_ERR_AMBIGUOUS;
1213 }
1214
1215 circuit->psnp_interval[0] = (u_int16_t) interval;
1216 circuit->psnp_interval[1] = (u_int16_t) interval;
1217
1218 return CMD_SUCCESS;
1219 }
1220
1221 DEFUN (no_psnp_interval,
1222 no_psnp_interval_cmd,
1223 "no isis psnp-interval",
1224 NO_STR
1225 "IS-IS commands\n"
1226 "Set PSNP interval in seconds\n")
1227 {
1228 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1229 if (!circuit)
1230 return CMD_ERR_NO_MATCH;
1231
1232 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
1233 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
1234
1235 return CMD_SUCCESS;
1236 }
1237
1238 ALIAS (no_psnp_interval,
1239 no_psnp_interval_arg_cmd,
1240 "no isis psnp-interval <1-120>",
1241 NO_STR
1242 "IS-IS commands\n"
1243 "Set PSNP interval in seconds\n"
1244 "PSNP interval value\n")
1245
1246 DEFUN (psnp_interval_l1,
1247 psnp_interval_l1_cmd,
1248 "isis psnp-interval <1-120> level-1",
1249 "IS-IS commands\n"
1250 "Set PSNP interval in seconds\n"
1251 "PSNP interval value\n"
1252 "Specify interval for level-1 PSNPs\n")
1253 {
1254 unsigned long interval;
1255 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1256 if (!circuit)
1257 return CMD_ERR_NO_MATCH;
1258
1259 interval = atol (argv[0]);
1260 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
1261 {
1262 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
1263 interval, VTY_NEWLINE);
1264 return CMD_ERR_AMBIGUOUS;
1265 }
1266
1267 circuit->psnp_interval[0] = (u_int16_t) interval;
1268
1269 return CMD_SUCCESS;
1270 }
1271
1272 DEFUN (no_psnp_interval_l1,
1273 no_psnp_interval_l1_cmd,
1274 "no isis psnp-interval level-1",
1275 NO_STR
1276 "IS-IS commands\n"
1277 "Set PSNP interval in seconds\n"
1278 "Specify interval for level-1 PSNPs\n")
1279 {
1280 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1281 if (!circuit)
1282 return CMD_ERR_NO_MATCH;
1283
1284 circuit->psnp_interval[0] = DEFAULT_PSNP_INTERVAL;
1285
1286 return CMD_SUCCESS;
1287 }
1288
1289 ALIAS (no_psnp_interval_l1,
1290 no_psnp_interval_l1_arg_cmd,
1291 "no isis psnp-interval <1-120> level-1",
1292 NO_STR
1293 "IS-IS commands\n"
1294 "Set PSNP interval in seconds\n"
1295 "PSNP interval value\n"
1296 "Specify interval for level-1 PSNPs\n")
1297
1298 DEFUN (psnp_interval_l2,
1299 psnp_interval_l2_cmd,
1300 "isis psnp-interval <1-120> level-2",
1301 "IS-IS commands\n"
1302 "Set PSNP interval in seconds\n"
1303 "PSNP interval value\n"
1304 "Specify interval for level-2 PSNPs\n")
1305 {
1306 unsigned long interval;
1307 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1308 if (!circuit)
1309 return CMD_ERR_NO_MATCH;
1310
1311 interval = atol (argv[0]);
1312 if (interval < MIN_PSNP_INTERVAL || interval > MAX_PSNP_INTERVAL)
1313 {
1314 vty_out (vty, "Invalid psnp-interval %lu - should be <1-120>%s",
1315 interval, VTY_NEWLINE);
1316 return CMD_ERR_AMBIGUOUS;
1317 }
1318
1319 circuit->psnp_interval[1] = (u_int16_t) interval;
1320
1321 return CMD_SUCCESS;
1322 }
1323
1324 DEFUN (no_psnp_interval_l2,
1325 no_psnp_interval_l2_cmd,
1326 "no isis psnp-interval level-2",
1327 NO_STR
1328 "IS-IS commands\n"
1329 "Set PSNP interval in seconds\n"
1330 "Specify interval for level-2 PSNPs\n")
1331 {
1332 struct isis_circuit *circuit = isis_circuit_lookup (vty);
1333 if (!circuit)
1334 return CMD_ERR_NO_MATCH;
1335
1336 circuit->psnp_interval[1] = DEFAULT_PSNP_INTERVAL;
1337
1338 return CMD_SUCCESS;
1339 }
1340
1341 ALIAS (no_psnp_interval_l2,
1342 no_psnp_interval_l2_arg_cmd,
1343 "no isis psnp-interval <1-120> level-2",
1344 NO_STR
1345 "IS-IS commands\n"
1346 "Set PSNP interval in seconds\n"
1347 "PSNP interval value\n"
1348 "Specify interval for level-2 PSNPs\n")
1349
1350 static int
1351 validate_metric_style_narrow (struct vty *vty, struct isis_area *area)
1352 {
1353 struct isis_circuit *circuit;
1354 struct listnode *node;
1355
1356 if (! vty)
1357 return CMD_ERR_AMBIGUOUS;
1358
1359 if (! area)
1360 {
1361 vty_out (vty, "ISIS area is invalid%s", VTY_NEWLINE);
1362 return CMD_ERR_AMBIGUOUS;
1363 }
1364
1365 for (ALL_LIST_ELEMENTS_RO (area->circuit_list, node, circuit))
1366 {
1367 if ((area->is_type & IS_LEVEL_1) &&
1368 (circuit->is_type & IS_LEVEL_1) &&
1369 (circuit->te_metric[0] > MAX_NARROW_LINK_METRIC))
1370 {
1371 vty_out (vty, "ISIS circuit %s metric is invalid%s",
1372 circuit->interface->name, VTY_NEWLINE);
1373 return CMD_ERR_AMBIGUOUS;
1374 }
1375 if ((area->is_type & IS_LEVEL_2) &&
1376 (circuit->is_type & IS_LEVEL_2) &&
1377 (circuit->te_metric[1] > MAX_NARROW_LINK_METRIC))
1378 {
1379 vty_out (vty, "ISIS circuit %s metric is invalid%s",
1380 circuit->interface->name, VTY_NEWLINE);
1381 return CMD_ERR_AMBIGUOUS;
1382 }
1383 }
1384
1385 return CMD_SUCCESS;
1386 }
1387
1388 DEFUN (metric_style,
1389 metric_style_cmd,
1390 "metric-style (narrow|transition|wide)",
1391 "Use old-style (ISO 10589) or new-style packet formats\n"
1392 "Use old style of TLVs with narrow metric\n"
1393 "Send and accept both styles of TLVs during transition\n"
1394 "Use new style of TLVs to carry wider metric\n")
1395 {
1396 VTY_DECLVAR_CONTEXT (isis_area, area);
1397 int ret;
1398
1399 if (strncmp (argv[0], "w", 1) == 0)
1400 {
1401 isis_area_metricstyle_set(area, false, true);
1402 return CMD_SUCCESS;
1403 }
1404
1405 ret = validate_metric_style_narrow (vty, area);
1406 if (ret != CMD_SUCCESS)
1407 return ret;
1408
1409 if (strncmp (argv[0], "t", 1) == 0)
1410 isis_area_metricstyle_set(area, true, true);
1411 else if (strncmp (argv[0], "n", 1) == 0)
1412 isis_area_metricstyle_set(area, true, false);
1413 return CMD_SUCCESS;
1414
1415 return CMD_SUCCESS;
1416 }
1417
1418 DEFUN (no_metric_style,
1419 no_metric_style_cmd,
1420 "no metric-style",
1421 NO_STR
1422 "Use old-style (ISO 10589) or new-style packet formats\n")
1423 {
1424 VTY_DECLVAR_CONTEXT (isis_area, area);
1425 int ret;
1426
1427 ret = validate_metric_style_narrow (vty, area);
1428 if (ret != CMD_SUCCESS)
1429 return ret;
1430
1431 isis_area_metricstyle_set(area, true, false);
1432 return CMD_SUCCESS;
1433 }
1434
1435 DEFUN (set_overload_bit,
1436 set_overload_bit_cmd,
1437 "set-overload-bit",
1438 "Set overload bit to avoid any transit traffic\n"
1439 "Set overload bit\n")
1440 {
1441 VTY_DECLVAR_CONTEXT (isis_area, area);
1442
1443 isis_area_overload_bit_set(area, true);
1444 return CMD_SUCCESS;
1445 }
1446
1447 DEFUN (no_set_overload_bit,
1448 no_set_overload_bit_cmd,
1449 "no set-overload-bit",
1450 "Reset overload bit to accept transit traffic\n"
1451 "Reset overload bit\n")
1452 {
1453 VTY_DECLVAR_CONTEXT (isis_area, area);
1454
1455 isis_area_overload_bit_set(area, false);
1456 return CMD_SUCCESS;
1457 }
1458
1459 DEFUN (set_attached_bit,
1460 set_attached_bit_cmd,
1461 "set-attached-bit",
1462 "Set attached bit to identify as L1/L2 router for inter-area traffic\n"
1463 "Set attached bit\n")
1464 {
1465 VTY_DECLVAR_CONTEXT (isis_area, area);
1466
1467 isis_area_attached_bit_set(area, true);
1468 return CMD_SUCCESS;
1469 }
1470
1471 DEFUN (no_set_attached_bit,
1472 no_set_attached_bit_cmd,
1473 "no set-attached-bit",
1474 "Reset attached bit\n")
1475 {
1476 VTY_DECLVAR_CONTEXT (isis_area, area);
1477
1478 isis_area_attached_bit_set(area, false);
1479 return CMD_SUCCESS;
1480 }
1481
1482 DEFUN (dynamic_hostname,
1483 dynamic_hostname_cmd,
1484 "hostname dynamic",
1485 "Dynamic hostname for IS-IS\n"
1486 "Dynamic hostname\n")
1487 {
1488 VTY_DECLVAR_CONTEXT (isis_area, area);
1489
1490 isis_area_dynhostname_set(area, true);
1491 return CMD_SUCCESS;
1492 }
1493
1494 DEFUN (no_dynamic_hostname,
1495 no_dynamic_hostname_cmd,
1496 "no hostname dynamic",
1497 NO_STR
1498 "Dynamic hostname for IS-IS\n"
1499 "Dynamic hostname\n")
1500 {
1501 VTY_DECLVAR_CONTEXT (isis_area, area);
1502
1503 isis_area_dynhostname_set(area, false);
1504 return CMD_SUCCESS;
1505 }
1506
1507 static int area_lsp_mtu_set(struct vty *vty, unsigned int lsp_mtu)
1508 {
1509 VTY_DECLVAR_CONTEXT (isis_area, area);
1510 struct listnode *node;
1511 struct isis_circuit *circuit;
1512
1513 for (ALL_LIST_ELEMENTS_RO(area->circuit_list, node, circuit))
1514 {
1515 if(circuit->state != C_STATE_INIT && circuit->state != C_STATE_UP)
1516 continue;
1517 if(lsp_mtu > isis_circuit_pdu_size(circuit))
1518 {
1519 vty_out(vty, "ISIS area contains circuit %s, which has a maximum PDU size of %zu.%s",
1520 circuit->interface->name, isis_circuit_pdu_size(circuit),
1521 VTY_NEWLINE);
1522 return CMD_ERR_AMBIGUOUS;
1523 }
1524 }
1525
1526 isis_area_lsp_mtu_set(area, lsp_mtu);
1527 return CMD_SUCCESS;
1528 }
1529
1530 DEFUN (area_lsp_mtu,
1531 area_lsp_mtu_cmd,
1532 "lsp-mtu <128-4352>",
1533 "Configure the maximum size of generated LSPs\n"
1534 "Maximum size of generated LSPs\n")
1535 {
1536 unsigned int lsp_mtu;
1537
1538 VTY_GET_INTEGER_RANGE("lsp-mtu", lsp_mtu, argv[0], 128, 4352);
1539
1540 return area_lsp_mtu_set(vty, lsp_mtu);
1541 }
1542
1543 DEFUN (no_area_lsp_mtu,
1544 no_area_lsp_mtu_cmd,
1545 "no lsp-mtu",
1546 NO_STR
1547 "Configure the maximum size of generated LSPs\n")
1548 {
1549 return area_lsp_mtu_set(vty, DEFAULT_LSP_MTU);
1550 }
1551
1552 ALIAS (no_area_lsp_mtu,
1553 no_area_lsp_mtu_arg_cmd,
1554 "no lsp-mtu <128-4352>",
1555 NO_STR
1556 "Configure the maximum size of generated LSPs\n"
1557 "Maximum size of generated LSPs\n");
1558
1559 DEFUN (is_type,
1560 is_type_cmd,
1561 "is-type (level-1|level-1-2|level-2-only)",
1562 "IS Level for this routing process (OSI only)\n"
1563 "Act as a station router only\n"
1564 "Act as both a station router and an area router\n"
1565 "Act as an area router only\n")
1566 {
1567 VTY_DECLVAR_CONTEXT (isis_area, area);
1568 int type;
1569
1570 type = string2circuit_t (argv[0]);
1571 if (!type)
1572 {
1573 vty_out (vty, "Unknown IS level %s", VTY_NEWLINE);
1574 return CMD_SUCCESS;
1575 }
1576
1577 isis_area_is_type_set(area, type);
1578
1579 return CMD_SUCCESS;
1580 }
1581
1582 DEFUN (no_is_type,
1583 no_is_type_cmd,
1584 "no is-type (level-1|level-1-2|level-2-only)",
1585 NO_STR
1586 "IS Level for this routing process (OSI only)\n"
1587 "Act as a station router only\n"
1588 "Act as both a station router and an area router\n"
1589 "Act as an area router only\n")
1590 {
1591 VTY_DECLVAR_CONTEXT (isis_area, area);
1592 int type;
1593
1594 /*
1595 * Put the is-type back to defaults:
1596 * - level-1-2 on first area
1597 * - level-1 for the rest
1598 */
1599 if (listgetdata (listhead (isis->area_list)) == area)
1600 type = IS_LEVEL_1_AND_2;
1601 else
1602 type = IS_LEVEL_1;
1603
1604 isis_area_is_type_set(area, type);
1605
1606 return CMD_SUCCESS;
1607 }
1608
1609 static int
1610 set_lsp_gen_interval (struct vty *vty, struct isis_area *area,
1611 uint16_t interval, int level)
1612 {
1613 int lvl;
1614
1615 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1616 {
1617 if (!(lvl & level))
1618 continue;
1619
1620 if (interval >= area->lsp_refresh[lvl-1])
1621 {
1622 vty_out (vty, "LSP gen interval %us must be less than "
1623 "the LSP refresh interval %us%s",
1624 interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
1625 return CMD_ERR_AMBIGUOUS;
1626 }
1627 }
1628
1629 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1630 {
1631 if (!(lvl & level))
1632 continue;
1633 area->lsp_gen_interval[lvl-1] = interval;
1634 }
1635
1636 return CMD_SUCCESS;
1637 }
1638
1639 DEFUN (lsp_gen_interval,
1640 lsp_gen_interval_cmd,
1641 "lsp-gen-interval <1-120>",
1642 "Minimum interval between regenerating same LSP\n"
1643 "Minimum interval in seconds\n")
1644 {
1645 VTY_DECLVAR_CONTEXT (isis_area, area);
1646 uint16_t interval;
1647 int level;
1648
1649 interval = atoi (argv[0]);
1650 level = IS_LEVEL_1 | IS_LEVEL_2;
1651 return set_lsp_gen_interval (vty, area, interval, level);
1652 }
1653
1654 DEFUN (no_lsp_gen_interval,
1655 no_lsp_gen_interval_cmd,
1656 "no lsp-gen-interval",
1657 NO_STR
1658 "Minimum interval between regenerating same LSP\n")
1659 {
1660 VTY_DECLVAR_CONTEXT (isis_area, area);
1661 uint16_t interval;
1662 int level;
1663
1664 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1665 level = IS_LEVEL_1 | IS_LEVEL_2;
1666 return set_lsp_gen_interval (vty, area, interval, level);
1667 }
1668
1669 ALIAS (no_lsp_gen_interval,
1670 no_lsp_gen_interval_arg_cmd,
1671 "no lsp-gen-interval <1-120>",
1672 NO_STR
1673 "Minimum interval between regenerating same LSP\n"
1674 "Minimum interval in seconds\n")
1675
1676 DEFUN (lsp_gen_interval_l1,
1677 lsp_gen_interval_l1_cmd,
1678 "lsp-gen-interval level-1 <1-120>",
1679 "Minimum interval between regenerating same LSP\n"
1680 "Set interval for level 1 only\n"
1681 "Minimum interval in seconds\n")
1682 {
1683 VTY_DECLVAR_CONTEXT (isis_area, area);
1684 uint16_t interval;
1685 int level;
1686
1687 interval = atoi (argv[0]);
1688 level = IS_LEVEL_1;
1689 return set_lsp_gen_interval (vty, area, interval, level);
1690 }
1691
1692 DEFUN (no_lsp_gen_interval_l1,
1693 no_lsp_gen_interval_l1_cmd,
1694 "no lsp-gen-interval level-1",
1695 NO_STR
1696 "Minimum interval between regenerating same LSP\n"
1697 "Set interval for level 1 only\n")
1698 {
1699 VTY_DECLVAR_CONTEXT (isis_area, area);
1700 uint16_t interval;
1701 int level;
1702
1703 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1704 level = IS_LEVEL_1;
1705 return set_lsp_gen_interval (vty, area, interval, level);
1706 }
1707
1708 ALIAS (no_lsp_gen_interval_l1,
1709 no_lsp_gen_interval_l1_arg_cmd,
1710 "no lsp-gen-interval level-1 <1-120>",
1711 NO_STR
1712 "Minimum interval between regenerating same LSP\n"
1713 "Set interval for level 1 only\n"
1714 "Minimum interval in seconds\n")
1715
1716 DEFUN (lsp_gen_interval_l2,
1717 lsp_gen_interval_l2_cmd,
1718 "lsp-gen-interval level-2 <1-120>",
1719 "Minimum interval between regenerating same LSP\n"
1720 "Set interval for level 2 only\n"
1721 "Minimum interval in seconds\n")
1722 {
1723 VTY_DECLVAR_CONTEXT (isis_area, area);
1724 uint16_t interval;
1725 int level;
1726
1727 interval = atoi (argv[0]);
1728 level = IS_LEVEL_2;
1729 return set_lsp_gen_interval (vty, area, interval, level);
1730 }
1731
1732 DEFUN (no_lsp_gen_interval_l2,
1733 no_lsp_gen_interval_l2_cmd,
1734 "no lsp-gen-interval level-2",
1735 NO_STR
1736 "Minimum interval between regenerating same LSP\n"
1737 "Set interval for level 2 only\n")
1738 {
1739 VTY_DECLVAR_CONTEXT (isis_area, area);
1740 uint16_t interval;
1741 int level;
1742
1743 interval = DEFAULT_MIN_LSP_GEN_INTERVAL;
1744 level = IS_LEVEL_2;
1745 return set_lsp_gen_interval (vty, area, interval, level);
1746 }
1747
1748 ALIAS (no_lsp_gen_interval_l2,
1749 no_lsp_gen_interval_l2_arg_cmd,
1750 "no lsp-gen-interval level-2 <1-120>",
1751 NO_STR
1752 "Minimum interval between regenerating same LSP\n"
1753 "Set interval for level 2 only\n"
1754 "Minimum interval in seconds\n")
1755
1756 DEFUN (spf_interval,
1757 spf_interval_cmd,
1758 "spf-interval <1-120>",
1759 "Minimum interval between SPF calculations\n"
1760 "Minimum interval between consecutive SPFs in seconds\n")
1761 {
1762 VTY_DECLVAR_CONTEXT (isis_area, area);
1763 u_int16_t interval;
1764
1765 interval = atoi (argv[0]);
1766 area->min_spf_interval[0] = interval;
1767 area->min_spf_interval[1] = interval;
1768
1769 return CMD_SUCCESS;
1770 }
1771
1772 DEFUN (no_spf_interval,
1773 no_spf_interval_cmd,
1774 "no spf-interval",
1775 NO_STR
1776 "Minimum interval between SPF calculations\n")
1777 {
1778 VTY_DECLVAR_CONTEXT (isis_area, area);
1779
1780 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1781 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
1782
1783 return CMD_SUCCESS;
1784 }
1785
1786 ALIAS (no_spf_interval,
1787 no_spf_interval_arg_cmd,
1788 "no spf-interval <1-120>",
1789 NO_STR
1790 "Minimum interval between SPF calculations\n"
1791 "Minimum interval between consecutive SPFs in seconds\n")
1792
1793 DEFUN (spf_interval_l1,
1794 spf_interval_l1_cmd,
1795 "spf-interval level-1 <1-120>",
1796 "Minimum interval between SPF calculations\n"
1797 "Set interval for level 1 only\n"
1798 "Minimum interval between consecutive SPFs in seconds\n")
1799 {
1800 VTY_DECLVAR_CONTEXT (isis_area, area);
1801 u_int16_t interval;
1802
1803 interval = atoi (argv[0]);
1804 area->min_spf_interval[0] = interval;
1805
1806 return CMD_SUCCESS;
1807 }
1808
1809 DEFUN (no_spf_interval_l1,
1810 no_spf_interval_l1_cmd,
1811 "no spf-interval level-1",
1812 NO_STR
1813 "Minimum interval between SPF calculations\n"
1814 "Set interval for level 1 only\n")
1815 {
1816 VTY_DECLVAR_CONTEXT (isis_area, area);
1817
1818 area->min_spf_interval[0] = MINIMUM_SPF_INTERVAL;
1819
1820 return CMD_SUCCESS;
1821 }
1822
1823 ALIAS (no_spf_interval,
1824 no_spf_interval_l1_arg_cmd,
1825 "no spf-interval level-1 <1-120>",
1826 NO_STR
1827 "Minimum interval between SPF calculations\n"
1828 "Set interval for level 1 only\n"
1829 "Minimum interval between consecutive SPFs in seconds\n")
1830
1831 DEFUN (spf_interval_l2,
1832 spf_interval_l2_cmd,
1833 "spf-interval level-2 <1-120>",
1834 "Minimum interval between SPF calculations\n"
1835 "Set interval for level 2 only\n"
1836 "Minimum interval between consecutive SPFs in seconds\n")
1837 {
1838 VTY_DECLVAR_CONTEXT (isis_area, area);
1839 u_int16_t interval;
1840
1841 interval = atoi (argv[0]);
1842 area->min_spf_interval[1] = interval;
1843
1844 return CMD_SUCCESS;
1845 }
1846
1847 DEFUN (no_spf_interval_l2,
1848 no_spf_interval_l2_cmd,
1849 "no spf-interval level-2",
1850 NO_STR
1851 "Minimum interval between SPF calculations\n"
1852 "Set interval for level 2 only\n")
1853 {
1854 VTY_DECLVAR_CONTEXT (isis_area, area);
1855
1856 area->min_spf_interval[1] = MINIMUM_SPF_INTERVAL;
1857
1858 return CMD_SUCCESS;
1859 }
1860
1861 ALIAS (no_spf_interval,
1862 no_spf_interval_l2_arg_cmd,
1863 "no spf-interval level-2 <1-120>",
1864 NO_STR
1865 "Minimum interval between SPF calculations\n"
1866 "Set interval for level 2 only\n"
1867 "Minimum interval between consecutive SPFs in seconds\n")
1868
1869 static int
1870 area_max_lsp_lifetime_set(struct vty *vty, int level,
1871 uint16_t interval)
1872 {
1873 VTY_DECLVAR_CONTEXT (isis_area, area);
1874 int lvl;
1875 uint16_t refresh_interval = interval - 300;
1876 int set_refresh_interval[ISIS_LEVELS] = {0, 0};
1877
1878 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
1879 {
1880 if (!(lvl & level))
1881 continue;
1882
1883 if (refresh_interval < area->lsp_refresh[lvl-1])
1884 {
1885 vty_out (vty, "Level %d Max LSP lifetime %us must be 300s greater than "
1886 "the configured LSP refresh interval %us%s",
1887 lvl, interval, area->lsp_refresh[lvl-1], VTY_NEWLINE);
1888 vty_out (vty, "Automatically reducing level %d LSP refresh interval "
1889 "to %us%s", lvl, refresh_interval, VTY_NEWLINE);
1890 set_refresh_interval[lvl-1] = 1;
1891
1892 if (refresh_interval <= area->lsp_gen_interval[lvl-1])
1893 {
1894 vty_out (vty, "LSP refresh interval %us must be greater than "
1895 "the configured LSP gen interval %us%s",
1896 refresh_interval, area->lsp_gen_interval[lvl-1],
1897 VTY_NEWLINE);
1898 return CMD_ERR_AMBIGUOUS;
1899 }
1900 }
1901 }
1902
1903 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; lvl++)
1904 {
1905 if (!(lvl & level))
1906 continue;
1907 isis_area_max_lsp_lifetime_set(area, lvl, interval);
1908 if (set_refresh_interval[lvl-1])
1909 isis_area_lsp_refresh_set(area, lvl, refresh_interval);
1910 }
1911
1912 return CMD_SUCCESS;
1913 }
1914
1915 DEFUN (max_lsp_lifetime,
1916 max_lsp_lifetime_cmd,
1917 "max-lsp-lifetime <350-65535>",
1918 "Maximum LSP lifetime\n"
1919 "LSP lifetime in seconds\n")
1920 {
1921 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]));
1922 }
1923
1924 DEFUN (no_max_lsp_lifetime,
1925 no_max_lsp_lifetime_cmd,
1926 "no max-lsp-lifetime",
1927 NO_STR
1928 "LSP lifetime in seconds\n")
1929 {
1930 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1_AND_2,
1931 DEFAULT_LSP_LIFETIME);
1932 }
1933
1934 ALIAS (no_max_lsp_lifetime,
1935 no_max_lsp_lifetime_arg_cmd,
1936 "no max-lsp-lifetime <350-65535>",
1937 NO_STR
1938 "Maximum LSP lifetime\n"
1939 "LSP lifetime in seconds\n")
1940
1941 DEFUN (max_lsp_lifetime_l1,
1942 max_lsp_lifetime_l1_cmd,
1943 "max-lsp-lifetime level-1 <350-65535>",
1944 "Maximum LSP lifetime for Level 1 only\n"
1945 "LSP lifetime for Level 1 only in seconds\n")
1946 {
1947 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, atoi(argv[0]));
1948 }
1949
1950 DEFUN (no_max_lsp_lifetime_l1,
1951 no_max_lsp_lifetime_l1_cmd,
1952 "no max-lsp-lifetime level-1",
1953 NO_STR
1954 "LSP lifetime for Level 1 only in seconds\n")
1955 {
1956 return area_max_lsp_lifetime_set(vty, IS_LEVEL_1, DEFAULT_LSP_LIFETIME);
1957 }
1958
1959 ALIAS (no_max_lsp_lifetime_l1,
1960 no_max_lsp_lifetime_l1_arg_cmd,
1961 "no max-lsp-lifetime level-1 <350-65535>",
1962 NO_STR
1963 "Maximum LSP lifetime for Level 1 only\n"
1964 "LSP lifetime for Level 1 only in seconds\n")
1965
1966 DEFUN (max_lsp_lifetime_l2,
1967 max_lsp_lifetime_l2_cmd,
1968 "max-lsp-lifetime level-2 <350-65535>",
1969 "Maximum LSP lifetime for Level 2 only\n"
1970 "LSP lifetime for Level 2 only in seconds\n")
1971 {
1972 return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, atoi(argv[0]));
1973 }
1974
1975 DEFUN (no_max_lsp_lifetime_l2,
1976 no_max_lsp_lifetime_l2_cmd,
1977 "no max-lsp-lifetime level-2",
1978 NO_STR
1979 "LSP lifetime for Level 2 only in seconds\n")
1980 {
1981 return area_max_lsp_lifetime_set(vty, IS_LEVEL_2, DEFAULT_LSP_LIFETIME);
1982 }
1983
1984 ALIAS (no_max_lsp_lifetime_l2,
1985 no_max_lsp_lifetime_l2_arg_cmd,
1986 "no max-lsp-lifetime level-2 <350-65535>",
1987 NO_STR
1988 "Maximum LSP lifetime for Level 2 only\n"
1989 "LSP lifetime for Level 2 only in seconds\n")
1990
1991 static int
1992 area_lsp_refresh_interval_set(struct vty *vty, int level, uint16_t interval)
1993 {
1994 VTY_DECLVAR_CONTEXT (isis_area, area);
1995 int lvl;
1996
1997 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
1998 {
1999 if (!(lvl & level))
2000 continue;
2001 if (interval <= area->lsp_gen_interval[lvl-1])
2002 {
2003 vty_out (vty, "LSP refresh interval %us must be greater than "
2004 "the configured LSP gen interval %us%s",
2005 interval, area->lsp_gen_interval[lvl-1],
2006 VTY_NEWLINE);
2007 return CMD_ERR_AMBIGUOUS;
2008 }
2009 if (interval > (area->max_lsp_lifetime[lvl-1] - 300))
2010 {
2011 vty_out (vty, "LSP refresh interval %us must be less than "
2012 "the configured LSP lifetime %us less 300%s",
2013 interval, area->max_lsp_lifetime[lvl-1],
2014 VTY_NEWLINE);
2015 return CMD_ERR_AMBIGUOUS;
2016 }
2017 }
2018
2019 for (lvl = IS_LEVEL_1; lvl <= IS_LEVEL_2; ++lvl)
2020 {
2021 if (!(lvl & level))
2022 continue;
2023 isis_area_lsp_refresh_set(area, lvl, interval);
2024 }
2025
2026 return CMD_SUCCESS;
2027 }
2028
2029 DEFUN (lsp_refresh_interval,
2030 lsp_refresh_interval_cmd,
2031 "lsp-refresh-interval <1-65235>",
2032 "LSP refresh interval\n"
2033 "LSP refresh interval in seconds\n")
2034 {
2035 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2, atoi(argv[0]));
2036 }
2037
2038 DEFUN (no_lsp_refresh_interval,
2039 no_lsp_refresh_interval_cmd,
2040 "no lsp-refresh-interval",
2041 NO_STR
2042 "LSP refresh interval in seconds\n")
2043 {
2044 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1_AND_2,
2045 DEFAULT_MAX_LSP_GEN_INTERVAL);
2046 }
2047
2048 ALIAS (no_lsp_refresh_interval,
2049 no_lsp_refresh_interval_arg_cmd,
2050 "no lsp-refresh-interval <1-65235>",
2051 NO_STR
2052 "LSP refresh interval\n"
2053 "LSP refresh interval in seconds\n")
2054
2055 DEFUN (lsp_refresh_interval_l1,
2056 lsp_refresh_interval_l1_cmd,
2057 "lsp-refresh-interval level-1 <1-65235>",
2058 "LSP refresh interval for Level 1 only\n"
2059 "LSP refresh interval for Level 1 only in seconds\n")
2060 {
2061 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1, atoi(argv[0]));
2062 }
2063
2064 DEFUN (no_lsp_refresh_interval_l1,
2065 no_lsp_refresh_interval_l1_cmd,
2066 "no lsp-refresh-interval level-1",
2067 NO_STR
2068 "LSP refresh interval for Level 1 only in seconds\n")
2069 {
2070 return area_lsp_refresh_interval_set(vty, IS_LEVEL_1,
2071 DEFAULT_MAX_LSP_GEN_INTERVAL);
2072 }
2073
2074 ALIAS (no_lsp_refresh_interval_l1,
2075 no_lsp_refresh_interval_l1_arg_cmd,
2076 "no lsp-refresh-interval level-1 <1-65235>",
2077 NO_STR
2078 "LSP refresh interval for Level 1 only\n"
2079 "LSP refresh interval for Level 1 only in seconds\n")
2080
2081 DEFUN (lsp_refresh_interval_l2,
2082 lsp_refresh_interval_l2_cmd,
2083 "lsp-refresh-interval level-2 <1-65235>",
2084 "LSP refresh interval for Level 2 only\n"
2085 "LSP refresh interval for Level 2 only in seconds\n")
2086 {
2087 return area_lsp_refresh_interval_set(vty, IS_LEVEL_2, atoi(argv[0]));
2088 }
2089
2090 DEFUN (no_lsp_refresh_interval_l2,
2091 no_lsp_refresh_interval_l2_cmd,
2092 "no lsp-refresh-interval level-2",
2093 NO_STR
2094 "LSP refresh interval for Level 2 only in seconds\n")
2095 {
2096 return area_lsp_refresh_interval_set(vty, IS_LEVEL_2,
2097 DEFAULT_MAX_LSP_GEN_INTERVAL);
2098 }
2099
2100 ALIAS (no_lsp_refresh_interval_l2,
2101 no_lsp_refresh_interval_l2_arg_cmd,
2102 "no lsp-refresh-interval level-2 <1-65235>",
2103 NO_STR
2104 "LSP refresh interval for Level 2 only\n"
2105 "LSP refresh interval for Level 2 only in seconds\n")
2106
2107 static int
2108 area_passwd_set(struct vty *vty, int level,
2109 int (*type_set)(struct isis_area *area, int level,
2110 const char *passwd, u_char snp_auth),
2111 const char *passwd, u_char snp_auth)
2112 {
2113 VTY_DECLVAR_CONTEXT (isis_area, area);
2114
2115 if (passwd && strlen(passwd) > 254)
2116 {
2117 vty_out (vty, "Too long area password (>254)%s", VTY_NEWLINE);
2118 return CMD_ERR_AMBIGUOUS;
2119 }
2120
2121 type_set(area, level, passwd, snp_auth);
2122 return CMD_SUCCESS;
2123 }
2124
2125 DEFUN (area_passwd_md5,
2126 area_passwd_md5_cmd,
2127 "(area-password|domain-password) md5 WORD",
2128 "Configure the authentication password for an area\n"
2129 "Set the authentication password for a routing domain\n"
2130 "Authentication type\n"
2131 "Level-wide password\n")
2132 {
2133 u_char snp_auth = 0;
2134 int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
2135
2136 if (argc > 2)
2137 {
2138 snp_auth = SNP_AUTH_SEND;
2139 if (strncmp(argv[2], "v", 1) == 0)
2140 snp_auth |= SNP_AUTH_RECV;
2141 }
2142
2143 return area_passwd_set(vty, level, isis_area_passwd_hmac_md5_set,
2144 argv[1], snp_auth);
2145 }
2146
2147 ALIAS (area_passwd_md5,
2148 area_passwd_md5_snpauth_cmd,
2149 "(area-password|domain-password) md5 WORD authenticate snp (send-only|validate)",
2150 "Configure the authentication password for an area\n"
2151 "Set the authentication password for a routing domain\n"
2152 "Authentication type\n"
2153 "Level-wide password\n"
2154 "Authentication\n"
2155 "SNP PDUs\n"
2156 "Send but do not check PDUs on receiving\n"
2157 "Send and check PDUs on receiving\n")
2158
2159 DEFUN (area_passwd_clear,
2160 area_passwd_clear_cmd,
2161 "(area-password|domain-password) clear WORD",
2162 "Configure the authentication password for an area\n"
2163 "Set the authentication password for a routing domain\n"
2164 "Authentication type\n"
2165 "Area password\n")
2166 {
2167 u_char snp_auth = 0;
2168 int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
2169
2170 if (argc > 2)
2171 {
2172 snp_auth = SNP_AUTH_SEND;
2173 if (strncmp(argv[2], "v", 1) == 0)
2174 snp_auth |= SNP_AUTH_RECV;
2175 }
2176
2177 return area_passwd_set(vty, level, isis_area_passwd_cleartext_set,
2178 argv[1], snp_auth);
2179 }
2180
2181 ALIAS (area_passwd_clear,
2182 area_passwd_clear_snpauth_cmd,
2183 "(area-password|domain-password) clear WORD authenticate snp (send-only|validate)",
2184 "Configure the authentication password for an area\n"
2185 "Set the authentication password for a routing domain\n"
2186 "Authentication type\n"
2187 "Area password\n"
2188 "Authentication\n"
2189 "SNP PDUs\n"
2190 "Send but do not check PDUs on receiving\n"
2191 "Send and check PDUs on receiving\n")
2192
2193 DEFUN (no_area_passwd,
2194 no_area_passwd_cmd,
2195 "no (area-password|domain-password)",
2196 NO_STR
2197 "Configure the authentication password for an area\n"
2198 "Set the authentication password for a routing domain\n")
2199 {
2200 VTY_DECLVAR_CONTEXT (isis_area, area);
2201 int level = (argv[0][0] == 'd') ? IS_LEVEL_2 : IS_LEVEL_1;
2202
2203 return isis_area_passwd_unset (area, level);
2204 }
2205
2206 void
2207 isis_vty_init (void)
2208 {
2209 install_element (INTERFACE_NODE, &ip_router_isis_cmd);
2210 install_element (INTERFACE_NODE, &no_ip_router_isis_cmd);
2211
2212 install_element (INTERFACE_NODE, &isis_passive_cmd);
2213 install_element (INTERFACE_NODE, &no_isis_passive_cmd);
2214
2215 install_element (INTERFACE_NODE, &isis_circuit_type_cmd);
2216 install_element (INTERFACE_NODE, &no_isis_circuit_type_cmd);
2217
2218 install_element (INTERFACE_NODE, &isis_network_cmd);
2219 install_element (INTERFACE_NODE, &no_isis_network_cmd);
2220
2221 install_element (INTERFACE_NODE, &isis_passwd_cmd);
2222 install_element (INTERFACE_NODE, &no_isis_passwd_cmd);
2223 install_element (INTERFACE_NODE, &no_isis_passwd_arg_cmd);
2224
2225 install_element (INTERFACE_NODE, &isis_priority_cmd);
2226 install_element (INTERFACE_NODE, &no_isis_priority_cmd);
2227 install_element (INTERFACE_NODE, &no_isis_priority_arg_cmd);
2228 install_element (INTERFACE_NODE, &isis_priority_l1_cmd);
2229 install_element (INTERFACE_NODE, &no_isis_priority_l1_cmd);
2230 install_element (INTERFACE_NODE, &no_isis_priority_l1_arg_cmd);
2231 install_element (INTERFACE_NODE, &isis_priority_l2_cmd);
2232 install_element (INTERFACE_NODE, &no_isis_priority_l2_cmd);
2233 install_element (INTERFACE_NODE, &no_isis_priority_l2_arg_cmd);
2234
2235 install_element (INTERFACE_NODE, &isis_metric_cmd);
2236 install_element (INTERFACE_NODE, &no_isis_metric_cmd);
2237 install_element (INTERFACE_NODE, &no_isis_metric_arg_cmd);
2238 install_element (INTERFACE_NODE, &isis_metric_l1_cmd);
2239 install_element (INTERFACE_NODE, &no_isis_metric_l1_cmd);
2240 install_element (INTERFACE_NODE, &no_isis_metric_l1_arg_cmd);
2241 install_element (INTERFACE_NODE, &isis_metric_l2_cmd);
2242 install_element (INTERFACE_NODE, &no_isis_metric_l2_cmd);
2243 install_element (INTERFACE_NODE, &no_isis_metric_l2_arg_cmd);
2244
2245 install_element (INTERFACE_NODE, &isis_hello_interval_cmd);
2246 install_element (INTERFACE_NODE, &no_isis_hello_interval_cmd);
2247 install_element (INTERFACE_NODE, &no_isis_hello_interval_arg_cmd);
2248 install_element (INTERFACE_NODE, &isis_hello_interval_l1_cmd);
2249 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_cmd);
2250 install_element (INTERFACE_NODE, &no_isis_hello_interval_l1_arg_cmd);
2251 install_element (INTERFACE_NODE, &isis_hello_interval_l2_cmd);
2252 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_cmd);
2253 install_element (INTERFACE_NODE, &no_isis_hello_interval_l2_arg_cmd);
2254
2255 install_element (INTERFACE_NODE, &isis_hello_multiplier_cmd);
2256 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_cmd);
2257 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_arg_cmd);
2258 install_element (INTERFACE_NODE, &isis_hello_multiplier_l1_cmd);
2259 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_cmd);
2260 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l1_arg_cmd);
2261 install_element (INTERFACE_NODE, &isis_hello_multiplier_l2_cmd);
2262 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_cmd);
2263 install_element (INTERFACE_NODE, &no_isis_hello_multiplier_l2_arg_cmd);
2264
2265 install_element (INTERFACE_NODE, &isis_hello_padding_cmd);
2266 install_element (INTERFACE_NODE, &no_isis_hello_padding_cmd);
2267
2268 install_element (INTERFACE_NODE, &csnp_interval_cmd);
2269 install_element (INTERFACE_NODE, &no_csnp_interval_cmd);
2270 install_element (INTERFACE_NODE, &no_csnp_interval_arg_cmd);
2271 install_element (INTERFACE_NODE, &csnp_interval_l1_cmd);
2272 install_element (INTERFACE_NODE, &no_csnp_interval_l1_cmd);
2273 install_element (INTERFACE_NODE, &no_csnp_interval_l1_arg_cmd);
2274 install_element (INTERFACE_NODE, &csnp_interval_l2_cmd);
2275 install_element (INTERFACE_NODE, &no_csnp_interval_l2_cmd);
2276 install_element (INTERFACE_NODE, &no_csnp_interval_l2_arg_cmd);
2277
2278 install_element (INTERFACE_NODE, &psnp_interval_cmd);
2279 install_element (INTERFACE_NODE, &no_psnp_interval_cmd);
2280 install_element (INTERFACE_NODE, &no_psnp_interval_arg_cmd);
2281 install_element (INTERFACE_NODE, &psnp_interval_l1_cmd);
2282 install_element (INTERFACE_NODE, &no_psnp_interval_l1_cmd);
2283 install_element (INTERFACE_NODE, &no_psnp_interval_l1_arg_cmd);
2284 install_element (INTERFACE_NODE, &psnp_interval_l2_cmd);
2285 install_element (INTERFACE_NODE, &no_psnp_interval_l2_cmd);
2286 install_element (INTERFACE_NODE, &no_psnp_interval_l2_arg_cmd);
2287
2288 install_element (ISIS_NODE, &metric_style_cmd);
2289 install_element (ISIS_NODE, &no_metric_style_cmd);
2290
2291 install_element (ISIS_NODE, &set_overload_bit_cmd);
2292 install_element (ISIS_NODE, &no_set_overload_bit_cmd);
2293
2294 install_element (ISIS_NODE, &set_attached_bit_cmd);
2295 install_element (ISIS_NODE, &no_set_attached_bit_cmd);
2296
2297 install_element (ISIS_NODE, &dynamic_hostname_cmd);
2298 install_element (ISIS_NODE, &no_dynamic_hostname_cmd);
2299
2300 install_element (ISIS_NODE, &area_lsp_mtu_cmd);
2301 install_element (ISIS_NODE, &no_area_lsp_mtu_cmd);
2302 install_element (ISIS_NODE, &no_area_lsp_mtu_arg_cmd);
2303
2304 install_element (ISIS_NODE, &is_type_cmd);
2305 install_element (ISIS_NODE, &no_is_type_cmd);
2306
2307 install_element (ISIS_NODE, &lsp_gen_interval_cmd);
2308 install_element (ISIS_NODE, &no_lsp_gen_interval_cmd);
2309 install_element (ISIS_NODE, &no_lsp_gen_interval_arg_cmd);
2310 install_element (ISIS_NODE, &lsp_gen_interval_l1_cmd);
2311 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_cmd);
2312 install_element (ISIS_NODE, &no_lsp_gen_interval_l1_arg_cmd);
2313 install_element (ISIS_NODE, &lsp_gen_interval_l2_cmd);
2314 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_cmd);
2315 install_element (ISIS_NODE, &no_lsp_gen_interval_l2_arg_cmd);
2316
2317 install_element (ISIS_NODE, &spf_interval_cmd);
2318 install_element (ISIS_NODE, &no_spf_interval_cmd);
2319 install_element (ISIS_NODE, &no_spf_interval_arg_cmd);
2320 install_element (ISIS_NODE, &spf_interval_l1_cmd);
2321 install_element (ISIS_NODE, &no_spf_interval_l1_cmd);
2322 install_element (ISIS_NODE, &no_spf_interval_l1_arg_cmd);
2323 install_element (ISIS_NODE, &spf_interval_l2_cmd);
2324 install_element (ISIS_NODE, &no_spf_interval_l2_cmd);
2325 install_element (ISIS_NODE, &no_spf_interval_l2_arg_cmd);
2326
2327 install_element (ISIS_NODE, &max_lsp_lifetime_cmd);
2328 install_element (ISIS_NODE, &no_max_lsp_lifetime_cmd);
2329 install_element (ISIS_NODE, &no_max_lsp_lifetime_arg_cmd);
2330 install_element (ISIS_NODE, &max_lsp_lifetime_l1_cmd);
2331 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_cmd);
2332 install_element (ISIS_NODE, &no_max_lsp_lifetime_l1_arg_cmd);
2333 install_element (ISIS_NODE, &max_lsp_lifetime_l2_cmd);
2334 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_cmd);
2335 install_element (ISIS_NODE, &no_max_lsp_lifetime_l2_arg_cmd);
2336
2337 install_element (ISIS_NODE, &lsp_refresh_interval_cmd);
2338 install_element (ISIS_NODE, &no_lsp_refresh_interval_cmd);
2339 install_element (ISIS_NODE, &no_lsp_refresh_interval_arg_cmd);
2340 install_element (ISIS_NODE, &lsp_refresh_interval_l1_cmd);
2341 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_cmd);
2342 install_element (ISIS_NODE, &no_lsp_refresh_interval_l1_arg_cmd);
2343 install_element (ISIS_NODE, &lsp_refresh_interval_l2_cmd);
2344 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_cmd);
2345 install_element (ISIS_NODE, &no_lsp_refresh_interval_l2_arg_cmd);
2346
2347 install_element (ISIS_NODE, &area_passwd_md5_cmd);
2348 install_element (ISIS_NODE, &area_passwd_md5_snpauth_cmd);
2349 install_element (ISIS_NODE, &area_passwd_clear_cmd);
2350 install_element (ISIS_NODE, &area_passwd_clear_snpauth_cmd);
2351 install_element (ISIS_NODE, &no_area_passwd_cmd);
2352 }