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
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@kernelnewbies.org http://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies
-- ........................ *MOHIT VERMA*
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
participants (3)
-
Javier Martinez Canillas -
mohit verma -
prabhu