Hi all, I am writing a kernel module that aim to share fairly the network resource between flows. I am trying to implement the Flow Random Early Detection algorithm described in "Dynamics of Random Early Detection" (written by Dong Lin and Robert Morris in 1997). My module take place in net/sched/ directory. I load it with tc utility (I have also modified tc). I have to identify flows but I have a big problem when I want to access the udp source port and the udp dest port fields : it results a kernel panic. I thought I cannot access skb->h.uh like this. I don't know where to look anymore. Anyway, if I have understood correctly, outgoing packets reach my modules after being initialyse, so there mustn't be any problem. Anybody could help ? Did I miss something ? thx in advance. Here is the code to identify the different flows... static void tbs_identify(struct sk_buff *skb, __u32 *saddr, __u16 *sport, __u32 *daddr, __u16 *dport, __u8 *tos) { if (skb) { switch (skb->protocol) { case __constant_htons(ETH_P_IP): *saddr = skb->nh.iph->saddr; *daddr = skb->nh.iph->daddr; *tos = skb->nh.iph->tos; switch (skb->nh.iph->protocol) { case IPPROTO_TCP: { struct tcphdr *th = skb->h.th; if (th) { *sport = th->source; *dport = th->dest; } else { *sport = 0; *dport = 0; } break; } case IPPROTO_UDP: { struct udphdr *uh = skb->h.uh; if (uh) { // Next two lines cause trouble *sport = uh->source; *dport = uh->dest; } else { *sport = 0; *dport = 0; } break; } default: *sport = 0; *dport = 0; } break; default: *saddr = 0; *daddr = 0; *tos = 0; *sport = 0; *dport = 0; } } else { *saddr = 0; *daddr = 0; *tos = 0; *sport = 0; *dport = 0; } } -- *Laurent Fazio* -+(12/08/2002)+- o-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-o | /Tout homme qui marche peut s'egarer/. "Faust" -- Goethe | o-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-o Reply-to: Laurent.Fazio(at)wanadoo.fr -- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/