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