* [PATCH net] net: bpfilter: fix iptables failure if bpfilter_umh is disabled
@ 2018-11-05 13:31 Taehee Yoo
2018-11-06 1:13 ` David Miller
0 siblings, 1 reply; 2+ messages in thread
From: Taehee Yoo @ 2018-11-05 13:31 UTC (permalink / raw)
To: davem, netdev; +Cc: daniel, ast, pablo, fw, ap420073
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>
---
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 26c36cccabdc..fffcc130900e 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1246,7 +1246,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);
@@ -1559,7 +1559,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);
@@ -1596,7 +1596,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.17.1
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH net] net: bpfilter: fix iptables failure if bpfilter_umh is disabled
2018-11-05 13:31 [PATCH net] net: bpfilter: fix iptables failure if bpfilter_umh is disabled Taehee Yoo
@ 2018-11-06 1:13 ` David Miller
0 siblings, 0 replies; 2+ messages in thread
From: David Miller @ 2018-11-06 1:13 UTC (permalink / raw)
To: ap420073; +Cc: netdev, daniel, ast, pablo, fw
From: Taehee Yoo <ap420073@gmail.com>
Date: Mon, 5 Nov 2018 22:31:41 +0900
> 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>
Applied, thanks Taehee-ssi.
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-11-06 10:35 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-11-05 13:31 [PATCH net] net: bpfilter: fix iptables failure if bpfilter_umh is disabled Taehee Yoo
2018-11-06 1:13 ` David Miller
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).