Results 1 to 1 of 1
Thread: trying to add some data to skb
Enjoy an ad free experience by logging in. Not a member yet? Register.
- Join Date
- Sep 2004
trying to add some data to skb
i have a char* buffer and i'm trying to create skbuff buffer and add the char* buffer as its payload.
i'm doing it in the tcp level, i created a new function that is very similar to the tcp_sendmsg function with the following major differences:
1. instead of 'struct msghdr *msg' my new function gets as a parameter
'unsigned char *payload'.
2. in tcp_sendmsg we have:
struct iovec *iov = msg->msg_iov;
unsined char __user *from = iov->iov_base;
in my function"
unsigned char *from = kmalloc (len,GEP_KERNEL); //len=512
from = memcpy(from, payload, payload_size); //payload_size < len
3. in tcp_sendmsg:
there is a call to akb_add_data that calls to -
copy_from_user(skb_put(skb,copy), from, copy))
in my function i'm trying to do -
memcpy(skb_put(skb,copy), from, payload_size);
kfree(from); // at the end of the function
there is no problem to compile the kernel but after boot, when it's beeing loaded, it seems that everything is ok but actually everyting is freezing.
does anyone has an idea???