Skip to content

Commit d074bf9

Browse files
Jiri Bencdavem330
authored andcommitted
vxlan: correctly handle ipv6.disable module parameter
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: b1be00a ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device") Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 90a1bb9 commit d074bf9

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

drivers/net/vxlan.c

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2822,17 +2822,21 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
28222822

28232823
static int vxlan_sock_add(struct vxlan_dev *vxlan)
28242824
{
2825-
bool ipv6 = vxlan->flags & VXLAN_F_IPV6;
28262825
bool metadata = vxlan->flags & VXLAN_F_COLLECT_METADATA;
2826+
bool ipv6 = vxlan->flags & VXLAN_F_IPV6 || metadata;
2827+
bool ipv4 = !ipv6 || metadata;
28272828
int ret = 0;
28282829

28292830
RCU_INIT_POINTER(vxlan->vn4_sock, NULL);
28302831
#if IS_ENABLED(CONFIG_IPV6)
28312832
RCU_INIT_POINTER(vxlan->vn6_sock, NULL);
2832-
if (ipv6 || metadata)
2833+
if (ipv6) {
28332834
ret = __vxlan_sock_add(vxlan, true);
2835+
if (ret < 0 && ret != -EAFNOSUPPORT)
2836+
ipv4 = false;
2837+
}
28342838
#endif
2835-
if (!ret && (!ipv6 || metadata))
2839+
if (ipv4)
28362840
ret = __vxlan_sock_add(vxlan, false);
28372841
if (ret < 0)
28382842
vxlan_sock_release(vxlan);

0 commit comments

Comments
 (0)