I have implemented a kernel level socket module for kernel 2.4 a few years ago. I think I can dig that up if you are interested. I am not sure if that is usable as is in 2.6. At least the compilation process has changed for modules... Anyhow, the main idea to using sockets from the kernel is to make sure you bypass the copy-from-user and copy-to-user functions. Otherwise, the messages that you try to send will never make it to the socket buffer or from the socket buffer. One way to do this is to introduce a new flag that tells the kernel not to check the validity of the memory address that represents your message. You can use this flag when you send your messages... Take a look at the source code for sys_sendto and sys_send (net/socket.c). You can do a similar thing in your kernel_sendto... Also, it might help if you decide what transport protocol you want to use (TCP or UDP) and call the functions directly: udp_sendmsg or tcp_sendmsg... The socket call maps almost transparently to the sys_socket... Cheers, Cristian On 5/7/06, Yogesh Sobale <yogesh.sobale@xxxxxxxxx> wrote:
hi , Can any body tell me how to write kernel mode socket ? If possible plz send the link for good document ...
-- Kernelnewbies: Help each other learn about the Linux kernel. Archive: http://mail.nl.linux.org/kernelnewbies/ FAQ: http://kernelnewbies.org/faq/