From: Stephen Hemminger Date: Sun, 1 Aug 2010 07:33:23 +0000 (-0700) Subject: net: ingress filter message limit X-Git-Tag: v2.6.36-rc1~571^2~47 X-Git-Url: https://bbs.cooldavid.org/git/?a=commitdiff_plain;h=de38483010bae523f533bb6bf9f7b7353772f6eb;p=net-next-2.6.git net: ingress filter message limit 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 Signed-off-by: David S. Miller --- diff --git a/net/core/dev.c b/net/core/dev.c index b74fcd3e936..5d1282df2fe 100644 --- a/net/core/dev.c +++ b/net/core/dev.c @@ -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; }