Patchwork Gianfar ethernet drop package

login
register
mail settings
Submitter Eric Dumazet
Date Aug. 27, 2012, 1:32 p.m.
Message ID <1346074359.26634.4.camel@edumazet-glaptop>
Download mbox | patch
Permalink /patch/180208/
State RFC
Delegated to: David Miller
Headers show

Comments

Eric Dumazet - Aug. 27, 2012, 1:32 p.m.
On Mon, 2012-08-27 at 14:01 +0100, AnĂ­bal Almeida Pinto wrote:

> Is there any way of put tcpdump or other tool to only log the packages 
> dropped ?

To log such packets with tcpdump, I am afraid you'll need to patch your
kernel.

We dont have a way to tell tcpdump "sniff dropped packets"

Something like this one

(alternatively you can use dropwatch (based on drop_monitor)) and tweak
it...




--
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

Patch

diff --git a/net/core/dev.c b/net/core/dev.c
index 3401e2d..1336570 100644
--- a/net/core/dev.c
+++ b/net/core/dev.c
@@ -3263,14 +3263,6 @@  another_round:
 	if (sk_memalloc_socks() && skb_pfmemalloc(skb))
 		goto skip_taps;
 
-	list_for_each_entry_rcu(ptype, &ptype_all, list) {
-		if (!ptype->dev || ptype->dev == skb->dev) {
-			if (pt_prev)
-				ret = deliver_skb(skb, pt_prev, orig_dev);
-			pt_prev = ptype;
-		}
-	}
-
 skip_taps:
 #ifdef CONFIG_NET_CLS_ACT
 	skb = handle_ing(skb, &pt_prev, &ret, orig_dev);
@@ -3337,6 +3329,11 @@  ncls:
 	} else {
 drop:
 		atomic_long_inc(&skb->dev->rx_dropped);
+		list_for_each_entry_rcu(ptype, &ptype_all, list) {
+			if (!ptype->dev || ptype->dev == skb->dev) {
+				ret = deliver_skb(skb, ptype, orig_dev);
+			}
+		}
 		kfree_skb(skb);
 		/* Jamal, now you will not able to escape explaining
 		 * me how you were going to use this. :-)