Skip to contentSkip to conversation

ipv4: validate source address if the packet is for us

PATCH In review Duan Jiong 2 participants 2 messages Feb 17, 2014

Subsystems (3)
lore
Share & tools
lore

Duan Jiong

author
#0 lore raw

PATCH 1/1 ipv4: validate source address if the packet is for us

otherwise the host may deal with the invaild packet.

---
 net/ipv4/fib_frontend.c | 1 +
 1 file changed, 1 insertion(+)
net/ipv4/fib_frontend.c +1 -0
index c7539e2..4423a1a 100644
@@ -321,6 +321,7 @@ int fib_validate_source(struct sk_buff *skb, __be32 src, __be32 dst,
 	int r = secpath_exists(skb) ? 0 : IN_DEV_RPFILTER(idev);
 
 	if (!r && !fib_num_tclassid_users(dev_net(dev)) &&
+	    oif != LOOPBACK_IFINDEX &&
 	    (dev->ifindex != oif || !IN_DEV_TX_REDIRECTS(idev))) {
 		*itag = 0;
 		return 0;
Signature · 1 line
1.8.3.1
maintainer
#1 lore raw

From: Duan Jiong <[email protected]>
Date: Mon, 17 Feb 2014 13:03:31 +0800

Quoted 3 lines

otherwise the host may deal with the invaild packet.

Locally bound packets are in fact the one case we do not want source address validation to occur for performance reasons, it's the whole reason this is coded the way that it is.

Turn on rpfilter if you have a machine directly exposed to the internet with no ingress firewalls/routers there to validate the source address.

I am not applying this patch.