Patchwork [net] gre: add link local route when local addr is any

login
register
mail settings
Submitter Nicolas Dichtel
Date Feb. 17, 2014, 1:22 p.m.
Message ID <1392643341-4288-1-git-send-email-nicolas.dichtel@6wind.com>
Download mbox | patch
Permalink /patch/320962/
State Accepted
Delegated to: David Miller
Headers show

Comments

Nicolas Dichtel - Feb. 17, 2014, 1:22 p.m.
This bug was reported by Steinar H. Gunderson and was introduced by commit
f7cb8886335d ("sit/gre6: don't try to add the same route two times").

root@morgental:~# ip tunnel add foo mode gre remote 1.2.3.4 ttl 64
root@morgental:~# ip link set foo up mtu 1468
root@morgental:~# ip -6 route show dev foo
fe80::/64  proto kernel  metric 256

but after the above commit, no such route shows up.

There is no link local route because dev->dev_addr is 0 (because local ipv4
address is 0), hence no link local address is configured.

In this scenario, the link local address is added manually: 'ip -6 addr add
fe80::1 dev foo' and because prefix is /128, no link local route is added by the
kernel.

Even if the right things to do is to add the link local address with a /64
prefix, we need to restore the previous behavior to avoid breaking userpace.

Reported-by: Steinar H. Gunderson <sesse@samfundet.no>
Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>
---
 net/ipv6/addrconf.c | 2 ++
 1 file changed, 2 insertions(+)
David Miller - Feb. 17, 2014, 7:09 p.m.
From: Nicolas Dichtel <nicolas.dichtel@6wind.com>
Date: Mon, 17 Feb 2014 14:22:21 +0100

> This bug was reported by Steinar H. Gunderson and was introduced by commit
> f7cb8886335d ("sit/gre6: don't try to add the same route two times").
> 
> root@morgental:~# ip tunnel add foo mode gre remote 1.2.3.4 ttl 64
> root@morgental:~# ip link set foo up mtu 1468
> root@morgental:~# ip -6 route show dev foo
> fe80::/64  proto kernel  metric 256
> 
> but after the above commit, no such route shows up.
> 
> There is no link local route because dev->dev_addr is 0 (because local ipv4
> address is 0), hence no link local address is configured.
> 
> In this scenario, the link local address is added manually: 'ip -6 addr add
> fe80::1 dev foo' and because prefix is /128, no link local route is added by the
> kernel.
> 
> Even if the right things to do is to add the link local address with a /64
> prefix, we need to restore the previous behavior to avoid breaking userpace.
> 
> Reported-by: Steinar H. Gunderson <sesse@samfundet.no>
> Signed-off-by: Nicolas Dichtel <nicolas.dichtel@6wind.com>

Applied and queued up for -stable, thanks.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Patch

diff --git a/net/ipv6/addrconf.c b/net/ipv6/addrconf.c
index ad235690684c..fdbfeca36d63 100644
--- a/net/ipv6/addrconf.c
+++ b/net/ipv6/addrconf.c
@@ -2783,6 +2783,8 @@  static void addrconf_gre_config(struct net_device *dev)
 	ipv6_addr_set(&addr,  htonl(0xFE800000), 0, 0, 0);
 	if (!ipv6_generate_eui64(addr.s6_addr + 8, dev))
 		addrconf_add_linklocal(idev, &addr);
+	else
+		addrconf_prefix_route(&addr, 64, dev, 0, 0);
 }
 #endif