Received: by 2002:a25:7ec1:0:0:0:0:0 with SMTP id z184csp6015467ybc; Wed, 27 Nov 2019 13:26:28 -0800 (PST) X-Google-Smtp-Source: APXvYqwMWwQ3DmxX8nOBv5IU367QvxovGU4yc8BM8hBlSTQAz+5x6TiTdIEfMQgk3rymBNNZ/Xaa X-Received: by 2002:a17:906:3606:: with SMTP id q6mr50140918ejb.307.1574889988247; Wed, 27 Nov 2019 13:26:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1574889988; cv=none; d=google.com; s=arc-20160816; b=LKIDr2ZzuKchB432bHdqvOWXgUxXRNVlawAj8z3l7yfgTUD2ZUVwIBCSKZ+qHY1PD4 rQBUWIj80UngpgEkkvqD//nOwJka1Uj5cjCwOgPaHmB6RxgQ663qB4871Gz6jbvmmMrT tYDzPfJEg+vhwY2iBjY45MHzwnY6/Yk6qWs0kNyPKA7HGbkkq4tMmpvCbHWjxaKWZArl Cq0MdlajYklfNR0j7gxuzsEGI7y/wg8OBy6OAP2mhcvYzEZJ+toNfVdVtcsj0/O7tBGO XTHSzGvs+DcNYeubBaSqne7vHfnc98TdvkyA8SZga+dSEQwTcbNMap9VAwOOHXZ3Gxyl SK5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=JBoEL6xNzsUmRdBEwB88XmVTSh2/uXqaNftjM/ksywY=; b=meC/NwOuzfOUQVkZFzAPPwNLogM0Cmjx65RoHUVlQvMhKInyzf6Z0vxo6WMe51pwUq 3J9CjbJUPxypfayMdI+6Xu0HQfceWg02yEc4WxJlL4E2hOozsbRVbHGsokk3nbzjWFpX P1Q8SeqKFPuAlSLQcRJ6m2l+9MTwVmaRyoG31SUR3j2/5N0uL7at4MLIJrk84zUi/3TO gDR4W6wSw9aWdxJzWUllv8qYJy5e/i1prHFsGBxOrC3wDxw33/+ZVjgGyitsNUI7S/Ft It5n+fnjxx7bppDLX2Un2JDdFJ5rB/Ltk1Suv2qLZ2kjqzueaz9osCkyQSdjRm8R65fv Zs0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xd8uVWP3; 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 jp18si9948181ejb.318.2019.11.27.13.26.03; Wed, 27 Nov 2019 13:26:28 -0800 (PST) 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; dkim=pass header.i=@kernel.org header.s=default header.b=xd8uVWP3; 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 S1731455AbfK0VD7 (ORCPT + 99 others); Wed, 27 Nov 2019 16:03:59 -0500 Received: from mail.kernel.org ([198.145.29.99]:57184 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731772AbfK0VDw (ORCPT ); Wed, 27 Nov 2019 16:03:52 -0500 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 133FC215F1; Wed, 27 Nov 2019 21:03:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1574888631; bh=2Wlb3YZLDLsri+AOZgu2/8+1BzXQy5enQQEq+o4T+ec=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xd8uVWP3Q3UFtlBoaSA9YXpWCacpDjQ7B4shVD6+JXbVN1uA7AKksD3JcacnZutju +c3Gch0qDln1YMZbyM5XXzCbnq7tLWfA92UVoVLyfXCpc9KuZo8HitM4wIpICjiElC oReoZ8vGRwl+qj1dmQkTfPpVij1O4+rpfR30x2gA= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Taehee Yoo , "David S. Miller" , Sasha Levin Subject: [PATCH 4.19 209/306] net: bpfilter: fix iptables failure if bpfilter_umh is disabled Date: Wed, 27 Nov 2019 21:30:59 +0100 Message-Id: <20191127203130.406914065@linuxfoundation.org> X-Mailer: git-send-email 2.24.0 In-Reply-To: <20191127203114.766709977@linuxfoundation.org> References: <20191127203114.766709977@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Taehee Yoo [ Upstream commit 97adaddaa6db7a8af81b9b11e30cbe3628cd6700 ] When iptables command is executed, ip_{set/get}sockopt() try to upload bpfilter.ko if bpfilter is enabled. if it couldn't find bpfilter.ko, command is failed. bpfilter.ko is generated if CONFIG_BPFILTER_UMH is enabled. ip_{set/get}sockopt() only checks CONFIG_BPFILTER. So that if CONFIG_BPFILTER is enabled and CONFIG_BPFILTER_UMH is disabled, iptables command is always failed. test config: CONFIG_BPFILTER=y # CONFIG_BPFILTER_UMH is not set test command: %iptables -L iptables: No chain/target/match by that name. Fixes: d2ba09c17a06 ("net: add skeleton of bpfilter kernel module") Signed-off-by: Taehee Yoo Signed-off-by: David S. Miller Signed-off-by: Sasha Levin --- net/ipv4/ip_sockglue.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c index b7a26120d5521..82f341e84faec 100644 --- a/net/ipv4/ip_sockglue.c +++ b/net/ipv4/ip_sockglue.c @@ -1244,7 +1244,7 @@ int ip_setsockopt(struct sock *sk, int level, return -ENOPROTOOPT; err = do_ip_setsockopt(sk, level, optname, optval, optlen); -#ifdef CONFIG_BPFILTER +#if IS_ENABLED(CONFIG_BPFILTER_UMH) if (optname >= BPFILTER_IPT_SO_SET_REPLACE && optname < BPFILTER_IPT_SET_MAX) err = bpfilter_ip_set_sockopt(sk, optname, optval, optlen); @@ -1557,7 +1557,7 @@ int ip_getsockopt(struct sock *sk, int level, int err; err = do_ip_getsockopt(sk, level, optname, optval, optlen, 0); -#ifdef CONFIG_BPFILTER +#if IS_ENABLED(CONFIG_BPFILTER_UMH) if (optname >= BPFILTER_IPT_SO_GET_INFO && optname < BPFILTER_IPT_GET_MAX) err = bpfilter_ip_get_sockopt(sk, optname, optval, optlen); @@ -1594,7 +1594,7 @@ int compat_ip_getsockopt(struct sock *sk, int level, int optname, err = do_ip_getsockopt(sk, level, optname, optval, optlen, MSG_CMSG_COMPAT); -#ifdef CONFIG_BPFILTER +#if IS_ENABLED(CONFIG_BPFILTER_UMH) if (optname >= BPFILTER_IPT_SO_GET_INFO && optname < BPFILTER_IPT_GET_MAX) err = bpfilter_ip_get_sockopt(sk, optname, optval, optlen); -- 2.20.1