]> git.ipfire.org Git - thirdparty/iproute2.git/commitdiff
iptunnel: add support for mpls/ip to sit tunnels
authorKrister Johansen <kjlx@templeofstupid.com>
Sat, 10 Jun 2017 01:31:31 +0000 (18:31 -0700)
committerStephen Hemminger <stephen@networkplumber.org>
Wed, 5 Jul 2017 16:04:59 +0000 (09:04 -0700)
Original-Author: Simon Horman <simon.horman@netronome.com>
Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
include/utils.h
ip/link_iptnl.c
ip/tunnel.c
man/man8/ip-link.8.in

index 915c82e97a00c696777691a6248915d0d485c0ab..6080b962fb41114ababb505104978a980a11ae65 100644 (file)
@@ -74,6 +74,9 @@ struct ipx_addr {
 #ifndef AF_MPLS
 # define AF_MPLS 28
 #endif
+#ifndef IPPROTO_MPLS
+#define IPPROTO_MPLS   137
+#endif
 
 __u32 get_addr32(const char *name);
 int get_addr_1(inet_prefix *dst, const char *arg, int family);
index 2f74d9b7df1a0f1291419a4b4ddf0c4e143bd8c3..cf3a9ef4cf4862c715d7ea013ee3d6defddca2fa 100644 (file)
@@ -16,6 +16,7 @@
 #include <sys/socket.h>
 #include <arpa/inet.h>
 
+#include <linux/in.h>
 #include <linux/ip.h>
 #include <linux/if_tunnel.h>
 #include "rt_names.h"
@@ -47,9 +48,8 @@ static void print_usage(FILE *f, int sit)
                type
        );
        if (sit) {
-               fprintf(f,
-                       "                [ mode { ip6ip | ipip | any } ]\n"
-                       "                [ isatap ]\n");
+               fprintf(f, "          [ mode { ip6ip | ipip | mplsip | any } ]\n");
+               fprintf(f, "          [ isatap ]\n");
        }
        fprintf(f, "                [ external ]\n");
        fprintf(f, "                [ fwmark MARK ]\n");
@@ -243,6 +243,9 @@ get_failed:
                                 strcmp(*argv, "ipip") == 0 ||
                                 strcmp(*argv, "ip4ip4") == 0)
                                proto = IPPROTO_IPIP;
+                       else if (strcmp(*argv, "mpls/ipv4") == 0 ||
+                                  strcmp(*argv, "mplsip") == 0)
+                               proto = IPPROTO_MPLS;
                        else if (strcmp(*argv, "any/ipv4") == 0 ||
                                 strcmp(*argv, "any") == 0)
                                proto = 0;
index 7956d71aa7334fbe94fb3d7a24f112ef23280bfb..d359eb958a6c6796b530eec47e4dda74c7a0baac 100644 (file)
@@ -54,6 +54,9 @@ const char *tnl_strproto(__u8 proto)
        case IPPROTO_ESP:
                strcpy(buf, "esp");
                break;
+       case IPPROTO_MPLS:
+               strcpy(buf, "mpls");
+               break;
        case 0:
                strcpy(buf, "any");
                break;
index 3cc2f5dcdac314ea50e690b21ce074b3c5f20722..994b539e343ec57701f32b1ef24cffc17fe112e5 100644 (file)
@@ -662,7 +662,7 @@ the following additional arguments are supported:
 ] [
 .I " [no]encap-remcsum "
 ] [
-.I " mode " { ip6ip | ipip | any } "
+.I " mode " { ip6ip | ipip | mplsip | any } "
 ]
 
 .in +8
@@ -700,10 +700,11 @@ encapsulation.
 applicable for Generic UDP Encapsulation.
 
 .sp
-.BI mode " { ip6ip | ipip | any } "
+.BI mode " { ip6ip | ipip | mplsip | any } "
 - specifies mode in which device should run. "ip6ip" indicates
-IPv6-Over-IPv4, "ipip" indicates "IPv4-Over-IPv4", "any" indicates either
-IPv6 or IPv4 Over IPv4. Only supported for SIT where the default is "ip6ip".
+IPv6-Over-IPv4, "ipip" indicates "IPv4-Over-IPv4", "mplsip" indicates
+MPLS-Over-IPv4, "any" indicates IPv6, IPv4 or MPLS Over IPv4. Only
+supported for SIT where the default is "ip6ip".
 
 .in -8