get tcp header

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

 



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?

thank you!
--
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