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

Accessing tcp socket information from within a kernel module



Hi all,

I am trying to write a module in the 2.4.20 kernel, which will do pretty 
much a small subset of what netstat does from the user-space. All 
netstat does is read from /proc/net/tcp to get hold of info regarding 
TCP sockets in the system.

I want to be able to find out what are all the open tcp sockets in the 
system and the states they are in. In the TCP implementation in the 
kernel, this information lies in a set of hash tables. I tried to access 
one of these hash tables "tcp_hashinfo" from within my kernel moule. But 
this symbol is exported by netsyms.c in the kernel only if IPV6 or 
KHTTPD or is turned on, and since I have my kernel built without IPV6 or 
KHTTPD, I cannot access these hashtables.

Is there some way of accessing the information of all open tcp sockets 
in the system, other than having to turn one of IPV6 or KHTTPD on?

Thanks in advance for any help.

-Vishwas.


--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/