Commit Graph

513 Commits

Author SHA1 Message Date
mlelstv 05f80f69b3 avoid signed/unsigned error when computing mask lengths for empty
masks with sa_len == 0 (happens for inet6 default route).
2006-10-03 08:30:12 +00:00
elad 65305bdc98 Good intentions are still intentions. If we can't open kvm, but we still
have sysctl, it's still not enough for -P. A groveler is a groveler is
a groveler.

On a different note, this code needs a rewrite.
2006-09-27 12:51: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
elad b77c058061 We now have CARP, so don't skip IFT_CARP in link_print(). 2006-09-16 12:25:11 +00:00
christos 32f8a691e7 - Back to using kvm if we have access to it, since the sysctl stats do not
yet support all the fields we need.
- Don't core-dump if we could not open the kvm file.
2006-09-14 20:43:50 +00:00
christos 13a976b45e print "-"'s for the statistics that we don't support in the sysctl interface
and make columns aligned again.
2006-09-14 20:42:34 +00:00
rpaulo 2fb2ae3251 Import of TCP ECN algorithm for congestion control.
Both available for IPv4 and IPv6.
Basic implementation test results are available at
http://netbsd-soc.sourceforge.net/projects/ecn/testresults.html.

Work sponsored by the Google Summer of Code project 2006.
Special thanks to Kentaro Kurahone, Allen Briggs and Matt Thomas for their
help, comments and support during the project.
2006-09-05 00:29:35 +00:00
matt a5db205458 Conditionalize XNS support. No longer enabled. 2006-08-26 15:33:20 +00:00
christos c10a5d302a well, the || needed to be an && and the operand order needed to be changed.
XXX: There are still things like interface printing that need kvm.
2006-08-22 20:06:17 +00:00
christos ed6a70d32a Fix another && || confusion, from Kurt Schreiner, thanks! 2006-08-21 18:31:24 +00:00
christos a49f247028 Don't use || if you need &&. 2006-08-17 22:23:07 +00:00
rpaulo 4381b9dc9b Revert previous. 2006-08-17 01:42:57 +00:00
rpaulo d7a463a8aa Adapt to ECN. 2006-08-17 01:32:13 +00:00
rpaulo 63b3e9f51c It's not an error if we can't print CARP stats, it just means it's not built
in.
2006-06-20 19:22:17 +00:00
christos 13b8a79d82 PR/33677: Scott Ellis: Building with MKINET6=no causes netstat to fail compiling 2006-06-09 16:39:11 +00:00
elad fb101b952c another netstat fix, Kurt Schreiner. thanx! 2006-06-04 22:39:33 +00:00
elad e7a2ce04a1 fix logic; from Kurt Schreiner 2006-06-04 20:01:14 +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
elad 48404677c4 be quiet if symbol not in namelist, nothing cares 2006-05-27 23:57:32 +00:00
rpaulo f6e31a1aa2 Fix carp_stats() prototype location.
Noticed by Iain Hibbert.
2006-05-23 14:31:11 +00:00
liamjfoy 362a260c6d check if malloc(3) failed
ok joerg@
2006-05-21 21:01:55 +00:00
riz 64cde4117b Use PRIu64 to format uint64_t quantities, instead of %llu, in
newly-introduced code.

XXX more %llu cleanup is needed throughout netstat code.
2006-05-18 17:19:22 +00:00
liamjfoy 4876c304b1 Integrate Common Address Redundancy Procotol (CARP) from OpenBSD
'pseudo-device	carp'

Thanks to: joerg@ christos@ riz@ and others who tested
Ok: core@
2006-05-18 09:05:49 +00:00
mrg 0e223467a4 nfiles -> ns_nfiles (conflicts with kernel header files and _KERNEL.) 2006-05-11 01:23:20 +00:00
rpaulo 32f6ca81fb snprintf returns int, not size_t. CID 691.
From bjh21.
2006-04-06 18:30:31 +00:00
christos 6e2787485e Coverity CID 2336: Fix memory leak. 2006-04-02 03:19:34 +00:00
rpaulo fbe17c43c7 Bump date for previous. 2005-12-28 22:53:59 +00:00
rpaulo fa0b253ddc Explain the netstat -B flag column. 2005-12-28 17:57:16 +00:00
rpaulo e5a1f0391d Convert 3 printf() calls into one puts(). 2005-11-21 22:43:34 +00:00
drochner 360dbbc86f make bpf stats #ifndef SMALL,
fixes build of x_netstat
2005-09-14 15:35:26 +00:00
wiz b5e0c3219f Punctuation fix. From YOMURA Masanori in private mail. 2005-09-11 23:20:12 +00:00
wiz ad44d18838 Argument is address_family, not "address family". From YOMURA Masanori in private mail. 2005-09-11 23:19:27 +00:00
elad 4c70438790 Use sysctl to fetch AF_LOCAL PCB lists if reading live kernel. 2005-09-04 18:59:57 +00:00
rpaulo f20c174719 Place the sysctl code under an if block and print an error message if the
user tries to fetch information via kvm.

Discussed with Elad Efrat.
2005-09-02 22:52:24 +00:00
rpaulo d65009381e Request process information using sysctl(3) and not kvm(3) since bpf(4)
statistics and peers are only available using the former.
2005-09-02 22:23:13 +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
elad bbf85a429b Use PRIxPTR when printing a pointer. 2005-08-12 14:08:16 +00:00
he 4577ef8d16 Replace usage of caddr_t with intptr_t, to allow this to build cleanly
on both 32- and 64-bit archs.
2005-08-08 12:11:52 +00:00
elad dbc883fab2 Use sysctl to read live kernel PF_INET PCBs. 2005-08-07 17:10:36 +00:00
elad c1494c99c6 Use sysctl to fetch IP, ICMP, TCP, and UDP statistics. 2005-08-06 17:58:13 +00:00
rpaulo ec70a5dc17 Explained how -B works and how it works in conjunction with -I or -s.
Reviewed by wiz@
2005-08-06 11:23:32 +00:00
elad 8920c39bb8 Fix printing formats. 2005-08-05 12:16:51 +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
rpaulo 22a0fcf290 Added bpf.c. 2005-08-04 19:40:00 +00:00
rpaulo 66daeed445 Implemented the userland part of the BPF statistics and BPF peers,
net.bpf.stats and net.bpf.peers sysctls respectively. netstat(1) now
has an additional syntax:
	netstat [-s] [-B] [-I Interface]

Only the super user can see a list of BPF peers with the following command:
# netstat -B
Active BPF peers
PID     Int     Recv     Drop     Capt     Flags  Bufsize  Comm
4941    lo0     0        0        0        I--S-  262144   tcpdump
252     ex0     19668    0        5        I-RS-  32768    dhclient

And every user can see the BPF statistics with:
$ netstat -s -B
bpf:
        19669 total packets received
        5 total packets captured
        0 total packets dropped

This idea came from FreeBSD (Christian S.J. Peron) but, currently, they
doen't have a userland utility in the base system to read the sysctls.

Reviewed by: christos@
2005-08-04 19:39:40 +00:00
atatat e698a148f7 For connected local domain sockets that don't have a "local" name,
print the "remote" name instead.
2005-03-04 03:59:07 +00:00
atatat 9244b3d60d Print the pcb address like the man page says, not the socket address. 2005-03-04 03:57:48 +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
lukem 7157011597 Only compile in IPv6 support if ${USE_INET6} != "no"
MKINET6 is for providing IPv6 infrastructure.
USE_INET6 is for compiling IPv6 support into the programs (needs MKINET6).
2005-01-10 02:58:58 +00:00
itojun da88342476 NI_WITHSCOPEID was not picked up by IETF standardization process 2004-11-16 06:04:12 +00:00
itojun b95181fc9b NI_WITHSCOPEID was not picked up by IETF standardization process. 2004-11-16 05:59:32 +00:00
dsl dfdc37e2fe Add (unsigned char) cast to ctype functions 2004-10-30 20:56:20 +00:00
martin ee9d1625eb Make it compile on ports where u_quad_t is not printf-format-compatible
with unsigned long long.
2004-09-06 14:51:32 +00:00
manu 753bcaf581 IPv4 PIM support, from the submission of Pavlin Radoslavov on tech-net@ 2004-09-04 23:35:43 +00:00
atatat 14eee8f4cc Rework sys/netipsec/ipsec_netbsd.c to present a more consistent tree.
Rework usr.bin/netstat/fast_ipsec.c to find the stats nodes under the
new names (Kame uses the name stats so we use different ones), as well
as setting slen appropriately between calls to sysctlbyname(), and
providing forward compatibility when actually retrieving stats via
sysctlbyname().

And correct a spelling error.
2004-07-17 16:36:39 +00:00
jonathan f8aeaf6223 Fix two stupid bugs I introduced with stats for fast-ipsec:
1. Pass the caller-supplied protocol name down through ipsec_switch().

2. Remove my poor attempt to print fast-ipsec stats automagically for
`netstat -s'.  The previous code would print (fast)IPsec per-protocol
stats even for 'netstat', which is just wrong.

A better fix would be to enumerate the sub-"protocols" under IPsec;
but first lets fix the broken behaviour now, for a pullup to 2.0.
2004-06-27 01:10:53 +00:00
christos 45a11d4b25 Temporary hack to fix ipsec stats lossage. Atatat, are you listening? 2004-06-06 17:11:48 +00:00
itojun cf6b841417 print stat for TCP MD5 signature 2004-05-18 14:44:41 +00:00
petrov 68cb92eb3b Forgotten $ for NetBSD key. 2004-05-09 03:20:44 +00:00
petrov 6e4bb32a73 Use int_fmtio.h and PRUx formats for longs. 2004-05-09 03:18:50 +00:00
jonathan 85b3ba5bf1 Redo net.inet.* sysctl subtree for fast-ipsec from scratch.
Attach FAST-IPSEC statistics with 64-bit counters to new sysctl MIB.
Rework netstat to show FAST_IPSEC statistics, via sysctl,  for
netstat -p ipsec.

New kernel files:
	sys/netipsec/Makefile		(new file; install *_var.h includes)
	sys/netipsec/ipsec_var.h	(new 64-bit mib counter struct)

Changed kernel files:
	sys/Makefile			(recurse into sys/netipsec/)
	sys/netinet/in.h		(fake IP_PROTO name for fast_ipsec
					sysctl subtree.)
	sys/netipsec/ipsec.h		(minimal userspace inclusion)
	sys/netipsec/ipsec_osdep.h	(minimal userspace inclusion)
	sys/netipsec/ipsec_netbsd.c	(redo sysctl subtree from scratch)
	sys/netipsec/key*.c		(fix broken net.key subtree)

	sys/netipsec/ah_var.h		(increase all counters to 64 bits)
	sys/netipsec/esp_var.h		(increase all counters to 64 bits)
	sys/netipsec/ipip_var.h		(increase all counters to 64 bits)
	sys/netipsec/ipcomp_var.h	(increase all counters to 64 bits)

	sys/netipsec/ipsec.c		(add #include netipsec/ipsec_var.h)
	sys/netipsec/ipsec_mbuf.c	(add #include netipsec/ipsec_var.h)
	sys/netipsec/ipsec_output.c	(add #include netipsec/ipsec_var.h)

	sys/netinet/raw_ip.c		(add #include netipsec/ipsec_var.h)
	sys/netinet/tcp_input.c		(add #include netipsec/ipsec_var.h)
	sys/netinet/udp_usrreq.c	(add #include netipsec/ipsec_var.h)

Changes to usr.bin/netstat to print the new fast-ipsec sysctl tree
for "netstat -s -p ipsec":

New file:
	usr.bin/netstat/fast_ipsec.c	(print fast-ipsec counters)

Changed files:
	usr.bin/netstat/Makefile	(add fast_ipsec.c)
	usr.bin/netstat/netstat.h	(declarations for fast_ipsec.c)
	usr.bin/netstat/main.c		(call KAME-vs-fast-ipsec dispatcher)
2004-05-07 00:55:14 +00:00
atatat e9814619fb sysctl(3) no longer returns ENOPROTOOPT in this case, but ENOENT,
which is a more generic "that's not in the tree" response.

ENOPROTOOPT was specific to the net subtree under the old framework,
and didn't add much value (other than letting the caller know they
were looking up something under the net subtree, which they presumably
ought to have known already).
2004-04-09 18:48:05 +00:00
ragge ab6a210f76 Use itimerval() instead of alarm() for interval displaying. This increases
accuracy on interval stats also on fast machines.
2003-11-15 11:54:34 +00:00
itojun 9a941e2d01 handle KAME scopeid hack for multicast addr. Matthias Drochner 2003-11-06 06:11:48 +00:00
enami 07bf4ffc50 mbstat.m_drain is still maintained. Don't skip it. 2003-10-18 12:26:26 +00:00
enami 52b6a13784 Print ips_rcvmemdrop and ips_nogif. 2003-10-17 22:28:11 +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
itojun c636858983 correct strange indentation 2003-08-19 12:52:13 +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 4c488f6bec always print prefixlen for routes. it's CIDR age. 2003-08-04 11:10:33 +00:00
itojun 182a98314c support new algorithms 2003-07-25 10:06:09 +00:00
itojun aa96314290 support hmac-sha2. 2003-07-22 03:41:28 +00:00
he 80ccb5520c As a temporary workaround, apply the fix from PR#20390, thereby
cooperating with the callout code in working around the race
condition caused by the TCP code's use of the callout facility.

Instead of unconditionally releasing memory in tcp_close() and
SYN_CACHE_PUT(), check whether any of the related callout handlers
are about to be invoked (but have not yet done callout_ack()), and
if so, just mark the associated data structure (tcpcb or syn cache
entry) as "dead", and test for this (and release storage) in the
callout handler functions.
2003-07-20 16:35:07 +00:00
itojun 417386ecc9 strlcpy 2003-07-12 13:38:10 +00:00
itojun 47d22404d4 use proper #ifdef to determine behavior (__KAME__) 2003-05-14 23:36:32 +00:00
lukem ef83aa34d9 clear errno before strto(u)l() if we're going to test it for ERANGE afterwards 2003-04-18 03:21:00 +00:00
itojun 01757d86d6 make char array bigger where it seems too small and may overrun. 2003-04-15 08:07:10 +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
itojun 424153ef69 TF_PROTO1/2 mixup. from itou makoto 2003-03-02 01:59:06 +00:00
enami acf5c11cc1 Don't use uninitialized variable. 2003-02-27 08:07:14 +00:00
matt 65e5548a17 Add MBUFTRACE kernel option.
Do a little mbuf rework while here.  Change all uses of MGET*(*, M_WAIT, *)
to m_get*(M_WAIT, *).  These are not performance critical and making them
call m_get saves considerable space.  Add m_clget analogue of MCLGET and
make corresponding change for M_WAIT uses.
Modify netinet, gem, fxp, tulip, nfs to support MBUFTRACE.
Begin to change netstat to use sysctl.
2003-02-26 06:31:08 +00:00
wiz 990562bfef .Nm does not need a dummy argument ("") before punctuation or
for correct formatting of the SYNOPSIS any longer.
2003-02-25 10:34:36 +00:00
perry 8a49ec08e4 "Utilize" has exactly the same meaning as "use," but it is more
difficult to read and understand. Most manuals of English style
therefore say that you should use "use".
2003-02-04 23:07:28 +00:00
thorpej 9abf2fa449 Update for callout changes, and show TCP timers in relative, rather
than absolute ticks.
2003-02-04 01:22:08 +00:00
thorpej 7d9af30957 Test CALLOUT_PENDING, not CALLOUT_ACTIVE. 2003-02-03 23:37:09 +00:00
christos 0fcef5865c undo mallocvar.h changes! 2003-02-02 02:35:58 +00:00
tron 1161776951 Include "sys/mallocvar.h" with "_KERNEL" defined in time to avoid
build failure because MALLOC_DECLARE() is not defined.
2003-02-01 18:35:44 +00:00
martin 304244f5d7 Avoid integer overflow in percent calculation when facing a mbuf leak.
Fixes PR bin/19381 by Michael van Elst (slightly different than suggested).
2002-12-14 11:12:24 +00:00
grant b1aed1c393 fix typo, from sm@resistor.net in misc/18816. 2002-10-26 17:06:08 +00:00
grant be8ae688ae New sentence, new line. 2002-09-30 11:08:56 +00:00
lukem 5d4973fe97 makefile delint. use NETBSDSRCDIR as appropriate 2002-09-18 14:00:33 +00:00
enami 0512a0df7f Add more software intrq. 2002-07-23 23:34:39 +00:00
itojun 15168e8feb typo. sync w/kame 2002-07-03 07:35:40 +00:00
enami 54a4e901f8 Introduce -q flag to print some information (like number of packets dropped
due to queue full) about software interrupt queues such as ipintrq.
2002-07-03 01:42:59 +00:00
soren 81abc60321 Sync SYNOPSIS and usage() with reality. 2002-07-02 21:34:18 +00:00
itojun 8b228ca304 use macro to determine link-local multicast addr 2002-06-19 23:38:59 +00:00
itojun 9be14081f9 identify kame scopeid hack with KAME_SCOPEID 2002-06-19 16:42:09 +00:00
itojun f51456c273 err/errx/warn/warnx do not need \n at the end 2002-06-11 06:06:18 +00:00
itojun 95c1349e5d use strchr, not index 2002-06-09 02:44:55 +00:00
yamt be385ec4c0 make an auto const variable static. 2002-06-08 14:56:26 +00:00
itojun 3a544704fb member of mrtstat are u_long, so %lu is more appropriate than %ld. 2002-06-02 15:45:58 +00:00
itojun e0280bbb53 KNF 2002-06-02 15:25:42 +00:00
itojun 3e7ae517e0 path MTU discovery blackhole detection.
PR 12790 (sorry for not committing it for a long time)
2002-05-26 16:05:43 +00:00
matt 83765a6e69 Don't count on kernel includes to exports user variables. 2002-05-13 05:13:23 +00:00
itojun 53a52c0ad8 pfkey statistics was presented in wrong direction. 2002-03-21 04:23:36 +00:00
sommerfeld 16d5bd2bae Adapt to pool rototill. 2002-03-09 23:26:51 +00:00
lukem a3bab9b7d7 clarification of vflag 2002-02-27 03:55:14 +00:00
lukem e16c1d5cbc if not -n and the local socket doesn't have INP_ANONPORT set, always try
to determine the symbolic name of the foreign port.

previously the foreign port would be displayed numerically in this case if
the local & foreign ports were different.  this particular behaviour was
added in rev 1.28 when I added INP_ANONPORT support from FreeBSD, and for
the life of me I can't fathom the rationale for it ;-|
2002-02-27 02:33:51 +00:00
wiz aded0d2cce Whitespace cleanup. 2001-12-01 16:43:07 +00:00
itojun c868e666a2 print rip6stat. sync with kame 2001-10-18 09:26:16 +00:00
bjh21 f4c2a9f013 Use getnameinfo() to format link-layer addresses for netstat -r rather than
doing it ourselves and falling back to link_ntoa().
2001-10-06 18:56:49 +00:00
bjh21 3369b8a6bb Use getnameinfo() for printing link-layer addresses in netstat -i, rather
than doing it ourselves.
2001-10-06 18:48:30 +00:00
thorpej daa2a3c1a7 Fix a printf format/argument cast. 2001-09-15 16:28:15 +00:00
thorpej 9c5f5108f7 tcp_dump(): Also print the address of the in6pcb. 2001-09-10 22:19:03 +00:00
thorpej 2807c29a57 Update for TCP timer changes. 2001-09-10 22:17:28 +00:00
thorpej 2dcc5d04ec Update for field name changes in struct tcpcb. 2001-09-10 15:25:24 +00:00
thorpej dc5de996f4 Make the PCB address printing look like the IPv4 version. 2001-09-10 14:25:12 +00:00
sommerfeld e15a851896 Cross-reference fstat(1) 2001-09-03 14:56:08 +00:00
itojun bc9b3f2aa8 snprintf length audit. from openbsd 2001-08-19 02:01:24 +00:00
itojun 8499f264ae present SPD cache lookup stats. sync with kame 2001-08-06 10:25:54 +00:00
wiz 3f9984fc90 `existent', not `existant' 2001-06-19 13:42:07 +00:00
itojun 1dca70a51b typo 2001-06-13 02:50:25 +00:00
itojun 33f046d400 typo 2001-05-28 05:52:41 +00:00
assar 7aedc79d5e add `-s' that prints port numbers symbolically but addresses numerically 2001-05-28 04:22:55 +00:00
wiz 7da30c83ac Change xref for vmstat(8) to vmstat(1).
Whitespace, punctuation and spelling fixes while I'm here.
2001-05-06 23:48:31 +00:00
itojun ea6a7c4787 pedant changes for strcpy/sprintf. 2001-04-06 05:10:28 +00:00
christos 7ee2aad347 PR/12517: Izumi Tsutsui: Don't use paddr_t in netstat; change to u_long 2001-03-31 20:11:18 +00:00
itojun 09afaac4e2 add sctp (maybe we should add it to /etc/protocols instead?) 2001-03-20 17:02:33 +00:00
itojun dd99f85c8e add few icmp type names.
http://www.isi.edu/in-notes/iana/assignments/icmp-parameters
2001-03-20 17:00:08 +00:00
enami 33ee74b742 Print hopcount too when -rv is given. 2001-03-08 03:47:04 +00:00
itojun 7806b5d1f3 increase ipstat.ips_badaddr if the packet fails to pass address checks. 2001-03-02 04:26:10 +00:00
itojun e79a9123a3 use u_quad_t for rtstat.
not sure if it really matters, but short (32K) looks way too small given
recent fat pipes connecting *BSD boxes, and our great uptime :-).
2001-02-21 05:45:11 +00:00
cgd a8ec668ddf convert to use getprogname() 2001-02-19 23:03:42 +00:00
itojun 22b473e0f6 during ip6/icmp6 inbound packet processing, do not call log() nor printf() in
normal operation (/var can get filled up by flodding bogus packets).
sysctl net.inet6.icmp6.nd6_debug will turn on diagnostic messages.
(#define ND6_DEBUG will turn it on by default)

improve stats in ND6 code.

lots of synchronziation with kame (including comments and cometic ones).
2001-02-07 08:59:47 +00:00
itojun fee00b1a78 mark cloned routes with RTF_CLONED. present it with netstat -r by "c".
let static routes overwrite cloned routes, as cloned routes can come back again
if necessary.  behavior same as freebsd/bsdi, code partially from bsdi42.
(NRL rt->rt_parent was not added)
should fix PR 11916 and maybe some other PRs with ARP behavior.

recompilation of usr.sbin/route6d is suggested.
2001-01-27 04:49:31 +00:00
itojun b206900063 try to lookup /etc/protocols for histogram 2000-12-14 20:38:10 +00:00
itojun 8b398d8448 typo in -s message 2000-12-11 17:52:43 +00:00
matt c3405770e4 Do the same IEEE1394 address hack in here. 2000-11-14 23:07:40 +00:00
matt b6e8f357a2 Print out IEEE1394 addresses with : . Add a hack to limit the address
to 8 bytes.
2000-11-14 23:00:57 +00:00
itojun 35ff033435 more fix to "pfkey printed twice" problem. PR 11323 from ura. 2000-10-28 03:53:33 +00:00
itojun 3029ed7874 count path MTU changes. 2000-10-23 03:46:23 +00:00
itojun 9e8a83c2a4 count successful path MTU changes. good for debugging.
(there could be some discussion on when to increase the counter...)
2000-10-18 19:20:02 +00:00
is 135600f947 More format string cleanup by sommerfeld. 2000-10-11 14:46:00 +00:00
itojun 544bd86193 don't print pfkey statistics twice. from uep 2000-10-05 03:22:59 +00:00
itojun eccf945a90 be ready for rijndael 2000-10-02 17:46:42 +00:00
jhawk 684592f691 Rewrite tprintstat() so that netstat -ss functionality works
correctly for the "tp:" case (family iso). To avoid serious code
space bloat, stats are now table-driven.

A side-effect is that the mbuf chain statistics have been slightly re-ordered
to follow the 3 lines of EOT stats (still under Miscellaneous) rather
than sandwiched between "dec bits" and the EOTs.
2000-08-31 06:49:42 +00:00
jhawk b70721109d Add kernel counters for arp events, displayable with netstat -s -f arp 2000-08-15 20:24:57 +00:00
itojun 4372a4b82a -Wall friendly 2000-08-13 18:48:22 +00:00
jhawk a80c6e8208 Fix netstat -ss handling for a bunch of ISO cases, so that
zero values are not printed.
"tp:" still needs some work, though.
2000-08-13 18:41:38 +00:00
itojun e07dc430ef sync with net/pfkeyv2.h change. do not assume SADB_[EAC]ALG numbers are
continuous.  sync with kame.
2000-07-20 16:23:17 +00:00
itojun e233a99759 do not print m_pulldown statistics. it is too experimental and
belongs to kame tree only (not for *bsd tree).
2000-07-13 03:53:03 +00:00
itojun 5872028b21 more stats. from kame 2000-07-06 12:40:19 +00:00
enami 92b750d474 Allocate one more byte for the asterisk after the name of interface. 2000-07-03 05:06:43 +00:00
enami ed2b9a81c5 Backout part of rev 1.29 which doesn't match with the log message. 2000-07-03 05:02:38 +00:00
matt fcd0fb118f Make gcc 2.96 (and maybe earlier) happier. Include <stdlib.h>,<string.>,
etc. as appropriate to get exit,srncmp,abs,abort,etc.
Add -I${.CURDIR} to a few Makefiles
2000-07-03 02:51:12 +00:00
itojun 144ba78cf9 with -inv flag, do not truncate name of the interface (like "strip0"). 2000-07-02 09:07:23 +00:00
itojun ff5f8a8828 print # of packets filtered by icmp6 rate limitation 2000-06-16 02:08:40 +00:00
itojun 92e7c0931d s/icmp/icmp6/ in message 2000-05-17 11:54:48 +00:00
enami 7e18584b57 Define members previously defined as u_long in struct iftot as u_quad_t.
Since these members are used to hold members defined now as u_quad_t
in struct if_data, u_long is quite not enough actually.
Without this, one night ttcp easily makes netstat to produce wrong output
like this:
enami@annex-2f-floor-244% netstat -ibw 1 -I tlp0
   tlp0 in            tlp0 out          total in           total out
     bytes               bytes             bytes               bytes
176333740607          176914940420         240082591           821282404
176093659136          176093659136                 0                   0
176093659136          176093659136                 0                   0
2000-04-19 03:26:55 +00:00
simonb d88dfea295 Don't declare 'extern opt*' getopt variables. 2000-04-14 06:11:07 +00:00
itojun 9da359bbec revise IPsec, pfkey, IPv6 multicast and IPv6 statistics. (sync with kame) 2000-02-26 09:55:24 +00:00
itojun 8b2de4271e use NI_WITHSCOPEID when printing multicast group with -inav. 2000-02-09 13:57:06 +00:00
itojun 9fb53279e8 print IPv6 scopeid on -inv. with -in, scopeid is omitted due to insufficient
width.
2000-02-05 17:39:22 +00:00
itojun 4978f056f6 better sync with #ifdef notdef part (in -i for AF_INET). 2000-01-25 16:07:13 +00:00
itojun 5fa65dbb58 don't truncate IPv4 entries on -i (with -v). it is mainly for
"Network" column (13 digits, it will be 18 digits in maximum).
2000-01-25 15:56:55 +00:00
itojun e30f445f00 print IPv6 multicast group on -ia (-iav will avoid truncation) 2000-01-17 18:24:37 +00:00
itojun 08de376ec3 fix default route determination for inet6. 2000-01-17 18:03:51 +00:00
itojun ccef23e54a mask addresses properly on netstat -inv.
From: Matt Thomas <matt@3am-software.com>
2000-01-17 17:54:56 +00:00
hubertf e27fbcf4a2 Properly print the "B"(lackhole) flag (as documented :).
Patch submitted in PR 9190 by URA Hiroshi <ura@hiru.aoba.yokohama.jp>
2000-01-15 01:39:54 +00:00
sommerfeld c657ebbc95 Pay attention to the netmask of routes to 0.0.0.0;
e.g., a route to 0.0.0.0/1 is *not* a default route.

Inspired by a patch by Rodney Grimes sent to the zebra list.
2000-01-07 04:49:11 +00:00
thorpej 2b9d9a9499 Make this compile on the Alpha again. 1999-12-16 00:58:17 +00:00
itojun 033763d6c9 per-interface statistics.
bring in and enable KAME scopeid hack.
lots of cleanups.
(sync with latest KAME)
1999-12-13 15:22:55 +00:00
tron b11e523694 Define "_KERNEL" not "KERNEL" before including "netinet6/ip6_mroute.h". 1999-12-02 14:31:22 +00:00
soren 819a9c5fd3 Print Internet6 header properly without -f. 1999-11-27 02:19:34 +00:00
itojun d8470360b1 more clarification to field width of netstat -rn -f inet6. 1999-11-24 08:45:43 +00:00
itojun 22758aaba3 use old WID_{DST,GW} value (field width for netstat -rn) for non-INET6
address families (see tech-net discussion).
1999-11-22 14:13:53 +00:00
bouyer f7e8e4aebd Change printf formats for 64bit counters. 1999-11-19 10:44:33 +00:00
is cef52aa203 Add -L option. netstat -r -L behaves like 4.3BSD netstat -r, that is, it
does not show route table entries pointing to link level addresses (ARP
entries or IPv6 neighbour discovery entries).
1999-09-15 20:12:18 +00:00
is 4d1abcb145 Netstat knows about "-f inet6". 1999-09-15 19:57:02 +00:00
dbj e1c216bcdf RTF_PROTO1 is indicated by the flag '1' and RTF_PROTO2 is indicated by the flag '2',
not the other way around
1999-09-12 02:33:43 +00:00
itojun f84fab5af8 sync with recent KAME.
- fix routing socket align issue on 64bit arch.
- avoid s6_addr{8,16,32}, which are nonstandard.
1999-09-03 04:26:31 +00:00
cgd f33ac29caa not all kvm_getfiles() errors are "out of memory." for instance,
some of them are caused by the kvm_getfiles() implementation being
TOTALLY BROKEN for dead kernels.  Print out the KVM descriptor's
error so that error causes are more easily diagnosed.
1999-08-19 06:13:09 +00:00
itojun 5413fa8362 do not include netinet/in6_systm.h, which has been empty for a while. 1999-07-30 10:31:22 +00:00
thorpej 00fb13f649 Revert previous, as it merely worked around a recent bug in make(1) which
is now fixed.
1999-07-12 18:17:56 +00:00
itojun e56c252759 make sure to use files in ${.CURDIR} before ${.CURDIR}/../../sys/netiso.
(namely iso.c)
1999-07-12 17:53:42 +00:00
itojun 5d56439d90 merge SRCS into one. 1999-07-12 17:48:45 +00:00
itojun 26c3d764fd add NetBSD RCS ID. 1999-07-06 13:14:54 +00:00
itojun 414ee1ddfb make netstat IPv6-ready. 1999-07-01 18:40:35 +00:00
thorpej c11fe1ae79 Print SYN,ACK retransmission statistics. 1999-04-29 03:58:27 +00:00
hubertf a8aaa73992 Remove duplicated if() statementA.
This fixes PR 7308 by Feico Dillema <feico@pasta.cs.uit.no>
1999-04-02 22:45:45 +00:00
chopps 005cdfb516 don't use malloc for large sockaddr's, just name the union declared above 1999-04-02 20:13:40 +00:00
chopps 87af70d729 user err() not errx() 1999-04-01 23:12:30 +00:00
chopps 3357b52e9b fix for sockaddr's that are bigger than standard sockaddr's (e.g., iso) 1999-04-01 08:14:11 +00:00
thorpej ed8849cd5a Define __POOL_EXPOSE to get at the guts of the pool descriptor. 1999-03-31 23:25:46 +00:00
garbled 9e44e9b578 More and more .Os cleanups. .Os is defined in the tmac.doc-common file,
so we shouldn't override it with versions in the manpages.  Many more to
come.
1999-03-22 18:16:34 +00:00
mycroft 58e1f7b9b0 Make the damned columns line up. 1999-03-14 22:28:05 +00:00
kristerw 010cbdf92e There is no -h flag. From OpenBSD. 1999-03-14 18:30:04 +00:00
sommerfe b36297112e fix PR7057: division by zero if no mbufs allocated
fix PR7059 (partial): mbuf cluster counts were based on counters which
are no longer maintained.
(full fix will involve renaming the now-unused fields in mclstat in mbuf.h)
1999-02-27 17:37:24 +00:00
lukem 2a6a3d1a76 rework so that `-A -n' won't truncate the `ipaddr.port' fields, by displaying
an abbreviated state column in that case (to fit in 80 columns)
1999-02-18 07:42:12 +00:00
explorer 6817ae8cab fix dumping of pcbs 1999-02-08 11:34:36 +00:00
lukem 266beeb0be remove sentence consistenting solely of "When" 1999-02-02 13:35:56 +00:00
kml 783ac03fcf Added a verbose flag for route display that will show
the various route metrics.
1999-01-15 19:06:25 +00:00
mrg a112081f50 #ifndef SMALL changes. saves 30k on the sparc 1999-01-11 12:31:53 +00:00
abs e516980de2 Apply (slightly modified) patch from 5543 to fix -s behaviour for netatalk. 1999-01-06 05:57:29 +00:00
pk 66bc493d73 Make a network number by shifting out host bits in octet units.
This is currently required still to get correct lookups in `/etc/networks'.
1998-12-05 13:14:04 +00:00
msaitoh 8240966355 fix invalid shift. colsed PR#5160. 1998-11-23 10:17:12 +00:00
mrg 3adcd350ed put all the different struct sockaddr_xxx types into the union pt_u, to force the alignment to be correct for all of them. 1998-10-31 06:42:22 +00:00
ross f670fa10c5 Add { and } to shut up egcs. Reformat the more questionable code. 1998-08-25 20:59:36 +00:00
sommerfe aecb58fd13 Fix bogon in length argument to snprintf when formatting port number 1998-07-20 21:03:37 +00:00
lukem f09ed79388 use AF_LOCAL instead of AF_UNIX. support -f local as synonym for -f unix 1998-07-18 05:04:10 +00:00
mrg efa1d2c3a5 - KNF
- use err(3)
- sprintf/strcpy -> snprintf/strncpy
- change route.c:domask() to take a size_t of the buffer passed.
1998-07-12 03:20:13 +00:00
mrg 80efe80bc9 - change setgid kmem programs (that lend themselves to this) so setegid(getgid())
and the top, and then set the effective gid back to kmem around the call to
  kvm_openfiles().  this reduces the time group kmem is available.
- for those above that also allow this, setgid(getgid()) after the call to
  kvm_openfiles() to fully revoke priviledges.
- some KNF
- use err(3) over fprintf(3) in some places
1998-07-06 07:50:18 +00:00
mrg 2beab49a06 - use an array MAXHOSTNAMELEN+1 size to hold hostnames
- ensure hostname from gethostname() is nul-terminated in all cases
- minor KNF
- use MAXHOSTNAMELEN over various other values/defines
- be safe will buffers that hold hostnames
1998-07-06 06:45:41 +00:00
thorpej 66012e9fca Add an option to dump the contents of a PCB at the specified address, and
implement this for TCP.
1998-06-03 02:41:10 +00:00
kml 78c488bad7 Partial fix for PR kern/5435 -- changed netstat to use unsigned counters
instead of signed.  The rest of the fix will have to wait for 64-bit counters.
1998-05-14 22:48:49 +00:00
kml 3c3dcf9966 Ensure that the 'L' lock flag for MTU is always displayed when present. 1998-05-14 20:55:51 +00:00
matt c3ef9d7317 Add support for printing fast forwarded packets. 1998-04-29 21:39:38 +00:00
kml 9433195784 Add support for a '-b' option to provide byte counts in and out,
instead of just packet counts.  On the byte screens, errors and
collisions are not shown, since they are more packet count related.
1998-03-19 02:42:57 +00:00
frueauf feff15ad4a s/_offsetof/offsetof and include stddef.h to reflect recent
change in sys/netiso/iso.h.
1998-01-29 09:11:21 +00:00
lukem 11cfadcaa1 if INP_ANONPORT is set in the pcb, don't getservbyport the local port,
as the service name is irrelevent. from freebsd
1998-01-07 22:55:07 +00:00
thorpej a9f58b2ca8 Print the connections dropped due to excessive persist timeouts. 1997-12-17 06:17:26 +00:00
thorpej d673bd5c41 Nuke "delayed window updates" statistic. 1997-12-13 21:03:46 +00:00
thorpej 76de9752dd Print window updates delayed (piggybacked on delayed ACKs). 1997-12-11 07:00:01 +00:00
thorpej 4047416683 Report connections drained due to memory shortage. 1997-12-10 07:26:02 +00:00
kml 9633603853 Added (and documented) a change to the route display, so that mtu values
which have been locked are indicated by an 'L' appended to the MTU value.
Locked routes have path mtu discovery turned off.
1997-10-28 22:38:42 +00:00
mrg 9395f04c8b fix compile warnings on the sparc. 1997-10-20 10:32:06 +00:00
lukem e55eeec2c5 fix up .Nm usage, getopt returns -1 not EOF 1997-10-19 05:49:56 +00:00
mikel c106897e5e add 'atalk' to list of arguments recognized by -f, minor cleanup 1997-08-01 05:03:14 +00:00
thorpej b3fb623d7f Pull SYN_cache_branch down onto the main line. 1997-07-23 21:31:27 +00:00
christos aef7001870 PR/3660: Dave Huang: Fix formatting misalignments in appletalk
PR/3659: Dave Huang: Fix PCB reporting in appletalk
1997-05-22 17:21:26 +00:00
gwr 10e180cc49 Back out the .PATH.c changes. The .depend problem (and others)
will be fixed using the new .NOPATH make feature instead.
1997-05-08 21:11:01 +00:00
gwr 012e528f2e Use .PATH.c: ... 1997-05-06 20:44:56 +00:00
christos 38ec358de7 Make the first field 2 characters wider so that XXX.XXX.XXX.XXX/XX fits.
From Kimmo
1997-04-10 15:45:58 +00:00
mikel 3bafb68ebf more column alignment fixes 1997-04-07 06:58:18 +00:00
christos 5fe1aec948 PR/3451: Anders Hjalmarsson: Column alignment fixes after the netatalk addition. 1997-04-07 03:04:24 +00:00
christos c3a7122e73 - netatalk additions
- printf format fixes
- minor prototype cleanups
1997-04-03 04:46:44 +00:00
thorpej 87ca1d62e0 Print Ethernet and FDDI addresses in the same format as ether_ntoa().
From Matt Thomas <matt@3am-software.com>
1997-03-26 01:49:44 +00:00
mycroft 19d55000f7 Get the byte-swapping right in netmask(). 1997-03-18 03:40:10 +00:00
jonathan f0f7e53290 Add compiled-in MCLBYTES and MSIZE to conf/param.c, as 'mclbytes" and "msize".
Add code to netstat to use libkvm to for kernel variables "mclbytes"
and "msize', and if found, use those for netstat -m rather than
compiled-in defaults.
1997-02-28 00:14:19 +00:00
mikel 5ca01fc0a4 Don't assume that sun_path in sockaddr_un is null-terminated; final fix by
Noriyuki Soda <soda@sra.co.jp>.  fixes part of PR 3035.
1997-02-27 05:41:19 +00:00
mellon 8040aaffba ns_print: fix type conflict 1997-01-02 08:06:24 +00:00
mellon 9209b257a5 ns_print: undo bogus type conflict 1997-01-02 08:04:26 +00:00
mellon d8671bd736 Lite2 Merge 1997-01-02 08:00:55 +00:00
neil 36139c4647 errors not generated 'cuz old message was icmp -> [EWW!]
errors not generated because old message was icmp
1996-12-09 12:48:37 +00:00
thorpej 2ea1f6b673 Add the `toolong' count to the IP stats display. 1996-10-25 07:41:35 +00:00
explorer 3f3e868348 use %lu, not %u. This covers more than my original %d -> %u change... 1996-10-08 01:18:10 +00:00
explorer 3d7986bab5 Netstat -s should use %u for u_long parameters... Closes bin/2817 by me 1996-10-07 18:42:25 +00:00