diff mbox

net: ingress filter message limit

Message ID 20100731121316.1adb52c0@nehalam
State Accepted, archived
Delegated to: David Miller
Headers show

Commit Message

stephen hemminger July 31, 2010, 7:13 p.m. UTC
If user misconfigures ingress and causes a redirection loop, don't
overwhelm the log.  This is also a error case so make it unlikely.
Found by inspection, luckily not in real system.

Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>


--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Comments

David Miller Aug. 1, 2010, 7:33 a.m. UTC | #1
From: Stephen Hemminger <shemminger@vyatta.com>
Date: Sat, 31 Jul 2010 12:13:16 -0700

> If user misconfigures ingress and causes a redirection loop, don't
> overwhelm the log.  This is also a error case so make it unlikely.
> Found by inspection, luckily not in real system.
> 
> Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>

Applied, thanks Stephen.
--
To unsubscribe from this list: send the line "unsubscribe netdev" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
diff mbox

Patch

--- a/net/core/dev.c	2010-07-31 12:08:00.808476717 -0700
+++ b/net/core/dev.c	2010-07-31 12:09:32.488882593 -0700
@@ -2646,10 +2646,10 @@  static int ing_filter(struct sk_buff *sk
 	int result = TC_ACT_OK;
 	struct Qdisc *q;
 
-	if (MAX_RED_LOOP < ttl++) {
-		printk(KERN_WARNING
-		       "Redir loop detected Dropping packet (%d->%d)\n",
-		       skb->skb_iif, dev->ifindex);
+	if (unlikely(MAX_RED_LOOP < ttl++)) {
+		if (net_ratelimit())
+			pr_warning( "Redir loop detected Dropping packet (%d->%d)\n",
+			       skb->skb_iif, dev->ifindex);
 		return TC_ACT_SHOT;
 	}