Hope this helps I have make a module in which i receive all incoming packets by net filter. I want to print the data (no headers) in /var/log/messages . I have tried the following printk line but its not printing the suitable message . , Maybe your forgot take a value by pointer(*), try this
printk(KERN_INFO"user data :: %x",*(sock_buff->data+sizeof(*sock_buff->network_header) +sizeof(*sock_buff->mac_header));
this will help My Broadcast receiver file ConnectivityReceiver.java was present in default package by mistake. And Android was not able to recognized this file because it was searching ConnectivityReceiver in the current package. i.e com.rakesh.simplewidget; It was simple unnoticeable mistake which caused me half an hour to debug this.
Why don't pointer point to right packet header when I capture network packet?
By : emily
Date : March 29 2020, 07:55 AM
it helps some times I used libpcap to capture network packet.My code was ,
ip_header* ih = (ip_header*)(pkt_data+14);
tcp_header* th = (tcp_header*)(ih+20);