Skip to contentSkip to conversation

iptunnel: Allow GRE_KEY for vti interface

PATCH In review Hangbin Liu 2 participants 2 messages Dec 5, 2013 – Dec 28, 2013

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 iptunnel: Allow GRE_KEY for vti interface

The vti interface will use GRE_KEY to match the right policy in kernel. So we can not return fail when the tunnel is vti.

---
 ip/iptunnel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ip/iptunnel.c +2 -2
index 40186d3..950f984 100644
@@ -240,8 +240,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
 		}
 	}
 
-	if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {
-		if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
+	if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
+		if (!(p->i_flags & VTI_ISVTI) && (p->iph.protocol != IPPROTO_GRE)) {
 			fprintf(stderr, "Keys are not allowed with ipip and sit tunnels\n");
 			return -1;
 		}
Signature · 1 line
1.8.1.4
#1 lore raw
Quoted 13 lines · On Fri, 6 Dec 2013 00:19:01 +0800 Hangbin Liu <[email protected]> wrote:

The vti interface will use GRE_KEY to match the right policy in kernel. So we can not return fail when the tunnel is vti.

---
 ip/iptunnel.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
ip/iptunnel.c +0 -0
index 40186d3..950f984 100644

ip/iptunnel.c static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p) · line 247

Quoted 10 lines
ip/iptunnel.c +2 -2
@@ -240,8 +240,8 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
 		}
 	}
 
-	if (p->iph.protocol == IPPROTO_IPIP || p->iph.protocol == IPPROTO_IPV6) {
-		if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
+	if ((p->i_flags & GRE_KEY) || (p->o_flags & GRE_KEY)) {
+		if (!(p->i_flags & VTI_ISVTI) && (p->iph.protocol != IPPROTO_GRE)) {
 			fprintf(stderr, "Keys are not allowed with ipip and sit tunnels\n");
 			return -1;
 		}

Accepted. Hope this works for everyone