Subject: Re: Netem does not work with loopback

From: Guillaume Chazarain <[email-masked]>
Date: Fri, 14 Jul 2006 19:04:01 +0200

Stephen Hemminger wrote :
> Isn't the skb owned by netem at that point...
>   
Thank you, that makes sense to me.
But then the loopback device reinjects the skb without cleaning skb->cb.

The attached patch solves the problem for me (netem on lo). Maybe the
correct solution would be to make a skb->destructor function for netem,
but I am not sure this is the intended use of a destructor function.

Thanks.

-- 
Guillaume

--- a/drivers/net/loopback.c
+++ b/drivers/net/loopback.c
@@ -156,6 +156,9 @@
 	lb_stats->tx_packets = lb_stats->rx_packets;
 	put_cpu();
 
+	/* Get rid of all the private data accumulated in the sending part */
+	memset(skb->cb, 0, sizeof(skb->cb));
+
 	netif_rx(skb);
 
 	return(0);

-- 
Signed-off-by: Guillaume Chazarain <[email-masked]>