Pham Viet Ha wrote: > Hello there, > > I am just a newbie. I got a bug when modifying CBQ scheduler in Linux > Kernel 2.4. I just want to get the soure and destination port number > of the packet (TCP/UDP). I used ntohs(skb->h.th->dest) for the > destination port number of a TCP packet. It doesn't work. The printed > value is not correct (we used FTP, port 21 to test). > > Did anyone meet the same issue? Please give me a hand. > > Thanks so much in advance. > > VietHa hi, should try something like this : struct iphdr *iph = skb->nh.iph; struct tcphdr *th; if (!(iph->frag_off&htons(IP_MF|IP_OFFSET)) && (iph->protocol == IPPROTO_TCP)) { th = (struct tcphdr*)(((u32*)iph) + iph->ihl); if (ntohs(th->dest) == .... } -- Vincent EGAL Email : egal@ipanematech.com _______________________________________________ LARTC mailing list / LARTC@mailman.ds9a.nl http://mailman.ds9a.nl/mailman/listinfo/lartc HOWTO: http://lartc.org/