how to get tcp seq from skb
I am trying to write a kernel program which needs to get tcp's seq value from sk_buff struct (skb). I did it with the following code:
struct tcphdr * mytcphdr = (struct tcphdr *) tcp_hdr(skb);
if(mytcphdr)
{
unsigned long tcpseq = ntohl(mytcphdr->seq);
}
However, the tcpseq values obtained this way are incorrect (I got the true values from "wireshark" program). Please let me know where it is wrong with the code? Thank you very much in advance.
By the way, I am with kernel 2.6.27.
ycli
|