views:

43

answers:

1

Hello everyone.

I create a module in kernel space that send a UPD segment using socket RAW, but my problem is read the UDP segment from kernel space.

I can read the UDP segment from user space, but when I prove to use "sock_recvmsg" from kernel space, I obtain as result -512

Please, help me!

+1  A: 

I don't know why you feel the need to use a raw socket to send/recieve UDP - just use a UDP socket instead.

It may be that the structure you're supplying to sock_recvmsg for the address isn't right.

In general using networking from inside the kernel is a bad idea and should be avoided (not least, it ties your code to a specific kernel version). If you tell us what you're trying to do (ideally in the form of another question) maybe someone can suggest a better way.

MarkR
I want create a simple kernel module that can read a UDP message from another computer.I prove to use this two examples:http://kernelnewbies.org/Simple_UDP_Serverhttp://www.linux.it/~rubini/docs/khttpd/khttpd.htmlBut my problem is in the use of "sock_recvmsg"
Nabeshin