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