All of lore.kernel.org
 help / color / mirror / Atom feed
* Socket program in kernel
@ 2011-02-22  9:43 prabhu
  2011-02-22 12:21 ` mohit verma
  2011-02-22 14:49 ` Javier Martinez Canillas
  0 siblings, 2 replies; 3+ messages in thread
From: prabhu @ 2011-02-22  9:43 UTC (permalink / raw)
  To: kernelnewbies

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.

Thanks,
Prabhu

-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110222/1465157a/attachment.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Socket program in kernel
  2011-02-22  9:43 Socket program in kernel prabhu
@ 2011-02-22 12:21 ` mohit verma
  2011-02-22 14:49 ` Javier Martinez Canillas
  1 sibling, 0 replies; 3+ messages in thread
From: mohit verma @ 2011-02-22 12:21 UTC (permalink / raw)
  To: kernelnewbies

http://www.linuxjournal.com/node/7356/

here is the link showing how u can add ur socket and define new protocol for
netlink family ( if u wish) in kernel land.

On Tue, Feb 22, 2011 at 3:13 PM, prabhu <prabhum@msys-tech.com> 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.
>
> Thanks,
> Prabhu
>
>
> _______________________________________________
> Kernelnewbies mailing list
> Kernelnewbies at kernelnewbies.org
> http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
>
>


-- 
........................
*MOHIT VERMA*
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kernelnewbies.org/pipermail/kernelnewbies/attachments/20110222/f0868e42/attachment-0001.html 

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Socket program in kernel
  2011-02-22  9:43 Socket program in kernel prabhu
  2011-02-22 12:21 ` mohit verma
@ 2011-02-22 14:49 ` Javier Martinez Canillas
  1 sibling, 0 replies; 3+ messages in thread
From: Javier Martinez Canillas @ 2011-02-22 14:49 UTC (permalink / raw)
  To: kernelnewbies

On Tue, Feb 22, 2011 at 10:43 AM, prabhu <prabhum@msys-tech.com> 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

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2011-02-22 14:49 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-22  9:43 Socket program in kernel prabhu
2011-02-22 12:21 ` mohit verma
2011-02-22 14:49 ` Javier Martinez Canillas

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.