Yesterday was a fantastic day trying to get the IP data field to be pointed to by in the skbuff structure. The documentation in the files did not help make things clearer.
The situation was where I was supposed to use the
unsigned char* data field in the skbuff structure to point to the IP data starting point.
Tried a lot of pointer math and the following finally worked:
IP Data pointer location:
unsigned char * ptr = sb->data +
int byte_size = ntohs(sb->nh.iph->tot_len) -
In fact, Vinay Reddy (firstname.lastname@example.org) suggested something which I think was even better than the stuff that was working for me. He said the pointer value should be:
unsigned char * ptr = sb->nh.iph->raw + sb->nh.iph->ihl*4;
I think this actually grabs the gist of what I exactly want to do.
I *really* want to point with respect to the IP Header. I do not really care about where sb->data really points to so I guess Vinay’s method is much better. Haven’t implemented it so I really don’t know but sounds the most logical!