I have a linux kernel module that needs to process the data received via netfilter hook as a socket buffer.
This is what I am doing in the callback,
unsigned char *eth = skb_mac_header(skb);
int len = skb->len + 14; //Assuming eth is 14 bytes. Neglecting VLAN case.
for (int j=0; j < len; j++)
{
printk("%X ", eth[j]);
}
On receiving packets, i get correct length. However he packet contents for some UDP traffic has only correct 48 bytes (initial) and rest of the bytes are not what my interface is receiving. User-space application is receiving correct packet contents as being received on the interface.
Can anyone help explain that what I am doing wrong. Help will be greatly appreciated. Thanks.