* [PATCH net] geneve: correctly handle ipv6.disable module parameter
@ 2019-02-28 13:56 Jiri Benc
2019-03-02 6:08 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Jiri Benc @ 2019-02-28 13:56 UTC (permalink / raw)
To: netdev
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>
---
drivers/net/geneve.c | 11 ++++++++---
1 file changed, 8 insertions(+), 3 deletions(-)
diff --git a/drivers/net/geneve.c b/drivers/net/geneve.c
index 3377ac66a347..5583d993480d 100644
--- a/drivers/net/geneve.c
+++ b/drivers/net/geneve.c
@@ -692,15 +692,20 @@ static int geneve_sock_add(struct geneve_dev *geneve, bool ipv6)
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);
--
2.18.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] geneve: correctly handle ipv6.disable module parameter
2019-02-28 13:56 [PATCH net] geneve: correctly handle ipv6.disable module parameter Jiri Benc
@ 2019-03-02 6:08 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2019-03-02 6:08 UTC (permalink / raw)
To: jbenc; +Cc: netdev
From: Jiri Benc <jbenc@redhat.com>
Date: Thu, 28 Feb 2019 14:56:04 +0100
> 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>
Applied and queued up for -stable, thanks Jiri.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2019-03-02 6:08 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2019-02-28 13:56 [PATCH net] geneve: correctly handle ipv6.disable module parameter Jiri Benc
2019-03-02 6:08 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).