Extracting port numbers
Vincent
cs83152 at csie.chu.edu.tw
Thu May 4 07:05:46 CEST 2006
>
>Hi,
>
>I was trying to extract tcp port numbers from sk_buff, going
>through netfilter code, there seem multiple ways of doing it.
>I was wondering if there is one standard way to do it which is
>generic enough to fit any situation.
>
>For seem reason the
>struct tcphrd *tcp = (struct tcphrd *)(skb->data +
>(skb->nh.iph->ihl*4));
>
>dest_port = tcp->dest;
>
>does not work and extracts wrong port numbers.
>
It seems ok. Do you miss to use the ntohs function to conver to the
correct form?
Vincent
More information about the netfilter-devel
mailing list