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"
44 zebra_mpls_transit_lsp (struct vty
*vty
, int add_cmd
, const char *inlabel_str
,
45 const char *gate_str
, const char *outlabel_str
,
48 struct zebra_vrf
*zvrf
;
50 enum nexthop_types_t gtype
;
53 mpls_label_t in_label
, out_label
;
57 vty_out (vty
, "%% MPLS not turned on in kernel, ignoring command%s",
62 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
65 vty_out (vty
, "%% Default VRF does not exist%s", VTY_NEWLINE
);
71 vty_out (vty
, "%% No Label Information%s", VTY_NEWLINE
);
75 out_label
= MPLS_IMP_NULL_LABEL
; /* as initialization */
76 label
= atoi(inlabel_str
);
77 if (!IS_MPLS_UNRESERVED_LABEL(label
))
79 vty_out (vty
, "%% Invalid label%s", VTY_NEWLINE
);
87 vty_out (vty
, "%% No Nexthop Information%s", VTY_NEWLINE
);
92 vty_out (vty
, "%% No Outgoing label Information%s", VTY_NEWLINE
);
98 gtype
= NEXTHOP_TYPE_BLACKHOLE
; /* as initialization */
102 /* Gateway is a IPv4 or IPv6 nexthop. */
103 ret
= inet_pton (AF_INET6
, gate_str
, &gate
.ipv6
);
105 gtype
= NEXTHOP_TYPE_IPV6
;
108 ret
= inet_pton (AF_INET
, gate_str
, &gate
.ipv4
);
110 gtype
= NEXTHOP_TYPE_IPV4
;
113 vty_out (vty
, "%% Invalid nexthop%s", VTY_NEWLINE
);
121 if (outlabel_str
[0] == 'i')
122 out_label
= MPLS_IMP_NULL_LABEL
;
123 else if (outlabel_str
[0] == 'e' && gtype
== NEXTHOP_TYPE_IPV4
)
124 out_label
= MPLS_V4_EXP_NULL_LABEL
;
125 else if (outlabel_str
[0] == 'e' && gtype
== NEXTHOP_TYPE_IPV6
)
126 out_label
= MPLS_V6_EXP_NULL_LABEL
;
128 out_label
= atoi(outlabel_str
);
133 #if defined(HAVE_CUMULUS)
134 /* Check that label value is consistent. */
135 if (!zebra_mpls_lsp_label_consistent (zvrf
, in_label
, out_label
, gtype
,
138 vty_out (vty
, "%% Label value not consistent%s",
142 #endif /* HAVE_CUMULUS */
144 ret
= zebra_mpls_static_lsp_add (zvrf
, in_label
, out_label
, gtype
,
148 ret
= zebra_mpls_static_lsp_del (zvrf
, in_label
, gtype
, &gate
, NULL
, 0);
152 vty_out (vty
, "%% LSP cannot be %s%s",
153 add_cmd
? "added" : "deleted", VTY_NEWLINE
);
160 DEFUN (mpls_transit_lsp
,
161 mpls_transit_lsp_cmd
,
162 "mpls lsp (16-1048575) <A.B.C.D|X:X::X:X> <(16-1048575)|explicit-null|implicit-null>",
164 "Establish label switched path\n"
165 "Incoming MPLS label\n"
166 "IPv4 gateway address\n"
167 "IPv6 gateway address\n"
168 "Outgoing MPLS label\n"
169 "Use Explicit-Null label\n"
170 "Use Implicit-Null label\n")
172 return zebra_mpls_transit_lsp (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
);
175 DEFUN (no_mpls_transit_lsp
,
176 no_mpls_transit_lsp_cmd
,
177 "no mpls lsp (16-1048575) <A.B.C.D|X:X::X:X>",
180 "Establish label switched path\n"
181 "Incoming MPLS label\n"
182 "IPv4 gateway address\n"
183 "IPv6 gateway address\n")
185 return zebra_mpls_transit_lsp (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
);
188 ALIAS (no_mpls_transit_lsp
,
189 no_mpls_transit_lsp_out_label_cmd
,
190 "no mpls lsp (16-1048575) <A.B.C.D|X:X::X:X> <(16-1048575)|explicit-null|implicit-null>",
193 "Establish label switched path\n"
194 "Incoming MPLS label\n"
195 "IPv4 gateway address\n"
196 "IPv6 gateway address\n"
197 "Outgoing MPLS label\n"
198 "Use Explicit-Null label\n"
199 "Use Implicit-Null label\n")
201 DEFUN (no_mpls_transit_lsp_all
,
202 no_mpls_transit_lsp_all_cmd
,
203 "no mpls lsp (16-1048575)",
206 "Establish label switched path\n"
207 "Incoming MPLS label\n")
209 return zebra_mpls_transit_lsp (vty
, 0, argv
[3]->arg
, NULL
, NULL
, NULL
);
212 /* Static route configuration. */
213 DEFUN (ip_route_label
,
215 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
217 "Establish static routes\n"
218 "IP destination prefix (e.g. 10.0.0.0/8)\n"
219 "IP gateway address\n"
220 "IP gateway interface name\n"
222 "Specify label(s) for this route\n"
223 "One or more labels separated by '/'\n")
225 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
, NULL
,
226 NULL
, NULL
, argv
[5]->arg
);
229 DEFUN (ip_route_tag_label
,
230 ip_route_tag_label_cmd
,
231 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
233 "Establish static routes\n"
234 "IP destination prefix (e.g. 10.0.0.0/8)\n"
235 "IP gateway address\n"
236 "IP gateway interface name\n"
238 "Set tag for this route\n"
240 "Specify label(s) for this route\n"
241 "One or more labels separated by '/'\n")
243 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
, argv
[5]->arg
,
244 NULL
, NULL
, argv
[7]->arg
);
247 /* Mask as A.B.C.D format. */
248 DEFUN (ip_route_mask_label
,
249 ip_route_mask_label_cmd
,
250 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
252 "Establish static routes\n"
253 "IP destination prefix\n"
254 "IP destination prefix mask\n"
255 "IP gateway address\n"
256 "IP gateway interface name\n"
258 "Specify label(s) for this route\n"
259 "One or more labels separated by '/'\n")
261 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
,
262 NULL
, NULL
, argv
[6]->arg
);
265 DEFUN (ip_route_mask_tag_label
,
266 ip_route_mask_tag_label_cmd
,
267 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
269 "Establish static routes\n"
270 "IP destination prefix\n"
271 "IP destination prefix mask\n"
272 "IP gateway address\n"
273 "IP gateway interface name\n"
275 "Set tag for this route\n"
277 "Specify label(s) for this route\n"
278 "One or more labels separated by '/'\n")
281 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, argv
[6]->arg
,
282 NULL
, NULL
, argv
[8]->arg
);
285 /* Distance option value. */
286 DEFUN (ip_route_distance_label
,
287 ip_route_distance_label_cmd
,
288 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
290 "Establish static routes\n"
291 "IP destination prefix (e.g. 10.0.0.0/8)\n"
292 "IP gateway address\n"
293 "IP gateway interface name\n"
295 "Distance value for this route\n"
296 "Specify label(s) for this route\n"
297 "One or more labels separated by '/'\n")
299 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
, NULL
,
300 argv
[4]->arg
, NULL
, argv
[6]->arg
);
303 DEFUN (ip_route_tag_distance_label
,
304 ip_route_tag_distance_label_cmd
,
305 "ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
307 "Establish static routes\n"
308 "IP destination prefix (e.g. 10.0.0.0/8)\n"
309 "IP gateway address\n"
310 "IP gateway interface name\n"
312 "Set tag for this route\n"
314 "Distance value for this route\n"
315 "Specify label(s) for this route\n"
316 "One or more labels separated by '/'\n")
319 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, NULL
, argv
[3]->arg
, NULL
, argv
[5]->arg
,
320 argv
[6]->arg
, NULL
, argv
[8]->arg
);
323 DEFUN (ip_route_mask_distance_label
,
324 ip_route_mask_distance_label_cmd
,
325 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255) label WORD",
327 "Establish static routes\n"
328 "IP destination prefix\n"
329 "IP destination prefix mask\n"
330 "IP gateway address\n"
331 "IP gateway interface name\n"
333 "Distance value for this route\n"
334 "Specify label(s) for this route\n"
335 "One or more labels separated by '/'\n")
337 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
,
338 argv
[5]->arg
, NULL
, argv
[7]->arg
);
341 DEFUN (ip_route_mask_tag_distance_label
,
342 ip_route_mask_tag_distance_label_cmd
,
343 "ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
345 "Establish static routes\n"
346 "IP destination prefix\n"
347 "IP destination prefix mask\n"
348 "IP gateway address\n"
349 "IP gateway interface name\n"
351 "Set tag for this route\n"
353 "Distance value for this route\n"
354 "Specify label(s) for this route\n"
355 "One or more labels separated by '/'\n")
357 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, argv
[6]->arg
,
358 argv
[7]->arg
, NULL
, argv
[9]->arg
);
361 DEFUN (no_ip_route_label
,
362 no_ip_route_label_cmd
,
363 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> label WORD",
366 "Establish static routes\n"
367 "IP destination prefix (e.g. 10.0.0.0/8)\n"
368 "IP gateway address\n"
369 "IP gateway interface name\n"
371 "Specify label(s) for this route\n"
372 "One or more labels separated by '/'\n")
374 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
, NULL
,
375 NULL
, NULL
, argv
[6]->arg
);
378 DEFUN (no_ip_route_tag_label
,
379 no_ip_route_tag_label_cmd
,
380 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
383 "Establish static routes\n"
384 "IP destination prefix (e.g. 10.0.0.0/8)\n"
385 "IP gateway address\n"
386 "IP gateway interface name\n"
388 "Tag of this route\n"
390 "Specify label(s) for this route\n"
391 "One or more labels separated by '/'\n")
393 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
, argv
[6]->arg
,
394 NULL
, NULL
, argv
[8]->arg
);
397 DEFUN (no_ip_route_mask_label
,
398 no_ip_route_mask_label_cmd
,
399 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> label WORD",
402 "Establish static routes\n"
403 "IP destination prefix\n"
404 "IP destination prefix mask\n"
405 "IP gateway address\n"
406 "IP gateway interface name\n"
408 "Specify label(s) for this route\n"
409 "One or more labels separated by '/'\n")
411 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, NULL
,
412 NULL
, NULL
, argv
[7]->arg
);
415 DEFUN (no_ip_route_mask_tag_label
,
416 no_ip_route_mask_tag_label_cmd
,
417 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) label WORD",
420 "Establish static routes\n"
421 "IP destination prefix\n"
422 "IP destination prefix mask\n"
423 "IP gateway address\n"
424 "IP gateway interface name\n"
426 "Tag of this route\n"
428 "Specify label(s) for this route\n"
429 "One or more labels separated by '/'\n")
431 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, 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
, argv
[4]->arg
, NULL
, NULL
,
450 argv
[5]->arg
, NULL
, argv
[7]->arg
);
453 DEFUN (no_ip_route_tag_distance_label
,
454 no_ip_route_tag_distance_label_cmd
,
455 "no ip route A.B.C.D/M <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
458 "Establish static routes\n"
459 "IP destination prefix (e.g. 10.0.0.0/8)\n"
460 "IP gateway address\n"
461 "IP gateway interface name\n"
463 "Tag of this route\n"
465 "Distance value for this route\n"
466 "Specify label(s) for this route\n"
467 "One or more labels separated by '/'\n")
469 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, NULL
, argv
[4]->arg
, NULL
, argv
[6]->arg
,
470 argv
[7]->arg
, NULL
, argv
[9]->arg
);
473 DEFUN (no_ip_route_mask_distance_label
,
474 no_ip_route_mask_distance_label_cmd
,
475 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> (1-255)",
478 "Establish static routes\n"
479 "IP destination prefix\n"
480 "IP destination prefix mask\n"
481 "IP gateway address\n"
482 "IP gateway interface name\n"
484 "Distance value for this route\n"
485 "Specify label(s) for this route\n"
486 "One or more labels separated by '/'\n")
488 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, NULL
,
489 argv
[6]->arg
, NULL
, NULL
);
492 DEFUN (no_ip_route_mask_tag_distance_label
,
493 no_ip_route_mask_tag_distance_label_cmd
,
494 "no ip route A.B.C.D A.B.C.D <A.B.C.D|INTERFACE|null0> tag (1-4294967295) (1-255) label WORD",
497 "Establish static routes\n"
498 "IP destination prefix\n"
499 "IP destination prefix mask\n"
500 "IP gateway address\n"
501 "IP gateway interface name\n"
503 "Tag of this route\n"
505 "Distance value for this route\n"
506 "Specify label(s) for this route\n"
507 "One or more labels separated by '/'\n")
509 return zebra_static_ipv4 (vty
, SAFI_UNICAST
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, argv
[7]->arg
,
510 argv
[8]->arg
, NULL
, argv
[10]->arg
);
513 DEFUN (ipv6_route_label
,
514 ipv6_route_label_cmd
,
515 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
517 "Establish static routes\n"
518 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
519 "IPv6 gateway address\n"
520 "IPv6 gateway interface name\n"
521 "Specify label(s) for this route\n"
522 "One or more labels separated by '/'\n")
524 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, NULL
, NULL
, NULL
, NULL
, NULL
, argv
[5]->arg
);
527 DEFUN (ipv6_route_tag_label
,
528 ipv6_route_tag_label_cmd
,
529 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
531 "Establish static routes\n"
532 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
533 "IPv6 gateway address\n"
534 "IPv6 gateway interface name\n"
535 "Set tag for this route\n"
537 "Specify label(s) for this route\n"
538 "One or more labels separated by '/'\n")
540 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, NULL
, NULL
, argv
[5]->arg
, NULL
, NULL
, argv
[7]->arg
);
543 DEFUN (ipv6_route_ifname_label
,
544 ipv6_route_ifname_label_cmd
,
545 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
547 "Establish static routes\n"
548 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
549 "IPv6 gateway address\n"
550 "IPv6 gateway interface name\n"
551 "Specify label(s) for this route\n"
552 "One or more labels separated by '/'\n")
554 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
, NULL
, NULL
, argv
[6]->arg
);
556 DEFUN (ipv6_route_ifname_tag_label
,
557 ipv6_route_ifname_tag_label_cmd
,
558 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
560 "Establish static routes\n"
561 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
562 "IPv6 gateway address\n"
563 "IPv6 gateway interface name\n"
564 "Set tag for this route\n"
566 "Specify label(s) for this route\n"
567 "One or more labels separated by '/'\n")
569 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, argv
[6]->arg
, NULL
, NULL
, argv
[8]->arg
);
572 DEFUN (ipv6_route_pref_label
,
573 ipv6_route_pref_label_cmd
,
574 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
576 "Establish static routes\n"
577 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
578 "IPv6 gateway address\n"
579 "IPv6 gateway interface name\n"
580 "Distance value for this prefix\n"
581 "Specify label(s) for this route\n"
582 "One or more labels separated by '/'\n")
584 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, NULL
, NULL
, NULL
, argv
[4]->arg
, NULL
, argv
[6]->arg
);
587 DEFUN (ipv6_route_pref_tag_label
,
588 ipv6_route_pref_tag_label_cmd
,
589 "ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
591 "Establish static routes\n"
592 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
593 "IPv6 gateway address\n"
594 "IPv6 gateway interface name\n"
595 "Set tag for this route\n"
597 "Distance value for this prefix\n"
598 "Specify label(s) for this route\n"
599 "One or more labels separated by '/'\n")
601 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, NULL
, NULL
, argv
[5]->arg
, argv
[6]->arg
, NULL
, argv
[8]->arg
);
604 DEFUN (ipv6_route_ifname_pref_label
,
605 ipv6_route_ifname_pref_label_cmd
,
606 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
608 "Establish static routes\n"
609 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
610 "IPv6 gateway address\n"
611 "IPv6 gateway interface name\n"
612 "Distance value for this prefix\n"
613 "Specify label(s) for this route\n"
614 "One or more labels separated by '/'\n")
616 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
, argv
[5]->arg
, NULL
, argv
[7]->arg
);
619 DEFUN (ipv6_route_ifname_pref_tag_label
,
620 ipv6_route_ifname_pref_tag_label_cmd
,
621 "ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
623 "Establish static routes\n"
624 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
625 "IPv6 gateway address\n"
626 "IPv6 gateway interface name\n"
627 "Set tag for this route\n"
629 "Distance value for this prefix\n"
630 "Specify label(s) for this route\n"
631 "One or more labels separated by '/'\n")
633 return static_ipv6_func (vty
, 1, argv
[2]->arg
, argv
[3]->arg
, argv
[4]->arg
, NULL
, argv
[6]->arg
, argv
[7]->arg
, NULL
, argv
[9]->arg
);
636 DEFUN (no_ipv6_route_label
,
637 no_ipv6_route_label_cmd
,
638 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> label WORD",
641 "Establish static routes\n"
642 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
643 "IPv6 gateway address\n"
644 "IPv6 gateway interface name\n"
645 "Specify label(s) for this route\n"
646 "One or more labels separated by '/'\n")
648 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
, NULL
, NULL
, NULL
, argv
[6]->arg
);
651 DEFUN (no_ipv6_route_tag_label
,
652 no_ipv6_route_tag_label_cmd
,
653 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) label WORD",
656 "Establish static routes\n"
657 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
658 "IPv6 gateway address\n"
659 "IPv6 gateway interface name\n"
660 "Set tag for this route\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
, argv
[4]->arg
, NULL
, NULL
, argv
[6]->arg
, NULL
, NULL
, argv
[8]->arg
);
668 DEFUN (no_ipv6_route_ifname_label
,
669 no_ipv6_route_ifname_label_cmd
,
670 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE label WORD",
673 "Establish static routes\n"
674 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
675 "IPv6 gateway address\n"
676 "IPv6 gateway interface name\n"
677 "Specify label(s) for this route\n"
678 "One or more labels separated by '/'\n")
680 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, NULL
, NULL
, NULL
, argv
[7]->arg
);
683 DEFUN (no_ipv6_route_ifname_tag_label
,
684 no_ipv6_route_ifname_tag_label_cmd
,
685 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) label WORD",
688 "Establish static routes\n"
689 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
690 "IPv6 gateway address\n"
691 "IPv6 gateway interface name\n"
692 "Set tag for this route\n"
694 "Specify label(s) for this route\n"
695 "One or more labels separated by '/'\n")
697 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, argv
[7]->arg
, NULL
, NULL
, argv
[9]->arg
);
700 DEFUN (no_ipv6_route_pref_label
,
701 no_ipv6_route_pref_label_cmd
,
702 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> (1-255) label WORD",
705 "Establish static routes\n"
706 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
707 "IPv6 gateway address\n"
708 "IPv6 gateway interface name\n"
709 "Distance value for this prefix\n"
710 "Specify label(s) for this route\n"
711 "One or more labels separated by '/'\n")
713 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
, NULL
, argv
[5]->arg
, NULL
, argv
[7]->arg
);
716 DEFUN (no_ipv6_route_pref_tag_label
,
717 no_ipv6_route_pref_tag_label_cmd
,
718 "no ipv6 route X:X::X:X/M <X:X::X:X|INTERFACE> tag (1-4294967295) (1-255) label WORD",
721 "Establish static routes\n"
722 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
723 "IPv6 gateway address\n"
724 "IPv6 gateway interface name\n"
725 "Set tag for this route\n"
727 "Distance value for this prefix\n"
728 "Specify label(s) for this route\n"
729 "One or more labels separated by '/'\n")
731 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, NULL
, NULL
, argv
[6]->arg
, argv
[7]->arg
, NULL
, argv
[9]->arg
);
734 DEFUN (no_ipv6_route_ifname_pref_label
,
735 no_ipv6_route_ifname_pref_label_cmd
,
736 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE (1-255) label WORD",
739 "Establish static routes\n"
740 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
741 "IPv6 gateway address\n"
742 "IPv6 gateway interface name\n"
743 "Distance value for this prefix\n"
744 "Specify label(s) for this route\n"
745 "One or more labels separated by '/'\n")
747 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, NULL
, argv
[6]->arg
, NULL
, argv
[8]->arg
);
750 DEFUN (no_ipv6_route_ifname_pref_tag_label
,
751 no_ipv6_route_ifname_pref_tag_label_cmd
,
752 "no ipv6 route X:X::X:X/M X:X::X:X INTERFACE tag (1-4294967295) (1-255) label WORD",
755 "Establish static routes\n"
756 "IPv6 destination prefix (e.g. 3ffe:506::/32)\n"
757 "IPv6 gateway address\n"
758 "IPv6 gateway interface name\n"
759 "Set tag for this route\n"
761 "Distance value for this prefix\n"
762 "Specify label(s) for this route\n"
763 "One or more labels separated by '/'\n")
765 return static_ipv6_func (vty
, 0, argv
[3]->arg
, argv
[4]->arg
, argv
[5]->arg
, NULL
, argv
[7]->arg
, argv
[8]->arg
, NULL
, argv
[10]->arg
);
768 /* MPLS LSP configuration write function. */
770 zebra_mpls_config (struct vty
*vty
)
773 struct zebra_vrf
*zvrf
;
775 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
779 write
+= zebra_mpls_write_lsp_config(vty
, zvrf
);
783 DEFUN (show_mpls_table
,
785 "show mpls table [json]",
789 "JavaScript Object Notation\n")
791 struct zebra_vrf
*zvrf
;
792 u_char use_json
= (argv
[3]->arg
!= NULL
);
794 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
795 zebra_mpls_print_lsp_table(vty
, zvrf
, use_json
);
799 DEFUN (show_mpls_table_lsp
,
800 show_mpls_table_lsp_cmd
,
801 "show mpls table (16-1048575) [json]",
805 "LSP to display information about\n"
806 "JavaScript Object Notation\n")
809 struct zebra_vrf
*zvrf
;
810 u_char use_json
= (argv
[4]->arg
!= NULL
);
812 zvrf
= vrf_info_lookup(VRF_DEFAULT
);
813 label
= atoi(argv
[3]->arg
);
814 zebra_mpls_print_lsp (vty
, zvrf
, label
, use_json
);
818 DEFUN (show_mpls_status
,
819 show_mpls_status_cmd
,
825 vty_out (vty
, "MPLS support enabled: %s%s", (mpls_enabled
) ? "yes" :
826 "no (mpls kernel extensions not detected)", VTY_NEWLINE
);
830 /* MPLS node for MPLS LSP. */
831 static struct cmd_node mpls_node
= { MPLS_NODE
, "", 1 };
835 zebra_mpls_vty_init (void)
837 install_element (VIEW_NODE
, &show_mpls_status_cmd
);
839 install_node (&mpls_node
, zebra_mpls_config
);
841 install_element (CONFIG_NODE
, &ip_route_label_cmd
);
842 install_element (CONFIG_NODE
, &ip_route_tag_label_cmd
);
843 install_element (CONFIG_NODE
, &ip_route_mask_label_cmd
);
844 install_element (CONFIG_NODE
, &ip_route_mask_tag_label_cmd
);
845 install_element (CONFIG_NODE
, &no_ip_route_label_cmd
);
846 install_element (CONFIG_NODE
, &no_ip_route_tag_label_cmd
);
847 install_element (CONFIG_NODE
, &no_ip_route_mask_label_cmd
);
848 install_element (CONFIG_NODE
, &no_ip_route_mask_tag_label_cmd
);
849 install_element (CONFIG_NODE
, &ip_route_distance_label_cmd
);
850 install_element (CONFIG_NODE
, &ip_route_tag_distance_label_cmd
);
851 install_element (CONFIG_NODE
, &ip_route_mask_distance_label_cmd
);
852 install_element (CONFIG_NODE
, &ip_route_mask_tag_distance_label_cmd
);
853 install_element (CONFIG_NODE
, &no_ip_route_distance_label_cmd
);
854 install_element (CONFIG_NODE
, &no_ip_route_tag_distance_label_cmd
);
855 install_element (CONFIG_NODE
, &no_ip_route_mask_distance_label_cmd
);
856 install_element (CONFIG_NODE
, &no_ip_route_mask_tag_distance_label_cmd
);
858 install_element (CONFIG_NODE
, &ipv6_route_label_cmd
);
859 install_element (CONFIG_NODE
, &ipv6_route_ifname_label_cmd
);
860 install_element (CONFIG_NODE
, &no_ipv6_route_label_cmd
);
861 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_label_cmd
);
862 install_element (CONFIG_NODE
, &ipv6_route_pref_label_cmd
);
863 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_label_cmd
);
864 install_element (CONFIG_NODE
, &no_ipv6_route_pref_label_cmd
);
865 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_label_cmd
);
866 install_element (CONFIG_NODE
, &ipv6_route_tag_label_cmd
);
867 install_element (CONFIG_NODE
, &ipv6_route_ifname_tag_label_cmd
);
868 install_element (CONFIG_NODE
, &ipv6_route_pref_tag_label_cmd
);
869 install_element (CONFIG_NODE
, &ipv6_route_ifname_pref_tag_label_cmd
);
870 install_element (CONFIG_NODE
, &no_ipv6_route_tag_label_cmd
);
871 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_tag_label_cmd
);
872 install_element (CONFIG_NODE
, &no_ipv6_route_pref_tag_label_cmd
);
873 install_element (CONFIG_NODE
, &no_ipv6_route_ifname_pref_tag_label_cmd
);
875 install_element (CONFIG_NODE
, &mpls_transit_lsp_cmd
);
876 install_element (CONFIG_NODE
, &no_mpls_transit_lsp_cmd
);
877 install_element (CONFIG_NODE
, &no_mpls_transit_lsp_out_label_cmd
);
878 install_element (CONFIG_NODE
, &no_mpls_transit_lsp_all_cmd
);
880 install_element (VIEW_NODE
, &show_mpls_table_cmd
);
881 install_element (VIEW_NODE
, &show_mpls_table_lsp_cmd
);