Commit 1ab553c8 authored by Eric Desrochers's avatar Eric Desrochers Committed by Juerg Haefliger

vxlan: correctly handle ipv6.disable module parameter

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

When IPv6 is compiled but disabled at runtime, __vxlan_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.

Fixes: b1be00a6 ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device")
Signed-off-by: default avatarJiri Benc <jbenc@redhat.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
(backported from commit d074bf96)
Signed-off-by: default avatarEric Desrochers <eric.desrochers@canonical.com>
Acked-by: default avatarStefan Bader <stefan.bader@canonical.com>
Signed-off-by: default avatarJuerg Haefliger <juergh@canonical.com>
parent 3194b1c2
...@@ -2947,17 +2947,21 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6) ...@@ -2947,17 +2947,21 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
static int vxlan_sock_add(struct vxlan_dev *vxlan) static int vxlan_sock_add(struct vxlan_dev *vxlan)
{ {
bool ipv6 = vxlan->flags & VXLAN_F_IPV6;
bool metadata = vxlan->flags & VXLAN_F_COLLECT_METADATA; bool metadata = vxlan->flags & VXLAN_F_COLLECT_METADATA;
bool ipv6 = vxlan->flags & VXLAN_F_IPV6 || metadata;
bool ipv4 = !ipv6 || metadata;
int ret = 0; int ret = 0;
vxlan->vn4_sock = NULL; vxlan->vn4_sock = NULL;
#if IS_ENABLED(CONFIG_IPV6) #if IS_ENABLED(CONFIG_IPV6)
vxlan->vn6_sock = NULL; vxlan->vn6_sock = NULL;
if (ipv6 || metadata) if (ipv6) {
ret = __vxlan_sock_add(vxlan, true); ret = __vxlan_sock_add(vxlan, true);
if (ret < 0 && ret != -EAFNOSUPPORT)
ipv4 = false;
}
#endif #endif
if (!ret && (!ipv6 || metadata)) if (ipv4)
ret = __vxlan_sock_add(vxlan, false); ret = __vxlan_sock_add(vxlan, false);
if (ret < 0) if (ret < 0)
vxlan_sock_release(vxlan); vxlan_sock_release(vxlan);
......
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