Commit Graph

68 Commits

Author SHA1 Message Date
christos 3934378a65 Allocate the right size for pcb blocks.
XXX: pullup-7!
2015-02-08 15:09:45 +00:00
christos b0698f50d1 print the timer flags. 2015-02-07 19:36:06 +00:00
christos 30107bf0d8 Update for new pcb tailq's.
While here fix ipv6 pcb printing by making tcp6_dump with tcp.
XXX: Merge the inet and the inet6 code. It is silly to need to specify
-p tcp6 to print a tcp6 pcb, we already know what it is.
2013-11-23 22:01:12 +00:00
christos 04908d82dd use correct function and symbolic constants 2013-10-19 15:56:05 +00:00
christos 35be7e66a7 use new scopeid functions 2013-10-19 00:28:38 +00:00
christos 15a5bba97c - avoid pointer gymnastics
- remove unused variables
2013-10-18 20:26:45 +00:00
martin a4110c4cbe Not all pointers are 64bit - use uintptr_t instead of uint64_t. 2013-06-20 10:43:18 +00:00
christos 08c3d981c5 Don't use -P as a kmem printer, verify that the address points to a pcb first! 2013-06-19 21:12:03 +00:00
joerg e240adbd0b Retire OSI network stack. OK core@ 2013-03-01 18:25:13 +00:00
spz 5f1fd2312c RA flood mitigation via a limit on accepted routes:
- introduce a limit for the routes accepted via IPv6 Router Advertisement:
  a common 2 interface client will have 6, the default limit is 100 and
  can be adjusted via sysctl
- report the current number of routes installed via RA via sysctl
- count discarded route additions. Note that one RA message is two routes.
  This is at present only across all interfaces even though per-interface
  would be more useful, since the per-interface structure complies to RFC2466
- bump kernel version due to the previous change
- adjust netstat to use the new value (with netstat -p icmp6)
2011-05-24 18:07:11 +00:00
dyoung 0d0dd0e146 Suppress whitespace at EOL to fix lib/librumphijack/t_tcpip. 2011-05-11 22:21:59 +00:00
drochner 4f6bdd19b5 use getmicrouptime(9) rather than microtime(9) for TIME_WAIT duration
calculation, because this doesn't get confused by system time changes,
and uses less CPU cycles
reviewed by dyoung
2011-05-11 15:08:59 +00:00
dyoung fea546afcb Don't use type qualifier 'register'. 2011-05-04 00:55:19 +00:00
dyoung 7f40ffb8aa Do not display expired or reclaimed vestigial TIME_WAIT entries. 2011-05-03 23:36:26 +00:00
dyoung c2e43be1c5 Reduces the resources demanded by TCP sessions in TIME_WAIT-state using
methods called Vestigial Time-Wait (VTW) and Maximum Segment Lifetime
Truncation (MSLT).

MSLT and VTW were contributed by Coyote Point Systems, Inc.

Even after a TCP session enters the TIME_WAIT state, its corresponding
socket and protocol control blocks (PCBs) stick around until the TCP
Maximum Segment Lifetime (MSL) expires.  On a host whose workload
necessarily creates and closes down many TCP sockets, the sockets & PCBs
for TCP sessions in TIME_WAIT state amount to many megabytes of dead
weight in RAM.

Maximum Segment Lifetimes Truncation (MSLT) assigns each TCP session to
a class based on the nearness of the peer.  Corresponding to each class
is an MSL, and a session uses the MSL of its class.  The classes are
loopback (local host equals remote host), local (local host and remote
host are on the same link/subnet), and remote (local host and remote
host communicate via one or more gateways).  Classes corresponding to
nearer peers have lower MSLs by default: 2 seconds for loopback, 10
seconds for local, 60 seconds for remote.  Loopback and local sessions
expire more quickly when MSLT is used.

Vestigial Time-Wait (VTW) replaces a TIME_WAIT session's PCB/socket
dead weight with a compact representation of the session, called a
"vestigial PCB".  VTW data structures are designed to be very fast and
memory-efficient: for fast insertion and lookup of vestigial PCBs,
the PCBs are stored in a hash table that is designed to minimize the
number of cacheline visits per lookup/insertion.  The memory both
for vestigial PCBs and for elements of the PCB hashtable come from
fixed-size pools, and linked data structures exploit this to conserve
memory by representing references with a narrow index/offset from the
start of a pool instead of a pointer.  When space for new vestigial PCBs
runs out, VTW makes room by discarding old vestigial PCBs, oldest first.
VTW cooperates with MSLT.

It may help to think of VTW as a "FIN cache" by analogy to the SYN
cache.

A 2.8-GHz Pentium 4 running a test workload that creates TIME_WAIT
sessions as fast as it can is approximately 17% idle when VTW is active
versus 0% idle when VTW is inactive.  It has 103 megabytes more free RAM
when VTW is active (approximately 64k vestigial PCBs are created) than
when it is inactive.
2011-05-03 18:28:44 +00:00
pooka f2ee316255 Add netstat rump client. For now, it always sets -X, i.e. will
use only sysctl and no kvm (implementing /dev/mem for a rump kernel
would probably not be hard, but still a non-zero effort).

Note: since there is absolutely no network activity in a fresh rump
kernel, rump.netstat usually displays exactly nothing when invoked
without parameters.  Arguments like -r, -bi, -p icmp etc. produce
more stuff.
2010-12-13 21:15:30 +00:00
lukem d5a0caad3b Fix many WARNS=4 issues (-Wshadow -Wcast-qual -Wsign-compare).
Fix probable bug with numeric printing of anon ports when using sysctl.
2009-04-12 16:08:37 +00:00
dholland e203f53315 Make netstat handle -a properly; that is, don't show unconnected
listener sockets unless -a was given. (It was checking the local
address instead of the remote address for being INADDR_ANY or
equivalent.)

PR 38093 from Dieter Roelants; I adjusted the patch a little.

This needs pullups for both -4 and -5.
2009-02-22 07:43:01 +00:00
thorpej 40edcfedc2 Note which things are not available by KVM, and print a nice message
stating so if someone specifically asks for it.
2008-04-24 04:09:27 +00:00
thorpej 0e499be12d Make pim6 stats per-cpu. 2008-04-15 05:40:15 +00:00
thorpej 16497cdf28 Make raw6 stats per-cpu. 2008-04-15 05:13:37 +00:00
thorpej db098952cf Use ANSI function decls throughout. 2008-04-15 04:50:05 +00:00
thorpej c2da059bc6 Make udp6 stats per-cpu. 2008-04-15 04:43:25 +00:00
thorpej 3f466bce48 Change IPv6 stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old ip6stat structure; old netstat
binaries will continue to work properly.
2008-04-08 23:37:43 +00:00
thorpej aa8724ff7b Change ICMP6 stats from a structure to an array of uint64_t's.
Note: This is ABI-compatible with the old icmp6stat structure; old netstat
binaries will continue to work properly.
2008-04-08 15:04:35 +00:00
matt 3b1e7dbd0b Fix more -combine fallout. (mismatched definitions) 2008-02-16 07:16:01 +00:00
liamjfoy 5e73ba0829 Add new IPv6 Fast Forward statistics 2007-03-07 22:22:50 +00:00
hubertf 48b31403c5 Remove duplicate #includes
From Slava Semushin <slava.semushin@gmail.com>, via private mail
2007-01-17 00:21:43 +00:00
elad a81bf90a94 PR/31347: Geoff C. Wing: netstat err message is ambiguous about cause
Applied patch, thanks!
2006-09-22 23:21:52 +00:00
rpaulo 088720fe4b Don't print an error if kernel doesn't have INET6 support.
By Jukka Salmi on current-users.
2006-05-31 13:26:17 +00:00
elad 5d7aa1a613 Make netstat use sysctl when dumping routing tables/stats.
Heavily based on similar code from Claudio Jeker (at OpenBSD).

While here, fix inet/inet6 sysctl stuff commited previously to
actually work, and some other nits to make netstat more sysctl
friendly.

One step closer to losing setgid kmem on this one...
2006-05-28 16:51:40 +00:00
liamjfoy 362a260c6d check if malloc(3) failed
ok joerg@
2006-05-21 21:01:55 +00:00
rpaulo c5a8fe81ae Use net.inet6.{ip6,udp6,pim6,raw6}.stats for live systems.
Reviewed by Elad Efrat.
2005-08-28 21:06:57 +00:00
rpaulo 51345e62d3 Use net.inet6.tcp6.pcblist, net.inet6.tcp6.stats (not implemented yet) and
net.inet6.icmp6.stats if we are gathering information from a live system.

Reviewed by Elad Efrat.
2005-08-28 16:12:35 +00:00
rpaulo 9ce7ce6bf0 Added #include <kvm.h> since netstat.h, which is included too, needs it. 2005-08-04 19:41:28 +00:00
atatat 61ae0cbaf1 print the proper pointer for the pcb address. otherwise, all the udp6
pcb addresses are the same as unrelated udp pcb addresses.
2005-02-13 03:15:18 +00:00
itojun b95181fc9b NI_WITHSCOPEID was not picked up by IETF standardization process. 2004-11-16 05:59:32 +00:00
itojun 9a941e2d01 handle KAME scopeid hack for multicast addr. Matthias Drochner 2003-11-06 06:11:48 +00:00
itojun 070ac19762 fix PR bin/22739 (netstat -nlv -f inet6 weird) 2003-09-12 10:43:42 +00:00
itojun 0162be23d0 synchronize w/ inpcb/in6pcb change 2003-09-04 09:23:35 +00:00
agc 89aaa1bb64 Move UCB-licensed code from 4-clause to 3-clause licence.
Patches provided by Joel Baker in PR 22365, verified by myself.
2003-08-07 11:13:06 +00:00
itojun 47d22404d4 use proper #ifdef to determine behavior (__KAME__) 2003-05-14 23:36:32 +00:00
jdolecek 842b4adcdc it's not necessary to limit the service name artificially to 8 characters
in inet*print() - only first 'width' characters of the 'host.service'
string would be printed anyway, so allow full service name if string would fit
2003-03-22 15:18:36 +00:00
grant b1aed1c393 fix typo, from sm@resistor.net in misc/18816. 2002-10-26 17:06:08 +00:00
itojun 95c1349e5d use strchr, not index 2002-06-09 02:44:55 +00:00
itojun c868e666a2 print rip6stat. sync with kame 2001-10-18 09:26:16 +00:00
thorpej dc5de996f4 Make the PCB address printing look like the IPv4 version. 2001-09-10 14:25:12 +00:00
itojun 1dca70a51b typo 2001-06-13 02:50:25 +00:00
assar 7aedc79d5e add `-s' that prints port numbers symbolically but addresses numerically 2001-05-28 04:22:55 +00:00
itojun ea6a7c4787 pedant changes for strcpy/sprintf. 2001-04-06 05:10:28 +00:00