Accessing tcp socket information from within a module

From: Vishwas Raman
Date: Fri Oct 03 2003 - 19:08:52 EST


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.

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/