[Devel] [PATCH RHEL7 COMMIT] netfilter: check per-ve netfilter status on actual operation
Konstantin Khorenko
khorenko at virtuozzo.com
Fri Jul 21 17:12:21 MSK 2017
The commit is pushed to "branch-rh7-3.10.0-514.26.1.vz7.33.x-ovz" and will appear at https://src.openvz.org/scm/ovz/vzkernel.git
after rh7-3.10.0-514.26.1.vz7.33.14
------>
commit 9d373c2a9b86abd220264dbb27a5d9c0f7cd8571
Author: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Date: Fri Jul 21 18:12:21 2017 +0400
netfilter: check per-ve netfilter status on actual operation
v2:
1) Return ENOPROTOOPT instead of ENOENT from ip_setsockopt
https://jira.sw.ru/browse/PSBM-58574
Signed-off-by: Stanislav Kinsburskiy <skinsbursky at virtuozzo.com>
Reviewed-by: Andrey Ryabinin <aryabinin at virtuozzo.com>
---
net/ipv4/ip_sockglue.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/net/ipv4/ip_sockglue.c b/net/ipv4/ip_sockglue.c
index bcca7f3..8b22763 100644
--- a/net/ipv4/ip_sockglue.c
+++ b/net/ipv4/ip_sockglue.c
@@ -1119,6 +1119,10 @@ int ip_setsockopt(struct sock *sk, int level,
optname != IP_IPSEC_POLICY &&
optname != IP_XFRM_POLICY &&
!ip_mroute_opt(optname)) {
+
+ if (!ve_ipt_permitted(net, VE_IP_FILTER))
+ return -ENOPROTOOPT;
+
lock_sock(sk);
err = nf_setsockopt(sk, PF_INET, optname, optval, optlen);
release_sock(sk);
@@ -1424,6 +1428,9 @@ int ip_getsockopt(struct sock *sk, int level,
if (get_user(len, optlen))
return -EFAULT;
+ if (!ve_ipt_permitted(net, VE_IP_FILTER))
+ return -ENOENT;
+
lock_sock(sk);
err = nf_getsockopt(sk, PF_INET, optname, optval,
&len);
More information about the Devel
mailing list