From patchwork Wed May 23 12:56:41 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Eric Desrochers X-Patchwork-Id: 919027 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (mailfrom) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 40rXbB1zhrz9s16; Wed, 23 May 2018 22:56:54 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1fLTJv-0008AW-K1; Wed, 23 May 2018 12:56:47 +0000 Received: from youngberry.canonical.com ([91.189.89.112]) by huckleberry.canonical.com with esmtps (TLS1.0:DHE_RSA_AES_128_CBC_SHA1:128) (Exim 4.86_2) (envelope-from ) id 1fLTJt-0008AP-Qn for kernel-team@lists.ubuntu.com; Wed, 23 May 2018 12:56:45 +0000 Received: from mail-qt0-f198.google.com ([209.85.216.198]) by youngberry.canonical.com with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.76) (envelope-from ) id 1fLTJt-0004jJ-GG for kernel-team@lists.ubuntu.com; Wed, 23 May 2018 12:56:45 +0000 Received: by mail-qt0-f198.google.com with SMTP id x2-v6so20905996qto.10 for ; Wed, 23 May 2018 05:56:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id; bh=Mmd6B3F5chi2YzCb05FgDLIpXQNUjMoR6ri0qnMCPZU=; b=qTD/LNiicjdp68q8/a+V7DySLZYFRLI6TwtSbj4L7WphPT2jZKqGKS1P0Rhjx+H1lx 3Kq2EMmdaWWdBdTofc/OVEQC89SUmL1Eck/5+3ECLxrCjzVZ+XhW15svMo8nir+qsAVy fIIO2ZM2dixgBrj/03OBcpiOKZUnJCqz1Qu6sqtndL/8VXa5mQBaHVbJFBsFZD04TqE0 ISwtOK/fEv7rXer34FR2KSm9ozkiyTUQ0KNeDhLw4X53Tk7dyBTIpIkgsGSwMz/rf245 T13a+LSKdR3JDBK5M9kbI+2X/PJ9yeUFVSOfgcMHn6yd03/yYFORJJSfEy1Q2oLQovKQ QZyA== X-Gm-Message-State: ALKqPwcto+1jrIN8oFHsb8vIoH/XZ3XEEcqT4NHoknjk/FiOwLhDivrl OkvMpSUiou4LC4TaAakJIEiCdWRVw8fpEJ0tobG26aIczPoU6wKx3flri6AJtCBqJ3xKlomLTev SBp58EJhFuEHHL90QWJS36RfZCmVXiv9dhMekGA70nA== X-Received: by 2002:a37:bf06:: with SMTP id p6-v6mr2132004qkf.143.1527080204510; Wed, 23 May 2018 05:56:44 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIzu1m4IcpNOfFQpuJ0miOJHjsiwQCkBgOCmVBjQpDhC0n3aHboP8mNHy/csZ3EXFKgjX9Npg== X-Received: by 2002:a37:bf06:: with SMTP id p6-v6mr2131994qkf.143.1527080204256; Wed, 23 May 2018 05:56:44 -0700 (PDT) Received: from thinkpad.in.azkaban.com (modemcable048.146-83-70.mc.videotron.ca. [70.83.146.48]) by smtp.gmail.com with ESMTPSA id v86-v6sm14283335qkv.60.2018.05.23.05.56.43 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 23 May 2018 05:56:43 -0700 (PDT) From: Eric Desrochers To: kernel-team@lists.ubuntu.com Subject: [PATCH][V2][SRU][X] vxlan: correctly handle ipv6.disable module parameter Date: Wed, 23 May 2018 08:56:41 -0400 Message-Id: <20180523125641.14924-1-eric.desrochers@canonical.com> X-Mailer: git-send-email 2.17.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" 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 Signed-off-by: David S. Miller (backported from commit d074bf9600443403aa24fbc12c1f18eadc90f5aa) Signed-off-by: Eric Desrochers Acked-by: Stefan Bader Acked-by: Juerg Haefliger --- 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);