summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorSabrina Dubroca <sd@queasysnail.net>2023-04-04 15:12:16 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2023-05-24 17:36:48 +0100
commit46f1a953545f03cafa76f231c159e6d4d4187c0b (patch)
tree868cf15e4260537733cf008e5ede7a075fcb8e5a /net
parent98f179c5b072ccfd3cfdf1646c0720731d1edba2 (diff)
downloadlinux-46f1a953545f03cafa76f231c159e6d4d4187c0b.tar.gz
linux-46f1a953545f03cafa76f231c159e6d4d4187c0b.tar.bz2
linux-46f1a953545f03cafa76f231c159e6d4d4187c0b.zip
xfrm: don't check the default policy if the policy allows the packet
[ Upstream commit 430cac487400494c19a8b85299e979bb07b4671f ] The current code doesn't let a simple "allow" policy counteract a default policy blocking all incoming packets: ip x p setdefault in block ip x p a src 192.168.2.1/32 dst 192.168.2.2/32 dir in action allow At this stage, we have an allow policy (with or without transforms) for this packet. It doesn't matter what the default policy says, since the policy we looked up lets the packet through. The case of a blocking policy is already handled separately, so we can remove this check. Fixes: 2d151d39073a ("xfrm: Add possibility to set the default to block if we have no policy") Signed-off-by: Sabrina Dubroca <sd@queasysnail.net> Signed-off-by: Steffen Klassert <steffen.klassert@secunet.com> Signed-off-by: Sasha Levin <sashal@kernel.org>
Diffstat (limited to 'net')
-rw-r--r--net/xfrm/xfrm_policy.c6
1 files changed, 0 insertions, 6 deletions
diff --git a/net/xfrm/xfrm_policy.c b/net/xfrm/xfrm_policy.c
index 0540e9f72b2f..37eeda0f123c 100644
--- a/net/xfrm/xfrm_policy.c
+++ b/net/xfrm/xfrm_policy.c
@@ -3636,12 +3636,6 @@ int __xfrm_policy_check(struct sock *sk, int dir, struct sk_buff *skb,
}
xfrm_nr = ti;
- if (net->xfrm.policy_default[dir] == XFRM_USERPOLICY_BLOCK &&
- !xfrm_nr) {
- XFRM_INC_STATS(net, LINUX_MIB_XFRMINNOSTATES);
- goto reject;
- }
-
if (npols > 1) {
xfrm_tmpl_sort(stp, tpp, xfrm_nr, family);
tpp = stp;