Skip to content

Commit 3a59131

Browse files
ebirgerklassert
authored andcommitted
xfrm: fix "disable_policy" on ipv4 early demux
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]>
1 parent 1d22f78 commit 3a59131

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
@@ -366,6 +366,11 @@ static int ip_rcv_finish_core(struct net *net, struct sock *sk,
366366
iph->tos, dev);
367367
if (unlikely(err))
368368
goto drop_error;
369+
} else {
370+
struct in_device *in_dev = __in_dev_get_rcu(dev);
371+
372+
if (in_dev && IN_DEV_ORCONF(in_dev, NOPOLICY))
373+
IPCB(skb)->flags |= IPSKB_NOPOLICY;
369374
}
370375

371376
#ifdef CONFIG_IP_ROUTE_CLASSID

0 commit comments

Comments
 (0)