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 .
struct sk_buff *sock_buff;
printk(KERN_INFO"user data :: %x",(sock_buff->data+sizeof(*sock_buff->network_header)+sizeof(*sock_buff->mac_header)) //though i want in character but i cant understand whats it printing not matching the hex of my data
printk(KERN_INFO"user data :: %s",(sock_buff->data+sizeof(*sock_buff->network_header)+sizeof(*sock_buff->mac_header))
i have even used tail – sizeof(my_data); then also i am not getting desired o/p.
Maybe your forgot take a value by pointer(*), try this
As I understand, in your structure data field have a pointer type.
Also %x specificator (number in hex) requers numerical agrument, not a pointer, that’s why you should not forgot to put one small (*)