Re: Socket program in kernel

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

 



On Tue, Feb 22, 2011 at 10:43 AM, prabhu <prabhum@xxxxxxxxxxxxx> wrote:
> Hi All,
>
> I wrote socket program in user level but i want to write the same program in
> kernel. Like the driver(socket server) should receive all the incoming
> TCP or UDP pocket(may be say raw socket) and write into the file.
>
> Please provide your valuable idea to do this program ... Also please point
> out pitfalls.
>

Hello Prabhu,

Please can you told us more about what do you want to achieve? Do you
want to receive information sended by a userspace program using
sockets? In that case netlink sockets is the way to go I think.

But if what you want to capture all the TCP and UDP messages and log
it, maybe you can register a new protocol handler.

Look at the packet_type structure and dev_add_pack() registration function.

Either way, accesing files from inside the kernel is not a good idea,
you should export your data via netlink sockets, sysfs, etc and write
to files from userpace.

Look at this excelent article  written by Greg KH about "Things You
Should Never Do in the Kernel"

http://www.linuxjournal.com/article/8130

Hope it helps.

Best regards,

-- 
-----------------------------------------
Javier MartÃnez Canillas
(+34) 682 39 81 69
PhD Student in High Performance Computing
Computer Architecture and Operating System Department (CAOS)
Universitat AutÃnoma de Barcelona
Barcelona, Spain

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@xxxxxxxxxxxxxxxxx
http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies



[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