Re: get tcp header

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tuesday 2010-08-31 20:26, Nicola Padovano wrote:

>Hi guys! i know the skb_transport_header to grab the tcp header of a
>packet...so i can write:
>struct tcphdr *tcp_header1 = (struct
>tcphdr*)skb_transport_header(skb), where skb is a certain packet.
>
>now, studying some source code that i've found some days ago, i've seen this:
>
>struct tcphdr *tcp_header2  = (void*)ip_hdr(skb) + ip_hdrlen(skb);
>
>I immediately thought that the two lines were identical, but but I was
>mistaken...in fact if i write this:
>
>printk(KERN_INFO "diff: %d\n",(int)((void*)tcp_header2 - (void*)tcp_header1));
>
>i see, "diff: 20"
>
>so my question is: what's the difference between the two code lines?


skb_transport_header is also explained in the PDF, especially when it 
can not be used.
--
To unsubscribe from this list: send the line "unsubscribe netfilter-devel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[Index of Archives]     [Netfitler Users]     [LARTC]     [Bugtraq]     [Yosemite Forum]

  Powered by Linux