-
Question about sk_buff
It's really obscure about pointers in skb, and i got
skb->packet_type==PACKET_HOST:
---|-----|---14---|----20----|---------------|--------|
head--mac----nh.iph-----tcph-----------tail------end
------------------nh.raw
------------------data
------------------h.th
when PCACKET_OUTGOING:
---|-----|---14---|----20----|---------------|--------|
head--mac----nh.iph-----tcph-----------tail------end
-------data------nh.raw
------------------h.th
i don't know why skb->h.th==skb->nh.iph and skb->data points to different location of skb when the packet type changes.
if i set tcp=(struct *tcphdr)(skb->nh.iph+skb->nh.iph->ihl*4)
i cannot get the correct tcp port number via tcp->source and tcp->dest;
when i set tcp=(stuct *tcphdr)(skb->raw+skb->nh.iph->ihl*4)
i can get the correct port number.
my kernel is 2.4.20-8
any ideas? THX