Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Stephen Hemminger and committed by
David S. Miller
de384830 e2e0c7c9

+4 -4
+4 -4
net/core/dev.c
··· 2646 2646 int result = TC_ACT_OK; 2647 2647 struct Qdisc *q; 2648 2648 2649 - if (MAX_RED_LOOP < ttl++) { 2650 - printk(KERN_WARNING 2651 - "Redir loop detected Dropping packet (%d->%d)\n", 2652 - skb->skb_iif, dev->ifindex); 2649 + if (unlikely(MAX_RED_LOOP < ttl++)) { 2650 + if (net_ratelimit()) 2651 + pr_warning( "Redir loop detected Dropping packet (%d->%d)\n", 2652 + skb->skb_iif, dev->ifindex); 2653 2653 return TC_ACT_SHOT; 2654 2654 } 2655 2655