summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichele Marchetto <michele@cvs.openbsd.org>2009-01-29 11:21:35 +0000
committerMichele Marchetto <michele@cvs.openbsd.org>2009-01-29 11:21:35 +0000
commitf5f79c1f8e5a4e6c393e030d179bc215aa19d183 (patch)
tree66242dd6823fa416d28807f3011a5c012f6a35a7
parent9aabf5f46abf81e915eaf37ca0f69baf6f7c0edd (diff)
Introduce -mplslabel to allow ipv4/ipv6 packets enter MPLS clouds.
This is also consistent with mplslabel in ifconfig(8). OK claudio@ laurent@
-rw-r--r--sbin/route/keywords.h4
-rw-r--r--sbin/route/route.c13
2 files changed, 15 insertions, 2 deletions
diff --git a/sbin/route/keywords.h b/sbin/route/keywords.h
index 3793352c3cc..cd1f39c0cfb 100644
--- a/sbin/route/keywords.h
+++ b/sbin/route/keywords.h
@@ -1,4 +1,4 @@
-/* $OpenBSD: keywords.h,v 1.23 2008/05/07 06:06:25 claudio Exp $ */
+/* $OpenBSD: keywords.h,v 1.24 2009/01/29 11:21:34 michele Exp $ */
/* WARNING! This file was generated by keywords.sh */
@@ -39,6 +39,7 @@ enum {
K_MONITOR,
K_MPATH,
K_MPLS,
+ K_MPLSLABEL,
K_MTU,
K_NET,
K_NETMASK,
@@ -95,6 +96,7 @@ struct keytab keywords[] = {
{ "monitor", K_MONITOR },
{ "mpath", K_MPATH },
{ "mpls", K_MPLS },
+ { "mplslabel", K_MPLSLABEL },
{ "mtu", K_MTU },
{ "net", K_NET },
{ "netmask", K_NETMASK },
diff --git a/sbin/route/route.c b/sbin/route/route.c
index 97e644c076f..892976550ec 100644
--- a/sbin/route/route.c
+++ b/sbin/route/route.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: route.c,v 1.125 2009/01/28 22:19:53 michele Exp $ */
+/* $OpenBSD: route.c,v 1.126 2009/01/29 11:21:34 michele Exp $ */
/* $NetBSD: route.c,v 1.16 1996/04/15 18:27:05 cgd Exp $ */
/*
@@ -383,6 +383,15 @@ newroute(int argc, char **argv)
af = AF_MPLS;
aflen = sizeof(struct sockaddr_mpls);
break;
+ case K_MPLSLABEL:
+ if (!--argc)
+ usage(1+*argv);
+ if (af != AF_INET && af != AF_INET6)
+ errx(1, "-mplslabel requires "
+ "-inet or -inet6");
+ getmplslabel(*++argv, 0);
+ flags |= MPLS_OP_PUSH;
+ break;
case K_IN:
if (!--argc)
usage(1+*argv);
@@ -393,6 +402,8 @@ newroute(int argc, char **argv)
case K_OUT:
if (!--argc)
usage(1+*argv);
+ if (af != AF_MPLS)
+ errx(1, "-in requires -mpls");
getmplslabel(*++argv, 0);
break;
case K_POP: