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