[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re:Question about skbuff
Hello,
On Sat, 11 Aug 2001, lam wai wm wrote:
>
> [...]
>
> struct tcphdr * tcph = (void *) ip + ip->ihl *4;
I think is better to write
struct tcphdr * tcph = (void *) ((char *) ip + ip->ihl * 4);
in order to have the correct sum. It is possible to work with your casts
but is safer to covert it to (char *).
>
> [...]
>
> if (tcplen != tcph->doff * 4)
> printk("TCP length not match\n");
> else
> printk("TCP length match..\n");
What does this part say? If it says "match", it means that the packet
contains no data and everything is OK.
> The result is :
> Source addr : 161.40.211.86:6190
> Dest addr : 161.40.211.86:1037
> Length : 52
> Skb Data addr : c7ca3d1c
> IP addr : c7ca3d1c
> IP->ihl : 5
> TCP addr : c7ca3d30
> Data :
> data addr : c7ca3d50
> tail : c7ca3d50
> end : c7ca3d50
Total Length : 52 = 0x34 // OK
Skb Data addr : 0xc7ca3d1c // OK
IP addr : 0xc7ca3d1c // OK
IP->ihl : 5 // OK
TCP addr : 0xc7ca3d30 = 0xc7ca3d1c + 5 * 4 // OK
tail : 0xc7ca3d50 = 0xc7ca3d1c + 52 // OK
data addr == tail : I think this is OK and maybe this is an ACK packet
with no data, only the header. Check the fields: syn, rst, ack in tcphdr
structure (http://www.rfc-editor.org/rfc/rfc793.txt).
I do not have too much experience with skbuffs but I think that nothing is
wrong with the data address being equal with tail address (only if this
happens for all the packets).
--
Catalin
-
Kernelnewbies: Help each other learn about the Linux kernel.
Archive: http://mail.nl.linux.org/kernelnewbies/
IRC Channel: irc.openprojects.net / #kernelnewbies
Web Page: http://www.kernelnewbies.org/