[PATCH][V2][SRU][X] vxlan: correctly handle ipv6.disable module parameter

classic Classic list List threaded Threaded
3 messages Options
Reply | Threaded
Open this post in threaded view
|

[PATCH][V2][SRU][X] vxlan: correctly handle ipv6.disable module parameter

Eric Desrochers
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: b1be00a6c39f ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device")
Signed-off-by: Jiri Benc <[hidden email]>
Signed-off-by: David S. Miller <[hidden email]>
(backported from commit d074bf9600443403aa24fbc12c1f18eadc90f5aa)
Signed-off-by: Eric Desrochers <[hidden email]>

---
 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 5bbe41e731ca..81c7d7f0ad46 100644
--- a/drivers/net/vxlan.c
+++ b/drivers/net/vxlan.c
@@ -2947,17 +2947,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;
 
  vxlan->vn4_sock = NULL;
 #if IS_ENABLED(CONFIG_IPV6)
  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);
--
2.17.0


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team
Reply | Threaded
Open this post in threaded view
|

ACK: [PATCH][V2][SRU][X] vxlan: correctly handle ipv6.disable module parameter

Stefan Bader-2
On 23.05.2018 05:56, Eric Desrochers wrote:

> 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: b1be00a6c39f ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device")
> Signed-off-by: Jiri Benc <[hidden email]>
> Signed-off-by: David S. Miller <[hidden email]>
> (backported from commit d074bf9600443403aa24fbc12c1f18eadc90f5aa)
> Signed-off-by: Eric Desrochers <[hidden email]>
Acked-by: Stefan Bader <[hidden email]>

>
> ---
>  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 5bbe41e731ca..81c7d7f0ad46 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2947,17 +2947,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;
>  
>   vxlan->vn4_sock = NULL;
>  #if IS_ENABLED(CONFIG_IPV6)
>   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);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (836 bytes) Download Attachment
Reply | Threaded
Open this post in threaded view
|

ACK/APPLIED: [PATCH][V2][SRU][X] vxlan: correctly handle ipv6.disable module parameter

Juerg Haefliger
In reply to this post by Eric Desrochers
On 05/23/2018 02:56 PM, Eric Desrochers wrote:

> 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: b1be00a6c39f ("vxlan: support both IPv4 and IPv6 sockets in a single vxlan device")
> Signed-off-by: Jiri Benc <[hidden email]>
> Signed-off-by: David S. Miller <[hidden email]>
> (backported from commit d074bf9600443403aa24fbc12c1f18eadc90f5aa)
> Signed-off-by: Eric Desrochers <[hidden email]>
Acked-by: Juerg Haefliger <[hidden email]>

Applied to xenial/master-next.

...Juerg

> ---
>  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 5bbe41e731ca..81c7d7f0ad46 100644
> --- a/drivers/net/vxlan.c
> +++ b/drivers/net/vxlan.c
> @@ -2947,17 +2947,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;
>  
>   vxlan->vn4_sock = NULL;
>  #if IS_ENABLED(CONFIG_IPV6)
>   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);
>


--
kernel-team mailing list
[hidden email]
https://lists.ubuntu.com/mailman/listinfo/kernel-team

signature.asc (849 bytes) Download Attachment