lkml.org 
[lkml]   [2018]   [Mar]   [23]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    From
    Subject[PATCH 4.9 108/177] vxlan: correctly handle ipv6.disable module parameter
    Date
    4.9-stable review patch.  If anyone has any objections, please let me know.

    ------------------

    From: Jiri Benc <jbenc@redhat.com>


    [ Upstream commit d074bf9600443403aa24fbc12c1f18eadc90f5aa ]

    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: Sasha Levin <alexander.levin@microsoft.com>
    Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    ---
    drivers/net/vxlan.c | 10 +++++++---
    1 file changed, 7 insertions(+), 3 deletions(-)

    --- a/drivers/net/vxlan.c
    +++ b/drivers/net/vxlan.c
    @@ -2816,17 +2816,21 @@ static int __vxlan_sock_add(struct 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 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);

    \
     
     \ /
      Last update: 2018-03-23 12:16    [W:4.231 / U:0.056 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site