All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH iproute2 resend] Fix changing tunnel remote and local address to any
@ 2015-06-04 12:01 Thadeu Lima de Souza Cascardo
  2015-06-08  8:51 ` Nicolas Dichtel
  0 siblings, 1 reply; 3+ messages in thread
From: Thadeu Lima de Souza Cascardo @ 2015-06-04 12:01 UTC (permalink / raw)
  To: netdev; +Cc: stephen

If a tunnel is created with a local address, you can't change it to any.

 # ip tunnel add tunl1 mode ipip remote 10.16.42.37 local 10.16.42.214 ttl 64
 # ip tunnel show tunl1
 tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
 # ip tunnel change tunl1 local any
 # echo $?
 0
 # ip tunnel show tunl1
 tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64

It happens that parse_args zeroes ip_tunnel_parm, and when creating the
tunnel, it is OK to leave it as is if the address is any. However, when
changing the tunnel, the current parameters will be read from
ip_tunnel_parm, and local and remote address won't be zeroes anymore, so
it needs to be explicitly set to any.

Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
---

Resending because it was probably lost in patchwork.

---
 ip/iptunnel.c | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/ip/iptunnel.c b/ip/iptunnel.c
index be84b83..78fa988 100644
--- a/ip/iptunnel.c
+++ b/ip/iptunnel.c
@@ -167,10 +167,14 @@ static int parse_args(int argc, char **argv, int cmd, struct ip_tunnel_parm *p)
 			NEXT_ARG();
 			if (strcmp(*argv, "any"))
 				p->iph.daddr = get_addr32(*argv);
+			else
+				p->iph.daddr = htonl(INADDR_ANY);
 		} else if (strcmp(*argv, "local") == 0) {
 			NEXT_ARG();
 			if (strcmp(*argv, "any"))
 				p->iph.saddr = get_addr32(*argv);
+			else
+				p->iph.saddr = htonl(INADDR_ANY);
 		} else if (strcmp(*argv, "dev") == 0) {
 			NEXT_ARG();
 			strncpy(medium, *argv, IFNAMSIZ-1);
-- 
2.4.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 resend] Fix changing tunnel remote and local address to any
  2015-06-04 12:01 [PATCH iproute2 resend] Fix changing tunnel remote and local address to any Thadeu Lima de Souza Cascardo
@ 2015-06-08  8:51 ` Nicolas Dichtel
  2015-06-25 12:46   ` Stephen Hemminger
  0 siblings, 1 reply; 3+ messages in thread
From: Nicolas Dichtel @ 2015-06-08  8:51 UTC (permalink / raw)
  To: Thadeu Lima de Souza Cascardo, netdev; +Cc: stephen

Le 04/06/2015 14:01, Thadeu Lima de Souza Cascardo a écrit :
> If a tunnel is created with a local address, you can't change it to any.
>
>   # ip tunnel add tunl1 mode ipip remote 10.16.42.37 local 10.16.42.214 ttl 64
>   # ip tunnel show tunl1
>   tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
>   # ip tunnel change tunl1 local any
>   # echo $?
>   0
>   # ip tunnel show tunl1
>   tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
>
> It happens that parse_args zeroes ip_tunnel_parm, and when creating the
> tunnel, it is OK to leave it as is if the address is any. However, when
> changing the tunnel, the current parameters will be read from
> ip_tunnel_parm, and local and remote address won't be zeroes anymore, so
> it needs to be explicitly set to any.
>
> Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH iproute2 resend] Fix changing tunnel remote and local address to any
  2015-06-08  8:51 ` Nicolas Dichtel
@ 2015-06-25 12:46   ` Stephen Hemminger
  0 siblings, 0 replies; 3+ messages in thread
From: Stephen Hemminger @ 2015-06-25 12:46 UTC (permalink / raw)
  To: Nicolas Dichtel; +Cc: Thadeu Lima de Souza Cascardo, netdev

On Mon, 08 Jun 2015 10:51:51 +0200
Nicolas Dichtel <nicolas.dichtel@6wind.com> wrote:

> Le 04/06/2015 14:01, Thadeu Lima de Souza Cascardo a écrit :
> > If a tunnel is created with a local address, you can't change it to any.
> >
> >   # ip tunnel add tunl1 mode ipip remote 10.16.42.37 local 10.16.42.214 ttl 64
> >   # ip tunnel show tunl1
> >   tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
> >   # ip tunnel change tunl1 local any
> >   # echo $?
> >   0
> >   # ip tunnel show tunl1
> >   tunl1: ip/ip  remote 10.16.42.37  local 10.16.42.214  ttl 64
> >
> > It happens that parse_args zeroes ip_tunnel_parm, and when creating the
> > tunnel, it is OK to leave it as is if the address is any. However, when
> > changing the tunnel, the current parameters will be read from
> > ip_tunnel_parm, and local and remote address won't be zeroes anymore, so
> > it needs to be explicitly set to any.
> >
> > Signed-off-by: Thadeu Lima de Souza Cascardo <cascardo@redhat.com>
> Acked-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied.

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2015-06-25 12:46 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-06-04 12:01 [PATCH iproute2 resend] Fix changing tunnel remote and local address to any Thadeu Lima de Souza Cascardo
2015-06-08  8:51 ` Nicolas Dichtel
2015-06-25 12:46   ` Stephen Hemminger

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.