* Accessing tcp socket information from within a module
@ 2003-10-04 0:02 Vishwas Raman
2003-10-04 5:51 ` David S. Miller
0 siblings, 1 reply; 6+ messages in thread
From: Vishwas Raman @ 2003-10-04 0:02 UTC (permalink / raw)
To: linux-kernel
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.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Accessing tcp socket information from within a module
2003-10-04 0:02 Accessing tcp socket information from within a module Vishwas Raman
@ 2003-10-04 5:51 ` David S. Miller
2003-10-04 23:07 ` Vishwas Raman
0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2003-10-04 5:51 UTC (permalink / raw)
To: Vishwas Raman; +Cc: linux-kernel
On Fri, 03 Oct 2003 17:02:07 -0700
Vishwas Raman <vishwas@eternal-systems.com> wrote:
> 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?
You don't even need to write your kernel module, there is already
a special netlink socket provided to userspace exactly for this
purpose, to get info on all TCP sockets efficiently.
See net/ipv4/tcp_diag.c
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Accessing tcp socket information from within a module
2003-10-04 5:51 ` David S. Miller
@ 2003-10-04 23:07 ` Vishwas Raman
2003-10-04 23:10 ` David S. Miller
0 siblings, 1 reply; 6+ messages in thread
From: Vishwas Raman @ 2003-10-04 23:07 UTC (permalink / raw)
To: David S. Miller; +Cc: linux-kernel
David S. Miller wrote:
> On Fri, 03 Oct 2003 17:02:07 -0700
> Vishwas Raman <vishwas@eternal-systems.com> wrote:
>
>
>>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?
>
>
> You don't even need to write your kernel module, there is already
> a special netlink socket provided to userspace exactly for this
> purpose, to get info on all TCP sockets efficiently.
>
> See net/ipv4/tcp_diag.c
>
But what if I am interested in doing the same in kernel space and not
user space? The module I am writing is going to sit between the tcp and
ip layers of the networking stack. And I need to get info on all TCP
sockets and create/modify certain data structures of my own in the
module based on that information.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Accessing tcp socket information from within a module
2003-10-04 23:07 ` Vishwas Raman
@ 2003-10-04 23:10 ` David S. Miller
2003-10-04 23:58 ` Onboard LAN Asus A7V8X-X (VT6102 [Rhine-II]) William Scott Lockwood III
0 siblings, 1 reply; 6+ messages in thread
From: David S. Miller @ 2003-10-04 23:10 UTC (permalink / raw)
To: Vishwas Raman; +Cc: linux-kernel
On Sat, 04 Oct 2003 16:07:00 -0700
Vishwas Raman <vishwas@eternal-systems.com> wrote:
> And I need to get info on all TCP
> sockets and create/modify certain data structures of my own in the
> module based on that information.
Well, then, you're going to have to study and learn the entire
TCP stack in order to learn how to do this and furthermore to be
able to do this safely.
I'm a bit skeptical of what you actually want to use this for,
so I'm going to choose not to help you with this until you give
some more details of what you're exactly up to.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Onboard LAN Asus A7V8X-X (VT6102 [Rhine-II])
2003-10-04 23:10 ` David S. Miller
@ 2003-10-04 23:58 ` William Scott Lockwood III
2003-10-05 1:31 ` Dave Jones
0 siblings, 1 reply; 6+ messages in thread
From: William Scott Lockwood III @ 2003-10-04 23:58 UTC (permalink / raw)
To: linux-kernel
This motherboard has source included (but has an unfortunate advertising
clause) at the website for the onboard nic, but I can't make it work in
2.4.22 - is this nic supported natively, or will it be? I didn't find an
option for it in 2.4.22 or 2.6.0-test6. Is there any interest in a driver
for this board? It's a VIA VT6102 [Rhine-II].
--
/"\ / For information and quotes, email us at
\ / ASCII RIBBON CAMPAIGN / info@lrsehosting.com
X AGAINST HTML MAIL / http://www.lrsehosting.com/
/ \ AND POSTINGS / vlad@lrsehosting.com
-------------------------------------------------------------------------
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: Onboard LAN Asus A7V8X-X (VT6102 [Rhine-II])
2003-10-04 23:58 ` Onboard LAN Asus A7V8X-X (VT6102 [Rhine-II]) William Scott Lockwood III
@ 2003-10-05 1:31 ` Dave Jones
0 siblings, 0 replies; 6+ messages in thread
From: Dave Jones @ 2003-10-05 1:31 UTC (permalink / raw)
To: William Scott Lockwood III; +Cc: linux-kernel
On Sat, Oct 04, 2003 at 06:58:22PM -0500, William Scott Lockwood III wrote:
> This motherboard has source included (but has an unfortunate advertising
> clause) at the website for the onboard nic, but I can't make it work in
> 2.4.22 - is this nic supported natively, or will it be? I didn't find an
> option for it in 2.4.22 or 2.6.0-test6. Is there any interest in a driver
> for this board? It's a VIA VT6102 [Rhine-II].
CONFIG_VIA_RHINE should do the trick, though with the same chip on a
different board in 2.4.22, I had to boot with "acpi=off noapic"
This is now fixed in 2.4.23 iirc.
Dave
--
Dave Jones http://www.codemonkey.org.uk
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2003-10-05 1:32 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2003-10-04 0:02 Accessing tcp socket information from within a module Vishwas Raman
2003-10-04 5:51 ` David S. Miller
2003-10-04 23:07 ` Vishwas Raman
2003-10-04 23:10 ` David S. Miller
2003-10-04 23:58 ` Onboard LAN Asus A7V8X-X (VT6102 [Rhine-II]) William Scott Lockwood III
2003-10-05 1:31 ` Dave Jones
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox