* [PATCH net 1/2] vxlan: correctly handle ipv6.disable module parameter
2017-04-27 19:24 [PATCH net 0/2] vxlan: do not error out on disabled IPv6 Jiri Benc
@ 2017-04-27 19:24 ` Jiri Benc
2017-04-27 19:24 ` [PATCH net 2/2] vxlan: do not output confusing error message Jiri Benc
2017-05-01 2:30 ` [PATCH net 0/2] vxlan: do not error out on disabled IPv6 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2017-04-27 19:24 UTC (permalink / raw)
To: netdev; +Cc: Marcelo Ricardo Leitner
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: b1be00a6c39f ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device")
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
drivers/net/vxlan.c | 10 +++++++---
1 file changed, 7 insertions(+), 3 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index bdb6ae16d4a8..118e508f1889 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2818,17 +2818,21 @@ static int __vxlan_sock_add(struct vxlan_dev *vxlan, bool ipv6)
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 ipv6 = vxlan->flags & VXLAN_F_IPV6 || metadata;
+ bool ipv4 = !ipv6 || metadata;
int ret = 0;
RCU_INIT_POINTER(vxlan->vn4_sock, NULL);
#if IS_ENABLED(CONFIG_IPV6)
RCU_INIT_POINTER(vxlan->vn6_sock, NULL);
- if (ipv6 || metadata)
+ if (ipv6) {
ret = __vxlan_sock_add(vxlan, true);
+ if (ret < 0 && ret != -EAFNOSUPPORT)
+ ipv4 = false;
+ }
#endif
- if (!ret && (!ipv6 || metadata))
+ if (ipv4)
ret = __vxlan_sock_add(vxlan, false);
if (ret < 0)
vxlan_sock_release(vxlan);
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH net 2/2] vxlan: do not output confusing error message
2017-04-27 19:24 [PATCH net 0/2] vxlan: do not error out on disabled IPv6 Jiri Benc
2017-04-27 19:24 ` [PATCH net 1/2] vxlan: correctly handle ipv6.disable module parameter Jiri Benc
@ 2017-04-27 19:24 ` Jiri Benc
2017-05-01 2:30 ` [PATCH net 0/2] vxlan: do not error out on disabled IPv6 David Miller
2 siblings, 0 replies; 4+ messages in thread
From: Jiri Benc @ 2017-04-27 19:24 UTC (permalink / raw)
To: netdev; +Cc: Marcelo Ricardo Leitner
The message "Cannot bind port X, err=Y" creates only confusion. In metadata
based mode, failure of IPv6 socket creation is okay if IPv6 is disabled and
no error message should be printed. But when IPv6 tunnel was requested, such
failure is fatal. The vxlan_socket_create does not know when the error is
harmless and when it's not.
Instead of passing such information down to vxlan_socket_create, remove the
message completely. It's not useful. We propagate the error code up to the
user space and the port number comes from the user space. There's nothing in
the message that the process creating vxlan interface does not know.
Signed-off-by: Jiri Benc <jbenc@redhat.com>
---
drivers/net/vxlan.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/drivers/net/vxlan.c b/drivers/net/vxlan.c
index 118e508f1889..27cba699d83a 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2754,8 +2754,6 @@ static struct vxlan_sock *vxlan_socket_create(struct net *net, bool ipv6,
sock = vxlan_create_sock(net, ipv6, port, flags);
if (IS_ERR(sock)) {
- pr_info("Cannot bind port %d, err=%ld\n", ntohs(port),
- PTR_ERR(sock));
kfree(vs);
return ERR_CAST(sock);
}
--
1.8.3.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH net 0/2] vxlan: do not error out on disabled IPv6
2017-04-27 19:24 [PATCH net 0/2] vxlan: do not error out on disabled IPv6 Jiri Benc
2017-04-27 19:24 ` [PATCH net 1/2] vxlan: correctly handle ipv6.disable module parameter Jiri Benc
2017-04-27 19:24 ` [PATCH net 2/2] vxlan: do not output confusing error message Jiri Benc
@ 2017-05-01 2:30 ` David Miller
2 siblings, 0 replies; 4+ messages in thread
From: David Miller @ 2017-05-01 2:30 UTC (permalink / raw)
To: jbenc; +Cc: netdev, mleitner
From: Jiri Benc <jbenc@redhat.com>
Date: Thu, 27 Apr 2017 21:24:34 +0200
> This patchset fixes a bug with metadata based tunnels when booted with
> ipv6.disable=1.
Series applied, thanks.
^ permalink raw reply [flat|nested] 4+ messages in thread