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