[PATCH] ipv4: delete the statements limit icmp message in ip_error()

Subsystems: networking [general], networking [ipv4/ipv6], the rest

STALE4584d

2 messages, 2 authors, 2014-01-15 · open the first message on its own page

[PATCH] ipv4: delete the statements limit icmp message in ip_error()

From: Duan Jiong <hidden>
Date: 2014-01-12 09:52:53

Because after the icmp_send() is called, the icmpv4_xrlim_allow()
will be called to limit the icmp message too.

Signed-off-by: Duan Jiong <redacted>
---
 net/ipv4/route.c | 21 +--------------------
 1 file changed, 1 insertion(+), 20 deletions(-)
diff --git a/net/ipv4/route.c b/net/ipv4/route.c
index f8da282..e521de1 100644
--- a/net/ipv4/route.c
+++ b/net/ipv4/route.c
@@ -900,10 +900,7 @@ static int ip_error(struct sk_buff *skb)
 {
 	struct in_device *in_dev = __in_dev_get_rcu(skb->dev);
 	struct rtable *rt = skb_rtable(skb);
-	struct inet_peer *peer;
-	unsigned long now;
 	struct net *net;
-	bool send;
 	int code;
 
 	net = dev_net(rt->dst.dev);
@@ -936,23 +933,7 @@ static int ip_error(struct sk_buff *skb)
 		break;
 	}
 
-	peer = inet_getpeer_v4(net->ipv4.peers, ip_hdr(skb)->saddr, 1);
-
-	send = true;
-	if (peer) {
-		now = jiffies;
-		peer->rate_tokens += now - peer->rate_last;
-		if (peer->rate_tokens > ip_rt_error_burst)
-			peer->rate_tokens = ip_rt_error_burst;
-		peer->rate_last = now;
-		if (peer->rate_tokens >= ip_rt_error_cost)
-			peer->rate_tokens -= ip_rt_error_cost;
-		else
-			send = false;
-		inet_putpeer(peer);
-	}
-	if (send)
-		icmp_send(skb, ICMP_DEST_UNREACH, code, 0);
+	icmp_send(skb, ICMP_DEST_UNREACH, code, 0);
 
 out:	kfree_skb(skb);
 	return 0;
-- 
1.8.3.1

Re: [PATCH] ipv4: delete the statements limit icmp message in ip_error()

From: David Miller <davem@davemloft.net>
Date: 2014-01-15 01:04:59

From: Duan Jiong <redacted>
Date: Sun, 12 Jan 2014 17:52:20 +0800
Because after the icmp_send() is called, the icmpv4_xrlim_allow()
will be called to limit the icmp message too.

Signed-off-by: Duan Jiong <redacted>
icmpv4_xrlim_allow() is different from what this code is doing.

There are seperate controls for ip_error() reporting, namely:
-		if (peer->rate_tokens > ip_rt_error_burst)
 ...
-		if (peer->rate_tokens >= ip_rt_error_cost)
And this is the only place where that is taken into account.

The icmpv4_xrlim_allow() is a top level limiting on all ICMPs,
this function is limiting specific kinds.

I am not applying this patch, sorry.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help