iptunnel: add support for mpls/ip to ipip tunnels
Original-Author: Simon Horman <simon.horman@netronome.com> Signed-off-by: Krister Johansen <kjlx@templeofstupid.com>
This commit is contained in:
parent
f005b700cf
commit
288c28bc11
|
|
@ -50,6 +50,8 @@ static void print_usage(FILE *f, int sit)
|
|||
if (sit) {
|
||||
fprintf(f, " [ mode { ip6ip | ipip | mplsip | any } ]\n");
|
||||
fprintf(f, " [ isatap ]\n");
|
||||
} else {
|
||||
fprintf(f, " [ mode { ipip | mplsip | any } ]\n");
|
||||
}
|
||||
fprintf(f, " [ external ]\n");
|
||||
fprintf(f, " [ fwmark MARK ]\n");
|
||||
|
|
@ -251,6 +253,21 @@ get_failed:
|
|||
proto = 0;
|
||||
else
|
||||
invarg("Cannot guess tunnel mode.", *argv);
|
||||
} else if (strcmp(lu->id, "ipip") == 0 &&
|
||||
strcmp(*argv, "mode") == 0) {
|
||||
NEXT_ARG();
|
||||
if (strcmp(*argv, "ipv4/ipv4") == 0 ||
|
||||
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;
|
||||
else
|
||||
invarg("Cannot guess tunnel mode.", *argv);
|
||||
} else if (strcmp(*argv, "noencap") == 0) {
|
||||
encaptype = TUNNEL_ENCAP_NONE;
|
||||
} else if (strcmp(*argv, "encap") == 0) {
|
||||
|
|
@ -343,9 +360,11 @@ get_failed:
|
|||
addattr16(n, 1024, IFLA_IPTUN_ENCAP_SPORT, htons(encapsport));
|
||||
addattr16(n, 1024, IFLA_IPTUN_ENCAP_DPORT, htons(encapdport));
|
||||
|
||||
if (strcmp(lu->id, "ipip") == 0 || strcmp(lu->id, "sit") == 0)
|
||||
addattr8(n, 1024, IFLA_IPTUN_PROTO, proto);
|
||||
|
||||
if (strcmp(lu->id, "sit") == 0) {
|
||||
addattr16(n, 1024, IFLA_IPTUN_FLAGS, iflags);
|
||||
addattr8(n, 1024, IFLA_IPTUN_PROTO, proto);
|
||||
if (ip6rdprefixlen) {
|
||||
addattr_l(n, 1024, IFLA_IPTUN_6RD_PREFIX,
|
||||
&ip6rdprefix, sizeof(ip6rdprefix));
|
||||
|
|
|
|||
|
|
@ -703,8 +703,9 @@ applicable for Generic UDP Encapsulation.
|
|||
.BI mode " { ip6ip | ipip | mplsip | any } "
|
||||
- specifies mode in which device should run. "ip6ip" indicates
|
||||
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".
|
||||
MPLS-Over-IPv4, "any" indicates IPv6, IPv4 or MPLS Over IPv4. Supported for
|
||||
SIT where the default is "ip6ip" and IPIP where the default is "ipip".
|
||||
IPv6-Over-IPv4 is not supported for IPIP.
|
||||
|
||||
.in -8
|
||||
|
||||
|
|
|
|||
Loading…
Reference in New Issue