Skip to content

Commit ecc6ce4

Browse files
ebirgergregkh
authored andcommitted
xfrm: fix "disable_policy" on ipv4 early demux
[ Upstream commit 3a59131 ] The commit in the "Fixes" tag tried to avoid a case where policy check is ignored due to dst caching in next hops. However, when the traffic is locally consumed, the dst may be cached in a local TCP or UDP socket as part of early demux. In this case the "disable_policy" flag is not checked as ip_route_input_noref() was only called before caching, and thus, packets after the initial packet in a flow will be dropped if not matching policies. Fix by checking the "disable_policy" flag also when a valid dst is already available. Link: https://bugzilla.kernel.org/show_bug.cgi?id=216557 Reported-by: Monil Patel <[email protected]> Fixes: e6175a2 ("xfrm: fix "disable_policy" flag use when arriving from different devices") Signed-off-by: Eyal Birger <[email protected]> ---- v2: use dev instead of skb->dev Signed-off-by: Steffen Klassert <[email protected]> Signed-off-by: Sasha Levin <[email protected]>
1 parent 5a792c1 commit ecc6ce4

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

net/ipv4/ip_input.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -364,6 +364,11 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk,
364364
iph->tos, dev);
365365
if (unlikely(err))
366366
goto drop_error;
367+
} else {
368+
struct in_device *in_dev = __in_dev_get_rcu(dev);
369+
370+
if (in_dev && IN_DEV_ORCONF(in_dev, NOPOLICY))
371+
IPCB(skb)->flags |= IPSKB_NOPOLICY;
367372
}
368373

369374
#ifdef CONFIG_IP_ROUTE_CLASSID

0 commit comments

Comments
 (0)