Subject: Netem does not work with loopback

From: Guillaume Chazarain <[email-masked]>
Date: Fri, 14 Jul 2006 16:34:30 +0200

Hello,

Is it a known problem that the Netem qdisc is very unreliable on the 
loopback (unlike on a true NIC)?

This seems to come from its usage of skb->cb which conflicts with IPCB. 
For instance, the field
IPCB(skb)->opt.optlen becomes non-null and memory corruption follows.

I ``worked around'' this conflict with the following ugly hack:

--- a/net/sched/sch_netem.c
+++ b/net/sched/sch_netem.c
@@ -79,6 +79,7 @@ struct netem_sched_data {
 
 /* Time stamp put into socket buffer control block */
 struct netem_skb_cb {
+    char padding[32]; /* to avoid stepping over IPCB when used on the 
loopback */
     psched_time_t    time_to_send;
 };

Hopefully someone has a better solution :-)

Thanks.

-- 
Guillaume