Commit e6f88b95 authored by Jiri Benc's avatar Jiri Benc Committed by Kleber Sacilotto de Souza

geneve: correctly handle ipv6.disable module parameter

BugLink: https://bugs.launchpad.net/bugs/1794232

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 d074bf96 ("vxlan: correctly
handle ipv6.disable module parameter") is doing for vxlan.

Note there's also commit c0a47e44 ("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: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
(backported from commit cf1c9ccb)
[ niv: infra.mode omitted and remote.sa.sa_family == AF_INET6
  check retained to avoid pulling in lot of new infrastructure ]
Signed-off-by: default avatarNivedita Singhvi <nivedita.singhvi@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Acked-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
Signed-off-by: default avatarKleber Sacilotto de Souza <kleber.souza@canonical.com>
parent aa1acf59
......@@ -627,15 +627,19 @@ static int geneve_open(struct net_device *dev)
struct geneve_dev *geneve = netdev_priv(dev);
bool ipv6 = geneve->remote.sa.sa_family == AF_INET6;
bool metadata = geneve->collect_md;
bool ipv4 = !ipv6 || metadata;
int ret = 0;
geneve->sock4 = NULL;
#if IS_ENABLED(CONFIG_IPV6)
geneve->sock6 = NULL;
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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment