net: ingress filter message limit
authorStephen Hemminger <shemminger@vyatta.com>
Sun, 1 Aug 2010 07:33:23 +0000 (00:33 -0700)
committerDavid S. Miller <davem@davemloft.net>
Sun, 1 Aug 2010 07:33:23 +0000 (00:33 -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>
Signed-off-by: David S. Miller <davem@davemloft.net>
net/core/dev.c

index b74fcd3e936503f8a6684c1cd46a20b2fd53805f..5d1282df2fe3a7ef37193bc39c1e37bf7afb96f6 100644 (file)
@@ -2646,10 +2646,10 @@ static int ing_filter(struct sk_buff *skb)
        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;
        }