1 /* Zebra MPLS VTY functions
2 * Copyright (C) 2002 Kunihiro Ishiguro
4 * This file is part of GNU Zebra.
6 * GNU Zebra is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License as published by the
8 * Free Software Foundation; either version 2, or (at your option) any
11 * GNU Zebra is distributed in the hope that it will be useful, but
12 * WITHOUT ANY WARRANTY; without even the implied warranty of
13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 * General Public License for more details.
16 * You should have received a copy of the GNU General Public License
17 * along with GNU Zebra; see the file COPYING. If not, write to the
18 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
19 * Boston, MA 02111-1307, USA.
35 #include "zebra/zserv.h"
36 #include "zebra/zebra_vrf.h"
37 #include "zebra/zebra_mpls.h"
38 #include "zebra/zebra_rnh.h"
39 #include "zebra/redistribute.h"
40 #include "zebra/zebra_routemap.h"
41 #include "zebra/zebra_static.h"
43 static int zebra_mpls_transit_lsp(struct vty
*vty
, int add_cmd
,
44 const char *inlabel_str
, const char *gate_str
,
45 const char *outlabel_str
,
48 struct zebra_vrf
*zvrf
;
50 enum nexthop_types_t gtype
;
53 mpls_label_t in_label
, out_label
;
57 "%% MPLS not turned on in kernel, ignoring command%s",
62 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
64 vty_out(vty
, "%% Default VRF does not exist%s", VTY_NEWLINE
);
69 vty_out(vty
, "%% No Label Information%s", VTY_NEWLINE
);
73 out_label
= MPLS_IMP_NULL_LABEL
; /* as initialization */
74 label
= atoi(inlabel_str
);
75 if (!IS_MPLS_UNRESERVED_LABEL(label
)) {
76 vty_out(vty
, "%% Invalid label%s", VTY_NEWLINE
);
82 vty_out(vty
, "%% No Nexthop Information%s",
87 vty_out(vty
, "%% No Outgoing label Information%s",
94 gtype
= NEXTHOP_TYPE_BLACKHOLE
; /* as initialization */
97 /* Gateway is a IPv4 or IPv6 nexthop. */
98 ret
= inet_pton(AF_INET6
, gate_str
, &gate
.ipv6
);
100 gtype
= NEXTHOP_TYPE_IPV6
;
102 ret
= inet_pton(AF_INET
, gate_str
, &gate
.ipv4
);
104 gtype
= NEXTHOP_TYPE_IPV4
;
106 vty_out(vty
, "%% Invalid nexthop%s",
114 if (outlabel_str
[0] == 'i')
115 out_label
= MPLS_IMP_NULL_LABEL
;
116 else if (outlabel_str
[0] == 'e' && gtype
== NEXTHOP_TYPE_IPV4
)
117 out_label
= MPLS_V4_EXP_NULL_LABEL
;
118 else if (outlabel_str
[0] == 'e' && gtype
== NEXTHOP_TYPE_IPV6
)
119 out_label
= MPLS_V6_EXP_NULL_LABEL
;
121 out_label
= atoi(outlabel_str
);
125 #if defined(HAVE_CUMULUS)
126 /* Check that label value is consistent. */
127 if (!zebra_mpls_lsp_label_consistent(zvrf
, in_label
, out_label
,
128 gtype
, &gate
, NULL
, 0)) {
129 vty_out(vty
, "%% Label value not consistent%s",
133 #endif /* HAVE_CUMULUS */
135 ret
= zebra_mpls_static_lsp_add(zvrf
, in_label
, out_label
,
136 gtype
, &gate
, NULL
, 0);
138 ret
= zebra_mpls_static_lsp_del(zvrf
, in_label
, gtype
, &gate
,
142 vty_out(vty
, "%% LSP cannot be %s%s",
143 add_cmd
? "added" : "deleted", VTY_NEWLINE
);
150 DEFUN (mpls_transit_lsp
,
151 mpls_transit_lsp_cmd
,
152 "mpls lsp (16-1048575) <A.B.C.D|X:X::X:X> <(16-1048575)|explicit-null|implicit-null>",
154 "Establish label switched path\n"
155 "Incoming MPLS label\n"
156 "IPv4 gateway address\n"
157 "IPv6 gateway address\n"
158 "Outgoing MPLS label\n"
159 "Use Explicit-Null label\n"
160 "Use Implicit-Null label\n")
162 return zebra_mpls_transit_lsp(vty
, 1, argv
[2]->arg
, argv
[3]->arg
,
166 DEFUN (no_mpls_transit_lsp
,
167 no_mpls_transit_lsp_cmd
,
168 "no mpls lsp (16-1048575) <A.B.C.D|X:X::X:X>",
171 "Establish label switched path\n"
172 "Incoming MPLS label\n"
173 "IPv4 gateway address\n"
174 "IPv6 gateway address\n")
176 return zebra_mpls_transit_lsp(vty
, 0, argv
[3]->arg
, argv
[4]->arg
, NULL
,
180 ALIAS(no_mpls_transit_lsp
, no_mpls_transit_lsp_out_label_cmd
,
181 "no mpls lsp (16-1048575) <A.B.C.D|X:X::X:X> <(16-1048575)|explicit-null|implicit-null>",
183 "Establish label switched path\n"
184 "Incoming MPLS label\n"
185 "IPv4 gateway address\n"
186 "IPv6 gateway address\n"
187 "Outgoing MPLS label\n"
188 "Use Explicit-Null label\n"
189 "Use Implicit-Null label\n")
191 DEFUN (no_mpls_transit_lsp_all
,
192 no_mpls_transit_lsp_all_cmd
,
193 "no mpls lsp (16-1048575)",
196 "Establish label switched path\n"
197 "Incoming MPLS label\n")
199 return zebra_mpls_transit_lsp(vty
, 0, argv
[3]->arg
, NULL
, NULL
, NULL
);
202 /* Static route configuration. */
203 DEFUN (ip_route_label
,
205 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
207 "Establish static routes\n"
208 "IP destination prefix (e.g. 10.0.0.0/8)\n"
209 "IP gateway address\n"
210 "IP gateway interface name\n"
212 "Specify label(s) for this route\n"
213 "One or more labels separated by '/'\n")
215 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
,
216 argv
[3]->arg
, NULL
, NULL
, NULL
, NULL
,
220 DEFUN (ip_route_tag_label
,
221 ip_route_tag_label_cmd
,
222 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
224 "Establish static routes\n"
225 "IP destination prefix (e.g. 10.0.0.0/8)\n"
226 "IP gateway address\n"
227 "IP gateway interface name\n"
229 "Set tag for this route\n"
231 "Specify label(s) for this route\n"
232 "One or more labels separated by '/'\n")
234 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
,
235 argv
[3]->arg
, NULL
, argv
[5]->arg
, NULL
, NULL
,
239 /* Mask as A.B.C.D format. */
240 DEFUN (ip_route_mask_label
,
241 ip_route_mask_label_cmd
,
242 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
244 "Establish static routes\n"
245 "IP destination prefix\n"
246 "IP destination prefix mask\n"
247 "IP gateway address\n"
248 "IP gateway interface name\n"
250 "Specify label(s) for this route\n"
251 "One or more labels separated by '/'\n")
253 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
,
254 argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
, NULL
,
258 DEFUN (ip_route_mask_tag_label
,
259 ip_route_mask_tag_label_cmd
,
260 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
262 "Establish static routes\n"
263 "IP destination prefix\n"
264 "IP destination prefix mask\n"
265 "IP gateway address\n"
266 "IP gateway interface name\n"
268 "Set tag for this route\n"
270 "Specify label(s) for this route\n"
271 "One or more labels separated by '/'\n")
273 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
,
274 argv
[3]->arg
, argv
[4]->arg
, NULL
, argv
[6]->arg
,
275 NULL
, NULL
, argv
[8]->arg
);
278 /* Distance option value. */
279 DEFUN (ip_route_distance_label
,
280 ip_route_distance_label_cmd
,
281 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
283 "Establish static routes\n"
284 "IP destination prefix (e.g. 10.0.0.0/8)\n"
285 "IP gateway address\n"
286 "IP gateway interface name\n"
288 "Distance value for this route\n"
289 "Specify label(s) for this route\n"
290 "One or more labels separated by '/'\n")
292 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
,
293 argv
[3]->arg
, NULL
, NULL
, argv
[4]->arg
, NULL
,
297 DEFUN (ip_route_tag_distance_label
,
298 ip_route_tag_distance_label_cmd
,
299 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
301 "Establish static routes\n"
302 "IP destination prefix (e.g. 10.0.0.0/8)\n"
303 "IP gateway address\n"
304 "IP gateway interface name\n"
306 "Set tag for this route\n"
308 "Distance value for this route\n"
309 "Specify label(s) for this route\n"
310 "One or more labels separated by '/'\n")
312 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
,
313 argv
[3]->arg
, NULL
, argv
[5]->arg
, argv
[6]->arg
,
317 DEFUN (ip_route_mask_distance_label
,
318 ip_route_mask_distance_label_cmd
,
319 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
321 "Establish static routes\n"
322 "IP destination prefix\n"
323 "IP destination prefix mask\n"
324 "IP gateway address\n"
325 "IP gateway interface name\n"
327 "Distance value for this route\n"
328 "Specify label(s) for this route\n"
329 "One or more labels separated by '/'\n")
331 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
,
332 argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
,
333 argv
[5]->arg
, NULL
, argv
[7]->arg
);
336 DEFUN (ip_route_mask_tag_distance_label
,
337 ip_route_mask_tag_distance_label_cmd
,
338 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
340 "Establish static routes\n"
341 "IP destination prefix\n"
342 "IP destination prefix mask\n"
343 "IP gateway address\n"
344 "IP gateway interface name\n"
346 "Set tag for this route\n"
348 "Distance value for this route\n"
349 "Specify label(s) for this route\n"
350 "One or more labels separated by '/'\n")
352 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 1, argv
[2]->arg
,
353 argv
[3]->arg
, argv
[4]->arg
, NULL
, argv
[6]->arg
,
354 argv
[7]->arg
, NULL
, argv
[9]->arg
);
357 DEFUN (no_ip_route_label
,
358 no_ip_route_label_cmd
,
359 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
362 "Establish static routes\n"
363 "IP destination prefix (e.g. 10.0.0.0/8)\n"
364 "IP gateway address\n"
365 "IP gateway interface name\n"
367 "Specify label(s) for this route\n"
368 "One or more labels separated by '/'\n")
370 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
,
371 argv
[4]->arg
, NULL
, NULL
, NULL
, NULL
,
375 DEFUN (no_ip_route_tag_label
,
376 no_ip_route_tag_label_cmd
,
377 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
380 "Establish static routes\n"
381 "IP destination prefix (e.g. 10.0.0.0/8)\n"
382 "IP gateway address\n"
383 "IP gateway interface name\n"
385 "Tag of this route\n"
387 "Specify label(s) for this route\n"
388 "One or more labels separated by '/'\n")
390 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
,
391 argv
[4]->arg
, NULL
, argv
[6]->arg
, NULL
, NULL
,
395 DEFUN (no_ip_route_mask_label
,
396 no_ip_route_mask_label_cmd
,
397 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
400 "Establish static routes\n"
401 "IP destination prefix\n"
402 "IP destination prefix mask\n"
403 "IP gateway address\n"
404 "IP gateway interface name\n"
406 "Specify label(s) for this route\n"
407 "One or more labels separated by '/'\n")
409 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
,
410 argv
[4]->arg
, argv
[5]->arg
, NULL
, NULL
, NULL
,
414 DEFUN (no_ip_route_mask_tag_label
,
415 no_ip_route_mask_tag_label_cmd
,
416 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
419 "Establish static routes\n"
420 "IP destination prefix\n"
421 "IP destination prefix mask\n"
422 "IP gateway address\n"
423 "IP gateway interface name\n"
425 "Tag of this route\n"
427 "Specify label(s) for this route\n"
428 "One or more labels separated by '/'\n")
430 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
,
431 argv
[4]->arg
, argv
[5]->arg
, NULL
, argv
[7]->arg
,
432 NULL
, NULL
, argv
[9]->arg
);
435 DEFUN (no_ip_route_distance_label
,
436 no_ip_route_distance_label_cmd
,
437 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
440 "Establish static routes\n"
441 "IP destination prefix (e.g. 10.0.0.0/8)\n"
442 "IP gateway address\n"
443 "IP gateway interface name\n"
445 "Distance value for this route\n"
446 "Specify label(s) for this route\n"
447 "One or more labels separated by '/'\n")
449 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
,
450 argv
[4]->arg
, NULL
, NULL
, argv
[5]->arg
, NULL
,
454 DEFUN (no_ip_route_tag_distance_label
,
455 no_ip_route_tag_distance_label_cmd
,
456 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
459 "Establish static routes\n"
460 "IP destination prefix (e.g. 10.0.0.0/8)\n"
461 "IP gateway address\n"
462 "IP gateway interface name\n"
464 "Tag of this route\n"
466 "Distance value for this route\n"
467 "Specify label(s) for this route\n"
468 "One or more labels separated by '/'\n")
470 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
,
471 argv
[4]->arg
, NULL
, argv
[6]->arg
, argv
[7]->arg
,
475 DEFUN (no_ip_route_mask_distance_label
,
476 no_ip_route_mask_distance_label_cmd
,
477 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
480 "Establish static routes\n"
481 "IP destination prefix\n"
482 "IP destination prefix mask\n"
483 "IP gateway address\n"
484 "IP gateway interface name\n"
486 "Distance value for this route\n"
487 "Specify label(s) for this route\n"
488 "One or more labels separated by '/'\n")
490 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
,
491 argv
[4]->arg
, argv
[5]->arg
, NULL
, NULL
,
492 argv
[6]->arg
, NULL
, argv
[8]->arg
);
495 DEFUN (no_ip_route_mask_tag_distance_label
,
496 no_ip_route_mask_tag_distance_label_cmd
,
497 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
500 "Establish static routes\n"
501 "IP destination prefix\n"
502 "IP destination prefix mask\n"
503 "IP gateway address\n"
504 "IP gateway interface name\n"
506 "Tag of this route\n"
508 "Distance value for this route\n"
509 "Specify label(s) for this route\n"
510 "One or more labels separated by '/'\n")
512 return zebra_static_ipv4(vty
, SAFI_UNICAST
, 0, argv
[3]->arg
,
513 argv
[4]->arg
, argv
[5]->arg
, NULL
, argv
[7]->arg
,
514 argv
[8]->arg
, NULL
, argv
[10]->arg
);
517 DEFUN (ipv6_route_label
,
518 ipv6_route_label_cmd
,
519 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
521 "Establish static routes\n"
522 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
523 "IPv6 gateway address\n"
524 "IPv6 gateway interface name\n"
525 "Specify label(s) for this route\n"
526 "One or more labels separated by '/'\n")
528 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
,
529 NULL
, NULL
, NULL
, NULL
, argv
[5]->arg
);
532 DEFUN (ipv6_route_tag_label
,
533 ipv6_route_tag_label_cmd
,
534 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
536 "Establish static routes\n"
537 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
538 "IPv6 gateway address\n"
539 "IPv6 gateway interface name\n"
540 "Set tag for this route\n"
542 "Specify label(s) for this route\n"
543 "One or more labels separated by '/'\n")
545 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
,
546 NULL
, argv
[5]->arg
, NULL
, NULL
, argv
[7]->arg
);
549 DEFUN (ipv6_route_ifname_label
,
550 ipv6_route_ifname_label_cmd
,
551 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
553 "Establish static routes\n"
554 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
555 "IPv6 gateway address\n"
556 "IPv6 gateway interface name\n"
557 "Specify label(s) for this route\n"
558 "One or more labels separated by '/'\n")
560 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
,
561 argv
[4]->arg
, NULL
, NULL
, NULL
, NULL
,
564 DEFUN (ipv6_route_ifname_tag_label
,
565 ipv6_route_ifname_tag_label_cmd
,
566 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
568 "Establish static routes\n"
569 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
570 "IPv6 gateway address\n"
571 "IPv6 gateway interface name\n"
572 "Set tag for this route\n"
574 "Specify label(s) for this route\n"
575 "One or more labels separated by '/'\n")
577 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
,
578 argv
[4]->arg
, NULL
, argv
[6]->arg
, NULL
, NULL
,
582 DEFUN (ipv6_route_pref_label
,
583 ipv6_route_pref_label_cmd
,
584 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
586 "Establish static routes\n"
587 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
588 "IPv6 gateway address\n"
589 "IPv6 gateway interface name\n"
590 "Distance value for this prefix\n"
591 "Specify label(s) for this route\n"
592 "One or more labels separated by '/'\n")
594 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
,
595 NULL
, NULL
, argv
[4]->arg
, NULL
, argv
[6]->arg
);
598 DEFUN (ipv6_route_pref_tag_label
,
599 ipv6_route_pref_tag_label_cmd
,
600 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
602 "Establish static routes\n"
603 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
604 "IPv6 gateway address\n"
605 "IPv6 gateway interface name\n"
606 "Set tag for this route\n"
608 "Distance value for this prefix\n"
609 "Specify label(s) for this route\n"
610 "One or more labels separated by '/'\n")
612 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
,
613 NULL
, argv
[5]->arg
, argv
[6]->arg
, NULL
,
617 DEFUN (ipv6_route_ifname_pref_label
,
618 ipv6_route_ifname_pref_label_cmd
,
619 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
621 "Establish static routes\n"
622 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
623 "IPv6 gateway address\n"
624 "IPv6 gateway interface name\n"
625 "Distance value for this prefix\n"
626 "Specify label(s) for this route\n"
627 "One or more labels separated by '/'\n")
629 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
,
630 argv
[4]->arg
, NULL
, NULL
, argv
[5]->arg
, NULL
,
634 DEFUN (ipv6_route_ifname_pref_tag_label
,
635 ipv6_route_ifname_pref_tag_label_cmd
,
636 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
638 "Establish static routes\n"
639 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
640 "IPv6 gateway address\n"
641 "IPv6 gateway interface name\n"
642 "Set tag for this route\n"
644 "Distance value for this prefix\n"
645 "Specify label(s) for this route\n"
646 "One or more labels separated by '/'\n")
648 return static_ipv6_func(vty
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
,
649 argv
[4]->arg
, NULL
, argv
[6]->arg
, argv
[7]->arg
,
653 DEFUN (no_ipv6_route_label
,
654 no_ipv6_route_label_cmd
,
655 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
658 "Establish static routes\n"
659 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
660 "IPv6 gateway address\n"
661 "IPv6 gateway interface name\n"
662 "Specify label(s) for this route\n"
663 "One or more labels separated by '/'\n")
665 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
,
666 NULL
, NULL
, NULL
, NULL
, argv
[6]->arg
);
669 DEFUN (no_ipv6_route_tag_label
,
670 no_ipv6_route_tag_label_cmd
,
671 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
674 "Establish static routes\n"
675 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
676 "IPv6 gateway address\n"
677 "IPv6 gateway interface name\n"
678 "Set tag for this route\n"
680 "Specify label(s) for this route\n"
681 "One or more labels separated by '/'\n")
683 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
,
684 NULL
, argv
[6]->arg
, NULL
, NULL
, argv
[8]->arg
);
687 DEFUN (no_ipv6_route_ifname_label
,
688 no_ipv6_route_ifname_label_cmd
,
689 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
692 "Establish static routes\n"
693 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
694 "IPv6 gateway address\n"
695 "IPv6 gateway interface name\n"
696 "Specify label(s) for this route\n"
697 "One or more labels separated by '/'\n")
699 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
,
700 argv
[5]->arg
, NULL
, NULL
, NULL
, NULL
,
704 DEFUN (no_ipv6_route_ifname_tag_label
,
705 no_ipv6_route_ifname_tag_label_cmd
,
706 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
709 "Establish static routes\n"
710 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
711 "IPv6 gateway address\n"
712 "IPv6 gateway interface name\n"
713 "Set tag for this route\n"
715 "Specify label(s) for this route\n"
716 "One or more labels separated by '/'\n")
718 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
,
719 argv
[5]->arg
, NULL
, argv
[7]->arg
, NULL
, NULL
,
723 DEFUN (no_ipv6_route_pref_label
,
724 no_ipv6_route_pref_label_cmd
,
725 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
728 "Establish static routes\n"
729 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
730 "IPv6 gateway address\n"
731 "IPv6 gateway interface name\n"
732 "Distance value for this prefix\n"
733 "Specify label(s) for this route\n"
734 "One or more labels separated by '/'\n")
736 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
,
737 NULL
, NULL
, argv
[5]->arg
, NULL
, argv
[7]->arg
);
740 DEFUN (no_ipv6_route_pref_tag_label
,
741 no_ipv6_route_pref_tag_label_cmd
,
742 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
745 "Establish static routes\n"
746 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
747 "IPv6 gateway address\n"
748 "IPv6 gateway interface name\n"
749 "Set tag for this route\n"
751 "Distance value for this prefix\n"
752 "Specify label(s) for this route\n"
753 "One or more labels separated by '/'\n")
755 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
,
756 NULL
, argv
[6]->arg
, argv
[7]->arg
, NULL
,
760 DEFUN (no_ipv6_route_ifname_pref_label
,
761 no_ipv6_route_ifname_pref_label_cmd
,
762 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
765 "Establish static routes\n"
766 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
767 "IPv6 gateway address\n"
768 "IPv6 gateway interface name\n"
769 "Distance value for this prefix\n"
770 "Specify label(s) for this route\n"
771 "One or more labels separated by '/'\n")
773 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
,
774 argv
[5]->arg
, NULL
, NULL
, argv
[6]->arg
, NULL
,
778 DEFUN (no_ipv6_route_ifname_pref_tag_label
,
779 no_ipv6_route_ifname_pref_tag_label_cmd
,
780 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
783 "Establish static routes\n"
784 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
785 "IPv6 gateway address\n"
786 "IPv6 gateway interface name\n"
787 "Set tag for this route\n"
789 "Distance value for this prefix\n"
790 "Specify label(s) for this route\n"
791 "One or more labels separated by '/'\n")
793 return static_ipv6_func(vty
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
,
794 argv
[5]->arg
, NULL
, argv
[7]->arg
, argv
[8]->arg
,
795 NULL
, argv
[10]->arg
);
798 /* MPLS LSP configuration write function. */
799 static int zebra_mpls_config(struct vty
*vty
)
802 struct zebra_vrf
*zvrf
;
804 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
808 write
+= zebra_mpls_write_lsp_config(vty
, zvrf
);
812 DEFUN (show_mpls_table
,
814 "show mpls table [json]",
820 struct zebra_vrf
*zvrf
;
821 u_char uj
= use_json(argc
, argv
);
823 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
824 zebra_mpls_print_lsp_table(vty
, zvrf
, uj
);
828 DEFUN (show_mpls_table_lsp
,
829 show_mpls_table_lsp_cmd
,
830 "show mpls table (16-1048575) [json]",
834 "LSP to display information about\n"
838 struct zebra_vrf
*zvrf
;
839 u_char uj
= use_json(argc
, argv
);
841 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
842 label
= atoi(argv
[3]->arg
);
843 zebra_mpls_print_lsp(vty
, zvrf
, label
, uj
);
847 DEFUN (show_mpls_status
,
848 show_mpls_status_cmd
,
854 vty_out(vty
, "MPLS support enabled: %s%s",
855 (mpls_enabled
) ? "yes"
856 : "no (mpls kernel extensions not detected)",
861 /* MPLS node for MPLS LSP. */
862 static struct cmd_node mpls_node
= {MPLS_NODE
, "", 1};
865 void zebra_mpls_vty_init(void)
867 install_element(VIEW_NODE
, &show_mpls_status_cmd
);
869 install_node(&mpls_node
, zebra_mpls_config
);
871 install_element(CONFIG_NODE
, &ip_route_label_cmd
);
872 install_element(CONFIG_NODE
, &ip_route_tag_label_cmd
);
873 install_element(CONFIG_NODE
, &ip_route_mask_label_cmd
);
874 install_element(CONFIG_NODE
, &ip_route_mask_tag_label_cmd
);
875 install_element(CONFIG_NODE
, &no_ip_route_label_cmd
);
876 install_element(CONFIG_NODE
, &no_ip_route_tag_label_cmd
);
877 install_element(CONFIG_NODE
, &no_ip_route_mask_label_cmd
);
878 install_element(CONFIG_NODE
, &no_ip_route_mask_tag_label_cmd
);
879 install_element(CONFIG_NODE
, &ip_route_distance_label_cmd
);
880 install_element(CONFIG_NODE
, &ip_route_tag_distance_label_cmd
);
881 install_element(CONFIG_NODE
, &ip_route_mask_distance_label_cmd
);
882 install_element(CONFIG_NODE
, &ip_route_mask_tag_distance_label_cmd
);
883 install_element(CONFIG_NODE
, &no_ip_route_distance_label_cmd
);
884 install_element(CONFIG_NODE
, &no_ip_route_tag_distance_label_cmd
);
885 install_element(CONFIG_NODE
, &no_ip_route_mask_distance_label_cmd
);
886 install_element(CONFIG_NODE
, &no_ip_route_mask_tag_distance_label_cmd
);
888 install_element(CONFIG_NODE
, &ipv6_route_label_cmd
);
889 install_element(CONFIG_NODE
, &ipv6_route_ifname_label_cmd
);
890 install_element(CONFIG_NODE
, &no_ipv6_route_label_cmd
);
891 install_element(CONFIG_NODE
, &no_ipv6_route_ifname_label_cmd
);
892 install_element(CONFIG_NODE
, &ipv6_route_pref_label_cmd
);
893 install_element(CONFIG_NODE
, &ipv6_route_ifname_pref_label_cmd
);
894 install_element(CONFIG_NODE
, &no_ipv6_route_pref_label_cmd
);
895 install_element(CONFIG_NODE
, &no_ipv6_route_ifname_pref_label_cmd
);
896 install_element(CONFIG_NODE
, &ipv6_route_tag_label_cmd
);
897 install_element(CONFIG_NODE
, &ipv6_route_ifname_tag_label_cmd
);
898 install_element(CONFIG_NODE
, &ipv6_route_pref_tag_label_cmd
);
899 install_element(CONFIG_NODE
, &ipv6_route_ifname_pref_tag_label_cmd
);
900 install_element(CONFIG_NODE
, &no_ipv6_route_tag_label_cmd
);
901 install_element(CONFIG_NODE
, &no_ipv6_route_ifname_tag_label_cmd
);
902 install_element(CONFIG_NODE
, &no_ipv6_route_pref_tag_label_cmd
);
903 install_element(CONFIG_NODE
, &no_ipv6_route_ifname_pref_tag_label_cmd
);
905 install_element(CONFIG_NODE
, &mpls_transit_lsp_cmd
);
906 install_element(CONFIG_NODE
, &no_mpls_transit_lsp_cmd
);
907 install_element(CONFIG_NODE
, &no_mpls_transit_lsp_out_label_cmd
);
908 install_element(CONFIG_NODE
, &no_mpls_transit_lsp_all_cmd
);
910 install_element(VIEW_NODE
, &show_mpls_table_cmd
);
911 install_element(VIEW_NODE
, &show_mpls_table_lsp_cmd
);