Re: How to write kernel mode socket ?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



hi,
 it  will be great if  send the link for that module. so that  i  will get idea about how it can be
written in 2.6

On 5/11/06, Cristian Tapus <cristian.tapus@xxxxxxxxx> wrote:
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 ...
>
>


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux