diff options
author | Jiri Benc <jbenc@redhat.com> | 2019-02-28 16:56:04 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2019-03-10 09:17:17 +0300 |
commit | 36bd44bcb4b2fef0f1fabc28c4f99f3098ab2cbd (patch) | |
tree | 6e10ddead9a2fafd1a568f004fbefd63f2f40722 /drivers | |
parent | 1713c8e18b44de3b9df3e69e0181b3b896280032 (diff) | |
download | linux-36bd44bcb4b2fef0f1fabc28c4f99f3098ab2cbd.tar.xz |
geneve: correctly handle ipv6.disable module parameter
[ Upstream commit cf1c9ccba7308e48a68fa77f476287d9d614e4c7 ]
When IPv6 is compiled but disabled at runtime, geneve_sock_add returns
-EAFNOSUPPORT. For metadata based tunnels, this causes failure of the whole
operation of bringing up the tunnel.
Ignore failure of IPv6 socket creation for metadata based tunnels caused by
IPv6 not being available.
This is the same fix as what commit d074bf960044 ("vxlan: correctly handle
ipv6.disable module parameter") is doing for vxlan.
Note there's also commit c0a47e44c098 ("geneve: should not call rt6_lookup()
when ipv6 was disabled") which fixes a similar issue but for regular
tunnels, while this patch is needed for metadata based tunnels.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/net/geneve.c | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c index 01711e6e9a39..e1427b56a073 100644 --- a/drivers/net/geneve.c +++ b/drivers/net/geneve.c @@ -636,15 +636,20 @@ out: static int geneve_open(struct net_device *dev) { struct geneve_dev *geneve = netdev_priv(dev); - bool ipv6 = !!(geneve->info.mode & IP_TUNNEL_INFO_IPV6); bool metadata = geneve->collect_md; + bool ipv4, ipv6; int ret = 0; + ipv6 = geneve->info.mode & IP_TUNNEL_INFO_IPV6 || metadata; + ipv4 = !ipv6 || metadata; #if IS_ENABLED(CONFIG_IPV6) - if (ipv6 || metadata) + if (ipv6) { ret = geneve_sock_add(geneve, true); + if (ret < 0 && ret != -EAFNOSUPPORT) + ipv4 = false; + } #endif - if (!ret && (!ipv6 || metadata)) + if (ipv4) ret = geneve_sock_add(geneve, false); if (ret < 0) geneve_sock_release(geneve); |