开发者

How can I read a UDP segment in Kernel Space?

开发者 https://www.devze.com 2022-12-21 15:41 出处:网络
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 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!


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消