netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Duan Jiong <duanj.fnst@cn.fujitsu.com>
To: David Miller <davem@davemloft.net>
Cc: netdev@vger.kernel.org
Subject: [PATCH] ipv4: delete the statements limit icmp message in ip_error()
Date: Sun, 12 Jan 2014 17:52:20 +0800	[thread overview]
Message-ID: <52D265D4.9050600@cn.fujitsu.com> (raw)


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 <duanj.fnst@cn.fujitsu.com>
---
 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

             reply	other threads:[~2014-01-12  9:52 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-01-12  9:52 Duan Jiong [this message]
2014-01-15  1:04 ` [PATCH] ipv4: delete the statements limit icmp message in ip_error() David Miller

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=52D265D4.9050600@cn.fujitsu.com \
    --to=duanj.fnst@cn.fujitsu.com \
    --cc=davem@davemloft.net \
    --cc=netdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).