net: bpfilter: fix iptables failure if bpfilter_umh is disabled
authorTaehee Yoo <ap420073@gmail.com>
Mon, 5 Nov 2018 13:31:41 +0000 (22:31 +0900)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Sun, 1 Dec 2019 08:17:18 +0000 (09:17 +0100)
commite6c6c0439a936e7fadc6a861cfa53ee61e43dae0
tree2595c86ea5250088e708f10dc2398265ab51e24d
parent811c8141d663e399f9413eba23eb046c98b16665
net: bpfilter: fix iptables failure if bpfilter_umh is disabled

[ 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 <ap420073@gmail.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Signed-off-by: Sasha Levin <sashal@kernel.org>
net/ipv4/ip_sockglue.c