diff mbox

[ovs-dev] datapath: backport: vxlan: correctly handle ipv6.disable module parameter

Message ID 1493766504-32719-1-git-send-email-pshelar@ovn.org
State Accepted
Headers show

Commit Message

Pravin Shelar May 2, 2017, 11:08 p.m. UTC
From: Jiri Benc <jbenc@redhat.com>

upstream commit:
    commit d074bf9600443403aa24fbc12c1f18eadc90f5aa
    Author: Jiri Benc <jbenc@redhat.com>
    Date:   Thu Apr 27 21:24:35 2017 +0200

    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: b1be00a6c39f ("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>

Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
---
 datapath/linux/compat/vxlan.c | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)

Comments

Joe Stringer May 3, 2017, 6:10 p.m. UTC | #1
On 2 May 2017 at 16:08, Pravin B Shelar <pshelar@ovn.org> wrote:
> From: Jiri Benc <jbenc@redhat.com>
>
> upstream commit:
>     commit d074bf9600443403aa24fbc12c1f18eadc90f5aa
>     Author: Jiri Benc <jbenc@redhat.com>
>     Date:   Thu Apr 27 21:24:35 2017 +0200
>
>     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: b1be00a6c39f ("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>
>
> Signed-off-by: Pravin B Shelar <pshelar@ovn.org>

Thanks!

Acked-by: Joe Stringer <joe@ovn.org>
Pravin Shelar May 4, 2017, 2:08 a.m. UTC | #2
On Wed, May 3, 2017 at 11:10 AM, Joe Stringer <joe@ovn.org> wrote:
> On 2 May 2017 at 16:08, Pravin B Shelar <pshelar@ovn.org> wrote:
>> From: Jiri Benc <jbenc@redhat.com>
>>
>> upstream commit:
>>     commit d074bf9600443403aa24fbc12c1f18eadc90f5aa
>>     Author: Jiri Benc <jbenc@redhat.com>
>>     Date:   Thu Apr 27 21:24:35 2017 +0200
>>
>>     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: b1be00a6c39f ("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>
>>
>> Signed-off-by: Pravin B Shelar <pshelar@ovn.org>
>
> Thanks!
>
> Acked-by: Joe Stringer <joe@ovn.org>

Thanks. I pushed patch to master and branch 2.6 and 2.7.
I have also sent out second patch from same upstream patch series to
keep error msg consistent with upstream vxlan module.
diff mbox

Patch

diff --git a/datapath/linux/compat/vxlan.c b/datapath/linux/compat/vxlan.c
index 186554e..50126ec 100644
--- a/datapath/linux/compat/vxlan.c
+++ b/datapath/linux/compat/vxlan.c
@@ -1808,17 +1808,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);