Received: by 10.213.65.68 with SMTP id h4csp219911imn; Fri, 23 Mar 2018 03:11:10 -0700 (PDT) X-Google-Smtp-Source: AG47ELtqiFKfZYRqunUQqrVimvxgGoljLvVZeWNYWKrPq/YArVUUP+oJY8dOLqZdu1LbLCItH2mK X-Received: by 10.99.126.73 with SMTP id o9mr20875846pgn.406.1521799870837; Fri, 23 Mar 2018 03:11:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521799870; cv=none; d=google.com; s=arc-20160816; b=0ql/TcUZNbYDA/pYY0Dz0mUhnQGLERj46+ylld2Omy+XtQ1O3fw4wps5md+0MR1E+U IRB9tCrr8lXu02OSjiiN4d7D0z3ayVMExYc5GintqQIormTmNMNjSXecWQO2l9SdwBPm ZdgD5vibJzi3NHukK5LxmTYi5RkI/fXmU1cn/JUjoTMEF9CsOyEo4Y6YpzULerH7gQIm u7HgKBYCLldOeV3SunwrpcQa83yhqNKJqWSUzt8V8VVTSlnItp2skyTV/7IIsN1nLuPL ni+8BuOQJ5Zn5vgHIrDjC4nMiKiCnW8Pt5gJAr5niIYBuMrjEXN1J6VuT9Op7XxE6oAY cagg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=xT0jFPzQTTopHesJl7tZiGgEFw+0yvbOkpbSiTtvIhA=; b=K+ZVnG7WhVtrnPyiWAfEPL7PG8vwdgzDSyWXgqthMEMkHtVDmdgDb3La0MeQbEQJnw /uDdAjeatsAzU3dC5+3muovvJBz5zzxsWXd9EdF9bZmdWQbHXZu501kooldP4xn1e1T3 zHAdCTYbAZeVjKQX+ii2cHLdh98I8Q7rtGjVchpbChVbMdtcwlZxRM3ZN8HU0zzXlheE ju23laK0497KWfkV89T//aJ5oxztUWul8KnGnip2CLlPBLuKlfs1dbvx1QEcrAevwtYq E+P6KhAANFZcOVe/jRc7OtXs0VlWP9QYtM/7JRlb1umTNbmjwJ0HWtEwCjrM0uhJHKqt hAyg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h11-v6si8186715plk.742.2018.03.23.03.10.56; Fri, 23 Mar 2018 03:11:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932578AbeCWKJv (ORCPT + 99 others); Fri, 23 Mar 2018 06:09:51 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:42264 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932539AbeCWKJn (ORCPT ); Fri, 23 Mar 2018 06:09:43 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id F2BF4FC9; Fri, 23 Mar 2018 10:09:42 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Jiri Benc , "David S. Miller" , Sasha Levin Subject: [PATCH 4.9 108/177] vxlan: correctly handle ipv6.disable module parameter Date: Fri, 23 Mar 2018 10:53:56 +0100 Message-Id: <20180323094210.042037001@linuxfoundation.org> X-Mailer: git-send-email 2.16.2 In-Reply-To: <20180323094205.090519271@linuxfoundation.org> References: <20180323094205.090519271@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Jiri Benc [ 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 Signed-off-by: David S. Miller Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- 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);