naccyde / rpms / iproute

Forked from rpms/iproute 7 months ago
Clone

Blame SOURCES/iproute2-3.10.0-Fix-changing-tunnel-remote-and-local-address-to-any.patch

a4b897
From b45db2060837990b05d2f8da28c1ba0217011439 Mon Sep 17 00:00:00 2001
a4b897
From: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
a4b897
Date: Thu, 4 Jun 2015 09:01:18 -0300
a4b897
Subject: [PATCH] Fix changing tunnel remote and local address to any
a4b897
a4b897
If a tunnel is created with a local address, you can't change it to any.
a4b897
a4b897
 # ip tunnel add tunl1 mode ipip remote 10.16.42.37 local 10.16.42.214 ttl 64
a4b897
 # ip tunnel show tunl1
a4b897
 tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
a4b897
 # ip tunnel change tunl1 local any
a4b897
 # echo $?
a4b897
 0
a4b897
 # ip tunnel show tunl1
a4b897
 tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
a4b897
a4b897
It happens that parse_args zeroes ip_tunnel_parm, and when creating the
a4b897
tunnel, it is OK to leave it as is if the address is any. However, when
a4b897
changing the tunnel, the current parameters will be read from
a4b897
ip_tunnel_parm, and local and remote address won't be zeroes anymore, so
a4b897
it needs to be explicitly set to any.
a4b897
a4b897
Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
a4b897
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
a4b897
(cherry picked from commit 4e4b78324f1dbcee590c01a7ac3e5ebaf20daa27)
a4b897
---
a4b897
 ip/iptunnel.c | 4 ++++
a4b897
 1 file changed, 4 insertions(+)
a4b897
a4b897
diff --git a/ip/iptunnel.c b/ip/iptunnel.c
a4b897
index 43f8585..4c9c429 100644
a4b897
--- a/ip/iptunnel.c
a4b897
+++ b/ip/iptunnel.c
a4b897
@@ -167,10 +167,14 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
a4b897
 			NEXT_ARG();
a4b897
 			if (strcmp(*argv, "any"))
a4b897
 				p->iph.daddr = get_addr32(*argv);
a4b897
+			else
a4b897
+				p->iph.daddr = htonl(INADDR_ANY);
a4b897
 		} else if (strcmp(*argv, "local") == 0) {
a4b897
 			NEXT_ARG();
a4b897
 			if (strcmp(*argv, "any"))
a4b897
 				p->iph.saddr = get_addr32(*argv);
a4b897
+			else
a4b897
+				p->iph.saddr = htonl(INADDR_ANY);
a4b897
 		} else if (strcmp(*argv, "dev") == 0) {
a4b897
 			NEXT_ARG();
a4b897
 			strncpy(medium, *argv, IFNAMSIZ-1);
a4b897
-- 
a4b897
1.8.3.1
a4b897